Merge pull request #169

* 修复 隐藏网速单位 & 随便精简了下代码

* Update SettingsActivity.kt
This commit is contained in:
YuKongA
2022-05-25 22:04:41 +08:00
committed by GitHub
parent cef006ced2
commit 90466bb3fb
70 changed files with 435 additions and 531 deletions

View File

@@ -12,6 +12,7 @@ object XSPUtils {
}
return prefs.getBoolean(key, defValue)
}
fun getInt(key: String, defValue: Int): Int {
if (prefs.hasFileChanged()) {
prefs.reload()
@@ -34,7 +35,12 @@ object XSPUtils {
}
}
inline fun hasEnable(key: String, default: Boolean = false, noinline extraCondition: (() -> Boolean)? = null, crossinline block: () -> Unit) {
inline fun hasEnable(
key: String,
default: Boolean = false,
noinline extraCondition: (() -> Boolean)? = null,
crossinline block: () -> Unit
) {
val conditionResult = if (extraCondition != null) extraCondition() else true
if (XSPUtils.getBoolean(key, default) && conditionResult) {
block()