From acd4b149f515f6fd41685016896c66c9c9941e61 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Wed, 27 Sep 2017 10:21:00 +0200 Subject: [PATCH] slight refactoring in MessageAdapter --- .../siacs/conversations/ui/adapter/MessageAdapter.java | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java index 52c917a2c..a5823bbe0 100644 --- a/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java +++ b/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java @@ -108,7 +108,7 @@ public class MessageAdapter extends ArrayAdapter implements CopyTextVie } }; - private ConversationActivity activity; + private final ConversationActivity activity; private DisplayMetrics metrics; @@ -669,8 +669,7 @@ public class MessageAdapter extends ArrayAdapter implements CopyTextVie viewHolder.load_more_messages = (Button) view.findViewById(R.id.load_more_messages); break; default: - viewHolder = null; - break; + throw new AssertionError("Unknown view type"); } if (viewHolder.messageBody != null) { listSelectionManager.onCreate(viewHolder.messageBody, @@ -790,16 +789,13 @@ public class MessageAdapter extends ArrayAdapter implements CopyTextVie } } else { displayInfoMessage(viewHolder,activity.getString(R.string.install_openkeychain),darkBackground); - if (viewHolder != null) { - viewHolder.message_box - .setOnClickListener(new OnClickListener() { + 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);