am 0df6a277
: Merge "Grey out settings icon when it is in disabled state"
* commit '0df6a2771d92e355e122195d3dceaf9a2b264ee5': Grey out settings icon when it is in disabled state
This commit is contained in:
@@ -316,7 +316,7 @@ public class DreamSettings extends SettingsPreferenceFragment {
|
|||||||
|
|
||||||
ImageView settingsButton = (ImageView) row.findViewById(android.R.id.button2);
|
ImageView settingsButton = (ImageView) row.findViewById(android.R.id.button2);
|
||||||
settingsButton.setVisibility(showSettings ? View.VISIBLE : View.INVISIBLE);
|
settingsButton.setVisibility(showSettings ? View.VISIBLE : View.INVISIBLE);
|
||||||
settingsButton.setAlpha(dreamInfo.isActive ? 1f : 0.33f);
|
settingsButton.setAlpha(dreamInfo.isActive ? 1f : Utils.DISABLED_ALPHA);
|
||||||
settingsButton.setEnabled(dreamInfo.isActive);
|
settingsButton.setEnabled(dreamInfo.isActive);
|
||||||
settingsButton.setOnClickListener(new OnClickListener(){
|
settingsButton.setOnClickListener(new OnClickListener(){
|
||||||
@Override
|
@Override
|
||||||
|
@@ -79,6 +79,11 @@ public class Utils {
|
|||||||
*/
|
*/
|
||||||
public static final int UPDATE_PREFERENCE_FLAG_SET_TITLE_TO_MATCHING_ACTIVITY = 1;
|
public static final int UPDATE_PREFERENCE_FLAG_SET_TITLE_TO_MATCHING_ACTIVITY = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The opacity level of a disabled icon.
|
||||||
|
*/
|
||||||
|
public static final float DISABLED_ALPHA = 0.4f;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Name of the meta-data item that should be set in the AndroidManifest.xml
|
* Name of the meta-data item that should be set in the AndroidManifest.xml
|
||||||
* to specify the icon that should be displayed for the preference.
|
* to specify the icon that should be displayed for the preference.
|
||||||
|
@@ -18,6 +18,7 @@ package com.android.settings.inputmethod;
|
|||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.SettingsPreferenceFragment;
|
import com.android.settings.SettingsPreferenceFragment;
|
||||||
|
import com.android.settings.Utils;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
@@ -29,7 +30,6 @@ import android.widget.ImageView;
|
|||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
public class CheckBoxAndSettingsPreference extends CheckBoxPreference {
|
public class CheckBoxAndSettingsPreference extends CheckBoxPreference {
|
||||||
private static final float DISABLED_ALPHA = 0.4f;
|
|
||||||
|
|
||||||
private SettingsPreferenceFragment mFragment;
|
private SettingsPreferenceFragment mFragment;
|
||||||
private TextView mTitleText;
|
private TextView mTitleText;
|
||||||
@@ -103,7 +103,7 @@ public class CheckBoxAndSettingsPreference extends CheckBoxPreference {
|
|||||||
mSettingsButton.setClickable(checked);
|
mSettingsButton.setClickable(checked);
|
||||||
mSettingsButton.setFocusable(checked);
|
mSettingsButton.setFocusable(checked);
|
||||||
if (!checked) {
|
if (!checked) {
|
||||||
mSettingsButton.setAlpha(DISABLED_ALPHA);
|
mSettingsButton.setAlpha(Utils.DISABLED_ALPHA);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -18,6 +18,7 @@ package com.android.settings.inputmethod;
|
|||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.SettingsPreferenceFragment;
|
import com.android.settings.SettingsPreferenceFragment;
|
||||||
|
import com.android.settings.Utils;
|
||||||
|
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.Fragment;
|
import android.app.Fragment;
|
||||||
@@ -47,7 +48,6 @@ import java.util.List;
|
|||||||
public class InputMethodPreference extends CheckBoxPreference
|
public class InputMethodPreference extends CheckBoxPreference
|
||||||
implements Comparator<InputMethodPreference> {
|
implements Comparator<InputMethodPreference> {
|
||||||
private static final String TAG = InputMethodPreference.class.getSimpleName();
|
private static final String TAG = InputMethodPreference.class.getSimpleName();
|
||||||
private static final float DISABLED_ALPHA = 0.4f;
|
|
||||||
private final SettingsPreferenceFragment mFragment;
|
private final SettingsPreferenceFragment mFragment;
|
||||||
private final InputMethodInfo mImi;
|
private final InputMethodInfo mImi;
|
||||||
private final InputMethodManager mImm;
|
private final InputMethodManager mImm;
|
||||||
@@ -172,7 +172,7 @@ public class InputMethodPreference extends CheckBoxPreference
|
|||||||
mInputMethodSettingsButton.setClickable(checked);
|
mInputMethodSettingsButton.setClickable(checked);
|
||||||
mInputMethodSettingsButton.setFocusable(checked);
|
mInputMethodSettingsButton.setFocusable(checked);
|
||||||
if (!checked) {
|
if (!checked) {
|
||||||
mInputMethodSettingsButton.setAlpha(DISABLED_ALPHA);
|
mInputMethodSettingsButton.setAlpha(Utils.DISABLED_ALPHA);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (mTitleText != null) {
|
if (mTitleText != null) {
|
||||||
|
@@ -17,6 +17,7 @@
|
|||||||
package com.android.settings.inputmethod;
|
package com.android.settings.inputmethod;
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
|
import com.android.settings.Utils;
|
||||||
|
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.content.ActivityNotFoundException;
|
import android.content.ActivityNotFoundException;
|
||||||
@@ -37,7 +38,6 @@ import android.widget.TextView;
|
|||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
public class SingleSpellCheckerPreference extends Preference {
|
public class SingleSpellCheckerPreference extends Preference {
|
||||||
private static final float DISABLED_ALPHA = 0.4f;
|
|
||||||
private static final String TAG = SingleSpellCheckerPreference.class.getSimpleName();
|
private static final String TAG = SingleSpellCheckerPreference.class.getSimpleName();
|
||||||
private static final boolean DBG = false;
|
private static final boolean DBG = false;
|
||||||
|
|
||||||
@@ -198,7 +198,7 @@ public class SingleSpellCheckerPreference extends Preference {
|
|||||||
mSettingsButton.setClickable(enabled);
|
mSettingsButton.setClickable(enabled);
|
||||||
mSettingsButton.setFocusable(enabled);
|
mSettingsButton.setFocusable(enabled);
|
||||||
if (!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.setClickable(enabled);
|
||||||
mSubtypeButton.setFocusable(enabled);
|
mSubtypeButton.setFocusable(enabled);
|
||||||
if (!enabled) {
|
if (!enabled) {
|
||||||
mSubtypeButton.setAlpha(DISABLED_ALPHA);
|
mSubtypeButton.setAlpha(Utils.DISABLED_ALPHA);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -30,6 +30,7 @@ import android.widget.RadioButton;
|
|||||||
|
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
|
import com.android.settings.Utils;
|
||||||
|
|
||||||
|
|
||||||
public class TtsEnginePreference extends Preference {
|
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
|
// Will be enabled only the engine has passed the voice check, and
|
||||||
// is currently enabled.
|
// is currently enabled.
|
||||||
mSettingsIcon.setEnabled(isChecked && mVoiceCheckData != null);
|
mSettingsIcon.setEnabled(isChecked && mVoiceCheckData != null);
|
||||||
|
if (!isChecked) {
|
||||||
|
mSettingsIcon.setAlpha(Utils.DISABLED_ALPHA);
|
||||||
|
}
|
||||||
mSettingsIcon.setOnClickListener(new View.OnClickListener() {
|
mSettingsIcon.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
@@ -169,7 +173,12 @@ public class TtsEnginePreference extends Preference {
|
|||||||
// case mSettingsIcon && mRadioButton will be null. In this case
|
// case mSettingsIcon && mRadioButton will be null. In this case
|
||||||
// getView will set the right values.
|
// getView will set the right values.
|
||||||
if (mSettingsIcon != null && mRadioButton != null) {
|
if (mSettingsIcon != null && mRadioButton != null) {
|
||||||
mSettingsIcon.setEnabled(mRadioButton.isChecked());
|
if (mRadioButton.isChecked()) {
|
||||||
|
mSettingsIcon.setEnabled(true);
|
||||||
|
} else {
|
||||||
|
mSettingsIcon.setEnabled(false);
|
||||||
|
mSettingsIcon.setAlpha(Utils.DISABLED_ALPHA);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user