mirror of
https://github.com/aniyomiorg/aniyomi.git
synced 2024-11-27 16:26:29 +03:00
Avoid crash when changing spinner indeterminate state
This commit is contained in:
parent
cfa07490e5
commit
7191552126
2 changed files with 16 additions and 8 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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" />
|
||||
|
||||
<com.google.android.material.progressindicator.CircularProgressIndicator
|
||||
android:id="@+id/download_queued"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:indeterminate="true"
|
||||
android:padding="1dp"
|
||||
android:visibility="gone"
|
||||
|
|
Loading…
Reference in a new issue