pull/1391/head
gedoor 3 years ago
parent e380f883c1
commit 3cf798b132
  1. 4
      app/src/main/java/io/legado/app/ui/rss/read/ReadRssActivity.kt
  2. 2
      app/src/main/java/io/legado/app/utils/DrawableUtils.kt
  3. 4
      app/src/main/java/io/legado/app/utils/MenuExtensions.kt

@ -217,7 +217,7 @@ class ReadRssActivity : VMBaseActivity<ActivityRssReadBinding, ReadRssViewModel>
starMenuItem?.setIcon(R.drawable.ic_star_border)
starMenuItem?.setTitle(R.string.out_favorites)
}
starMenuItem?.icon?.setTint(primaryTextColor)
starMenuItem?.icon?.setTintMutate(primaryTextColor)
}
override fun upTtsMenu(isPlaying: Boolean) {
@ -229,7 +229,7 @@ class ReadRssActivity : VMBaseActivity<ActivityRssReadBinding, ReadRssViewModel>
ttsMenuItem?.setIcon(R.drawable.ic_volume_up)
ttsMenuItem?.setTitle(R.string.read_aloud)
}
ttsMenuItem?.icon?.setTint(primaryTextColor)
ttsMenuItem?.icon?.setTintMutate(primaryTextColor)
}
}

@ -42,7 +42,7 @@ fun Drawable.setTintList(
DrawableCompat.setTintList(wrappedDrawable, tint)
}
fun Drawable.setTint(
fun Drawable.setTintMutate(
@ColorInt tint: Int,
tintMode: PorterDuff.Mode = PorterDuff.Mode.SRC_ATOP
) {

@ -22,7 +22,7 @@ fun Menu.applyTint(context: Context, theme: Theme = Theme.Auto): Menu = this.let
menu.forEach { item ->
(item as MenuItemImpl).let { impl ->
//overflow:展开的item
impl.icon.setTint(
impl.icon?.setTintMutate(
if (impl.requiresOverflow()) defaultTextColor else tintColor
)
}
@ -44,7 +44,7 @@ fun Menu.applyOpenTint(context: Context) {
if (menuItems is ArrayList<*>) {
for (menuItem in menuItems) {
if (menuItem is MenuItem) {
menuItem.icon.setTint(defaultTextColor)
menuItem.icon?.setTintMutate(defaultTextColor)
}
}
}

Loading…
Cancel
Save