Improve download notifications

This commit is contained in:
Koitharu
2023-05-08 19:25:34 +03:00
parent 25e7ab2d8e
commit 235b02870b
2 changed files with 10 additions and 2 deletions

View File

@@ -101,8 +101,13 @@ class DownloadNotificationFactory @AssistedInject constructor(
}
suspend fun create(state: DownloadState?): Notification = mutex.withLock {
builder.setContentTitle(state?.manga?.title ?: context.getString(R.string.preparing_))
builder.setContentText(context.getString(R.string.manga_downloading_))
if (state == null) {
builder.setContentTitle(context.getString(R.string.manga_downloading_))
builder.setContentText(context.getString(R.string.preparing_))
} else {
builder.setContentTitle(state.manga.title)
builder.setContentText(context.getString(R.string.manga_downloading_))
}
builder.setProgress(1, 0, true)
builder.setSmallIcon(android.R.drawable.stat_sys_download)
builder.setContentIntent(queueIntent)

View File

@@ -19,6 +19,9 @@ class TimeLeftEstimator {
emptyTick()
return
}
if (lastTick?.value == value) {
return
}
val tick = Tick(value, total, SystemClock.elapsedRealtime())
lastTick?.let {
val ticksCount = value - it.value