Add icons for notification list

This commit is contained in:
neslihanturan 2017-12-20 20:53:30 +03:00
parent 76ee338a20
commit 7abb530207
6 changed files with 56 additions and 27 deletions

View file

@ -12,11 +12,11 @@ public class NotificationController {
public static List<Notification> loadNotifications() {
List<Notification> notifications = new ArrayList<>();
notifications.add(new Notification(Notification.NotificationType.message, "notification 1"));
notifications.add(new Notification(Notification.NotificationType.message, "notification 2"));
notifications.add(new Notification(Notification.NotificationType.message, "notification 3"));
notifications.add(new Notification(Notification.NotificationType.edit, "notification 2"));
notifications.add(new Notification(Notification.NotificationType.mention, "notification 3"));
notifications.add(new Notification(Notification.NotificationType.message, "notification 4"));
notifications.add(new Notification(Notification.NotificationType.message, "notification 5"));
notifications.add(new Notification(Notification.NotificationType.message, "notification 6"));
notifications.add(new Notification(Notification.NotificationType.edit, "notification 5"));
notifications.add(new Notification(Notification.NotificationType.mention, "notification 6"));
notifications.add(new Notification(Notification.NotificationType.message, "notification 7"));
return notifications;
}

View file

@ -17,12 +17,10 @@ import fr.free.nrw.commons.R;
*/
public class NotificationRenderer extends Renderer<Notification> {
@BindView(R.id.tvName)
TextView tvName;
@BindView(R.id.tvDesc) TextView tvDesc;
@BindView(R.id.distance) TextView distance;
@BindView(R.id.icon)
ImageView icon;
@BindView(R.id.title) TextView title;
@BindView(R.id.description) TextView description;
@BindView(R.id.time) TextView time;
@BindView(R.id.icon) ImageView icon;
private NotificationClicked listener;
@ -48,16 +46,19 @@ public class NotificationRenderer extends Renderer<Notification> {
@Override
public void render() {
Notification notification = getContent();
tvName.setText(notification.notificationText);
title.setText(notification.notificationText);
time.setText("3d");
description.setText("Example notification description");
switch (notification.notificationType) {
case edit:
icon.setImageResource(R.drawable.round_icon_unknown);
icon.setImageResource(R.drawable.ic_edit_black_24dp);
break;
case message:
icon.setImageResource(R.drawable.round_icon_unknown);
icon.setImageResource(R.drawable.ic_message_black_24dp);
break;
case mention:
icon.setImageResource(R.drawable.round_icon_unknown);
case block:
icon.setImageResource(R.drawable.round_icon_unknown);
icon.setImageResource(R.drawable.ic_chat_bubble_black_24px);
break;
default:
icon.setImageResource(R.drawable.round_icon_unknown);
}