Cherish:Power Menu animations [2/2]

Signed-off-by: Hưng Phan <phandinhhungvp2001@gmail.com>
This commit is contained in:
Alex Cruz
2018-11-17 19:48:58 +05:30
committed by Hưng Phan
parent 3aff8b6ff6
commit 54c3509bed
4 changed files with 44 additions and 0 deletions

View File

@@ -622,4 +622,17 @@
<item>6</item>
<item>7</item>
</string-array>
<!-- Power menu Animations -->
<string-array name="power_menu_animations_entries">
<item>@string/power_menu_animation_aosp</item>
<item>@string/power_menu_animation_bottom</item>
<item>@string/power_menu_animation_top</item>
</string-array>
<string-array name="power_menu_animations_values" translatable="false">
<item>0</item>
<item>1</item>
<item>2</item>
</string-array>
</resources>

View File

@@ -648,4 +648,12 @@
<string name="qs_set_animation_style">%1$s</string>
<string name="qs_set_animation_duration">%1$s</string>
<string name="qs_set_animation_interpolator">%1$s</string>
<!-- Power menu Animations -->
<string name="power_menu_animation_title">Power menu animation</string>
<string name="power_menu_animation_summary">Change the enter/exit animation of the power menu</string>
<string name="power_menu_animation_dialog_title">Select power menu animation</string>
<string name="power_menu_animation_aosp">AOSP (default)</string>
<string name="power_menu_animation_bottom">Bottom</string>
<string name="power_menu_animation_top">Top</string>
</resources>

View File

@@ -18,6 +18,15 @@
android:title="@string/powermenu_title"
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings">
<ListPreference
android:key="power_menu_animations"
android:title="@string/power_menu_animation_title"
android:dialogTitle="@string/power_menu_animation_dialog_title"
android:entries="@array/power_menu_animations_entries"
android:entryValues="@array/power_menu_animations_values"
android:summary="@string/power_menu_animation_summary"
android:persistent="false" />
<com.cherish.settings.preferences.SystemSettingSwitchPreference
android:key="global_actions_screenshot"
android:icon="@drawable/ic_screenshot"

View File

@@ -44,7 +44,9 @@ import java.util.List;
public class PowerMenuSettings extends SettingsPreferenceFragment
implements Preference.OnPreferenceChangeListener {
private static final String POWER_MENU_ANIMATIONS = "power_menu_animations";
private ListPreference mPowerMenuAnimations;
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
@@ -54,11 +56,23 @@ public class PowerMenuSettings extends SettingsPreferenceFragment
final ContentResolver resolver = getActivity().getContentResolver();
final PreferenceScreen prefScreen = 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
public boolean onPreferenceChange(Preference preference, Object newValue) {
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;
}