diff --git a/app/src/main/java/io/legado/app/ui/main/myconfig/MyConfigFragment.kt b/app/src/main/java/io/legado/app/ui/main/myconfig/MyConfigFragment.kt index 45ca2ee4f..2d431297d 100644 --- a/app/src/main/java/io/legado/app/ui/main/myconfig/MyConfigFragment.kt +++ b/app/src/main/java/io/legado/app/ui/main/myconfig/MyConfigFragment.kt @@ -4,9 +4,17 @@ import android.os.Bundle import android.util.Log import android.view.MenuItem import android.view.View +import androidx.appcompat.view.menu.MenuBuilder +import androidx.appcompat.view.menu.MenuItemImpl import androidx.appcompat.widget.Toolbar +import androidx.core.view.forEach import androidx.fragment.app.Fragment import io.legado.app.R +import io.legado.app.lib.theme.ColorUtils +import io.legado.app.lib.theme.DrawableUtils +import io.legado.app.lib.theme.ThemeStore +import io.legado.app.lib.theme.getPrimaryTextColor +import io.legado.app.utils.getCompatColor import kotlinx.android.synthetic.main.view_titlebar.* class MyConfigFragment : Fragment(R.layout.fragment_my_config), Toolbar.OnMenuItemClickListener { @@ -15,6 +23,24 @@ class MyConfigFragment : Fragment(R.layout.fragment_my_config), Toolbar.OnMenuIt super.onViewCreated(view, savedInstanceState) Log.e("TAG", "MyConfigFragment") toolbar.inflateMenu(R.menu.my_config) + toolbar.menu?.let { + if (it is MenuBuilder) { + it.setOptionalIconsVisible(true) + } + context?.let { context -> + val primaryTextColor = getPrimaryTextColor(ColorUtils.isColorLight(ThemeStore.primaryColor(context))) + val defaultTextColor = getCompatColor(R.color.tv_text_default) + it.forEach { item -> + (item as MenuItemImpl).let { impl -> + //overflow:展开的item + DrawableUtils.setTint( + impl.icon, + if (impl.requiresOverflow()) defaultTextColor else primaryTextColor + ) + } + } + } + } toolbar.setOnMenuItemClickListener(this) } diff --git a/app/src/main/java/io/legado/app/utils/MenuExtensions.kt b/app/src/main/java/io/legado/app/utils/MenuExtensions.kt new file mode 100644 index 000000000..656da42d1 --- /dev/null +++ b/app/src/main/java/io/legado/app/utils/MenuExtensions.kt @@ -0,0 +1,2 @@ +package io.legado.app.utils + diff --git a/app/src/main/res/drawable/ic_live_help_black_24dp.xml b/app/src/main/res/drawable/ic_live_help_black_24dp.xml new file mode 100644 index 000000000..74f549430 --- /dev/null +++ b/app/src/main/res/drawable/ic_live_help_black_24dp.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/menu/bookshelf.xml b/app/src/main/res/menu/bookshelf.xml index 8c69ffa8e..6a7f00e90 100644 --- a/app/src/main/res/menu/bookshelf.xml +++ b/app/src/main/res/menu/bookshelf.xml @@ -3,9 +3,9 @@ xmlns:app="http://schemas.android.com/apk/res-auto"> + app:showAsAction="always"/> - + - diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 8fd365498..9f1a444a3 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -469,4 +469,5 @@ 清空发现缓存 编辑发现 切换软件显示在桌面的图标 + 帮助