diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 0b60ed4..5dd028f 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -19,8 +19,8 @@ android { applicationId = "com.anthonyla.paperize" minSdk = 26 targetSdk = 34 - versionCode = 26 - versionName = "1.6.1" + versionCode = 27 + versionName = "1.6.2" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" vectorDrawables { useSupportLibrary = true diff --git a/app/src/main/java/com/anthonyla/paperize/feature/wallpaper/presentation/PaperizeApp.kt b/app/src/main/java/com/anthonyla/paperize/feature/wallpaper/presentation/PaperizeApp.kt index dba558e..d7904b8 100644 --- a/app/src/main/java/com/anthonyla/paperize/feature/wallpaper/presentation/PaperizeApp.kt +++ b/app/src/main/java/com/anthonyla/paperize/feature/wallpaper/presentation/PaperizeApp.kt @@ -559,7 +559,8 @@ fun PaperizeApp( }, onShowFolderView = { folderName, wallpapers -> navController.navigate(FolderView(folderName, wallpapers)) - } + }, + animate = settingsState.value.animate ) } // Navigate to wallpaper view screen to view individual wallpapers in full screen @@ -655,6 +656,7 @@ fun PaperizeApp( if (albumWithWallpaper != null) { AlbumViewScreen( album = albumWithWallpaper, + animate = settingsState.value.animate, onBackClick = { navController.navigateUp() }, onShowWallpaperView = { navController.navigate(WallpaperView(it)) diff --git a/app/src/main/java/com/anthonyla/paperize/feature/wallpaper/presentation/add_album_screen/AddAlbumScreen.kt b/app/src/main/java/com/anthonyla/paperize/feature/wallpaper/presentation/add_album_screen/AddAlbumScreen.kt index 4d56bc4..f58e91d 100644 --- a/app/src/main/java/com/anthonyla/paperize/feature/wallpaper/presentation/add_album_screen/AddAlbumScreen.kt +++ b/app/src/main/java/com/anthonyla/paperize/feature/wallpaper/presentation/add_album_screen/AddAlbumScreen.kt @@ -5,11 +5,8 @@ import android.net.Uri import androidx.activity.compose.BackHandler import androidx.activity.compose.rememberLauncherForActivityResult import androidx.activity.result.contract.ActivityResultContracts -import androidx.compose.animation.AnimatedVisibility import androidx.compose.animation.core.FastOutSlowInEasing import androidx.compose.animation.core.tween -import androidx.compose.animation.scaleIn -import androidx.compose.animation.scaleOut import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.fillMaxSize @@ -33,26 +30,21 @@ import com.anthonyla.paperize.feature.wallpaper.presentation.add_album_screen.co import com.anthonyla.paperize.feature.wallpaper.presentation.add_album_screen.components.AddAlbumSmallTopBar import com.anthonyla.paperize.feature.wallpaper.presentation.album.components.FolderItem import com.anthonyla.paperize.feature.wallpaper.presentation.album.components.WallpaperItem -import com.anthonyla.paperize.feature.wallpaper.presentation.settings_screen.SettingsViewModel @Composable fun AddAlbumScreen( addAlbumViewModel: AddAlbumViewModel = hiltViewModel(), - settingsViewModel: SettingsViewModel = hiltViewModel(), initialAlbumName: String, onBackClick: () -> Unit, onConfirmation: () -> Unit, onShowWallpaperView: (String) -> Unit, - onShowFolderView: (String?, List) -> Unit + onShowFolderView: (String?, List) -> Unit, + animate: Boolean ) { val context = LocalContext.current val lazyGridState = rememberLazyStaggeredGridState() val addAlbumState = addAlbumViewModel.state.collectAsStateWithLifecycle() - val settingsState = settingsViewModel.state.collectAsStateWithLifecycle() var selectionMode by rememberSaveable { mutableStateOf(false) } - if (addAlbumState.value.initialAlbumName.isEmpty()) { - addAlbumViewModel.onEvent(AddAlbumEvent.SetAlbumName(initialAlbumName)) - } var showSpotlight by rememberSaveable { mutableStateOf(false) } BackHandler( @@ -126,40 +118,17 @@ fun AddAlbumScreen( ) }, floatingActionButton = { - if (settingsState.value.animate) { - AnimatedVisibility( - visible = !lazyGridState.isScrollInProgress || lazyGridState.firstVisibleItemScrollOffset < 0, - enter = scaleIn(tween(400, 50, FastOutSlowInEasing)), - exit = scaleOut(tween(400, 50, FastOutSlowInEasing)), - ) { - AddAlbumAnimatedFab( - onImageClick = { - selectionMode = false - imagePickerLauncher.launch(arrayOf("image/*")) - }, - onFolderClick = { - selectionMode = false - folderPickerLauncher.launch(null) - }, - animate = true - ) - } - } - else { - AddAlbumAnimatedFab( - onImageClick = { - selectionMode = false - imagePickerLauncher.launch(arrayOf("image/*")) - showSpotlight = true - }, - onFolderClick = { - selectionMode = false - folderPickerLauncher.launch(null) - showSpotlight = true - }, - animate = false - ) - } + AddAlbumAnimatedFab( + onImageClick = { + selectionMode = false + imagePickerLauncher.launch(arrayOf("image/*")) + }, + onFolderClick = { + selectionMode = false + folderPickerLauncher.launch(null) + }, + animate = animate + ) }, content = { LazyVerticalStaggeredGrid( @@ -225,7 +194,7 @@ fun AddAlbumScreen( easing = FastOutSlowInEasing ), ), - animate = settingsState.value.animate + animate = animate ) } } diff --git a/app/src/main/java/com/anthonyla/paperize/feature/wallpaper/presentation/album/components/AlbumItem.kt b/app/src/main/java/com/anthonyla/paperize/feature/wallpaper/presentation/album/components/AlbumItem.kt index 4eeeb08..5907acc 100644 --- a/app/src/main/java/com/anthonyla/paperize/feature/wallpaper/presentation/album/components/AlbumItem.kt +++ b/app/src/main/java/com/anthonyla/paperize/feature/wallpaper/presentation/album/components/AlbumItem.kt @@ -15,6 +15,9 @@ import androidx.compose.material3.CircularProgressIndicator import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip @@ -38,6 +41,7 @@ fun AlbumItem( modifier: Modifier = Modifier, animate: Boolean = true ) { + val context = LocalContext.current fun isValidUri(context: Context, uriString: String?): Boolean { val uri = uriString?.toUri() return try { @@ -48,8 +52,7 @@ fun AlbumItem( true } catch (e: Exception) { false } } - - val showCoverUri = album.coverUri != null && isValidUri(LocalContext.current, album.coverUri) + val showCoverUri by remember { mutableStateOf(album.coverUri != null && isValidUri(context, album.coverUri)) } Card( colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.surfaceVariant), @@ -70,7 +73,7 @@ fun AlbumItem( imageOptions = ImageOptions( contentScale = ContentScale.Crop, alignment = Alignment.Center, - requestSize = IntSize(300, 300), + requestSize = IntSize(250, 250), ), loading = { if (animate) { diff --git a/app/src/main/java/com/anthonyla/paperize/feature/wallpaper/presentation/album/components/FolderItem.kt b/app/src/main/java/com/anthonyla/paperize/feature/wallpaper/presentation/album/components/FolderItem.kt index 4730c03..368cb1b 100644 --- a/app/src/main/java/com/anthonyla/paperize/feature/wallpaper/presentation/album/components/FolderItem.kt +++ b/app/src/main/java/com/anthonyla/paperize/feature/wallpaper/presentation/album/components/FolderItem.kt @@ -28,13 +28,14 @@ import androidx.compose.material3.Text import androidx.compose.material3.surfaceColorAtElevation import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.graphics.Color import androidx.compose.ui.hapticfeedback.HapticFeedbackType import androidx.compose.ui.layout.ContentScale -import androidx.compose.ui.platform.LocalConfiguration import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalHapticFeedback import androidx.compose.ui.res.stringResource @@ -62,7 +63,7 @@ fun FolderItem( modifier: Modifier = Modifier, animate: Boolean = true ) { - val configuration = LocalConfiguration.current + val context = LocalContext.current val haptics = LocalHapticFeedback.current val transition = updateTransition(itemSelected, label = "") @@ -84,8 +85,7 @@ fun FolderItem( true } catch (e: Exception) { false } } - - val showCoverUri = folder.coverUri != null && isValidUri(LocalContext.current, folder.coverUri) + val showCoverUri by remember { mutableStateOf(folder.coverUri != null && isValidUri(context, folder.coverUri)) } Card( colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.surfaceVariant), @@ -122,7 +122,7 @@ fun FolderItem( imageOptions = ImageOptions( contentScale = ContentScale.Crop, alignment = Alignment.Center, - requestSize = IntSize(300, 300), + requestSize = IntSize(250, 250), ), loading = { if (animate) { diff --git a/app/src/main/java/com/anthonyla/paperize/feature/wallpaper/presentation/album/components/WallpaperItem.kt b/app/src/main/java/com/anthonyla/paperize/feature/wallpaper/presentation/album/components/WallpaperItem.kt index e93b993..d62a270 100644 --- a/app/src/main/java/com/anthonyla/paperize/feature/wallpaper/presentation/album/components/WallpaperItem.kt +++ b/app/src/main/java/com/anthonyla/paperize/feature/wallpaper/presentation/album/components/WallpaperItem.kt @@ -21,6 +21,8 @@ import androidx.compose.material3.MaterialTheme import androidx.compose.material3.surfaceColorAtElevation import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.blur @@ -40,8 +42,6 @@ import androidx.core.net.toUri import com.anthonyla.paperize.R import com.anthonyla.paperize.core.ScalingConstants import com.anthonyla.paperize.core.getImageDimensions -import com.bumptech.glide.Glide -import com.bumptech.glide.load.DecodeFormat import com.skydoves.landscapist.ImageOptions import com.skydoves.landscapist.glide.GlideImage @@ -88,8 +88,8 @@ fun WallpaperItem( true } catch (e: Exception) { false } } + val showUri by remember { mutableStateOf(isValidUri(context, wallpaperUri)) } - val showUri = isValidUri(LocalContext.current, wallpaperUri) val boxModifier = if (clickable) { modifier .padding(paddingTransition) @@ -115,6 +115,7 @@ fun WallpaperItem( .padding(paddingTransition) .clip(RoundedCornerShape(roundedCornerShapeTransition)) } + Box(modifier = boxModifier) { if (showUri) { val dimension = wallpaperUri.toUri().getImageDimensions(context) @@ -129,7 +130,7 @@ fun WallpaperItem( ScalingConstants.STRETCH -> ContentScale.FillBounds } } else { ContentScale.Crop }, - requestSize = IntSize(300, 300), + requestSize = IntSize(250, 250), alignment = Alignment.Center, colorFilter = if (darken && darkenPercentage != null && darkenPercentage < 100) { ColorFilter.tint( @@ -145,12 +146,6 @@ fun WallpaperItem( } } }, - requestBuilder = { - Glide - .with(LocalContext.current) - .asBitmap() - .format(DecodeFormat.PREFER_RGB_565) - }, modifier = Modifier .aspectRatio(imageAspectRatio) .background(if (scaling != null) Color.Black else Color.Transparent) diff --git a/app/src/main/java/com/anthonyla/paperize/feature/wallpaper/presentation/album_view_screen/AlbumViewScreen.kt b/app/src/main/java/com/anthonyla/paperize/feature/wallpaper/presentation/album_view_screen/AlbumViewScreen.kt index 1e5a5d1..45dc098 100644 --- a/app/src/main/java/com/anthonyla/paperize/feature/wallpaper/presentation/album_view_screen/AlbumViewScreen.kt +++ b/app/src/main/java/com/anthonyla/paperize/feature/wallpaper/presentation/album_view_screen/AlbumViewScreen.kt @@ -5,11 +5,8 @@ import android.net.Uri import androidx.activity.compose.BackHandler import androidx.activity.compose.rememberLauncherForActivityResult import androidx.activity.result.contract.ActivityResultContracts -import androidx.compose.animation.AnimatedVisibility import androidx.compose.animation.core.FastOutSlowInEasing import androidx.compose.animation.core.tween -import androidx.compose.animation.scaleIn -import androidx.compose.animation.scaleOut import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.fillMaxSize @@ -34,13 +31,12 @@ import com.anthonyla.paperize.feature.wallpaper.presentation.add_album_screen.co import com.anthonyla.paperize.feature.wallpaper.presentation.album.components.FolderItem import com.anthonyla.paperize.feature.wallpaper.presentation.album.components.WallpaperItem import com.anthonyla.paperize.feature.wallpaper.presentation.album_view_screen.components.AlbumViewTopBar -import com.anthonyla.paperize.feature.wallpaper.presentation.settings_screen.SettingsViewModel @Composable fun AlbumViewScreen( albumViewScreenViewModel: AlbumViewScreenViewModel = hiltViewModel(), - settingsViewModel: SettingsViewModel = hiltViewModel(), album: AlbumWithWallpaperAndFolder, + animate: Boolean, onBackClick: () -> Unit, onShowWallpaperView: (String) -> Unit, onShowFolderView: (String?, List) -> Unit, @@ -51,7 +47,6 @@ fun AlbumViewScreen( albumViewScreenViewModel.onEvent(AlbumViewEvent.SetSize(album.wallpapers.size + album.folders.size)) // For selectedAll state val lazyListState = rememberLazyStaggeredGridState() val albumState = albumViewScreenViewModel.state.collectAsStateWithLifecycle() - val settingsState = settingsViewModel.state.collectAsStateWithLifecycle() var selectionMode by rememberSaveable { mutableStateOf(false) } val context = LocalContext.current @@ -119,38 +114,17 @@ fun AlbumViewScreen( ) }, floatingActionButton = { - if (settingsState.value.animate) { - AnimatedVisibility( - visible = !lazyListState.isScrollInProgress || lazyListState.firstVisibleItemScrollOffset < 0, - enter = scaleIn(tween(400, 50, FastOutSlowInEasing)), - exit = scaleOut(tween(400, 50, FastOutSlowInEasing)), - ) { - AddAlbumAnimatedFab( - onImageClick = { - selectionMode = false - imagePickerLauncher.launch(arrayOf("image/*")) - }, - onFolderClick = { - selectionMode = false - folderPickerLauncher.launch(null) - }, - animate = true - ) - } - } - else { - AddAlbumAnimatedFab( - onImageClick = { - selectionMode = false - imagePickerLauncher.launch(arrayOf("image/*")) - }, - onFolderClick = { - selectionMode = false - folderPickerLauncher.launch(null) - }, - animate = false - ) - } + AddAlbumAnimatedFab( + onImageClick = { + selectionMode = false + imagePickerLauncher.launch(arrayOf("image/*")) + }, + onFolderClick = { + selectionMode = false + folderPickerLauncher.launch(null) + }, + animate = animate + ) }, content = { it -> LazyVerticalStaggeredGrid( @@ -164,7 +138,7 @@ fun AlbumViewScreen( content = { items (items = album.folders, key = { folder -> folder.folderUri } ) { folder -> - if (settingsState.value.animate) { + if (animate) { FolderItem( folder = folder, itemSelected = albumState.value.selectedFolders.contains(folder.folderUri), @@ -182,8 +156,10 @@ fun AlbumViewScreen( onFolderViewClick = { if (folder.wallpapers.isNotEmpty()) onShowFolderView(folder.folderName, folder.wallpapers) }, - modifier = Modifier.padding(4.dp).animateItem( - placementSpec = tween( + modifier = Modifier + .padding(4.dp) + .animateItem( + placementSpec = tween( durationMillis = 800, delayMillis = 0, easing = FastOutSlowInEasing @@ -217,7 +193,7 @@ fun AlbumViewScreen( } items (items = album.wallpapers, key = { wallpaper -> wallpaper.wallpaperUri } ) { wallpaper -> - if (settingsState.value.animate) { + if (animate) { WallpaperItem( wallpaperUri = wallpaper.wallpaperUri, itemSelected = albumState.value.selectedWallpapers.contains(wallpaper.wallpaperUri), diff --git a/app/src/main/java/com/anthonyla/paperize/feature/wallpaper/presentation/wallpaper_screen/WallpaperScreen.kt b/app/src/main/java/com/anthonyla/paperize/feature/wallpaper/presentation/wallpaper_screen/WallpaperScreen.kt index be98041..46f4865 100644 --- a/app/src/main/java/com/anthonyla/paperize/feature/wallpaper/presentation/wallpaper_screen/WallpaperScreen.kt +++ b/app/src/main/java/com/anthonyla/paperize/feature/wallpaper/presentation/wallpaper_screen/WallpaperScreen.kt @@ -9,13 +9,11 @@ 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.rememberScrollState +import androidx.compose.foundation.lazy.LazyColumn 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 @@ -88,7 +86,6 @@ fun WallpaperScreen( val snackbarHostState = remember { SnackbarHostState() } val openLiveDialog = rememberSaveable { mutableStateOf(false) } val showInterval = rememberSaveable { mutableStateOf(false) } - val scrollState = rememberScrollState() if (openLiveDialog.value) { ShowLiveWallpaperEnabledDialog( @@ -110,100 +107,124 @@ fun WallpaperScreen( ) }, modifier = Modifier.fillMaxSize(), content = { padding -> - Column( + LazyColumn( modifier = Modifier .fillMaxSize() - .padding(8.dp) - .verticalScroll(scrollState), + .padding(8.dp), horizontalAlignment = Alignment.CenterHorizontally ) { - 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 { + ChangerSelectionRow( + homeEnabled = homeEnabled, + lockEnabled = lockEnabled, + onHomeCheckedChange = onHomeCheckedChange, + onLockCheckedChange = onLockCheckedChange ) } - if (animate) { - AnimatedVisibility( - visible = ((homeEnabled || lockEnabled)) && selectedAlbum != null, - enter = slideInVertically(initialOffsetY = { -it }), - exit = fadeOut() - ) { + 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 (((homeEnabled || lockEnabled)) && selectedAlbum != null) { CurrentAndNextChange(lastSetTime, nextSetTime) } } } - else { - 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 + ) + } + } } - } - if (animate) { - AnimatedVisibility( - visible = ((homeEnabled || lockEnabled)) && selectedAlbum != null, - enter = slideInVertically(initialOffsetY = { -it }), - exit = fadeOut() - ) { + else { if (((homeEnabled || lockEnabled)) && selectedAlbum != null) { WallpaperPreviewAndScale( currentHomeWallpaper = selectedAlbum.album.currentHomeWallpaper, currentLockWallpaper = selectedAlbum.album.currentLockWallpaper, - animate = true, + animate = false, darken = darken, darkenPercentage = darkenPercentage, scaling = scaling, @@ -216,123 +237,112 @@ fun WallpaperScreen( } } } - 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() + ) { + 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, + ) + } } } - 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() + ) { + 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 + ) + } } } - 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, - ) + 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 + ) + } } - } - 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 - ) + else { + if (((homeEnabled || lockEnabled)) && selectedAlbum != null) { + BlurSwitchAndSlider( + onBlurPercentageChange = onBlurPercentageChange, + onBlurChange = onBlurChange, + blur = blur, + blurPercentage = blurPercentage, + animate = false + ) + } } } }