64c50c1283
Given that the next stable version of Chrome (120) will require Android 8+, it's inevitable that the WebView functionality will gradually break. As always, newer OS versions are recommended for better support with evolving Internet technologies. According to https://apilevels.com/, Android 8+ still covers 93.7% of Android users.
40 lines
1.3 KiB
Kotlin
40 lines
1.3 KiB
Kotlin
package eu.kanade.domain.ui
|
|
|
|
import eu.kanade.domain.ui.model.AppTheme
|
|
import eu.kanade.domain.ui.model.TabletUiMode
|
|
import eu.kanade.domain.ui.model.ThemeMode
|
|
import eu.kanade.tachiyomi.util.system.DeviceUtil
|
|
import eu.kanade.tachiyomi.util.system.isDynamicColorAvailable
|
|
import tachiyomi.core.preference.PreferenceStore
|
|
import tachiyomi.core.preference.getEnum
|
|
import java.text.DateFormat
|
|
import java.text.SimpleDateFormat
|
|
import java.util.Locale
|
|
|
|
class UiPreferences(
|
|
private val preferenceStore: PreferenceStore,
|
|
) {
|
|
|
|
fun themeMode() = preferenceStore.getEnum("pref_theme_mode_key", ThemeMode.SYSTEM)
|
|
|
|
fun appTheme() = preferenceStore.getEnum(
|
|
"pref_app_theme",
|
|
if (DeviceUtil.isDynamicColorAvailable) { AppTheme.MONET } else { AppTheme.DEFAULT },
|
|
)
|
|
|
|
fun themeDarkAmoled() = preferenceStore.getBoolean("pref_theme_dark_amoled_key", false)
|
|
|
|
fun relativeTime() = preferenceStore.getBoolean("relative_time_v2", true)
|
|
|
|
fun dateFormat() = preferenceStore.getString("app_date_format", "")
|
|
|
|
fun tabletUiMode() = preferenceStore.getEnum("tablet_ui_mode", TabletUiMode.AUTOMATIC)
|
|
|
|
companion object {
|
|
fun dateFormat(format: String): DateFormat = when (format) {
|
|
"" -> DateFormat.getDateInstance(DateFormat.SHORT)
|
|
else -> SimpleDateFormat(format, Locale.getDefault())
|
|
}
|
|
}
|
|
}
|