Simplify accessibility display adjustments
BUG: 14680114 Change-Id: Ifd66256f4a8301d4c159f62a4211a2fbaaa6111a
This commit is contained in:
@@ -987,21 +987,6 @@
|
||||
android:resource="@id/accessibility_settings" />
|
||||
</activity>
|
||||
|
||||
<activity android:name="Settings$AccessibilityContrastSettingsActivity"
|
||||
android:label="@string/accessibility_display_contrast_preference_title"
|
||||
android:taskAffinity="com.android.settings"
|
||||
android:parentActivityName="Settings$AccessibilitySettingsActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<action android:name="com.android.settings.ACCESSIBILITY_CONTRAST_SETTINGS" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||
android:value="com.android.settings.accessibility.ToggleContrastPreferenceFragment" />
|
||||
<meta-data android:name="com.android.settings.TOP_LEVEL_HEADER_ID"
|
||||
android:resource="@id/accessibility_settings" />
|
||||
</activity>
|
||||
|
||||
<activity android:name="Settings$AccessibilityDaltonizerSettingsActivity"
|
||||
android:label="@string/accessibility_display_daltonizer_preference_title"
|
||||
android:taskAffinity="com.android.settings"
|
||||
|
@@ -1171,20 +1171,6 @@
|
||||
<item>critical</item>
|
||||
</string-array>
|
||||
|
||||
<!-- Display color inversion modes for accessibility -->
|
||||
<string-array name="inversion_type_entries">
|
||||
<item>Standard</item>
|
||||
<item>Hue only</item>
|
||||
<item>Value only</item>
|
||||
</string-array>
|
||||
|
||||
<!-- Values for display color inversion modes -->
|
||||
<string-array name="inversion_type_values" translatable="false">
|
||||
<item>0</item>
|
||||
<item>1</item>
|
||||
<item>2</item>
|
||||
</string-array>
|
||||
|
||||
<!-- Display color space adjustment modes for accessibility -->
|
||||
<string-array name="daltonizer_type_entries" translatable="false">
|
||||
<item>@string/daltonizer_mode_deuteranomaly</item>
|
||||
|
@@ -3362,8 +3362,6 @@
|
||||
<string name="accessibility_toggle_speak_password_preference_title">Speak passwords</string>
|
||||
<!-- Title for accessibility preference to choose long-press delay i.e. timeout before it is detected. [CHAR LIMIT=35] -->
|
||||
<string name="accessibility_long_press_timeout_preference_title">Touch & hold delay</string>
|
||||
<!-- Title for the accessibility preference to configure display contrast enhancement. [CHAR LIMIT=NONE] -->
|
||||
<string name="accessibility_display_contrast_preference_title">Contrast enhancement</string>
|
||||
<!-- Title for the accessibility preference to configure display color inversion. [CHAR LIMIT=NONE] -->
|
||||
<string name="accessibility_display_inversion_preference_title">Color inversion</string>
|
||||
<!-- Title for the accessibility preference to configure display color space correction. [CHAR LIMIT=NONE] -->
|
||||
@@ -3371,12 +3369,6 @@
|
||||
|
||||
<!-- Title for the preference to show a tile for a particular feature in the Quick Settings pane. [CHAR LIMIT=NONE] -->
|
||||
<string name="enable_quick_setting">Show in Quick Settings</string>
|
||||
<!-- Title for the preference to configure contrast enhancement's brightness level. [CHAR LIMIT=NONE] -->
|
||||
<string name="contrast_brightness">Brightness</string>
|
||||
<!-- Title for the preference to configure contrast enhancement's contrast level. [CHAR LIMIT=NONE] -->
|
||||
<string name="contrast_contrast">Contrast</string>
|
||||
<!-- Title for the preference to configure the type of color inversion to apply. [CHAR LIMIT=NONE] -->
|
||||
<string name="inversion_type">Inversion mode</string>
|
||||
<!-- Title for the preference to configure the type of color space correction to apply. [CHAR LIMIT=NONE] -->
|
||||
<string name="daltonizer_type">Correction mode</string>
|
||||
<!-- Summary shown for color space correction preference when its value is overridden by another preference [CHAR LIMIT=35] -->
|
||||
|
@@ -1,35 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
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.
|
||||
-->
|
||||
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:title="@string/accessibility_display_contrast_preference_title" >
|
||||
|
||||
<CheckBoxPreference
|
||||
android:key="enable_quick_setting"
|
||||
android:persistent="false"
|
||||
android:title="@string/enable_quick_setting" />
|
||||
|
||||
<SeekBarPreference
|
||||
android:key="contrast"
|
||||
android:persistent="false"
|
||||
android:title="@string/contrast_contrast" />
|
||||
<SeekBarPreference
|
||||
android:key="brightness"
|
||||
android:persistent="false"
|
||||
android:title="@string/contrast_brightness" />
|
||||
|
||||
</PreferenceScreen>
|
@@ -22,12 +22,4 @@
|
||||
android:persistent="false"
|
||||
android:title="@string/enable_quick_setting" />
|
||||
|
||||
<ListPreference
|
||||
android:entries="@array/inversion_type_entries"
|
||||
android:entryValues="@array/inversion_type_values"
|
||||
android:key="type"
|
||||
android:persistent="false"
|
||||
android:summary="%s"
|
||||
android:title="@string/inversion_type" />
|
||||
|
||||
</PreferenceScreen>
|
||||
|
@@ -77,10 +77,6 @@
|
||||
<PreferenceCategory
|
||||
android:key="display_category"
|
||||
android:title="@string/accessibility_display_title" >
|
||||
<PreferenceScreen
|
||||
android:fragment="com.android.settings.accessibility.ToggleContrastPreferenceFragment"
|
||||
android:key="contrast_preference_screen"
|
||||
android:title="@string/accessibility_display_contrast_preference_title" />
|
||||
<PreferenceScreen
|
||||
android:fragment="com.android.settings.accessibility.ToggleInversionPreferenceFragment"
|
||||
android:key="inversion_preference_screen"
|
||||
|
@@ -256,7 +256,6 @@ public class SettingsActivity extends Activity
|
||||
AccessibilitySettings.class.getName(),
|
||||
CaptionPropertiesFragment.class.getName(),
|
||||
com.android.settings.accessibility.ToggleInversionPreferenceFragment.class.getName(),
|
||||
com.android.settings.accessibility.ToggleContrastPreferenceFragment.class.getName(),
|
||||
com.android.settings.accessibility.ToggleDaltonizerPreferenceFragment.class.getName(),
|
||||
TextToSpeechSettings.class.getName(),
|
||||
Memory.class.getName(),
|
||||
|
@@ -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);
|
||||
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
@@ -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);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user