mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-10 12:47:26 +01:00
Use proper method to clear notification actions
This commit is contained in:
parent
db2dd4b6c6
commit
cf7ec6aa76
@ -68,9 +68,7 @@ class BackupNotifier(private val context: Context) {
|
|||||||
setContentText(unifile.filePath ?: unifile.name)
|
setContentText(unifile.filePath ?: unifile.name)
|
||||||
|
|
||||||
// Clear old actions if they exist
|
// Clear old actions if they exist
|
||||||
if (mActions.isNotEmpty()) {
|
clearActions()
|
||||||
mActions.clear()
|
|
||||||
}
|
|
||||||
|
|
||||||
addAction(
|
addAction(
|
||||||
R.drawable.ic_share_24dp,
|
R.drawable.ic_share_24dp,
|
||||||
@ -94,9 +92,7 @@ class BackupNotifier(private val context: Context) {
|
|||||||
setOnlyAlertOnce(true)
|
setOnlyAlertOnce(true)
|
||||||
|
|
||||||
// Clear old actions if they exist
|
// Clear old actions if they exist
|
||||||
if (mActions.isNotEmpty()) {
|
clearActions()
|
||||||
mActions.clear()
|
|
||||||
}
|
|
||||||
|
|
||||||
addAction(
|
addAction(
|
||||||
R.drawable.ic_close_24dp,
|
R.drawable.ic_close_24dp,
|
||||||
@ -137,9 +133,7 @@ class BackupNotifier(private val context: Context) {
|
|||||||
setContentText(context.resources.getQuantityString(R.plurals.restore_completed_message, errorCount, timeString, errorCount))
|
setContentText(context.resources.getQuantityString(R.plurals.restore_completed_message, errorCount, timeString, errorCount))
|
||||||
|
|
||||||
// Clear old actions if they exist
|
// Clear old actions if they exist
|
||||||
if (mActions.isNotEmpty()) {
|
clearActions()
|
||||||
mActions.clear()
|
|
||||||
}
|
|
||||||
|
|
||||||
if (errorCount > 0 && !path.isNullOrEmpty() && !file.isNullOrEmpty()) {
|
if (errorCount > 0 && !path.isNullOrEmpty() && !file.isNullOrEmpty()) {
|
||||||
val destFile = File(path, file)
|
val destFile = File(path, file)
|
||||||
|
@ -66,15 +66,6 @@ internal class DownloadNotifier(private val context: Context) {
|
|||||||
context.notificationManager.notify(id, build())
|
context.notificationManager.notify(id, build())
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Clear old actions if they exist.
|
|
||||||
*/
|
|
||||||
private fun NotificationCompat.Builder.clearActions() {
|
|
||||||
if (mActions.isNotEmpty()) {
|
|
||||||
mActions.clear()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dismiss the downloader's notification. Downloader error notifications use a different id, so
|
* Dismiss the downloader's notification. Downloader error notifications use a different id, so
|
||||||
* those can only be dismissed by the user.
|
* those can only be dismissed by the user.
|
||||||
|
@ -60,9 +60,7 @@ class SaveImageNotifier(private val context: Context) {
|
|||||||
setAutoCancel(true)
|
setAutoCancel(true)
|
||||||
|
|
||||||
// Clear old actions if they exist
|
// Clear old actions if they exist
|
||||||
if (mActions.isNotEmpty()) {
|
clearActions()
|
||||||
mActions.clear()
|
|
||||||
}
|
|
||||||
|
|
||||||
setContentIntent(NotificationHandler.openImagePendingActivity(context, file))
|
setContentIntent(NotificationHandler.openImagePendingActivity(context, file))
|
||||||
// Share action
|
// Share action
|
||||||
|
Loading…
Reference in New Issue
Block a user