mirror of
https://github.com/gedoor/legado.git
synced 2024-09-01 09:34:25 +08:00
优化
This commit is contained in:
parent
e380f883c1
commit
3cf798b132
@ -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…
Reference in New Issue
Block a user