diff --git a/app/src/main/java/info/nightscout/androidaps/MainActivity.kt b/app/src/main/java/info/nightscout/androidaps/MainActivity.kt index 484f9262ff..01e7696df7 100644 --- a/app/src/main/java/info/nightscout/androidaps/MainActivity.kt +++ b/app/src/main/java/info/nightscout/androidaps/MainActivity.kt @@ -7,6 +7,7 @@ import android.os.Bundle import android.os.PersistableBundle import android.text.SpannableString import android.text.method.LinkMovementMethod +import android.text.style.ForegroundColorSpan import android.text.util.Linkify import android.util.TypedValue import android.view.Menu @@ -116,6 +117,7 @@ class MainActivity : NoSplashAppCompatActivity() { override fun onPageSelected(position: Int) { setPluginPreferenceMenuName() checkPluginPreferences(binding.mainPager) + setDisabledMenuItemColorPluginPreferences() } }) @@ -256,6 +258,14 @@ class MainActivity : NoSplashAppCompatActivity() { return super.dispatchTouchEvent(event) } + private fun setDisabledMenuItemColorPluginPreferences() { + if( pluginPreferencesMenuItem?.isEnabled == false){ + val spanString = SpannableString(this.menu?.findItem(R.id.nav_plugin_preferences)?.title.toString()) + spanString.setSpan(ForegroundColorSpan(rh.gac(R.attr.disabledTextColor)), 0, spanString.length, 0) + this.menu?.findItem(R.id.nav_plugin_preferences)?.title = spanString + } + } + private fun setPluginPreferenceMenuName() { if (binding.mainPager.currentItem >= 0) { val plugin = (binding.mainPager.adapter as TabPageAdapter).getPluginAt(binding.mainPager.currentItem) @@ -284,6 +294,7 @@ class MainActivity : NoSplashAppCompatActivity() { pluginPreferencesMenuItem = menu.findItem(R.id.nav_plugin_preferences) setPluginPreferenceMenuName() checkPluginPreferences(binding.mainPager) + setDisabledMenuItemColorPluginPreferences() return true } diff --git a/core/src/main/res/values-night/styles.xml b/core/src/main/res/values-night/styles.xml index 534c57bd62..94a77f46f4 100644 --- a/core/src/main/res/values-night/styles.xml +++ b/core/src/main/res/values-night/styles.xml @@ -109,6 +109,8 @@ @style/DialogTheme @style/DialogTheme @style/DialogTheme + + @color/sandGray