mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-17 15:19:15 +01:00
Add status icons to manga info (#5832)
* Add icons to manga status * Slightly better formatting Mixed in with a dose of syntactic sugar * Remove unnecessary lines I think they are, at least * Change according to review comments - Fix forgotten Tablet code removal - Change 'android:background' to 'app:srcCompat' * Adjust size of icon Smaller and more fitting to the environment
This commit is contained in:
parent
0e26abf7a6
commit
d935e22f0d
@ -270,15 +270,17 @@ class MangaInfoHeaderAdapter(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update status TextView.
|
// Update manga status.
|
||||||
binding.mangaStatus.setText(
|
binding.apply {
|
||||||
when (manga.status) {
|
val (statusDrawable, statusString) = when (manga.status) {
|
||||||
SManga.ONGOING -> R.string.ongoing
|
SManga.ONGOING -> R.drawable.ic_status_ongoing_24dp to R.string.ongoing
|
||||||
SManga.COMPLETED -> R.string.completed
|
SManga.COMPLETED -> R.drawable.ic_status_completed_24dp to R.string.completed
|
||||||
SManga.LICENSED -> R.string.licensed
|
SManga.LICENSED -> R.drawable.ic_status_licensed_24dp to R.string.licensed
|
||||||
else -> R.string.unknown_status
|
else -> R.drawable.ic_status_unknown_24dp to R.string.unknown
|
||||||
}
|
}
|
||||||
)
|
mangaStatusIcon.setImageResource(statusDrawable)
|
||||||
|
mangaStatus.setText(statusString)
|
||||||
|
}
|
||||||
|
|
||||||
// Set the favorite drawable to the correct one.
|
// Set the favorite drawable to the correct one.
|
||||||
setFavoriteButtonState(manga.favorite)
|
setFavoriteButtonState(manga.favorite)
|
||||||
|
9
app/src/main/res/drawable/ic_status_completed_24dp.xml
Normal file
9
app/src/main/res/drawable/ic_status_completed_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="@android:color/white"
|
||||||
|
android:pathData="M18,7l-1.41,-1.41 -6.34,6.34 1.41,1.41L18,7zM22.24,5.59L11.66,16.17 7.48,12l-1.41,1.41L11.66,19l12,-12 -1.42,-1.41zM0.41,13.41L6,19l1.41,-1.41L1.83,12 0.41,13.41z" />
|
||||||
|
</vector>
|
9
app/src/main/res/drawable/ic_status_licensed_24dp.xml
Normal file
9
app/src/main/res/drawable/ic_status_licensed_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="@android:color/white"
|
||||||
|
android:pathData="M11.8,10.9c-2.27,-0.59 -3,-1.2 -3,-2.15 0,-1.09 1.01,-1.85 2.7,-1.85 1.78,0 2.44,0.85 2.5,2.1h2.21c-0.07,-1.72 -1.12,-3.3 -3.21,-3.81V3h-3v2.16c-1.94,0.42 -3.5,1.68 -3.5,3.61 0,2.31 1.91,3.46 4.7,4.13 2.5,0.6 3,1.48 3,2.41 0,0.69 -0.49,1.79 -2.7,1.79 -2.06,0 -2.87,-0.92 -2.98,-2.1h-2.2c0.12,2.19 1.76,3.42 3.68,3.83V21h3v-2.15c1.95,-0.37 3.5,-1.5 3.5,-3.55 0,-2.84 -2.43,-3.81 -4.7,-4.4z" />
|
||||||
|
</vector>
|
9
app/src/main/res/drawable/ic_status_ongoing_24dp.xml
Normal file
9
app/src/main/res/drawable/ic_status_ongoing_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="@android:color/white"
|
||||||
|
android:pathData="M11.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,8zM12.5,7L11,7v6l5.25,3.15 0.75,-1.23 -4.5,-2.67z" />
|
||||||
|
</vector>
|
9
app/src/main/res/drawable/ic_status_unknown_24dp.xml
Normal file
9
app/src/main/res/drawable/ic_status_unknown_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="@android:color/white"
|
||||||
|
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,20c-4.42,0 -8,-3.58 -8,-8 0,-1.85 0.63,-3.55 1.69,-4.9L16.9,18.31C15.55,19.37 13.85,20 12,20zM18.31,16.9L7.1,5.69C8.45,4.63 10.15,4 12,4c4.42,0 8,3.58 8,8 0,1.85 -0.63,3.55 -1.69,4.9z" />
|
||||||
|
</vector>
|
@ -95,6 +95,15 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/manga_status_icon"
|
||||||
|
android:layout_width="16dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginEnd="4dp"
|
||||||
|
app:srcCompat="@drawable/ic_status_unknown_24dp"
|
||||||
|
app:tint="?android:attr/textColorSecondary"
|
||||||
|
tools:ignore="ContentDescription" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/manga_status"
|
android:id="@+id/manga_status"
|
||||||
style="@style/TextAppearance.Regular.Body1.Secondary"
|
style="@style/TextAppearance.Regular.Body1.Secondary"
|
||||||
|
@ -104,6 +104,15 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="4dp">
|
android:layout_marginTop="4dp">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/manga_status_icon"
|
||||||
|
android:layout_width="16dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginEnd="4dp"
|
||||||
|
app:srcCompat="@drawable/ic_status_unknown_24dp"
|
||||||
|
app:tint="?android:attr/textColorSecondary"
|
||||||
|
tools:ignore="ContentDescription" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/manga_status"
|
android:id="@+id/manga_status"
|
||||||
style="@style/TextAppearance.Regular.Body1.Secondary"
|
style="@style/TextAppearance.Regular.Body1.Secondary"
|
||||||
|
Loading…
Reference in New Issue
Block a user