fix #403, tweak some things around notifications
This commit is contained in:
parent
1aae2a6fc6
commit
1d54ea7788
|
@ -159,17 +159,15 @@ fun Context.notifyEvent(event: Event) {
|
|||
val startTime = Formatter.getTimeFromTS(applicationContext, event.startTS)
|
||||
val endTime = Formatter.getTimeFromTS(applicationContext, event.endTS)
|
||||
val startDate = Formatter.getDateFromTS(event.startTS)
|
||||
val displayedStartDate: String
|
||||
if (startDate == LocalDate.now()) {
|
||||
displayedStartDate = ""
|
||||
} else if (startDate == LocalDate.now().plusDays(1)) {
|
||||
displayedStartDate = getString(R.string.tomorrow)
|
||||
} else /* At least 2 days in the future */ {
|
||||
displayedStartDate = Formatter.getDayAndMonth(startDate)
|
||||
val displayedStartDate = when (startDate) {
|
||||
LocalDate.now() -> ""
|
||||
LocalDate.now().plusDays(1) -> getString(R.string.tomorrow)
|
||||
else -> Formatter.getDayAndMonth(startDate)
|
||||
}
|
||||
|
||||
val timeRange = if (event.getIsAllDay()) getString(R.string.all_day) else getFormattedEventTime(startTime, endTime)
|
||||
val descriptionOrLocation = if (config.replaceDescription) event.location else event.description
|
||||
val content = arrayOf(displayedStartDate, timeRange, descriptionOrLocation).joinToString(" ")
|
||||
val content = "$displayedStartDate $timeRange $descriptionOrLocation".trim()
|
||||
val notification = getNotification(applicationContext, pendingIntent, event, content)
|
||||
val notificationManager = getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
|
||||
notificationManager.notify(event.id, notification)
|
||||
|
|
Loading…
Reference in New Issue