slight refactoring in MessageAdapter

This commit is contained in:
Daniel Gultsch 2017-09-27 10:21:00 +02:00
parent a95fe08780
commit acd4b149f5
1 changed files with 3 additions and 7 deletions

View File

@ -108,7 +108,7 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie
} }
}; };
private ConversationActivity activity; private final ConversationActivity activity;
private DisplayMetrics metrics; private DisplayMetrics metrics;
@ -669,8 +669,7 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie
viewHolder.load_more_messages = (Button) view.findViewById(R.id.load_more_messages); viewHolder.load_more_messages = (Button) view.findViewById(R.id.load_more_messages);
break; break;
default: default:
viewHolder = null; throw new AssertionError("Unknown view type");
break;
} }
if (viewHolder.messageBody != null) { if (viewHolder.messageBody != null) {
listSelectionManager.onCreate(viewHolder.messageBody, listSelectionManager.onCreate(viewHolder.messageBody,
@ -790,9 +789,7 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie
} }
} else { } else {
displayInfoMessage(viewHolder,activity.getString(R.string.install_openkeychain),darkBackground); 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 @Override
public void onClick(View v) { public void onClick(View v) {
@ -800,7 +797,6 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie
} }
}); });
} }
}
} else if (message.getEncryption() == Message.ENCRYPTION_DECRYPTION_FAILED) { } else if (message.getEncryption() == Message.ENCRYPTION_DECRYPTION_FAILED) {
displayDecryptionFailed(viewHolder,darkBackground); displayDecryptionFailed(viewHolder,darkBackground);
} else { } else {