diff --git a/app/src/main/java/com/sevtinge/hyperceiler/ui/fragment/systemui/SystemUIOtherSettings.java b/app/src/main/java/com/sevtinge/hyperceiler/ui/fragment/systemui/SystemUIOtherSettings.java index 2dc8f374ee..e6170a54e6 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/ui/fragment/systemui/SystemUIOtherSettings.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/ui/fragment/systemui/SystemUIOtherSettings.java @@ -27,11 +27,14 @@ import android.content.pm.PackageManager; import android.view.View; +import androidx.annotation.NonNull; + import com.sevtinge.hyperceiler.R; import com.sevtinge.hyperceiler.ui.base.BaseSettingsActivity; import com.sevtinge.hyperceiler.ui.fragment.base.SettingsPreferenceFragment; import moralnorm.preference.DropDownPreference; +import moralnorm.preference.Preference; import moralnorm.preference.PreferenceCategory; import moralnorm.preference.SwitchPreference; @@ -43,6 +46,7 @@ public class SystemUIOtherSettings extends SettingsPreferenceFragment { SwitchPreference mMiuiMultiWinSwitchRemove; SwitchPreference mBottomBar; SwitchPreference mVolume; + SwitchPreference mPower; SwitchPreference mDisableBluetoothRestrict; // 禁用蓝牙临时关闭 SwitchPreference mPctUseBlur; @@ -54,8 +58,8 @@ public int getContentResId() { @Override public View.OnClickListener addRestartListener() { return view -> ((BaseSettingsActivity) getActivity()).showRestartDialog( - getResources().getString(R.string.system_ui), - "com.android.systemui" + getResources().getString(R.string.system_ui), + "com.android.systemui" ); } @@ -68,6 +72,7 @@ public void initPrefs() { mMiuiMultiWinSwitchRemove = findPreference("prefs_key_system_ui_remove_miui_multi_win_switch"); mBottomBar = findPreference("prefs_key_system_ui_disable_bottombar"); mVolume = findPreference("prefs_key_system_ui_disable_volume"); + mPower = findPreference("prefs_key_system_ui_disable_power"); mPctUseBlur = findPreference("prefs_key_system_showpct_use_blur"); mChargeAnimationTitle.setVisible(!isMoreHyperOSVersion(1f)); @@ -80,19 +85,38 @@ public void initPrefs() { mVolume.setOnPreferenceChangeListener( (preference, o) -> { ComponentName componentName = new ComponentName("miui.systemui.plugin", - "miui.systemui.volume.VolumeDialogPlugin"); + "miui.systemui.volume.VolumeDialogPlugin"); PackageManager packageManager = getContext().getPackageManager(); if ((boolean) o) { packageManager.setComponentEnabledSetting(componentName, - PackageManager.COMPONENT_ENABLED_STATE_DISABLED, - PackageManager.DONT_KILL_APP); + PackageManager.COMPONENT_ENABLED_STATE_DISABLED, + PackageManager.DONT_KILL_APP); } else { packageManager.setComponentEnabledSetting(componentName, - PackageManager.COMPONENT_ENABLED_STATE_ENABLED, - PackageManager.DONT_KILL_APP); + PackageManager.COMPONENT_ENABLED_STATE_ENABLED, + PackageManager.DONT_KILL_APP); } return true; } ); + + mPower.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { + @Override + public boolean onPreferenceChange(@NonNull Preference preference, Object o) { + ComponentName componentName = new ComponentName("miui.systemui.plugin", + "miui.systemui.globalactions.GlobalActionsPlugin"); + PackageManager packageManager = getContext().getPackageManager(); + if ((boolean) o) { + packageManager.setComponentEnabledSetting(componentName, + PackageManager.COMPONENT_ENABLED_STATE_DISABLED, + PackageManager.DONT_KILL_APP); + } else { + packageManager.setComponentEnabledSetting(componentName, + PackageManager.COMPONENT_ENABLED_STATE_ENABLED, + PackageManager.DONT_KILL_APP); + } + return true; + } + }); } } diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 65797890ab..abb217f5e7 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -890,6 +890,8 @@ 其他 原生音量条 + 原生关机菜单 + MIUI 为旧版菜单,Hyper 为原生菜单 针对 MIUI/HyperOS 音量条的修改无法作用于原生音量条 解锁原生剪切板编辑器 实验性功能,会导致 MIUI/HyperOS 的编辑器一并弹出 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 0af0e09153..dbc134dea1 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -869,6 +869,8 @@ Other Native volume bar + Native shutdown menu + MIUI is the old menu, and Hyper is the native menu The modification of Xiaomi\'s volume bar does not apply to the native volume bar Unlock the AOSP clipboard editor After unlocking, it will pop up together with the MIUI/HyperOS editor. diff --git a/app/src/main/res/xml/system_ui_other.xml b/app/src/main/res/xml/system_ui_other.xml index e92e2b12c6..80fa966ee3 100644 --- a/app/src/main/res/xml/system_ui_other.xml +++ b/app/src/main/res/xml/system_ui_other.xml @@ -106,6 +106,12 @@ android:summary="@string/system_ui_disable_volume_desc" android:title="@string/system_ui_disable_volume" /> + +