|
|
|
@ -7,10 +7,9 @@ import androidx.appcompat.view.menu.MenuItemImpl |
|
|
|
|
import androidx.core.view.forEach |
|
|
|
|
import io.legado.app.R |
|
|
|
|
import io.legado.app.lib.theme.DrawableUtils |
|
|
|
|
import io.legado.app.lib.theme.getPrimaryTextColor |
|
|
|
|
import io.legado.app.lib.theme.primaryTextColor |
|
|
|
|
|
|
|
|
|
fun Menu.applyTint(context: Context): Menu = this.let { menu -> |
|
|
|
|
fun Menu.applyTint(context: Context, inPrimary: Boolean = true): Menu = this.let { menu -> |
|
|
|
|
if (menu is MenuBuilder) { |
|
|
|
|
menu.setOptionalIconsVisible(true) |
|
|
|
|
} |
|
|
|
@ -21,7 +20,9 @@ fun Menu.applyTint(context: Context): Menu = this.let { menu -> |
|
|
|
|
//overflow:展开的item |
|
|
|
|
DrawableUtils.setTint( |
|
|
|
|
impl.icon, |
|
|
|
|
if (impl.requiresOverflow()) defaultTextColor else primaryTextColor |
|
|
|
|
if (!inPrimary) defaultTextColor |
|
|
|
|
else if (impl.requiresOverflow()) defaultTextColor |
|
|
|
|
else primaryTextColor |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|