Updated dependencies
Updated Kotlin 1.9.22 Updated Compose compiler to 1.5.10 Refactored navigation and implemented type-safe navigation from navigation-compose:2.8.0-alpha08 Updated the version code to 1.1.0 Updated SetLockScreen component to show a fixed aspect ratio of 9:19.5 and disable clicking splash Updated FAB color due to dependencies update breaking visual design Added option to disable loading animation for images in the app Added option to disable grid change animation
This commit is contained in:
1 parent
f9207309a8
commit
1906a3f170
21 files changed
+439
-343
No files matched your search
Generated
+15
@@ -1,8 +1,23 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="AppInsightsSettings">
|
<component name="AppInsightsSettings">
|
||||||
|
<option name="selectedTabId" value="Android Vitals" />
|
||||||
<option name="tabSettings">
|
<option name="tabSettings">
|
||||||
<map>
|
<map>
|
||||||
|
<entry key="Android Vitals">
|
||||||
|
<value>
|
||||||
|
<InsightsFilterSettings>
|
||||||
|
<option name="connection">
|
||||||
|
<ConnectionSetting>
|
||||||
|
<option name="appId" value="com.anthonyla.paperize" />
|
||||||
|
</ConnectionSetting>
|
||||||
|
</option>
|
||||||
|
<option name="signal" value="SIGNAL_UNSPECIFIED" />
|
||||||
|
<option name="timeIntervalDays" value="SEVEN_DAYS" />
|
||||||
|
<option name="visibilityType" value="ALL" />
|
||||||
|
</InsightsFilterSettings>
|
||||||
|
</value>
|
||||||
|
</entry>
|
||||||
<entry key="Firebase Crashlytics">
|
<entry key="Firebase Crashlytics">
|
||||||
<value>
|
<value>
|
||||||
<InsightsFilterSettings>
|
<InsightsFilterSettings>
|
||||||
|
|||||||
Generated
+4
-1
@@ -1,6 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
|
<component name="Kotlin2JvmCompilerArguments">
|
||||||
|
<option name="jvmTarget" value="1.8" />
|
||||||
|
</component>
|
||||||
<component name="KotlinJpsPluginSettings">
|
<component name="KotlinJpsPluginSettings">
|
||||||
<option name="version" value="1.9.0" />
|
<option name="version" value="1.9.22" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
||||||
+23
-21
@@ -4,6 +4,7 @@ plugins {
|
|||||||
id("com.google.devtools.ksp")
|
id("com.google.devtools.ksp")
|
||||||
id("com.google.dagger.hilt.android")
|
id("com.google.dagger.hilt.android")
|
||||||
id ("com.mikepenz.aboutlibraries.plugin")
|
id ("com.mikepenz.aboutlibraries.plugin")
|
||||||
|
id ("org.jetbrains.kotlin.plugin.serialization")
|
||||||
}
|
}
|
||||||
ksp {
|
ksp {
|
||||||
arg("room.schemaLocation", "$projectDir/schemas")
|
arg("room.schemaLocation", "$projectDir/schemas")
|
||||||
@@ -16,8 +17,8 @@ android {
|
|||||||
applicationId = "com.anthonyla.paperize"
|
applicationId = "com.anthonyla.paperize"
|
||||||
minSdk = 26
|
minSdk = 26
|
||||||
targetSdk = 34
|
targetSdk = 34
|
||||||
versionCode = 2
|
versionCode = 3
|
||||||
versionName = "0.3.0"
|
versionName = "1.1.0"
|
||||||
|
|
||||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||||
vectorDrawables {
|
vectorDrawables {
|
||||||
@@ -47,7 +48,7 @@ android {
|
|||||||
viewBinding = true
|
viewBinding = true
|
||||||
}
|
}
|
||||||
composeOptions {
|
composeOptions {
|
||||||
kotlinCompilerExtensionVersion = "1.5.1"
|
kotlinCompilerExtensionVersion = "1.5.10"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,22 +59,22 @@ androidComponents {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation("androidx.core:core-ktx:1.13.0")
|
implementation("androidx.core:core-ktx:1.13.1")
|
||||||
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.7.0")
|
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.7.0")
|
||||||
implementation("androidx.activity:activity-compose:1.9.0")
|
implementation("androidx.activity:activity-compose:1.9.0")
|
||||||
implementation(platform("androidx.compose:compose-bom:2024.04.01"))
|
implementation(platform("androidx.compose:compose-bom:2024.05.00"))
|
||||||
implementation("androidx.compose.ui:ui:1.7.0-alpha07")
|
implementation("androidx.compose.ui:ui:1.7.0-alpha08")
|
||||||
implementation("androidx.compose.ui:ui-graphics:1.7.0-alpha07")
|
implementation("androidx.compose.ui:ui-graphics:1.7.0-alpha08")
|
||||||
implementation("androidx.compose.ui:ui-tooling-preview:1.7.0-alpha07")
|
implementation("androidx.compose.ui:ui-tooling-preview:1.7.0-alpha08")
|
||||||
implementation("androidx.compose.material3:material3:1.3.0-alpha05")
|
implementation("androidx.compose.material3:material3:1.3.0-alpha06")
|
||||||
implementation("androidx.navigation:navigation-compose:2.8.0-alpha07")
|
implementation("androidx.navigation:navigation-compose:2.8.0-alpha08")
|
||||||
implementation("androidx.compose.material:material:1.7.0-alpha07")
|
implementation("androidx.compose.material:material:1.7.0-alpha08")
|
||||||
implementation("androidx.datastore:datastore:1.1.0")
|
implementation("androidx.datastore:datastore:1.1.1")
|
||||||
implementation("androidx.datastore:datastore-preferences:1.1.0")
|
implementation("androidx.datastore:datastore-preferences:1.1.1")
|
||||||
implementation("androidx.compose.material:material-icons-extended:1.7.0-alpha07")
|
implementation("androidx.compose.material:material-icons-extended:1.7.0-alpha08")
|
||||||
implementation("com.google.accompanist:accompanist-adaptive:0.34.0")
|
implementation("com.google.accompanist:accompanist-adaptive:0.34.0")
|
||||||
implementation("androidx.hilt:hilt-navigation-compose:1.2.0")
|
implementation("androidx.hilt:hilt-navigation-compose:1.2.0")
|
||||||
implementation("androidx.compose.animation:animation:1.7.0-alpha07")
|
implementation("androidx.compose.animation:animation:1.7.0-alpha08")
|
||||||
implementation("androidx.core:core-splashscreen:1.2.0-alpha01")
|
implementation("androidx.core:core-splashscreen:1.2.0-alpha01")
|
||||||
implementation("androidx.lifecycle:lifecycle-runtime-compose:2.7.0")
|
implementation("androidx.lifecycle:lifecycle-runtime-compose:2.7.0")
|
||||||
implementation("com.google.code.gson:gson:2.10.1")
|
implementation("com.google.code.gson:gson:2.10.1")
|
||||||
@@ -84,19 +85,20 @@ dependencies {
|
|||||||
implementation("androidx.hilt:hilt-work:1.2.0")
|
implementation("androidx.hilt:hilt-work:1.2.0")
|
||||||
implementation("com.airbnb.android:lottie-compose:6.4.0")
|
implementation("com.airbnb.android:lottie-compose:6.4.0")
|
||||||
implementation("com.google.accompanist:accompanist-permissions:0.35.0-alpha")
|
implementation("com.google.accompanist:accompanist-permissions:0.35.0-alpha")
|
||||||
implementation("com.mikepenz:aboutlibraries-core:11.1.3")
|
implementation("com.mikepenz:aboutlibraries-core:11.1.4")
|
||||||
implementation("com.mikepenz:aboutlibraries-compose-m3:11.1.3")
|
implementation("com.mikepenz:aboutlibraries-compose-m3:11.1.4")
|
||||||
implementation("androidx.compose.foundation:foundation:1.7.0-alpha07")
|
implementation("androidx.compose.foundation:foundation:1.7.0-alpha08")
|
||||||
testImplementation("junit:junit:4.13.2")
|
testImplementation("junit:junit:4.13.2")
|
||||||
androidTestImplementation("androidx.test.ext:junit:1.1.5")
|
androidTestImplementation("androidx.test.ext:junit:1.1.5")
|
||||||
androidTestImplementation("androidx.test.espresso:espresso-core:3.6.0-alpha04")
|
androidTestImplementation("androidx.test.espresso:espresso-core:3.6.0-alpha04")
|
||||||
androidTestImplementation("androidx.compose.ui:ui-test-junit4:1.7.0-alpha07")
|
androidTestImplementation("androidx.compose.ui:ui-test-junit4:1.7.0-alpha08")
|
||||||
debugImplementation("androidx.compose.ui:ui-tooling:1.7.0-alpha07")
|
debugImplementation("androidx.compose.ui:ui-tooling:1.7.0-alpha08")
|
||||||
debugImplementation("androidx.compose.ui:ui-test-manifest:1.7.0-alpha07")
|
debugImplementation("androidx.compose.ui:ui-test-manifest:1.7.0-alpha08")
|
||||||
implementation("com.google.dagger:hilt-android:2.51.1")
|
implementation("com.google.dagger:hilt-android:2.51.1")
|
||||||
ksp("com.google.dagger:hilt-android-compiler:2.51.1")
|
ksp("com.google.dagger:hilt-android-compiler:2.51.1")
|
||||||
implementation("androidx.room:room-runtime:2.6.1")
|
implementation("androidx.room:room-runtime:2.6.1")
|
||||||
ksp("androidx.room:room-compiler:2.6.1")
|
ksp("androidx.room:room-compiler:2.6.1")
|
||||||
implementation("androidx.room:room-ktx:2.6.1")
|
implementation("androidx.room:room-ktx:2.6.1")
|
||||||
implementation("com.lazygeniouz:dfc:1.0.8")
|
implementation("com.lazygeniouz:dfc:1.0.8")
|
||||||
|
implementation ("org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.3")
|
||||||
}
|
}
|
||||||
+99
-139
@@ -11,11 +11,10 @@ import androidx.compose.ui.platform.LocalContext
|
|||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
import androidx.hilt.navigation.compose.hiltViewModel
|
import androidx.hilt.navigation.compose.hiltViewModel
|
||||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||||
import androidx.navigation.NavType
|
|
||||||
import androidx.navigation.compose.NavHost
|
import androidx.navigation.compose.NavHost
|
||||||
import androidx.navigation.compose.composable
|
import androidx.navigation.compose.composable
|
||||||
import androidx.navigation.compose.rememberNavController
|
import androidx.navigation.compose.rememberNavController
|
||||||
import androidx.navigation.navArgument
|
import androidx.navigation.toRoute
|
||||||
import com.anthonyla.paperize.feature.wallpaper.domain.model.SelectedAlbum
|
import com.anthonyla.paperize.feature.wallpaper.domain.model.SelectedAlbum
|
||||||
import com.anthonyla.paperize.feature.wallpaper.domain.model.Wallpaper
|
import com.anthonyla.paperize.feature.wallpaper.domain.model.Wallpaper
|
||||||
import com.anthonyla.paperize.feature.wallpaper.presentation.add_album_screen.AddAlbumScreen
|
import com.anthonyla.paperize.feature.wallpaper.presentation.add_album_screen.AddAlbumScreen
|
||||||
@@ -34,17 +33,20 @@ import com.anthonyla.paperize.feature.wallpaper.presentation.startup_screen.Star
|
|||||||
import com.anthonyla.paperize.feature.wallpaper.presentation.wallpaper_screen.WallpaperEvent
|
import com.anthonyla.paperize.feature.wallpaper.presentation.wallpaper_screen.WallpaperEvent
|
||||||
import com.anthonyla.paperize.feature.wallpaper.presentation.wallpaper_screen.WallpaperScreenViewModel
|
import com.anthonyla.paperize.feature.wallpaper.presentation.wallpaper_screen.WallpaperScreenViewModel
|
||||||
import com.anthonyla.paperize.feature.wallpaper.presentation.wallpaper_view_screen.WallpaperViewScreen
|
import com.anthonyla.paperize.feature.wallpaper.presentation.wallpaper_view_screen.WallpaperViewScreen
|
||||||
|
import com.anthonyla.paperize.feature.wallpaper.util.navigation.AddEdit
|
||||||
|
import com.anthonyla.paperize.feature.wallpaper.util.navigation.AlbumView
|
||||||
|
import com.anthonyla.paperize.feature.wallpaper.util.navigation.FolderView
|
||||||
|
import com.anthonyla.paperize.feature.wallpaper.util.navigation.Home
|
||||||
|
import com.anthonyla.paperize.feature.wallpaper.util.navigation.Licenses
|
||||||
import com.anthonyla.paperize.feature.wallpaper.util.navigation.NavConstants.INITIAL_OFFSET
|
import com.anthonyla.paperize.feature.wallpaper.util.navigation.NavConstants.INITIAL_OFFSET
|
||||||
import com.anthonyla.paperize.feature.wallpaper.util.navigation.NavScreens
|
import com.anthonyla.paperize.feature.wallpaper.util.navigation.Notification
|
||||||
|
import com.anthonyla.paperize.feature.wallpaper.util.navigation.Privacy
|
||||||
|
import com.anthonyla.paperize.feature.wallpaper.util.navigation.Settings
|
||||||
|
import com.anthonyla.paperize.feature.wallpaper.util.navigation.Startup
|
||||||
|
import com.anthonyla.paperize.feature.wallpaper.util.navigation.WallpaperView
|
||||||
import com.anthonyla.paperize.feature.wallpaper.util.navigation.sharedXTransitionIn
|
import com.anthonyla.paperize.feature.wallpaper.util.navigation.sharedXTransitionIn
|
||||||
import com.anthonyla.paperize.feature.wallpaper.util.navigation.sharedXTransitionOut
|
import com.anthonyla.paperize.feature.wallpaper.util.navigation.sharedXTransitionOut
|
||||||
import com.anthonyla.paperize.feature.wallpaper.wallpaperservice.WallpaperService
|
import com.anthonyla.paperize.feature.wallpaper.wallpaperservice.WallpaperService
|
||||||
import com.google.gson.Gson
|
|
||||||
import kotlinx.coroutines.Dispatchers
|
|
||||||
import kotlinx.coroutines.runBlocking
|
|
||||||
import kotlinx.coroutines.withContext
|
|
||||||
import java.net.URLEncoder
|
|
||||||
import java.nio.charset.StandardCharsets
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun PaperizeApp(
|
fun PaperizeApp(
|
||||||
@@ -65,8 +67,8 @@ fun PaperizeApp(
|
|||||||
if (!albumWithWallpapers.album.initialized && (albumWithWallpapers.wallpapers.isNotEmpty() || albumWithWallpapers.folders.isNotEmpty())) {
|
if (!albumWithWallpapers.album.initialized && (albumWithWallpapers.wallpapers.isNotEmpty() || albumWithWallpapers.folders.isNotEmpty())) {
|
||||||
albumsViewModel.onEvent(AlbumsEvent.InitializeAlbum(albumWithWallpapers))
|
albumsViewModel.onEvent(AlbumsEvent.InitializeAlbum(albumWithWallpapers))
|
||||||
} else if (albumWithWallpapers.album.initialized && albumWithWallpapers.wallpapers.isEmpty() && albumWithWallpapers.folders.isEmpty()) {
|
} else if (albumWithWallpapers.album.initialized && albumWithWallpapers.wallpapers.isEmpty() && albumWithWallpapers.folders.isEmpty()) {
|
||||||
if (navController.currentDestination?.route != NavScreens.Home.route) {
|
if (navController.currentDestination?.route == Home::class.simpleName) {
|
||||||
navController.popBackStack(NavScreens.Home.route, false)
|
navController.popBackStack<Home>(inclusive = false)
|
||||||
}
|
}
|
||||||
albumsViewModel.onEvent(AlbumsEvent.DeleteAlbumWithWallpapers(albumWithWallpapers))
|
albumsViewModel.onEvent(AlbumsEvent.DeleteAlbumWithWallpapers(albumWithWallpapers))
|
||||||
}
|
}
|
||||||
@@ -114,12 +116,11 @@ fun PaperizeApp(
|
|||||||
|
|
||||||
NavHost(
|
NavHost(
|
||||||
navController = navController,
|
navController = navController,
|
||||||
startDestination = if (firstLaunch) NavScreens.Startup.route else NavScreens.Home.route,
|
startDestination = if (firstLaunch) Startup else Home,
|
||||||
modifier = Modifier.navigationBarsPadding()
|
modifier = Modifier.navigationBarsPadding()
|
||||||
) {
|
) {
|
||||||
// Navigate to the startup screen to show the privacy policy and notification screen
|
// Navigate to the startup screen to show the privacy policy and notification screen
|
||||||
composable(
|
composable<Startup> (
|
||||||
route = NavScreens.Startup.route,
|
|
||||||
enterTransition = {
|
enterTransition = {
|
||||||
sharedXTransitionIn(initial = { (it * INITIAL_OFFSET).toInt() })
|
sharedXTransitionIn(initial = { (it * INITIAL_OFFSET).toInt() })
|
||||||
},
|
},
|
||||||
@@ -137,20 +138,17 @@ fun PaperizeApp(
|
|||||||
onAgree = {
|
onAgree = {
|
||||||
if (ContextCompat.checkSelfPermission(context, Manifest.permission.POST_NOTIFICATIONS) == PackageManager.PERMISSION_GRANTED) {
|
if (ContextCompat.checkSelfPermission(context, Manifest.permission.POST_NOTIFICATIONS) == PackageManager.PERMISSION_GRANTED) {
|
||||||
settingsViewModel.onEvent(SettingsEvent.SetFirstLaunch)
|
settingsViewModel.onEvent(SettingsEvent.SetFirstLaunch)
|
||||||
navController.navigate(NavScreens.Home.route) {
|
navController.navigate(Home) {
|
||||||
popUpTo(NavScreens.Startup.route) { inclusive = true }
|
popUpTo(Startup) { inclusive = true }
|
||||||
popUpTo(NavScreens.Notification.route) { inclusive = true }
|
popUpTo(Notification) { inclusive = true }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else { navController.navigate(Notification) }
|
||||||
navController.navigate(NavScreens.Notification.route)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
// Navigate to the notification screen to ask for notification permission
|
// Navigate to the notification screen to ask for notification permission
|
||||||
composable(
|
composable<Notification> (
|
||||||
route = NavScreens.Notification.route,
|
|
||||||
enterTransition = {
|
enterTransition = {
|
||||||
sharedXTransitionIn(initial = { (it * INITIAL_OFFSET).toInt() })
|
sharedXTransitionIn(initial = { (it * INITIAL_OFFSET).toInt() })
|
||||||
},
|
},
|
||||||
@@ -167,16 +165,15 @@ fun PaperizeApp(
|
|||||||
NotificationScreen(
|
NotificationScreen(
|
||||||
onAgree = {
|
onAgree = {
|
||||||
settingsViewModel.onEvent(SettingsEvent.SetFirstLaunch)
|
settingsViewModel.onEvent(SettingsEvent.SetFirstLaunch)
|
||||||
navController.navigate(NavScreens.Home.route) {
|
navController.navigate(Home) {
|
||||||
popUpTo(NavScreens.Startup.route) { inclusive = true }
|
popUpTo(Startup) { inclusive = true }
|
||||||
popUpTo(NavScreens.Notification.route) { inclusive = true }
|
popUpTo(Notification) { inclusive = true }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
// Navigate to the home screen to view all albums and wallpapers
|
// Navigate to the home screen to view all albums and wallpapers
|
||||||
composable(
|
composable<Home> (
|
||||||
route = NavScreens.Home.route,
|
|
||||||
enterTransition = {
|
enterTransition = {
|
||||||
sharedXTransitionIn(initial = { (it * INITIAL_OFFSET).toInt() })
|
sharedXTransitionIn(initial = { (it * INITIAL_OFFSET).toInt() })
|
||||||
},
|
},
|
||||||
@@ -191,12 +188,12 @@ fun PaperizeApp(
|
|||||||
},
|
},
|
||||||
) {
|
) {
|
||||||
HomeScreen(
|
HomeScreen(
|
||||||
onSettingsClick = { navController.navigate(NavScreens.Settings.route) },
|
onSettingsClick = { navController.navigate(Settings) },
|
||||||
navigateToAddWallpaperScreen = {
|
navigateToAddWallpaperScreen = {
|
||||||
navController.navigate("${NavScreens.AddEdit.route}/$it")
|
navController.navigate(AddEdit(it))
|
||||||
},
|
},
|
||||||
onAlbumViewClick = {
|
onAlbumViewClick = {
|
||||||
navController.navigate("${NavScreens.AlbumView.route}/$it")
|
navController.navigate(AlbumView(it))
|
||||||
},
|
},
|
||||||
onScheduleWallpaperChanger = { timeInMinutes ->
|
onScheduleWallpaperChanger = { timeInMinutes ->
|
||||||
settingsViewModel.onEvent(SettingsEvent.SetWallpaperInterval(timeInMinutes))
|
settingsViewModel.onEvent(SettingsEvent.SetWallpaperInterval(timeInMinutes))
|
||||||
@@ -212,12 +209,11 @@ fun PaperizeApp(
|
|||||||
context.startForegroundService(it)
|
context.startForegroundService(it)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
animate = settingsState.value.animate
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
// Navigate to the add album screen to create a new album and add wallpapers to it
|
// Navigate to the add album screen to create a new album and add wallpapers to it
|
||||||
composable(
|
composable<AddEdit>(
|
||||||
route = NavScreens.AddEdit.route.plus("/{initialAlbumName}"),
|
|
||||||
arguments = listOf(navArgument("initialAlbumName") { type = NavType.StringType }),
|
|
||||||
enterTransition = {
|
enterTransition = {
|
||||||
sharedXTransitionIn(initial = { (it * INITIAL_OFFSET).toInt() })
|
sharedXTransitionIn(initial = { (it * INITIAL_OFFSET).toInt() })
|
||||||
},
|
},
|
||||||
@@ -231,94 +227,21 @@ fun PaperizeApp(
|
|||||||
sharedXTransitionOut(target = { (it * INITIAL_OFFSET).toInt() })
|
sharedXTransitionOut(target = { (it * INITIAL_OFFSET).toInt() })
|
||||||
}
|
}
|
||||||
) {backStackEntry ->
|
) {backStackEntry ->
|
||||||
backStackEntry.arguments?.getString("initialAlbumName").let {
|
val addEdit: AddEdit = backStackEntry.toRoute()
|
||||||
if (it != null) {
|
AddAlbumScreen(
|
||||||
AddAlbumScreen(
|
initialAlbumName = addEdit.wallpaper,
|
||||||
initialAlbumName = it,
|
|
||||||
onBackClick = { navController.navigateUp() },
|
|
||||||
onConfirmation = {
|
|
||||||
navController.navigateUp()
|
|
||||||
},
|
|
||||||
onShowWallpaperView = { wallpaper ->
|
|
||||||
val encodedWallpaper = runBlocking { encodeUri(uri = wallpaper) }
|
|
||||||
navController.navigate("${NavScreens.WallpaperView.route}/$encodedWallpaper")
|
|
||||||
},
|
|
||||||
onShowFolderView = { folder, folderName, wallpapers ->
|
|
||||||
val encodedFolder = runBlocking { encodeUri(uri = folder) }
|
|
||||||
val encodedWallpapers = runBlocking { encodeUri(uri = Gson().toJson(wallpapers)) }
|
|
||||||
navController.navigate("${NavScreens.FolderView.route}/$encodedFolder/$folderName/$encodedWallpapers")
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Navigate to wallpaper view screen to view individual wallpapers in full screen
|
|
||||||
composable(
|
|
||||||
route = NavScreens.WallpaperView.route.plus("/{wallpaperUri}"),
|
|
||||||
arguments = listOf(navArgument("wallpaperUri") { type = NavType.StringType }),
|
|
||||||
enterTransition = {
|
|
||||||
sharedXTransitionIn(initial = { (it * INITIAL_OFFSET).toInt() })
|
|
||||||
},
|
|
||||||
exitTransition = {
|
|
||||||
sharedXTransitionOut(target = { -(it * INITIAL_OFFSET).toInt() })
|
|
||||||
},
|
|
||||||
popEnterTransition = {
|
|
||||||
sharedXTransitionIn(initial = { -(it * INITIAL_OFFSET).toInt() })
|
|
||||||
},
|
|
||||||
popExitTransition = {
|
|
||||||
sharedXTransitionOut(target = { (it * INITIAL_OFFSET).toInt() })
|
|
||||||
},
|
|
||||||
) { backStackEntry ->
|
|
||||||
backStackEntry.arguments?.getString("wallpaperUri").let { wallpaper ->
|
|
||||||
if (wallpaper != null) {
|
|
||||||
WallpaperViewScreen(
|
|
||||||
wallpaperUri = wallpaper,
|
|
||||||
onBackClick = { navController.navigateUp() },
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Navigate to folder view screen to view wallpapers in a particular folder
|
|
||||||
composable(
|
|
||||||
route = NavScreens.FolderView.route.plus("/{folderName}/{wallpapers}"),
|
|
||||||
arguments = listOf(
|
|
||||||
navArgument("folderName") { type = NavType.StringType },
|
|
||||||
navArgument("wallpapers") { type = NavType.StringType }
|
|
||||||
),
|
|
||||||
enterTransition = {
|
|
||||||
sharedXTransitionIn(initial = { (it * INITIAL_OFFSET).toInt() })
|
|
||||||
},
|
|
||||||
exitTransition = {
|
|
||||||
sharedXTransitionOut(target = { -(it * INITIAL_OFFSET).toInt() })
|
|
||||||
},
|
|
||||||
popEnterTransition = {
|
|
||||||
sharedXTransitionIn(initial = { -(it * INITIAL_OFFSET).toInt() })
|
|
||||||
},
|
|
||||||
popExitTransition = {
|
|
||||||
sharedXTransitionOut(target = { (it * INITIAL_OFFSET).toInt() })
|
|
||||||
},
|
|
||||||
) { backStackEntry ->
|
|
||||||
val folderName = backStackEntry.arguments?.getString("folderName")
|
|
||||||
val wallpapers = Gson().fromJson(
|
|
||||||
backStackEntry.arguments?.getString("wallpapers"),
|
|
||||||
Array<String>::class.java
|
|
||||||
).toList()
|
|
||||||
FolderViewScreen(
|
|
||||||
folderName = folderName,
|
|
||||||
wallpapers = wallpapers,
|
|
||||||
onBackClick = { navController.navigateUp() },
|
onBackClick = { navController.navigateUp() },
|
||||||
|
onConfirmation = { navController.navigateUp() },
|
||||||
onShowWallpaperView = { wallpaper ->
|
onShowWallpaperView = { wallpaper ->
|
||||||
val encodedWallpaper = runBlocking { encodeUri(uri = wallpaper) }
|
navController.navigate(WallpaperView(wallpaper))
|
||||||
navController.navigate("${NavScreens.WallpaperView.route}/$encodedWallpaper")
|
},
|
||||||
|
onShowFolderView = { folderName, wallpapers ->
|
||||||
|
navController.navigate(FolderView(folderName, wallpapers))
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
// Navigate to the album view screen to view folders and wallpapers in an album
|
// Navigate to wallpaper view screen to view individual wallpapers in full screen
|
||||||
composable(
|
composable<WallpaperView> (
|
||||||
route = NavScreens.AlbumView.route.plus("/{initialAlbumName}"),
|
|
||||||
arguments = listOf(
|
|
||||||
navArgument("initialAlbumName") { type = NavType.StringType },
|
|
||||||
),
|
|
||||||
enterTransition = {
|
enterTransition = {
|
||||||
sharedXTransitionIn(initial = { (it * INITIAL_OFFSET).toInt() })
|
sharedXTransitionIn(initial = { (it * INITIAL_OFFSET).toInt() })
|
||||||
},
|
},
|
||||||
@@ -332,19 +255,65 @@ fun PaperizeApp(
|
|||||||
sharedXTransitionOut(target = { (it * INITIAL_OFFSET).toInt() })
|
sharedXTransitionOut(target = { (it * INITIAL_OFFSET).toInt() })
|
||||||
},
|
},
|
||||||
) { backStackEntry ->
|
) { backStackEntry ->
|
||||||
val initialAlbumName = backStackEntry.arguments?.getString("initialAlbumName")
|
val wallpaperView: WallpaperView = backStackEntry.toRoute()
|
||||||
val albumWithWallpaper = albumState.value.albumsWithWallpapers.find { it.album.initialAlbumName == initialAlbumName }
|
WallpaperViewScreen(
|
||||||
if (initialAlbumName != null && albumWithWallpaper != null) {
|
wallpaperUri = wallpaperView.wallpaper,
|
||||||
|
onBackClick = { navController.navigateUp() },
|
||||||
|
animate = settingsState.value.animate
|
||||||
|
)
|
||||||
|
}
|
||||||
|
// Navigate to folder view screen to view wallpapers in a particular folder
|
||||||
|
composable<FolderView> (
|
||||||
|
enterTransition = {
|
||||||
|
sharedXTransitionIn(initial = { (it * INITIAL_OFFSET).toInt() })
|
||||||
|
},
|
||||||
|
exitTransition = {
|
||||||
|
sharedXTransitionOut(target = { -(it * INITIAL_OFFSET).toInt() })
|
||||||
|
},
|
||||||
|
popEnterTransition = {
|
||||||
|
sharedXTransitionIn(initial = { -(it * INITIAL_OFFSET).toInt() })
|
||||||
|
},
|
||||||
|
popExitTransition = {
|
||||||
|
sharedXTransitionOut(target = { (it * INITIAL_OFFSET).toInt() })
|
||||||
|
},
|
||||||
|
) { backStackEntry ->
|
||||||
|
val folderView: FolderView = backStackEntry.toRoute()
|
||||||
|
FolderViewScreen(
|
||||||
|
folderName = folderView.folderName,
|
||||||
|
wallpapers = folderView.wallpapers,
|
||||||
|
onBackClick = { navController.navigateUp() },
|
||||||
|
onShowWallpaperView = {
|
||||||
|
navController.navigate(WallpaperView(it))
|
||||||
|
},
|
||||||
|
animate = settingsState.value.animate
|
||||||
|
)
|
||||||
|
}
|
||||||
|
// Navigate to the album view screen to view folders and wallpapers in an album
|
||||||
|
composable<AlbumView> (
|
||||||
|
enterTransition = {
|
||||||
|
sharedXTransitionIn(initial = { (it * INITIAL_OFFSET).toInt() })
|
||||||
|
},
|
||||||
|
exitTransition = {
|
||||||
|
sharedXTransitionOut(target = { -(it * INITIAL_OFFSET).toInt() })
|
||||||
|
},
|
||||||
|
popEnterTransition = {
|
||||||
|
sharedXTransitionIn(initial = { -(it * INITIAL_OFFSET).toInt() })
|
||||||
|
},
|
||||||
|
popExitTransition = {
|
||||||
|
sharedXTransitionOut(target = { (it * INITIAL_OFFSET).toInt() })
|
||||||
|
},
|
||||||
|
) { backStackEntry ->
|
||||||
|
val albumView: AlbumView = backStackEntry.toRoute()
|
||||||
|
val albumWithWallpaper = albumState.value.albumsWithWallpapers.find { it.album.initialAlbumName == albumView.initialAlbumName }
|
||||||
|
if (albumWithWallpaper != null) {
|
||||||
AlbumViewScreen(
|
AlbumViewScreen(
|
||||||
album = albumWithWallpaper,
|
album = albumWithWallpaper,
|
||||||
onBackClick = { navController.navigateUp() },
|
onBackClick = { navController.navigateUp() },
|
||||||
onShowWallpaperView = { wallpaper ->
|
onShowWallpaperView = {
|
||||||
val encodedWallpaper = runBlocking { encodeUri(uri = wallpaper) }
|
navController.navigate(WallpaperView(it))
|
||||||
navController.navigate("${NavScreens.WallpaperView.route}/$encodedWallpaper")
|
|
||||||
},
|
},
|
||||||
onShowFolderView = { folderName, wallpapers ->
|
onShowFolderView = { folderName, wallpapers ->
|
||||||
val encodedWallpapers = runBlocking { encodeUri(uri = Gson().toJson(wallpapers)) }
|
navController.navigate(FolderView(folderName, wallpapers))
|
||||||
navController.navigate("${NavScreens.FolderView.route}/$folderName/$encodedWallpapers")
|
|
||||||
},
|
},
|
||||||
onDeleteAlbum = {
|
onDeleteAlbum = {
|
||||||
albumsViewModel.onEvent(AlbumsEvent.DeleteAlbumWithWallpapers(albumWithWallpaper))
|
albumsViewModel.onEvent(AlbumsEvent.DeleteAlbumWithWallpapers(albumWithWallpaper))
|
||||||
@@ -357,11 +326,10 @@ fun PaperizeApp(
|
|||||||
albumsViewModel.onEvent(AlbumsEvent.RefreshAlbums)
|
albumsViewModel.onEvent(AlbumsEvent.RefreshAlbums)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
} else { navController.navigateUp() }
|
||||||
}
|
}
|
||||||
// Navigate to the settings screen to change app settings
|
// Navigate to the settings screen to change app settings
|
||||||
composable(
|
composable<Settings> (
|
||||||
route = NavScreens.Settings.route,
|
|
||||||
enterTransition = {
|
enterTransition = {
|
||||||
sharedXTransitionIn(initial = { (it * INITIAL_OFFSET).toInt() })
|
sharedXTransitionIn(initial = { (it * INITIAL_OFFSET).toInt() })
|
||||||
},
|
},
|
||||||
@@ -388,16 +356,15 @@ fun PaperizeApp(
|
|||||||
settingsViewModel.onEvent(SettingsEvent.SetAnimate(it))
|
settingsViewModel.onEvent(SettingsEvent.SetAnimate(it))
|
||||||
},
|
},
|
||||||
onPrivacyClick = {
|
onPrivacyClick = {
|
||||||
navController.navigate(NavScreens.Privacy.route)
|
navController.navigate(Privacy)
|
||||||
},
|
},
|
||||||
onLicenseClick = {
|
onLicenseClick = {
|
||||||
navController.navigate(NavScreens.Licenses.route)
|
navController.navigate(Licenses)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
// Navigate to the privacy screen to view the privacy policy
|
// Navigate to the privacy screen to view the privacy policy
|
||||||
composable(
|
composable<Privacy> (
|
||||||
route = NavScreens.Privacy.route,
|
|
||||||
enterTransition = {
|
enterTransition = {
|
||||||
sharedXTransitionIn(initial = { (it * INITIAL_OFFSET).toInt() })
|
sharedXTransitionIn(initial = { (it * INITIAL_OFFSET).toInt() })
|
||||||
},
|
},
|
||||||
@@ -416,8 +383,7 @@ fun PaperizeApp(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
// Navigate to the licenses screen to view the licenses of the libraries used
|
// Navigate to the licenses screen to view the licenses of the libraries used
|
||||||
composable(
|
composable<Licenses> (
|
||||||
route = NavScreens.Licenses.route,
|
|
||||||
enterTransition = {
|
enterTransition = {
|
||||||
sharedXTransitionIn(initial = { (it * INITIAL_OFFSET).toInt() })
|
sharedXTransitionIn(initial = { (it * INITIAL_OFFSET).toInt() })
|
||||||
},
|
},
|
||||||
@@ -436,10 +402,4 @@ fun PaperizeApp(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Encode an URI so it can be passed with navigation
|
|
||||||
suspend fun encodeUri(uri: String): String =
|
|
||||||
withContext(Dispatchers.IO) {
|
|
||||||
URLEncoder.encode(uri, StandardCharsets.UTF_8.toString())
|
|
||||||
}
|
}
|
||||||
+4
-3
@@ -44,7 +44,7 @@ fun AddAlbumScreen(
|
|||||||
onBackClick: () -> Unit,
|
onBackClick: () -> Unit,
|
||||||
onConfirmation: () -> Unit,
|
onConfirmation: () -> Unit,
|
||||||
onShowWallpaperView: (String) -> Unit,
|
onShowWallpaperView: (String) -> Unit,
|
||||||
onShowFolderView: (String, String?, List<String>) -> Unit
|
onShowFolderView: (String?, List<String>) -> Unit
|
||||||
) {
|
) {
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
val lazyGridState = rememberLazyStaggeredGridState()
|
val lazyGridState = rememberLazyStaggeredGridState()
|
||||||
@@ -187,7 +187,7 @@ fun AddAlbumScreen(
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
onFolderViewClick = {
|
onFolderViewClick = {
|
||||||
onShowFolderView(folder.folderUri, folder.folderName, folder.wallpapers)
|
onShowFolderView(folder.folderName, folder.wallpapers)
|
||||||
},
|
},
|
||||||
modifier = Modifier.padding(4.dp).animateItem(
|
modifier = Modifier.padding(4.dp).animateItem(
|
||||||
placementSpec = tween(
|
placementSpec = tween(
|
||||||
@@ -223,7 +223,8 @@ fun AddAlbumScreen(
|
|||||||
delayMillis = 0,
|
delayMillis = 0,
|
||||||
easing = FastOutSlowInEasing
|
easing = FastOutSlowInEasing
|
||||||
),
|
),
|
||||||
)
|
),
|
||||||
|
animate = settingsState.value.animate
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+15
@@ -22,11 +22,13 @@ import androidx.compose.foundation.shape.RoundedCornerShape
|
|||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.filled.Add
|
import androidx.compose.material.icons.filled.Add
|
||||||
import androidx.compose.material.icons.filled.Remove
|
import androidx.compose.material.icons.filled.Remove
|
||||||
|
import androidx.compose.material3.CardColors
|
||||||
import androidx.compose.material3.ElevatedCard
|
import androidx.compose.material3.ElevatedCard
|
||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
import androidx.compose.material3.LargeFloatingActionButton
|
import androidx.compose.material3.LargeFloatingActionButton
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material3.Surface
|
import androidx.compose.material3.Surface
|
||||||
|
import androidx.compose.material3.surfaceColorAtElevation
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.runtime.mutableStateOf
|
import androidx.compose.runtime.mutableStateOf
|
||||||
@@ -34,6 +36,7 @@ import androidx.compose.runtime.remember
|
|||||||
import androidx.compose.runtime.setValue
|
import androidx.compose.runtime.setValue
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.input.pointer.pointerInput
|
import androidx.compose.ui.input.pointer.pointerInput
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
@@ -82,6 +85,12 @@ fun AddAlbumAnimatedFab(
|
|||||||
|
|
||||||
if (animate) {
|
if (animate) {
|
||||||
ElevatedCard(
|
ElevatedCard(
|
||||||
|
colors = CardColors(
|
||||||
|
containerColor = MaterialTheme.colorScheme.surfaceColorAtElevation(5.dp),
|
||||||
|
contentColor = Color.Transparent,
|
||||||
|
disabledContentColor = Color.Transparent,
|
||||||
|
disabledContainerColor = Color.Transparent,
|
||||||
|
),
|
||||||
shape = RoundedCornerShape(28.dp),
|
shape = RoundedCornerShape(28.dp),
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.padding(4.dp)
|
.padding(4.dp)
|
||||||
@@ -147,6 +156,12 @@ fun AddAlbumAnimatedFab(
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ElevatedCard(
|
ElevatedCard(
|
||||||
|
colors = CardColors(
|
||||||
|
containerColor = MaterialTheme.colorScheme.surfaceColorAtElevation(5.dp),
|
||||||
|
contentColor = Color.Transparent,
|
||||||
|
disabledContentColor = Color.Transparent,
|
||||||
|
disabledContainerColor = Color.Transparent,
|
||||||
|
),
|
||||||
shape = RoundedCornerShape(28.dp),
|
shape = RoundedCornerShape(28.dp),
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.padding(4.dp)
|
.padding(4.dp)
|
||||||
|
|||||||
+6
-3
@@ -34,7 +34,8 @@ import com.skydoves.landscapist.glide.GlideImage
|
|||||||
fun AlbumItem(
|
fun AlbumItem(
|
||||||
album: Album,
|
album: Album,
|
||||||
onAlbumViewClick: () -> Unit,
|
onAlbumViewClick: () -> Unit,
|
||||||
modifier: Modifier = Modifier
|
modifier: Modifier = Modifier,
|
||||||
|
animate: Boolean = true
|
||||||
) {
|
) {
|
||||||
Card(
|
Card(
|
||||||
colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.surfaceVariant),
|
colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.surfaceVariant),
|
||||||
@@ -62,8 +63,10 @@ fun AlbumItem(
|
|||||||
.transition(BitmapTransitionOptions.withCrossFade())
|
.transition(BitmapTransitionOptions.withCrossFade())
|
||||||
},
|
},
|
||||||
loading = {
|
loading = {
|
||||||
Box(modifier = Modifier.matchParentSize()) {
|
if (animate) {
|
||||||
CircularProgressIndicator(modifier = Modifier.align(Alignment.Center))
|
Box(modifier = Modifier.matchParentSize()) {
|
||||||
|
CircularProgressIndicator(modifier = Modifier.align(Alignment.Center))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
|
|||||||
+6
-3
@@ -59,7 +59,8 @@ fun FolderItem(
|
|||||||
onActivateSelectionMode: (Boolean) -> Unit,
|
onActivateSelectionMode: (Boolean) -> Unit,
|
||||||
onItemSelection: () -> Unit,
|
onItemSelection: () -> Unit,
|
||||||
onFolderViewClick: () -> Unit,
|
onFolderViewClick: () -> Unit,
|
||||||
modifier: Modifier = Modifier
|
modifier: Modifier = Modifier,
|
||||||
|
animate: Boolean = true
|
||||||
) {
|
) {
|
||||||
val configuration = LocalConfiguration.current
|
val configuration = LocalConfiguration.current
|
||||||
val haptics = LocalHapticFeedback.current
|
val haptics = LocalHapticFeedback.current
|
||||||
@@ -113,8 +114,10 @@ fun FolderItem(
|
|||||||
.transition(BitmapTransitionOptions.withCrossFade())
|
.transition(BitmapTransitionOptions.withCrossFade())
|
||||||
},
|
},
|
||||||
loading = {
|
loading = {
|
||||||
Box(modifier = Modifier.matchParentSize()) {
|
if (animate) {
|
||||||
CircularProgressIndicator(modifier = Modifier.align(Alignment.Center))
|
Box(modifier = Modifier.matchParentSize()) {
|
||||||
|
CircularProgressIndicator(modifier = Modifier.align(Alignment.Center))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
|
|||||||
+20
-7
@@ -54,7 +54,10 @@ fun WallpaperItem(
|
|||||||
onItemSelection: () -> Unit,
|
onItemSelection: () -> Unit,
|
||||||
onWallpaperViewClick: () -> Unit,
|
onWallpaperViewClick: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
wallpaperDrawable : Bitmap? = null
|
wallpaperDrawable : Bitmap? = null,
|
||||||
|
aspectRatio: Float? = null,
|
||||||
|
clickable: Boolean = true,
|
||||||
|
animate: Boolean = true
|
||||||
) {
|
) {
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
val haptics = LocalHapticFeedback.current
|
val haptics = LocalHapticFeedback.current
|
||||||
@@ -68,10 +71,10 @@ fun WallpaperItem(
|
|||||||
}
|
}
|
||||||
|
|
||||||
val dimension = wallpaperDrawable?.let { Pair(it.width, it.height) } ?: wallpaperUri.toUri().getImageDimensions(context)
|
val dimension = wallpaperDrawable?.let { Pair(it.width, it.height) } ?: wallpaperUri.toUri().getImageDimensions(context)
|
||||||
val aspectRatio = (dimension.first.toFloat()/dimension.second.toFloat())
|
val imageAspectRatio = aspectRatio ?: (dimension.first.toFloat() / dimension.second.toFloat())
|
||||||
|
|
||||||
Box(
|
val boxModifier = if (clickable) {
|
||||||
modifier = modifier
|
modifier
|
||||||
.padding(paddingTransition)
|
.padding(paddingTransition)
|
||||||
.clip(RoundedCornerShape(roundedCornerShapeTransition))
|
.clip(RoundedCornerShape(roundedCornerShapeTransition))
|
||||||
.combinedClickable(
|
.combinedClickable(
|
||||||
@@ -87,6 +90,14 @@ fun WallpaperItem(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
} else {
|
||||||
|
modifier
|
||||||
|
.padding(paddingTransition)
|
||||||
|
.clip(RoundedCornerShape(roundedCornerShapeTransition))
|
||||||
|
}
|
||||||
|
|
||||||
|
Box(
|
||||||
|
modifier = boxModifier
|
||||||
) {
|
) {
|
||||||
GlideImage(
|
GlideImage(
|
||||||
imageModel = { wallpaperDrawable ?: wallpaperUri.toUri() },
|
imageModel = { wallpaperDrawable ?: wallpaperUri.toUri() },
|
||||||
@@ -101,11 +112,13 @@ fun WallpaperItem(
|
|||||||
.transition(withCrossFade())
|
.transition(withCrossFade())
|
||||||
},
|
},
|
||||||
loading = {
|
loading = {
|
||||||
Box(modifier = Modifier.matchParentSize()) {
|
if (animate) {
|
||||||
CircularProgressIndicator(modifier = Modifier.align(Alignment.Center))
|
Box(modifier = Modifier.matchParentSize()) {
|
||||||
|
CircularProgressIndicator(modifier = Modifier.align(Alignment.Center))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
modifier = Modifier.aspectRatio(aspectRatio)
|
modifier = Modifier.aspectRatio(imageAspectRatio)
|
||||||
)
|
)
|
||||||
if (selectionMode) {
|
if (selectionMode) {
|
||||||
val bgColor = MaterialTheme.colorScheme.surfaceColorAtElevation(5.dp)
|
val bgColor = MaterialTheme.colorScheme.surfaceColorAtElevation(5.dp)
|
||||||
|
|||||||
+102
-52
@@ -47,7 +47,7 @@ fun AlbumViewScreen(
|
|||||||
onShowFolderView: (String?, List<String>) -> Unit,
|
onShowFolderView: (String?, List<String>) -> Unit,
|
||||||
onDeleteAlbum: () -> Unit,
|
onDeleteAlbum: () -> Unit,
|
||||||
onTitleChange: (String, AlbumWithWallpaperAndFolder) -> Unit,
|
onTitleChange: (String, AlbumWithWallpaperAndFolder) -> Unit,
|
||||||
onSelectionDeleted: () -> Unit
|
onSelectionDeleted: () -> Unit,
|
||||||
) {
|
) {
|
||||||
albumViewScreenViewModel.onEvent(AlbumViewEvent.SetSize(album.wallpapers.size + album.folders.size)) // For selectedAll state
|
albumViewScreenViewModel.onEvent(AlbumViewEvent.SetSize(album.wallpapers.size + album.folders.size)) // For selectedAll state
|
||||||
val lazyListState = rememberLazyStaggeredGridState()
|
val lazyListState = rememberLazyStaggeredGridState()
|
||||||
@@ -153,7 +153,7 @@ fun AlbumViewScreen(
|
|||||||
selectionMode = false
|
selectionMode = false
|
||||||
folderPickerLauncher.launch(null)
|
folderPickerLauncher.launch(null)
|
||||||
},
|
},
|
||||||
animate = true
|
animate = false
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -169,61 +169,111 @@ fun AlbumViewScreen(
|
|||||||
content = {
|
content = {
|
||||||
items (items = album.folders, key = { folder -> folder.folderUri.hashCode() }
|
items (items = album.folders, key = { folder -> folder.folderUri.hashCode() }
|
||||||
) { folder ->
|
) { folder ->
|
||||||
FolderItem(
|
if (settingsState.value.animate) {
|
||||||
folder = folder,
|
FolderItem(
|
||||||
itemSelected = albumState.value.selectedFolders.contains(folder.folderUri),
|
folder = folder,
|
||||||
selectionMode = selectionMode,
|
itemSelected = albumState.value.selectedFolders.contains(folder.folderUri),
|
||||||
onActivateSelectionMode = { selectionMode = it },
|
selectionMode = selectionMode,
|
||||||
onItemSelection = {
|
onActivateSelectionMode = { selectionMode = it },
|
||||||
albumViewScreenViewModel.onEvent(
|
onItemSelection = {
|
||||||
if (!albumState.value.selectedFolders.contains(folder.folderUri))
|
albumViewScreenViewModel.onEvent(
|
||||||
AlbumViewEvent.SelectFolder(folder.folderUri)
|
if (!albumState.value.selectedFolders.contains(folder.folderUri))
|
||||||
else {
|
AlbumViewEvent.SelectFolder(folder.folderUri)
|
||||||
AlbumViewEvent.RemoveFolderFromSelection(folder.folderUri)
|
else {
|
||||||
}
|
AlbumViewEvent.RemoveFolderFromSelection(folder.folderUri)
|
||||||
)
|
}
|
||||||
},
|
)
|
||||||
onFolderViewClick = {
|
},
|
||||||
onShowFolderView(folder.folderName, folder.wallpapers)
|
onFolderViewClick = {
|
||||||
},
|
onShowFolderView(folder.folderName, folder.wallpapers)
|
||||||
modifier = Modifier.padding(4.dp).animateItem(
|
},
|
||||||
placementSpec = tween(
|
modifier = Modifier.padding(4.dp).animateItem(
|
||||||
durationMillis = 800,
|
|
||||||
delayMillis = 0,
|
|
||||||
easing = FastOutSlowInEasing
|
|
||||||
),
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
items (items = album.wallpapers, key = { wallpaper -> wallpaper.wallpaperUri.hashCode()}
|
|
||||||
) { wallpaper ->
|
|
||||||
WallpaperItem(
|
|
||||||
wallpaperUri = wallpaper.wallpaperUri,
|
|
||||||
itemSelected = albumState.value.selectedWallpapers.contains(wallpaper.wallpaperUri),
|
|
||||||
selectionMode = selectionMode,
|
|
||||||
onActivateSelectionMode = { selectionMode = it },
|
|
||||||
onItemSelection = {
|
|
||||||
albumViewScreenViewModel.onEvent(
|
|
||||||
if (!albumState.value.selectedWallpapers.contains(wallpaper.wallpaperUri))
|
|
||||||
AlbumViewEvent.SelectWallpaper(wallpaper.wallpaperUri)
|
|
||||||
else {
|
|
||||||
AlbumViewEvent.RemoveWallpaperFromSelection(wallpaper.wallpaperUri)
|
|
||||||
}
|
|
||||||
)
|
|
||||||
},
|
|
||||||
onWallpaperViewClick = {
|
|
||||||
onShowWallpaperView(wallpaper.wallpaperUri)
|
|
||||||
},
|
|
||||||
modifier = Modifier
|
|
||||||
.padding(4.dp)
|
|
||||||
.animateItem(
|
|
||||||
placementSpec = tween(
|
placementSpec = tween(
|
||||||
durationMillis = 800,
|
durationMillis = 800,
|
||||||
delayMillis = 0,
|
delayMillis = 0,
|
||||||
easing = FastOutSlowInEasing
|
easing = FastOutSlowInEasing
|
||||||
|
),
|
||||||
|
),
|
||||||
|
animate = true
|
||||||
|
)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
FolderItem(
|
||||||
|
folder = folder,
|
||||||
|
itemSelected = albumState.value.selectedFolders.contains(folder.folderUri),
|
||||||
|
selectionMode = selectionMode,
|
||||||
|
onActivateSelectionMode = { selectionMode = it },
|
||||||
|
onItemSelection = {
|
||||||
|
albumViewScreenViewModel.onEvent(
|
||||||
|
if (!albumState.value.selectedFolders.contains(folder.folderUri))
|
||||||
|
AlbumViewEvent.SelectFolder(folder.folderUri)
|
||||||
|
else {
|
||||||
|
AlbumViewEvent.RemoveFolderFromSelection(folder.folderUri)
|
||||||
|
}
|
||||||
)
|
)
|
||||||
)
|
},
|
||||||
)
|
onFolderViewClick = {
|
||||||
|
onShowFolderView(folder.folderName, folder.wallpapers)
|
||||||
|
},
|
||||||
|
modifier = Modifier.padding(4.dp),
|
||||||
|
animate = false
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
items (items = album.wallpapers, key = { wallpaper -> wallpaper.wallpaperUri.hashCode()}
|
||||||
|
) { wallpaper ->
|
||||||
|
if (settingsState.value.animate) {
|
||||||
|
WallpaperItem(
|
||||||
|
wallpaperUri = wallpaper.wallpaperUri,
|
||||||
|
itemSelected = albumState.value.selectedWallpapers.contains(wallpaper.wallpaperUri),
|
||||||
|
selectionMode = selectionMode,
|
||||||
|
onActivateSelectionMode = { selectionMode = it },
|
||||||
|
onItemSelection = {
|
||||||
|
albumViewScreenViewModel.onEvent(
|
||||||
|
if (!albumState.value.selectedWallpapers.contains(wallpaper.wallpaperUri))
|
||||||
|
AlbumViewEvent.SelectWallpaper(wallpaper.wallpaperUri)
|
||||||
|
else {
|
||||||
|
AlbumViewEvent.RemoveWallpaperFromSelection(wallpaper.wallpaperUri)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
},
|
||||||
|
onWallpaperViewClick = {
|
||||||
|
onShowWallpaperView(wallpaper.wallpaperUri)
|
||||||
|
},
|
||||||
|
modifier = Modifier
|
||||||
|
.padding(4.dp)
|
||||||
|
.animateItem(
|
||||||
|
placementSpec = tween(
|
||||||
|
durationMillis = 800,
|
||||||
|
delayMillis = 0,
|
||||||
|
easing = FastOutSlowInEasing
|
||||||
|
)
|
||||||
|
),
|
||||||
|
animate = true
|
||||||
|
)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
WallpaperItem(
|
||||||
|
wallpaperUri = wallpaper.wallpaperUri,
|
||||||
|
itemSelected = albumState.value.selectedWallpapers.contains(wallpaper.wallpaperUri),
|
||||||
|
selectionMode = selectionMode,
|
||||||
|
onActivateSelectionMode = { selectionMode = it },
|
||||||
|
onItemSelection = {
|
||||||
|
albumViewScreenViewModel.onEvent(
|
||||||
|
if (!albumState.value.selectedWallpapers.contains(wallpaper.wallpaperUri))
|
||||||
|
AlbumViewEvent.SelectWallpaper(wallpaper.wallpaperUri)
|
||||||
|
else {
|
||||||
|
AlbumViewEvent.RemoveWallpaperFromSelection(wallpaper.wallpaperUri)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
},
|
||||||
|
onWallpaperViewClick = {
|
||||||
|
onShowWallpaperView(wallpaper.wallpaperUri)
|
||||||
|
},
|
||||||
|
modifier = Modifier.padding(4.dp),
|
||||||
|
animate = false
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
+36
-19
@@ -23,7 +23,8 @@ fun FolderViewScreen(
|
|||||||
folderName: String?,
|
folderName: String?,
|
||||||
wallpapers: List<String>,
|
wallpapers: List<String>,
|
||||||
onBackClick: () -> Unit,
|
onBackClick: () -> Unit,
|
||||||
onShowWallpaperView: (String) -> Unit
|
onShowWallpaperView: (String) -> Unit,
|
||||||
|
animate: Boolean
|
||||||
) {
|
) {
|
||||||
val lazyListState = rememberLazyStaggeredGridState()
|
val lazyListState = rememberLazyStaggeredGridState()
|
||||||
BackHandler { onBackClick() }
|
BackHandler { onBackClick() }
|
||||||
@@ -32,9 +33,8 @@ fun FolderViewScreen(
|
|||||||
topBar = {
|
topBar = {
|
||||||
FolderViewTopBar(
|
FolderViewTopBar(
|
||||||
title = folderName ?: "",
|
title = folderName ?: "",
|
||||||
) {
|
onBackClick = onBackClick
|
||||||
onBackClick()
|
)
|
||||||
}
|
|
||||||
},
|
},
|
||||||
content = {
|
content = {
|
||||||
LazyVerticalStaggeredGrid(
|
LazyVerticalStaggeredGrid(
|
||||||
@@ -48,23 +48,40 @@ fun FolderViewScreen(
|
|||||||
content = {
|
content = {
|
||||||
items (items = wallpapers, key = { wallpaper -> wallpaper }
|
items (items = wallpapers, key = { wallpaper -> wallpaper }
|
||||||
) { wallpaper ->
|
) { wallpaper ->
|
||||||
WallpaperItem(
|
if (animate) {
|
||||||
wallpaperUri = wallpaper,
|
WallpaperItem(
|
||||||
itemSelected = false,
|
wallpaperUri = wallpaper,
|
||||||
selectionMode = false,
|
itemSelected = false,
|
||||||
onActivateSelectionMode = {},
|
selectionMode = false,
|
||||||
onItemSelection = {},
|
onActivateSelectionMode = {},
|
||||||
onWallpaperViewClick = {
|
onItemSelection = {},
|
||||||
onShowWallpaperView(wallpaper)
|
onWallpaperViewClick = {
|
||||||
},
|
onShowWallpaperView(wallpaper)
|
||||||
modifier = Modifier.padding(4.dp).animateItem(
|
},
|
||||||
placementSpec = tween(
|
modifier = Modifier.padding(4.dp).animateItem(
|
||||||
durationMillis = 800,
|
placementSpec = tween(
|
||||||
delayMillis = 0,
|
durationMillis = 800,
|
||||||
easing = FastOutSlowInEasing
|
delayMillis = 0,
|
||||||
|
easing = FastOutSlowInEasing
|
||||||
|
),
|
||||||
),
|
),
|
||||||
|
animate = true
|
||||||
)
|
)
|
||||||
)
|
}
|
||||||
|
else {
|
||||||
|
WallpaperItem(
|
||||||
|
wallpaperUri = wallpaper,
|
||||||
|
itemSelected = false,
|
||||||
|
selectionMode = false,
|
||||||
|
onActivateSelectionMode = {},
|
||||||
|
onItemSelection = {},
|
||||||
|
onWallpaperViewClick = {
|
||||||
|
onShowWallpaperView(wallpaper)
|
||||||
|
},
|
||||||
|
modifier = Modifier.padding(4.dp),
|
||||||
|
animate = false
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
+4
-4
@@ -1,6 +1,5 @@
|
|||||||
package com.anthonyla.paperize.feature.wallpaper.presentation.home_screen
|
package com.anthonyla.paperize.feature.wallpaper.presentation.home_screen
|
||||||
|
|
||||||
import androidx.compose.foundation.ExperimentalFoundationApi
|
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.pager.HorizontalPager
|
import androidx.compose.foundation.pager.HorizontalPager
|
||||||
@@ -29,14 +28,14 @@ import com.anthonyla.paperize.feature.wallpaper.presentation.library_screen.Libr
|
|||||||
import com.anthonyla.paperize.feature.wallpaper.presentation.settings_screen.components.tabItems
|
import com.anthonyla.paperize.feature.wallpaper.presentation.settings_screen.components.tabItems
|
||||||
import com.anthonyla.paperize.feature.wallpaper.presentation.wallpaper_screen.WallpaperScreen
|
import com.anthonyla.paperize.feature.wallpaper.presentation.wallpaper_screen.WallpaperScreen
|
||||||
|
|
||||||
@OptIn(ExperimentalFoundationApi::class)
|
|
||||||
@Composable
|
@Composable
|
||||||
fun HomeScreen(
|
fun HomeScreen(
|
||||||
onSettingsClick: () -> Unit,
|
onSettingsClick: () -> Unit,
|
||||||
navigateToAddWallpaperScreen: (String) -> Unit,
|
navigateToAddWallpaperScreen: (String) -> Unit,
|
||||||
onAlbumViewClick: (String) -> Unit,
|
onAlbumViewClick: (String) -> Unit,
|
||||||
onScheduleWallpaperChanger: (Int) -> Unit,
|
onScheduleWallpaperChanger: (Int) -> Unit,
|
||||||
onStop: () -> Unit
|
onStop: () -> Unit,
|
||||||
|
animate : Boolean
|
||||||
) {
|
) {
|
||||||
var tabIndex by rememberSaveable { mutableIntStateOf(0) }
|
var tabIndex by rememberSaveable { mutableIntStateOf(0) }
|
||||||
val pagerState = rememberPagerState { tabItems.size }
|
val pagerState = rememberPagerState { tabItems.size }
|
||||||
@@ -108,7 +107,8 @@ fun HomeScreen(
|
|||||||
)
|
)
|
||||||
1 -> LibraryScreen(
|
1 -> LibraryScreen(
|
||||||
onAddNewAlbumClick = { addAlbumDialog = true },
|
onAddNewAlbumClick = { addAlbumDialog = true },
|
||||||
onViewAlbum = onAlbumViewClick
|
onViewAlbum = onAlbumViewClick,
|
||||||
|
animate = animate
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-2
@@ -30,7 +30,8 @@ import com.anthonyla.paperize.feature.wallpaper.presentation.album.components.Al
|
|||||||
fun LibraryScreen(
|
fun LibraryScreen(
|
||||||
albumsViewModel: AlbumsViewModel = hiltViewModel(),
|
albumsViewModel: AlbumsViewModel = hiltViewModel(),
|
||||||
onAddNewAlbumClick: () -> Unit,
|
onAddNewAlbumClick: () -> Unit,
|
||||||
onViewAlbum: (String) -> Unit
|
onViewAlbum: (String) -> Unit,
|
||||||
|
animate: Boolean
|
||||||
) {
|
) {
|
||||||
val lazyListState = rememberLazyGridState()
|
val lazyListState = rememberLazyGridState()
|
||||||
val state = albumsViewModel.state.collectAsStateWithLifecycle()
|
val state = albumsViewModel.state.collectAsStateWithLifecycle()
|
||||||
@@ -68,7 +69,8 @@ fun LibraryScreen(
|
|||||||
delayMillis = 0,
|
delayMillis = 0,
|
||||||
easing = FastOutSlowInEasing
|
easing = FastOutSlowInEasing
|
||||||
),
|
),
|
||||||
)
|
),
|
||||||
|
animate = animate
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-5
@@ -21,6 +21,7 @@ import androidx.compose.runtime.Composable
|
|||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.draw.clip
|
import androidx.compose.ui.draw.clip
|
||||||
|
import androidx.compose.ui.draw.scale
|
||||||
import androidx.compose.ui.graphics.vector.ImageVector
|
import androidx.compose.ui.graphics.vector.ImageVector
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.res.vectorResource
|
import androidx.compose.ui.res.vectorResource
|
||||||
@@ -53,7 +54,7 @@ fun PaperizeListItem(onGitHubClick: () -> Unit, onPlaystoreClick: () -> Unit, on
|
|||||||
Icon(
|
Icon(
|
||||||
imageVector = ImageVector.vectorResource(id = R.drawable.app_icon_foreground),
|
imageVector = ImageVector.vectorResource(id = R.drawable.app_icon_foreground),
|
||||||
contentDescription = stringResource(id = R.string.appname),
|
contentDescription = stringResource(id = R.string.appname),
|
||||||
modifier = Modifier.size(160.dp),
|
modifier = Modifier.size(160.dp).scale(1.5f),
|
||||||
tint = MaterialTheme.colorScheme.primary,
|
tint = MaterialTheme.colorScheme.primary,
|
||||||
)
|
)
|
||||||
Text(
|
Text(
|
||||||
@@ -62,7 +63,7 @@ fun PaperizeListItem(onGitHubClick: () -> Unit, onPlaystoreClick: () -> Unit, on
|
|||||||
fontSize = MaterialTheme.typography.titleLarge.fontSize
|
fontSize = MaterialTheme.typography.titleLarge.fontSize
|
||||||
)
|
)
|
||||||
Text(
|
Text(
|
||||||
text = "Version: 0.3.0",
|
text = "Version: 1.1.0",
|
||||||
style = MaterialTheme.typography.bodySmall,
|
style = MaterialTheme.typography.bodySmall,
|
||||||
fontSize = MaterialTheme.typography.bodyMedium.fontSize
|
fontSize = MaterialTheme.typography.bodyMedium.fontSize
|
||||||
)
|
)
|
||||||
@@ -79,7 +80,7 @@ fun PaperizeListItem(onGitHubClick: () -> Unit, onPlaystoreClick: () -> Unit, on
|
|||||||
IconButton(
|
IconButton(
|
||||||
onClick = onGitHubClick,
|
onClick = onGitHubClick,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.size(64.dp)
|
.size(60.dp)
|
||||||
.background(MaterialTheme.colorScheme.primary, CircleShape)
|
.background(MaterialTheme.colorScheme.primary, CircleShape)
|
||||||
) {
|
) {
|
||||||
Icon(
|
Icon(
|
||||||
@@ -95,7 +96,7 @@ fun PaperizeListItem(onGitHubClick: () -> Unit, onPlaystoreClick: () -> Unit, on
|
|||||||
IconButton(
|
IconButton(
|
||||||
onClick = onPlaystoreClick,
|
onClick = onPlaystoreClick,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.size(64.dp)
|
.size(60.dp)
|
||||||
.background(MaterialTheme.colorScheme.primary, CircleShape)
|
.background(MaterialTheme.colorScheme.primary, CircleShape)
|
||||||
) {
|
) {
|
||||||
Icon(
|
Icon(
|
||||||
@@ -111,7 +112,7 @@ fun PaperizeListItem(onGitHubClick: () -> Unit, onPlaystoreClick: () -> Unit, on
|
|||||||
IconButton(
|
IconButton(
|
||||||
onClick = onFdroidClick,
|
onClick = onFdroidClick,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.size(64.dp)
|
.size(60.dp)
|
||||||
.background(MaterialTheme.colorScheme.primary, CircleShape)
|
.background(MaterialTheme.colorScheme.primary, CircleShape)
|
||||||
) {
|
) {
|
||||||
Icon(
|
Icon(
|
||||||
|
|||||||
+8
-7
@@ -1,7 +1,5 @@
|
|||||||
package com.anthonyla.paperize.feature.wallpaper.presentation.wallpaper_screen
|
package com.anthonyla.paperize.feature.wallpaper.presentation.wallpaper_screen
|
||||||
|
|
||||||
import android.os.Build
|
|
||||||
import android.view.HapticFeedbackConstants
|
|
||||||
import androidx.compose.animation.AnimatedVisibility
|
import androidx.compose.animation.AnimatedVisibility
|
||||||
import androidx.compose.animation.fadeOut
|
import androidx.compose.animation.fadeOut
|
||||||
import androidx.compose.animation.slideInVertically
|
import androidx.compose.animation.slideInVertically
|
||||||
@@ -23,7 +21,6 @@ import androidx.compose.runtime.saveable.rememberSaveable
|
|||||||
import androidx.compose.runtime.setValue
|
import androidx.compose.runtime.setValue
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.platform.LocalView
|
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.hilt.navigation.compose.hiltViewModel
|
import androidx.hilt.navigation.compose.hiltViewModel
|
||||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||||
@@ -92,7 +89,8 @@ fun WallpaperScreen(
|
|||||||
}
|
}
|
||||||
onStop()
|
onStop()
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
animate = settingsState.value.animate
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
if (settingsState.value.animate) {
|
if (settingsState.value.animate) {
|
||||||
@@ -120,7 +118,8 @@ fun WallpaperScreen(
|
|||||||
checked = settingsState.value.setLockWithHome,
|
checked = settingsState.value.setLockWithHome,
|
||||||
onCheckedChange = { isChecked ->
|
onCheckedChange = { isChecked ->
|
||||||
settingsViewModel.onEvent(SettingsEvent.SetLockWithHome(isChecked))
|
settingsViewModel.onEvent(SettingsEvent.SetLockWithHome(isChecked))
|
||||||
}
|
},
|
||||||
|
animate = settingsState.value.animate
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -157,7 +156,8 @@ fun WallpaperScreen(
|
|||||||
checked = settingsState.value.setLockWithHome,
|
checked = settingsState.value.setLockWithHome,
|
||||||
onCheckedChange = { isChecked ->
|
onCheckedChange = { isChecked ->
|
||||||
settingsViewModel.onEvent(SettingsEvent.SetLockWithHome(isChecked))
|
settingsViewModel.onEvent(SettingsEvent.SetLockWithHome(isChecked))
|
||||||
}
|
},
|
||||||
|
animate = settingsState.value.animate
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -207,7 +207,8 @@ fun WallpaperScreen(
|
|||||||
}
|
}
|
||||||
wallpaperScreenViewModel.onEvent(WallpaperEvent.UpdateSelectedAlbum(newSelectedAlbum))
|
wallpaperScreenViewModel.onEvent(WallpaperEvent.UpdateSelectedAlbum(newSelectedAlbum))
|
||||||
onScheduleWallpaperChanger(settingsState.value.interval)
|
onScheduleWallpaperChanger(settingsState.value.interval)
|
||||||
}
|
},
|
||||||
|
animate = settingsState.value.animate
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
+10
-6
@@ -2,7 +2,6 @@ package com.anthonyla.paperize.feature.wallpaper.presentation.wallpaper_screen.c
|
|||||||
|
|
||||||
import androidx.compose.foundation.clickable
|
import androidx.compose.foundation.clickable
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.WindowInsets
|
|
||||||
import androidx.compose.foundation.layout.aspectRatio
|
import androidx.compose.foundation.layout.aspectRatio
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.layout.size
|
import androidx.compose.foundation.layout.size
|
||||||
@@ -47,7 +46,8 @@ fun AlbumBottomSheet(
|
|||||||
onDismiss: () -> Unit,
|
onDismiss: () -> Unit,
|
||||||
currentSelectedAlbum: SelectedAlbum?,
|
currentSelectedAlbum: SelectedAlbum?,
|
||||||
albums: List<AlbumWithWallpaperAndFolder>,
|
albums: List<AlbumWithWallpaperAndFolder>,
|
||||||
onSelect: (AlbumWithWallpaperAndFolder) -> Unit
|
onSelect: (AlbumWithWallpaperAndFolder) -> Unit,
|
||||||
|
animate: Boolean
|
||||||
) {
|
) {
|
||||||
val modalBottomSheetState = rememberModalBottomSheetState()
|
val modalBottomSheetState = rememberModalBottomSheetState()
|
||||||
val scope = rememberCoroutineScope()
|
val scope = rememberCoroutineScope()
|
||||||
@@ -55,7 +55,6 @@ fun AlbumBottomSheet(
|
|||||||
onDismissRequest = { onDismiss() },
|
onDismissRequest = { onDismiss() },
|
||||||
sheetState = modalBottomSheetState,
|
sheetState = modalBottomSheetState,
|
||||||
dragHandle = { BottomSheetDefaults.DragHandle() },
|
dragHandle = { BottomSheetDefaults.DragHandle() },
|
||||||
windowInsets = WindowInsets(0.dp)
|
|
||||||
) {
|
) {
|
||||||
albums.forEach {
|
albums.forEach {
|
||||||
ListItem(
|
ListItem(
|
||||||
@@ -97,9 +96,14 @@ fun AlbumBottomSheet(
|
|||||||
.transition(BitmapTransitionOptions.withCrossFade())
|
.transition(BitmapTransitionOptions.withCrossFade())
|
||||||
},
|
},
|
||||||
loading = {
|
loading = {
|
||||||
Box(modifier = Modifier.matchParentSize()) {
|
if (animate) {
|
||||||
CircularProgressIndicator(modifier = Modifier.align(
|
Box(modifier = Modifier.matchParentSize()) {
|
||||||
Alignment.Center))
|
CircularProgressIndicator(
|
||||||
|
modifier = Modifier.align(
|
||||||
|
Alignment.Center
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
|
|||||||
+6
-3
@@ -42,7 +42,8 @@ import com.skydoves.landscapist.glide.GlideImage
|
|||||||
fun CurrentSelectedAlbum(
|
fun CurrentSelectedAlbum(
|
||||||
selectedAlbum: SelectedAlbum?,
|
selectedAlbum: SelectedAlbum?,
|
||||||
onOpenBottomSheet: () -> Unit,
|
onOpenBottomSheet: () -> Unit,
|
||||||
onStop: () -> Unit
|
onStop: () -> Unit,
|
||||||
|
animate: Boolean
|
||||||
) {
|
) {
|
||||||
ListItem(
|
ListItem(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
@@ -82,8 +83,10 @@ fun CurrentSelectedAlbum(
|
|||||||
.transition(BitmapTransitionOptions.withCrossFade())
|
.transition(BitmapTransitionOptions.withCrossFade())
|
||||||
},
|
},
|
||||||
loading = {
|
loading = {
|
||||||
Box(modifier = Modifier.matchParentSize()) {
|
if (animate) {
|
||||||
CircularProgressIndicator(modifier = Modifier.align(Alignment.Center))
|
Box(modifier = Modifier.matchParentSize()) {
|
||||||
|
CircularProgressIndicator(modifier = Modifier.align(Alignment.Center))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
|
|||||||
+14
-3
@@ -33,7 +33,8 @@ import com.anthonyla.paperize.feature.wallpaper.presentation.album.components.Wa
|
|||||||
fun SetLockScreenSwitch(
|
fun SetLockScreenSwitch(
|
||||||
albumUri : String?,
|
albumUri : String?,
|
||||||
checked: Boolean,
|
checked: Boolean,
|
||||||
onCheckedChange: (Boolean) -> Unit
|
onCheckedChange: (Boolean) -> Unit,
|
||||||
|
animate: Boolean
|
||||||
) {
|
) {
|
||||||
Surface(
|
Surface(
|
||||||
tonalElevation = 10.dp,
|
tonalElevation = 10.dp,
|
||||||
@@ -75,7 +76,12 @@ fun SetLockScreenSwitch(
|
|||||||
onActivateSelectionMode = {},
|
onActivateSelectionMode = {},
|
||||||
onItemSelection = {},
|
onItemSelection = {},
|
||||||
onWallpaperViewClick = {},
|
onWallpaperViewClick = {},
|
||||||
modifier = Modifier.padding(4.dp).border(3.dp, color = Color.Black, shape = RoundedCornerShape(16.dp))
|
modifier = Modifier
|
||||||
|
.padding(4.dp)
|
||||||
|
.border(3.dp, color = Color.Black, shape = RoundedCornerShape(16.dp)),
|
||||||
|
aspectRatio = 9f / 19.5f,
|
||||||
|
clickable = false,
|
||||||
|
animate = animate
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -94,7 +100,12 @@ fun SetLockScreenSwitch(
|
|||||||
onActivateSelectionMode = {},
|
onActivateSelectionMode = {},
|
||||||
onItemSelection = {},
|
onItemSelection = {},
|
||||||
onWallpaperViewClick = {},
|
onWallpaperViewClick = {},
|
||||||
modifier = Modifier.padding(4.dp).border(3.dp, color = Color.Black, shape = RoundedCornerShape(16.dp))
|
modifier = Modifier
|
||||||
|
.padding(4.dp)
|
||||||
|
.border(3.dp, color = Color.Black, shape = RoundedCornerShape(16.dp)),
|
||||||
|
aspectRatio = 9f / 19.5f,
|
||||||
|
clickable = false,
|
||||||
|
animate = animate
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-2
@@ -43,6 +43,7 @@ import net.engawapg.lib.zoomable.zoomable
|
|||||||
fun WallpaperViewScreen(
|
fun WallpaperViewScreen(
|
||||||
wallpaperUri: String,
|
wallpaperUri: String,
|
||||||
onBackClick: () -> Unit,
|
onBackClick: () -> Unit,
|
||||||
|
animate : Boolean
|
||||||
) {
|
) {
|
||||||
val zoomState = rememberZoomState()
|
val zoomState = rememberZoomState()
|
||||||
BackHandler { onBackClick() }
|
BackHandler { onBackClick() }
|
||||||
@@ -98,8 +99,10 @@ fun WallpaperViewScreen(
|
|||||||
.transition(BitmapTransitionOptions.withCrossFade())
|
.transition(BitmapTransitionOptions.withCrossFade())
|
||||||
},
|
},
|
||||||
loading = {
|
loading = {
|
||||||
Box(modifier = Modifier.matchParentSize()) {
|
if (animate) {
|
||||||
CircularProgressIndicator(modifier = Modifier.align(Alignment.Center))
|
Box(modifier = Modifier.matchParentSize()) {
|
||||||
|
CircularProgressIndicator(modifier = Modifier.align(Alignment.Center))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
+50
-63
@@ -1,77 +1,64 @@
|
|||||||
package com.anthonyla.paperize.feature.wallpaper.util.navigation
|
package com.anthonyla.paperize.feature.wallpaper.util.navigation
|
||||||
|
|
||||||
import androidx.annotation.StringRes
|
import kotlinx.serialization.Serializable
|
||||||
import androidx.compose.material.icons.Icons
|
|
||||||
import androidx.compose.material.icons.filled.Add
|
|
||||||
import androidx.compose.material.icons.filled.BrowseGallery
|
|
||||||
import androidx.compose.material.icons.filled.Image
|
|
||||||
import androidx.compose.material.icons.filled.Newspaper
|
|
||||||
import androidx.compose.material.icons.filled.Notifications
|
|
||||||
import androidx.compose.material.icons.filled.PrivacyTip
|
|
||||||
import androidx.compose.material.icons.filled.Settings
|
|
||||||
import androidx.compose.material.icons.filled.Start
|
|
||||||
import androidx.compose.material.icons.outlined.Add
|
|
||||||
import androidx.compose.material.icons.outlined.BrowseGallery
|
|
||||||
import androidx.compose.material.icons.outlined.Image
|
|
||||||
import androidx.compose.material.icons.outlined.Newspaper
|
|
||||||
import androidx.compose.material.icons.outlined.Notifications
|
|
||||||
import androidx.compose.material.icons.outlined.PrivacyTip
|
|
||||||
import androidx.compose.material.icons.outlined.Settings
|
|
||||||
import androidx.compose.material.icons.outlined.Start
|
|
||||||
import androidx.compose.ui.graphics.vector.ImageVector
|
|
||||||
import com.anthonyla.paperize.R
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enum class for navigation screens in application
|
* Data class for Startup screen
|
||||||
*/
|
*/
|
||||||
sealed class NavScreens(val route: String, @StringRes val resourceId: Int, val unfilledIcon: ImageVector, val filledIcon: ImageVector) {
|
@Serializable
|
||||||
/**
|
object Startup
|
||||||
* Home screen that the user lands on initially
|
|
||||||
*/
|
|
||||||
object Startup : NavScreens("startup_screen", R.string.startup, Icons.Outlined.Start, Icons.Filled.Start)
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notification screen for the application to ask for permission
|
* Object for Notification screen
|
||||||
*/
|
*/
|
||||||
object Notification : NavScreens("notification_screen", R.string.notifications, Icons.Outlined.Notifications, Icons.Filled.Notifications)
|
@Serializable
|
||||||
|
object Notification
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Home screen that the user lands on initially containing the wallpapers and albums
|
* Object for Home screen
|
||||||
*/
|
*/
|
||||||
object Home : NavScreens("home_screen", R.string.home_screen, Icons.Outlined.Image, Icons.Filled.Image)
|
@Serializable
|
||||||
|
object Home
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Settings screen for the application
|
* Object for Settings screen
|
||||||
*/
|
*/
|
||||||
object Settings : NavScreens("settings_screen", R.string.settings_screen, Icons.Outlined.Settings, Icons.Filled.Settings)
|
@Serializable
|
||||||
|
object Settings
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* License screen for the application
|
* Object for Licenses screen
|
||||||
*/
|
*/
|
||||||
object Licenses : NavScreens("licenses_screen", R.string.licenses_screen, Icons.Outlined.Newspaper, Icons.Filled.Newspaper)
|
@Serializable
|
||||||
|
object Licenses
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Settings screen for the application
|
* Object for Privacy screen
|
||||||
*/
|
*/
|
||||||
object Privacy : NavScreens("privacy_screen", R.string.privacy_screen, Icons.Outlined.PrivacyTip, Icons.Filled.PrivacyTip)
|
@Serializable
|
||||||
|
object Privacy
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add/Edit screen for album when adding or editing
|
* Data class for AlbumView screen
|
||||||
*/
|
*/
|
||||||
object AddEdit : NavScreens("add_edit_screen", R.string.add_wallpaper_screen, Icons.Outlined.Add, Icons.Filled.Add)
|
@Serializable
|
||||||
|
data class AlbumView(val initialAlbumName: String)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wallpaper view screen for viewing wallpapers when clicking on a wallpaper
|
* Data class for AddEdit screen
|
||||||
*/
|
*/
|
||||||
object WallpaperView : NavScreens("wallpaper_view_screen", R.string.wallpaper_view, Icons.Outlined.BrowseGallery, Icons.Filled.BrowseGallery)
|
@Serializable
|
||||||
|
data class AddEdit(val wallpaper: String)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Folder view screen for viewing wallpapers in a folder when clicking on a folder
|
* Data class for WallpaperView screen
|
||||||
*/
|
*/
|
||||||
object FolderView : NavScreens("folder_view_screen", R.string.folder_view, Icons.Outlined.BrowseGallery, Icons.Filled.BrowseGallery)
|
@Serializable
|
||||||
|
data class WallpaperView(val wallpaper: String)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Album view screen for viewing albums when clicking on an album. Shows wallpapers and folders of the album
|
* Data class for FolderView screen
|
||||||
*/
|
*/
|
||||||
object AlbumView : NavScreens("album_view_screen", R.string.album_view, Icons.Outlined.BrowseGallery, Icons.Filled.BrowseGallery)
|
@Serializable
|
||||||
}
|
data class FolderView(val folderName: String?, val wallpapers: List<String>)
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
buildscript {
|
buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
|
mavenCentral()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -11,6 +12,7 @@ plugins {
|
|||||||
id("com.google.dagger.hilt.android") version "2.50" apply false
|
id("com.google.dagger.hilt.android") version "2.50" apply false
|
||||||
id("com.google.devtools.ksp") version "1.9.0-1.0.13" apply false
|
id("com.google.devtools.ksp") version "1.9.0-1.0.13" apply false
|
||||||
id ("com.mikepenz.aboutlibraries.plugin") version "11.1.3" apply false
|
id ("com.mikepenz.aboutlibraries.plugin") version "11.1.3" apply false
|
||||||
|
id ("org.jetbrains.kotlin.plugin.serialization") version "1.9.22" apply false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user