mirror of
https://github.com/mihonapp/mihon.git
synced 2025-06-30 04:57:50 +02:00
Avoid crash when changing spinner indeterminate state
This commit is contained in:
@ -43,14 +43,11 @@ class ChapterDownloadView @JvmOverloads constructor(context: Context, attrs: Att
|
||||
isAnimating = false
|
||||
}
|
||||
|
||||
binding.downloadProgress.isVisible = state == Download.State.DOWNLOADING || state == Download.State.QUEUE
|
||||
// Spinner when queued
|
||||
val isDownloading = state == Download.State.DOWNLOADING || (state == Download.State.QUEUE && progress > 0)
|
||||
binding.downloadProgress.isIndeterminate = !isDownloading
|
||||
// Actual progress when downloading or partially downloaded
|
||||
if (isDownloading) {
|
||||
binding.downloadProgress.progress = progress
|
||||
}
|
||||
binding.downloadQueued.isVisible = state == Download.State.QUEUE
|
||||
|
||||
binding.downloadProgress.isVisible = state == Download.State.DOWNLOADING ||
|
||||
(state == Download.State.QUEUE && progress > 0)
|
||||
binding.downloadProgress.progress = progress
|
||||
|
||||
binding.downloadedIcon.isVisible = state == Download.State.DOWNLOADED
|
||||
|
||||
|
Reference in New Issue
Block a user