mirror of
https://github.com/fankes/ColorOSNotifyIcon.git
synced 2025-09-04 09:45:34 +08:00
Modify remove prefs cache function and disable prefs cache
This commit is contained in:
@@ -27,7 +27,6 @@ package com.fankes.coloros.notify.data
|
|||||||
import android.content.Context
|
import android.content.Context
|
||||||
import com.fankes.coloros.notify.const.IconRuleSourceSyncType
|
import com.fankes.coloros.notify.const.IconRuleSourceSyncType
|
||||||
import com.fankes.coloros.notify.utils.factory.isUpperOfAndroidS
|
import com.fankes.coloros.notify.utils.factory.isUpperOfAndroidS
|
||||||
import com.highcapable.yukihookapi.YukiHookAPI
|
|
||||||
import com.highcapable.yukihookapi.hook.factory.prefs
|
import com.highcapable.yukihookapi.hook.factory.prefs
|
||||||
import com.highcapable.yukihookapi.hook.log.loggerW
|
import com.highcapable.yukihookapi.hook.log.loggerW
|
||||||
import com.highcapable.yukihookapi.hook.param.PackageParam
|
import com.highcapable.yukihookapi.hook.param.PackageParam
|
||||||
@@ -41,9 +40,6 @@ object ConfigData {
|
|||||||
/** 启用模块 */
|
/** 启用模块 */
|
||||||
val ENABLE_MODULE = PrefsData("_enable_module", true)
|
val ENABLE_MODULE = PrefsData("_enable_module", true)
|
||||||
|
|
||||||
/** 启用数据缓存 */
|
|
||||||
val ENABLE_PREFS_CACHE = PrefsData("_enable_prefs_cache", true)
|
|
||||||
|
|
||||||
/** 启用模块日志 */
|
/** 启用模块日志 */
|
||||||
val ENABLE_MODULE_LOG = PrefsData("_enable_module_log", false)
|
val ENABLE_MODULE_LOG = PrefsData("_enable_module_log", false)
|
||||||
|
|
||||||
@@ -117,8 +113,6 @@ object ConfigData {
|
|||||||
is Context, is PackageParam -> this.instance = instance
|
is Context, is PackageParam -> this.instance = instance
|
||||||
else -> error("Unknown type for init ConfigData")
|
else -> error("Unknown type for init ConfigData")
|
||||||
}
|
}
|
||||||
/** 设置是否启用数据缓存 */
|
|
||||||
YukiHookAPI.Configs.isEnablePrefsBridgeCache = isEnablePrefsCache
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -203,16 +197,6 @@ object ConfigData {
|
|||||||
putBoolean(ENABLE_MODULE, value)
|
putBoolean(ENABLE_MODULE, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否启用数据缓存
|
|
||||||
* @return [Boolean]
|
|
||||||
*/
|
|
||||||
var isEnablePrefsCache
|
|
||||||
get() = getBoolean(ENABLE_PREFS_CACHE)
|
|
||||||
set(value) {
|
|
||||||
putBoolean(ENABLE_PREFS_CACHE, value)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否启用模块日志
|
* 是否启用模块日志
|
||||||
* @return [Boolean]
|
* @return [Boolean]
|
||||||
|
@@ -42,6 +42,7 @@ object HookEntry : IYukiHookXposedInit {
|
|||||||
elements(PRIORITY)
|
elements(PRIORITY)
|
||||||
}
|
}
|
||||||
isDebug = false
|
isDebug = false
|
||||||
|
isEnablePrefsBridgeCache = false
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onHook() = encase {
|
override fun onHook() = encase {
|
||||||
|
@@ -129,10 +129,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
|||||||
binding.notifyIconAutoSyncText.text = ConfigData.notifyIconFixAutoTime
|
binding.notifyIconAutoSyncText.text = ConfigData.notifyIconFixAutoTime
|
||||||
binding.moduleEnableSwitch.bind(ConfigData.ENABLE_MODULE) {
|
binding.moduleEnableSwitch.bind(ConfigData.ENABLE_MODULE) {
|
||||||
onInitialize {
|
onInitialize {
|
||||||
binding.moduleEnableLogSwitch.isVisible = it
|
binding.moduleEnableLogItem.isVisible = it
|
||||||
binding.moduleEnableLogText.isVisible = it
|
|
||||||
binding.modulePrefsCacheEnableSwitch.isVisible = it
|
|
||||||
binding.modulePrefsCacheEnableText.isVisible = it
|
|
||||||
binding.expAllDebugLogButton.isVisible = it && ConfigData.isEnableModuleLog
|
binding.expAllDebugLogButton.isVisible = it && ConfigData.isEnableModuleLog
|
||||||
binding.notifyIconConfigItem.isVisible = it
|
binding.notifyIconConfigItem.isVisible = it
|
||||||
binding.devNotifyConfigItem.isVisible = it
|
binding.devNotifyConfigItem.isVisible = it
|
||||||
@@ -144,9 +141,6 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
|||||||
SystemUITool.showNeedRestartSnake(context = this@MainActivity)
|
SystemUITool.showNeedRestartSnake(context = this@MainActivity)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
binding.modulePrefsCacheEnableSwitch.bind(ConfigData.ENABLE_PREFS_CACHE) {
|
|
||||||
onChanged { SystemUITool.showNeedRestartSnake(context = this@MainActivity) }
|
|
||||||
}
|
|
||||||
binding.moduleEnableLogSwitch.bind(ConfigData.ENABLE_MODULE_LOG) {
|
binding.moduleEnableLogSwitch.bind(ConfigData.ENABLE_MODULE_LOG) {
|
||||||
onInitialize { binding.expAllDebugLogButton.isVisible = it && ConfigData.isEnableModule }
|
onInitialize { binding.expAllDebugLogButton.isVisible = it && ConfigData.isEnableModule }
|
||||||
onChanged {
|
onChanged {
|
||||||
|
@@ -270,68 +270,50 @@
|
|||||||
android:textColor="@color/colorTextDark"
|
android:textColor="@color/colorTextDark"
|
||||||
android:textSize="12sp" />
|
android:textSize="12sp" />
|
||||||
|
|
||||||
<com.fankes.coloros.notify.ui.widget.MaterialSwitch
|
<LinearLayout
|
||||||
android:id="@+id/module_prefs_cache_enable_switch"
|
android:id="@+id/module_enable_log_item"
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="30dp"
|
|
||||||
android:layout_marginLeft="15dp"
|
|
||||||
android:layout_marginRight="15dp"
|
|
||||||
android:layout_marginBottom="10dp"
|
|
||||||
android:text="启用数据缓存"
|
|
||||||
android:textColor="@color/colorTextGray"
|
|
||||||
android:textSize="15sp" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/module_prefs_cache_enable_text"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="15dp"
|
|
||||||
android:layout_marginRight="15dp"
|
|
||||||
android:layout_marginBottom="5dp"
|
|
||||||
android:alpha="0.6"
|
|
||||||
android:lineSpacingExtra="6dp"
|
|
||||||
android:text="此选项默认开启,默认情况下模块会将数据缓存在内存中,防止每次重复读取数据造成卡顿,如果开启此选项后一段时间导致系统界面 (系统 UI) 崩溃 (内存溢出),你可以尝试关闭此选项,但是这有可能会造成在通知较多时下拉通知栏出现卡顿。"
|
|
||||||
android:textColor="@color/colorTextDark"
|
|
||||||
android:textSize="12sp" />
|
|
||||||
|
|
||||||
<com.fankes.coloros.notify.ui.widget.MaterialSwitch
|
|
||||||
android:id="@+id/module_enable_log_switch"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="35dp"
|
|
||||||
android:layout_marginLeft="15dp"
|
|
||||||
android:layout_marginRight="15dp"
|
|
||||||
android:layout_marginBottom="5dp"
|
|
||||||
android:text="启用调试日志"
|
|
||||||
android:textColor="@color/colorTextGray"
|
|
||||||
android:textSize="15sp" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/exp_all_debug_log_button"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginLeft="13dp"
|
|
||||||
android:layout_marginRight="13dp"
|
|
||||||
android:layout_marginBottom="10dp"
|
android:layout_marginBottom="10dp"
|
||||||
android:background="@drawable/bg_button_round"
|
android:orientation="vertical">
|
||||||
android:gravity="center"
|
|
||||||
android:padding="10dp"
|
|
||||||
android:singleLine="true"
|
|
||||||
android:text="导出全部调试日志"
|
|
||||||
android:textColor="@color/colorTextGray"
|
|
||||||
android:textSize="15sp" />
|
|
||||||
|
|
||||||
<TextView
|
<com.fankes.coloros.notify.ui.widget.MaterialSwitch
|
||||||
android:id="@+id/module_enable_log_text"
|
android:id="@+id/module_enable_log_switch"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="30dp"
|
||||||
android:layout_marginLeft="15dp"
|
android:layout_marginLeft="15dp"
|
||||||
android:layout_marginRight="15dp"
|
android:layout_marginRight="15dp"
|
||||||
android:layout_marginBottom="10dp"
|
android:layout_marginBottom="10dp"
|
||||||
android:alpha="0.6"
|
android:text="启用调试日志"
|
||||||
android:lineSpacingExtra="6dp"
|
android:textColor="@color/colorTextGray"
|
||||||
android:text="默认情况下不建议开启此选项,仅在模块故障时开启,此时你可以发送调试日志给开发者帮助我们快速定位问题。"
|
android:textSize="15sp" />
|
||||||
android:textColor="@color/colorTextDark"
|
|
||||||
android:textSize="12sp" />
|
<TextView
|
||||||
|
android:id="@+id/exp_all_debug_log_button"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="13dp"
|
||||||
|
android:layout_marginRight="13dp"
|
||||||
|
android:layout_marginBottom="10dp"
|
||||||
|
android:background="@drawable/bg_button_round"
|
||||||
|
android:gravity="center"
|
||||||
|
android:padding="10dp"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:text="导出全部调试日志"
|
||||||
|
android:textColor="@color/colorTextGray"
|
||||||
|
android:textSize="15sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="15dp"
|
||||||
|
android:layout_marginRight="15dp"
|
||||||
|
android:alpha="0.6"
|
||||||
|
android:lineSpacingExtra="6dp"
|
||||||
|
android:text="默认情况下不建议开启此选项,仅在模块故障时开启,此时你可以发送调试日志给开发者帮助我们快速定位问题。"
|
||||||
|
android:textColor="@color/colorTextDark"
|
||||||
|
android:textSize="12sp" />
|
||||||
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
Reference in New Issue
Block a user