Add Developer Option setting for Animator scaling.
This new setting allows users to set a scale factor for the
duration and startDelay of all Animator-based animations. This
setting is very similar to the Transition animation scale and
Window animation scale settings, except this one applies specifically
to Animator animations. The property is only accessible by users
through the Settings UI, not programmatically. The value applies
system-wide and is picked up per-process at the time of the first
ValueAnimator construction.
Change-Id: I4fd02b03e508495b39481bfc8904d8771d0fd4e1
diff --git a/res/values/arrays.xml b/res/values/arrays.xml
index 97c6d99..17a1669 100644
--- a/res/values/arrays.xml
+++ b/res/values/arrays.xml
@@ -646,6 +646,28 @@
<item>10</item>
</string-array>
+ <!-- Titles for animator duration scale preference. [CHAR LIMIT=35] -->
+ <string-array name="animator_duration_scale_entries">
+ <item>Animation off</item>
+ <item>Animation scale .5x</item>
+ <item>Animation scale 1x</item>
+ <item>Animation scale 1.5x</item>
+ <item>Animation scale 2x</item>
+ <item>Animation scale 5x</item>
+ <item>Animation scale 10x</item>
+ </string-array>
+
+ <!-- Values for animator duration scale preference. -->
+ <string-array name="animator_duration_scale_values" translatable="false" >
+ <item>0</item>
+ <item>.5</item>
+ <item>1</item>
+ <item>1.5</item>
+ <item>2</item>
+ <item>5</item>
+ <item>10</item>
+ </string-array>
+
<!-- Titles for app process limit preference. [CHAR LIMIT=35] -->
<string-array name="app_process_limit_entries">
<item>Standard limit</item>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 988c3ae..842e4e0 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -3516,6 +3516,9 @@
<!-- UI debug setting: scaling factor for transition animations [CHAR LIMIT=25] -->
<string name="transition_animation_scale_title">Transition animation scale</string>
+ <!-- UI debug setting: scaling factor for all Animator-based animations [CHAR LIMIT=25] -->
+ <string name="animator_duration_scale_title">Animator duration scale</string>
+
<!-- Preference category for application debugging development settings. [CHAR LIMIT=25] -->
<string name="debug_applications_category">Apps</string>
diff --git a/res/xml/development_prefs.xml b/res/xml/development_prefs.xml
index 68e24c4..8677a47 100644
--- a/res/xml/development_prefs.xml
+++ b/res/xml/development_prefs.xml
@@ -104,6 +104,13 @@
android:entries="@array/transition_animation_scale_entries"
android:entryValues="@array/transition_animation_scale_values" />
+ <ListPreference
+ android:key="animator_duration_scale"
+ android:title="@string/animator_duration_scale_title"
+ android:persistent="false"
+ android:entries="@array/animator_duration_scale_entries"
+ android:entryValues="@array/animator_duration_scale_values" />
+
</PreferenceCategory>
<PreferenceCategory android:key="debug_applications_category"
diff --git a/src/com/android/settings/DevelopmentSettings.java b/src/com/android/settings/DevelopmentSettings.java
index 2ffae19..4a292c4 100644
--- a/src/com/android/settings/DevelopmentSettings.java
+++ b/src/com/android/settings/DevelopmentSettings.java
@@ -70,6 +70,7 @@
private static final String FORCE_HARDWARE_UI_KEY = "force_hw_ui";
private static final String WINDOW_ANIMATION_SCALE_KEY = "window_animation_scale";
private static final String TRANSITION_ANIMATION_SCALE_KEY = "transition_animation_scale";
+ private static final String ANIMATOR_DURATION_SCALE_KEY = "animator_duration_scale";
private static final String IMMEDIATELY_DESTROY_ACTIVITIES_KEY
= "immediately_destroy_activities";
@@ -93,6 +94,7 @@
private CheckBoxPreference mForceHardwareUi;
private ListPreference mWindowAnimationScale;
private ListPreference mTransitionAnimationScale;
+ private ListPreference mAnimatorDurationScale;
private CheckBoxPreference mImmediatelyDestroyActivities;
private ListPreference mAppProcessLimit;
@@ -129,6 +131,8 @@
mWindowAnimationScale.setOnPreferenceChangeListener(this);
mTransitionAnimationScale = (ListPreference) findPreference(TRANSITION_ANIMATION_SCALE_KEY);
mTransitionAnimationScale.setOnPreferenceChangeListener(this);
+ mAnimatorDurationScale = (ListPreference) findPreference(ANIMATOR_DURATION_SCALE_KEY);
+ mAnimatorDurationScale.setOnPreferenceChangeListener(this);
mImmediatelyDestroyActivities = (CheckBoxPreference) findPreference(
IMMEDIATELY_DESTROY_ACTIVITIES_KEY);
@@ -359,6 +363,7 @@
private void updateAnimationScaleOptions() {
updateAnimationScaleValue(0, mWindowAnimationScale);
updateAnimationScaleValue(1, mTransitionAnimationScale);
+ updateAnimationScaleValue(2, mAnimatorDurationScale);
}
private void writeAnimationScaleOption(int which, ListPreference pref, Object newValue) {
@@ -473,6 +478,9 @@
} else if (preference == mTransitionAnimationScale) {
writeAnimationScaleOption(1, mTransitionAnimationScale, newValue);
return true;
+ } else if (preference == mAnimatorDurationScale) {
+ writeAnimationScaleOption(2, mAnimatorDurationScale, newValue);
+ return true;
} else if (preference == mAppProcessLimit) {
writeAppProcessLimitOptions(newValue);
return true;