Compare commits

..
2 Commits
Author SHA1 Message Date
Anthonyy232 c97f9f7e3d Fixed crash due to importing folder caused by type-safe navigation compose bug
Updated version number and version code for 1.0.1
2024-05-09 12:53:37 -07:00
Anthonyy232 4429355a1e Added metadata information to project 2024-05-08 22:28:24 -07:00
18 changed files with 161 additions and 25 deletions

No files matched your search

+2 -2
View File
@@ -17,8 +17,8 @@ android {
applicationId = "com.anthonyla.paperize"
minSdk = 26
targetSdk = 34
versionCode = 4
versionName = "1.0.0"
versionCode = 5
versionName = "1.0.1"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
@@ -11,9 +11,11 @@ import androidx.compose.ui.platform.LocalContext
import androidx.core.content.ContextCompat
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import androidx.navigation.NavType
import androidx.navigation.compose.NavHost
import androidx.navigation.compose.composable
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.Wallpaper
@@ -37,10 +39,10 @@ import com.anthonyla.paperize.feature.wallpaper.presentation.wallpaper_screen.Wa
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.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
@@ -49,6 +51,12 @@ 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.sharedXTransitionOut
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
fun PaperizeApp(
@@ -242,11 +250,18 @@ fun PaperizeApp(
initialAlbumName = addEdit.wallpaper,
onBackClick = { navController.navigateUp() },
onConfirmation = { navController.navigateUp() },
onShowWallpaperView = { wallpaper ->
navController.navigate(WallpaperView(wallpaper))
onShowWallpaperView = {
navController.navigate(WallpaperView(it))
},
onShowFolderView = { folderName, wallpapers ->
navController.navigate(FolderView(folderName, wallpapers))
/*navController.navigate(
com.anthonyla.paperize.feature.wallpaper.util.navigation.FolderView(
folderName,
wallpapers
)
)*/
val encodedWallpapers = runBlocking { encodeUri(uri = Gson().toJson(wallpapers)) }
navController.navigate("${NavScreens.FolderView.route}/$folderName/$encodedWallpapers")
}
)
}
@@ -273,7 +288,7 @@ fun PaperizeApp(
)
}
// Navigate to folder view screen to view wallpapers in a particular folder
composable<FolderView> (
/*composable<FolderView> (
enterTransition = {
sharedXTransitionIn(initial = { (it * INITIAL_OFFSET).toInt() })
},
@@ -288,15 +303,53 @@ fun PaperizeApp(
},
) { 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
)
if (folderView.wallpapers.isNotEmpty()) {
FolderViewScreen(
folderName = folderView.folderName,
wallpapers = folderView.wallpapers,
onBackClick = { navController.navigateUp() },
onShowWallpaperView = {
navController.navigate(WallpaperView(it))
},
animate = settingsState.value.animate
)
} else { navController.navigateUp() }
}*/
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()
if (wallpapers.isNotEmpty()) {
FolderViewScreen(
folderName = folderName,
wallpapers = wallpapers,
onBackClick = { navController.navigateUp() },
onShowWallpaperView = {
navController.navigate(WallpaperView(it))
},
animate = settingsState.value.animate
)
} else { navController.navigateUp() }
}
// Navigate to the album view screen to view folders and wallpapers in an album
composable<AlbumView> (
@@ -323,7 +376,14 @@ fun PaperizeApp(
navController.navigate(WallpaperView(it))
},
onShowFolderView = { folderName, wallpapers ->
navController.navigate(FolderView(folderName, wallpapers))
/*navController.navigate(
com.anthonyla.paperize.feature.wallpaper.util.navigation.FolderView(
folderName,
wallpapers
)
)*/
val encodedWallpapers = runBlocking { encodeUri(uri = Gson().toJson(wallpapers)) }
navController.navigate("${NavScreens.FolderView.route}/$folderName/$encodedWallpapers")
},
onDeleteAlbum = {
albumsViewModel.onEvent(AlbumsEvent.DeleteAlbumWithWallpapers(albumWithWallpaper))
@@ -430,4 +490,10 @@ 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())
}
@@ -3,7 +3,6 @@ package com.anthonyla.paperize.feature.wallpaper.presentation.add_album_screen
import android.app.Application
import android.content.Context
import android.webkit.MimeTypeMap
import androidx.core.net.toUri
import androidx.lifecycle.AndroidViewModel
import androidx.lifecycle.viewModelScope
@@ -274,9 +273,8 @@ class AddAlbumViewModel @Inject constructor(
if (file.isDirectory()) {
files.addAll(listFilesRecursive(file, context))
} else {
val extension = MimeTypeMap.getFileExtensionFromUrl(file.uri.toString())
val allowedExtensions = listOf("jpg", "png", "heif", "webp")
if (extension in allowedExtensions) {
if (file.extension in allowedExtensions) {
files.add(file.uri.toString())
}
}
@@ -63,7 +63,7 @@ fun PaperizeListItem(onGitHubClick: () -> Unit, onPlaystoreClick: () -> Unit, on
fontSize = MaterialTheme.typography.titleLarge.fontSize
)
Text(
text = "Version: 1.0.0",
text = "Version: 1.0.1",
style = MaterialTheme.typography.bodySmall,
fontSize = MaterialTheme.typography.bodyMedium.fontSize
)
@@ -57,8 +57,11 @@ data class AddEdit(val wallpaper: String)
@Serializable
data class WallpaperView(val wallpaper: String)
/**
/** Reverted back to passing JSON due to bug in navigation compose causing crash
* Data class for FolderView screen
*/
@Serializable
data class FolderView(val folderName: String?, val wallpapers: List<String>)
data class FolderView(val folderName: String?, val wallpapers: List<String>)
*/
sealed class NavScreens(val route: String) {
data object FolderView : NavScreens("folder_view_screen")
}
@@ -0,0 +1,4 @@
v0.1.0-alpha
The main feature of the app is operational and ready for use
There are a few minor features that are missing that will be added in v1.0.0 stable release
Create an issue if there are any bugs
@@ -0,0 +1,9 @@
v0.2.0-alpha
Cleaned code and allow adding to previously created albums.
Added functionality to add more wallpapers and folders to already created albums
Refactored some old code to be cleaner
Create an issue if there are any bugs or email me (GitHub profile)
Planning
Add an app icon 😆
Look into whether live wallpaper using WallpaperManager (WallpaperManager.ACTION_LIVE_WALLPAPER_CHOOSER) would work well/be realistic
+6
View File
@@ -0,0 +1,6 @@
v0.3.0
Added app icon and GitHub redirect in settings page
Planning
Look into whether live wallpaper using WallpaperManager (WallpaperManager.ACTION_LIVE_WALLPAPER_CHOOSER) would work well/be realistic
It would drain too much battery. Video/GIF wallpaper is also not possible with current WallpaperManager APIs without using live wallpaper
+7
View File
@@ -0,0 +1,7 @@
v1.0.0
Updated dependencies, refactored code for more efficient and cleaner code
Added reset option in the settings
Fixed issue with using other images format other than JPG (now supports JPEG, PNG, AVIF, WEBP and perhaps more, untested)
Fixed issue where the app would instantly crash if the content URIs were not cleared when uninstalling and reinstalling
Planning
Nothing at the moment. Give me your suggestions!
+42
View File
@@ -0,0 +1,42 @@
Paperize is a dynamic wallpaper changer application designed to keep your device's aesthetic fresh and exciting
------
Dynamic Wallpaper Changer: Set your wallpaper to change at specific time intervals
Supports Various Image Types: Paperize can handle a wide range of image types
JPEG, PNG, AVIF, WEBP
Folder Support: Organize your wallpapers into folders for auto-updating
Home and Lock Screen Wallpaper: Choose to change either your home screen, lock screen, or both
On-Device Storage: All your wallpapers and settings are stored on your device
------
Technologies
Kotlin - A programming language that is used for Android app development
Jetpack Compose - A declarative UI toolkit for building native Android UI
Material 3 - A UI design system git for modern UI guidelines
Dagger Hilt - A dependency injection library
Room - A persistence library that provides an abstraction layer over SQLite interfacing with Kotlin
AboutLibraries - A library to offer some information of libraries
Lottie Compose - A library that provides Lottie animation support for Jetpack Compose
Landscapist - A Compose and KPP image loading library that streamlines Glide, Coil, and Fresco
Zoomable - A library that provides a zoomable and pannable view, which can be used with any view you want
AnimatedFABMenu - A animated floating action button with Material 3 design
Thanks to the creators and maintainers of the open-source libraries used in this project.
------
Build
This project is built using Kotlin, Java, and Gradle. Here are the steps to build the project:
Prerequisites
Java 8 (1.8)
Android Studio Jellyfish | 2023.3.1 or later
Gradle 8.4.0 or later
Minimum SDK 26
Steps
Open a terminal and run the following git command:
git clone https://github.com/Anthonyy232/Paperize.git
Launch Android Studio and choose Open an existing Android Studio project. Navigate to the cloned repository and select the root folder of the project.
In Android Studio, click on Build -> Generate Signed Bundle / APK and follow the instructions to generate an APK
Alternatively, click ▶ Run and build the app and run it immediately
------
Contributions
All contributions to the app is welcome. Feel free to report any issues and create pull requests for any issues or pull requests.
------
License
Contact on my GitHub profile
Paperize © GNU GPL v3.0
Binary file not shown.

After

Width:  |  Height:  |  Size: 274 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 187 KiB

+1
View File
@@ -0,0 +1 @@
Paperize is a dynamic wallpaper changer application designed to keep your device's aesthetic fresh and exciting