Cherish:Power Menu animations [2/2]

This commit is contained in:
Alex Cruz
2018-11-17 19:48:58 +05:30
committed by Hưng Phan
parent ba1cbe8331
commit 09719c8493
4 changed files with 50 additions and 0 deletions

View File

@@ -516,4 +516,17 @@
<item>@string/volume_panel_oreo_val</item>
<item>@string/volume_panel_tiled_val</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

@@ -585,4 +585,13 @@
<string name="volume_panel_compat_val">co.potatoproject.plugin.volume.compact</string>
<string name="volume_panel_oreo_val">co.potatoproject.plugin.volume.oreo</string>
<string name="volume_panel_tiled_val">co.potatoproject.plugin.volume.tiled</string>
<!-- Power menu Animations -->
<string name="power_menu_animation">Power menu</string>
<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

@@ -88,5 +88,19 @@
android:title="@string/wallpaper_intra_close_title" />
</PreferenceCategory>
<PreferenceCategory
android:title="@string/power_menu_animation">
<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" />
</PreferenceCategory>
</PreferenceScreen>

View File

@@ -61,8 +61,10 @@ public class AnimationsSettings extends SettingsPreferenceFragment implements On
private static final String WALLPAPER_CLOSE = "wallpaper_close";
private static final String WALLPAPER_INTRA_OPEN = "wallpaper_intra_open";
private static final String WALLPAPER_INTRA_CLOSE = "wallpaper_intra_close";
private static final String POWER_MENU_ANIMATIONS = "power_menu_animations";
private CustomSeekBarPreference mAnimDuration;
private ListPreference mPowerMenuAnimations;
ListPreference mActivityOpenPref;
ListPreference mActivityClosePref;
@@ -167,6 +169,12 @@ public class AnimationsSettings extends SettingsPreferenceFragment implements On
mWallpaperIntraClose.setEntries(mAnimationsStrings);
mWallpaperIntraClose.setEntryValues(mAnimationsNum);
mWallpaperIntraClose.setOnPreferenceChangeListener(this);
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
@@ -242,6 +250,12 @@ public class AnimationsSettings extends SettingsPreferenceFragment implements On
Settings.Global.putInt(resolver,
Settings.Global.ACTIVITY_ANIMATION_CONTROLS[10], val);
preference.setSummary(getProperSummary(preference));
return true;
} else 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;