From 5f97abadbd1b0725b6c459f465b5aa15d81104c8 Mon Sep 17 00:00:00 2001 From: Invinciblelee <1760316362@qq.com> Date: Tue, 4 Jun 2019 11:56:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/legado/app/base/BaseActivity.kt | 11 ++++++----- app/src/main/res/values/styles.xml | 17 +++++++++-------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/app/src/main/java/io/legado/app/base/BaseActivity.kt b/app/src/main/java/io/legado/app/base/BaseActivity.kt index 1b5f22bf6..c3be3ac14 100644 --- a/app/src/main/java/io/legado/app/base/BaseActivity.kt +++ b/app/src/main/java/io/legado/app/base/BaseActivity.kt @@ -7,6 +7,7 @@ import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.view.menu.MenuBuilder import androidx.appcompat.view.menu.MenuItemImpl import androidx.core.content.ContextCompat +import androidx.core.view.forEach import androidx.lifecycle.ViewModel import io.legado.app.R import io.legado.app.lib.theme.ColorUtils @@ -29,7 +30,7 @@ abstract class BaseActivity : AppCompatActivity() { abstract fun onViewModelCreated(viewModel: VM, savedInstanceState: Bundle?) - override fun onCreateOptionsMenu(menu: Menu?): Boolean { + final override fun onCreateOptionsMenu(menu: Menu?): Boolean { return menu?.let { if (it is MenuBuilder) { it.setOptionalIconsVisible(true) @@ -37,12 +38,12 @@ abstract class BaseActivity : AppCompatActivity() { val bool = onCompatCreateOptionsMenu(it) val primaryTextColor = getPrimaryTextColor(ColorUtils.isColorLight(ThemeStore.primaryColor(this))) val defaultTextColor = ContextCompat.getColor(this, R.color.tv_text_default) - for (i in 0 until menu.size()) { - (menu.getItem(i) as MenuItemImpl).let { item -> + menu.forEach {item -> + (item as MenuItemImpl).let { impl -> //overflow:展开的item DrawableUtils.setTint( - item.icon, - if (item.requiresOverflow()) defaultTextColor else primaryTextColor + impl.icon, + if (impl.requiresOverflow()) defaultTextColor else primaryTextColor ) } } diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 0cf68e183..15c10c068 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -76,6 +76,15 @@ @color/background_menu + + + //**************************************************************Widget Style******************************************************************************// - -