Skip to content

Commit 6cd9cb7

Browse files
committed
Modify remove prefs cache function and disable prefs cache
1 parent 8bdff8d commit 6cd9cb7

4 files changed

Lines changed: 41 additions & 80 deletions

File tree

app/src/main/java/com/fankes/coloros/notify/data/ConfigData.kt

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ package com.fankes.coloros.notify.data
2727
import android.content.Context
2828
import com.fankes.coloros.notify.const.IconRuleSourceSyncType
2929
import com.fankes.coloros.notify.utils.factory.isUpperOfAndroidS
30-
import com.highcapable.yukihookapi.YukiHookAPI
3130
import com.highcapable.yukihookapi.hook.factory.prefs
3231
import com.highcapable.yukihookapi.hook.log.loggerW
3332
import com.highcapable.yukihookapi.hook.param.PackageParam
@@ -41,9 +40,6 @@ object ConfigData {
4140
/** 启用模块 */
4241
val ENABLE_MODULE = PrefsData("_enable_module", true)
4342

44-
/** 启用数据缓存 */
45-
val ENABLE_PREFS_CACHE = PrefsData("_enable_prefs_cache", true)
46-
4743
/** 启用模块日志 */
4844
val ENABLE_MODULE_LOG = PrefsData("_enable_module_log", false)
4945

@@ -117,8 +113,6 @@ object ConfigData {
117113
is Context, is PackageParam -> this.instance = instance
118114
else -> error("Unknown type for init ConfigData")
119115
}
120-
/** 设置是否启用数据缓存 */
121-
YukiHookAPI.Configs.isEnablePrefsBridgeCache = isEnablePrefsCache
122116
}
123117

