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

@@ -560,8 +560,6 @@
<string name="wallpaper_intra_open_title">Wallpaper intra open animation</string> <string name="wallpaper_intra_open_title">Wallpaper intra open animation</string>
<string name="wallpaper_intra_close_title">Wallpaper intra close animation</string> <string name="wallpaper_intra_close_title">Wallpaper intra close animation</string>
<string name="animation_duration_title">Animation duration</string> <string name="animation_duration_title">Animation duration</string>
<string name="title_animation_no_override">Prevent app overrides</string>
<string name="summary_animation_no_override">Prevent apps from overriding transitions</string>
<string name="animation_duration_default">Default</string> <string name="animation_duration_default">Default</string>
<!-- Toast Animation --> <!-- Toast Animation -->

View File

@@ -23,6 +23,15 @@
<PreferenceCategory <PreferenceCategory
android:title="@string/system_animation_title"> android:title="@string/system_animation_title">
<com.cherish.settings.preferences.CustomSeekBarPreference
android:key="animation_duration"
android:max="1500"
android:persistent="false"
android:title="@string/animation_duration_title"
settings:min="0"
settings:units="ms"
settings:interval="50"/>
<ListPreference <ListPreference
android:key="activity_open" android:key="activity_open"
android:title="@string/activity_open_title" /> android:title="@string/activity_open_title" />

View File

@@ -42,6 +42,8 @@ import com.android.settings.SettingsPreferenceFragment;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent; import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.internal.util.cherish.AwesomeAnimationHelper; import com.android.internal.util.cherish.AwesomeAnimationHelper;
import com.cherish.settings.preferences.CustomSeekBarPreference;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashSet; 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_CLOSE = "task_close";
private static final String TASK_MOVE_TO_FRONT = "task_move_to_front"; 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 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_OPEN = "wallpaper_open";
private static final String WALLPAPER_CLOSE = "wallpaper_close"; private static final String WALLPAPER_CLOSE = "wallpaper_close";
private static final String WALLPAPER_INTRA_OPEN = "wallpaper_intra_open"; 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_PREF = "pref_scrollingcache";
private static final String SCROLLINGCACHE_PERSIST_PROP = "persist.sys.scrollingcache"; private static final String SCROLLINGCACHE_PERSIST_PROP = "persist.sys.scrollingcache";
private static final String SCROLLINGCACHE_DEFAULT = "2"; private static final String SCROLLINGCACHE_DEFAULT = "2";
private static final String ANIMATION_DURATION = "animation_duration";
private ListPreference mToastAnimation; private ListPreference mToastAnimation;
private ListPreference mScrollingCachePref; private ListPreference mScrollingCachePref;
private ListPreference mListViewAnimation; private ListPreference mListViewAnimation;
private ListPreference mListViewInterpolator; private ListPreference mListViewInterpolator;
ListPreference mActivityOpenPref; private ListPreference mActivityOpenPref;
ListPreference mActivityClosePref; private ListPreference mActivityClosePref;
ListPreference mTaskOpenPref; private ListPreference mTaskOpenPref;
ListPreference mTaskOpenBehind; private ListPreference mTaskOpenBehind;
ListPreference mTaskClosePref; private ListPreference mTaskClosePref;
ListPreference mTaskMoveToFrontPref; private ListPreference mTaskMoveToFrontPref;
ListPreference mTaskMoveToBackPref; private ListPreference mTaskMoveToBackPref;
ListPreference mWallpaperOpen; private ListPreference mWallpaperOpen;
ListPreference mWallpaperClose; private ListPreference mWallpaperClose;
ListPreference mWallpaperIntraOpen; private ListPreference mWallpaperIntraOpen;
ListPreference mWallpaperIntraClose; private ListPreference mWallpaperIntraClose;
private CustomSeekBarPreference mAnimationDuration;
private int[] mAnimations; private int[] mAnimations;
private String[] mAnimationsStrings; private String[] mAnimationsStrings;
@@ -139,6 +142,10 @@ public class AnimationsSettings extends SettingsPreferenceFragment
mAnimationsNum[i] = String.valueOf(mAnimations[i]); 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 = (ListPreference) findPreference(ACTIVITY_OPEN);
mActivityOpenPref.setOnPreferenceChangeListener(this); mActivityOpenPref.setOnPreferenceChangeListener(this);
mActivityOpenPref.setSummary(getProperSummary(mActivityOpenPref)); mActivityOpenPref.setSummary(getProperSummary(mActivityOpenPref));
@@ -286,6 +293,10 @@ public class AnimationsSettings extends SettingsPreferenceFragment
int val = Integer.parseInt((String) newValue); int val = Integer.parseInt((String) newValue);
result = Settings.Global.putInt(mContext.getContentResolver(), result = Settings.Global.putInt(mContext.getContentResolver(),
Settings.Global.ACTIVITY_ANIMATION_CONTROLS[10], val); 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)); preference.setSummary(getProperSummary(preference));
return result; return result;