mirror of
https://github.com/SimpleMobileTools/Simple-Clock.git
synced 2025-06-05 22:19:17 +02:00
couple backgrounded timer related improvements
This commit is contained in:
@ -240,7 +240,7 @@ class TimerFragment : Fragment() {
|
|||||||
activity?.startActivity(this)
|
activity?.startActivity(this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (!isForegrounded) {
|
} else if (diff > 0 && !isForegrounded && isRunning) {
|
||||||
showNotification(formattedDuration)
|
showNotification(formattedDuration)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -253,8 +253,9 @@ class TimerFragment : Fragment() {
|
|||||||
val label = getString(R.string.timer)
|
val label = getString(R.string.timer)
|
||||||
val notificationManager = context!!.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
|
val notificationManager = context!!.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
|
||||||
if (isOreoPlus()) {
|
if (isOreoPlus()) {
|
||||||
val importance = NotificationManager.IMPORTANCE_DEFAULT
|
val importance = NotificationManager.IMPORTANCE_HIGH
|
||||||
NotificationChannel(channelId, label, importance).apply {
|
NotificationChannel(channelId, label, importance).apply {
|
||||||
|
setSound(null, null)
|
||||||
notificationManager.createNotificationChannel(this)
|
notificationManager.createNotificationChannel(this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -264,7 +265,8 @@ class TimerFragment : Fragment() {
|
|||||||
.setContentText(formattedDuration)
|
.setContentText(formattedDuration)
|
||||||
.setSmallIcon(R.drawable.ic_timer)
|
.setSmallIcon(R.drawable.ic_timer)
|
||||||
.setContentIntent(context!!.getOpenTimerTabIntent())
|
.setContentIntent(context!!.getOpenTimerTabIntent())
|
||||||
.setPriority(Notification.PRIORITY_DEFAULT)
|
.setPriority(Notification.PRIORITY_HIGH)
|
||||||
|
.setSound(null)
|
||||||
.setOngoing(true)
|
.setOngoing(true)
|
||||||
.setAutoCancel(true)
|
.setAutoCancel(true)
|
||||||
.setChannelId(channelId)
|
.setChannelId(channelId)
|
||||||
|
Reference in New Issue
Block a user