Compare commits

..
14 Commits
Author SHA1 Message Date
Anthonyy232 e5fab5cb5e Updated version code 2024-07-23 09:52:07 -07:00
Anthonyy232 5fd233e790 Added AMOLED dark mode setting
Reverted lazy column back to column due to stutter
2024-07-22 18:25:02 -07:00
Anthonyy232 48a730e4a9 Fixed WallpaperBootAndChangeReceiver not changing wallpaper immediately
Refactored WallpaperAlarmSchedulerImpl.kt name
2024-07-19 20:28:29 -07:00
Anthonyy232 4c3d5af7f7 Removed FAB animation when scrolling due to recomposition inefficiency
Refactored viewmodel injection code
Changed column to lazy column on WallpaperScreen.kt
2024-07-17 22:42:10 -07:00
Anthonyy232 829d982d23 Refactored albums viewmodel injecting 2024-07-16 23:34:34 -07:00
Anthonyy232 b01b9a87d6 Updated version code 2024-07-12 10:38:18 -07:00
Anthony La c4395b364c Merge pull request #31 from Anthonyy232/renovate/com.android.application-8.x
Update plugin com.android.application to v8.5.1
2024-07-12 10:33:05 -07:00
renovate[bot] dc1f8b9802 Update plugin com.android.application to v8.5.1 2024-07-12 17:32:59 +00:00
Anthony La 4279dd3be7 Merge pull request #30 from Anthonyy232/renovate/gradle-8.x
Update dependency gradle to v8.9
2024-07-12 10:32:34 -07:00
Anthony La 373f784fb6 Merge pull request #32 from Anthonyy232/renovate/com.google.devtools.ksp-2.x
Update plugin com.google.devtools.ksp to v2.0.0-1.0.23
2024-07-12 10:32:13 -07:00
Anthony La fe12b2116c Merge pull request #33 from Anthonyy232/renovate/com.android.library-8.x
Update plugin com.android.library to v8.5.1
2024-07-12 10:32:03 -07:00
renovate[bot] 9f906aa11c Update plugin com.android.library to v8.5.1 2024-07-12 00:30:16 +00:00
renovate[bot] e20b3c7c49 Update plugin com.google.devtools.ksp to v2.0.0-1.0.23 2024-07-11 21:48:28 +00:00
renovate[bot] 9bab8ad4b6 Update dependency gradle to v8.9 2024-07-11 15:33:27 +00:00
31 changed files with 328 additions and 243 deletions

No files matched your search

