From c5943770df39e862d1933c035cf439a1c46e2d33 Mon Sep 17 00:00:00 2001 From: gedoor Date: Sun, 14 Feb 2021 16:59:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/assets/updateLog.md | 1 + app/src/main/java/io/legado/app/constant/PreferKey.kt | 2 ++ app/src/main/java/io/legado/app/help/AppConfig.kt | 3 +-- app/src/main/java/io/legado/app/ui/welcome/WelcomeActivity.kt | 3 +-- app/src/main/java/io/legado/app/utils/ContextExtensions.kt | 4 ---- app/src/main/res/values/pref_key_value.xml | 2 -- app/src/main/res/xml/pref_config_other.xml | 4 ++-- 7 files changed, 7 insertions(+), 12 deletions(-) diff --git a/app/src/main/assets/updateLog.md b/app/src/main/assets/updateLog.md index aeb542e32..fdccc63eb 100644 --- a/app/src/main/assets/updateLog.md +++ b/app/src/main/assets/updateLog.md @@ -6,6 +6,7 @@ **2021/02/13** * 修复分享内容不对的bug * 优化主题颜色,添加透明度 +* rss分类url支持js **2021/02/09** * 修复分组内书籍数目少于搜索线程数目,会导致搜索线程数目变低 diff --git a/app/src/main/java/io/legado/app/constant/PreferKey.kt b/app/src/main/java/io/legado/app/constant/PreferKey.kt index b8cbedf1c..1d25c5607 100644 --- a/app/src/main/java/io/legado/app/constant/PreferKey.kt +++ b/app/src/main/java/io/legado/app/constant/PreferKey.kt @@ -65,6 +65,8 @@ object PreferKey { const val screenOrientation = "screenOrientation" const val syncBookProgress = "syncBookProgress" const val preDownload = "preDownload" + const val autoRefresh = "auto_refresh" + const val defaultToRead = "defaultToRead" const val cPrimary = "colorPrimary" const val cAccent = "colorAccent" diff --git a/app/src/main/java/io/legado/app/help/AppConfig.kt b/app/src/main/java/io/legado/app/help/AppConfig.kt index 08a1fa3df..81441ea2d 100644 --- a/app/src/main/java/io/legado/app/help/AppConfig.kt +++ b/app/src/main/java/io/legado/app/help/AppConfig.kt @@ -2,7 +2,6 @@ package io.legado.app.help import android.content.Context import android.content.SharedPreferences -import io.legado.app.R import io.legado.app.constant.AppConst import io.legado.app.constant.PreferKey import io.legado.app.utils.* @@ -96,7 +95,7 @@ object AppConfig : SharedPreferences.OnSharedPreferenceChangeListener { get() = context.getPrefBoolean(PreferKey.showRss, true) val autoRefreshBook: Boolean - get() = context.getPrefBoolean(R.string.pk_auto_refresh) + get() = context.getPrefBoolean(PreferKey.autoRefresh) var threadCount: Int get() = context.getPrefInt(PreferKey.threadCount, 16) diff --git a/app/src/main/java/io/legado/app/ui/welcome/WelcomeActivity.kt b/app/src/main/java/io/legado/app/ui/welcome/WelcomeActivity.kt index 4337e9476..7a224f3bc 100644 --- a/app/src/main/java/io/legado/app/ui/welcome/WelcomeActivity.kt +++ b/app/src/main/java/io/legado/app/ui/welcome/WelcomeActivity.kt @@ -3,7 +3,6 @@ package io.legado.app.ui.welcome import android.content.Intent import android.os.Bundle import com.hankcs.hanlp.HanLP -import io.legado.app.R import io.legado.app.base.BaseActivity import io.legado.app.constant.PreferKey import io.legado.app.data.appDb @@ -54,7 +53,7 @@ open class WelcomeActivity : BaseActivity() { private fun startMainActivity() { startActivity() - if (getPrefBoolean(R.string.pk_default_read)) { + if (getPrefBoolean(PreferKey.defaultToRead)) { startActivity() } finish() diff --git a/app/src/main/java/io/legado/app/utils/ContextExtensions.kt b/app/src/main/java/io/legado/app/utils/ContextExtensions.kt index 259334f3c..d6644e35a 100644 --- a/app/src/main/java/io/legado/app/utils/ContextExtensions.kt +++ b/app/src/main/java/io/legado/app/utils/ContextExtensions.kt @@ -17,7 +17,6 @@ import android.provider.Settings import android.widget.Toast import androidx.annotation.ColorRes import androidx.annotation.DrawableRes -import androidx.annotation.StringRes import androidx.core.content.ContextCompat import androidx.core.content.FileProvider import androidx.core.content.edit @@ -68,9 +67,6 @@ val Context.defaultSharedPreferences: SharedPreferences fun Context.getPrefBoolean(key: String, defValue: Boolean = false) = defaultSharedPreferences.getBoolean(key, defValue) -fun Context.getPrefBoolean(@StringRes keyId: Int, defValue: Boolean = false) = - defaultSharedPreferences.getBoolean(getString(keyId), defValue) - fun Context.putPrefBoolean(key: String, value: Boolean = false) = defaultSharedPreferences.edit { putBoolean(key, value) } diff --git a/app/src/main/res/values/pref_key_value.xml b/app/src/main/res/values/pref_key_value.xml index ebaac231b..904a4e441 100644 --- a/app/src/main/res/values/pref_key_value.xml +++ b/app/src/main/res/values/pref_key_value.xml @@ -1,8 +1,6 @@ - auto_refresh bookshelf_px - defaultToRead 开源阅读 https://alanskycn.gitee.io/teachme/ diff --git a/app/src/main/res/xml/pref_config_other.xml b/app/src/main/res/xml/pref_config_other.xml index c3439baf8..c15aee51e 100644 --- a/app/src/main/res/xml/pref_config_other.xml +++ b/app/src/main/res/xml/pref_config_other.xml @@ -18,14 +18,14 @@