use the event title and description at the event notification

This commit is contained in:
tibbi 2017-01-26 21:59:35 +01:00
parent 86fd2f6fac
commit 28e1b06703

View File

@ -32,8 +32,7 @@ class NotificationReceiver : BroadcastReceiver() {
val pendingIntent = getPendingIntent(context, event) val pendingIntent = getPendingIntent(context, event)
val startTime = Formatter.getTimeFromTS(context, event.startTS) val startTime = Formatter.getTimeFromTS(context, event.startTS)
val endTime = Formatter.getTimeFromTS(context, event.endTS) val endTime = Formatter.getTimeFromTS(context, event.endTS)
val title = event.title val notification = getNotification(context, pendingIntent, event.title, "${getEventTime(startTime, endTime)} ${event.description}")
val notification = getNotification(context, pendingIntent, "${getEventTime(startTime, endTime)} $title")
notificationManager.notify(id, notification) notificationManager.notify(id, notification)
if (event.repeatInterval != 0) if (event.repeatInterval != 0)
@ -48,10 +47,10 @@ class NotificationReceiver : BroadcastReceiver() {
return PendingIntent.getActivity(context, event.id, intent, PendingIntent.FLAG_UPDATE_CURRENT) return PendingIntent.getActivity(context, event.id, intent, PendingIntent.FLAG_UPDATE_CURRENT)
} }
private fun getNotification(context: Context, pendingIntent: PendingIntent, content: String): Notification { private fun getNotification(context: Context, pendingIntent: PendingIntent, title: String, content: String): Notification {
val soundUri = Uri.parse(context.config.reminderSound) val soundUri = Uri.parse(context.config.reminderSound)
val builder = Notification.Builder(context) val builder = Notification.Builder(context)
.setContentTitle(context.resources.getString(R.string.app_name)) .setContentTitle(title)
.setContentText(content) .setContentText(content)
.setSmallIcon(R.drawable.ic_calendar) .setSmallIcon(R.drawable.ic_calendar)
.setContentIntent(pendingIntent) .setContentIntent(pendingIntent)