diff options
author | Christian Schneppe <christian@pix-art.de> | 2017-10-06 22:13:43 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2017-10-06 22:13:43 +0200 |
commit | 61c3a688a9f267fc5786084bf3cf6805d3491eb7 (patch) | |
tree | 7756f0e8d85978ece7ed49db66e1189534a61194 /src/main/java/de/pixart/messenger | |
parent | c18f61522e0e1afe892daffc3176a9922c115110 (diff) |
slight refactoring in MessageAdapter
Diffstat (limited to 'src/main/java/de/pixart/messenger')
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java | 23 |
1 files changed, 9 insertions, 14 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 7245a977d..c3693c24b 100644 --- a/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java +++ b/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java @@ -118,7 +118,7 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie } }; - private ConversationActivity activity; + private final ConversationActivity activity; private DisplayMetrics metrics; @@ -815,9 +815,7 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie viewHolder.load_more_messages = (Button) view.findViewById(R.id.load_more_messages); break; default: - view = new View(getContext()); - viewHolder = null; - break; + throw new AssertionError("Unknown view type"); } if (viewHolder.messageBody != null) { listSelectionManager.onCreate(viewHolder.messageBody, new MessageBodyActionModeCallback(viewHolder.messageBody)); @@ -913,16 +911,13 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie } } else { displayInfoMessage(viewHolder, activity.getString(R.string.install_openkeychain), darkBackground); - if (viewHolder != null) { - viewHolder.message_box - .setOnClickListener(new OnClickListener() { - - @Override - public void onClick(View v) { - activity.showInstallPgpDialog(); - } - }); - } + viewHolder.message_box.setOnClickListener(new OnClickListener() { + + @Override + public void onClick(View v) { + activity.showInstallPgpDialog(); + } + }); } } else if (message.getEncryption() == Message.ENCRYPTION_DECRYPTION_FAILED) { displayDecryptionFailed(viewHolder, darkBackground); |