From 3f92a05dc3af767da8747835514853363b75f89d Mon Sep 17 00:00:00 2001 From: kunfei Date: Mon, 2 Sep 2019 10:09:26 +0800 Subject: [PATCH] up --- .../java/io/legado/app/ui/booksource/GroupManageDialog.kt | 1 + app/src/main/java/io/legado/app/utils/MenuExtensions.kt | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/booksource/GroupManageDialog.kt b/app/src/main/java/io/legado/app/ui/booksource/GroupManageDialog.kt index ad5643a3a..7ffff5b8f 100644 --- a/app/src/main/java/io/legado/app/ui/booksource/GroupManageDialog.kt +++ b/app/src/main/java/io/legado/app/ui/booksource/GroupManageDialog.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()) diff --git a/app/src/main/java/io/legado/app/utils/MenuExtensions.kt b/app/src/main/java/io/legado/app/utils/MenuExtensions.kt index 21eeae968..d4b55caaa 100644 --- a/app/src/main/java/io/legado/app/utils/MenuExtensions.kt +++ b/app/src/main/java/io/legado/app/utils/MenuExtensions.kt @@ -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 ) } }