From f67d3870200ea40019cb79bb6827a9724792f7b0 Mon Sep 17 00:00:00 2001 From: LittleTurtle2333 Date: Mon, 20 Feb 2023 21:27:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9EA13=E7=A6=81=E7=94=A8?= =?UTF-8?q?=E4=B8=B4=E6=97=B6=E8=93=9D=E7=89=99=E5=85=B3=E9=97=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../activity/pages/t/SystemUIPageForT.kt | 7 ++++ .../simplicitytools/hooks/apps/SystemUI.kt | 33 ++----------------- .../DisableBluetoothTemporarilyOffForT.kt | 16 +++++++++ app/src/main/res/values/strings.xml | 1 + 4 files changed, 26 insertions(+), 31 deletions(-) create mode 100644 app/src/main/java/com/lt2333/simplicitytools/hooks/rules/t/systemui/DisableBluetoothTemporarilyOffForT.kt diff --git a/app/src/main/java/com/lt2333/simplicitytools/activity/pages/t/SystemUIPageForT.kt b/app/src/main/java/com/lt2333/simplicitytools/activity/pages/t/SystemUIPageForT.kt index 48d10428..4eadab2f 100644 --- a/app/src/main/java/com/lt2333/simplicitytools/activity/pages/t/SystemUIPageForT.kt +++ b/app/src/main/java/com/lt2333/simplicitytools/activity/pages/t/SystemUIPageForT.kt @@ -566,6 +566,13 @@ import com.lt2333.simplicitytools.R ) Line() TitleText(textId = R.string.control_center) + TextSummaryWithSwitch( + TextSummaryV( + textId = R.string.disable_bluetooth_temporarily_off + ), SwitchV( + "disable_bluetooth_temporarily_off" + ) + ) val controlCenterWeatherBinding = GetDataBinding({ MIUIActivity.safeSP.getBoolean( "control_center_weather", false diff --git a/app/src/main/java/com/lt2333/simplicitytools/hooks/apps/SystemUI.kt b/app/src/main/java/com/lt2333/simplicitytools/hooks/apps/SystemUI.kt index 8245d6c1..8ed36c57 100644 --- a/app/src/main/java/com/lt2333/simplicitytools/hooks/apps/SystemUI.kt +++ b/app/src/main/java/com/lt2333/simplicitytools/hooks/apps/SystemUI.kt @@ -32,37 +32,7 @@ import com.lt2333.simplicitytools.hooks.rules.s.systemui.StatusBarLayoutForS import com.lt2333.simplicitytools.hooks.rules.s.systemui.StatusBarNetworkSpeedRefreshSpeedForS import com.lt2333.simplicitytools.hooks.rules.s.systemui.StatusBarTimeCustomizationForS import com.lt2333.simplicitytools.hooks.rules.s.systemui.WaveChargeForS -import com.lt2333.simplicitytools.hooks.rules.t.systemui.BatteryPercentageForT -import com.lt2333.simplicitytools.hooks.rules.t.systemui.CanNotificationSlideForT -import com.lt2333.simplicitytools.hooks.rules.t.systemui.ControlCenterWeatherForT -import com.lt2333.simplicitytools.hooks.rules.t.systemui.CustomMobileTypeTextForT -import com.lt2333.simplicitytools.hooks.rules.t.systemui.DoubleLineNetworkSpeedForT -import com.lt2333.simplicitytools.hooks.rules.t.systemui.HideBatteryIconForT -import com.lt2333.simplicitytools.hooks.rules.t.systemui.HideHDIconForT -import com.lt2333.simplicitytools.hooks.rules.t.systemui.HideMobileActivityIconForT -import com.lt2333.simplicitytools.hooks.rules.t.systemui.HideMobileTypeIconForT -import com.lt2333.simplicitytools.hooks.rules.t.systemui.HideNetworkSpeedSplitterForT -import com.lt2333.simplicitytools.hooks.rules.t.systemui.HideSimIconForT -import com.lt2333.simplicitytools.hooks.rules.t.systemui.HideStatusBarIconForT -import com.lt2333.simplicitytools.hooks.rules.t.systemui.HideStatusBarNetworkSpeedSecondForT -import com.lt2333.simplicitytools.hooks.rules.t.systemui.HideWifiActivityIconForT -import com.lt2333.simplicitytools.hooks.rules.t.systemui.LockScreenClockDisplaySecondsForT -import com.lt2333.simplicitytools.hooks.rules.t.systemui.LockScreenCurrentForT -import com.lt2333.simplicitytools.hooks.rules.t.systemui.LockScreenDoubleTapToSleepForT -import com.lt2333.simplicitytools.hooks.rules.t.systemui.MaximumNumberOfNotificationIconsForT -import com.lt2333.simplicitytools.hooks.rules.t.systemui.NewNotificationWeatherForT -import com.lt2333.simplicitytools.hooks.rules.t.systemui.NotificationWeatherForT -import com.lt2333.simplicitytools.hooks.rules.t.systemui.OldNotificationWeatherForT -import com.lt2333.simplicitytools.hooks.rules.t.systemui.OldQSCustomForT -import com.lt2333.simplicitytools.hooks.rules.t.systemui.RemoveLockScreenCameraForT -import com.lt2333.simplicitytools.hooks.rules.t.systemui.RemoveTheLeftSideOfTheLockScreenForT -import com.lt2333.simplicitytools.hooks.rules.t.systemui.ShowWifiStandardForT -import com.lt2333.simplicitytools.hooks.rules.t.systemui.StatusBarBigMobileTypeIconForT -import com.lt2333.simplicitytools.hooks.rules.t.systemui.StatusBarDoubleTapToSleepForT -import com.lt2333.simplicitytools.hooks.rules.t.systemui.StatusBarLayoutForT -import com.lt2333.simplicitytools.hooks.rules.t.systemui.StatusBarNetworkSpeedRefreshSpeedForT -import com.lt2333.simplicitytools.hooks.rules.t.systemui.StatusBarTimeCustomizationForT -import com.lt2333.simplicitytools.hooks.rules.t.systemui.WaveChargeForT +import com.lt2333.simplicitytools.hooks.rules.t.systemui.* import com.lt2333.simplicitytools.utils.xposed.base.AppRegister import de.robv.android.xposed.callbacks.XC_LoadPackage @@ -105,6 +75,7 @@ object SystemUI : AppRegister() { CanNotificationSlideForT, //允许下滑通知打开小窗 LockScreenClockDisplaySecondsForT, // 锁屏时钟显示秒 ShowWifiStandardForT, // 显示 WIFI 角标 + DisableBluetoothTemporarilyOffForT, //禁用临时蓝牙关闭 ) } diff --git a/app/src/main/java/com/lt2333/simplicitytools/hooks/rules/t/systemui/DisableBluetoothTemporarilyOffForT.kt b/app/src/main/java/com/lt2333/simplicitytools/hooks/rules/t/systemui/DisableBluetoothTemporarilyOffForT.kt new file mode 100644 index 00000000..070fe0b7 --- /dev/null +++ b/app/src/main/java/com/lt2333/simplicitytools/hooks/rules/t/systemui/DisableBluetoothTemporarilyOffForT.kt @@ -0,0 +1,16 @@ +package com.lt2333.simplicitytools.hooks.rules.t.systemui + +import com.github.kyuubiran.ezxhelper.utils.findMethod +import com.github.kyuubiran.ezxhelper.utils.hookBefore +import com.lt2333.simplicitytools.utils.hasEnable +import com.lt2333.simplicitytools.utils.xposed.base.HookRegister + +object DisableBluetoothTemporarilyOffForT: HookRegister() { + override fun init()= hasEnable("disable_bluetooth_temporarily_off") { + findMethod("com.android.settingslib.bluetooth.LocalBluetoothAdapter"){ + name == "isSupportBluetoothRestrict" && parameterCount==1 + }.hookBefore { + it.result = false + } + } +} \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 69c95e8c..8b5f8d0d 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -251,4 +251,5 @@ Press and hold the desktop icon to add a quick open window Small window Click to view use cases + Disable bluetooth temporarily off