fix theming of chapter filter button on tablets

This commit is contained in:
Jays2Kings 2022-04-24 23:32:59 -04:00
parent cd59a1ffc0
commit 2cc8b64e91
3 changed files with 15 additions and 2 deletions

View file

@ -330,6 +330,10 @@ class MangaDetailsController :
private fun setItemColors() {
getHeader()?.updateColors()
if (adapter?.itemCount ?: 0 > 1) {
if (isTablet) {
val chapterHolder = binding.recycler.findViewHolderForAdapterPosition(0) as? MangaHeaderHolder
chapterHolder?.updateColors()
}
(presenter.chapters).forEach { chapter ->
val chapterHolder =
binding.recycler.findViewHolderForItemId(chapter.id!!) as? ChapterHolder

View file

@ -284,6 +284,10 @@ class MangaHeaderHolder(
chapterBinding.chaptersTitle.text =
itemView.resources.getQuantityString(R.plurals.chapters_plural, count, count)
chapterBinding.filtersText.text = presenter.currentFilters()
if (adapter.preferences.themeMangaDetails()) {
val accentColor = adapter.delegate.accentColor() ?: return
chapterBinding.filterButton.imageTintList = ColorStateList.valueOf(accentColor)
}
}
return
}
@ -534,8 +538,13 @@ class MangaHeaderHolder(
}
fun updateColors(updateAll: Boolean = true) {
binding ?: return
val accentColor = adapter.delegate.accentColor() ?: return
if (binding == null) {
if (chapterBinding != null) {
chapterBinding.filterButton.imageTintList = ColorStateList.valueOf(accentColor)
}
return
}
val manga = adapter.presenter.manga
with(binding) {
trueBackdrop.setBackgroundColor(

View file

@ -28,7 +28,7 @@
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/webview_button"
android:id="@+id/filter_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="12dp"