diff --git a/res/values/cherish_arrays.xml b/res/values/cherish_arrays.xml
index 06b4f9b..2f1d1a5 100644
--- a/res/values/cherish_arrays.xml
+++ b/res/values/cherish_arrays.xml
@@ -209,5 +209,31 @@
- 8
- 9
+
+
+
+ - @string/qs_tile_animation_style_off
+ - @string/qs_tile_animation_style_flip
+ - @string/qs_tile_animation_style_rotate
+
+
+
+ - 0
+ - 1
+ - 2
+
+
+
+
+ - @string/qs_tile_animation_duration_low
+ - @string/qs_tile_animation_duration_default
+ - @string/qs_tile_animation_duration_fast
+
+
+
+ - 2500
+ - 2000
+ - 1500
+
diff --git a/res/values/cherish_strings.xml b/res/values/cherish_strings.xml
index 5d2ae6f..d5928c8 100644
--- a/res/values/cherish_strings.xml
+++ b/res/values/cherish_strings.xml
@@ -346,5 +346,17 @@
Charging animation
Display an animation when the device is plugged in
-
-
\ No newline at end of file
+
+
+ Animations
+ Animation style
+ Animation duration
+ no animation
+ flip
+ rotate
+ low
+ default
+ fast
+ Animation is set to %1$s
+ Animation duration is set to %1$s
+
diff --git a/res/xml/cherish_settings_animations.xml b/res/xml/cherish_settings_animations.xml
index 6aac2a3..46dd603 100644
--- a/res/xml/cherish_settings_animations.xml
+++ b/res/xml/cherish_settings_animations.xml
@@ -19,5 +19,24 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/animations_title"
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings" >
+
+
+
+
+
+
+
diff --git a/src/com/cherish/settings/fragments/AnimationsSettings.java b/src/com/cherish/settings/fragments/AnimationsSettings.java
index f59a71d..91e79f9 100644
--- a/src/com/cherish/settings/fragments/AnimationsSettings.java
+++ b/src/com/cherish/settings/fragments/AnimationsSettings.java
@@ -54,6 +54,12 @@ import java.util.List;
@SearchIndexable(forTarget = SearchIndexable.ALL & ~SearchIndexable.ARC)
public class AnimationsSettings extends SettingsPreferenceFragment
implements OnPreferenceChangeListener {
+
+ private static final String PREF_TILE_ANIM_STYLE = "qs_tile_animation_style";
+ private static final String PREF_TILE_ANIM_DURATION = "qs_tile_animation_duration";
+
+ private ListPreference mTileAnimationStyle;
+ private ListPreference mTileAnimationDuration;
@Override
public int getMetricsCategory() {
@@ -66,6 +72,22 @@ public class AnimationsSettings extends SettingsPreferenceFragment
addPreferencesFromResource(R.xml.cherish_settings_animations);
ContentResolver resolver = getActivity().getContentResolver();
PreferenceScreen prefs = getPreferenceScreen();
+
+ // QS animation
+ mTileAnimationStyle = (ListPreference) findPreference(PREF_TILE_ANIM_STYLE);
+ int tileAnimationStyle = Settings.System.getIntForUser(resolver,
+ Settings.System.ANIM_TILE_STYLE, 0, UserHandle.USER_CURRENT);
+ mTileAnimationStyle.setValue(String.valueOf(tileAnimationStyle));
+ updateTileAnimationStyleSummary(tileAnimationStyle);
+ updateAnimTileDuration(tileAnimationStyle);
+ mTileAnimationStyle.setOnPreferenceChangeListener(this);
+
+ mTileAnimationDuration = (ListPreference) findPreference(PREF_TILE_ANIM_DURATION);
+ int tileAnimationDuration = Settings.System.getIntForUser(resolver,
+ Settings.System.ANIM_TILE_DURATION, 2000, UserHandle.USER_CURRENT);
+ mTileAnimationDuration.setValue(String.valueOf(tileAnimationDuration));
+ updateTileAnimationDurationSummary(tileAnimationDuration);
+ mTileAnimationDuration.setOnPreferenceChangeListener(this);
}
@Override
@@ -76,9 +98,43 @@ public class AnimationsSettings extends SettingsPreferenceFragment
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
ContentResolver resolver = getActivity().getContentResolver();
- return false;
-}
+ if (preference == mTileAnimationStyle) {
+ int tileAnimationStyle = Integer.valueOf((String) newValue);
+ Settings.System.putIntForUser(resolver, Settings.System.ANIM_TILE_STYLE,
+ tileAnimationStyle, UserHandle.USER_CURRENT);
+ updateTileAnimationStyleSummary(tileAnimationStyle);
+ updateAnimTileDuration(tileAnimationStyle);
+ return true;
+ } else if (preference == mTileAnimationDuration) {
+ int tileAnimationDuration = Integer.valueOf((String) newValue);
+ Settings.System.putIntForUser(resolver, Settings.System.ANIM_TILE_DURATION,
+ tileAnimationDuration, UserHandle.USER_CURRENT);
+ updateTileAnimationDurationSummary(tileAnimationDuration);
+ return true;
+ }
+ return false;
+ }
+
+ private void updateTileAnimationStyleSummary(int tileAnimationStyle) {
+ String prefix = (String) mTileAnimationStyle.getEntries()[mTileAnimationStyle.findIndexOfValue(String
+ .valueOf(tileAnimationStyle))];
+ mTileAnimationStyle.setSummary(getResources().getString(R.string.qs_set_animation_style, prefix));
+ }
+ private void updateTileAnimationDurationSummary(int tileAnimationDuration) {
+ String prefix = (String) mTileAnimationDuration.getEntries()[mTileAnimationDuration.findIndexOfValue(String
+ .valueOf(tileAnimationDuration))];
+ mTileAnimationDuration.setSummary(getResources().getString(R.string.qs_set_animation_duration, prefix));
+ }
+
+ private void updateAnimTileDuration(int tileAnimationStyle) {
+ if (mTileAnimationDuration != null) {
+ if (tileAnimationStyle == 0) {
+ mTileAnimationDuration.setSelectable(false);
+ } else {
+ mTileAnimationDuration.setSelectable(true);
+ }
+ }
/**
* For Search.
*/