do not display a time range at the notif at events without end time

This commit is contained in:
tibbi 2016-10-14 23:47:10 +02:00
parent b8a4cccbd5
commit 6009b4fe25
1 changed files with 5 additions and 1 deletions

View File

@ -34,13 +34,17 @@ public class NotificationReceiver extends BroadcastReceiver {
final String startTime = Formatter.getTime(event.getStartTS()); final String startTime = Formatter.getTime(event.getStartTS());
final String endTime = Formatter.getTime(event.getEndTS()); final String endTime = Formatter.getTime(event.getEndTS());
final String title = event.getTitle(); 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); notificationManager.notify(id, notification);
if (event.getRepeatInterval() != 0) if (event.getRepeatInterval() != 0)
Utils.scheduleNextEvent(context, event); 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) { private PendingIntent getPendingIntent(Context context, Event event) {
final Intent intent = new Intent(context, EventActivity.class); final Intent intent = new Intent(context, EventActivity.class);
intent.putExtra(Constants.EVENT, event); intent.putExtra(Constants.EVENT, event);