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 <uzbmaster@gmail.com>
This commit is contained in:
Shuhrat Dehkanov
2012-10-03 12:24:07 +09:00
parent 19f09fb127
commit 96577681a2
6 changed files with 23 additions and 9 deletions

View File

@@ -17,6 +17,7 @@
package com.android.settings.inputmethod;
import com.android.settings.R;
import com.android.settings.Utils;
import android.app.AlertDialog;
import android.content.ActivityNotFoundException;
@@ -37,7 +38,6 @@ import android.widget.TextView;
import android.widget.Toast;
public class SingleSpellCheckerPreference extends Preference {
private static final float DISABLED_ALPHA = 0.4f;
private static final String TAG = SingleSpellCheckerPreference.class.getSimpleName();
private static final boolean DBG = false;
@@ -198,7 +198,7 @@ public class SingleSpellCheckerPreference extends Preference {
mSettingsButton.setClickable(enabled);
mSettingsButton.setFocusable(enabled);
if (!enabled) {
mSettingsButton.setAlpha(DISABLED_ALPHA);
mSettingsButton.setAlpha(Utils.DISABLED_ALPHA);
}
}
}
@@ -210,7 +210,7 @@ public class SingleSpellCheckerPreference extends Preference {
mSubtypeButton.setClickable(enabled);
mSubtypeButton.setFocusable(enabled);
if (!enabled) {
mSubtypeButton.setAlpha(DISABLED_ALPHA);
mSubtypeButton.setAlpha(Utils.DISABLED_ALPHA);
}
}
}