Return: Listanimation Views and Interpolator [2/2]

Signed-off-by: Hưng Phan <phandinhhungvp2001@gmail.com>
This commit is contained in:
jkl5616
2018-09-13 20:49:40 +05:30
committed by Hưng Phan
parent 83f17e74d9
commit f588acecab
4 changed files with 126 additions and 0 deletions

View File

@@ -487,4 +487,56 @@
<item>14</item> <item>14</item>
<item>15</item> <item>15</item>
</string-array> </string-array>
<!-- Listview animation -->
<string-array name="listview_animation_entries">
<item>@string/listview_off</item>
<item>@string/listview_wave_left</item>
<item>@string/listview_wave_right</item>
<item>@string/listview_scale</item>
<item>@string/listview_alpha</item>
<item>@string/listview_stack_top</item>
<item>@string/listview_stack_bottom</item>
<item>@string/listview_unfold</item>
<item>@string/listview_fold</item>
<item>@string/listview_translate_left</item>
<item>@string/listview_translate_right</item>
</string-array>
<string-array name="listview_animation_values">
<item>0</item>
<item>1</item>
<item>2</item>
<item>3</item>
<item>4</item>
<item>5</item>
<item>6</item>
<item>7</item>
<item>8</item>
<item>9</item>
<item>10</item>
</string-array>
<!-- Listview Interpolator -->
<string-array name="listview_interpolator_entries">
<item>@string/listview_off</item>
<item>@string/listview_accelerate_interpolator</item>
<item>@string/listview_decelerate_interpolator</item>
<item>@string/listview_accelerate_decelerate_interpolator</item>
<item>@string/listview_anticipate_interpolator</item>
<item>@string/listview_overshoot_interpolator</item>
<item>@string/listview_anticipate_overshoot_interpolator</item>
<item>@string/listview_bounce_interpolator</item>
</string-array>
<string-array name="listview_interpolator_values">
<item>0</item>
<item>1</item>
<item>2</item>
<item>3</item>
<item>4</item>
<item>5</item>
<item>6</item>
<item>7</item>
</string-array>
</resources> </resources>

View File

@@ -581,4 +581,28 @@
<string name="toast_Translucent_animation">Translucent</string> <string name="toast_Translucent_animation">Translucent</string>
<string name="toast_SlideLeftRight_animation">Slide left to right</string> <string name="toast_SlideLeftRight_animation">Slide left to right</string>
<string name="toast_SlideRightLeft_animation">Slide right to left</string> <string name="toast_SlideRightLeft_animation">Slide right to left</string>
<!-- ListView animation -->
<string name="listview_animation_title">ListView animation</string>
<string name="listview_off">Default</string>
<string name="listview_wave_left">Wave (left)</string>
<string name="listview_wave_right">Wave (right)</string>
<string name="listview_alpha">Alpha</string>
<string name="listview_scale">Scale</string>
<string name="listview_stack_top">Stack (top)</string>
<string name="listview_stack_bottom">Stack (bottom)</string>
<string name="listview_unfold">Unfold</string>
<string name="listview_fold">Fold</string>
<string name="listview_translate_left">Translate (left)</string>
<string name="listview_translate_right">Translate (right)</string>
<!-- ListView interpolator -->
<string name="listview_interpolator_title">ListView interpolator</string>
<string name="listview_accelerate_interpolator">Accelerate</string>
<string name="listview_decelerate_interpolator">Decelerate</string>
<string name="listview_accelerate_decelerate_interpolator">Accelerate and decelerate</string>
<string name="listview_anticipate_interpolator">Anticipate</string>
<string name="listview_overshoot_interpolator">Overshoot</string>
<string name="listview_anticipate_overshoot_interpolator">Anticipate and overshoot</string>
<string name="listview_bounce_interpolator">Bounce</string>
</resources> </resources>

View File

@@ -71,4 +71,20 @@
android:entries="@array/toast_animation_entries" android:entries="@array/toast_animation_entries"
android:entryValues="@array/toast_animation_values" android:entryValues="@array/toast_animation_values"
android:persistent="false" /> android:persistent="false" />
<ListPreference
android:key="listview_animation"
android:dialogTitle="@string/listview_animation_title"
android:title="@string/listview_animation_title"
android:entries="@array/listview_animation_entries"
android:entryValues="@array/listview_animation_values"
android:defaultValue="0" />
<ListPreference
android:key="listview_interpolator"
android:dialogTitle="@string/listview_interpolator_title"
android:title="@string/listview_interpolator_title"
android:entries="@array/listview_interpolator_entries"
android:entryValues="@array/listview_interpolator_values"
android:defaultValue="0" />
</PreferenceScreen> </PreferenceScreen>

View File

@@ -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_OPEN = "wallpaper_intra_open";
private static final String WALLPAPER_INTRA_CLOSE = "wallpaper_intra_close"; private static final String WALLPAPER_INTRA_CLOSE = "wallpaper_intra_close";
private static final String KEY_TOAST_ANIMATION = "toast_animation"; 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 mToastAnimation;
private ListPreference mListViewAnimation;
private ListPreference mListViewInterpolator;
ListPreference mActivityOpenPref; ListPreference mActivityOpenPref;
ListPreference mActivityClosePref; ListPreference mActivityClosePref;
ListPreference mTaskOpenPref; ListPreference mTaskOpenPref;
@@ -100,6 +104,21 @@ public class AnimationsSettings extends SettingsPreferenceFragment
mToastAnimation.setSummary(mToastAnimation.getEntries()[CurrentToastAnimation]); mToastAnimation.setSummary(mToastAnimation.getEntries()[CurrentToastAnimation]);
mToastAnimation.setOnPreferenceChangeListener(this); 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(); mAnimations = AwesomeAnimationHelper.getAnimationsList();
int animqty = mAnimations.length; int animqty = mAnimations.length;
mAnimationsStrings = new String[animqty]; mAnimationsStrings = new String[animqty];
@@ -186,6 +205,21 @@ public class AnimationsSettings extends SettingsPreferenceFragment
mToastAnimation.setSummary(mToastAnimation.getEntries()[index]); mToastAnimation.setSummary(mToastAnimation.getEntries()[index]);
Toast.makeText(mContext, "Toast Test", Toast.LENGTH_SHORT).show(); Toast.makeText(mContext, "Toast Test", Toast.LENGTH_SHORT).show();
return true; 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) { } else if (preference == mActivityOpenPref) {
int val = Integer.parseInt((String) newValue); int val = Integer.parseInt((String) newValue);
result = Settings.Global.putInt(mContext.getContentResolver(), result = Settings.Global.putInt(mContext.getContentResolver(),