From 7abb530207df4cf97a119e0a9cf15146708ff8aa Mon Sep 17 00:00:00 2001 From: neslihanturan Date: Wed, 20 Dec 2017 20:53:30 +0300 Subject: [PATCH] Add icons for notification list --- .../notification/NotificationController.java | 8 +++--- .../notification/NotificationRenderer.java | 25 ++++++++++--------- .../drawable/ic_chat_bubble_black_24px.xml | 9 +++++++ .../main/res/drawable/ic_edit_black_24dp.xml | 9 +++++++ .../res/drawable/ic_message_black_24dp.xml | 9 +++++++ app/src/main/res/layout/item_notification.xml | 23 +++++++++-------- 6 files changed, 56 insertions(+), 27 deletions(-) create mode 100644 app/src/main/res/drawable/ic_chat_bubble_black_24px.xml create mode 100644 app/src/main/res/drawable/ic_edit_black_24dp.xml create mode 100644 app/src/main/res/drawable/ic_message_black_24dp.xml diff --git a/app/src/main/java/fr/free/nrw/commons/notification/NotificationController.java b/app/src/main/java/fr/free/nrw/commons/notification/NotificationController.java index 94e2e3612..84f5c15d8 100644 --- a/app/src/main/java/fr/free/nrw/commons/notification/NotificationController.java +++ b/app/src/main/java/fr/free/nrw/commons/notification/NotificationController.java @@ -12,11 +12,11 @@ public class NotificationController { public static List loadNotifications() { List 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; } diff --git a/app/src/main/java/fr/free/nrw/commons/notification/NotificationRenderer.java b/app/src/main/java/fr/free/nrw/commons/notification/NotificationRenderer.java index 201d00ff4..36272d4a2 100644 --- a/app/src/main/java/fr/free/nrw/commons/notification/NotificationRenderer.java +++ b/app/src/main/java/fr/free/nrw/commons/notification/NotificationRenderer.java @@ -17,12 +17,10 @@ import fr.free.nrw.commons.R; */ public class NotificationRenderer extends Renderer { - @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 { @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); } diff --git a/app/src/main/res/drawable/ic_chat_bubble_black_24px.xml b/app/src/main/res/drawable/ic_chat_bubble_black_24px.xml new file mode 100644 index 000000000..8d40c6d63 --- /dev/null +++ b/app/src/main/res/drawable/ic_chat_bubble_black_24px.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/ic_edit_black_24dp.xml b/app/src/main/res/drawable/ic_edit_black_24dp.xml new file mode 100644 index 000000000..2ab2fb753 --- /dev/null +++ b/app/src/main/res/drawable/ic_edit_black_24dp.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/ic_message_black_24dp.xml b/app/src/main/res/drawable/ic_message_black_24dp.xml new file mode 100644 index 000000000..d2876bfad --- /dev/null +++ b/app/src/main/res/drawable/ic_message_black_24dp.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/layout/item_notification.xml b/app/src/main/res/layout/item_notification.xml index bd4833d97..d8f4dd8d4 100644 --- a/app/src/main/res/layout/item_notification.xml +++ b/app/src/main/res/layout/item_notification.xml @@ -18,10 +18,11 @@ android:contentDescription="@string/no_image_found" android:scaleType="centerCrop" android:src="@drawable/empty_photo" + android:tint="@color/primaryDarkColor" />