diff --git a/res/values/cherish_arrays.xml b/res/values/cherish_arrays.xml index 2f1d1a5..78d7a78 100644 --- a/res/values/cherish_arrays.xml +++ b/res/values/cherish_arrays.xml @@ -235,5 +235,28 @@ 2000 1500 + + + + @string/qs_tile_animation_interpolator_linearInterpolator + @string/qs_tile_animation_interpolator_accelerateInterpolator + @string/qs_tile_animation_interpolator_decelerateInterpolator + @string/qs_tile_animation_interpolator_accelerateDecelerateInterpolator + @string/qs_tile_animation_interpolator_bounceInterpolator + @string/qs_tile_animation_interpolator_overshootInterpolator + @string/qs_tile_animation_interpolator_anticipateInterpolator + @string/qs_tile_animation_interpolator_anticipateOvershootInterpolator + + + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + diff --git a/res/values/cherish_strings.xml b/res/values/cherish_strings.xml index d5928c8..5349216 100644 --- a/res/values/cherish_strings.xml +++ b/res/values/cherish_strings.xml @@ -351,12 +351,22 @@ 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 + Tiles animation interpolator + No animation + Flip + Rotate + Low + Default + Fast + Linear + Accelerate + Decelerate + Accelerate decelerate + Bounce + Overshoot + Anticipate + Anticipate overshoot + %1$s + %1$s + %1$s diff --git a/res/xml/cherish_settings_animations.xml b/res/xml/cherish_settings_animations.xml index 46dd603..8c0b73d 100644 --- a/res/xml/cherish_settings_animations.xml +++ b/res/xml/cherish_settings_animations.xml @@ -22,7 +22,7 @@ + android:title="@string/qs_tile_animation_title"> - + + diff --git a/src/com/cherish/settings/fragments/AnimationsSettings.java b/src/com/cherish/settings/fragments/AnimationsSettings.java index 91e79f9..e207d4b 100644 --- a/src/com/cherish/settings/fragments/AnimationsSettings.java +++ b/src/com/cherish/settings/fragments/AnimationsSettings.java @@ -57,9 +57,11 @@ public class AnimationsSettings extends SettingsPreferenceFragment 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 static final String PREF_TILE_ANIM_INTERPOLATOR = "qs_tile_animation_interpolator"; private ListPreference mTileAnimationStyle; private ListPreference mTileAnimationDuration; + private ListPreference mTileAnimationInterpolator; @Override public int getMetricsCategory() { @@ -79,7 +81,7 @@ public class AnimationsSettings extends SettingsPreferenceFragment Settings.System.ANIM_TILE_STYLE, 0, UserHandle.USER_CURRENT); mTileAnimationStyle.setValue(String.valueOf(tileAnimationStyle)); updateTileAnimationStyleSummary(tileAnimationStyle); - updateAnimTileDuration(tileAnimationStyle); + updateAnimTileStyle(tileAnimationStyle); mTileAnimationStyle.setOnPreferenceChangeListener(this); mTileAnimationDuration = (ListPreference) findPreference(PREF_TILE_ANIM_DURATION); @@ -88,6 +90,13 @@ public class AnimationsSettings extends SettingsPreferenceFragment mTileAnimationDuration.setValue(String.valueOf(tileAnimationDuration)); updateTileAnimationDurationSummary(tileAnimationDuration); mTileAnimationDuration.setOnPreferenceChangeListener(this); + + mTileAnimationInterpolator = (ListPreference) findPreference(PREF_TILE_ANIM_INTERPOLATOR); + int tileAnimationInterpolator = Settings.System.getIntForUser(getContentResolver(), + Settings.System.ANIM_TILE_INTERPOLATOR, 0, UserHandle.USER_CURRENT); + mTileAnimationInterpolator.setValue(String.valueOf(tileAnimationInterpolator)); + updateTileAnimationInterpolatorSummary(tileAnimationInterpolator); + mTileAnimationInterpolator.setOnPreferenceChangeListener(this); } @Override @@ -103,7 +112,7 @@ public class AnimationsSettings extends SettingsPreferenceFragment Settings.System.putIntForUser(resolver, Settings.System.ANIM_TILE_STYLE, tileAnimationStyle, UserHandle.USER_CURRENT); updateTileAnimationStyleSummary(tileAnimationStyle); - updateAnimTileDuration(tileAnimationStyle); + updateAnimTileStyle(tileAnimationStyle); return true; } else if (preference == mTileAnimationDuration) { int tileAnimationDuration = Integer.valueOf((String) newValue); @@ -111,6 +120,12 @@ public class AnimationsSettings extends SettingsPreferenceFragment tileAnimationDuration, UserHandle.USER_CURRENT); updateTileAnimationDurationSummary(tileAnimationDuration); return true; + } else if (preference == mTileAnimationInterpolator) { + int tileAnimationInterpolator = Integer.valueOf((String) newValue); + Settings.System.putIntForUser(resolver, Settings.System.ANIM_TILE_INTERPOLATOR, + tileAnimationInterpolator, UserHandle.USER_CURRENT); + updateTileAnimationInterpolatorSummary(tileAnimationInterpolator); + return true; } return false; } @@ -127,14 +142,23 @@ public class AnimationsSettings extends SettingsPreferenceFragment mTileAnimationDuration.setSummary(getResources().getString(R.string.qs_set_animation_duration, prefix)); } - private void updateAnimTileDuration(int tileAnimationStyle) { + private void updateTileAnimationInterpolatorSummary(int tileAnimationInterpolator) { + String prefix = (String) mTileAnimationInterpolator.getEntries()[mTileAnimationInterpolator.findIndexOfValue(String + .valueOf(tileAnimationInterpolator))]; + mTileAnimationInterpolator.setSummary(getResources().getString(R.string.qs_set_animation_interpolator, prefix)); + } + + private void updateAnimTileStyle(int tileAnimationStyle) { if (mTileAnimationDuration != null) { if (tileAnimationStyle == 0) { mTileAnimationDuration.setSelectable(false); + mTileAnimationInterpolator.setSelectable(false); } else { mTileAnimationDuration.setSelectable(true); + mTileAnimationInterpolator.setSelectable(true); } } + } /** * For Search. */