am 004970da: am 0df6a277: Merge "Grey out settings icon when it is in disabled state"

* commit '004970da50ddbce80321b50536625e149ff1f825':
  Grey out settings icon when it is in disabled state
This commit is contained in:
Amith Yamasani
2012-12-12 09:57:37 -08:00
committed by Android Git Automerger
6 changed files with 23 additions and 9 deletions

View File

@@ -33,6 +33,7 @@ import android.widget.RadioButton;
import com.android.settings.R;
import com.android.settings.Utils;
public class TtsEnginePreference extends Preference {
@@ -141,6 +142,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) {
@@ -174,7 +178,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);
}
}
}