124118
/**
@@ -203,16 +197,6 @@ object ConfigData {
203197
putBoolean(ENABLE_MODULE, value)
204198
}
205199

206-
/**
207-
* 是否启用数据缓存
208-
* @return [Boolean]
209-
*/
210-
var isEnablePrefsCache
211-
get() = getBoolean(ENABLE_PREFS_CACHE)
212-
set(value) {
213-
putBoolean(ENABLE_PREFS_CACHE, value)
214-
}
215-
216200
/**
217201
* 是否启用模块日志
218202
* @return [Boolean]

app/src/main/java/com/fankes/coloros/notify/hook/HookEntry.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ object HookEntry : IYukiHookXposedInit {
4242
elements(PRIORITY)
4343
}
4444
isDebug = false
45+
isEnablePrefsBridgeCache = false
4546
}
4647

4748
override fun onHook() = encase {

app/src/main/java/com/fankes/coloros/notify/ui/activity/MainActivity.kt

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
129129
binding.notifyIconAutoSyncText.text = ConfigData.notifyIconFixAutoTime
130130
binding.moduleEnableSwitch.bind(ConfigData.ENABLE_MODULE) {
131131
onInitialize {
132-
binding.moduleEnableLogSwitch.isVisible = it
133-
binding.moduleEnableLogText.isVisible = it
134-
binding.modulePrefsCacheEnableSwitch.isVisible = it
135-
binding.modulePrefsCacheEnableText.isVisible = it
132+
binding.moduleEnableLogItem.isVisible = it
136133
binding.expAllDebugLogButton.isVisible = it && ConfigData.isEnableModuleLog
137134
binding.notifyIconConfigItem.isVisible = it
138135
binding.devNotifyConfigItem.isVisible = it
@@ -144,9 +141,6 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
144141
SystemUITool.showNeedRestartSnake(context = this@MainActivity)
145142
}
146143
}
147-
binding.modulePrefsCacheEnableSwitch.bind(ConfigData.ENABLE_PREFS_CACHE) {
148-
onChanged { SystemUITool.showNeedRestartSnake(context = this@MainActivity) }
149-
}
150144
binding.moduleEnableLogSwitch.bind(ConfigData.ENABLE_MODULE_LOG) {
151145
onInitialize { binding.expAllDebugLogButton.isVisible = it && ConfigData.isEnableModule }
152146
onChanged {

app/src/main/res/layout/activity_main.xml

Lines changed: 39 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -270,68 +270,50 @@
270270
android:textColor="@color/colorTextDark"
271271
android:textSize="12sp" />
272272

273-
<com.fankes.coloros.notify.ui.widget.MaterialSwitch
274-
android:id="@+id/module_prefs_cache_enable_switch"
275-
android:layout_width="match_parent"
276-
android:layout_height="30dp"
277-
android:layout_marginLeft="15dp"
278-
android:layout_marginRight="15dp"
279-
android:layout_marginBottom="10dp"
280-
android:text="启用数据缓存"
281-
android:textColor="@color/colorTextGray"
282-
android:textSize="15sp" />
283-
284-
<TextView
285-
android:id="@+id/module_prefs_cache_enable_text"
273+
<LinearLayout
274+
android:id="@+id/module_enable_log_item"
286275
android:layout_width="match_parent"
287276
android:layout_height="wrap_content"
288-
android:layout_marginLeft="15dp"
289-
android:layout_marginRight="15dp"
290-
android:layout_marginBottom="5dp"
291-
android:alpha="0.6"
292-
android:lineSpacingExtra="6dp"
293-
android:text="此选项默认开启,默认情况下模块会将数据缓存在内存中,防止每次重复读取数据造成卡顿,如果开启此选项后一段时间导致系统界面 (系统 UI) 崩溃 (内存溢出),你可以尝试关闭此选项,但是这有可能会造成在通知较多时下拉通知栏出现卡顿。"
294-
android:textColor="@color/colorTextDark"
295-
android:textSize="12sp" />
277+
android:layout_marginBottom="10dp"
278+
android:orientation="vertical">
296279

297-
<com.fankes.coloros.notify.ui.widget.MaterialSwitch
298-
android:id="@+id/module_enable_log_switch"
299-
android:layout_width="match_parent"
300-
android:layout_height="35dp"
301-
android:layout_marginLeft="15dp"
302-
android:layout_marginRight="15dp"
303-
android:layout_marginBottom="5dp"
304-
android:text="启用调试日志"
305-
android:textColor="@color/colorTextGray"
306-
android:textSize="15sp" />
280+
<com.fankes.coloros.notify.ui.widget.MaterialSwitch
281+
android:id="@+id/module_enable_log_switch"
282+
android:layout_width="match_parent"
283+
android:layout_height="30dp"
284+
android:layout_marginLeft="15dp"
285+
android:layout_marginRight="15dp"
286+
android:layout_marginBottom="10dp"
287+
android:text="启用调试日志"
288+
android:textColor="@color/colorTextGray"
289+
android:textSize="15sp" />
307290

308-
<TextView
309-
android:id="@+id/exp_all_debug_log_button"
310-
android:layout_width="match_parent"
311-
android:layout_height="wrap_content"
312-
android:layout_marginLeft="13dp"
313-
android:layout_marginRight="13dp"
314-
android:layout_marginBottom="10dp"
315-
android:background="@drawable/bg_button_round"
316-
android:gravity="center"
317-
android:padding="10dp"
318-
android:singleLine="true"
319-
android:text="导出全部调试日志"
320-
android:textColor="@color/colorTextGray"
321-
android:textSize="15sp" />
291+
<TextView
292+
android:id="@+id/exp_all_debug_log_button"
293+
android:layout_width="match_parent"
294+
android:layout_height="wrap_content"
295+
android:layout_marginLeft="13dp"
296+
android:layout_marginRight="13dp"
297+
android:layout_marginBottom="10dp"
298+
android:background="@drawable/bg_button_round"
299+
android:gravity="center"
300+
android:padding="10dp"
301+
android:singleLine="true"
302+
android:text="导出全部调试日志"
303+
android:textColor="@color/colorTextGray"
304+
android:textSize="15sp" />
322305

323-
<TextView
324-
android:id="@+id/module_enable_log_text"
325-
android:layout_width="match_parent"
326-
android:layout_height="wrap_content"
327-
android:layout_marginLeft="15dp"
328-
android:layout_marginRight="15dp"
329-
android:layout_marginBottom="10dp"
330-
android:alpha="0.6"
331-
android:lineSpacingExtra="6dp"
332-
android:text="默认情况下不建议开启此选项,仅在模块故障时开启,此时你可以发送调试日志给开发者帮助我们快速定位问题。"
333-
android:textColor="@color/colorTextDark"
334-
android:textSize="12sp" />
306+
<TextView
307+
android:layout_width="match_parent"
308+
android:layout_height="wrap_content"
309+
android:layout_marginLeft="15dp"
310+
android:layout_marginRight="15dp"
311+
android:alpha="0.6"
312+
android:lineSpacingExtra="6dp"
313+
android:text="默认情况下不建议开启此选项,仅在模块故障时开启,此时你可以发送调试日志给开发者帮助我们快速定位问题。"
314+
android:textColor="@color/colorTextDark"
315+
android:textSize="12sp" />
316+
</LinearLayout>
335317
</LinearLayout>
336318

337319
<LinearLayout

0 commit comments

Comments
 (0)