Added AMOLED dark mode setting

Reverted lazy column back to column due to stutter
This commit is contained in:
Anthonyy232 committed 2024-07-22 18:25:02 -07:00
1 parent 48a730e4a9
commit 5fd233e790
13 files changed
+341 -212

No files matched your search

@@ -6,6 +6,7 @@ package com.anthonyla.paperize.core
object SettingsConstants {
const val SETTINGS_DATASTORE = "settings_datastore"
const val DARK_MODE_TYPE = "dark_mode_type"
const val AMOLED_THEME_TYPE = "amoled_theme_type"
const val DYNAMIC_THEME_TYPE = "dynamic_theme_type"
const val ANIMATE_TYPE = "animate_type"
const val ENABLE_CHANGER = "enable_changer"
@@ -117,7 +117,7 @@ class MainActivity : ComponentActivity() {
}
}
PaperizeTheme(settingsState.value.darkMode, settingsState.value.dynamicTheming) {
PaperizeTheme(settingsState.value.darkMode, settingsState.value.amoledTheme, settingsState.value.dynamicTheming) {
Surface(tonalElevation = 5.dp) {
PaperizeApp(isFirstLaunch, scheduler, topInset)
}
@@ -707,6 +707,9 @@ fun PaperizeApp(
onDarkModeClick = {
settingsViewModel.onEvent(SettingsEvent.SetDarkMode(it))
},
onAmoledClick = {
settingsViewModel.onEvent(SettingsEvent.SetAmoledTheme(it))
},
onDynamicThemingClick = {
settingsViewModel.onEvent(SettingsEvent.SetDynamicTheming(it))
},
@@ -9,6 +9,7 @@ sealed class SettingsEvent {
data object SetFirstLaunch: SettingsEvent()
data object RefreshNextSetTime: SettingsEvent()
data class SetDarkMode(val darkMode: Boolean?): SettingsEvent()
data class SetAmoledTheme(val amoledTheme: Boolean): SettingsEvent()
data class SetDynamicTheming(val dynamicTheming: Boolean): SettingsEvent()
data class SetAnimate(val animate: Boolean): SettingsEvent()
data class SetDarken(val darken: Boolean): SettingsEvent()
@@ -22,6 +22,7 @@ fun SettingsScreen(
topInsets: Dp,
onBackClick: () -> Unit,
onDarkModeClick: (Boolean?) -> Unit,
onAmoledClick: (Boolean) -> Unit,
onDynamicThemingClick: (Boolean) -> Unit,
onAnimateClick: (Boolean) -> Unit,
onPrivacyClick: () -> Unit,
@@ -39,12 +40,13 @@ fun SettingsScreen(
largeTopAppBarHeightPx = largeTopAppBarHeight,
scroll = scroll,
onDarkModeClick = onDarkModeClick,
onAmoledClick = onAmoledClick,
onDynamicThemingClick = onDynamicThemingClick,
onAnimateClick = onAnimateClick,
onPrivacyClick = onPrivacyClick,
onLicenseClick = onLicenseClick,
onResetClick = onResetClick,
onBackClick = onBackClick,
onBackClick = onBackClick
)
SettingsTitle(
scroll = scroll,
@@ -6,6 +6,7 @@ data class SettingsState(
val firstLaunch: Boolean = true,
// App settings
val darkMode: Boolean? = null,
val amoledTheme: Boolean = false,
val dynamicTheming: Boolean = false,
val animate: Boolean = true,
// Wallpaper settings
@@ -36,6 +36,7 @@ class SettingsViewModel @Inject constructor (
currentGetJob = viewModelScope.launch(Dispatchers.IO) {
val firstLaunch = async { settingsDataStoreImpl.getBoolean(SettingsConstants.FIRST_LAUNCH) ?: true }
val darkMode = async { settingsDataStoreImpl.getBoolean(SettingsConstants.DARK_MODE_TYPE) }
val amoledTheme = async { settingsDataStoreImpl.getBoolean(SettingsConstants.AMOLED_THEME_TYPE) ?: false }
val dynamicTheming = async { settingsDataStoreImpl.getBoolean(SettingsConstants.DYNAMIC_THEME_TYPE) ?: false }
val enableChanger = async { settingsDataStoreImpl.getBoolean(SettingsConstants.ENABLE_CHANGER) ?: true }
val setHomeWallpaper = async { settingsDataStoreImpl.getBoolean(SettingsConstants.HOME_WALLPAPER) ?: false }
@@ -55,6 +56,7 @@ class SettingsViewModel @Inject constructor (
_state.update {
it.copy(
darkMode = darkMode.await(),
amoledTheme = amoledTheme.await(),
dynamicTheming = dynamicTheming.await(),
homeInterval = homeWallpaperInterval.await(),
lockInterval = lockWallpaperInterval.await(),
@@ -104,6 +106,7 @@ class SettingsViewModel @Inject constructor (
is SettingsEvent.Refresh -> {
currentGetJob = viewModelScope.launch(Dispatchers.IO) {
val darkMode = async { settingsDataStoreImpl.getBoolean(SettingsConstants.DARK_MODE_TYPE) }
val amoledTheme = async { settingsDataStoreImpl.getBoolean(SettingsConstants.AMOLED_THEME_TYPE) ?: false }
val dynamicTheming = async { settingsDataStoreImpl.getBoolean(SettingsConstants.DYNAMIC_THEME_TYPE) ?: false }
val firstLaunch = async { settingsDataStoreImpl.getBoolean(SettingsConstants.FIRST_LAUNCH) ?: true }
val lastSetTime = async { settingsDataStoreImpl.getString(SettingsConstants.LAST_SET_TIME) }
@@ -122,6 +125,7 @@ class SettingsViewModel @Inject constructor (
_state.update {
it.copy(
darkMode = darkMode.await(),
amoledTheme = amoledTheme.await(),
dynamicTheming = dynamicTheming.await(),
firstLaunch = firstLaunch.await(),
lastSetTime = lastSetTime.await(),
@@ -157,11 +161,30 @@ class SettingsViewModel @Inject constructor (
}
}
is SettingsEvent.SetAmoledTheme -> {
viewModelScope.launch(Dispatchers.IO) {
settingsDataStoreImpl.putBoolean(SettingsConstants.AMOLED_THEME_TYPE, event.amoledTheme)
if (event.amoledTheme) {
settingsDataStoreImpl.putBoolean(SettingsConstants.DYNAMIC_THEME_TYPE, false)
}
_state.update {
it.copy(
amoledTheme = event.amoledTheme,
dynamicTheming = if (event.amoledTheme) false else it.dynamicTheming
)
}
}
}
is SettingsEvent.SetDynamicTheming -> {
viewModelScope.launch(Dispatchers.IO) {
settingsDataStoreImpl.putBoolean(SettingsConstants.DYNAMIC_THEME_TYPE, event.dynamicTheming)
if (event.dynamicTheming) {
settingsDataStoreImpl.putBoolean(SettingsConstants.AMOLED_THEME_TYPE, false)
}
_state.update {
it.copy(
amoledTheme = if (event.dynamicTheming) false else it.amoledTheme,
dynamicTheming = event.dynamicTheming
)
}
@@ -354,6 +377,7 @@ class SettingsViewModel @Inject constructor (
is SettingsEvent.Reset -> {
viewModelScope.launch(Dispatchers.IO) {
settingsDataStoreImpl.deleteBoolean(SettingsConstants.DARK_MODE_TYPE)
settingsDataStoreImpl.deleteBoolean(SettingsConstants.AMOLED_THEME_TYPE)
settingsDataStoreImpl.deleteBoolean(SettingsConstants.DYNAMIC_THEME_TYPE)
settingsDataStoreImpl.deleteBoolean(SettingsConstants.FIRST_LAUNCH)
settingsDataStoreImpl.deleteString(SettingsConstants.LAST_SET_TIME)
@@ -377,6 +401,7 @@ class SettingsViewModel @Inject constructor (
_state.update {
it.copy(
darkMode = null,
amoledTheme = false,
dynamicTheming = false,
firstLaunch = true,
lastSetTime = null,
@@ -0,0 +1,61 @@
package com.anthonyla.paperize.feature.wallpaper.presentation.settings_screen.components
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.DarkMode
import androidx.compose.material3.Icon
import androidx.compose.material3.ListItem
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Switch
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.semantics.contentDescription
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.unit.dp
import com.anthonyla.paperize.R
/**
* AMOLED list item to enable AMOLED mode
*/
@Composable
fun AmoledListItem(amoledMode: Boolean, onAmoledClick: (Boolean) -> Unit) {
val context = LocalContext.current
Row {
ListItem(
modifier = Modifier
.clip(RoundedCornerShape(16.dp))
.clickable { onAmoledClick(!amoledMode) },
headlineContent = {
Text(
text = stringResource(R.string.amoled_mode),
style = MaterialTheme.typography.titleMedium
) },
supportingContent = {
Text(
text = stringResource(R.string.full_dark_mode),
style = MaterialTheme.typography.bodySmall
) },
trailingContent = {
Switch(
modifier = Modifier.semantics { contentDescription = context.getString(R.string.amoled_mode) },
checked = amoledMode,
onCheckedChange = onAmoledClick,
enabled = true
) },
leadingContent = {
Icon(
Icons.Filled.DarkMode,
contentDescription = stringResource(R.string.amoled_mode),
tint = MaterialTheme.colorScheme.primary
) },
tonalElevation = 5.dp
)
}
}
@@ -15,7 +15,6 @@ import androidx.compose.material.icons.outlined.Brightness6
import androidx.compose.material.icons.outlined.BrightnessAuto
import androidx.compose.material.icons.outlined.DarkMode
import androidx.compose.material.icons.outlined.LightMode
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
import androidx.compose.material3.ListItem
import androidx.compose.material3.MaterialTheme
@@ -38,7 +37,6 @@ import com.anthonyla.paperize.R
/**
* Three-state selector for dark mode in settings
*/
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun DarkModeListItem(darkMode: Boolean?, onDarkModeClick: (Boolean?) -> Unit) {
val options = listOf(
@@ -77,7 +75,7 @@ fun DarkModeListItem(darkMode: Boolean?, onDarkModeClick: (Boolean?) -> Unit) {
},
headlineContent = {
Text(
text = stringResource(R.string.dark_mode),
text = stringResource(R.string.theme),
style = MaterialTheme.typography.titleMedium
) },
@@ -1,5 +1,6 @@
package com.anthonyla.paperize.feature.wallpaper.presentation.settings_screen.components
import android.annotation.SuppressLint
import android.content.Intent
import android.net.Uri
import androidx.compose.foundation.ScrollState
@@ -47,6 +48,7 @@ import kotlinx.coroutines.launch
/**
* Scrollable settings screen to wrap all settings components
*/
@SuppressLint("UnusedMaterial3ScaffoldPaddingParameter")
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun SettingsScrollableSettings(
@@ -55,11 +57,12 @@ fun SettingsScrollableSettings(
scroll: ScrollState,
onDynamicThemingClick: (Boolean) -> Unit,
onDarkModeClick: (Boolean?) -> Unit,
onAmoledClick: (Boolean) -> Unit,
onAnimateClick: (Boolean) -> Unit,
onPrivacyClick: () -> Unit,
onLicenseClick: () -> Unit,
onResetClick: () -> Unit,
onBackClick: () -> Unit
onBackClick: () -> Unit,
) {
val state = settingsState.collectAsStateWithLifecycle()
val context = LocalContext.current
@@ -108,7 +111,7 @@ fun SettingsScrollableSettings(
)
},
modifier = Modifier.fillMaxSize(),
content = { it
content = {
Column(
horizontalAlignment = Alignment.Start,
verticalArrangement = Arrangement.Top,
@@ -127,11 +130,17 @@ fun SettingsScrollableSettings(
onDarkModeClick = { onDarkModeClick(it) }
)
Spacer(modifier = Modifier.height(16.dp))
if (state.value.darkMode == null || state.value.darkMode == true) {
AmoledListItem(
amoledMode = state.value.amoledTheme,
onAmoledClick = { onAmoledClick(it) }
)
Spacer(modifier = Modifier.height(16.dp))
}
DynamicThemingListItem(
dynamicTheming = state.value.dynamicTheming,
onDynamicThemingClick = { onDynamicThemingClick(it) }
)
Spacer(modifier = Modifier.height(16.dp))
AnimationListItem(
animate = state.value.animate,
@@ -10,6 +10,7 @@ import androidx.compose.material3.dynamicLightColorScheme
import androidx.compose.material3.lightColorScheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.SideEffect
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalView
import androidx.core.view.WindowCompat
@@ -80,6 +81,38 @@ private val DarkColors = darkColorScheme(
scrim = md_theme_dark_scrim,
)
private val AmoledDarkColors = darkColorScheme(
primary = md_theme_light_primary,
onPrimary = md_theme_light_onPrimary,
primaryContainer = md_theme_light_primaryContainer,
onPrimaryContainer = md_theme_light_onPrimaryContainer,
secondary = Color.Black,
onSecondary = Color.White,
secondaryContainer = Color.Black,
onSecondaryContainer = Color.White,
tertiary = md_theme_light_tertiary,
onTertiary = md_theme_light_onTertiary,
tertiaryContainer = Color.Black,
onTertiaryContainer = Color.White,
error = Color.Red,
errorContainer = Color.Black,
onError = Color.White,
onErrorContainer = Color.Black,
background = Color.Black,
onBackground = Color.White,
surface = Color.Black,
onSurface = Color.White,
surfaceVariant = Color.Black,
onSurfaceVariant = Color.White,
outline = Color.White,
inverseOnSurface = Color.Black,
inverseSurface = Color.White,
inversePrimary = Color.White,
surfaceTint = Color.Black,
outlineVariant = md_theme_dark_outlineVariant,
scrim = md_theme_dark_scrim,
)
/**
* App theming for dynamic theming when supported and dark mode.
@@ -87,6 +120,7 @@ private val DarkColors = darkColorScheme(
@Composable
fun PaperizeTheme(
darkMode: Boolean?,
amoledMode: Boolean,
dynamicTheming: Boolean,
content: @Composable () -> Unit
) {
@@ -97,7 +131,8 @@ fun PaperizeTheme(
val colors = when {
isDynamicTheming && dynamicThemingSupported && isDarkMode -> dynamicDarkColorScheme(context)
isDynamicTheming && dynamicThemingSupported && !isDarkMode -> dynamicLightColorScheme(context)
isDarkMode -> DarkColors
isDarkMode && amoledMode -> AmoledDarkColors
isDarkMode && !amoledMode -> DarkColors
else -> LightColors
}
@@ -9,11 +9,13 @@ import android.provider.Settings
import androidx.compose.animation.AnimatedVisibility
import androidx.compose.animation.fadeOut
import androidx.compose.animation.slideInVertically
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Snackbar
import androidx.compose.material3.SnackbarDuration
@@ -80,6 +82,7 @@ fun WallpaperScreen(
onBlurChange: (Boolean) -> Unit,
blurPercentage: Int
) {
val scrollState = rememberScrollState()
val context = LocalContext.current
var openBottomSheet by rememberSaveable { mutableStateOf(false) }
val scope = rememberCoroutineScope()
@@ -107,124 +110,100 @@ fun WallpaperScreen(
) },
modifier = Modifier.fillMaxSize(),
content = { padding ->
LazyColumn(
Column(
modifier = Modifier
.verticalScroll(scrollState)
.fillMaxSize()
.padding(8.dp),
horizontalAlignment = Alignment.CenterHorizontally
) {
item {
ChangerSelectionRow(
homeEnabled = homeEnabled,
lockEnabled = lockEnabled,
onHomeCheckedChange = onHomeCheckedChange,
onLockCheckedChange = onLockCheckedChange
ChangerSelectionRow(
homeEnabled = homeEnabled,
lockEnabled = lockEnabled,
onHomeCheckedChange = onHomeCheckedChange,
onLockCheckedChange = onLockCheckedChange
)
if (homeEnabled || lockEnabled) {
CurrentSelectedAlbum(
selectedAlbum = selectedAlbum,
onOpenBottomSheet = {
if (albums.firstOrNull() != null) {
if (isLiveWallpaperSet(context)) {
openLiveDialog.value = true
} else {
openBottomSheet = true
}
} else {
scope.launch {
snackbarHostState.currentSnackbarData?.dismiss()
snackbarHostState.showSnackbar(
message = context.getString(R.string.no_albums_found),
actionLabel = context.getString(R.string.dismiss),
duration = SnackbarDuration.Short
)
}
}
},
onStop = {
if (selectedAlbum != null) {
scope.launch {
snackbarHostState.currentSnackbarData?.dismiss()
snackbarHostState.showSnackbar(
message = context.getString(
R.string.has_been_unselected,
selectedAlbum.album.displayedAlbumName
),
actionLabel = context.getString(R.string.dismiss),
duration = SnackbarDuration.Short
)
}
onStop()
}
},
animate = animate,
enableChanger = enableChanger,
onToggleChanger = {
if (!it) {
scope.launch {
snackbarHostState.currentSnackbarData?.dismiss()
snackbarHostState.showSnackbar(
message = context.getString(R.string.wallpaper_changer_has_been_disabled),
actionLabel = context.getString(R.string.dismiss),
duration = SnackbarDuration.Short
)
}
}
onToggleChanger(it)
}
)
}
item {
if (homeEnabled || lockEnabled) {
CurrentSelectedAlbum(
selectedAlbum = selectedAlbum,
onOpenBottomSheet = {
if (albums.firstOrNull() != null) {
if (isLiveWallpaperSet(context)) {
openLiveDialog.value = true
} else {
openBottomSheet = true
}
} else {
scope.launch {
snackbarHostState.currentSnackbarData?.dismiss()
snackbarHostState.showSnackbar(
message = context.getString(R.string.no_albums_found),
actionLabel = context.getString(R.string.dismiss),
duration = SnackbarDuration.Short
)
}
}
},
onStop = {
if (selectedAlbum != null) {
scope.launch {
snackbarHostState.currentSnackbarData?.dismiss()
snackbarHostState.showSnackbar(
message = context.getString(
R.string.has_been_unselected,
selectedAlbum.album.displayedAlbumName
),
actionLabel = context.getString(R.string.dismiss),
duration = SnackbarDuration.Short
)
}
onStop()
}
},
animate = animate,
enableChanger = enableChanger,
onToggleChanger = {
if (!it) {
scope.launch {
snackbarHostState.currentSnackbarData?.dismiss()
snackbarHostState.showSnackbar(
message = context.getString(R.string.wallpaper_changer_has_been_disabled),
actionLabel = context.getString(R.string.dismiss),
duration = SnackbarDuration.Short
)
}
}
onToggleChanger(it)
}
)
}
}
item {
if (animate) {
AnimatedVisibility(
visible = ((homeEnabled || lockEnabled)) && selectedAlbum != null,
enter = slideInVertically(initialOffsetY = { -it }),
exit = fadeOut()
) {
if (((homeEnabled || lockEnabled)) && selectedAlbum != null) {
CurrentAndNextChange(lastSetTime, nextSetTime)
}
}
}
else {
if (animate) {
AnimatedVisibility(
visible = ((homeEnabled || lockEnabled)) && selectedAlbum != null,
enter = slideInVertically(initialOffsetY = { -it }),
exit = fadeOut()
) {
if (((homeEnabled || lockEnabled)) && selectedAlbum != null) {
CurrentAndNextChange(lastSetTime, nextSetTime)
}
}
}
item {
if (animate) {
AnimatedVisibility(
visible = ((homeEnabled || lockEnabled)) && selectedAlbum != null,
enter = slideInVertically(initialOffsetY = { -it }),
exit = fadeOut()
) {
if (((homeEnabled || lockEnabled)) && selectedAlbum != null) {
WallpaperPreviewAndScale(
currentHomeWallpaper = selectedAlbum.album.currentHomeWallpaper,
currentLockWallpaper = selectedAlbum.album.currentLockWallpaper,
animate = true,
darken = darken,
darkenPercentage = darkenPercentage,
scaling = scaling,
onScalingChange = onScalingChange,
homeEnabled = homeEnabled,
lockEnabled = lockEnabled,
blur = blur,
blurPercentage = blurPercentage
)
}
}
else {
if (((homeEnabled || lockEnabled)) && selectedAlbum != null) {
CurrentAndNextChange(lastSetTime, nextSetTime)
}
else {
}
if (animate) {
AnimatedVisibility(
visible = ((homeEnabled || lockEnabled)) && selectedAlbum != null,
enter = slideInVertically(initialOffsetY = { -it }),
exit = fadeOut()
) {
if (((homeEnabled || lockEnabled)) && selectedAlbum != null) {
WallpaperPreviewAndScale(
currentHomeWallpaper = selectedAlbum.album.currentHomeWallpaper,
currentLockWallpaper = selectedAlbum.album.currentLockWallpaper,
animate = false,
animate = true,
darken = darken,
darkenPercentage = darkenPercentage,
scaling = scaling,
@@ -237,112 +216,123 @@ fun WallpaperScreen(
}
}
}
item {
if (animate) {
AnimatedVisibility(
visible = ((homeEnabled || lockEnabled)) && selectedAlbum != null,
enter = slideInVertically(initialOffsetY = { -it }),
exit = fadeOut()
) {
TimeSliders(
timeInMinutes1 = interval1,
timeInMinutes2 = interval2,
onTimeChange1 = { days, hours, minutes ->
val totalMinutes = 24 * days * 60 + hours * 60 + minutes
onTimeChange1(totalMinutes)
},
onTimeChange2 = { days, hours, minutes ->
val totalMinutes = 24 * days * 60 + hours * 60 + minutes
onTimeChange2(totalMinutes)
},
showInterval = showInterval.value,
animate = true,
onShowIntervalChange = { showInterval.value = it },
scheduleSeparately = scheduleSeparately,
onScheduleSeparatelyChange = onScheduleSeparatelyChange,
lockEnabled = lockEnabled,
homeEnabled = homeEnabled
)
}
}
else {
if (((homeEnabled || lockEnabled)) && selectedAlbum != null) {
TimeSliders(
timeInMinutes1 = interval1,
timeInMinutes2 = interval2,
onTimeChange1 = { days, hours, minutes ->
val totalMinutes = 24 * days * 60 + hours * 60 + minutes
onScheduleWallpaperChanger1(totalMinutes)
},
onTimeChange2 = { days, hours, minutes ->
val totalMinutes = 24 * days * 60 + hours * 60 + minutes
onScheduleWallpaperChanger2(totalMinutes)
},
showInterval = showInterval.value,
animate = false,
onShowIntervalChange = { showInterval.value = it },
scheduleSeparately = scheduleSeparately,
onScheduleSeparatelyChange = onScheduleSeparatelyChange,
lockEnabled = lockEnabled,
homeEnabled = homeEnabled,
)
}
else {
if (((homeEnabled || lockEnabled)) && selectedAlbum != null) {
WallpaperPreviewAndScale(
currentHomeWallpaper = selectedAlbum.album.currentHomeWallpaper,
currentLockWallpaper = selectedAlbum.album.currentLockWallpaper,
animate = false,
darken = darken,
darkenPercentage = darkenPercentage,
scaling = scaling,
onScalingChange = onScalingChange,
homeEnabled = homeEnabled,
lockEnabled = lockEnabled,
blur = blur,
blurPercentage = blurPercentage
)
}
}
item {
if (animate) {
AnimatedVisibility(
visible = ((homeEnabled || lockEnabled)) && selectedAlbum != null,
enter = slideInVertically(initialOffsetY = { -it }),
exit = fadeOut()
) {
DarkenSwitchAndSlider(
onDarkCheck = onDarkCheck,
darken = darken,
onDarkenChange = onDarkenPercentage,
darkenPercentage = darkenPercentage,
animate = true
)
}
}
else {
if (((homeEnabled || lockEnabled)) && selectedAlbum != null) {
DarkenSwitchAndSlider(
onDarkCheck = onDarkCheck,
darken = darken,
onDarkenChange = onDarkenPercentage,
darkenPercentage = darkenPercentage,
animate = false
)
}
if (animate) {
AnimatedVisibility(
visible = ((homeEnabled || lockEnabled)) && selectedAlbum != null,
enter = slideInVertically(initialOffsetY = { -it }),
exit = fadeOut()
) {
TimeSliders(
timeInMinutes1 = interval1,
timeInMinutes2 = interval2,
onTimeChange1 = { days, hours, minutes ->
val totalMinutes = 24 * days * 60 + hours * 60 + minutes
onTimeChange1(totalMinutes)
},
onTimeChange2 = { days, hours, minutes ->
val totalMinutes = 24 * days * 60 + hours * 60 + minutes
onTimeChange2(totalMinutes)
},
showInterval = showInterval.value,
animate = true,
onShowIntervalChange = { showInterval.value = it },
scheduleSeparately = scheduleSeparately,
onScheduleSeparatelyChange = onScheduleSeparatelyChange,
lockEnabled = lockEnabled,
homeEnabled = homeEnabled
)
}
}
item {
if (animate) {
AnimatedVisibility(
visible = ((homeEnabled || lockEnabled)) && selectedAlbum != null,
enter = slideInVertically(initialOffsetY = { -it }),
exit = fadeOut()
) {
BlurSwitchAndSlider(
onBlurPercentageChange = onBlurPercentageChange,
onBlurChange = onBlurChange,
blur = blur,
blurPercentage = blurPercentage,
animate = true
)
}
else {
if (((homeEnabled || lockEnabled)) && selectedAlbum != null) {
TimeSliders(
timeInMinutes1 = interval1,
timeInMinutes2 = interval2,
onTimeChange1 = { days, hours, minutes ->
val totalMinutes = 24 * days * 60 + hours * 60 + minutes
onScheduleWallpaperChanger1(totalMinutes)
},
onTimeChange2 = { days, hours, minutes ->
val totalMinutes = 24 * days * 60 + hours * 60 + minutes
onScheduleWallpaperChanger2(totalMinutes)
},
showInterval = showInterval.value,
animate = false,
onShowIntervalChange = { showInterval.value = it },
scheduleSeparately = scheduleSeparately,
onScheduleSeparatelyChange = onScheduleSeparatelyChange,
lockEnabled = lockEnabled,
homeEnabled = homeEnabled,
)
}
else {
if (((homeEnabled || lockEnabled)) && selectedAlbum != null) {
BlurSwitchAndSlider(
onBlurPercentageChange = onBlurPercentageChange,
onBlurChange = onBlurChange,
blur = blur,
blurPercentage = blurPercentage,
animate = false
)
}
}
if (animate) {
AnimatedVisibility(
visible = ((homeEnabled || lockEnabled)) && selectedAlbum != null,
enter = slideInVertically(initialOffsetY = { -it }),
exit = fadeOut()
) {
DarkenSwitchAndSlider(
onDarkCheck = onDarkCheck,
darken = darken,
onDarkenChange = onDarkenPercentage,
darkenPercentage = darkenPercentage,
animate = true
)
}
}
else {
if (((homeEnabled || lockEnabled)) && selectedAlbum != null) {
DarkenSwitchAndSlider(
onDarkCheck = onDarkCheck,
darken = darken,
onDarkenChange = onDarkenPercentage,
darkenPercentage = darkenPercentage,
animate = false
)
}
}
if (animate) {
AnimatedVisibility(
visible = ((homeEnabled || lockEnabled)) && selectedAlbum != null,
enter = slideInVertically(initialOffsetY = { -it }),
exit = fadeOut()
) {
BlurSwitchAndSlider(
onBlurPercentageChange = onBlurPercentageChange,
onBlurChange = onBlurChange,
blur = blur,
blurPercentage = blurPercentage,
animate = true
)
}
}
else {
if (((homeEnabled || lockEnabled)) && selectedAlbum != null) {
BlurSwitchAndSlider(
onBlurPercentageChange = onBlurPercentageChange,
onBlurChange = onBlurChange,
blur = blur,
blurPercentage = blurPercentage,
animate = false
)
}
}
}
+3
View File
@@ -153,4 +153,7 @@
<string name="delay_notice_dialog">Delay Notice</string>
<string name="to_minimize_battery_usage_changing_wallpapers_may_have_some_delays_once_scheduled_when_the_device_is_asleep_the_wallpaper_may_take_longer_to_apply">To minimize battery usage, changing wallpapers may have some delays once scheduled. When the device is asleep, the wallpaper may take longer to apply.</string>
<string name="change_wallpaper">Change wallpaper</string>
<string name="theme">Theme</string>
<string name="amoled_mode">AMOLED Mode</string>
<string name="full_dark_mode">Full dark mode</string>
</resources>