diff options
author | steckbrief <steckbrief@chefmail.de> | 2017-01-05 20:17:12 +0100 |
---|---|---|
committer | steckbrief <steckbrief@chefmail.de> | 2017-01-05 20:17:12 +0100 |
commit | c9ae205490bc644e01fb38611406b4f91c4d2f6b (patch) | |
tree | 3ca307f2fe81974b97c9710efcb977fa076ab906 /src/main/java | |
parent | 28676d3048eaf52260101cf6390c12479192e892 (diff) | |
parent | 93c3c723a9f7411087125b802badd788484ee6fb (diff) |
Merge remote-tracking branch 'origin/trz/rename' into trz/rebase
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java | 33 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java | 13 |
2 files changed, 19 insertions, 27 deletions
diff --git a/src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java index 4ea7d7cf..317dcc78 100644 --- a/src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java +++ b/src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java @@ -69,6 +69,7 @@ public class ConversationAdapter extends ArrayAdapter<Conversation> { TextView mTimestamp = (TextView) view.findViewById(R.id.conversation_lastupdate); ImageView imagePreview = (ImageView) view.findViewById(R.id.conversation_lastimage); ImageView notificationStatus = (ImageView) view.findViewById(R.id.notification_status); + TextView txtUnreadCount = (TextView) view.findViewById(R.id.conversation_unreadcount); if (Settings.SHOW_ONLINE_STATUS) { int color = ConversationsPlusColors.offline(); @@ -85,11 +86,15 @@ public class ConversationAdapter extends ArrayAdapter<Conversation> { Message message = conversation.getLatestMessage(); + int txtUnreadCountVisibility = View.INVISIBLE; if (!conversation.isRead()) { convName.setTypeface(null, Typeface.BOLD); + txtUnreadCountVisibility = View.VISIBLE; + txtUnreadCount.setText(String.valueOf(conversation.unreadCount())); } else { convName.setTypeface(null, Typeface.NORMAL); } + txtUnreadCount.setVisibility(txtUnreadCountVisibility); if ((null != message.getFileParams() && message.getFileParams().getWidth() > 0) // TODO: Use FileParams.getMimeType() && (message.getTransferable() == null @@ -113,20 +118,20 @@ public class ConversationAdapter extends ArrayAdapter<Conversation> { } String lastMessagePreview = ((null == msgPrefix || msgPrefix.isEmpty()) ? "" : (msgPrefix + ": ")) + msgText; mLastMessage.setText(lastMessagePreview); - if (preview.second) { - if (conversation.isRead()) { - mLastMessage.setTypeface(null, Typeface.ITALIC); - } else { - mLastMessage.setTypeface(null,Typeface.BOLD_ITALIC); - } - } else { - if (conversation.isRead()) { - mLastMessage.setTypeface(null,Typeface.NORMAL); - } else { - mLastMessage.setTypeface(null,Typeface.BOLD); - } - } - } + int lastMessageTypeface = Typeface.NORMAL; + if (conversation.isRead()) { + if (preview.second) { + lastMessageTypeface = Typeface.ITALIC; + } + } else { + if (preview.second) { + lastMessageTypeface = Typeface.BOLD_ITALIC; + } else { + lastMessageTypeface = Typeface.BOLD; + } + } + mLastMessage.setTypeface(null, lastMessageTypeface); + } long muted_till = conversation.getLongAttribute(Conversation.ATTRIBUTE_MUTED_TILL,0); if (muted_till == Long.MAX_VALUE) { 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 d562dd5e..0e0e086f 100644 --- a/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java +++ b/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java @@ -76,15 +76,6 @@ public class MessageAdapter extends ArrayAdapter<Message> { private OnContactPictureClicked mOnContactPictureClickedListener; private OnContactPictureLongClicked mOnContactPictureLongClickedListener; - private OnLongClickListener openContextMenu = new OnLongClickListener() { - - @Override - public boolean onLongClick(View v) { - v.showContextMenu(); - return true; - } - }; - public MessageAdapter(ConversationActivity activity, List<Message> messages) { super(activity, 0, messages); this.activity = activity; @@ -376,7 +367,6 @@ public class MessageAdapter extends ArrayAdapter<Message> { } viewHolder.messageBody.setTextColor(this.getMessageTextColor(darkBackground, true)); viewHolder.messageBody.setTypeface(null, Typeface.NORMAL); - viewHolder.messageBody.setOnLongClickListener(openContextMenu); } /** @@ -454,7 +444,6 @@ public class MessageAdapter extends ArrayAdapter<Message> { openDownloadable(message); } }); - viewHolder.download_button.setOnLongClickListener(openContextMenu); } private void displayLocationMessage(ViewHolder viewHolder, final Message message) { @@ -469,7 +458,6 @@ public class MessageAdapter extends ArrayAdapter<Message> { showLocation(message); } }); - viewHolder.download_button.setOnLongClickListener(openContextMenu); } private void displayImageMessage(ViewHolder viewHolder, @@ -504,7 +492,6 @@ public class MessageAdapter extends ArrayAdapter<Message> { openDownloadable(message); } }); - viewHolder.image.setOnLongClickListener(openContextMenu); } private View displayStatusMessage(final Message message, ViewHolder viewHolder) { |