Skip to content
This repository has been archived by the owner on Jan 2, 2025. It is now read-only.

Commit

Permalink
添加 系统界面-其他-原生音量条 (#364)
Browse files Browse the repository at this point in the history
* Update SystemUIOtherSettings.java

* Update system_ui_other.xml

* Update strings.xml

* Update strings.xml

* Update prefs_about_contributor.xml
  • Loading branch information
xing0meng authored Feb 16, 2024
1 parent f446b11 commit e852c44
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -1,35 +1,40 @@
/*
* 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 <https://www.gnu.org/licenses/>.
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
* 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;
import static com.sevtinge.hyperceiler.utils.devicesdk.SystemSDKKt.isMiuiVersion;
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;

Expand All @@ -41,6 +46,7 @@ public class SystemUIOtherSettings extends SettingsPreferenceFragment {
SwitchPreference mOriginCharge;
SwitchPreference mMiuiMultiWinSwitch;
SwitchPreference mBottomBar;
SwitchPreference mVolume;
SwitchPreference mDisableBluetoothRestrict; // 禁用蓝牙临时关闭

@Override
Expand All @@ -65,12 +71,34 @@ 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));
mOriginCharge.setVisible(isAndroidVersion(31));
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;
}
}
);
}
}
1 change: 1 addition & 0 deletions app/src/main/res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -801,6 +801,7 @@
<string name="system_ui_control_center_more_card_tiles_most">更多</string>

<string name="system_ui_other_title">其他</string>
<string name="system_ui_disable_volume">原生音量条</string>
<string name="system_ui_charge_animation_title">充电动画</string>
<string name="system_ui_charge_animation_style">充电动画样式</string>
<string name="system_ui_charge_animation_style_desc">选择锁屏充电动画样式</string>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -787,6 +787,7 @@
<string name="system_ui_control_center_unlock_blur_supported_desc">There is no restriction on background blur for official premium materials only for third-party theme removal</string>

<string name="system_ui_other_title">Other</string>
<string name="system_ui_disable_volume">Native volume bar</string>
<string name="system_ui_charge_animation_title">Charge animation</string>
<string name="system_ui_charge_animation_style">Charging animation style</string>
<string name="system_ui_charge_animation_style_desc">Select the lock screen charging animation style</string>
Expand Down
9 changes: 8 additions & 1 deletion app/src/main/res/xml/prefs_about_contributor.xml
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,13 @@
android:action="android.intent.action.VIEW"
android:data="https://github.com/zjw2017" />
</Preference>
<Preference
android:summary="GitHub@xing0meng"
android:title="星夜萌">
<intent
android:action="android.intent.action.VIEW"
android:data="https://github.com/xing0meng" />
</Preference>
<Preference
android:summary="CoolApk@欧瓯烨"
android:title="欧瓯烨">
Expand Down Expand Up @@ -180,4 +187,4 @@
</PreferenceCategory>
<Preference android:enabled="false" />

</PreferenceScreen>
</PreferenceScreen>
7 changes: 6 additions & 1 deletion app/src/main/res/xml/system_ui_other.xml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@
android:key="prefs_key_system_ui_disable_bluetooth_restrict"
android:title="@string/system_ui_disable_bluetooth_restrict" />

<SwitchPreference
android:defaultValue="false"
android:key="prefs_key_system_ui_disable_volume"
android:title="@string/system_ui_disable_volume" />

<SwitchPreference
android:defaultValue="false"
android:key="prefs_key_system_ui_unlock_super_volume"
Expand Down Expand Up @@ -121,4 +126,4 @@

</PreferenceCategory>
<Preference android:enabled="false" />
</PreferenceScreen>
</PreferenceScreen>

0 comments on commit e852c44

Please sign in to comment.