diff --git a/res/values/cherish_arrays.xml b/res/values/cherish_arrays.xml index 0bc3db5..34bc2bc 100644 --- a/res/values/cherish_arrays.xml +++ b/res/values/cherish_arrays.xml @@ -486,4 +486,17 @@ 600000 1800000 + + + + @string/power_menu_animation_aosp + @string/power_menu_animation_bottom + @string/power_menu_animation_top + + + + 0 + 1 + 2 + diff --git a/res/values/cherish_strings.xml b/res/values/cherish_strings.xml index ab41ecc..f7937d0 100644 --- a/res/values/cherish_strings.xml +++ b/res/values/cherish_strings.xml @@ -737,5 +737,12 @@ Use custom lightness scale Brightness Confirm + + + Power menu animation + Select power menu animation + AOSP (default) + Bottom + Top diff --git a/res/xml/cherish_settings_animations.xml b/res/xml/cherish_settings_animations.xml index 6aac2a3..9226217 100644 --- a/res/xml/cherish_settings_animations.xml +++ b/res/xml/cherish_settings_animations.xml @@ -19,5 +19,14 @@ xmlns:android="http://schemas.android.com/apk/res/android" android:title="@string/animations_title" xmlns:settings="http://schemas.android.com/apk/res/com.android.settings" > + + diff --git a/src/com/cherish/settings/fragments/AnimationsSettings.java b/src/com/cherish/settings/fragments/AnimationsSettings.java index f59a71d..47ea8c4 100644 --- a/src/com/cherish/settings/fragments/AnimationsSettings.java +++ b/src/com/cherish/settings/fragments/AnimationsSettings.java @@ -54,6 +54,10 @@ import java.util.List; @SearchIndexable(forTarget = SearchIndexable.ALL & ~SearchIndexable.ARC) public class AnimationsSettings extends SettingsPreferenceFragment implements OnPreferenceChangeListener { + + private static final String POWER_MENU_ANIMATIONS = "power_menu_animations"; + + private ListPreference mPowerMenuAnimations; @Override public int getMetricsCategory() { @@ -66,6 +70,12 @@ public class AnimationsSettings extends SettingsPreferenceFragment addPreferencesFromResource(R.xml.cherish_settings_animations); ContentResolver resolver = getActivity().getContentResolver(); PreferenceScreen prefs = getPreferenceScreen(); + + mPowerMenuAnimations = (ListPreference) findPreference(POWER_MENU_ANIMATIONS); + mPowerMenuAnimations.setValue(String.valueOf(Settings.System.getInt( + getContentResolver(), Settings.System.POWER_MENU_ANIMATIONS, 0))); + mPowerMenuAnimations.setSummary(mPowerMenuAnimations.getEntry()); + mPowerMenuAnimations.setOnPreferenceChangeListener(this); } @Override @@ -75,7 +85,14 @@ public class AnimationsSettings extends SettingsPreferenceFragment @Override public boolean onPreferenceChange(Preference preference, Object newValue) { - ContentResolver resolver = getActivity().getContentResolver(); + ContentResolver resolver = getActivity().getContentResolver(); + if (preference == mPowerMenuAnimations) { + Settings.System.putInt(getContentResolver(), Settings.System.POWER_MENU_ANIMATIONS, + Integer.valueOf((String) newValue)); + mPowerMenuAnimations.setValue(String.valueOf(newValue)); + mPowerMenuAnimations.setSummary(mPowerMenuAnimations.getEntry()); + return true; + } return false; }