Move filter icon tint color to resources

This commit is contained in:
arkon 2020-03-15 11:01:30 -04:00
parent a6c1de1cb2
commit e77db309b8
4 changed files with 10 additions and 3 deletions

View File

@ -3,7 +3,6 @@ package eu.kanade.tachiyomi.ui.library
import android.app.Activity
import android.content.Intent
import android.content.res.Configuration
import android.graphics.Color
import android.net.Uri
import android.os.Bundle
import android.view.LayoutInflater
@ -39,6 +38,7 @@ import eu.kanade.tachiyomi.ui.base.controller.TabbedController
import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction
import eu.kanade.tachiyomi.ui.main.MainActivity
import eu.kanade.tachiyomi.ui.manga.MangaController
import eu.kanade.tachiyomi.util.system.getResourceColor
import eu.kanade.tachiyomi.util.system.toast
import eu.kanade.tachiyomi.util.view.inflate
import java.io.IOException
@ -367,8 +367,10 @@ class LibraryController(
val filterItem = menu.findItem(R.id.action_filter)
// Tint icon if there's a filter active
val filterColor = if (navView.hasActiveFilters()) Color.rgb(255, 238, 7) else Color.WHITE
DrawableCompat.setTint(filterItem.icon, filterColor)
if (navView.hasActiveFilters()) {
val filterColor = activity!!.getResourceColor(R.attr.colorFilterActive)
DrawableCompat.setTint(filterItem.icon, filterColor)
}
// Display submenu
if (preferences.libraryAsList().getOrDefault()) {

View File

@ -21,6 +21,7 @@
</declare-styleable>
<attr name="selectable_library_drawable" format="reference|integer"/>
<attr name="colorFilterActive" format="reference|integer"/>
<attr name="colorBackgroundSplash" format="reference|integer"/>
</resources>

View File

@ -38,6 +38,8 @@
<color name="pageNumberBackgroundLight">@color/md_grey_50_75</color>
<color name="pageNumberBackgroundDark">@color/md_grey_900_75</color>
<color name="filterColor">#FFEE07</color>
<!-- Text Colors -->
<color name="md_black_1000_87">#DE000000</color>
<color name="md_black_1000_54">#8A000000</color>

View File

@ -58,6 +58,7 @@
<!-- Custom Attributes-->
<item name="selectable_library_drawable">@drawable/library_item_selector_light</item>
<item name="colorFilterActive">@color/filterColor</item>
</style>
<!--===========-->
@ -122,6 +123,7 @@
<!-- Custom Attributes-->
<item name="selectable_library_drawable">@drawable/library_item_selector_dark</item>
<item name="colorFilterActive">@color/filterColor</item>
</style>
<style name="Theme.Tachiyomi.Dark" parent="Theme.Base.Dark">