hide timer notification at Reset or play/pause toggle too

This commit is contained in:
tibbi 2018-03-12 17:54:53 +01:00
parent 256c686a03
commit a542775a84

View File

@ -141,6 +141,7 @@ class TimerFragment : Fragment() {
private fun togglePlayPause() {
isRunning = !isRunning
updateIcons()
hideTimerNotification()
if (isRunning) {
updateHandler.post(updateRunnable)
@ -165,6 +166,7 @@ class TimerFragment : Fragment() {
currentTicks = 0
totalTicks = 0
initialSecs = context!!.config.timerSeconds
hideTimerNotification()
updateDisplayedText()
updateIcons()
view.timer_reset.beGone()
@ -189,7 +191,7 @@ class TimerFragment : Fragment() {
notificationManager.notify(TIMER_NOTIF_ID, notification)
Handler().postDelayed({
context?.hideNotification(TIMER_NOTIF_ID)
hideTimerNotification()
}, context?.config!!.timerMaxReminderSecs * 1000L)
}
return true
@ -245,6 +247,10 @@ class TimerFragment : Fragment() {
return PendingIntent.getActivity(context, TIMER_NOTIF_ID, intent, PendingIntent.FLAG_UPDATE_CURRENT)
}
private fun hideTimerNotification() {
context?.hideNotification(TIMER_NOTIF_ID)
}
private val updateRunnable = object : Runnable {
override fun run() {
if (isRunning) {