fix some bugs

This commit is contained in:
Christian Schneppe 2020-01-26 15:48:02 +01:00
parent 954cf63162
commit 0b857a81db
No known key found for this signature in database
GPG key ID: F30B8D686B44D87E
4 changed files with 15 additions and 17 deletions

View file

@ -447,9 +447,9 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
}
protected void deleteBookmark() {
final Account account = mConversation.getAccount();
final Bookmark bookmark = mConversation.getBookmark();
try {
final Account account = mConversation.getAccount();
final Bookmark bookmark = mConversation.getBookmark();
bookmark.setConversation(null);
xmppConnectionService.deleteBookmark(account, bookmark);
} catch (Exception e) {

View file

@ -2640,7 +2640,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
}
public void updateSendButton() {
messageListAdapter.setBubbleBackgroundColor(binding.messageInputBox, activity.getThemeColor(), 0, isPrivateMessage(), true);
messageListAdapter.setBubbleBackgroundColor(binding.messageInputBox, 0, isPrivateMessage(), true);
boolean hasAttachments = mediaPreviewAdapter != null && mediaPreviewAdapter.hasAttachments();
boolean useSendButtonToIndicateStatus = activity != null && PreferenceManager.getDefaultSharedPreferences(activity).getBoolean("send_button_status", getResources().getBoolean(R.bool.send_button_status));
final Conversation c = this.conversation;

View file

@ -44,6 +44,7 @@ import com.squareup.picasso.Picasso;
import java.io.UnsupportedEncodingException;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.Locale;
import java.util.regex.Matcher;
@ -366,7 +367,6 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie
final String bodyLanguage = message.getBodyLanguage();
final String bodyLanguageInfo = bodyLanguage == null ? "" : String.format(" \u00B7 %s", bodyLanguage.toUpperCase(Locale.US));
if (message.getStatus() <= Message.STATUS_RECEIVED) {
;
if ((filesize != null) && (info != null)) {
viewHolder.time.setText(formattedTime + " \u00B7 " + filesize + " \u00B7 " + info + bodyLanguageInfo);
} else if ((filesize == null) && (info != null)) {
@ -1172,11 +1172,11 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie
viewHolder.answer_button.setVisibility(View.GONE);
}
if (isInValidSession) {
setBubbleBackgroundColor(viewHolder.message_box, activity.getThemeColor(), type, message.isPrivateMessage(), isInValidSession);
setBubbleBackgroundColor(viewHolder.message_box, type, message.isPrivateMessage(), isInValidSession);
viewHolder.encryption.setVisibility(View.GONE);
viewHolder.encryption.setTextColor(this.getMessageTextColor(darkBackground, false));
} else {
setBubbleBackgroundColor(viewHolder.message_box, activity.getThemeColor(), type, message.isPrivateMessage(), isInValidSession);
setBubbleBackgroundColor(viewHolder.message_box, type, message.isPrivateMessage(), isInValidSession);
viewHolder.encryption.setVisibility(View.VISIBLE);
viewHolder.encryption.setTextColor(this.getWarningTextColor(darkBackground));
if (omemoEncryption && !message.isTrusted()) {
@ -1188,26 +1188,23 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie
}
if (type == SENT) {
setBubbleBackgroundColor(viewHolder.message_box, activity.getThemeColor(), type, message.isPrivateMessage(), isInValidSession);
setBubbleBackgroundColor(viewHolder.message_box, type, message.isPrivateMessage(), isInValidSession);
}
displayStatus(viewHolder, message, type, darkBackground);
return view;
}
private void markFileExisting(Message message) {
Log.d(Config.LOGTAG, "Found and restored orphaned file");
message.setFileDeleted(false);
activity.xmppConnectionService.updateMessage(message, false);
}
private boolean checkFileExistence(Message message, View view, ViewHolder viewHolder) {
Rect scrollBounds = new Rect();
final Rect scrollBounds = new Rect();
view.getHitRect(scrollBounds);
if (viewHolder.messageBody.getText().equals(activity.getResources().getString(R.string.file_deleted)) && viewHolder.messageBody.getLocalVisibleRect(scrollBounds)) {
if (activity.xmppConnectionService.getFileBackend().getFile(message).exists()) {
return true;
} else {
return false;
}
if (message.isFileDeleted() && viewHolder.messageBody.getLocalVisibleRect(scrollBounds)) {
return activity.xmppConnectionService.getFileBackend().getFile(message).exists();
} else {
return false;
}
@ -1390,7 +1387,7 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie
}
}
public void setBubbleBackgroundColor(final View viewHolder, final String themeColor, final int type, final boolean isPrivateMessage, final boolean isInValidSession) {
public void setBubbleBackgroundColor(final View viewHolder, final int type, final boolean isPrivateMessage, final boolean isInValidSession) {
if (type == RECEIVED) {
if (isInValidSession) {
if (isPrivateMessage) {

View file

@ -48,7 +48,7 @@ import de.pixart.messenger.ui.SettingsActivity;
public class ThemeHelper {
public static int find(Context context) {
public static int find(final Context context) {
final SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
final Resources resources = context.getResources();
final boolean auto = sharedPreferences.getString(SettingsActivity.THEME, resources.getString(R.string.theme)).equals("auto");
@ -93,8 +93,9 @@ public class ThemeHelper {
return false;
case Configuration.UI_MODE_NIGHT_UNDEFINED:
return false;
default:
return false;
}
return false;
}
public static int findDialog(Context context) {