From 96577681a298b44be2e1133b10bc637623be3b87 Mon Sep 17 00:00:00 2001 From: Shuhrat Dehkanov Date: Wed, 3 Oct 2012 12:24:07 +0900 Subject: Grey out settings icon when it is in disabled state If engine is not active, its settings icon is disabled in Settings > Language & input > Text-to-speech output screen. Currently, settings icons for all TTS engines are shown at the same opacity. This fix dims settings icons of not-selected engines. Make sure that more than one TTS engine are installed on the target, for e.g., Google Text-to-speech Engine and Classic Text To Speech Engine (SVOX Classic TTS). Additionally, since setAlpha() is used in multiple places within Settings package, moved DISABLED_ALPHA declaration to Utils.java in order to have single point of reference. Change-Id: Ifa7de79814a2f4a4aa021cd8621cbfab41655680 Signed-off-by: Shuhrat Dehkanov --- src/com/android/settings/tts/TtsEnginePreference.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/com/android/settings/tts') diff --git a/src/com/android/settings/tts/TtsEnginePreference.java b/src/com/android/settings/tts/TtsEnginePreference.java index 3d612f0..21ef81d 100644 --- a/src/com/android/settings/tts/TtsEnginePreference.java +++ b/src/com/android/settings/tts/TtsEnginePreference.java @@ -30,6 +30,7 @@ import android.widget.RadioButton; import com.android.settings.R; +import com.android.settings.Utils; public class TtsEnginePreference extends Preference { @@ -136,6 +137,9 @@ public class TtsEnginePreference extends Preference { // Will be enabled only the engine has passed the voice check, and // is currently enabled. mSettingsIcon.setEnabled(isChecked && mVoiceCheckData != null); + if (!isChecked) { + mSettingsIcon.setAlpha(Utils.DISABLED_ALPHA); + } mSettingsIcon.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { @@ -169,7 +173,12 @@ public class TtsEnginePreference extends Preference { // case mSettingsIcon && mRadioButton will be null. In this case // getView will set the right values. if (mSettingsIcon != null && mRadioButton != null) { - mSettingsIcon.setEnabled(mRadioButton.isChecked()); + if (mRadioButton.isChecked()) { + mSettingsIcon.setEnabled(true); + } else { + mSettingsIcon.setEnabled(false); + mSettingsIcon.setAlpha(Utils.DISABLED_ALPHA); + } } } -- cgit v1.1