MessageAdapter: code cleanup

This commit is contained in:
Daniel Gultsch 2017-11-09 20:23:31 +01:00
parent 459cf09f06
commit a5c33abe88

View file

@ -623,59 +623,41 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie
switch (type) { switch (type) {
case DATE_SEPARATOR: case DATE_SEPARATOR:
view = activity.getLayoutInflater().inflate(R.layout.message_date_bubble, parent, false); view = activity.getLayoutInflater().inflate(R.layout.message_date_bubble, parent, false);
viewHolder.status_message = (TextView) view.findViewById(R.id.message_body); viewHolder.status_message = view.findViewById(R.id.message_body);
viewHolder.message_box = (LinearLayout) view.findViewById(R.id.message_box); viewHolder.message_box = view.findViewById(R.id.message_box);
break; break;
case SENT: case SENT:
view = activity.getLayoutInflater().inflate( view = activity.getLayoutInflater().inflate(R.layout.message_sent, parent, false);
R.layout.message_sent, parent, false); viewHolder.message_box = view.findViewById(R.id.message_box);
viewHolder.message_box = (LinearLayout) view viewHolder.contact_picture = view.findViewById(R.id.message_photo);
.findViewById(R.id.message_box); viewHolder.download_button = view.findViewById(R.id.download_button);
viewHolder.contact_picture = (ImageView) view viewHolder.indicator = view.findViewById(R.id.security_indicator);
.findViewById(R.id.message_photo); viewHolder.edit_indicator = view.findViewById(R.id.edit_indicator);
viewHolder.download_button = (Button) view viewHolder.image = view.findViewById(R.id.message_image);
.findViewById(R.id.download_button); viewHolder.messageBody = view.findViewById(R.id.message_body);
viewHolder.indicator = (ImageView) view viewHolder.time = view.findViewById(R.id.message_time);
.findViewById(R.id.security_indicator); viewHolder.indicatorReceived = view.findViewById(R.id.indicator_received);
viewHolder.edit_indicator = (ImageView) view.findViewById(R.id.edit_indicator); viewHolder.audioPlayer = view.findViewById(R.id.audio_player);
viewHolder.image = (ImageView) view
.findViewById(R.id.message_image);
viewHolder.messageBody = (CopyTextView) view
.findViewById(R.id.message_body);
viewHolder.time = (TextView) view
.findViewById(R.id.message_time);
viewHolder.indicatorReceived = (ImageView) view
.findViewById(R.id.indicator_received);
viewHolder.audioPlayer = (RelativeLayout) view.findViewById(R.id.audio_player);
break; break;
case RECEIVED: case RECEIVED:
view = activity.getLayoutInflater().inflate( view = activity.getLayoutInflater().inflate(R.layout.message_received, parent, false);
R.layout.message_received, parent, false); viewHolder.message_box = view.findViewById(R.id.message_box);
viewHolder.message_box = (LinearLayout) view viewHolder.contact_picture = view.findViewById(R.id.message_photo);
.findViewById(R.id.message_box); viewHolder.download_button = view.findViewById(R.id.download_button);
viewHolder.contact_picture = (ImageView) view viewHolder.indicator = view.findViewById(R.id.security_indicator);
.findViewById(R.id.message_photo); viewHolder.edit_indicator = view.findViewById(R.id.edit_indicator);
viewHolder.download_button = (Button) view viewHolder.image = view.findViewById(R.id.message_image);
.findViewById(R.id.download_button); viewHolder.messageBody = view.findViewById(R.id.message_body);
viewHolder.indicator = (ImageView) view viewHolder.time = view.findViewById(R.id.message_time);
.findViewById(R.id.security_indicator); viewHolder.indicatorReceived = view.findViewById(R.id.indicator_received);
viewHolder.edit_indicator = (ImageView) view.findViewById(R.id.edit_indicator); viewHolder.encryption = view.findViewById(R.id.message_encryption);
viewHolder.image = (ImageView) view viewHolder.audioPlayer = view.findViewById(R.id.audio_player);
.findViewById(R.id.message_image);
viewHolder.messageBody = (CopyTextView) view
.findViewById(R.id.message_body);
viewHolder.time = (TextView) view
.findViewById(R.id.message_time);
viewHolder.indicatorReceived = (ImageView) view
.findViewById(R.id.indicator_received);
viewHolder.encryption = (TextView) view.findViewById(R.id.message_encryption);
viewHolder.audioPlayer = (RelativeLayout) view.findViewById(R.id.audio_player);
break; break;
case STATUS: case STATUS:
view = activity.getLayoutInflater().inflate(R.layout.message_status, parent, false); view = activity.getLayoutInflater().inflate(R.layout.message_status, parent, false);
viewHolder.contact_picture = (ImageView) view.findViewById(R.id.message_photo); viewHolder.contact_picture = view.findViewById(R.id.message_photo);
viewHolder.status_message = (TextView) view.findViewById(R.id.status_message); viewHolder.status_message = view.findViewById(R.id.status_message);
viewHolder.load_more_messages = (Button) view.findViewById(R.id.load_more_messages); viewHolder.load_more_messages = view.findViewById(R.id.load_more_messages);
break; break;
default: default:
throw new AssertionError("Unknown view type"); throw new AssertionError("Unknown view type");