diff --git a/app/src/main/java/com/nextcloud/talk/adapters/items/ConversationItem.java b/app/src/main/java/com/nextcloud/talk/adapters/items/ConversationItem.java index 0de0a2413..f87a7bcc7 100644 --- a/app/src/main/java/com/nextcloud/talk/adapters/items/ConversationItem.java +++ b/app/src/main/java/com/nextcloud/talk/adapters/items/ConversationItem.java @@ -199,7 +199,7 @@ public class ConversationItem extends AbstractFlexibleItem @Override public void bindViewHolder(FlexibleAdapter adapter, UserItemViewHolder holder, int position, List payloads) { - holder.participantAvatar.setController(null); + if (holder.participantAvatar != null) { + holder.participantAvatar.setController(null); + } if (holder.checkedImageView != null) { if (participant.isSelected()) { @@ -134,37 +136,7 @@ public class UserItem extends AbstractFlexibleItem } } - if (holder.statusMessage != null && holder.participantEmoji != null && holder.userStatusImage != null) { - float size = DisplayUtils.convertDpToPixel(STATUS_SIZE_IN_DP, context); - holder.userStatusImage.setImageDrawable(new StatusDrawable( - participant.status, - NO_ICON, - size, - context.getResources().getColor(R.color.bg_default), - context)); - - if (participant.statusMessage != null) { - holder.statusMessage.setText(participant.statusMessage); - } else { - holder.statusMessage.setText(""); - } - - if (participant.statusIcon != null && !participant.statusIcon.isEmpty()) { - holder.participantEmoji.setText(participant.statusIcon); - } else { - holder.participantEmoji.setVisibility(View.GONE); - } - - if (participant.status != null && participant.status.equals(StatusType.DND.getString())) { - if (participant.statusMessage == null || participant.statusMessage.isEmpty()) { - holder.statusMessage.setText(R.string.dnd); - } - } else if (participant.status != null && participant.status.equals(StatusType.AWAY.getString())) { - if (participant.statusMessage == null || participant.statusMessage.isEmpty()) { - holder.statusMessage.setText(R.string.away); - } - } - } + drawStatus(holder); if (!isOnline) { holder.contactDisplayName.setTextColor(ResourcesCompat.getColor( @@ -294,6 +266,40 @@ public class UserItem extends AbstractFlexibleItem } } + private void drawStatus(UserItemViewHolder holder) { + if (holder.statusMessage != null && holder.participantEmoji != null && holder.userStatusImage != null) { + float size = DisplayUtils.convertDpToPixel(STATUS_SIZE_IN_DP, context); + holder.userStatusImage.setImageDrawable(new StatusDrawable( + participant.status, + NO_ICON, + size, + context.getResources().getColor(R.color.bg_default), + context)); + + if (participant.statusMessage != null) { + holder.statusMessage.setText(participant.statusMessage); + } else { + holder.statusMessage.setText(""); + } + + if (participant.statusIcon != null && !participant.statusIcon.isEmpty()) { + holder.participantEmoji.setText(participant.statusIcon); + } else { + holder.participantEmoji.setVisibility(View.GONE); + } + + if (participant.status != null && participant.status.equals(StatusType.DND.getString())) { + if (participant.statusMessage == null || participant.statusMessage.isEmpty()) { + holder.statusMessage.setText(R.string.dnd); + } + } else if (participant.status != null && participant.status.equals(StatusType.AWAY.getString())) { + if (participant.statusMessage == null || participant.statusMessage.isEmpty()) { + holder.statusMessage.setText(R.string.away); + } + } + } + } + @Override public boolean filter(String constraint) { return participant.getDisplayName() != null && diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 128e1c338..0cc93d084 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -459,7 +459,6 @@ Favorite Status Encrypted - Password protected Avatar Account icon