diff options
Diffstat (limited to '')
4 files changed, 15 insertions, 17 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java b/src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java index ccb9a5e50..d99c37d5b 100644 --- a/src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java +++ b/src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java @@ -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) { diff --git a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java index 2e8e50ecb..997f67d29 100644 --- a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java +++ b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java @@ -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; diff --git a/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java b/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java index d6f04f718..79157b413 100644 --- a/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java +++ b/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java @@ -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) { diff --git a/src/main/java/de/pixart/messenger/utils/ThemeHelper.java b/src/main/java/de/pixart/messenger/utils/ThemeHelper.java index 9a326b638..874e73998 100644 --- a/src/main/java/de/pixart/messenger/utils/ThemeHelper.java +++ b/src/main/java/de/pixart/messenger/utils/ThemeHelper.java @@ -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) { |