pull/32/head
kunfei 5 years ago
parent 9a03cbb024
commit 3f92a05dc3
  1. 1
      app/src/main/java/io/legado/app/ui/booksource/GroupManageDialog.kt
  2. 7
      app/src/main/java/io/legado/app/utils/MenuExtensions.kt

@ -62,6 +62,7 @@ class GroupManageDialog : DialogFragment(), Toolbar.OnMenuItemClickListener {
private fun initData() {
tool_bar.title = getString(R.string.group_manage)
tool_bar.inflateMenu(R.menu.group_manage)
tool_bar.menu.applyTint(requireContext(), false)
tool_bar.setOnMenuItemClickListener(this)
adapter = GroupAdapter(requireContext(), this)
recycler_view.layoutManager = LinearLayoutManager(requireContext())

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

Loading…
Cancel
Save