diff --git a/res/values/cherish_arrays.xml b/res/values/cherish_arrays.xml index 180dcd0..78295c3 100644 --- a/res/values/cherish_arrays.xml +++ b/res/values/cherish_arrays.xml @@ -389,4 +389,17 @@ EEEE MM/dd @string/status_bar_date_format_custom + + + + @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 2593c22..dd151c7 100644 --- a/res/values/cherish_strings.xml +++ b/res/values/cherish_strings.xml @@ -627,4 +627,11 @@ Label text size Columns (portrait) Columns (landscape) + + + 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; }