Add error state to chapter download icons
This commit is contained in:
parent
8f98055e9e
commit
01ff3af63f
3 changed files with 22 additions and 4 deletions
|
@ -19,11 +19,16 @@ class ChapterDownloadView @JvmOverloads constructor(context: Context, attrs: Att
|
|||
}
|
||||
|
||||
fun setState(state: Download.State) {
|
||||
binding.downloadIconBorder.isVisible = state == Download.State.NOT_DOWNLOADED || state == Download.State.ERROR
|
||||
binding.downloadIconBorder.isVisible = state == Download.State.NOT_DOWNLOADED
|
||||
binding.downloadIcon.isVisible = state == Download.State.NOT_DOWNLOADED || state == Download.State.DOWNLOADING
|
||||
|
||||
binding.downloadProgress.isVisible = state == Download.State.DOWNLOADING || state == Download.State.QUEUE
|
||||
// TODO: show actual download progress
|
||||
|
||||
binding.downloadedIcon.isVisible = state == Download.State.DOWNLOADED
|
||||
|
||||
binding.errorIcon.isVisible = state == Download.State.ERROR
|
||||
}
|
||||
|
||||
// TODO: onClick actions
|
||||
}
|
||||
|
|
9
app/src/main/res/drawable/ic_error_outline_24dp.xml
Normal file
9
app/src/main/res/drawable/ic_error_outline_24dp.xml
Normal file
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M11,15h2v2h-2zM11,7h2v6h-2zM11.99,2C6.47,2 2,6.48 2,12s4.47,10 9.99,10C17.52,22 22,17.52 22,12S17.52,2 11.99,2zM12,20c-4.42,0 -8,-3.58 -8,-8s3.58,-8 8,-8 8,3.58 8,8 -3.58,8 -8,8z" />
|
||||
</vector>
|
|
@ -43,8 +43,12 @@
|
|||
app:tint="@color/material_on_surface_emphasis_medium"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
<!-- chapter_error -->
|
||||
|
||||
<!-- chapter_queued-->
|
||||
<ImageView
|
||||
android:id="@+id/error_icon"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:srcCompat="@drawable/ic_error_outline_24dp"
|
||||
app:tint="?attr/colorError"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
</FrameLayout>
|
||||
|
|
Reference in a new issue