aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2018-04-29 13:29:06 +0200
committerChristian Schneppe <christian@pix-art.de>2018-04-29 13:29:06 +0200
commit8cf430a7ba6c6c45b3b5a18ece512b62bd276619 (patch)
tree5c6db10fdbe69e47985b9565de5e20c7184bd0c0 /src/main/java/de/pixart/messenger
parent74f0efc4fdcf7b96d3a7a6da4fea874485ff85d4 (diff)
make text clickable in openkeychain missing message
Diffstat (limited to 'src/main/java/de/pixart/messenger')
-rw-r--r--src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java33
1 files changed, 16 insertions, 17 deletions
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 1b343aa67..4cdce8aca 100644
--- a/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java
+++ b/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java
@@ -411,19 +411,6 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie
viewHolder.messageBody.setTextIsSelectable(false);
}
- private void displayDecryptionFailed(ViewHolder viewHolder, boolean darkBackground) {
- viewHolder.download_button.setVisibility(View.GONE);
- viewHolder.image.setVisibility(View.GONE);
- viewHolder.audioPlayer.setVisibility(View.GONE);
- viewHolder.messageBody.setVisibility(View.VISIBLE);
- if (darkBackground) {
- viewHolder.messageBody.setTextAppearance(getContext(), R.style.TextAppearance_Conversations_Body1_Secondary_OnDark);
- } else {
- viewHolder.messageBody.setTextAppearance(getContext(), R.style.TextAppearance_Conversations_Body1_Secondary);
- }
- viewHolder.messageBody.setTextIsSelectable(false);
- }
-
private void displayEmojiMessage(final ViewHolder viewHolder, final String body, final boolean darkBackground) {
viewHolder.download_button.setVisibility(View.GONE);
viewHolder.audioPlayer.setVisibility(View.GONE);
@@ -915,8 +902,9 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie
loadAvatar(message, viewHolder.contact_picture, activity.getPixel(48));
}
- viewHolder.contact_picture
- .setOnClickListener(v -> {
+ resetClickListener(viewHolder.message_box, viewHolder.messageBody);
+
+ viewHolder.contact_picture.setOnClickListener(v -> {
if (MessageAdapter.this.mOnContactPictureClickedListener != null) {
MessageAdapter.this.mOnContactPictureClickedListener
.onContactPictureClicked(message);
@@ -962,10 +950,11 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie
}
} else {
displayInfoMessage(viewHolder, activity.getString(R.string.install_openkeychain), darkBackground);
- viewHolder.message_box.setOnClickListener(v -> activity.showInstallPgpDialog());
+ viewHolder.message_box.setOnClickListener(this::promptOpenKeychainInstall);
+ viewHolder.messageBody.setOnClickListener(this::promptOpenKeychainInstall);
}
} else if (message.getEncryption() == Message.ENCRYPTION_DECRYPTION_FAILED) {
- displayDecryptionFailed(viewHolder, darkBackground);
+ displayInfoMessage(viewHolder, activity.getString(R.string.decryption_failed), darkBackground);
} else if (message.getEncryption() == Message.ENCRYPTION_AXOLOTL_NOT_FOR_THIS_DEVICE) {
displayInfoMessage(viewHolder, activity.getString(R.string.not_encrypted_for_this_device), darkBackground);
} else {
@@ -1019,6 +1008,16 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie
return view;
}
+ private static void resetClickListener(View... views) {
+ for (View view : views) {
+ view.setOnClickListener(null);
+ }
+ }
+
+ private void promptOpenKeychainInstall(View view) {
+ activity.showInstallPgpDialog();
+ }
+
@Override
public void notifyDataSetChanged() {
listSelectionManager.onBeforeNotifyDataSetChanged();