From 6009b4fe25c54ac1139f9d338e1375346b74a076 Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 14 Oct 2016 23:47:10 +0200 Subject: [PATCH] do not display a time range at the notif at events without end time --- .../calendar/receivers/NotificationReceiver.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/simplemobiletools/calendar/receivers/NotificationReceiver.java b/app/src/main/java/com/simplemobiletools/calendar/receivers/NotificationReceiver.java index 45c858434..2d383535e 100644 --- a/app/src/main/java/com/simplemobiletools/calendar/receivers/NotificationReceiver.java +++ b/app/src/main/java/com/simplemobiletools/calendar/receivers/NotificationReceiver.java @@ -34,13 +34,17 @@ public class NotificationReceiver extends BroadcastReceiver { final String startTime = Formatter.getTime(event.getStartTS()); final String endTime = Formatter.getTime(event.getEndTS()); final String title = event.getTitle(); - final Notification notification = getNotification(context, pendingIntent, startTime + " - " + endTime + " " + title); + final Notification notification = getNotification(context, pendingIntent, getEventTime(startTime, endTime) + " " + title); notificationManager.notify(id, notification); if (event.getRepeatInterval() != 0) Utils.scheduleNextEvent(context, event); } + private String getEventTime(String startTime, String endTime) { + return startTime.equals(endTime) ? startTime : (startTime + " - " + endTime); + } + private PendingIntent getPendingIntent(Context context, Event event) { final Intent intent = new Intent(context, EventActivity.class); intent.putExtra(Constants.EVENT, event);