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

@@ -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(),