mirror of
https://github.com/aniyomiorg/aniyomi.git
synced 2024-11-28 17:19:00 +03:00
fix pause button duplication
This commit is contained in:
parent
283576336a
commit
64d737433f
1 changed files with 13 additions and 10 deletions
|
@ -1,5 +1,6 @@
|
||||||
package eu.kanade.tachiyomi.data.download.anime
|
package eu.kanade.tachiyomi.data.download.anime
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint
|
||||||
import android.app.PendingIntent
|
import android.app.PendingIntent
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.graphics.BitmapFactory
|
import android.graphics.BitmapFactory
|
||||||
|
@ -77,6 +78,7 @@ internal class AnimeDownloadNotifier(private val context: Context) {
|
||||||
*
|
*
|
||||||
* @param download download object containing download information.
|
* @param download download object containing download information.
|
||||||
*/
|
*/
|
||||||
|
@SuppressLint("RestrictedApi")
|
||||||
fun onProgressChange(download: AnimeDownload) {
|
fun onProgressChange(download: AnimeDownload) {
|
||||||
val notificationId = download.episode.id.hashCode()
|
val notificationId = download.episode.id.hashCode()
|
||||||
|
|
||||||
|
@ -112,18 +114,19 @@ internal class AnimeDownloadNotifier(private val context: Context) {
|
||||||
}
|
}
|
||||||
setOngoing(true)
|
setOngoing(true)
|
||||||
|
|
||||||
|
show(notificationId)
|
||||||
|
}
|
||||||
|
|
||||||
// Add pause action if not already added
|
// Add pause action if not already added
|
||||||
if (!paused) {
|
val pauseActionAdded = progressNotificationBuilder.mActions.any { it.icon == R.drawable.ic_pause_24dp }
|
||||||
addAction(
|
if (!paused && !pauseActionAdded) {
|
||||||
|
progressNotificationBuilder.addAction(
|
||||||
R.drawable.ic_pause_24dp,
|
R.drawable.ic_pause_24dp,
|
||||||
context.getString(R.string.action_pause),
|
context.getString(R.string.action_pause),
|
||||||
NotificationReceiver.pauseAnimeDownloadsPendingBroadcast(context),
|
NotificationReceiver.pauseAnimeDownloadsPendingBroadcast(context),
|
||||||
)
|
)
|
||||||
paused = true
|
paused = true
|
||||||
}
|
}
|
||||||
|
|
||||||
show(notificationId)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue