|
@@ -5,10 +5,20 @@ import androidx.lifecycle.ViewModel
|
|
|
import androidx.lifecycle.viewModelScope
|
|
import androidx.lifecycle.viewModelScope
|
|
|
import io.legado.app.R
|
|
import io.legado.app.R
|
|
|
import io.legado.app.constant.PreferKey
|
|
import io.legado.app.constant.PreferKey
|
|
|
|
|
+import io.legado.app.domain.gateway.AppShellBooleanSetting
|
|
|
import io.legado.app.domain.gateway.AppShellSettingsGateway
|
|
import io.legado.app.domain.gateway.AppShellSettingsGateway
|
|
|
|
|
+import io.legado.app.domain.gateway.AppShellSettingsUpdate
|
|
|
|
|
+import io.legado.app.domain.gateway.AppShellStringSetting
|
|
|
|
|
+import io.legado.app.domain.gateway.LabSettingsGateway
|
|
|
import io.legado.app.domain.gateway.ReadSettingsGateway
|
|
import io.legado.app.domain.gateway.ReadSettingsGateway
|
|
|
|
|
+import io.legado.app.domain.gateway.ReadSettingsUpdate
|
|
|
|
|
+import io.legado.app.domain.gateway.ThemeBooleanSetting
|
|
|
|
|
+import io.legado.app.domain.gateway.ThemeColorSlot
|
|
|
|
|
+import io.legado.app.domain.gateway.ThemeFloatSetting
|
|
|
|
|
+import io.legado.app.domain.gateway.ThemeIntSetting
|
|
|
import io.legado.app.domain.gateway.ThemeSettingsGateway
|
|
import io.legado.app.domain.gateway.ThemeSettingsGateway
|
|
|
-import io.legado.app.domain.gateway.LabSettingsGateway
|
|
|
|
|
|
|
+import io.legado.app.domain.gateway.ThemeSettingsUpdate
|
|
|
|
|
+import io.legado.app.domain.gateway.ThemeStringSetting
|
|
|
import io.legado.app.domain.model.settings.AppShellSettings
|
|
import io.legado.app.domain.model.settings.AppShellSettings
|
|
|
import io.legado.app.domain.model.settings.ThemeSettings
|
|
import io.legado.app.domain.model.settings.ThemeSettings
|
|
|
import io.legado.app.ui.main.MainDestination
|
|
import io.legado.app.ui.main.MainDestination
|
|
@@ -18,8 +28,6 @@ import io.legado.app.utils.MD5Utils
|
|
|
import io.legado.app.utils.externalFiles
|
|
import io.legado.app.utils.externalFiles
|
|
|
import io.legado.app.utils.inputStream
|
|
import io.legado.app.utils.inputStream
|
|
|
import io.legado.app.utils.openInputStream
|
|
import io.legado.app.utils.openInputStream
|
|
|
-import java.io.File
|
|
|
|
|
-import java.io.FileOutputStream
|
|
|
|
|
import kotlinx.coroutines.Dispatchers
|
|
import kotlinx.coroutines.Dispatchers
|
|
|
import kotlinx.coroutines.flow.MutableSharedFlow
|
|
import kotlinx.coroutines.flow.MutableSharedFlow
|
|
|
import kotlinx.coroutines.flow.MutableStateFlow
|
|
import kotlinx.coroutines.flow.MutableStateFlow
|
|
@@ -28,6 +36,8 @@ import kotlinx.coroutines.flow.asStateFlow
|
|
|
import kotlinx.coroutines.flow.update
|
|
import kotlinx.coroutines.flow.update
|
|
|
import kotlinx.coroutines.launch
|
|
import kotlinx.coroutines.launch
|
|
|
import splitties.init.appCtx
|
|
import splitties.init.appCtx
|
|
|
|
|
+import java.io.File
|
|
|
|
|
+import java.io.FileOutputStream
|
|
|
|
|
|
|
|
class ThemeConfigViewModel(
|
|
class ThemeConfigViewModel(
|
|
|
private val appShellSettingsGateway: AppShellSettingsGateway,
|
|
private val appShellSettingsGateway: AppShellSettingsGateway,
|
|
@@ -79,6 +89,13 @@ class ThemeConfigViewModel(
|
|
|
_uiState.update { it.copy(activeSheet = intent.sheet) }
|
|
_uiState.update { it.copy(activeSheet = intent.sheet) }
|
|
|
ThemeConfigIntent.DismissSheet ->
|
|
ThemeConfigIntent.DismissSheet ->
|
|
|
_uiState.update { it.copy(activeSheet = null) }
|
|
_uiState.update { it.copy(activeSheet = null) }
|
|
|
|
|
+ is ThemeConfigIntent.ShowDialog ->
|
|
|
|
|
+ _uiState.update { it.copy(activeDialog = intent.dialog) }
|
|
|
|
|
+
|
|
|
|
|
+ ThemeConfigIntent.DismissDialog ->
|
|
|
|
|
+ _uiState.update { it.copy(activeDialog = null) }
|
|
|
|
|
+
|
|
|
|
|
+ ThemeConfigIntent.ResetDefaults -> resetDefaults()
|
|
|
is ThemeConfigIntent.SelectTheme -> selectTheme(intent.value)
|
|
is ThemeConfigIntent.SelectTheme -> selectTheme(intent.value)
|
|
|
is ThemeConfigIntent.SetThemeMode -> updateAppShell(
|
|
is ThemeConfigIntent.SetThemeMode -> updateAppShell(
|
|
|
transform = { it.copy(themeMode = intent.value) },
|
|
transform = { it.copy(themeMode = intent.value) },
|
|
@@ -165,6 +182,322 @@ class ThemeConfigViewModel(
|
|
|
viewModelScope.launch { themeSettingsGateway.update(transform) }
|
|
viewModelScope.launch { themeSettingsGateway.update(transform) }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ private fun resetDefaults() {
|
|
|
|
|
+ viewModelScope.launch(Dispatchers.IO) {
|
|
|
|
|
+ val defaultShell = AppShellSettings()
|
|
|
|
|
+ val defaultTheme = ThemeSettings()
|
|
|
|
|
+ val currentTheme = _uiState.value.theme
|
|
|
|
|
+
|
|
|
|
|
+ listOf(currentTheme.backgroundImageLight, currentTheme.backgroundImageDark)
|
|
|
|
|
+ .filterNotNull()
|
|
|
|
|
+ .map(::File)
|
|
|
|
|
+ .filter { it.absolutePath.startsWith(appCtx.externalFiles.absolutePath) }
|
|
|
|
|
+ .forEach { it.delete() }
|
|
|
|
|
+ listOf("home", "bookshelf", "explore", "rss", "my")
|
|
|
|
|
+ .map { File(appCtx.filesDir, "nav_icons/$it.png") }
|
|
|
|
|
+ .forEach { it.delete() }
|
|
|
|
|
+ currentTheme.appFontPath?.let { path ->
|
|
|
|
|
+ File(path)
|
|
|
|
|
+ .takeIf { it.absolutePath.startsWith(appCtx.filesDir.absolutePath) }
|
|
|
|
|
+ ?.delete()
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ appShellSettingsGateway.updateAll(
|
|
|
|
|
+ listOf(
|
|
|
|
|
+ AppShellSettingsUpdate.ThemeMode(defaultShell.themeMode),
|
|
|
|
|
+ AppShellSettingsUpdate.FontScale(defaultShell.fontScale),
|
|
|
|
|
+ AppShellSettingsUpdate.ComposeEngine(defaultShell.composeEngine),
|
|
|
|
|
+ AppShellSettingsUpdate.MainNavigationOrder(defaultShell.mainNavigationOrder),
|
|
|
|
|
+ AppShellSettingsUpdate.BooleanValue(
|
|
|
|
|
+ AppShellBooleanSetting.ShowHome,
|
|
|
|
|
+ defaultShell.showHome
|
|
|
|
|
+ ),
|
|
|
|
|
+ AppShellSettingsUpdate.BooleanValue(
|
|
|
|
|
+ AppShellBooleanSetting.ShowDiscovery,
|
|
|
|
|
+ defaultShell.showDiscovery
|
|
|
|
|
+ ),
|
|
|
|
|
+ AppShellSettingsUpdate.BooleanValue(
|
|
|
|
|
+ AppShellBooleanSetting.ShowRss,
|
|
|
|
|
+ defaultShell.showRss
|
|
|
|
|
+ ),
|
|
|
|
|
+ AppShellSettingsUpdate.BooleanValue(
|
|
|
|
|
+ AppShellBooleanSetting.ShowStatusBar,
|
|
|
|
|
+ defaultShell.showStatusBar
|
|
|
|
|
+ ),
|
|
|
|
|
+ AppShellSettingsUpdate.BooleanValue(
|
|
|
|
|
+ AppShellBooleanSetting.SwipeAnimation,
|
|
|
|
|
+ defaultShell.swipeAnimation
|
|
|
|
|
+ ),
|
|
|
|
|
+ AppShellSettingsUpdate.BooleanValue(
|
|
|
|
|
+ AppShellBooleanSetting.PredictiveBack,
|
|
|
|
|
+ defaultShell.predictiveBackEnabled
|
|
|
|
|
+ ),
|
|
|
|
|
+ AppShellSettingsUpdate.BooleanValue(
|
|
|
|
|
+ AppShellBooleanSetting.ShowBottomView,
|
|
|
|
|
+ defaultShell.showBottomView
|
|
|
|
|
+ ),
|
|
|
|
|
+ AppShellSettingsUpdate.BooleanValue(
|
|
|
|
|
+ AppShellBooleanSetting.UseFloatingBottomBar,
|
|
|
|
|
+ defaultShell.useFloatingBottomBar
|
|
|
|
|
+ ),
|
|
|
|
|
+ AppShellSettingsUpdate.BooleanValue(
|
|
|
|
|
+ AppShellBooleanSetting.UseFloatingBottomBarLiquidGlass,
|
|
|
|
|
+ defaultShell.useFloatingBottomBarLiquidGlass
|
|
|
|
|
+ ),
|
|
|
|
|
+ AppShellSettingsUpdate.BooleanValue(
|
|
|
|
|
+ AppShellBooleanSetting.NavExtended,
|
|
|
|
|
+ defaultShell.navExtended
|
|
|
|
|
+ ),
|
|
|
|
|
+ AppShellSettingsUpdate.StringValue(
|
|
|
|
|
+ AppShellStringSetting.TabletInterface,
|
|
|
|
|
+ defaultShell.tabletInterface
|
|
|
|
|
+ ),
|
|
|
|
|
+ AppShellSettingsUpdate.StringValue(
|
|
|
|
|
+ AppShellStringSetting.LabelVisibilityMode,
|
|
|
|
|
+ defaultShell.labelVisibilityMode
|
|
|
|
|
+ ),
|
|
|
|
|
+ AppShellSettingsUpdate.StringValue(
|
|
|
|
|
+ AppShellStringSetting.DefaultHomePage,
|
|
|
|
|
+ defaultShell.defaultHomePage
|
|
|
|
|
+ ),
|
|
|
|
|
+ AppShellSettingsUpdate.StringValue(
|
|
|
|
|
+ AppShellStringSetting.NavIconHome,
|
|
|
|
|
+ defaultShell.navIconHome
|
|
|
|
|
+ ),
|
|
|
|
|
+ AppShellSettingsUpdate.StringValue(
|
|
|
|
|
+ AppShellStringSetting.NavIconBookshelf,
|
|
|
|
|
+ defaultShell.navIconBookshelf
|
|
|
|
|
+ ),
|
|
|
|
|
+ AppShellSettingsUpdate.StringValue(
|
|
|
|
|
+ AppShellStringSetting.NavIconExplore,
|
|
|
|
|
+ defaultShell.navIconExplore
|
|
|
|
|
+ ),
|
|
|
|
|
+ AppShellSettingsUpdate.StringValue(
|
|
|
|
|
+ AppShellStringSetting.NavIconRss,
|
|
|
|
|
+ defaultShell.navIconRss
|
|
|
|
|
+ ),
|
|
|
|
|
+ AppShellSettingsUpdate.StringValue(
|
|
|
|
|
+ AppShellStringSetting.NavIconMy,
|
|
|
|
|
+ defaultShell.navIconMy
|
|
|
|
|
+ ),
|
|
|
|
|
+ AppShellSettingsUpdate.StringValue(
|
|
|
|
|
+ AppShellStringSetting.LauncherIcon,
|
|
|
|
|
+ defaultShell.launcherIcon
|
|
|
|
|
+ ),
|
|
|
|
|
+ )
|
|
|
|
|
+ )
|
|
|
|
|
+ themeSettingsGateway.updateAll(
|
|
|
|
|
+ listOf(
|
|
|
|
|
+ ThemeSettingsUpdate.AppTheme(defaultTheme.appTheme),
|
|
|
|
|
+ ThemeSettingsUpdate.PureBlack(defaultTheme.isPureBlack),
|
|
|
|
|
+ ThemeSettingsUpdate.PaletteStyle(defaultTheme.paletteStyle),
|
|
|
|
|
+ ThemeSettingsUpdate.MaterialVersion(defaultTheme.materialVersion),
|
|
|
|
|
+ ThemeSettingsUpdate.CustomContrast(defaultTheme.customContrast),
|
|
|
|
|
+ ThemeSettingsUpdate.DeepPersonalization(defaultTheme.enableDeepPersonalization),
|
|
|
|
|
+ ThemeSettingsUpdate.CustomPrimary(defaultTheme.customPrimary),
|
|
|
|
|
+ ThemeSettingsUpdate.CustomNightPrimary(defaultTheme.customNightPrimary),
|
|
|
|
|
+ ThemeSettingsUpdate.AppFontPath(null),
|
|
|
|
|
+ ThemeSettingsUpdate.CustomColor(
|
|
|
|
|
+ ThemeColorSlot.Primary,
|
|
|
|
|
+ defaultTheme.themeColor
|
|
|
|
|
+ ),
|
|
|
|
|
+ ThemeSettingsUpdate.CustomColor(
|
|
|
|
|
+ ThemeColorSlot.Secondary,
|
|
|
|
|
+ defaultTheme.secondaryThemeColor
|
|
|
|
|
+ ),
|
|
|
|
|
+ ThemeSettingsUpdate.CustomColor(
|
|
|
|
|
+ ThemeColorSlot.PrimaryText,
|
|
|
|
|
+ defaultTheme.primaryTextColor
|
|
|
|
|
+ ),
|
|
|
|
|
+ ThemeSettingsUpdate.CustomColor(
|
|
|
|
|
+ ThemeColorSlot.SecondaryText,
|
|
|
|
|
+ defaultTheme.secondaryTextColor
|
|
|
|
|
+ ),
|
|
|
|
|
+ ThemeSettingsUpdate.CustomColor(
|
|
|
|
|
+ ThemeColorSlot.Background,
|
|
|
|
|
+ defaultTheme.themeBackgroundColor
|
|
|
|
|
+ ),
|
|
|
|
|
+ ThemeSettingsUpdate.CustomColor(
|
|
|
|
|
+ ThemeColorSlot.LabelContainer,
|
|
|
|
|
+ defaultTheme.labelContainerColor
|
|
|
|
|
+ ),
|
|
|
|
|
+ ThemeSettingsUpdate.CustomColor(
|
|
|
|
|
+ ThemeColorSlot.PrimaryNight,
|
|
|
|
|
+ defaultTheme.themeColorNight
|
|
|
|
|
+ ),
|
|
|
|
|
+ ThemeSettingsUpdate.CustomColor(
|
|
|
|
|
+ ThemeColorSlot.SecondaryNight,
|
|
|
|
|
+ defaultTheme.secondaryThemeColorNight
|
|
|
|
|
+ ),
|
|
|
|
|
+ ThemeSettingsUpdate.CustomColor(
|
|
|
|
|
+ ThemeColorSlot.PrimaryTextNight,
|
|
|
|
|
+ defaultTheme.primaryTextColorNight
|
|
|
|
|
+ ),
|
|
|
|
|
+ ThemeSettingsUpdate.CustomColor(
|
|
|
|
|
+ ThemeColorSlot.SecondaryTextNight,
|
|
|
|
|
+ defaultTheme.secondaryTextColorNight
|
|
|
|
|
+ ),
|
|
|
|
|
+ ThemeSettingsUpdate.CustomColor(
|
|
|
|
|
+ ThemeColorSlot.BackgroundNight,
|
|
|
|
|
+ defaultTheme.themeBackgroundColorNight
|
|
|
|
|
+ ),
|
|
|
|
|
+ ThemeSettingsUpdate.CustomColor(
|
|
|
|
|
+ ThemeColorSlot.LabelContainerNight,
|
|
|
|
|
+ defaultTheme.labelContainerColorNight
|
|
|
|
|
+ ),
|
|
|
|
|
+ ThemeSettingsUpdate.BooleanValue(
|
|
|
|
|
+ ThemeBooleanSetting.UseMiuixMonet,
|
|
|
|
|
+ defaultTheme.useMiuixMonet
|
|
|
|
|
+ ),
|
|
|
|
|
+ ThemeSettingsUpdate.BooleanValue(
|
|
|
|
|
+ ThemeBooleanSetting.EnableBlur,
|
|
|
|
|
+ defaultTheme.enableBlur
|
|
|
|
|
+ ),
|
|
|
|
|
+ ThemeSettingsUpdate.BooleanValue(
|
|
|
|
|
+ ThemeBooleanSetting.EnableProgressiveBlur,
|
|
|
|
|
+ defaultTheme.enableProgressiveBlur
|
|
|
|
|
+ ),
|
|
|
|
|
+ ThemeSettingsUpdate.BooleanValue(
|
|
|
|
|
+ ThemeBooleanSetting.UseFlexibleTopAppBar,
|
|
|
|
|
+ defaultTheme.useFlexibleTopAppBar
|
|
|
|
|
+ ),
|
|
|
|
|
+ ThemeSettingsUpdate.BooleanValue(
|
|
|
|
|
+ ThemeBooleanSetting.BookInfoFollowCoverColor,
|
|
|
|
|
+ defaultTheme.bookInfoFollowCoverColor
|
|
|
|
|
+ ),
|
|
|
|
|
+ ThemeSettingsUpdate.BooleanValue(
|
|
|
|
|
+ ThemeBooleanSetting.EnableItemDivider,
|
|
|
|
|
+ defaultTheme.enableItemDivider
|
|
|
|
|
+ ),
|
|
|
|
|
+ ThemeSettingsUpdate.BooleanValue(
|
|
|
|
|
+ ThemeBooleanSetting.OverrideBaseCardCornerRadius,
|
|
|
|
|
+ defaultTheme.overrideBaseCardCornerRadius
|
|
|
|
|
+ ),
|
|
|
|
|
+ ThemeSettingsUpdate.BooleanValue(
|
|
|
|
|
+ ThemeBooleanSetting.OverrideBaseCardBorder,
|
|
|
|
|
+ defaultTheme.overrideBaseCardBorder
|
|
|
|
|
+ ),
|
|
|
|
|
+ ThemeSettingsUpdate.BooleanValue(
|
|
|
|
|
+ ThemeBooleanSetting.DisableSplicedColumnGroupCornerRadius,
|
|
|
|
|
+ defaultTheme.disableSplicedColumnGroupCornerRadius
|
|
|
|
|
+ ),
|
|
|
|
|
+ ThemeSettingsUpdate.BooleanValue(
|
|
|
|
|
+ ThemeBooleanSetting.EyeProtectionEnabled,
|
|
|
|
|
+ defaultTheme.eyeProtectionEnabled
|
|
|
|
|
+ ),
|
|
|
|
|
+ ThemeSettingsUpdate.BooleanValue(
|
|
|
|
|
+ ThemeBooleanSetting.EyeProtectionSchedule,
|
|
|
|
|
+ defaultTheme.eyeProtectionSchedule
|
|
|
|
|
+ ),
|
|
|
|
|
+ ThemeSettingsUpdate.BooleanValue(
|
|
|
|
|
+ ThemeBooleanSetting.ShowRefactorTip,
|
|
|
|
|
+ defaultTheme.showRefactorTip
|
|
|
|
|
+ ),
|
|
|
|
|
+ ThemeSettingsUpdate.BooleanValue(
|
|
|
|
|
+ ThemeBooleanSetting.EnableCustomTagColors,
|
|
|
|
|
+ defaultTheme.enableCustomTagColors
|
|
|
|
|
+ ),
|
|
|
|
|
+ ThemeSettingsUpdate.IntValue(
|
|
|
|
|
+ ThemeIntSetting.ContainerOpacity,
|
|
|
|
|
+ defaultTheme.containerOpacity
|
|
|
|
|
+ ),
|
|
|
|
|
+ ThemeSettingsUpdate.IntValue(
|
|
|
|
|
+ ThemeIntSetting.TopBarOpacity,
|
|
|
|
|
+ defaultTheme.topBarOpacity
|
|
|
|
|
+ ),
|
|
|
|
|
+ ThemeSettingsUpdate.IntValue(
|
|
|
|
|
+ ThemeIntSetting.BottomBarOpacity,
|
|
|
|
|
+ defaultTheme.bottomBarOpacity
|
|
|
|
|
+ ),
|
|
|
|
|
+ ThemeSettingsUpdate.IntValue(
|
|
|
|
|
+ ThemeIntSetting.TopBarBlurRadius,
|
|
|
|
|
+ defaultTheme.topBarBlurRadius
|
|
|
|
|
+ ),
|
|
|
|
|
+ ThemeSettingsUpdate.IntValue(
|
|
|
|
|
+ ThemeIntSetting.BottomBarBlurRadius,
|
|
|
|
|
+ defaultTheme.bottomBarBlurRadius
|
|
|
|
|
+ ),
|
|
|
|
|
+ ThemeSettingsUpdate.IntValue(
|
|
|
|
|
+ ThemeIntSetting.TopBarBlurAlpha,
|
|
|
|
|
+ defaultTheme.topBarBlurAlpha
|
|
|
|
|
+ ),
|
|
|
|
|
+ ThemeSettingsUpdate.IntValue(
|
|
|
|
|
+ ThemeIntSetting.BottomBarBlurAlpha,
|
|
|
|
|
+ defaultTheme.bottomBarBlurAlpha
|
|
|
|
|
+ ),
|
|
|
|
|
+ ThemeSettingsUpdate.IntValue(
|
|
|
|
|
+ ThemeIntSetting.BackgroundImageBlurring,
|
|
|
|
|
+ defaultTheme.backgroundImageBlurring
|
|
|
|
|
+ ),
|
|
|
|
|
+ ThemeSettingsUpdate.IntValue(
|
|
|
|
|
+ ThemeIntSetting.BackgroundImageDarkBlurring,
|
|
|
|
|
+ defaultTheme.backgroundImageDarkBlurring
|
|
|
|
|
+ ),
|
|
|
|
|
+ ThemeSettingsUpdate.IntValue(
|
|
|
|
|
+ ThemeIntSetting.ItemDividerColor,
|
|
|
|
|
+ defaultTheme.itemDividerColor
|
|
|
|
|
+ ),
|
|
|
|
|
+ ThemeSettingsUpdate.IntValue(
|
|
|
|
|
+ ThemeIntSetting.BaseCardBorderColor,
|
|
|
|
|
+ defaultTheme.baseCardBorderColor
|
|
|
|
|
+ ),
|
|
|
|
|
+ ThemeSettingsUpdate.IntValue(
|
|
|
|
|
+ ThemeIntSetting.BaseCardBorderColorNight,
|
|
|
|
|
+ defaultTheme.baseCardBorderColorNight
|
|
|
|
|
+ ),
|
|
|
|
|
+ ThemeSettingsUpdate.IntValue(
|
|
|
|
|
+ ThemeIntSetting.ColorTemperature,
|
|
|
|
|
+ defaultTheme.colorTemperature
|
|
|
|
|
+ ),
|
|
|
|
|
+ ThemeSettingsUpdate.FloatValue(
|
|
|
|
|
+ ThemeFloatSetting.BottomBarLensRadius,
|
|
|
|
|
+ defaultTheme.bottomBarLensRadius
|
|
|
|
|
+ ),
|
|
|
|
|
+ ThemeSettingsUpdate.FloatValue(
|
|
|
|
|
+ ThemeFloatSetting.ItemDividerWidth,
|
|
|
|
|
+ defaultTheme.itemDividerWidth
|
|
|
|
|
+ ),
|
|
|
|
|
+ ThemeSettingsUpdate.FloatValue(
|
|
|
|
|
+ ThemeFloatSetting.ItemDividerLength,
|
|
|
|
|
+ defaultTheme.itemDividerLength
|
|
|
|
|
+ ),
|
|
|
|
|
+ ThemeSettingsUpdate.FloatValue(
|
|
|
|
|
+ ThemeFloatSetting.BaseCardCornerRadius,
|
|
|
|
|
+ defaultTheme.baseCardCornerRadius
|
|
|
|
|
+ ),
|
|
|
|
|
+ ThemeSettingsUpdate.FloatValue(
|
|
|
|
|
+ ThemeFloatSetting.BaseCardBorderWidth,
|
|
|
|
|
+ defaultTheme.baseCardBorderWidth
|
|
|
|
|
+ ),
|
|
|
|
|
+ ThemeSettingsUpdate.StringValue(
|
|
|
|
|
+ ThemeStringSetting.BookInfoNetworkCoverBackground,
|
|
|
|
|
+ defaultTheme.bookInfoNetworkCoverBackground
|
|
|
|
|
+ ),
|
|
|
|
|
+ ThemeSettingsUpdate.StringValue(
|
|
|
|
|
+ ThemeStringSetting.BookInfoDefaultCoverBackground,
|
|
|
|
|
+ defaultTheme.bookInfoDefaultCoverBackground
|
|
|
|
|
+ ),
|
|
|
|
|
+ ThemeSettingsUpdate.StringValue(ThemeStringSetting.BackgroundImageLight, null),
|
|
|
|
|
+ ThemeSettingsUpdate.StringValue(ThemeStringSetting.BackgroundImageDark, null),
|
|
|
|
|
+ ThemeSettingsUpdate.StringValue(
|
|
|
|
|
+ ThemeStringSetting.EyeProtectionStartTime,
|
|
|
|
|
+ defaultTheme.eyeProtectionStartTime
|
|
|
|
|
+ ),
|
|
|
|
|
+ ThemeSettingsUpdate.StringValue(
|
|
|
|
|
+ ThemeStringSetting.EyeProtectionEndTime,
|
|
|
|
|
+ defaultTheme.eyeProtectionEndTime
|
|
|
|
|
+ ),
|
|
|
|
|
+ ThemeSettingsUpdate.StringValue(ThemeStringSetting.CustomTagColorsJson, null),
|
|
|
|
|
+ )
|
|
|
|
|
+ )
|
|
|
|
|
+ _effects.tryEmit(ThemeConfigEffect.ApplyDayNight)
|
|
|
|
|
+ _effects.tryEmit(ThemeConfigEffect.NotifyMain)
|
|
|
|
|
+ _effects.tryEmit(ThemeConfigEffect.ChangeLauncherIcon(defaultShell.launcherIcon))
|
|
|
|
|
+ _effects.tryEmit(ThemeConfigEffect.ShowToast(R.string.theme_config_reset_success))
|
|
|
|
|
+ _uiState.update { it.copy(activeDialog = null) }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
private fun selectTheme(value: String) {
|
|
private fun selectTheme(value: String) {
|
|
|
val theme = _uiState.value.theme
|
|
val theme = _uiState.value.theme
|
|
|
if (value == "13" &&
|
|
if (value == "13" &&
|