From 7191552126b514fee5a882072b4ad445136b4584 Mon Sep 17 00:00:00 2001 From: arkon Date: Fri, 5 Feb 2021 23:13:57 -0500 Subject: [PATCH] Avoid crash when changing spinner indeterminate state --- .../ui/manga/chapter/ChapterDownloadView.kt | 13 +++++-------- app/src/main/res/layout/chapter_download_view.xml | 11 +++++++++++ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChapterDownloadView.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChapterDownloadView.kt index 755b71f123..d66d0910e8 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChapterDownloadView.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChapterDownloadView.kt @@ -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 diff --git a/app/src/main/res/layout/chapter_download_view.xml b/app/src/main/res/layout/chapter_download_view.xml index cd03bd953d..a0d90c7900 100644 --- a/app/src/main/res/layout/chapter_download_view.xml +++ b/app/src/main/res/layout/chapter_download_view.xml @@ -31,6 +31,17 @@ android:id="@+id/download_progress" android:layout_width="match_parent" android:layout_height="match_parent" + android:padding="1dp" + android:visibility="gone" + app:indicatorColor="?android:attr/textColorHint" + app:indicatorInset="0dp" + app:indicatorSize="24dp" + app:trackThickness="2dp" /> + +