diff options
author | Alan Viverette <alanv@google.com> | 2014-05-12 15:13:54 -0700 |
---|---|---|
committer | Alan Viverette <alanv@google.com> | 2014-05-12 15:13:54 -0700 |
commit | 02d1aec28678485c7da0fa1634756bdb90e96d8e (patch) | |
tree | a63f4b0608825e22d202a4eb32d476b2ce5e3f20 /src/com/android/settings/accessibility | |
parent | 1cb159a7394b5b2ae613994f1f2c36d0fb472468 (diff) | |
download | packages_apps_Settings-02d1aec28678485c7da0fa1634756bdb90e96d8e.zip packages_apps_Settings-02d1aec28678485c7da0fa1634756bdb90e96d8e.tar.gz packages_apps_Settings-02d1aec28678485c7da0fa1634756bdb90e96d8e.tar.bz2 |
Simplify accessibility display adjustments
BUG: 14680114
Change-Id: Ifd66256f4a8301d4c159f62a4211a2fbaaa6111a
Diffstat (limited to 'src/com/android/settings/accessibility')
3 files changed, 0 insertions, 133 deletions
diff --git a/src/com/android/settings/accessibility/AccessibilitySettings.java b/src/com/android/settings/accessibility/AccessibilitySettings.java index 9aa822e..b116290 100644 --- a/src/com/android/settings/accessibility/AccessibilitySettings.java +++ b/src/com/android/settings/accessibility/AccessibilitySettings.java @@ -525,8 +525,6 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements mDisplayMagnificationPreferenceScreen); updateFeatureSummary(Settings.Secure.ACCESSIBILITY_DISPLAY_INVERSION_ENABLED, mDisplayInversionPreferenceScreen); - updateFeatureSummary(Settings.Secure.ACCESSIBILITY_DISPLAY_CONTRAST_ENABLED, - mDisplayContrastPreferenceScreen); updateFeatureSummary(Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED, mDisplayDaltonizerPreferenceScreen); diff --git a/src/com/android/settings/accessibility/ToggleContrastPreferenceFragment.java b/src/com/android/settings/accessibility/ToggleContrastPreferenceFragment.java deleted file mode 100644 index d1e30f8..0000000 --- a/src/com/android/settings/accessibility/ToggleContrastPreferenceFragment.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (C) 2013 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.settings.accessibility; - -import android.os.Bundle; -import android.preference.CheckBoxPreference; -import android.preference.Preference; -import android.preference.PreferenceScreen; -import android.preference.SeekBarPreference; -import android.provider.Settings; -import android.view.View; -import android.widget.CompoundButton; -import android.widget.CompoundButton.OnCheckedChangeListener; - -import com.android.settings.R; -import com.android.settings.accessibility.ToggleSwitch.OnBeforeCheckedChangeListener; - -public class ToggleContrastPreferenceFragment extends ToggleFeaturePreferenceFragment - implements Preference.OnPreferenceChangeListener { - private static final String ENABLED = Settings.Secure.ACCESSIBILITY_DISPLAY_CONTRAST_ENABLED; - private static final String QUICK_SETTING_ENABLED = - Settings.Secure.ACCESSIBILITY_DISPLAY_CONTRAST_QUICK_SETTING_ENABLED; - - private CheckBoxPreference mEnableQuickSetting; - private SeekBarPreference mBrightness; - private SeekBarPreference mContrast; - - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - addPreferencesFromResource(R.xml.accessibility_contrast_settings); - - mEnableQuickSetting = (CheckBoxPreference) findPreference("enable_quick_setting"); - mBrightness = (SeekBarPreference) findPreference("brightness"); - mBrightness.setMax(1000); - mContrast = (SeekBarPreference) findPreference("contrast"); - mContrast.setMax(1000); - - initPreferences(); - } - - @Override - protected void onPreferenceToggled(String preferenceKey, boolean enabled) { - Settings.Secure.putInt(getContentResolver(), ENABLED, enabled ? 1 : 0); - } - - @Override - public boolean onPreferenceChange(Preference preference, Object newValue) { - if (preference == mEnableQuickSetting) { - Settings.Secure.putInt( - getContentResolver(), QUICK_SETTING_ENABLED, ((Boolean) newValue) ? 1 : 0); - } else if (preference == mBrightness) { - final int progress = (Integer) newValue; - final float value = progress / 1000f - 0.5f; - Settings.Secure.putFloat( - getContentResolver(), Settings.Secure.ACCESSIBILITY_DISPLAY_BRIGHTNESS, value); - } else if (preference == mContrast) { - final int progress = (Integer) newValue; - final float value = progress / 1000f * 10f + 1f; - Settings.Secure.putFloat( - getContentResolver(), Settings.Secure.ACCESSIBILITY_DISPLAY_CONTRAST, value); - } - - return true; - } - - @Override - public void onViewCreated(View view, Bundle savedInstanceState) { - super.onViewCreated(view, savedInstanceState); - - setTitle(getString(R.string.accessibility_display_contrast_preference_title)); - } - - @Override - protected void onInstallActionBarToggleSwitch() { - super.onInstallActionBarToggleSwitch(); - - mToggleSwitch.setCheckedInternal( - Settings.Secure.getInt(getContentResolver(), ENABLED, 0) == 1); - mToggleSwitch.setOnCheckedChangeListener(new OnCheckedChangeListener() { - @Override - public void onCheckedChanged(CompoundButton button, boolean checked) { - onPreferenceToggled(mPreferenceKey, checked); - } - }); - } - - private void initPreferences() { - mEnableQuickSetting.setChecked( - Settings.Secure.getInt(getContentResolver(), QUICK_SETTING_ENABLED, 0) == 1); - mEnableQuickSetting.setOnPreferenceChangeListener(this); - - final float brightness = Settings.Secure.getFloat( - getContentResolver(), Settings.Secure.ACCESSIBILITY_DISPLAY_BRIGHTNESS, 0); - final float contrast = Settings.Secure.getFloat( - getContentResolver(), Settings.Secure.ACCESSIBILITY_DISPLAY_CONTRAST, 2); - - // Available brightness range is -0.5 to 0.5. - mBrightness.setProgress((int) (1000 * (brightness + 0.5f))); - mBrightness.setOnPreferenceChangeListener(this); - - // Available contrast range is 1 to 10. - mContrast.setProgress((int) (1000 * (contrast - 1f) / 10f)); - mContrast.setOnPreferenceChangeListener(this); - } -} diff --git a/src/com/android/settings/accessibility/ToggleInversionPreferenceFragment.java b/src/com/android/settings/accessibility/ToggleInversionPreferenceFragment.java index bfb2500..92a778e 100644 --- a/src/com/android/settings/accessibility/ToggleInversionPreferenceFragment.java +++ b/src/com/android/settings/accessibility/ToggleInversionPreferenceFragment.java @@ -35,13 +35,10 @@ import com.android.settings.accessibility.ToggleSwitch.OnBeforeCheckedChangeList public class ToggleInversionPreferenceFragment extends ToggleFeaturePreferenceFragment implements Preference.OnPreferenceChangeListener { private static final String ENABLED = Settings.Secure.ACCESSIBILITY_DISPLAY_INVERSION_ENABLED; - private static final String TYPE = Settings.Secure.ACCESSIBILITY_DISPLAY_INVERSION; private static final String QUICK_SETTING_ENABLED = Settings.Secure.ACCESSIBILITY_DISPLAY_INVERSION_QUICK_SETTING_ENABLED; - private static final int DEFAULT_TYPE = AccessibilityManager.INVERSION_STANDARD; private CheckBoxPreference mEnableQuickSetting; - private ListPreference mType; @Override public void onCreate(Bundle savedInstanceState) { @@ -50,7 +47,6 @@ public class ToggleInversionPreferenceFragment extends ToggleFeaturePreferenceFr addPreferencesFromResource(R.xml.accessibility_inversion_settings); mEnableQuickSetting = (CheckBoxPreference) findPreference("enable_quick_setting"); - mType = (ListPreference) findPreference("type"); initPreferences(); } @@ -65,8 +61,6 @@ public class ToggleInversionPreferenceFragment extends ToggleFeaturePreferenceFr if (preference == mEnableQuickSetting) { Settings.Secure.putInt( getContentResolver(), QUICK_SETTING_ENABLED, ((Boolean) newValue) ? 1 : 0); - } else if (preference == mType) { - Settings.Secure.putInt(getContentResolver(), TYPE, Integer.parseInt((String) newValue)); } return true; @@ -97,9 +91,5 @@ public class ToggleInversionPreferenceFragment extends ToggleFeaturePreferenceFr mEnableQuickSetting.setChecked( Settings.Secure.getInt(getContentResolver(), QUICK_SETTING_ENABLED, 0) == 1); mEnableQuickSetting.setOnPreferenceChangeListener(this); - - mType.setValue( - Integer.toString(Settings.Secure.getInt(getContentResolver(), TYPE, DEFAULT_TYPE))); - mType.setOnPreferenceChangeListener(this); } } |