From 388595c290e5d68741dae452c2940142930999d2 Mon Sep 17 00:00:00 2001 From: Jays2Kings Date: Fri, 16 Apr 2021 03:25:01 -0400 Subject: [PATCH] Filter Tag Group now matches color accent of theme Plus tool tip for clearing filters --- .../ui/library/filter/FilterBottomSheet.kt | 2 ++ .../ui/library/filter/FilterTagGroup.kt | 20 +++++++++++++------ .../res/drawable/round_textview_border.xml | 13 ++++++++++-- app/src/main/res/values/strings.xml | 1 + 4 files changed, 28 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/filter/FilterBottomSheet.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/filter/FilterBottomSheet.kt index 3840e55167..8169189148 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/filter/FilterBottomSheet.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/filter/FilterBottomSheet.kt @@ -21,6 +21,7 @@ import eu.kanade.tachiyomi.util.system.dpToPx import eu.kanade.tachiyomi.util.system.launchUI import eu.kanade.tachiyomi.util.view.activityBinding import eu.kanade.tachiyomi.util.view.collapse +import eu.kanade.tachiyomi.util.view.compatToolTipText import eu.kanade.tachiyomi.util.view.hide import eu.kanade.tachiyomi.util.view.inflate import eu.kanade.tachiyomi.util.view.isExpanded @@ -156,6 +157,7 @@ class FilterBottomSheet @JvmOverloads constructor(context: Context, attrs: Attri createTags() clearButton.setOnClickListener { clearFilters() } + clearButton.compatToolTipText = context.getString(R.string.clear_filters) preferences.filterOrder().asFlow() .drop(1) .onEach { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/filter/FilterTagGroup.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/filter/FilterTagGroup.kt index 4d39cdc771..6553c13ff7 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/filter/FilterTagGroup.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/filter/FilterTagGroup.kt @@ -1,12 +1,12 @@ package eu.kanade.tachiyomi.ui.library.filter import android.content.Context -import android.graphics.Color import android.util.AttributeSet import android.view.View import android.view.ViewGroup import android.widget.LinearLayout import com.f2prateek.rx.preferences.Preference +import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.preference.getOrDefault import eu.kanade.tachiyomi.databinding.FilterTagGroupBinding import eu.kanade.tachiyomi.util.system.dpToPx @@ -119,10 +119,16 @@ class FilterTagGroup@JvmOverloads constructor(context: Context, attrs: Attribute if (itemCount == 1) { binding.firstButton.isActivated = !binding.firstButton.isActivated binding.firstButton.setTextColor( - if (binding.firstButton.isActivated) Color.WHITE else context - .getResourceColor(android.R.attr.textColorPrimary) + context.getResourceColor( + if (binding.firstButton.isActivated) R.attr.colorOnAccent + else android.R.attr.textColorPrimary + ) + ) + listener?.onFilterClicked( + this, + if (binding.firstButton.isActivated) index else -1, + callBack ) - listener?.onFilterClicked(this, if (binding.firstButton.isActivated) index else -1, callBack) return } val mainButton = buttons[index] @@ -145,8 +151,10 @@ class FilterTagGroup@JvmOverloads constructor(context: Context, attrs: Attribute separators.forEach { it.gone() } } mainButton.setTextColor( - if (mainButton.isActivated) Color.WHITE else context - .getResourceColor(android.R.attr.textColorPrimary) + context.getResourceColor( + if (mainButton.isActivated) R.attr.colorOnAccent + else android.R.attr.textColorPrimary + ) ) } } diff --git a/app/src/main/res/drawable/round_textview_border.xml b/app/src/main/res/drawable/round_textview_border.xml index 6dabc3b153..0c3f0cfb44 100644 --- a/app/src/main/res/drawable/round_textview_border.xml +++ b/app/src/main/res/drawable/round_textview_border.xml @@ -15,8 +15,17 @@ - - + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 4a501d33a0..7b68fa218f 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -821,6 +821,7 @@ Change Charging Clear + Clear filters Close Common Cover of manga