diff --git a/app/src/main/java/io/legado/app/help/PrefExtensions.kt b/app/src/main/java/io/legado/app/help/PrefExtensions.kt new file mode 100644 index 000000000..3f6de591c --- /dev/null +++ b/app/src/main/java/io/legado/app/help/PrefExtensions.kt @@ -0,0 +1,12 @@ +package io.legado.app.help + +import android.content.Context +import io.legado.app.utils.getPrefBoolean +import io.legado.app.utils.getPrefInt + + +val Context.isShowRSS: Boolean + get() = getPrefBoolean("showRss", true) + +val Context.threadCount: Int + get() = getPrefInt("threadCount", 6) \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/ui/config/OtherConfigFragment.kt b/app/src/main/java/io/legado/app/ui/config/OtherConfigFragment.kt index f4c38eb70..4795b56bb 100644 --- a/app/src/main/java/io/legado/app/ui/config/OtherConfigFragment.kt +++ b/app/src/main/java/io/legado/app/ui/config/OtherConfigFragment.kt @@ -13,6 +13,7 @@ import io.legado.app.R import io.legado.app.constant.Bus import io.legado.app.constant.PreferKey import io.legado.app.help.BookHelp +import io.legado.app.help.threadCount import io.legado.app.lib.theme.ATH import io.legado.app.receiver.SharedReceiverActivity import io.legado.app.ui.filechooser.FileChooserDialog @@ -113,7 +114,7 @@ class OtherConfigFragment : PreferenceFragmentCompat(), PreferKey.downloadPath -> getPrefString(PreferKey.downloadPath) ?: App.INSTANCE.getExternalFilesDir(null)?.absolutePath ?: App.INSTANCE.cacheDir.absolutePath - "threadCount" -> getPrefInt("threadCount", 6) + "threadCount" -> requireContext().threadCount else -> getPrefString(key) ?: "" } } diff --git a/app/src/main/java/io/legado/app/ui/main/MainActivity.kt b/app/src/main/java/io/legado/app/ui/main/MainActivity.kt index ddb8b3f10..0b47b24f6 100644 --- a/app/src/main/java/io/legado/app/ui/main/MainActivity.kt +++ b/app/src/main/java/io/legado/app/ui/main/MainActivity.kt @@ -17,6 +17,7 @@ import io.legado.app.base.VMBaseActivity import io.legado.app.constant.Bus import io.legado.app.constant.PreferKey import io.legado.app.help.coroutine.Coroutine +import io.legado.app.help.isShowRSS import io.legado.app.help.storage.Backup import io.legado.app.lib.theme.ATH import io.legado.app.service.BaseReadAloudService 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 2ab88b481..7f4be23c0 100644 --- a/app/src/main/java/io/legado/app/utils/ContextExtensions.kt +++ b/app/src/main/java/io/legado/app/utils/ContextExtensions.kt @@ -120,6 +120,3 @@ val Context.isNightTheme: Boolean val Context.isTransparentStatusBar: Boolean get() = getPrefBoolean("transparentStatusBar", true) - -val Context.isShowRSS: Boolean - get() = getPrefBoolean("showRss", true) \ No newline at end of file