summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/accessibility/ToggleDaltonizerPreferenceFragment.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/settings/accessibility/ToggleDaltonizerPreferenceFragment.java')
-rw-r--r--src/com/android/settings/accessibility/ToggleDaltonizerPreferenceFragment.java28
1 files changed, 17 insertions, 11 deletions
diff --git a/src/com/android/settings/accessibility/ToggleDaltonizerPreferenceFragment.java b/src/com/android/settings/accessibility/ToggleDaltonizerPreferenceFragment.java
index 6da81b01b..b910f796a 100644
--- a/src/com/android/settings/accessibility/ToggleDaltonizerPreferenceFragment.java
+++ b/src/com/android/settings/accessibility/ToggleDaltonizerPreferenceFragment.java
@@ -23,13 +23,13 @@ import android.preference.Preference;
import android.provider.Settings;
import android.view.View;
import android.view.accessibility.AccessibilityManager;
-import android.widget.CompoundButton;
-import android.widget.CompoundButton.OnCheckedChangeListener;
+import android.widget.Switch;
import com.android.settings.R;
+import com.android.settings.widget.SwitchBar;
public class ToggleDaltonizerPreferenceFragment extends ToggleFeaturePreferenceFragment
- implements Preference.OnPreferenceChangeListener {
+ implements Preference.OnPreferenceChangeListener, SwitchBar.OnSwitchChangeListener {
private static final String ENABLED = Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED;
private static final String TYPE = Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER;
private static final String QUICK_SETTING_ENABLED =
@@ -77,17 +77,18 @@ public class ToggleDaltonizerPreferenceFragment extends ToggleFeaturePreferenceF
}
@Override
- protected void onInstallActionBarToggleSwitch() {
- super.onInstallActionBarToggleSwitch();
+ protected void onInstallSwitchBarToggleSwitch() {
+ super.onInstallSwitchBarToggleSwitch();
mToggleSwitch.setCheckedInternal(
Settings.Secure.getInt(getContentResolver(), ENABLED, 0) == 1);
- mToggleSwitch.setOnCheckedChangeListener(new OnCheckedChangeListener() {
- @Override
- public void onCheckedChanged(CompoundButton button, boolean checked) {
- onPreferenceToggled(mPreferenceKey, checked);
- }
- });
+ mSwitchBar.addOnSwitchChangeListener(this);
+ }
+
+ @Override
+ protected void onRemoveSwitchBarToggleSwitch() {
+ super.onRemoveSwitchBarToggleSwitch();
+ mSwitchBar.removeOnSwitchChangeListener(this);
}
private void initPreferences() {
@@ -106,4 +107,9 @@ public class ToggleDaltonizerPreferenceFragment extends ToggleFeaturePreferenceF
getString(R.string.simulate_color_space)));
}
}
+
+ @Override
+ public void onSwitchChanged(Switch switchView, boolean isChecked) {
+ onPreferenceToggled(mPreferenceKey, isChecked);
+ }
}