Merge "Add accessibility display adjustments to Settings"
This commit is contained in:
committed by
Android (Google) Code Review
commit
394a517982
@@ -1004,6 +1004,51 @@
|
|||||||
android:resource="@id/accessibility_settings" />
|
android:resource="@id/accessibility_settings" />
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
|
<activity android:name="Settings$AccessibilityInversionSettingsActivity"
|
||||||
|
android:label="@string/accessibility_display_inversion_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_INVERSION_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.ToggleInversionPreferenceFragment" />
|
||||||
|
<meta-data android:name="com.android.settings.TOP_LEVEL_HEADER_ID"
|
||||||
|
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"
|
||||||
|
android:parentActivityName="Settings$AccessibilitySettingsActivity">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
<action android:name="com.android.settings.ACCESSIBILITY_COLOR_SPACE_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.ToggleDaltonizerPreferenceFragment" />
|
||||||
|
<meta-data android:name="com.android.settings.TOP_LEVEL_HEADER_ID"
|
||||||
|
android:resource="@id/accessibility_settings" />
|
||||||
|
</activity>
|
||||||
|
|
||||||
<activity android:name="Settings$CaptioningSettingsActivity"
|
<activity android:name="Settings$CaptioningSettingsActivity"
|
||||||
android:label="@string/accessibility_captioning_title"
|
android:label="@string/accessibility_captioning_title"
|
||||||
android:taskAffinity="com.android.settings"
|
android:taskAffinity="com.android.settings"
|
||||||
|
@@ -1163,4 +1163,62 @@
|
|||||||
<item>critical</item>
|
<item>critical</item>
|
||||||
</string-array>
|
</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>
|
||||||
|
<item>@string/daltonizer_mode_protanomaly</item>
|
||||||
|
<item>@string/daltonizer_mode_tritanomaly</item>
|
||||||
|
<item>@string/daltonizer_mode_deuteranopia</item>
|
||||||
|
<item>@string/daltonizer_mode_protanopia</item>
|
||||||
|
<item>@string/daltonizer_mode_tritanopia</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
|
<!-- Values for display color space adjustment modes for accessibility -->
|
||||||
|
<string-array name="daltonizer_type_values" translatable="false">
|
||||||
|
<item>12</item>
|
||||||
|
<item>11</item>
|
||||||
|
<item>13</item>
|
||||||
|
<item>15</item>
|
||||||
|
<item>14</item>
|
||||||
|
<item>16</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
|
<!-- Display color space adjustment modes for developers -->
|
||||||
|
<string-array name="simulate_color_space_entries" translatable="false">
|
||||||
|
<item>@string/daltonizer_mode_disabled</item>
|
||||||
|
<item>@string/daltonizer_mode_monochromacy</item>
|
||||||
|
<item>@string/daltonizer_mode_deuteranomaly</item>
|
||||||
|
<item>@string/daltonizer_mode_protanomaly</item>
|
||||||
|
<item>@string/daltonizer_mode_tritanomaly</item>
|
||||||
|
<item>@string/daltonizer_mode_deuteranopia</item>
|
||||||
|
<item>@string/daltonizer_mode_protanopia</item>
|
||||||
|
<item>@string/daltonizer_mode_tritanopia</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
|
<!-- Values for display color space adjustment modes for developers -->
|
||||||
|
<string-array name="simulate_color_space_values" translatable="false">
|
||||||
|
<item>-1</item>
|
||||||
|
<item>0</item>
|
||||||
|
<item>2</item>
|
||||||
|
<item>1</item>
|
||||||
|
<item>3</item>
|
||||||
|
<item>5</item>
|
||||||
|
<item>4</item>
|
||||||
|
<item>6</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
@@ -3278,6 +3278,8 @@
|
|||||||
<string name="accessibility_services_title">Services</string>
|
<string name="accessibility_services_title">Services</string>
|
||||||
<!-- Title for the accessibility preference category of system related preferences. [CHAR LIMIT=25] -->
|
<!-- Title for the accessibility preference category of system related preferences. [CHAR LIMIT=25] -->
|
||||||
<string name="accessibility_system_title">System</string>
|
<string name="accessibility_system_title">System</string>
|
||||||
|
<!-- Title for the accessibility preference category of display related preferences. [CHAR LIMIT=25] -->
|
||||||
|
<string name="accessibility_display_title">Display</string>
|
||||||
<!-- Title for the accessibility preference screen to enable video captioning. [CHAR LIMIT=35] -->
|
<!-- Title for the accessibility preference screen to enable video captioning. [CHAR LIMIT=35] -->
|
||||||
<string name="accessibility_captioning_title">Captions</string>
|
<string name="accessibility_captioning_title">Captions</string>
|
||||||
<!-- Title for the accessibility preference screen to enable screen magnification. [CHAR LIMIT=35] -->
|
<!-- Title for the accessibility preference screen to enable screen magnification. [CHAR LIMIT=35] -->
|
||||||
@@ -3308,6 +3310,42 @@
|
|||||||
<string name="accessibility_toggle_speak_password_preference_title">Speak passwords</string>
|
<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] -->
|
<!-- 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>
|
<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] -->
|
||||||
|
<string name="accessibility_display_daltonizer_preference_title">Color space correction</string>
|
||||||
|
|
||||||
|
<!-- 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] -->
|
||||||
|
<string name="daltonizer_type_overridden">Overridden by <xliff:g id="title" example="Simulate color space">%1$s</xliff:g></string>
|
||||||
|
|
||||||
|
<!-- Label for disabling color space adjustment [CHAR LIMIT=35] -->
|
||||||
|
<string name="daltonizer_mode_disabled">Disabled</string>
|
||||||
|
<!-- Label for converting display colors to grayscale [CHAR LIMIT=35] -->
|
||||||
|
<string name="daltonizer_mode_monochromacy">Monochromacy</string>
|
||||||
|
<!-- Label for deuteranomaly (red-green color blindness) [CHAR LIMIT=35] -->
|
||||||
|
<string name="daltonizer_mode_deuteranomaly">Deuteranomaly (red-green)</string>
|
||||||
|
<!-- Label for protanomaly (red-green color blindness) [CHAR LIMIT=35] -->
|
||||||
|
<string name="daltonizer_mode_protanomaly">Protanomaly (red-green)</string>
|
||||||
|
<!-- Label for tritanomaly (blue-yellow color blindness) [CHAR LIMIT=35] -->
|
||||||
|
<string name="daltonizer_mode_tritanomaly">Tritanomaly (blue-yellow)</string>
|
||||||
|
<!-- Label for deuteranopia (green color blindness) [CHAR LIMIT=35] -->
|
||||||
|
<string name="daltonizer_mode_deuteranopia">Deuteranopia (green)</string>
|
||||||
|
<!-- Label for protanopia (red color blindness) [CHAR LIMIT=35] -->
|
||||||
|
<string name="daltonizer_mode_protanopia">Protanopia (red)</string>
|
||||||
|
<!-- Label for tritanopia (blue color blindness) [CHAR LIMIT=35] -->
|
||||||
|
<string name="daltonizer_mode_tritanopia">Tritanopia (blue)</string>
|
||||||
|
|
||||||
<!-- Title for accessibility menu item to lauch a settings activity. [CHAR LIMIT=15] -->
|
<!-- Title for accessibility menu item to lauch a settings activity. [CHAR LIMIT=15] -->
|
||||||
<string name="accessibility_menu_item_settings">Settings</string>
|
<string name="accessibility_menu_item_settings">Settings</string>
|
||||||
@@ -4310,6 +4348,9 @@
|
|||||||
<!-- UI debug setting: disable use of overlays summary [CHAR LIMIT=50] -->
|
<!-- UI debug setting: disable use of overlays summary [CHAR LIMIT=50] -->
|
||||||
<string name="disable_overlays_summary">Always use GPU for screen compositing</string>
|
<string name="disable_overlays_summary">Always use GPU for screen compositing</string>
|
||||||
|
|
||||||
|
<!-- UI debug setting: simulate color space anomalies. [CHAR LIMIT=25] -->
|
||||||
|
<string name="simulate_color_space">Simulate color space</string>
|
||||||
|
|
||||||
<!-- UI debug setting: enable various types of OpenGL traces [CHAR LIMIT=25] -->
|
<!-- UI debug setting: enable various types of OpenGL traces [CHAR LIMIT=25] -->
|
||||||
<string name="enable_opengl_traces_title">Enable OpenGL traces</string>
|
<string name="enable_opengl_traces_title">Enable OpenGL traces</string>
|
||||||
|
|
||||||
|
35
res/xml/accessibility_contrast_settings.xml
Normal file
35
res/xml/accessibility_contrast_settings.xml
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
<?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>
|
33
res/xml/accessibility_daltonizer_settings.xml
Normal file
33
res/xml/accessibility_daltonizer_settings.xml
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
<?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_daltonizer_preference_title" >
|
||||||
|
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:key="enable_quick_setting"
|
||||||
|
android:persistent="false"
|
||||||
|
android:title="@string/enable_quick_setting" />
|
||||||
|
|
||||||
|
<ListPreference
|
||||||
|
android:entries="@array/daltonizer_type_entries"
|
||||||
|
android:entryValues="@array/daltonizer_type_values"
|
||||||
|
android:key="type"
|
||||||
|
android:persistent="false"
|
||||||
|
android:summary="%s"
|
||||||
|
android:title="@string/daltonizer_type" />
|
||||||
|
|
||||||
|
</PreferenceScreen>
|
33
res/xml/accessibility_inversion_settings.xml
Normal file
33
res/xml/accessibility_inversion_settings.xml
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
<?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_inversion_preference_title" >
|
||||||
|
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:key="enable_quick_setting"
|
||||||
|
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>
|
@@ -74,4 +74,21 @@
|
|||||||
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
|
<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"
|
||||||
|
android:title="@string/accessibility_display_inversion_preference_title" />
|
||||||
|
<PreferenceScreen
|
||||||
|
android:fragment="com.android.settings.accessibility.ToggleDaltonizerPreferenceFragment"
|
||||||
|
android:key="daltonizer_preference_screen"
|
||||||
|
android:title="@string/accessibility_display_daltonizer_preference_title" />
|
||||||
|
</PreferenceCategory>
|
||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
@@ -212,6 +212,14 @@
|
|||||||
android:title="@string/disable_overlays"
|
android:title="@string/disable_overlays"
|
||||||
android:summary="@string/disable_overlays_summary"/>
|
android:summary="@string/disable_overlays_summary"/>
|
||||||
|
|
||||||
|
<ListPreference
|
||||||
|
android:entries="@array/simulate_color_space_entries"
|
||||||
|
android:entryValues="@array/simulate_color_space_values"
|
||||||
|
android:key="simulate_color_space"
|
||||||
|
android:persistent="false"
|
||||||
|
android:summary="%s"
|
||||||
|
android:title="@string/simulate_color_space" />
|
||||||
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
<PreferenceCategory android:key="debug_monitoring_category"
|
<PreferenceCategory android:key="debug_monitoring_category"
|
||||||
|
@@ -59,6 +59,7 @@ import android.view.Gravity;
|
|||||||
import android.view.HardwareRenderer;
|
import android.view.HardwareRenderer;
|
||||||
import android.view.IWindowManager;
|
import android.view.IWindowManager;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.view.accessibility.AccessibilityManager;
|
||||||
import android.webkit.WebViewFactory;
|
import android.webkit.WebViewFactory;
|
||||||
import android.widget.CompoundButton;
|
import android.widget.CompoundButton;
|
||||||
import android.widget.Switch;
|
import android.widget.Switch;
|
||||||
@@ -114,6 +115,7 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
|
|||||||
private static final String SHOW_TOUCHES_KEY = "show_touches";
|
private static final String SHOW_TOUCHES_KEY = "show_touches";
|
||||||
private static final String SHOW_SCREEN_UPDATES_KEY = "show_screen_updates";
|
private static final String SHOW_SCREEN_UPDATES_KEY = "show_screen_updates";
|
||||||
private static final String DISABLE_OVERLAYS_KEY = "disable_overlays";
|
private static final String DISABLE_OVERLAYS_KEY = "disable_overlays";
|
||||||
|
private static final String SIMULATE_COLOR_SPACE = "simulate_color_space";
|
||||||
private static final String SHOW_CPU_USAGE_KEY = "show_cpu_usage";
|
private static final String SHOW_CPU_USAGE_KEY = "show_cpu_usage";
|
||||||
private static final String FORCE_HARDWARE_UI_KEY = "force_hw_ui";
|
private static final String FORCE_HARDWARE_UI_KEY = "force_hw_ui";
|
||||||
private static final String FORCE_MSAA_KEY = "force_msaa";
|
private static final String FORCE_MSAA_KEY = "force_msaa";
|
||||||
@@ -195,6 +197,7 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
|
|||||||
private ListPreference mAnimatorDurationScale;
|
private ListPreference mAnimatorDurationScale;
|
||||||
private ListPreference mOverlayDisplayDevices;
|
private ListPreference mOverlayDisplayDevices;
|
||||||
private ListPreference mOpenGLTraces;
|
private ListPreference mOpenGLTraces;
|
||||||
|
private ListPreference mSimulateColorSpace;
|
||||||
|
|
||||||
private CheckBoxPreference mImmediatelyDestroyActivities;
|
private CheckBoxPreference mImmediatelyDestroyActivities;
|
||||||
private ListPreference mAppProcessLimit;
|
private ListPreference mAppProcessLimit;
|
||||||
@@ -300,6 +303,7 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
|
|||||||
mAnimatorDurationScale = addListPreference(ANIMATOR_DURATION_SCALE_KEY);
|
mAnimatorDurationScale = addListPreference(ANIMATOR_DURATION_SCALE_KEY);
|
||||||
mOverlayDisplayDevices = addListPreference(OVERLAY_DISPLAY_DEVICES_KEY);
|
mOverlayDisplayDevices = addListPreference(OVERLAY_DISPLAY_DEVICES_KEY);
|
||||||
mOpenGLTraces = addListPreference(OPENGL_TRACES_KEY);
|
mOpenGLTraces = addListPreference(OPENGL_TRACES_KEY);
|
||||||
|
mSimulateColorSpace = addListPreference(SIMULATE_COLOR_SPACE);
|
||||||
|
|
||||||
mImmediatelyDestroyActivities = (CheckBoxPreference) findPreference(
|
mImmediatelyDestroyActivities = (CheckBoxPreference) findPreference(
|
||||||
IMMEDIATELY_DESTROY_ACTIVITIES_KEY);
|
IMMEDIATELY_DESTROY_ACTIVITIES_KEY);
|
||||||
@@ -513,6 +517,7 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
|
|||||||
updateBugreportOptions();
|
updateBugreportOptions();
|
||||||
updateForceRtlOptions();
|
updateForceRtlOptions();
|
||||||
updateWifiDisplayCertificationOptions();
|
updateWifiDisplayCertificationOptions();
|
||||||
|
updateSimulateColorSpace();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void resetDangerousOptions() {
|
private void resetDangerousOptions() {
|
||||||
@@ -949,6 +954,40 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
|
|||||||
pokeSystemProperties();
|
pokeSystemProperties();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateSimulateColorSpace() {
|
||||||
|
final ContentResolver cr = getContentResolver();
|
||||||
|
final boolean enabled = Settings.Secure.getInt(
|
||||||
|
cr, Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED, 0) != 0;
|
||||||
|
if (enabled) {
|
||||||
|
final String mode = Integer.toString(Settings.Secure.getInt(
|
||||||
|
cr, Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER,
|
||||||
|
AccessibilityManager.DALTONIZER_DISABLED));
|
||||||
|
mSimulateColorSpace.setValue(mode);
|
||||||
|
final int index = mSimulateColorSpace.findIndexOfValue(mode);
|
||||||
|
if (index < 0) {
|
||||||
|
// We're using a mode controlled by accessibility preferences.
|
||||||
|
mSimulateColorSpace.setSummary(getString(R.string.daltonizer_type_overridden,
|
||||||
|
getString(R.string.accessibility_display_daltonizer_preference_title)));
|
||||||
|
} else {
|
||||||
|
mSimulateColorSpace.setSummary("%s");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
mSimulateColorSpace.setValue(
|
||||||
|
Integer.toString(AccessibilityManager.DALTONIZER_DISABLED));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void writeSimulateColorSpace(Object value) {
|
||||||
|
final ContentResolver cr = getContentResolver();
|
||||||
|
final int newMode = Integer.parseInt(value.toString());
|
||||||
|
if (newMode < 0) {
|
||||||
|
Settings.Secure.putInt(cr, Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED, 0);
|
||||||
|
} else {
|
||||||
|
Settings.Secure.putInt(cr, Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED, 1);
|
||||||
|
Settings.Secure.putInt(cr, Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER, newMode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void updateForceRtlOptions() {
|
private void updateForceRtlOptions() {
|
||||||
updateCheckBox(mForceRtlLayout, Settings.Global.getInt(getActivity().getContentResolver(),
|
updateCheckBox(mForceRtlLayout, Settings.Global.getInt(getActivity().getContentResolver(),
|
||||||
Settings.Global.DEVELOPMENT_FORCE_RTL, 0) != 0);
|
Settings.Global.DEVELOPMENT_FORCE_RTL, 0) != 0);
|
||||||
@@ -1350,6 +1389,9 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
|
|||||||
} else if (preference == mAppProcessLimit) {
|
} else if (preference == mAppProcessLimit) {
|
||||||
writeAppProcessLimitOptions(newValue);
|
writeAppProcessLimitOptions(newValue);
|
||||||
return true;
|
return true;
|
||||||
|
} else if (preference == mSimulateColorSpace) {
|
||||||
|
writeSimulateColorSpace(newValue);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@@ -332,6 +332,9 @@ public class Settings extends PreferenceActivity
|
|||||||
DeviceAdminSettings.class.getName(),
|
DeviceAdminSettings.class.getName(),
|
||||||
AccessibilitySettings.class.getName(),
|
AccessibilitySettings.class.getName(),
|
||||||
ToggleCaptioningPreferenceFragment.class.getName(),
|
ToggleCaptioningPreferenceFragment.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(),
|
TextToSpeechSettings.class.getName(),
|
||||||
Memory.class.getName(),
|
Memory.class.getName(),
|
||||||
DevelopmentSettings.class.getName(),
|
DevelopmentSettings.class.getName(),
|
||||||
@@ -1077,6 +1080,9 @@ public class Settings extends PreferenceActivity
|
|||||||
public static class DevelopmentSettingsActivity extends Settings { /* empty */ }
|
public static class DevelopmentSettingsActivity extends Settings { /* empty */ }
|
||||||
public static class AccessibilitySettingsActivity extends Settings { /* empty */ }
|
public static class AccessibilitySettingsActivity extends Settings { /* empty */ }
|
||||||
public static class CaptioningSettingsActivity extends Settings { /* empty */ }
|
public static class CaptioningSettingsActivity extends Settings { /* empty */ }
|
||||||
|
public static class AccessibilityInversionSettingsActivity extends Settings { /* empty */ }
|
||||||
|
public static class AccessibilityContrastSettingsActivity extends Settings { /* empty */ }
|
||||||
|
public static class AccessibilityDaltonizerSettingsActivity extends Settings { /* empty */ }
|
||||||
public static class SecuritySettingsActivity extends Settings { /* empty */ }
|
public static class SecuritySettingsActivity extends Settings { /* empty */ }
|
||||||
public static class LocationSettingsActivity extends Settings { /* empty */ }
|
public static class LocationSettingsActivity extends Settings { /* empty */ }
|
||||||
public static class PrivacySettingsActivity extends Settings { /* empty */ }
|
public static class PrivacySettingsActivity extends Settings { /* empty */ }
|
||||||
|
@@ -103,6 +103,12 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements
|
|||||||
"captioning_preference_screen";
|
"captioning_preference_screen";
|
||||||
private static final String DISPLAY_MAGNIFICATION_PREFERENCE_SCREEN =
|
private static final String DISPLAY_MAGNIFICATION_PREFERENCE_SCREEN =
|
||||||
"screen_magnification_preference_screen";
|
"screen_magnification_preference_screen";
|
||||||
|
private static final String DISPLAY_CONTRAST_PREFERENCE_SCREEN =
|
||||||
|
"contrast_preference_screen";
|
||||||
|
private static final String DISPLAY_INVERSION_PREFERENCE_SCREEN =
|
||||||
|
"inversion_preference_screen";
|
||||||
|
private static final String DISPLAY_DALTONIZER_PREFERENCE_SCREEN =
|
||||||
|
"daltonizer_preference_screen";
|
||||||
|
|
||||||
// Extras passed to sub-fragments.
|
// Extras passed to sub-fragments.
|
||||||
static final String EXTRA_PREFERENCE_KEY = "preference_key";
|
static final String EXTRA_PREFERENCE_KEY = "preference_key";
|
||||||
@@ -198,6 +204,9 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements
|
|||||||
private PreferenceScreen mCaptioningPreferenceScreen;
|
private PreferenceScreen mCaptioningPreferenceScreen;
|
||||||
private PreferenceScreen mDisplayMagnificationPreferenceScreen;
|
private PreferenceScreen mDisplayMagnificationPreferenceScreen;
|
||||||
private PreferenceScreen mGlobalGesturePreferenceScreen;
|
private PreferenceScreen mGlobalGesturePreferenceScreen;
|
||||||
|
private PreferenceScreen mDisplayInversionPreferenceScreen;
|
||||||
|
private PreferenceScreen mDisplayContrastPreferenceScreen;
|
||||||
|
private PreferenceScreen mDisplayDaltonizerPreferenceScreen;
|
||||||
|
|
||||||
private int mLongPressTimeoutDefault;
|
private int mLongPressTimeoutDefault;
|
||||||
|
|
||||||
@@ -375,6 +384,14 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements
|
|||||||
mDisplayMagnificationPreferenceScreen = (PreferenceScreen) findPreference(
|
mDisplayMagnificationPreferenceScreen = (PreferenceScreen) findPreference(
|
||||||
DISPLAY_MAGNIFICATION_PREFERENCE_SCREEN);
|
DISPLAY_MAGNIFICATION_PREFERENCE_SCREEN);
|
||||||
|
|
||||||
|
// Display color adjustments.
|
||||||
|
mDisplayContrastPreferenceScreen = (PreferenceScreen) findPreference(
|
||||||
|
DISPLAY_CONTRAST_PREFERENCE_SCREEN);
|
||||||
|
mDisplayInversionPreferenceScreen = (PreferenceScreen) findPreference(
|
||||||
|
DISPLAY_INVERSION_PREFERENCE_SCREEN);
|
||||||
|
mDisplayDaltonizerPreferenceScreen = (PreferenceScreen) findPreference(
|
||||||
|
DISPLAY_DALTONIZER_PREFERENCE_SCREEN);
|
||||||
|
|
||||||
// Global gesture.
|
// Global gesture.
|
||||||
mGlobalGesturePreferenceScreen =
|
mGlobalGesturePreferenceScreen =
|
||||||
(PreferenceScreen) findPreference(ENABLE_ACCESSIBILITY_GESTURE_PREFERENCE_SCREEN);
|
(PreferenceScreen) findPreference(ENABLE_ACCESSIBILITY_GESTURE_PREFERENCE_SCREEN);
|
||||||
@@ -518,25 +535,16 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements
|
|||||||
mSelectLongPressTimeoutPreference.setValue(value);
|
mSelectLongPressTimeoutPreference.setValue(value);
|
||||||
mSelectLongPressTimeoutPreference.setSummary(mLongPressTimeoutValuetoTitleMap.get(value));
|
mSelectLongPressTimeoutPreference.setSummary(mLongPressTimeoutValuetoTitleMap.get(value));
|
||||||
|
|
||||||
// Captioning.
|
updateFeatureSummary(Settings.Secure.ACCESSIBILITY_CAPTIONING_ENABLED,
|
||||||
final boolean captioningEnabled = Settings.Secure.getInt(getContentResolver(),
|
mCaptioningPreferenceScreen);
|
||||||
Settings.Secure.ACCESSIBILITY_CAPTIONING_ENABLED, 0) == 1;
|
updateFeatureSummary(Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED,
|
||||||
if (captioningEnabled) {
|
mDisplayMagnificationPreferenceScreen);
|
||||||
mCaptioningPreferenceScreen.setSummary(R.string.accessibility_feature_state_on);
|
updateFeatureSummary(Settings.Secure.ACCESSIBILITY_DISPLAY_INVERSION_ENABLED,
|
||||||
} else {
|
mDisplayInversionPreferenceScreen);
|
||||||
mCaptioningPreferenceScreen.setSummary(R.string.accessibility_feature_state_off);
|
updateFeatureSummary(Settings.Secure.ACCESSIBILITY_DISPLAY_CONTRAST_ENABLED,
|
||||||
}
|
mDisplayContrastPreferenceScreen);
|
||||||
|
updateFeatureSummary(Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED,
|
||||||
// Screen magnification.
|
mDisplayDaltonizerPreferenceScreen);
|
||||||
final boolean magnificationEnabled = Settings.Secure.getInt(getContentResolver(),
|
|
||||||
Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED, 0) == 1;
|
|
||||||
if (magnificationEnabled) {
|
|
||||||
mDisplayMagnificationPreferenceScreen.setSummary(
|
|
||||||
R.string.accessibility_feature_state_on);
|
|
||||||
} else {
|
|
||||||
mDisplayMagnificationPreferenceScreen.setSummary(
|
|
||||||
R.string.accessibility_feature_state_off);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Global gesture
|
// Global gesture
|
||||||
final boolean globalGestureEnabled = Settings.Global.getInt(getContentResolver(),
|
final boolean globalGestureEnabled = Settings.Global.getInt(getContentResolver(),
|
||||||
@@ -550,6 +558,12 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateFeatureSummary(String prefKey, Preference pref) {
|
||||||
|
final boolean enabled = Settings.Secure.getInt(getContentResolver(), prefKey, 0) == 1;
|
||||||
|
pref.setSummary(enabled ? R.string.accessibility_feature_state_on
|
||||||
|
: R.string.accessibility_feature_state_off);
|
||||||
|
}
|
||||||
|
|
||||||
private void updateLockScreenRotationCheckbox() {
|
private void updateLockScreenRotationCheckbox() {
|
||||||
Context context = getActivity();
|
Context context = getActivity();
|
||||||
if (context != null) {
|
if (context != null) {
|
||||||
|
@@ -0,0 +1,121 @@
|
|||||||
|
/*
|
||||||
|
* 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);
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,114 @@
|
|||||||
|
/*
|
||||||
|
* 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.accessibilityservice.AccessibilityService;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.preference.CheckBoxPreference;
|
||||||
|
import android.preference.ListPreference;
|
||||||
|
import android.preference.Preference;
|
||||||
|
import android.preference.Preference.OnPreferenceChangeListener;
|
||||||
|
import android.preference.PreferenceScreen;
|
||||||
|
import android.preference.SeekBarPreference;
|
||||||
|
import android.provider.Settings;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.accessibility.AccessibilityManager;
|
||||||
|
import android.widget.CompoundButton;
|
||||||
|
import android.widget.CompoundButton.OnCheckedChangeListener;
|
||||||
|
|
||||||
|
import com.android.settings.R;
|
||||||
|
import com.android.settings.accessibility.ToggleSwitch.OnBeforeCheckedChangeListener;
|
||||||
|
|
||||||
|
public class ToggleDaltonizerPreferenceFragment extends ToggleFeaturePreferenceFragment
|
||||||
|
implements Preference.OnPreferenceChangeListener {
|
||||||
|
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 =
|
||||||
|
Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER_QUICK_SETTING_ENABLED;
|
||||||
|
private static final int DEFAULT_TYPE = AccessibilityManager.DALTONIZER_CORRECT_DEUTERANOMALY;
|
||||||
|
|
||||||
|
private CheckBoxPreference mEnableQuickSetting;
|
||||||
|
private ListPreference mType;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
addPreferencesFromResource(R.xml.accessibility_daltonizer_settings);
|
||||||
|
|
||||||
|
mEnableQuickSetting = (CheckBoxPreference) findPreference("enable_quick_setting");
|
||||||
|
mType = (ListPreference) findPreference("type");
|
||||||
|
|
||||||
|
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 == mType) {
|
||||||
|
Settings.Secure.putInt(getContentResolver(), TYPE, Integer.parseInt((String) newValue));
|
||||||
|
preference.setSummary("%s");
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||||
|
super.onViewCreated(view, savedInstanceState);
|
||||||
|
|
||||||
|
setTitle(getString(R.string.accessibility_display_daltonizer_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 String value = Integer.toString(
|
||||||
|
Settings.Secure.getInt(getContentResolver(), TYPE, DEFAULT_TYPE));
|
||||||
|
mType.setValue(value);
|
||||||
|
mType.setOnPreferenceChangeListener(this);
|
||||||
|
final int index = mType.findIndexOfValue(value);
|
||||||
|
if (index < 0) {
|
||||||
|
// We're using a mode controlled by developer preferences.
|
||||||
|
mType.setSummary(getString(R.string.daltonizer_type_overridden,
|
||||||
|
getString(R.string.simulate_color_space)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -92,9 +92,6 @@ public abstract class ToggleFeaturePreferenceFragment
|
|||||||
super.onViewCreated(view, savedInstanceState);
|
super.onViewCreated(view, savedInstanceState);
|
||||||
onInstallActionBarToggleSwitch();
|
onInstallActionBarToggleSwitch();
|
||||||
onProcessArguments(getArguments());
|
onProcessArguments(getArguments());
|
||||||
// Set a transparent drawable to prevent use of the default one.
|
|
||||||
getListView().setSelector(new ColorDrawable(Color.TRANSPARENT));
|
|
||||||
getListView().setDivider(null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -135,21 +132,45 @@ public abstract class ToggleFeaturePreferenceFragment
|
|||||||
return toggleSwitch;
|
return toggleSwitch;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void onProcessArguments(Bundle arguments) {
|
public void setTitle(String title) {
|
||||||
// Key.
|
final PreferenceActivity activity = (PreferenceActivity) getActivity();
|
||||||
mPreferenceKey = arguments.getString(AccessibilitySettings.EXTRA_PREFERENCE_KEY);
|
|
||||||
// Enabled.
|
|
||||||
final boolean enabled = arguments.getBoolean(AccessibilitySettings.EXTRA_CHECKED);
|
|
||||||
mToggleSwitch.setCheckedInternal(enabled);
|
|
||||||
// Title.
|
|
||||||
PreferenceActivity activity = (PreferenceActivity) getActivity();
|
|
||||||
if (!activity.onIsMultiPane() || activity.onIsHidingHeaders()) {
|
if (!activity.onIsMultiPane() || activity.onIsHidingHeaders()) {
|
||||||
mOldActivityTitle = getActivity().getTitle();
|
mOldActivityTitle = getActivity().getTitle();
|
||||||
String title = arguments.getString(AccessibilitySettings.EXTRA_TITLE);
|
|
||||||
getActivity().getActionBar().setTitle(title);
|
getActivity().getActionBar().setTitle(title);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void onProcessArguments(Bundle arguments) {
|
||||||
|
if (arguments == null) {
|
||||||
|
getPreferenceScreen().removePreference(mSummaryPreference);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Key.
|
||||||
|
mPreferenceKey = arguments.getString(AccessibilitySettings.EXTRA_PREFERENCE_KEY);
|
||||||
|
|
||||||
|
// Enabled.
|
||||||
|
if (arguments.containsKey(AccessibilitySettings.EXTRA_CHECKED)) {
|
||||||
|
final boolean enabled = arguments.getBoolean(AccessibilitySettings.EXTRA_CHECKED);
|
||||||
|
mToggleSwitch.setCheckedInternal(enabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Title.
|
||||||
|
if (arguments.containsKey(AccessibilitySettings.EXTRA_TITLE)) {
|
||||||
|
setTitle(arguments.getString(AccessibilitySettings.EXTRA_TITLE));
|
||||||
|
}
|
||||||
|
|
||||||
// Summary.
|
// Summary.
|
||||||
CharSequence summary = arguments.getCharSequence(AccessibilitySettings.EXTRA_SUMMARY);
|
if (arguments.containsKey(AccessibilitySettings.EXTRA_SUMMARY)) {
|
||||||
mSummaryPreference.setSummary(summary);
|
final CharSequence summary = arguments.getCharSequence(
|
||||||
|
AccessibilitySettings.EXTRA_SUMMARY);
|
||||||
|
mSummaryPreference.setSummary(summary);
|
||||||
|
|
||||||
|
// Set a transparent drawable to prevent use of the default one.
|
||||||
|
getListView().setSelector(new ColorDrawable(Color.TRANSPARENT));
|
||||||
|
getListView().setDivider(null);
|
||||||
|
} else {
|
||||||
|
getPreferenceScreen().removePreference(mSummaryPreference);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,105 @@
|
|||||||
|
/*
|
||||||
|
* 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.accessibilityservice.AccessibilityService;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.preference.CheckBoxPreference;
|
||||||
|
import android.preference.ListPreference;
|
||||||
|
import android.preference.Preference;
|
||||||
|
import android.preference.PreferenceScreen;
|
||||||
|
import android.preference.SeekBarPreference;
|
||||||
|
import android.provider.Settings;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.accessibility.AccessibilityManager;
|
||||||
|
import android.widget.CompoundButton;
|
||||||
|
import android.widget.CompoundButton.OnCheckedChangeListener;
|
||||||
|
|
||||||
|
import com.android.settings.R;
|
||||||
|
import com.android.settings.accessibility.ToggleSwitch.OnBeforeCheckedChangeListener;
|
||||||
|
|
||||||
|
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) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
addPreferencesFromResource(R.xml.accessibility_inversion_settings);
|
||||||
|
|
||||||
|
mEnableQuickSetting = (CheckBoxPreference) findPreference("enable_quick_setting");
|
||||||
|
mType = (ListPreference) findPreference("type");
|
||||||
|
|
||||||
|
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 == mType) {
|
||||||
|
Settings.Secure.putInt(getContentResolver(), TYPE, Integer.parseInt((String) newValue));
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||||
|
super.onViewCreated(view, savedInstanceState);
|
||||||
|
|
||||||
|
setTitle(getString(R.string.accessibility_display_inversion_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);
|
||||||
|
|
||||||
|
mType.setValue(
|
||||||
|
Integer.toString(Settings.Secure.getInt(getContentResolver(), TYPE, DEFAULT_TYPE)));
|
||||||
|
mType.setOnPreferenceChangeListener(this);
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user