From f588acecabcafc33b4a07b3bf1a70f586d51241a Mon Sep 17 00:00:00 2001 From: jkl5616 Date: Thu, 13 Sep 2018 20:49:40 +0530 Subject: [PATCH] Return: Listanimation Views and Interpolator [2/2] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Hưng Phan --- res/values/cherish_arrays.xml | 52 +++++++++++++++++++ res/values/cherish_strings.xml | 24 +++++++++ res/xml/cherish_settings_animations.xml | 16 ++++++ .../fragments/AnimationsSettings.java | 34 ++++++++++++ 4 files changed, 126 insertions(+) diff --git a/res/values/cherish_arrays.xml b/res/values/cherish_arrays.xml index de8a190..7717d84 100644 --- a/res/values/cherish_arrays.xml +++ b/res/values/cherish_arrays.xml @@ -487,4 +487,56 @@ 14 15 + + + + @string/listview_off + @string/listview_wave_left + @string/listview_wave_right + @string/listview_scale + @string/listview_alpha + @string/listview_stack_top + @string/listview_stack_bottom + @string/listview_unfold + @string/listview_fold + @string/listview_translate_left + @string/listview_translate_right + + + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + + + + + @string/listview_off + @string/listview_accelerate_interpolator + @string/listview_decelerate_interpolator + @string/listview_accelerate_decelerate_interpolator + @string/listview_anticipate_interpolator + @string/listview_overshoot_interpolator + @string/listview_anticipate_overshoot_interpolator + @string/listview_bounce_interpolator + + + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + diff --git a/res/values/cherish_strings.xml b/res/values/cherish_strings.xml index 7f470e8..24bcbf2 100644 --- a/res/values/cherish_strings.xml +++ b/res/values/cherish_strings.xml @@ -581,4 +581,28 @@ Translucent Slide left to right Slide right to left + + + ListView animation + Default + Wave (left) + Wave (right) + Alpha + Scale + Stack (top) + Stack (bottom) + Unfold + Fold + Translate (left) + Translate (right) + + + ListView interpolator + Accelerate + Decelerate + Accelerate and decelerate + Anticipate + Overshoot + Anticipate and overshoot + Bounce diff --git a/res/xml/cherish_settings_animations.xml b/res/xml/cherish_settings_animations.xml index b9ac710..bb969c2 100644 --- a/res/xml/cherish_settings_animations.xml +++ b/res/xml/cherish_settings_animations.xml @@ -71,4 +71,20 @@ android:entries="@array/toast_animation_entries" android:entryValues="@array/toast_animation_values" android:persistent="false" /> + + + + diff --git a/src/com/cherish/settings/fragments/AnimationsSettings.java b/src/com/cherish/settings/fragments/AnimationsSettings.java index c0956f6..eee8e4a 100644 --- a/src/com/cherish/settings/fragments/AnimationsSettings.java +++ b/src/com/cherish/settings/fragments/AnimationsSettings.java @@ -62,8 +62,12 @@ public class AnimationsSettings extends SettingsPreferenceFragment private static final String WALLPAPER_INTRA_OPEN = "wallpaper_intra_open"; private static final String WALLPAPER_INTRA_CLOSE = "wallpaper_intra_close"; private static final String KEY_TOAST_ANIMATION = "toast_animation"; + private static final String KEY_LISTVIEW_ANIMATION = "listview_animation"; + private static final String KEY_LISTVIEW_INTERPOLATOR = "listview_interpolator"; private ListPreference mToastAnimation; + private ListPreference mListViewAnimation; + private ListPreference mListViewInterpolator; ListPreference mActivityOpenPref; ListPreference mActivityClosePref; ListPreference mTaskOpenPref; @@ -100,6 +104,21 @@ public class AnimationsSettings extends SettingsPreferenceFragment mToastAnimation.setSummary(mToastAnimation.getEntries()[CurrentToastAnimation]); mToastAnimation.setOnPreferenceChangeListener(this); + mListViewAnimation = (ListPreference) findPreference(KEY_LISTVIEW_ANIMATION); + int listviewanimation = Settings.Global.getInt(getContentResolver(), + Settings.Global.LISTVIEW_ANIMATION, 0); + mListViewAnimation.setValue(String.valueOf(listviewanimation)); + mListViewAnimation.setSummary(mListViewAnimation.getEntry()); + mListViewAnimation.setOnPreferenceChangeListener(this); + + mListViewInterpolator = (ListPreference) findPreference(KEY_LISTVIEW_INTERPOLATOR); + int listviewinterpolator = Settings.Global.getInt(getContentResolver(), + Settings.Global.LISTVIEW_INTERPOLATOR, 0); + mListViewInterpolator.setValue(String.valueOf(listviewinterpolator)); + mListViewInterpolator.setSummary(mListViewInterpolator.getEntry()); + mListViewInterpolator.setOnPreferenceChangeListener(this); + mListViewInterpolator.setEnabled(listviewanimation > 0); + mAnimations = AwesomeAnimationHelper.getAnimationsList(); int animqty = mAnimations.length; mAnimationsStrings = new String[animqty]; @@ -186,6 +205,21 @@ public class AnimationsSettings extends SettingsPreferenceFragment mToastAnimation.setSummary(mToastAnimation.getEntries()[index]); Toast.makeText(mContext, "Toast Test", Toast.LENGTH_SHORT).show(); return true; + } else if (preference == mListViewAnimation) { + int value = Integer.parseInt((String) newValue); + int index = mListViewAnimation.findIndexOfValue((String) newValue); + Settings.Global.putInt(getContentResolver(), + Settings.Global.LISTVIEW_ANIMATION, value); + mListViewAnimation.setSummary(mListViewAnimation.getEntries()[index]); + mListViewInterpolator.setEnabled(value > 0); + return true; + } else if (preference == mListViewInterpolator) { + int value = Integer.parseInt((String) newValue); + int index = mListViewInterpolator.findIndexOfValue((String) newValue); + Settings.Global.putInt(getContentResolver(), + Settings.Global.LISTVIEW_INTERPOLATOR, value); + mListViewInterpolator.setSummary(mListViewInterpolator.getEntries()[index]); + return true; } else if (preference == mActivityOpenPref) { int val = Integer.parseInt((String) newValue); result = Settings.Global.putInt(mContext.getContentResolver(),