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() { public static List<Notification> loadNotifications() {
List<Notification> notifications = new ArrayList<>(); List<Notification> notifications = new ArrayList<>();
notifications.add(new Notification(Notification.NotificationType.message, "notification 1")); notifications.add(new Notification(Notification.NotificationType.message, "notification 1"));
notifications.add(new Notification(Notification.NotificationType.message, "notification 2")); notifications.add(new Notification(Notification.NotificationType.edit, "notification 2"));
notifications.add(new Notification(Notification.NotificationType.message, "notification 3")); 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 4"));
notifications.add(new Notification(Notification.NotificationType.message, "notification 5")); notifications.add(new Notification(Notification.NotificationType.edit, "notification 5"));
notifications.add(new Notification(Notification.NotificationType.message, "notification 6")); notifications.add(new Notification(Notification.NotificationType.mention, "notification 6"));
notifications.add(new Notification(Notification.NotificationType.message, "notification 7")); notifications.add(new Notification(Notification.NotificationType.message, "notification 7"));
return notifications; return notifications;
} }

View file

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

View file

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:pathData="M4,2C2.9,2 2,2.9 2,4L2,22L6,18L20,18C21.1,18 22,17.1 22,16L22,4C22,2.9 21.1,2 20,2L4,2zM12.496,4.098C13.408,4.098 14.236,4.273 14.98,4.623C15.725,4.969 16.347,5.47 16.848,6.125C17.153,6.524 17.384,6.956 17.539,7.424C17.698,7.888 17.775,8.376 17.775,8.889C17.775,9.991 17.444,10.849 16.781,11.459C16.118,12.069 15.183,12.375 13.975,12.375L13.736,12.375L13.736,11.434C13.614,11.722 13.417,11.949 13.145,12.111C12.876,12.27 12.559,12.35 12.197,12.35C11.497,12.35 10.928,12.098 10.488,11.594C10.053,11.085 9.836,10.423 9.836,9.609C9.836,8.796 10.055,8.134 10.494,7.625C10.934,7.116 11.501,6.863 12.197,6.863C12.559,6.863 12.876,6.945 13.145,7.107C13.417,7.27 13.614,7.496 13.736,7.785L13.736,6.984L15.012,6.984L15.012,11.215C15.516,11.138 15.912,10.895 16.201,10.488C16.49,10.077 16.635,9.553 16.635,8.914C16.635,8.507 16.575,8.125 16.457,7.771C16.339,7.413 16.16,7.086 15.92,6.789C15.533,6.293 15.051,5.911 14.469,5.643C13.891,5.374 13.263,5.238 12.588,5.238C12.116,5.238 11.664,5.302 11.232,5.428C10.801,5.55 10.403,5.731 10.037,5.971C9.435,6.369 8.965,6.887 8.627,7.521C8.293,8.152 8.127,8.836 8.127,9.572C8.127,10.179 8.234,10.748 8.449,11.281C8.669,11.81 8.986,12.279 9.396,12.686C9.803,13.084 10.268,13.388 10.793,13.596C11.322,13.807 11.886,13.912 12.484,13.912C12.997,13.912 13.511,13.816 14.023,13.625C14.536,13.434 14.972,13.175 15.334,12.85L15.258,14.324C14.96,14.491 14.648,14.63 14.322,14.742C13.724,14.954 13.115,15.061 12.496,15.061C11.743,15.061 11.035,14.925 10.367,14.656C9.7,14.392 9.105,14.007 8.584,13.498C8.063,12.989 7.667,12.4 7.395,11.732C7.122,11.061 6.984,10.341 6.984,9.572C6.984,8.832 7.124,8.126 7.4,7.455C7.677,6.784 8.071,6.194 8.584,5.686C9.097,5.181 9.694,4.79 10.373,4.514C11.057,4.237 11.764,4.098 12.496,4.098zM12.412,7.998C12.054,7.998 11.766,8.143 11.551,8.432C11.339,8.716 11.232,9.105 11.232,9.598C11.232,10.098 11.339,10.492 11.551,10.781C11.766,11.07 12.058,11.215 12.424,11.215C12.786,11.215 13.075,11.07 13.291,10.781C13.507,10.488 13.613,10.094 13.613,9.598C13.613,9.105 13.503,8.716 13.283,8.432C13.068,8.143 12.778,7.998 12.412,7.998z"
android:fillColor="#000000"/>
</vector>

View file

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M3,17.25V21h3.75L17.81,9.94l-3.75,-3.75L3,17.25zM20.71,7.04c0.39,-0.39 0.39,-1.02 0,-1.41l-2.34,-2.34c-0.39,-0.39 -1.02,-0.39 -1.41,0l-1.83,1.83 3.75,3.75 1.83,-1.83z"/>
</vector>

View file

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M20,2L4,2c-1.1,0 -1.99,0.9 -1.99,2L2,22l4,-4h14c1.1,0 2,-0.9 2,-2L22,4c0,-1.1 -0.9,-2 -2,-2zM18,14L6,14v-2h12v2zM18,11L6,11L6,9h12v2zM18,8L6,8L6,6h12v2z"/>
</vector>

View file

@ -18,10 +18,11 @@
android:contentDescription="@string/no_image_found" android:contentDescription="@string/no_image_found"
android:scaleType="centerCrop" android:scaleType="centerCrop"
android:src="@drawable/empty_photo" android:src="@drawable/empty_photo"
android:tint="@color/primaryDarkColor"
/> />
<TextView <TextView
android:id="@+id/distance" android:id="@+id/time"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
@ -34,16 +35,16 @@
/> />
<TextView <TextView
android:id="@+id/tvName" android:id="@+id/title"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignTop="@id/distance" android:layout_alignTop="@id/time"
android:layout_marginLeft="16dp" android:layout_marginLeft="16dp"
android:layout_marginStart="16dp" android:layout_marginStart="16dp"
android:layout_toEndOf="@id/icon" android:layout_toEndOf="@id/icon"
android:layout_toLeftOf="@id/distance" android:layout_toLeftOf="@id/time"
android:layout_toRightOf="@id/icon" android:layout_toRightOf="@id/icon"
android:layout_toStartOf="@id/distance" android:layout_toStartOf="@id/time"
android:ellipsize="end" android:ellipsize="end"
android:maxLines="2" android:maxLines="2"
android:textAppearance="@style/TextAppearance.AppCompat.Body2" android:textAppearance="@style/TextAppearance.AppCompat.Body2"
@ -51,14 +52,14 @@
/> />
<TextView <TextView
android:id="@+id/tvDesc" android:id="@+id/description"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignEnd="@id/distance" android:layout_alignEnd="@id/time"
android:layout_alignLeft="@id/tvName" android:layout_alignLeft="@id/title"
android:layout_alignRight="@id/distance" android:layout_alignRight="@id/time"
android:layout_alignStart="@id/tvName" android:layout_alignStart="@id/title"
android:layout_below="@id/tvName" android:layout_below="@id/title"
android:layout_marginBottom="16dp" android:layout_marginBottom="16dp"
android:ellipsize="end" android:ellipsize="end"
android:maxLines="4" android:maxLines="4"