mirror of
https://github.com/fankes/TSBattery.git
synced 2025-09-07 03:06:06 +08:00
增加通知栏守护状态可关闭功能
This commit is contained in:
@@ -25,6 +25,7 @@ object HookConst {
|
|||||||
|
|
||||||
const val ENABLE_HIDE_ICON = "_hide_icon"
|
const val ENABLE_HIDE_ICON = "_hide_icon"
|
||||||
const val ENABLE_RUN_INFO = "_tip_run_info"
|
const val ENABLE_RUN_INFO = "_tip_run_info"
|
||||||
|
const val ENABLE_NOTIFY_TIP = "_tip_in_notify"
|
||||||
const val ENABLE_QQTIM_WHITE_MODE = "_qqtim_white_mode"
|
const val ENABLE_QQTIM_WHITE_MODE = "_qqtim_white_mode"
|
||||||
const val ENABLE_QQTIM_CORESERVICE_BAN = "_qqtim_core_service_ban"
|
const val ENABLE_QQTIM_CORESERVICE_BAN = "_qqtim_core_service_ban"
|
||||||
const val ENABLE_QQTIM_CORESERVICE_CHILD_BAN = "_qqtim_core_service_child_ban"
|
const val ENABLE_QQTIM_CORESERVICE_CHILD_BAN = "_qqtim_core_service_child_ban"
|
||||||
|
@@ -29,6 +29,7 @@ import android.content.Intent
|
|||||||
import android.os.Build
|
import android.os.Build
|
||||||
import com.fankes.tsbattery.hook.HookConst.DISABLE_WECHAT_HOOK
|
import com.fankes.tsbattery.hook.HookConst.DISABLE_WECHAT_HOOK
|
||||||
import com.fankes.tsbattery.hook.HookConst.ENABLE_MODULE_VERSION
|
import com.fankes.tsbattery.hook.HookConst.ENABLE_MODULE_VERSION
|
||||||
|
import com.fankes.tsbattery.hook.HookConst.ENABLE_NOTIFY_TIP
|
||||||
import com.fankes.tsbattery.hook.HookConst.ENABLE_QQTIM_CORESERVICE_BAN
|
import com.fankes.tsbattery.hook.HookConst.ENABLE_QQTIM_CORESERVICE_BAN
|
||||||
import com.fankes.tsbattery.hook.HookConst.ENABLE_QQTIM_CORESERVICE_CHILD_BAN
|
import com.fankes.tsbattery.hook.HookConst.ENABLE_QQTIM_CORESERVICE_CHILD_BAN
|
||||||
import com.fankes.tsbattery.hook.HookConst.ENABLE_QQTIM_WHITE_MODE
|
import com.fankes.tsbattery.hook.HookConst.ENABLE_QQTIM_WHITE_MODE
|
||||||
@@ -165,12 +166,13 @@ class HookEntry : YukiHookXposedInitProxy {
|
|||||||
param(CharSequenceType)
|
param(CharSequenceType)
|
||||||
}
|
}
|
||||||
beforeHook {
|
beforeHook {
|
||||||
when (firstArgs as CharSequence) {
|
if (prefs.getBoolean(ENABLE_NOTIFY_TIP, default = true))
|
||||||
"QQ正在后台运行" ->
|
when (firstArgs as CharSequence) {
|
||||||
args().set("QQ正在后台运行 - TSBattery 守护中")
|
"QQ正在后台运行" ->
|
||||||
"TIM正在后台运行" ->
|
args().set("QQ正在后台运行 - TSBattery 守护中")
|
||||||
args().set("TIM正在后台运行 - TSBattery 守护中")
|
"TIM正在后台运行" ->
|
||||||
}
|
args().set("TIM正在后台运行 - TSBattery 守护中")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -41,6 +41,7 @@ import com.fankes.tsbattery.R
|
|||||||
import com.fankes.tsbattery.hook.HookConst.DISABLE_WECHAT_HOOK
|
import com.fankes.tsbattery.hook.HookConst.DISABLE_WECHAT_HOOK
|
||||||
import com.fankes.tsbattery.hook.HookConst.ENABLE_HIDE_ICON
|
import com.fankes.tsbattery.hook.HookConst.ENABLE_HIDE_ICON
|
||||||
import com.fankes.tsbattery.hook.HookConst.ENABLE_MODULE_VERSION
|
import com.fankes.tsbattery.hook.HookConst.ENABLE_MODULE_VERSION
|
||||||
|
import com.fankes.tsbattery.hook.HookConst.ENABLE_NOTIFY_TIP
|
||||||
import com.fankes.tsbattery.hook.HookConst.ENABLE_QQTIM_CORESERVICE_BAN
|
import com.fankes.tsbattery.hook.HookConst.ENABLE_QQTIM_CORESERVICE_BAN
|
||||||
import com.fankes.tsbattery.hook.HookConst.ENABLE_QQTIM_CORESERVICE_CHILD_BAN
|
import com.fankes.tsbattery.hook.HookConst.ENABLE_QQTIM_CORESERVICE_CHILD_BAN
|
||||||
import com.fankes.tsbattery.hook.HookConst.ENABLE_QQTIM_WHITE_MODE
|
import com.fankes.tsbattery.hook.HookConst.ENABLE_QQTIM_WHITE_MODE
|
||||||
@@ -161,6 +162,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
val wechatDisableHookSwitch = findViewById<SwitchCompat>(R.id.disable_wechat_sv_switch)
|
val wechatDisableHookSwitch = findViewById<SwitchCompat>(R.id.disable_wechat_sv_switch)
|
||||||
val hideIconInLauncherSwitch = findViewById<SwitchCompat>(R.id.hide_icon_in_launcher_switch)
|
val hideIconInLauncherSwitch = findViewById<SwitchCompat>(R.id.hide_icon_in_launcher_switch)
|
||||||
val notifyModuleInfoSwitch = findViewById<SwitchCompat>(R.id.notify_module_info_switch)
|
val notifyModuleInfoSwitch = findViewById<SwitchCompat>(R.id.notify_module_info_switch)
|
||||||
|
val notifyNotifyTipSwitch = findViewById<SwitchCompat>(R.id.notify_module_notify_tip_switch)
|
||||||
/** 获取 Sp 存储的信息 */
|
/** 获取 Sp 存储的信息 */
|
||||||
qqTimProtectModeSwitch.isChecked = modulePrefs.getBoolean(ENABLE_QQTIM_WHITE_MODE)
|
qqTimProtectModeSwitch.isChecked = modulePrefs.getBoolean(ENABLE_QQTIM_WHITE_MODE)
|
||||||
qqTimCoreServiceSwitch.isChecked = modulePrefs.getBoolean(ENABLE_QQTIM_CORESERVICE_BAN)
|
qqTimCoreServiceSwitch.isChecked = modulePrefs.getBoolean(ENABLE_QQTIM_CORESERVICE_BAN)
|
||||||
@@ -168,6 +170,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
wechatDisableHookSwitch.isChecked = modulePrefs.getBoolean(DISABLE_WECHAT_HOOK)
|
wechatDisableHookSwitch.isChecked = modulePrefs.getBoolean(DISABLE_WECHAT_HOOK)
|
||||||
hideIconInLauncherSwitch.isChecked = modulePrefs.getBoolean(ENABLE_HIDE_ICON)
|
hideIconInLauncherSwitch.isChecked = modulePrefs.getBoolean(ENABLE_HIDE_ICON)
|
||||||
notifyModuleInfoSwitch.isChecked = modulePrefs.getBoolean(ENABLE_RUN_INFO)
|
notifyModuleInfoSwitch.isChecked = modulePrefs.getBoolean(ENABLE_RUN_INFO)
|
||||||
|
notifyNotifyTipSwitch.isChecked = modulePrefs.getBoolean(ENABLE_NOTIFY_TIP, default = true)
|
||||||
qqTimProtectModeSwitch.setOnCheckedChangeListener { btn, b ->
|
qqTimProtectModeSwitch.setOnCheckedChangeListener { btn, b ->
|
||||||
if (!btn.isPressed) return@setOnCheckedChangeListener
|
if (!btn.isPressed) return@setOnCheckedChangeListener
|
||||||
modulePrefs.putBoolean(ENABLE_QQTIM_WHITE_MODE, b)
|
modulePrefs.putBoolean(ENABLE_QQTIM_WHITE_MODE, b)
|
||||||
@@ -197,6 +200,10 @@ class MainActivity : AppCompatActivity() {
|
|||||||
if (!btn.isPressed) return@setOnCheckedChangeListener
|
if (!btn.isPressed) return@setOnCheckedChangeListener
|
||||||
modulePrefs.putBoolean(ENABLE_RUN_INFO, b)
|
modulePrefs.putBoolean(ENABLE_RUN_INFO, b)
|
||||||
}
|
}
|
||||||
|
notifyNotifyTipSwitch.setOnCheckedChangeListener { btn, b ->
|
||||||
|
if (!btn.isPressed) return@setOnCheckedChangeListener
|
||||||
|
modulePrefs.putBoolean(ENABLE_NOTIFY_TIP, b)
|
||||||
|
}
|
||||||
/** 快捷操作 QQ */
|
/** 快捷操作 QQ */
|
||||||
findViewById<View>(R.id.quick_qq_button).setOnClickListener { openSelfSetting(QQ_PACKAGE_NAME) }
|
findViewById<View>(R.id.quick_qq_button).setOnClickListener { openSelfSetting(QQ_PACKAGE_NAME) }
|
||||||
/** 快捷操作 TIM */
|
/** 快捷操作 TIM */
|
||||||
|
@@ -345,7 +345,8 @@
|
|||||||
<com.fankes.tsbattery.view.MaterialSwitch
|
<com.fankes.tsbattery.view.MaterialSwitch
|
||||||
android:id="@+id/shut_core_sv_qqtim_switch"
|
android:id="@+id/shut_core_sv_qqtim_switch"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="35dp"
|
||||||
|
android:layout_marginBottom="5dp"
|
||||||
android:text="关闭 CoreService"
|
android:text="关闭 CoreService"
|
||||||
android:textColor="@color/colorTextGray"
|
android:textColor="@color/colorTextGray"
|
||||||
android:textSize="15sp" />
|
android:textSize="15sp" />
|
||||||
@@ -363,7 +364,8 @@
|
|||||||
<com.fankes.tsbattery.view.MaterialSwitch
|
<com.fankes.tsbattery.view.MaterialSwitch
|
||||||
android:id="@+id/shut_core_sv_kn_qqtim_switch"
|
android:id="@+id/shut_core_sv_kn_qqtim_switch"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="35dp"
|
||||||
|
android:layout_marginBottom="5dp"
|
||||||
android:text="关闭 CoreService$KernelService"
|
android:text="关闭 CoreService$KernelService"
|
||||||
android:textColor="@color/colorTextGray"
|
android:textColor="@color/colorTextGray"
|
||||||
android:textSize="15sp" />
|
android:textSize="15sp" />
|
||||||
@@ -525,9 +527,28 @@
|
|||||||
android:paddingRight="15dp">
|
android:paddingRight="15dp">
|
||||||
|
|
||||||
<com.fankes.tsbattery.view.MaterialSwitch
|
<com.fankes.tsbattery.view.MaterialSwitch
|
||||||
android:id="@+id/notify_module_info_switch"
|
android:id="@+id/notify_module_notify_tip_switch"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:text="通知栏显示守护状态"
|
||||||
|
android:textColor="@color/colorTextGray"
|
||||||
|
android:textSize="15sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="10dp"
|
||||||
|
android:alpha="0.6"
|
||||||
|
android:lineSpacingExtra="6dp"
|
||||||
|
android:text="此功能仅支持 QQ、TIM,在开启“系统通知栏显示 QQ、TIM 图标”后系统通知后方将在最后显示“TSBattery 守护中”字样以判断模块已经生效,若不喜欢,你可以随时关闭这个功能。"
|
||||||
|
android:textColor="@color/colorTextDark"
|
||||||
|
android:textSize="12sp" />
|
||||||
|
|
||||||
|
<com.fankes.tsbattery.view.MaterialSwitch
|
||||||
|
android:id="@+id/notify_module_info_switch"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="35dp"
|
||||||
|
android:layout_marginBottom="5dp"
|
||||||
android:text="提示模块运行信息"
|
android:text="提示模块运行信息"
|
||||||
android:textColor="@color/colorTextGray"
|
android:textColor="@color/colorTextGray"
|
||||||
android:textSize="15sp" />
|
android:textSize="15sp" />
|
||||||
|
Reference in New Issue
Block a user