优化代码

This commit is contained in:
2022-01-24 06:13:21 +08:00
parent d293e4656d
commit e4d1ea8519

View File

@@ -143,9 +143,9 @@ class MainActivity : AppCompatActivity() {
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)
/** 获取 Sp 存储的信息 */ /** 获取 Sp 存储的信息 */
protectModeSwitch.isChecked = getBoolean("_white_mode") protectModeSwitch.isChecked = getBoolean(HookMedium.ENABLE_WHITE_MODE)
hideIconInLauncherSwitch.isChecked = getBoolean("_hide_icon") hideIconInLauncherSwitch.isChecked = getBoolean(HookMedium.ENABLE_HIDE_ICON)
notifyModuleInfoSwitch.isChecked = getBoolean("_tip_run_info") notifyModuleInfoSwitch.isChecked = getBoolean(HookMedium.ENABLE_RUN_INFO)
protectModeSwitch.setOnCheckedChangeListener { btn, b -> protectModeSwitch.setOnCheckedChangeListener { btn, b ->
if (!btn.isPressed) return@setOnCheckedChangeListener if (!btn.isPressed) return@setOnCheckedChangeListener
putBoolean(HookMedium.ENABLE_WHITE_MODE, b) putBoolean(HookMedium.ENABLE_WHITE_MODE, b)