Cherish:Added ANIMATION_DURATION options [2/2]

Correct few things in AnimationSettings

Signed-off-by: Hưng Phan <phandinhhungvp2001@gmail.com>
This commit is contained in:
Alexey Derendyaev
2018-09-26 15:38:08 +05:30
committed by Hưng Phan
parent 9c0e1c565a
commit 76037acfce
3 changed files with 32 additions and 14 deletions

View File

@@ -42,6 +42,8 @@ import com.android.settings.SettingsPreferenceFragment;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.internal.util.cherish.AwesomeAnimationHelper;
import com.cherish.settings.preferences.CustomSeekBarPreference;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
@@ -57,7 +59,6 @@ public class AnimationsSettings extends SettingsPreferenceFragment
private static final String TASK_CLOSE = "task_close";
private static final String TASK_MOVE_TO_FRONT = "task_move_to_front";
private static final String TASK_MOVE_TO_BACK = "task_move_to_back";
private static final String ANIMATION_NO_OVERRIDE = "animation_no_override";
private static final String WALLPAPER_OPEN = "wallpaper_open";
private static final String WALLPAPER_CLOSE = "wallpaper_close";
private static final String WALLPAPER_INTRA_OPEN = "wallpaper_intra_open";
@@ -68,22 +69,24 @@ public class AnimationsSettings extends SettingsPreferenceFragment
private static final String SCROLLINGCACHE_PREF = "pref_scrollingcache";
private static final String SCROLLINGCACHE_PERSIST_PROP = "persist.sys.scrollingcache";
private static final String SCROLLINGCACHE_DEFAULT = "2";
private static final String ANIMATION_DURATION = "animation_duration";
private ListPreference mToastAnimation;
private ListPreference mScrollingCachePref;
private ListPreference mListViewAnimation;
private ListPreference mListViewInterpolator;
ListPreference mActivityOpenPref;
ListPreference mActivityClosePref;
ListPreference mTaskOpenPref;
ListPreference mTaskOpenBehind;
ListPreference mTaskClosePref;
ListPreference mTaskMoveToFrontPref;
ListPreference mTaskMoveToBackPref;
ListPreference mWallpaperOpen;
ListPreference mWallpaperClose;
ListPreference mWallpaperIntraOpen;
ListPreference mWallpaperIntraClose;
private ListPreference mActivityOpenPref;
private ListPreference mActivityClosePref;
private ListPreference mTaskOpenPref;
private ListPreference mTaskOpenBehind;
private ListPreference mTaskClosePref;
private ListPreference mTaskMoveToFrontPref;
private ListPreference mTaskMoveToBackPref;
private ListPreference mWallpaperOpen;
private ListPreference mWallpaperClose;
private ListPreference mWallpaperIntraOpen;
private ListPreference mWallpaperIntraClose;
private CustomSeekBarPreference mAnimationDuration;
private int[] mAnimations;
private String[] mAnimationsStrings;
@@ -139,6 +142,10 @@ public class AnimationsSettings extends SettingsPreferenceFragment
mAnimationsNum[i] = String.valueOf(mAnimations[i]);
}
mAnimationDuration = (CustomSeekBarPreference) findPreference(ANIMATION_DURATION);
mAnimationDuration.setValue(Settings.Global.getInt(resolver, Settings.Global.ANIMATION_CONTROLS_DURATION, 0));
mAnimationDuration.setOnPreferenceChangeListener(this);
mActivityOpenPref = (ListPreference) findPreference(ACTIVITY_OPEN);
mActivityOpenPref.setOnPreferenceChangeListener(this);
mActivityOpenPref.setSummary(getProperSummary(mActivityOpenPref));
@@ -286,6 +293,10 @@ public class AnimationsSettings extends SettingsPreferenceFragment
int val = Integer.parseInt((String) newValue);
result = Settings.Global.putInt(mContext.getContentResolver(),
Settings.Global.ACTIVITY_ANIMATION_CONTROLS[10], val);
} else if (preference == mAnimationDuration) {
int val = (Integer) newValue;
Settings.Global.putInt(getContentResolver(), Settings.Global.ANIMATION_CONTROLS_DURATION, val);
return true;
}
preference.setSummary(getProperSummary(preference));
return result;