parent
1365d553a4
commit
6dd280205b
@ -0,0 +1,36 @@
|
||||
package eu.kanade.tachiyomi.ui.manga.chapter
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.widget.FrameLayout
|
||||
import androidx.core.view.isVisible
|
||||
import eu.kanade.tachiyomi.databinding.ChapterDownloadViewBinding
|
||||
|
||||
class ChapterDownloadView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) :
|
||||
FrameLayout(context, attrs) {
|
||||
|
||||
private val binding: ChapterDownloadViewBinding
|
||||
|
||||
init {
|
||||
binding = ChapterDownloadViewBinding.inflate(LayoutInflater.from(context), this, false)
|
||||
addView(binding.root)
|
||||
}
|
||||
|
||||
fun setState(state: State) {
|
||||
binding.downloadIconBorder.isVisible = state == State.DOWNLOAD || state == State.ERROR
|
||||
binding.downloadIcon.isVisible = state == State.DOWNLOAD || state == State.DOWNLOADING
|
||||
|
||||
binding.downloadProgress.isVisible = state == State.DOWNLOADING || state == State.QUEUED
|
||||
|
||||
binding.downloadedIcon.isVisible = state == State.DOWNLOADED
|
||||
}
|
||||
|
||||
enum class State {
|
||||
DOWNLOAD,
|
||||
QUEUED,
|
||||
DOWNLOADING,
|
||||
ERROR,
|
||||
DOWNLOADED,
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="oval"
|
||||
android:thicknessRatio="2">
|
||||
<solid android:color="@android:color/transparent" />
|
||||
<size
|
||||
android:width="25dp"
|
||||
android:height="25dp" />
|
||||
<stroke
|
||||
android:width="2dp"
|
||||
android:color="?colorAccent" />
|
||||
</shape>
|
@ -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,4H13V16L18.5,10.5L19.92,11.92L12,19.84L4.08,11.92L5.5,10.5L11,16V4Z" />
|
||||
</vector>
|
@ -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="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM10,17l-5,-5 1.41,-1.41L10,14.17l7.59,-7.59L19,8l-9,9z" />
|
||||
</vector>
|
@ -0,0 +1,50 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:background="?selectableItemBackgroundBorderless">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/download_icon_border"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:srcCompat="@drawable/border_circle"
|
||||
app:tint="@color/material_on_surface_emphasis_medium"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/download_icon"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="4dp"
|
||||
app:srcCompat="@drawable/ic_arrow_downward_24dp"
|
||||
app:tint="@color/material_on_surface_emphasis_medium"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
<com.google.android.material.progressindicator.CircularProgressIndicator
|
||||
android:id="@+id/download_progress"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:indeterminate="true"
|
||||
android:padding="0dp"
|
||||
android:visibility="gone"
|
||||
app:indicatorColor="@color/material_on_surface_emphasis_medium"
|
||||
app:indicatorInset="0dp"
|
||||
app:indicatorSize="24dp"
|
||||
app:trackThickness="2dp" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/downloaded_icon"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:srcCompat="@drawable/ic_check_circle_24dp"
|
||||
app:tint="@color/material_on_surface_emphasis_medium"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
<!-- chapter_error -->
|
||||
|
||||
<!-- chapter_queued-->
|
||||
|
||||
</FrameLayout>
|
Loading…
Reference in new issue