From d935e22f0df88d59e6e527cbc3db5dd7d908df35 Mon Sep 17 00:00:00 2001 From: Soitora Date: Thu, 2 Sep 2021 23:57:54 +0200 Subject: [PATCH] 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 --- .../ui/manga/info/MangaInfoHeaderAdapter.kt | 18 ++++++++++-------- .../res/drawable/ic_status_completed_24dp.xml | 9 +++++++++ .../res/drawable/ic_status_licensed_24dp.xml | 9 +++++++++ .../res/drawable/ic_status_ongoing_24dp.xml | 9 +++++++++ .../res/drawable/ic_status_unknown_24dp.xml | 9 +++++++++ .../res/layout-sw720dp/manga_info_header.xml | 9 +++++++++ app/src/main/res/layout/manga_info_header.xml | 9 +++++++++ 7 files changed, 64 insertions(+), 8 deletions(-) create mode 100644 app/src/main/res/drawable/ic_status_completed_24dp.xml create mode 100644 app/src/main/res/drawable/ic_status_licensed_24dp.xml create mode 100644 app/src/main/res/drawable/ic_status_ongoing_24dp.xml create mode 100644 app/src/main/res/drawable/ic_status_unknown_24dp.xml diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoHeaderAdapter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoHeaderAdapter.kt index eaea7093ec..d6d4930e20 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoHeaderAdapter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoHeaderAdapter.kt @@ -270,15 +270,17 @@ class MangaInfoHeaderAdapter( } } - // Update status TextView. - binding.mangaStatus.setText( - when (manga.status) { - SManga.ONGOING -> R.string.ongoing - SManga.COMPLETED -> R.string.completed - SManga.LICENSED -> R.string.licensed - else -> R.string.unknown_status + // Update manga status. + binding.apply { + val (statusDrawable, statusString) = when (manga.status) { + SManga.ONGOING -> R.drawable.ic_status_ongoing_24dp to R.string.ongoing + SManga.COMPLETED -> R.drawable.ic_status_completed_24dp to R.string.completed + SManga.LICENSED -> R.drawable.ic_status_licensed_24dp to R.string.licensed + 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. setFavoriteButtonState(manga.favorite) diff --git a/app/src/main/res/drawable/ic_status_completed_24dp.xml b/app/src/main/res/drawable/ic_status_completed_24dp.xml new file mode 100644 index 0000000000..2e24134794 --- /dev/null +++ b/app/src/main/res/drawable/ic_status_completed_24dp.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/ic_status_licensed_24dp.xml b/app/src/main/res/drawable/ic_status_licensed_24dp.xml new file mode 100644 index 0000000000..ba6217217e --- /dev/null +++ b/app/src/main/res/drawable/ic_status_licensed_24dp.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/ic_status_ongoing_24dp.xml b/app/src/main/res/drawable/ic_status_ongoing_24dp.xml new file mode 100644 index 0000000000..feebf134fe --- /dev/null +++ b/app/src/main/res/drawable/ic_status_ongoing_24dp.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/ic_status_unknown_24dp.xml b/app/src/main/res/drawable/ic_status_unknown_24dp.xml new file mode 100644 index 0000000000..7fa2fa53e4 --- /dev/null +++ b/app/src/main/res/drawable/ic_status_unknown_24dp.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/layout-sw720dp/manga_info_header.xml b/app/src/main/res/layout-sw720dp/manga_info_header.xml index 782d0086a2..271d8227dd 100644 --- a/app/src/main/res/layout-sw720dp/manga_info_header.xml +++ b/app/src/main/res/layout-sw720dp/manga_info_header.xml @@ -95,6 +95,15 @@ android:layout_width="wrap_content" android:layout_height="wrap_content"> + + + +