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 ffacbb1f49..291f9e3c22 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 @@ -1,21 +1,21 @@ /* - * This file is part of HyperCeiler. + * This file is part of HyperCeiler. - * HyperCeiler is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License. + * HyperCeiler is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License. - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . - * Copyright (C) 2023-2024 HyperCeiler Contributions -*/ + * Copyright (C) 2023-2024 HyperCeiler Contributions + */ package com.sevtinge.hyperceiler.ui.fragment.systemui; import static com.sevtinge.hyperceiler.utils.devicesdk.SystemSDKKt.isAndroidVersion; @@ -23,13 +23,18 @@ import static com.sevtinge.hyperceiler.utils.devicesdk.SystemSDKKt.isMoreAndroidVersion; import static com.sevtinge.hyperceiler.utils.devicesdk.SystemSDKKt.isMoreHyperOSVersion; +import android.content.ComponentName; +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; @@ -41,6 +46,7 @@ public class SystemUIOtherSettings extends SettingsPreferenceFragment { SwitchPreference mOriginCharge; SwitchPreference mMiuiMultiWinSwitch; SwitchPreference mBottomBar; + SwitchPreference mVolume; SwitchPreference mDisableBluetoothRestrict; // 禁用蓝牙临时关闭 @Override @@ -65,6 +71,7 @@ public void initPrefs() { mDisableBluetoothRestrict = findPreference("prefs_key_system_ui_disable_bluetooth_restrict"); mMiuiMultiWinSwitch = findPreference("prefs_key_system_ui_disable_miui_multi_win_switch"); mBottomBar = findPreference("prefs_key_system_ui_disable_bottombar"); + mVolume = findPreference("prefs_key_system_ui_disable_volume"); mChargeAnimationTitle.setVisible(!isMoreHyperOSVersion(1f)); mMonetOverlay.setVisible(!isAndroidVersion(30)); @@ -72,5 +79,26 @@ public void initPrefs() { mDisableBluetoothRestrict.setVisible(isMiuiVersion(14f) && isMoreAndroidVersion(31)); mMiuiMultiWinSwitch.setVisible(isMoreHyperOSVersion(1f) && isMoreAndroidVersion(34)); mBottomBar.setVisible(isMoreHyperOSVersion(1f) && isMoreAndroidVersion(34)); + + mVolume.setOnPreferenceChangeListener( + new Preference.OnPreferenceChangeListener() { + @Override + public boolean onPreferenceChange(@NonNull Preference preference, Object o) { + ComponentName componentName = new ComponentName("miui.systemui.plugin", + "miui.systemui.volume.VolumeDialogPlugin"); + 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 e5b8731c5f..82141dc57e 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -801,6 +801,7 @@ 更多 其他 + 原生音量条 充电动画 充电动画样式 选择锁屏充电动画样式 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 6730dbf108..3f74e23328 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -787,6 +787,7 @@ There is no restriction on background blur for official premium materials only for third-party theme removal Other + Native volume bar Charge animation Charging animation style Select the lock screen charging animation style diff --git a/app/src/main/res/xml/prefs_about_contributor.xml b/app/src/main/res/xml/prefs_about_contributor.xml index 148f584ab8..2d064d11ba 100644 --- a/app/src/main/res/xml/prefs_about_contributor.xml +++ b/app/src/main/res/xml/prefs_about_contributor.xml @@ -149,6 +149,13 @@ android:action="android.intent.action.VIEW" android:data="https://github.com/zjw2017" /> + + + @@ -180,4 +187,4 @@ - \ No newline at end of file + diff --git a/app/src/main/res/xml/system_ui_other.xml b/app/src/main/res/xml/system_ui_other.xml index 651176812a..6528fd446e 100644 --- a/app/src/main/res/xml/system_ui_other.xml +++ b/app/src/main/res/xml/system_ui_other.xml @@ -94,6 +94,11 @@ android:key="prefs_key_system_ui_disable_bluetooth_restrict" android:title="@string/system_ui_disable_bluetooth_restrict" /> + + - \ No newline at end of file +