Add date with year parameter to Notification class, because we will use it on comparasion of dates

This commit is contained in:
neslihanturan 2018-09-10 18:50:41 +03:00
parent 0ef52659b3
commit a759741c86
2 changed files with 12 additions and 2 deletions

View file

@ -11,13 +11,15 @@ public class Notification {
public String description; public String description;
public String link; public String link;
public String iconUrl; public String iconUrl;
public String dateWithYear;
public Notification(NotificationType notificationType, String notificationText, String date, String description, String link, String iconUrl) { public Notification(NotificationType notificationType, String notificationText, String date, String description, String link, String iconUrl, String dateWithYear) {
this.notificationType = notificationType; this.notificationType = notificationType;
this.notificationText = notificationText; this.notificationText = notificationText;
this.date = date; this.date = date;
this.description = description; this.description = description;
this.link = link; this.link = link;
this.iconUrl = iconUrl; this.iconUrl = iconUrl;
this.dateWithYear = dateWithYear;
} }
} }

View file

@ -144,7 +144,7 @@ public class NotificationUtils {
notificationText = getWelcomeMessage(context, document); notificationText = getWelcomeMessage(context, document);
break; break;
} }
return new Notification(type, notificationText, getTimestamp(document), description, link, iconUrl); return new Notification(type, notificationText, getTimestamp(document), description, link, iconUrl, getTimestampWithYear(document));
} }
private static String getNotificationText(Node document) { private static String getNotificationText(Node document) {
@ -247,6 +247,14 @@ public class NotificationUtils {
return ""; return "";
} }
private static String getTimestampWithYear(Node document) {
Element timestampElement = (Element) getNode(document, "timestamp");
if (timestampElement != null) {
return timestampElement.getAttribute("utcunix");
}
return "";
}
private static String getNotificationDescription(Node document) { private static String getNotificationDescription(Node document) {
Element titleElement = (Element) getNode(document, "title"); Element titleElement = (Element) getNode(document, "title");
if (titleElement != null) { if (titleElement != null) {