Merge branch '399-contact-list-unread-messages' into 'master'

Contact List Unread Messages

Adds unread count as bubble to avatar image in contact list.

Please note that this is based on !190.

![device-2016-05-18-124534](/uploads/647dbdcff73a69eb6cf1814f85cbffe6/device-2016-05-18-124534.png)![device-2016-05-18-124339](/uploads/fa56a44f229234bb86fdebf8f9060927/device-2016-05-18-124339.png)

Closes #399

See merge request !192
This commit is contained in:
str4d
2016-05-19 03:45:13 +00:00
4 changed files with 63 additions and 18 deletions

View File

@@ -34,18 +34,13 @@ public class ContactListAdapter
ContactListItem item = getItem(position);
// name and unread count
String contactName = item.getContact().getAuthor().getName();
// unread count
int unread = item.getUnreadCount();
if (unread > 0) {
// TODO show these in a bubble on top of the avatar
ui.name.setText(contactName + " (" + unread + ")");
// different background for contacts with unread messages
ui.layout.setBackgroundColor(
ContextCompat.getColor(ctx, R.color.unread_background));
ui.unread.setText(String.valueOf(unread));
ui.unread.setVisibility(View.VISIBLE);
} else {
ui.name.setText(contactName);
ui.unread.setVisibility(View.INVISIBLE);
}
// date of last message
@@ -73,6 +68,7 @@ public class ContactListAdapter
extends BaseContactListAdapter.BaseContactHolder {
public final ImageView bulb;
public final TextView unread;
public final TextView date;
public final TextView identity;
@@ -80,6 +76,7 @@ public class ContactListAdapter
super(v);
bulb = (ImageView) v.findViewById(R.id.bulbView);
unread = (TextView) v.findViewById(R.id.unreadCountView);
date = (TextView) v.findViewById(R.id.dateView);
identity = (TextView) v.findViewById(R.id.identityView);
}