hide the event notification if the edit screen opens in any way

This commit is contained in:
tibbi 2018-09-10 12:22:08 +02:00
parent 984769a438
commit 012ceeb5d3
2 changed files with 3 additions and 2 deletions

View File

@ -89,6 +89,8 @@ class EventActivity : SimpleActivity() {
if (intent.getBooleanExtra(IS_DUPLICATE_INTENT, false)) {
mEvent.id = 0
}
cancelNotification(mEvent.id)
} else {
mEvent = Event()
mReminder1Minutes = config.defaultReminderMinutes

View File

@ -119,8 +119,7 @@ fun Context.scheduleEventIn(notifTS: Long, event: Event, activity: SimpleActivit
}
fun Context.cancelNotification(id: Int) {
val intent = Intent(applicationContext, NotificationReceiver::class.java)
PendingIntent.getBroadcast(applicationContext, id, intent, PendingIntent.FLAG_UPDATE_CURRENT).cancel()
(getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager).cancel(id)
}
private fun getNotificationIntent(context: Context, event: Event): PendingIntent {