diff --git a/res/values/evolution_arrays.xml b/res/values/evolution_arrays.xml index 572524e..2623fb0 100644 --- a/res/values/evolution_arrays.xml +++ b/res/values/evolution_arrays.xml @@ -52,6 +52,79 @@ preset + + + Default + Amazon Fire + Asus Zenfone Max + Essential PH-1 + HTC M8 + Huawei + Hyper OS + Iqoo + LG G3 + Minecraft door + MIUI 10 + MIUI 11 + Nextbit + Nokia X + Old School IOS + One UI + OOS 14 + Razer Phone + Soong + Windows Device + Windows Error + + + + /product/media/audio/ui/Lock.ogg + /product/media/audio/ui/Amazon_Fire_Lock.ogg + /product/media/audio/ui/Asus_Zenfone_Max_Lock.ogg + /product/media/audio/ui/Essential_PH-1_Lock.ogg + /product/media/audio/ui/HTC_M8_Lock.ogg + /product/media/audio/ui/Huawei_Lock.ogg + /product/media/audio/ui/Hyper_OS_Lock.ogg + /product/media/audio/ui/Iqoo_Lock.ogg + /product/media/audio/ui/LG_G3_Lock.ogg + /product/media/audio/ui/Minecraft_Door_Lock.ogg + /product/media/audio/ui/MIUI_10_Lock.ogg + /product/media/audio/ui/MIUI_11_Lock.ogg + /product/media/audio/ui/Nextbit_Lock.ogg + /product/media/audio/ui/Nokia_X_Lock.ogg + /product/media/audio/ui/Old_School_IOS_Lock.ogg + /product/media/audio/ui/One_UI_Lock.ogg + /product/media/audio/ui/OOS_14_Lock.ogg + /product/media/audio/ui/Razer_Phone_Lock.ogg + /product/media/audio/ui/Soong_Lock.ogg + /product/media/audio/ui/Windows_Device_Lock.ogg + /product/media/audio/ui/Windows_Error_Lock.ogg + + + + /product/media/audio/ui/Unlock.ogg + /product/media/audio/ui/Amazon_Fire_Unlock.ogg + /product/media/audio/ui/Asus_Zenfone_Max_Unlock.ogg + /product/media/audio/ui/Essential_PH-1_Unlock.ogg + /product/media/audio/ui/HTC_M8_Unlock.ogg + /product/media/audio/ui/Huawei_Unlock.ogg + /product/media/audio/ui/Hyper_OS_Unlock.ogg + /product/media/audio/ui/Iqoo_Unlock.ogg + /product/media/audio/ui/LG_G3_Unlock.ogg + /product/media/audio/ui/Minecraft_Door_Unlock.ogg + /product/media/audio/ui/MIUI_10_Unlock.ogg + /product/media/audio/ui/MIUI_11_Unlock.ogg + /product/media/audio/ui/Nextbit_Unlock.ogg + /product/media/audio/ui/Nokia_X_Unlock.ogg + /product/media/audio/ui/Old_School_IOS_Unlock.ogg + /product/media/audio/ui/One_UI_Unlock.ogg + /product/media/audio/ui/OOS_14_Unlock.ogg + /product/media/audio/ui/Razer_Phone_Unlock.ogg + /product/media/audio/ui/Soong_Unlock.ogg + /product/media/audio/ui/Windows_Device_Unlock.ogg + /product/media/audio/ui/Windows_Error_Unlock.ogg + + @string/themes_screen_off_animation_default diff --git a/res/values/evolution_strings.xml b/res/values/evolution_strings.xml index 6437db8..b73e113 100644 --- a/res/values/evolution_strings.xml +++ b/res/values/evolution_strings.xml @@ -33,6 +33,9 @@ Monet Monet settings Customize Android\'s built-in theme engine + Audio + Lock sound + Unlock sound Fonts System font Set system font style @@ -472,4 +475,10 @@ milliseconds dp seconds + + + SystemUI restart required + For changes to take effect, a SystemUI restart is required. Restart SystemUI now? + Yes + Not now diff --git a/res/xml/evolution_settings_themes.xml b/res/xml/evolution_settings_themes.xml index 2040e25..ad7fe6b 100644 --- a/res/xml/evolution_settings_themes.xml +++ b/res/xml/evolution_settings_themes.xml @@ -21,6 +21,27 @@ android:fragment="org.evolution.settings.fragments.themes.MonetSettings" /> + + + + + + + + + diff --git a/src/org/evolution/settings/fragments/themes/Themes.java b/src/org/evolution/settings/fragments/themes/Themes.java index d397d36..911d2b6 100644 --- a/src/org/evolution/settings/fragments/themes/Themes.java +++ b/src/org/evolution/settings/fragments/themes/Themes.java @@ -25,7 +25,9 @@ import com.android.settingslib.search.SearchIndexable; import java.util.List; +import org.evolution.settings.preferences.GlobalSettingListPreference; import org.evolution.settings.utils.DeviceUtils; +import org.evolution.settings.utils.SystemUtils; @SearchIndexable public class Themes extends SettingsPreferenceFragment implements @@ -33,6 +35,8 @@ public class Themes extends SettingsPreferenceFragment implements private static final String TAG = "Themes"; + private static final String KEY_LOCK_SOUND = "lock_sound"; + private static final String KEY_UNLOCK_SOUND = "unlock_sound"; private static final String KEY_ICONS_CATEGORY = "themes_icons_category"; private static final String KEY_NAVBAR_ICON = "android.theme.customization.navbar"; private static final String KEY_SIGNAL_ICON = "android.theme.customization.signal_icon"; @@ -40,6 +44,8 @@ public class Themes extends SettingsPreferenceFragment implements private static final String KEY_ANIMATIONS_CATEGORY = "themes_animations_category"; private static final String KEY_UDFPS_ANIMATION = "udfps_animation"; + private GlobalSettingListPreference mLockSound; + private GlobalSettingListPreference mUnlockSound; private PreferenceCategory mIconsCategory; private Preference mNavbarIcon; private Preference mSignalIcon; @@ -57,6 +63,10 @@ public class Themes extends SettingsPreferenceFragment implements final PreferenceScreen prefScreen = getPreferenceScreen(); final Resources resources = context.getResources(); + mLockSound = (GlobalSettingListPreference) findPreference(KEY_LOCK_SOUND); + mLockSound.setOnPreferenceChangeListener(this); + mUnlockSound = (GlobalSettingListPreference) findPreference(KEY_UNLOCK_SOUND); + mUnlockSound.setOnPreferenceChangeListener(this); mIconsCategory = (PreferenceCategory) findPreference(KEY_ICONS_CATEGORY); mNavbarIcon = (Preference) findPreference(KEY_NAVBAR_ICON); mSignalIcon = (Preference) findPreference(KEY_SIGNAL_ICON); @@ -92,6 +102,10 @@ public class Themes extends SettingsPreferenceFragment implements public boolean onPreferenceChange(Preference preference, Object newValue) { final Context context = getContext(); final ContentResolver resolver = context.getContentResolver(); + if (preference == mLockSound || preference == mUnlockSound) { + SystemUtils.showSystemUiRestartDialog(context); + return true; + } return false; } diff --git a/src/org/evolution/settings/utils/SystemUtils.java b/src/org/evolution/settings/utils/SystemUtils.java new file mode 100644 index 0000000..4a05cb3 --- /dev/null +++ b/src/org/evolution/settings/utils/SystemUtils.java @@ -0,0 +1,49 @@ +/* + * SPDX-FileCopyrightText: 2024 The Evolution X Project + * SPDX-License-Identifier: Apache-2.0 + */ + +package org.evolution.settings.utils; + +import android.app.ActivityManager; +import android.app.AlertDialog; +import android.app.IActivityManager; +import android.content.Context; +import android.content.DialogInterface; +import android.os.AsyncTask; + +import com.android.settings.R; + +public class SystemUtils { + + public static void showSystemUiRestartDialog(final Context context) { + new AlertDialog.Builder(context) + .setTitle(R.string.systemui_restart_title) + .setMessage(R.string.systemui_restart_message) + .setPositiveButton(R.string.systemui_restart_yes, new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int id) { + new AsyncTask() { + @Override + protected Void doInBackground(Void... params) { + try { + ActivityManager am = + (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); + IActivityManager ams = ActivityManager.getService(); + for (ActivityManager.RunningAppProcessInfo app : am.getRunningAppProcesses()) { + if ("com.android.systemui".equals(app.processName)) { + ams.killApplicationProcess(app.processName, app.uid); + break; + } + } + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + }.execute(); + } + }) + .setNegativeButton(R.string.systemui_restart_not_now, null) + .show(); + } +}