|
|
@ -7,7 +7,26 @@ import io.legado.app.R |
|
|
|
import io.legado.app.constant.PreferKey |
|
|
|
import io.legado.app.constant.PreferKey |
|
|
|
import io.legado.app.utils.* |
|
|
|
import io.legado.app.utils.* |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Suppress("MemberVisibilityCanBePrivate") |
|
|
|
object AppConfig { |
|
|
|
object AppConfig { |
|
|
|
|
|
|
|
var isEInkMode: Boolean = false |
|
|
|
|
|
|
|
var clickAllNext: Boolean = false |
|
|
|
|
|
|
|
var isGooglePlay: Boolean |
|
|
|
|
|
|
|
var isCoolApk: Boolean |
|
|
|
|
|
|
|
var replaceEnableDefault: Boolean = true |
|
|
|
|
|
|
|
val sysElevation = App.INSTANCE.resources.getDimension(R.dimen.design_appbar_elevation).toInt() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
init { |
|
|
|
|
|
|
|
upConfig() |
|
|
|
|
|
|
|
isGooglePlay = App.INSTANCE.channel == "google" |
|
|
|
|
|
|
|
isCoolApk = App.INSTANCE.channel == "coolApk" |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fun upConfig() { |
|
|
|
|
|
|
|
upEInkMode() |
|
|
|
|
|
|
|
upClickAllNext() |
|
|
|
|
|
|
|
upReplaceEnableDefault() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun isNightTheme(context: Context): Boolean { |
|
|
|
fun isNightTheme(context: Context): Boolean { |
|
|
|
return when (context.getPrefString(PreferKey.themeMode, "0")) { |
|
|
|
return when (context.getPrefString(PreferKey.themeMode, "0")) { |
|
|
@ -30,8 +49,9 @@ object AppConfig { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
val isEInkMode: Boolean |
|
|
|
fun upEInkMode() { |
|
|
|
get() = App.INSTANCE.getPrefString(PreferKey.themeMode) == "3" |
|
|
|
isEInkMode = App.INSTANCE.getPrefString(PreferKey.themeMode) == "3" |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var isTransparentStatusBar: Boolean |
|
|
|
var isTransparentStatusBar: Boolean |
|
|
|
get() = App.INSTANCE.getPrefBoolean(PreferKey.transparentStatusBar) |
|
|
|
get() = App.INSTANCE.getPrefBoolean(PreferKey.transparentStatusBar) |
|
|
@ -83,7 +103,9 @@ object AppConfig { |
|
|
|
App.INSTANCE.putPrefInt(PreferKey.ttsSpeechRate, value) |
|
|
|
App.INSTANCE.putPrefInt(PreferKey.ttsSpeechRate, value) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
val clickAllNext: Boolean get() = App.INSTANCE.getPrefBoolean(PreferKey.clickAllNext, false) |
|
|
|
fun upClickAllNext() { |
|
|
|
|
|
|
|
clickAllNext = App.INSTANCE.getPrefBoolean(PreferKey.clickAllNext, false) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var chineseConverterType: Int |
|
|
|
var chineseConverterType: Int |
|
|
|
get() = App.INSTANCE.getPrefInt(PreferKey.chineseConverterType) |
|
|
|
get() = App.INSTANCE.getPrefInt(PreferKey.chineseConverterType) |
|
|
@ -99,23 +121,19 @@ object AppConfig { |
|
|
|
|
|
|
|
|
|
|
|
var elevation: Int |
|
|
|
var elevation: Int |
|
|
|
@SuppressLint("PrivateResource") |
|
|
|
@SuppressLint("PrivateResource") |
|
|
|
get() = App.INSTANCE.getPrefInt( |
|
|
|
get() = App.INSTANCE.getPrefInt(PreferKey.barElevation, sysElevation) |
|
|
|
PreferKey.barElevation, |
|
|
|
|
|
|
|
App.INSTANCE.resources.getDimension(R.dimen.design_appbar_elevation).toInt() |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
set(value) { |
|
|
|
set(value) { |
|
|
|
App.INSTANCE.putPrefInt(PreferKey.barElevation, value) |
|
|
|
App.INSTANCE.putPrefInt(PreferKey.barElevation, value) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var replaceEnableDefault: Boolean = |
|
|
|
|
|
|
|
App.INSTANCE.getPrefBoolean(PreferKey.replaceEnableDefault, true) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
val autoChangeSource: Boolean get() = App.INSTANCE.getPrefBoolean("autoChangeSource", true) |
|
|
|
val autoChangeSource: Boolean get() = App.INSTANCE.getPrefBoolean("autoChangeSource", true) |
|
|
|
|
|
|
|
|
|
|
|
val readBodyToLh: Boolean get() = App.INSTANCE.getPrefBoolean(PreferKey.readBodyToLh, true) |
|
|
|
val readBodyToLh: Boolean get() = App.INSTANCE.getPrefBoolean(PreferKey.readBodyToLh, true) |
|
|
|
|
|
|
|
|
|
|
|
val isGooglePlay: Boolean get() = App.INSTANCE.channel == "google" |
|
|
|
fun upReplaceEnableDefault() { |
|
|
|
|
|
|
|
replaceEnableDefault = |
|
|
|
|
|
|
|
App.INSTANCE.getPrefBoolean(PreferKey.replaceEnableDefault, true) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
val isCoolApk: Boolean get() = App.INSTANCE.channel == "coolApk" |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|