+1 -1
View File
@@ -65,7 +65,7 @@ This project is built using Kotlin, Java, and Gradle. Here are the steps to buil
- Java 8 (1.8)
- Android Studio Jellyfish | 2024.1.1 or later
- Android Gradle Plugin 8.5.0 or later
- Gradle 8.8
- Gradle 8.9
- Minimum SDK 26
### Steps
+2 -2
View File
@@ -19,8 +19,8 @@ android {
applicationId = "com.anthonyla.paperize"
minSdk = 26
targetSdk = 34
versionCode = 25
versionName = "1.6.0"
versionCode = 28
versionName = "1.6.3"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
useSupportLibrary = true
@@ -6,6 +6,7 @@ package com.anthonyla.paperize.core
object SettingsConstants {
const val SETTINGS_DATASTORE = "settings_datastore"
const val DARK_MODE_TYPE = "dark_mode_type"
const val AMOLED_THEME_TYPE = "amoled_theme_type"
const val DYNAMIC_THEME_TYPE = "dynamic_theme_type"
const val ANIMATE_TYPE = "animate_type"
const val ENABLE_CHANGER = "enable_changer"
@@ -42,7 +42,7 @@ import com.anthonyla.paperize.feature.wallpaper.presentation.wallpaper_screen.Wa
import com.anthonyla.paperize.feature.wallpaper.presentation.wallpaper_screen.WallpaperScreenViewModel
import com.anthonyla.paperize.feature.wallpaper.wallpaper_alarmmanager.WallpaperAlarmItem
import com.anthonyla.paperize.feature.wallpaper.wallpaper_alarmmanager.WallpaperReceiver
import com.anthonyla.paperize.feature.wallpaper.wallpaper_alarmmanager.WallpaperScheduler
import com.anthonyla.paperize.feature.wallpaper.wallpaper_alarmmanager.WallpaperAlarmSchedulerImpl
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking
@@ -81,7 +81,7 @@ class MainActivity : ComponentActivity() {
splashScreen.setKeepOnScreenCondition { settingsViewModel.setKeepOnScreenCondition }
setContent {
val scheduler = WallpaperScheduler(context)
val scheduler = WallpaperAlarmSchedulerImpl(context)
val settingsState = settingsViewModel.state.collectAsStateWithLifecycle()
val isFirstLaunch = runBlocking { settingsDataStoreImpl.getBoolean(SettingsConstants.FIRST_LAUNCH) } ?: true
if (isFirstLaunch) {
@@ -117,7 +117,7 @@ class MainActivity : ComponentActivity() {
}
}
PaperizeTheme(settingsState.value.darkMode, settingsState.value.dynamicTheming) {
PaperizeTheme(settingsState.value.darkMode, settingsState.value.amoledTheme, settingsState.value.dynamicTheming) {
Surface(tonalElevation = 5.dp) {
PaperizeApp(isFirstLaunch, scheduler, topInset)
}
@@ -55,7 +55,7 @@ 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.wallpaper_alarmmanager.WallpaperAlarmItem
import com.anthonyla.paperize.feature.wallpaper.wallpaper_alarmmanager.WallpaperScheduler
import com.anthonyla.paperize.feature.wallpaper.wallpaper_alarmmanager.WallpaperAlarmSchedulerImpl
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job
import kotlinx.coroutines.delay
@@ -65,7 +65,7 @@ import kotlinx.coroutines.withContext
@Composable
fun PaperizeApp(
firstLaunch: Boolean,
scheduler : WallpaperScheduler,
scheduler : WallpaperAlarmSchedulerImpl,
topInsets: Dp,
albumsViewModel: AlbumsViewModel = hiltViewModel(),
settingsViewModel: SettingsViewModel = hiltViewModel(),
@@ -232,6 +232,7 @@ fun PaperizeApp(
}
) {
HomeScreen(
albums = albumState.value.albumsWithWallpapers,
onSettingsClick = { navController.navigate(Settings) },
navigateToAddWallpaperScreen = {
navController.navigate(AddEdit(it))
@@ -558,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
@@ -654,6 +656,7 @@ fun PaperizeApp(
if (albumWithWallpaper != null) {
AlbumViewScreen(
album = albumWithWallpaper,
animate = settingsState.value.animate,
onBackClick = { navController.navigateUp() },
onShowWallpaperView = {
navController.navigate(WallpaperView(it))
@@ -704,6 +707,9 @@ fun PaperizeApp(
onDarkModeClick = {
settingsViewModel.onEvent(SettingsEvent.SetDarkMode(it))
},
onAmoledClick = {
settingsViewModel.onEvent(SettingsEvent.SetAmoledTheme(it))
},
onDynamicThemingClick = {
settingsViewModel.onEvent(SettingsEvent.SetDynamicTheming(it))
},
@@ -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<String>) -> Unit
onShowFolderView: (String?, List<String>) -> 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
)
}
}
@@ -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) {
@@ -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) {
@@ -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)
@@ -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<String>) -> 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),
@@ -32,6 +32,7 @@ import com.anthonyla.paperize.feature.wallpaper.presentation.wallpaper_screen.Wa
@Composable
fun HomeScreen(
albums: List<AlbumWithWallpaperAndFolder>,
animate : Boolean,
darken: Boolean,
darkenPercentage: Int,
@@ -131,6 +132,7 @@ fun HomeScreen(
) { index ->
when(index.coerceIn(tabItems.indices)) {
0 -> WallpaperScreen(
albums = albums,
animate = animate,
darken = darken,
darkenPercentage = darkenPercentage,
@@ -163,6 +165,7 @@ fun HomeScreen(
blurPercentage = blurPercentage
)
else -> LibraryScreen(
albums = albums,
onAddNewAlbumClick = { addAlbumDialog = true },
onViewAlbum = onAlbumViewClick,
animate = animate
@@ -18,21 +18,18 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.anthonyla.paperize.R
import com.anthonyla.paperize.feature.wallpaper.presentation.album.AlbumsViewModel
import com.anthonyla.paperize.feature.wallpaper.domain.model.AlbumWithWallpaperAndFolder
import com.anthonyla.paperize.feature.wallpaper.presentation.album.components.AlbumItem
@Composable
fun LibraryScreen(
albumsViewModel: AlbumsViewModel = hiltViewModel(),
albums: List<AlbumWithWallpaperAndFolder>,
onAddNewAlbumClick: () -> Unit,
onViewAlbum: (String) -> Unit,
animate: Boolean
) {
val lazyListState = rememberLazyGridState()
val state = albumsViewModel.state.collectAsStateWithLifecycle()
Scaffold(
modifier = Modifier.fillMaxSize(),
floatingActionButton = {
@@ -56,7 +53,7 @@ fun LibraryScreen(
contentPadding = PaddingValues(4.dp, 4.dp),
horizontalArrangement = Arrangement.Start,
content = {
items (state.value.albumsWithWallpapers, key = { album -> album.album.initialAlbumName}
items (albums, key = { album -> album.album.initialAlbumName}
) { album ->
AlbumItem(
album = album.album,
@@ -9,6 +9,7 @@ sealed class SettingsEvent {
data object SetFirstLaunch: SettingsEvent()
data object RefreshNextSetTime: SettingsEvent()
data class SetDarkMode(val darkMode: Boolean?): SettingsEvent()
data class SetAmoledTheme(val amoledTheme: Boolean): SettingsEvent()
data class SetDynamicTheming(val dynamicTheming: Boolean): SettingsEvent()
data class SetAnimate(val animate: Boolean): SettingsEvent()
data class SetDarken(val darken: Boolean): SettingsEvent()
@@ -22,6 +22,7 @@ fun SettingsScreen(
topInsets: Dp,
onBackClick: () -> Unit,
onDarkModeClick: (Boolean?) -> Unit,
onAmoledClick: (Boolean) -> Unit,
onDynamicThemingClick: (Boolean) -> Unit,
onAnimateClick: (Boolean) -> Unit,
onPrivacyClick: () -> Unit,
@@ -39,12 +40,13 @@ fun SettingsScreen(
largeTopAppBarHeightPx = largeTopAppBarHeight,
scroll = scroll,
onDarkModeClick = onDarkModeClick,
onAmoledClick = onAmoledClick,
onDynamicThemingClick = onDynamicThemingClick,
onAnimateClick = onAnimateClick,
onPrivacyClick = onPrivacyClick,
onLicenseClick = onLicenseClick,
onResetClick = onResetClick,
onBackClick = onBackClick,
onBackClick = onBackClick
)
SettingsTitle(
scroll = scroll,
@@ -6,6 +6,7 @@ data class SettingsState(
val firstLaunch: Boolean = true,
// App settings
val darkMode: Boolean? = null,
val amoledTheme: Boolean = false,
val dynamicTheming: Boolean = false,
val animate: Boolean = true,
// Wallpaper settings
@@ -36,6 +36,7 @@ class SettingsViewModel @Inject constructor (
currentGetJob = viewModelScope.launch(Dispatchers.IO) {
val firstLaunch = async { settingsDataStoreImpl.getBoolean(SettingsConstants.FIRST_LAUNCH) ?: true }
val darkMode = async { settingsDataStoreImpl.getBoolean(SettingsConstants.DARK_MODE_TYPE) }
val amoledTheme = async { settingsDataStoreImpl.getBoolean(SettingsConstants.AMOLED_THEME_TYPE) ?: false }
val dynamicTheming = async { settingsDataStoreImpl.getBoolean(SettingsConstants.DYNAMIC_THEME_TYPE) ?: false }
val enableChanger = async { settingsDataStoreImpl.getBoolean(SettingsConstants.ENABLE_CHANGER) ?: true }
val setHomeWallpaper = async { settingsDataStoreImpl.getBoolean(SettingsConstants.HOME_WALLPAPER) ?: false }
@@ -55,6 +56,7 @@ class SettingsViewModel @Inject constructor (
_state.update {
it.copy(
darkMode = darkMode.await(),
amoledTheme = amoledTheme.await(),
dynamicTheming = dynamicTheming.await(),
homeInterval = homeWallpaperInterval.await(),
lockInterval = lockWallpaperInterval.await(),
@@ -104,6 +106,7 @@ class SettingsViewModel @Inject constructor (
is SettingsEvent.Refresh -> {
currentGetJob = viewModelScope.launch(Dispatchers.IO) {
val darkMode = async { settingsDataStoreImpl.getBoolean(SettingsConstants.DARK_MODE_TYPE) }
val amoledTheme = async { settingsDataStoreImpl.getBoolean(SettingsConstants.AMOLED_THEME_TYPE) ?: false }
val dynamicTheming = async { settingsDataStoreImpl.getBoolean(SettingsConstants.DYNAMIC_THEME_TYPE) ?: false }
val firstLaunch = async { settingsDataStoreImpl.getBoolean(SettingsConstants.FIRST_LAUNCH) ?: true }
val lastSetTime = async { settingsDataStoreImpl.getString(SettingsConstants.LAST_SET_TIME) }
@@ -122,6 +125,7 @@ class SettingsViewModel @Inject constructor (
_state.update {
it.copy(
darkMode = darkMode.await(),
amoledTheme = amoledTheme.await(),
dynamicTheming = dynamicTheming.await(),
firstLaunch = firstLaunch.await(),
lastSetTime = lastSetTime.await(),
@@ -157,11 +161,30 @@ class SettingsViewModel @Inject constructor (
}
}
is SettingsEvent.SetAmoledTheme -> {
viewModelScope.launch(Dispatchers.IO) {
settingsDataStoreImpl.putBoolean(SettingsConstants.AMOLED_THEME_TYPE, event.amoledTheme)
if (event.amoledTheme) {
settingsDataStoreImpl.putBoolean(SettingsConstants.DYNAMIC_THEME_TYPE, false)
}
_state.update {
it.copy(
amoledTheme = event.amoledTheme,
dynamicTheming = if (event.amoledTheme) false else it.dynamicTheming
)
}
}
}
is SettingsEvent.SetDynamicTheming -> {
viewModelScope.launch(Dispatchers.IO) {
settingsDataStoreImpl.putBoolean(SettingsConstants.DYNAMIC_THEME_TYPE, event.dynamicTheming)
if (event.dynamicTheming) {
settingsDataStoreImpl.putBoolean(SettingsConstants.AMOLED_THEME_TYPE, false)
}
_state.update {
it.copy(
amoledTheme = if (event.dynamicTheming) false else it.amoledTheme,
dynamicTheming = event.dynamicTheming
)
}
@@ -354,6 +377,7 @@ class SettingsViewModel @Inject constructor (
is SettingsEvent.Reset -> {
viewModelScope.launch(Dispatchers.IO) {
settingsDataStoreImpl.deleteBoolean(SettingsConstants.DARK_MODE_TYPE)
settingsDataStoreImpl.deleteBoolean(SettingsConstants.AMOLED_THEME_TYPE)
settingsDataStoreImpl.deleteBoolean(SettingsConstants.DYNAMIC_THEME_TYPE)
settingsDataStoreImpl.deleteBoolean(SettingsConstants.FIRST_LAUNCH)
settingsDataStoreImpl.deleteString(SettingsConstants.LAST_SET_TIME)
@@ -377,6 +401,7 @@ class SettingsViewModel @Inject constructor (
_state.update {
it.copy(
darkMode = null,
amoledTheme = false,
dynamicTheming = false,
firstLaunch = true,
lastSetTime = null,
@@ -0,0 +1,61 @@
package com.anthonyla.paperize.feature.wallpaper.presentation.settings_screen.components
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.DarkMode
import androidx.compose.material3.Icon
import androidx.compose.material3.ListItem
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Switch
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.semantics.contentDescription
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.unit.dp
import com.anthonyla.paperize.R
/**
* AMOLED list item to enable AMOLED mode
*/
@Composable
fun AmoledListItem(amoledMode: Boolean, onAmoledClick: (Boolean) -> Unit) {
val context = LocalContext.current
Row {
ListItem(
modifier = Modifier
.clip(RoundedCornerShape(16.dp))
.clickable { onAmoledClick(!amoledMode) },
headlineContent = {
Text(
text = stringResource(R.string.amoled_mode),
style = MaterialTheme.typography.titleMedium
) },
supportingContent = {
Text(
text = stringResource(R.string.full_dark_mode),
style = MaterialTheme.typography.bodySmall
) },
trailingContent = {
Switch(
modifier = Modifier.semantics { contentDescription = context.getString(R.string.amoled_mode) },
checked = amoledMode,
onCheckedChange = onAmoledClick,
enabled = true
) },
leadingContent = {
Icon(
Icons.Filled.DarkMode,
contentDescription = stringResource(R.string.amoled_mode),
tint = MaterialTheme.colorScheme.primary
) },
tonalElevation = 5.dp
)
}
}
@@ -15,7 +15,6 @@ import androidx.compose.material.icons.outlined.Brightness6
import androidx.compose.material.icons.outlined.BrightnessAuto
import androidx.compose.material.icons.outlined.DarkMode
import androidx.compose.material.icons.outlined.LightMode
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
import androidx.compose.material3.ListItem
import androidx.compose.material3.MaterialTheme
@@ -38,7 +37,6 @@ import com.anthonyla.paperize.R
/**
* Three-state selector for dark mode in settings
*/
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun DarkModeListItem(darkMode: Boolean?, onDarkModeClick: (Boolean?) -> Unit) {
val options = listOf(
@@ -77,7 +75,7 @@ fun DarkModeListItem(darkMode: Boolean?, onDarkModeClick: (Boolean?) -> Unit) {
},
headlineContent = {
Text(
text = stringResource(R.string.dark_mode),
text = stringResource(R.string.theme),
style = MaterialTheme.typography.titleMedium
) },
@@ -1,5 +1,6 @@
package com.anthonyla.paperize.feature.wallpaper.presentation.settings_screen.components
import android.annotation.SuppressLint
import android.content.Intent
import android.net.Uri
import androidx.compose.foundation.ScrollState
@@ -47,6 +48,7 @@ import kotlinx.coroutines.launch
/**
* Scrollable settings screen to wrap all settings components
*/
@SuppressLint("UnusedMaterial3ScaffoldPaddingParameter")
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun SettingsScrollableSettings(
@@ -55,11 +57,12 @@ fun SettingsScrollableSettings(
scroll: ScrollState,
onDynamicThemingClick: (Boolean) -> Unit,
onDarkModeClick: (Boolean?) -> Unit,
onAmoledClick: (Boolean) -> Unit,
onAnimateClick: (Boolean) -> Unit,
onPrivacyClick: () -> Unit,
onLicenseClick: () -> Unit,
onResetClick: () -> Unit,
onBackClick: () -> Unit
onBackClick: () -> Unit,
) {
val state = settingsState.collectAsStateWithLifecycle()
val context = LocalContext.current
@@ -108,7 +111,7 @@ fun SettingsScrollableSettings(
)
},
modifier = Modifier.fillMaxSize(),
content = { it
content = {
Column(
horizontalAlignment = Alignment.Start,
verticalArrangement = Arrangement.Top,
@@ -127,11 +130,17 @@ fun SettingsScrollableSettings(
onDarkModeClick = { onDarkModeClick(it) }
)
Spacer(modifier = Modifier.height(16.dp))
if (state.value.darkMode == null || state.value.darkMode == true) {
AmoledListItem(
amoledMode = state.value.amoledTheme,
onAmoledClick = { onAmoledClick(it) }
)
Spacer(modifier = Modifier.height(16.dp))
}
DynamicThemingListItem(
dynamicTheming = state.value.dynamicTheming,
onDynamicThemingClick = { onDynamicThemingClick(it) }
)
Spacer(modifier = Modifier.height(16.dp))
AnimationListItem(
animate = state.value.animate,
@@ -10,6 +10,7 @@ import androidx.compose.material3.dynamicLightColorScheme
import androidx.compose.material3.lightColorScheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.SideEffect
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalView
import androidx.core.view.WindowCompat
@@ -80,6 +81,38 @@ private val DarkColors = darkColorScheme(
scrim = md_theme_dark_scrim,
)
private val AmoledDarkColors = darkColorScheme(
primary = md_theme_light_primary,
onPrimary = md_theme_light_onPrimary,
primaryContainer = md_theme_light_primaryContainer,
onPrimaryContainer = md_theme_light_onPrimaryContainer,
secondary = Color.Black,
onSecondary = Color.White,
secondaryContainer = Color.Black,
onSecondaryContainer = Color.White,
tertiary = md_theme_light_tertiary,
onTertiary = md_theme_light_onTertiary,
tertiaryContainer = Color.Black,
onTertiaryContainer = Color.White,
error = Color.Red,
errorContainer = Color.Black,
onError = Color.White,
onErrorContainer = Color.Black,
background = Color.Black,
onBackground = Color.White,
surface = Color.Black,
onSurface = Color.White,
surfaceVariant = Color.Black,
onSurfaceVariant = Color.White,
outline = Color.White,
inverseOnSurface = Color.Black,
inverseSurface = Color.White,
inversePrimary = Color.White,
surfaceTint = Color.Black,
outlineVariant = md_theme_dark_outlineVariant,
scrim = md_theme_dark_scrim,
)
/**
* App theming for dynamic theming when supported and dark mode.
@@ -87,6 +120,7 @@ private val DarkColors = darkColorScheme(
@Composable
fun PaperizeTheme(
darkMode: Boolean?,
amoledMode: Boolean,
dynamicTheming: Boolean,
content: @Composable () -> Unit
) {
@@ -97,7 +131,8 @@ fun PaperizeTheme(
val colors = when {
isDynamicTheming && dynamicThemingSupported && isDarkMode -> dynamicDarkColorScheme(context)
isDynamicTheming && dynamicThemingSupported && !isDarkMode -> dynamicLightColorScheme(context)
isDarkMode -> DarkColors
isDarkMode && amoledMode -> AmoledDarkColors
isDarkMode && !amoledMode -> DarkColors
else -> LightColors
}
@@ -33,13 +33,10 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.unit.dp
import androidx.core.content.ContextCompat
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.anthonyla.paperize.R
import com.anthonyla.paperize.core.ScalingConstants
import com.anthonyla.paperize.feature.wallpaper.domain.model.AlbumWithWallpaperAndFolder
import com.anthonyla.paperize.feature.wallpaper.domain.model.SelectedAlbum
import com.anthonyla.paperize.feature.wallpaper.presentation.album.AlbumsViewModel
import com.anthonyla.paperize.feature.wallpaper.presentation.wallpaper_screen.components.AlbumBottomSheet
import com.anthonyla.paperize.feature.wallpaper.presentation.wallpaper_screen.components.BlurSwitchAndSlider
import com.anthonyla.paperize.feature.wallpaper.presentation.wallpaper_screen.components.ChangerSelectionRow
@@ -53,7 +50,7 @@ import kotlinx.coroutines.launch
@Composable
fun WallpaperScreen(
albumsViewModel: AlbumsViewModel = hiltViewModel(),
albums: List<AlbumWithWallpaperAndFolder>,
animate: Boolean,
darken: Boolean,
darkenPercentage: Int,
@@ -85,14 +82,13 @@ fun WallpaperScreen(
onBlurChange: (Boolean) -> Unit,
blurPercentage: Int
) {
val scrollState = rememberScrollState()
val context = LocalContext.current
val albumState = albumsViewModel.state.collectAsStateWithLifecycle()
var openBottomSheet by rememberSaveable { mutableStateOf(false) }
val scope = rememberCoroutineScope()
val snackbarHostState = remember { SnackbarHostState() }
val openLiveDialog = rememberSaveable { mutableStateOf(false) }
val showInterval = rememberSaveable { mutableStateOf(false) }
val scrollState = rememberScrollState()
if (openLiveDialog.value) {
ShowLiveWallpaperEnabledDialog(
@@ -116,9 +112,9 @@ fun WallpaperScreen(
content = { padding ->
Column(
modifier = Modifier
.verticalScroll(scrollState)
.fillMaxSize()
.padding(8.dp)
.verticalScroll(scrollState),
.padding(8.dp),
horizontalAlignment = Alignment.CenterHorizontally
) {
ChangerSelectionRow(
@@ -131,7 +127,7 @@ fun WallpaperScreen(
CurrentSelectedAlbum(
selectedAlbum = selectedAlbum,
onOpenBottomSheet = {
if (albumState.value.albumsWithWallpapers.firstOrNull() != null) {
if (albums.firstOrNull() != null) {
if (isLiveWallpaperSet(context)) {
openLiveDialog.value = true
} else {
@@ -342,7 +338,7 @@ fun WallpaperScreen(
}
if (((homeEnabled || lockEnabled)) && openBottomSheet) {
AlbumBottomSheet(
albums = albumState.value.albumsWithWallpapers,
albums = albums,
currentSelectedAlbum = selectedAlbum,
onDismiss = { openBottomSheet = false },
onSelect = { album ->
@@ -16,7 +16,7 @@ import java.time.ZoneId
* It uses the AlarmManager to schedule alarms for the WallpaperReceiver.
* It also uses the WallpaperService to change the wallpaper due to receiver limitations.
*/
class WallpaperScheduler (
class WallpaperAlarmSchedulerImpl (
private val context: Context,
): WallpaperAlarmScheduler {
private val alarmManager = context.getSystemService(Context.ALARM_SERVICE) as AlarmManager
@@ -23,7 +23,7 @@ class WallpaperBootAndChangeReceiver : BroadcastReceiver() {
@SuppressLint("UnsafeProtectedBroadcastReceiver")
override fun onReceive(context: Context, intent: Intent) = goAsync {
try {
val scheduler = WallpaperScheduler(context)
val scheduler = WallpaperAlarmSchedulerImpl(context)
val toggleChanger = settingsDataStoreImpl.getBoolean(SettingsConstants.ENABLE_CHANGER) ?: false
if (toggleChanger) {
val timeInMinutes1 = settingsDataStoreImpl.getInt(SettingsConstants.HOME_WALLPAPER_CHANGE_INTERVAL) ?: SettingsConstants.WALLPAPER_CHANGE_INTERVAL_DEFAULT
@@ -34,8 +34,7 @@ class WallpaperBootAndChangeReceiver : BroadcastReceiver() {
timeInMinutes2 = timeInMinutes2,
scheduleSeparately = scheduleSeparately
)
val changeImmediate = intent.getBooleanExtra("changeImmediate", false)
alarmItem.let{scheduler.scheduleWallpaperAlarm(it, null, changeImmediate, true)}
alarmItem.let{scheduler.scheduleWallpaperAlarm(it, null, true, true)}
}
} catch (e: Exception) {
e.printStackTrace()
@@ -22,7 +22,7 @@ class WallpaperReceiver: BroadcastReceiver() {
action = WallpaperService1.Actions.REFRESH.toString()
}
context.startService(serviceIntent)
WallpaperScheduler(context).scheduleRefresh()
WallpaperAlarmSchedulerImpl(context).scheduleRefresh()
}
else {
val timeInMinutes1 = intent?.getIntExtra("timeInMinutes1", WALLPAPER_CHANGE_INTERVAL_DEFAULT) ?: WALLPAPER_CHANGE_INTERVAL_DEFAULT
@@ -48,7 +48,7 @@ class WallpaperReceiver: BroadcastReceiver() {
// Schedule next alarm for next wallpaper change
val origin = intent?.getIntExtra("origin", -1)?.takeIf { it != -1 }
WallpaperScheduler(context).scheduleWallpaperAlarm(
WallpaperAlarmSchedulerImpl(context).scheduleWallpaperAlarm(
WallpaperAlarmItem(
timeInMinutes1 = timeInMinutes1,
timeInMinutes2 = timeInMinutes2,
@@ -28,7 +28,7 @@ class ChangeWallpaperTileService: TileService() {
override fun onClick() {
super.onClick()
val intent = Intent(this, WallpaperBootAndChangeReceiver::class.java).putExtra("changeImmediate", true)
val intent = Intent(this, WallpaperBootAndChangeReceiver::class.java)
sendBroadcast(intent)
}
+3
View File
@@ -153,4 +153,7 @@
<string name="delay_notice_dialog">Delay Notice</string>
<string name="to_minimize_battery_usage_changing_wallpapers_may_have_some_delays_once_scheduled_when_the_device_is_asleep_the_wallpaper_may_take_longer_to_apply">To minimize battery usage, changing wallpapers may have some delays once scheduled. When the device is asleep, the wallpaper may take longer to apply.</string>
<string name="change_wallpaper">Change wallpaper</string>
<string name="theme">Theme</string>
<string name="amoled_mode">AMOLED Mode</string>
<string name="full_dark_mode">Full dark mode</string>
</resources>
+3 -3
View File
@@ -6,12 +6,12 @@ buildscript {
}
plugins {
id("com.android.application") version "8.5.0" apply false
id("com.android.library") version "8.5.0" apply false
id("com.android.application") version "8.5.1" apply false
id("com.android.library") version "8.5.1" apply false
id("org.jetbrains.kotlin.android") version "2.0.0" apply false
id ("org.jetbrains.kotlin.plugin.compose") version "2.0.0" apply false
id("com.google.dagger.hilt.android") version "2.51.1" apply false
id("com.google.devtools.ksp") version "2.0.0-1.0.22" apply false
id("com.google.devtools.ksp") version "2.0.0-1.0.23" apply false
id ("com.mikepenz.aboutlibraries.plugin") version "11.2.2" apply false
id ("org.jetbrains.kotlin.plugin.serialization") version "2.0.0" apply false
}
Binary file not shown.
+2 -2
View File
@@ -1,7 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionSha256Sum=a4b4158601f8636cdeeab09bd76afb640030bb5b144aafe261a5e8af027dc612
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
distributionSha256Sum=d725d707bfabd4dfdc958c624003b3c80accc03f7037b5122c4b1d0ef15cecab
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Vendored
+4 -1
View File
@@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#
##############################################################################
#
@@ -84,7 +86,8 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Vendored
+94 -92
View File
@@ -1,92 +1,94 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
if %ERRORLEVEL% equ 0 goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
if %ERRORLEVEL% equ 0 goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega