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:
Soitora
2021-09-02 23:57:54 +02:00
committed by GitHub
parent 0e26abf7a6
commit d935e22f0d
7 changed files with 64 additions and 8 deletions

View File

@ -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)