Filter Tag Group now matches color accent of theme

Plus tool tip for clearing filters
This commit is contained in:
Jays2Kings 2021-04-16 03:25:01 -04:00
parent 681ceccf2e
commit 388595c290
4 changed files with 28 additions and 8 deletions

View File

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

View File

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

View File

@ -15,8 +15,17 @@
<size
android:height="32dp"
android:width="32dp" />
<solid android:color="@android:color/transparent"/>
<stroke android:width="1dp" android:color="@color/app_color_primary" />
<stroke android:width="1dp" android:color="?attr/colorAccent" />
</shape>
</item>
<item android:id="@+id/bg_dim" android:alpha="0.1">
<shape
android:shape="rectangle">
<corners android:radius="16dp"/>
<size
android:height="32dp"
android:width="32dp" />
<stroke android:width="1dp" android:color="?android:attr/textColorSecondaryInverse" />
</shape>
</item>
</ripple>

View File

@ -821,6 +821,7 @@
<string name="change">Change</string>
<string name="charging">Charging</string>
<string name="clear">Clear</string>
<string name="clear_filters">Clear filters</string>
<string name="close">Close</string>
<string name="common">Common</string>
<string name="cover_of_image">Cover of manga</string>