Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
047d519e80 | ||
|
|
b4041cc8ea | ||
|
|
fc57f14d2a | ||
|
|
4fd1e06b8e | ||
|
|
6a08e0eff9 | ||
|
|
d7edb40a9b | ||
|
|
ac889ed7b1 |
No files matched your search
@@ -17,8 +17,8 @@ android {
|
||||
applicationId = "com.anthonyla.paperize"
|
||||
minSdk = 26
|
||||
targetSdk = 34
|
||||
versionCode = 5
|
||||
versionName = "1.0.1"
|
||||
versionCode = 7
|
||||
versionName = "1.1.0"
|
||||
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
vectorDrawables {
|
||||
|
||||
@@ -2,10 +2,6 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<uses-feature
|
||||
android:name="android.software.paperize"
|
||||
android:required="true" />
|
||||
|
||||
<uses-permission android:name="android.permission.SET_WALLPAPER"/>
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK" />
|
||||
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
||||
|
||||
@@ -12,6 +12,8 @@ object SettingsConstants {
|
||||
const val WALLPAPER_CHANGE_INTERVAL_DEFAULT = 15
|
||||
const val SET_LOCK_WITH_HOME = "set_lock_with_home"
|
||||
const val FIRST_LAUNCH = "first_launch"
|
||||
const val FIRST_ALBUM_SET = "first_album_set"
|
||||
const val LAST_SET_TIME = "last_set_time"
|
||||
const val NEXT_SET_TIME = "next_set_time"
|
||||
const val ENABLE_CHANGER = "enable_changer"
|
||||
}
|
||||
@@ -3,6 +3,8 @@ package com.anthonyla.paperize.di
|
||||
import android.app.Application
|
||||
import android.content.Context
|
||||
import androidx.room.Room
|
||||
import androidx.room.migration.Migration
|
||||
import androidx.sqlite.db.SupportSQLiteDatabase
|
||||
import com.anthonyla.paperize.data.settings.SettingsDataStore
|
||||
import com.anthonyla.paperize.data.settings.SettingsDataStoreImpl
|
||||
import com.anthonyla.paperize.feature.wallpaper.data.data_source.AlbumDatabase
|
||||
@@ -31,7 +33,7 @@ object AppModule {
|
||||
app,
|
||||
AlbumDatabase::class.java,
|
||||
AlbumDatabase.DATABASE_NAME
|
||||
).build()
|
||||
).addMigrations(MIGRATION_1_2).build()
|
||||
}
|
||||
|
||||
@Provides
|
||||
@@ -41,7 +43,7 @@ object AppModule {
|
||||
app,
|
||||
SelectedAlbumDatabase::class.java,
|
||||
SelectedAlbumDatabase.DATABASE_NAME
|
||||
).build()
|
||||
).addMigrations(MIGRATION_1_2).build()
|
||||
}
|
||||
|
||||
@Provides
|
||||
@@ -79,4 +81,10 @@ object AppModule {
|
||||
fun provideContext(
|
||||
@ApplicationContext context: Context,
|
||||
): Context { return context }
|
||||
}
|
||||
|
||||
val MIGRATION_1_2 = object : Migration(1, 2) {
|
||||
override fun migrate(db: SupportSQLiteDatabase) {
|
||||
db.execSQL("ALTER TABLE Album ADD COLUMN currentWallpaper TEXT")
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,7 @@ import com.anthonyla.paperize.feature.wallpaper.domain.model.Wallpaper
|
||||
*/
|
||||
@Database(
|
||||
entities = [Album::class, Wallpaper::class, Folder::class],
|
||||
version = 1
|
||||
version = 2
|
||||
)
|
||||
@TypeConverters(Converters::class)
|
||||
abstract class AlbumDatabase: RoomDatabase() {
|
||||
|
||||
@@ -12,7 +12,7 @@ import com.anthonyla.paperize.feature.wallpaper.domain.model.Wallpaper
|
||||
*/
|
||||
@Database(
|
||||
entities = [Album::class, Wallpaper::class],
|
||||
version = 1
|
||||
version = 2
|
||||
)
|
||||
@TypeConverters(Converters::class)
|
||||
abstract class SelectedAlbumDatabase: RoomDatabase() {
|
||||
|
||||
@@ -19,4 +19,5 @@ data class Album(
|
||||
val coverUri: String?,
|
||||
val initialized: Boolean = false,
|
||||
val wallpapersInQueue: List<String> = emptyList(),
|
||||
val currentWallpaper: String? = null
|
||||
)
|
||||
@@ -1,22 +1,26 @@
|
||||
package com.anthonyla.paperize.feature.wallpaper.presentation
|
||||
|
||||
import android.Manifest
|
||||
import android.animation.ObjectAnimator
|
||||
import android.app.Activity
|
||||
import android.content.Intent
|
||||
import android.content.pm.PackageManager
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import android.view.animation.AccelerateInterpolator
|
||||
import androidx.activity.ComponentActivity
|
||||
import androidx.activity.compose.setContent
|
||||
import androidx.activity.enableEdgeToEdge
|
||||
import androidx.activity.viewModels
|
||||
import androidx.compose.material3.Surface
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.core.animation.doOnEnd
|
||||
import androidx.core.app.ActivityCompat
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
|
||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||
import com.anthonyla.paperize.core.SettingsConstants
|
||||
import com.anthonyla.paperize.data.settings.SettingsDataStore
|
||||
import com.anthonyla.paperize.feature.wallpaper.presentation.album.AlbumsViewModel
|
||||
import com.anthonyla.paperize.feature.wallpaper.presentation.settings_screen.SettingsViewModel
|
||||
import com.anthonyla.paperize.feature.wallpaper.presentation.themes.PaperizeTheme
|
||||
import com.anthonyla.paperize.feature.wallpaper.presentation.wallpaper_screen.WallpaperScreenViewModel
|
||||
@@ -24,10 +28,8 @@ import dagger.hilt.android.AndroidEntryPoint
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import javax.inject.Inject
|
||||
|
||||
|
||||
@AndroidEntryPoint
|
||||
class MainActivity : ComponentActivity() {
|
||||
private val albumsViewModel: AlbumsViewModel by viewModels()
|
||||
private val settingsViewModel: SettingsViewModel by viewModels()
|
||||
private val wallpaperScreenViewModel: WallpaperScreenViewModel by viewModels()
|
||||
private val context = this
|
||||
@@ -39,8 +41,17 @@ class MainActivity : ComponentActivity() {
|
||||
enableEdgeToEdge()
|
||||
super.onCreate(savedInstanceState)
|
||||
val splashScreen = installSplashScreen()
|
||||
splashScreen.setKeepOnScreenCondition { settingsViewModel.setKeepOnScreenCondition }
|
||||
splashScreen.setOnExitAnimationListener { splashScreenViewProvider ->
|
||||
val fadeOut = ObjectAnimator.ofFloat(splashScreenViewProvider.view, View.ALPHA, 1f, 0f)
|
||||
fadeOut.interpolator = AccelerateInterpolator()
|
||||
fadeOut.duration = 300L
|
||||
fadeOut.doOnEnd { splashScreenViewProvider.remove() }
|
||||
fadeOut.start()
|
||||
}
|
||||
setContent {
|
||||
val settingsState = settingsViewModel.state.collectAsStateWithLifecycle()
|
||||
val selectedState = wallpaperScreenViewModel.state.collectAsStateWithLifecycle()
|
||||
splashScreen.setKeepOnScreenCondition { settingsState.value.isDataLoaded && selectedState.value.isDataLoaded }
|
||||
val isFirstLaunch = runBlocking { settingsDataStoreImpl.getBoolean(SettingsConstants.FIRST_LAUNCH) } ?: true
|
||||
if (isFirstLaunch) {
|
||||
val contentResolver = context.contentResolver
|
||||
@@ -49,7 +60,7 @@ class MainActivity : ComponentActivity() {
|
||||
contentResolver.releasePersistableUriPermission(permission.uri, Intent.FLAG_GRANT_READ_URI_PERMISSION or Intent.FLAG_GRANT_WRITE_URI_PERMISSION)
|
||||
}
|
||||
}
|
||||
PaperizeTheme(settingsViewModel.state) {
|
||||
PaperizeTheme(settingsState) {
|
||||
Surface(tonalElevation = 5.dp) {
|
||||
PaperizeApp(isFirstLaunch)
|
||||
}
|
||||
|
||||
@@ -77,7 +77,8 @@ fun PaperizeApp(
|
||||
albumState.value.albumsWithWallpapers.asSequence().forEach { albumWithWallpapers ->
|
||||
if (!albumWithWallpapers.album.initialized && (albumWithWallpapers.wallpapers.isNotEmpty() || albumWithWallpapers.folders.isNotEmpty())) {
|
||||
albumsViewModel.onEvent(AlbumsEvent.InitializeAlbum(albumWithWallpapers))
|
||||
} else if (albumWithWallpapers.album.initialized && albumWithWallpapers.wallpapers.isEmpty() && albumWithWallpapers.folders.isEmpty()) {
|
||||
}
|
||||
else if (albumWithWallpapers.wallpapers.isEmpty() && albumWithWallpapers.folders.isEmpty() && albumWithWallpapers.album.initialized) {
|
||||
if (navController.currentDestination?.route == Home::class.simpleName) {
|
||||
navController.popBackStack<Home>(inclusive = false)
|
||||
}
|
||||
@@ -86,42 +87,42 @@ fun PaperizeApp(
|
||||
}
|
||||
|
||||
selectedState.value.selectedAlbum?.let { selectedAlbum ->
|
||||
albumState.value.albumsWithWallpapers.find { it.album.initialAlbumName == selectedAlbum.album.initialAlbumName }
|
||||
?.let { foundAlbum ->
|
||||
val albumNameHashCode = foundAlbum.album.initialAlbumName.hashCode()
|
||||
val wallpapers: List<Wallpaper> =
|
||||
foundAlbum.wallpapers + foundAlbum.folders.flatMap { folder ->
|
||||
folder.wallpapers.map { wallpaper ->
|
||||
val wallpaperHashCode = wallpaper.hashCode()
|
||||
Wallpaper(
|
||||
initialAlbumName = foundAlbum.album.initialAlbumName,
|
||||
wallpaperUri = wallpaper,
|
||||
key = wallpaperHashCode + albumNameHashCode,
|
||||
)
|
||||
}
|
||||
albumState.value.albumsWithWallpapers.find { it.album.initialAlbumName == selectedAlbum.album.initialAlbumName }?.let { foundAlbum ->
|
||||
val albumNameHashCode = foundAlbum.album.initialAlbumName.hashCode()
|
||||
val wallpapers: List<Wallpaper> =
|
||||
foundAlbum.wallpapers + foundAlbum.folders.flatMap { folder ->
|
||||
folder.wallpapers.map { wallpaper ->
|
||||
Wallpaper(
|
||||
initialAlbumName = foundAlbum.album.initialAlbumName,
|
||||
wallpaperUri = wallpaper,
|
||||
key = wallpaper.hashCode() + albumNameHashCode,
|
||||
)
|
||||
}
|
||||
val wallpaperUriSet = wallpapers.map { it.wallpaperUri }.toSet()
|
||||
val newSelectedAlbum = SelectedAlbum(
|
||||
album = foundAlbum.album.copy(
|
||||
wallpapersInQueue = selectedAlbum.album.wallpapersInQueue.filter { it in wallpaperUriSet }
|
||||
),
|
||||
wallpapers = wallpapers
|
||||
)
|
||||
wallpaperScreenViewModel.onEvent(WallpaperEvent.UpdateSelectedAlbum(newSelectedAlbum))
|
||||
settingsViewModel.onEvent(SettingsEvent.SetWallpaperInterval(settingsState.value.interval))
|
||||
}
|
||||
val wallpaperUriSet = wallpapers.map { it.wallpaperUri }.toSet()
|
||||
val newSelectedAlbum = SelectedAlbum(
|
||||
album = foundAlbum.album.copy(
|
||||
wallpapersInQueue = selectedAlbum.album.wallpapersInQueue.filter { it in wallpaperUriSet },
|
||||
currentWallpaper = selectedAlbum.album.currentWallpaper
|
||||
),
|
||||
wallpapers = wallpapers
|
||||
)
|
||||
wallpaperScreenViewModel.onEvent(WallpaperEvent.UpdateSelectedAlbum(newSelectedAlbum))
|
||||
settingsViewModel.onEvent(SettingsEvent.SetWallpaperInterval(settingsState.value.interval))
|
||||
if (settingsState.value.enableChanger) { // Not ideal but no other option to check if service is running (thanks Android)
|
||||
val intent = Intent(context, WallpaperService::class.java).apply {
|
||||
action = WallpaperService.Actions.START.toString()
|
||||
putExtra("timeInMinutes", settingsState.value.interval)
|
||||
}
|
||||
context.startForegroundService(intent)
|
||||
}
|
||||
?: run {
|
||||
wallpaperScreenViewModel.onEvent(WallpaperEvent.Reset)
|
||||
Intent(context, WallpaperService::class.java).also {
|
||||
it.action = WallpaperService.Actions.STOP.toString()
|
||||
context.startForegroundService(it)
|
||||
}
|
||||
} ?: run {
|
||||
wallpaperScreenViewModel.onEvent(WallpaperEvent.Reset)
|
||||
Intent(context, WallpaperService::class.java).also {
|
||||
it.action = WallpaperService.Actions.STOP.toString()
|
||||
context.startForegroundService(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -206,14 +207,17 @@ fun PaperizeApp(
|
||||
},
|
||||
onScheduleWallpaperChanger = { timeInMinutes ->
|
||||
settingsViewModel.onEvent(SettingsEvent.SetWallpaperInterval(timeInMinutes))
|
||||
val intent = Intent(context, WallpaperService::class.java).apply {
|
||||
action = WallpaperService.Actions.START.toString()
|
||||
putExtra("timeInMinutes", timeInMinutes)
|
||||
if (settingsState.value.enableChanger) {
|
||||
val intent = Intent(context, WallpaperService::class.java).apply {
|
||||
action = WallpaperService.Actions.START.toString()
|
||||
putExtra("timeInMinutes", timeInMinutes)
|
||||
}
|
||||
context.startForegroundService(intent)
|
||||
}
|
||||
context.startForegroundService(intent)
|
||||
},
|
||||
onStop = {
|
||||
wallpaperScreenViewModel.onEvent(WallpaperEvent.Reset)
|
||||
settingsViewModel.onEvent(SettingsEvent.SetChangerToggle(false))
|
||||
Intent(context, WallpaperService::class.java).also {
|
||||
it.action = WallpaperService.Actions.STOP.toString()
|
||||
context.startForegroundService(it)
|
||||
@@ -227,7 +231,24 @@ fun PaperizeApp(
|
||||
onSetLockWithHome = {
|
||||
settingsViewModel.onEvent(SettingsEvent.SetLockWithHome(it))
|
||||
},
|
||||
selectedAlbum = selectedState.value.selectedAlbum
|
||||
selectedAlbum = selectedState.value.selectedAlbum,
|
||||
enableChanger = settingsState.value.enableChanger,
|
||||
onToggleChanger = { enableWallpaperChanger ->
|
||||
settingsViewModel.onEvent(SettingsEvent.SetChangerToggle(enableWallpaperChanger))
|
||||
if (enableWallpaperChanger) {
|
||||
val intent = Intent(context, WallpaperService::class.java).apply {
|
||||
action = WallpaperService.Actions.START.toString()
|
||||
putExtra("timeInMinutes", settingsState.value.interval)
|
||||
}
|
||||
context.startForegroundService(intent)
|
||||
}
|
||||
else {
|
||||
Intent(context, WallpaperService::class.java).also {
|
||||
it.action = WallpaperService.Actions.STOP.toString()
|
||||
context.startForegroundService(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
// Navigate to the add album screen to create a new album and add wallpapers to it
|
||||
|
||||
@@ -54,6 +54,7 @@ fun AddAlbumScreen(
|
||||
if (addAlbumState.value.initialAlbumName.isEmpty()) {
|
||||
addAlbumViewModel.onEvent(AddAlbumEvent.SetAlbumName(initialAlbumName))
|
||||
}
|
||||
var showSpotlight by rememberSaveable { mutableStateOf(false) }
|
||||
|
||||
BackHandler {
|
||||
if (selectionMode) {
|
||||
@@ -62,6 +63,7 @@ fun AddAlbumScreen(
|
||||
} else {
|
||||
onBackClick()
|
||||
addAlbumViewModel.onEvent(AddAlbumEvent.Reset)
|
||||
showSpotlight = false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,11 +105,14 @@ fun AddAlbumScreen(
|
||||
isEmpty = addAlbumState.value.isEmpty,
|
||||
selectionMode = selectionMode,
|
||||
albumState = addAlbumViewModel.state,
|
||||
showSpotlight = showSpotlight,
|
||||
onBackClick = {
|
||||
showSpotlight = false
|
||||
addAlbumViewModel.onEvent(AddAlbumEvent.Reset)
|
||||
onBackClick()
|
||||
},
|
||||
onConfirmationClick = {
|
||||
showSpotlight = false
|
||||
addAlbumViewModel.onEvent(AddAlbumEvent.ReflectAlbumName(it))
|
||||
addAlbumViewModel.onEvent(AddAlbumEvent.SaveAlbum)
|
||||
addAlbumViewModel.onEvent(AddAlbumEvent.Reset)
|
||||
@@ -151,10 +156,12 @@ fun AddAlbumScreen(
|
||||
onImageClick = {
|
||||
selectionMode = false
|
||||
imagePickerLauncher.launch(arrayOf("image/*"))
|
||||
showSpotlight = true
|
||||
},
|
||||
onFolderClick = {
|
||||
selectionMode = false
|
||||
folderPickerLauncher.launch(null)
|
||||
showSpotlight = true
|
||||
},
|
||||
animate = false
|
||||
)
|
||||
|
||||
@@ -273,7 +273,7 @@ class AddAlbumViewModel @Inject constructor(
|
||||
if (file.isDirectory()) {
|
||||
files.addAll(listFilesRecursive(file, context))
|
||||
} else {
|
||||
val allowedExtensions = listOf("jpg", "png", "heif", "webp")
|
||||
val allowedExtensions = listOf("jpg", "jpeg", "png", "heif", "webp", "JPG", "JPEG", "PNG", "HEIF", "WEBP")
|
||||
if (file.extension in allowedExtensions) {
|
||||
files.add(file.uri.toString())
|
||||
}
|
||||
|
||||
@@ -1,8 +1,16 @@
|
||||
package com.anthonyla.paperize.feature.wallpaper.presentation.add_album_screen.components
|
||||
|
||||
import androidx.compose.animation.core.LinearOutSlowInEasing
|
||||
import androidx.compose.animation.core.RepeatMode
|
||||
import androidx.compose.animation.core.animateFloat
|
||||
import androidx.compose.animation.core.infiniteRepeatable
|
||||
import androidx.compose.animation.core.rememberInfiniteTransition
|
||||
import androidx.compose.animation.core.tween
|
||||
import androidx.compose.foundation.Canvas
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.border
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.requiredSize
|
||||
@@ -33,7 +41,9 @@ import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.geometry.Offset
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.drawscope.Stroke
|
||||
import androidx.compose.ui.platform.LocalFocusManager
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.input.ImeAction
|
||||
@@ -54,17 +64,45 @@ fun AddAlbumSmallTopBar(
|
||||
title: String,
|
||||
isEmpty: Boolean,
|
||||
selectionMode: Boolean,
|
||||
showSpotlight: Boolean,
|
||||
onSelectAllClick: () -> Unit,
|
||||
onBackClick: () -> Unit,
|
||||
onDeleteSelected: () -> Unit,
|
||||
onConfirmationClick: (String) -> Unit,
|
||||
modifier: Modifier = Modifier
|
||||
) {
|
||||
onConfirmationClick: (String) -> Unit
|
||||
) {
|
||||
val state = albumState.collectAsStateWithLifecycle()
|
||||
val focusManager = LocalFocusManager.current
|
||||
var editableTitle by rememberSaveable { mutableStateOf(title) }
|
||||
var showSelectionDeleteDialog by rememberSaveable { mutableStateOf(false) }
|
||||
|
||||
val infiniteTransition = rememberInfiniteTransition(label = stringResource(R.string.spotlight_animation))
|
||||
val radius1 by infiniteTransition.animateFloat(
|
||||
initialValue = 25f,
|
||||
targetValue = 50f,
|
||||
animationSpec = infiniteRepeatable(
|
||||
animation = tween(2000, easing = LinearOutSlowInEasing),
|
||||
repeatMode = RepeatMode.Reverse
|
||||
), label = stringResource(R.string.circle_1_animation)
|
||||
)
|
||||
val radius2 by infiniteTransition.animateFloat(
|
||||
initialValue = 25f,
|
||||
targetValue = 60f,
|
||||
animationSpec = infiniteRepeatable(
|
||||
animation = tween(2000, easing = LinearOutSlowInEasing),
|
||||
repeatMode = RepeatMode.Reverse
|
||||
), label = stringResource(R.string.circle_2_animation)
|
||||
)
|
||||
|
||||
val radius3 by infiniteTransition.animateFloat(
|
||||
initialValue = 25f,
|
||||
targetValue = 75f,
|
||||
animationSpec = infiniteRepeatable(
|
||||
animation = tween(2000, easing = LinearOutSlowInEasing),
|
||||
repeatMode = RepeatMode.Reverse
|
||||
), label = stringResource(R.string.circle_3_animation)
|
||||
)
|
||||
|
||||
|
||||
TopAppBar(
|
||||
colors = TopAppBarDefaults.centerAlignedTopAppBarColors(containerColor = MaterialTheme.colorScheme.surface),
|
||||
title = {
|
||||
@@ -109,9 +147,7 @@ fun AddAlbumSmallTopBar(
|
||||
horizontalArrangement = Arrangement.Start,
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
IconButton(
|
||||
onClick = onSelectAllClick
|
||||
) {
|
||||
IconButton(onClick = onSelectAllClick) {
|
||||
val bgColor = MaterialTheme.colorScheme.surfaceColorAtElevation(5.dp)
|
||||
if (state.value.allSelected) {
|
||||
Icon(
|
||||
@@ -139,12 +175,38 @@ fun AddAlbumSmallTopBar(
|
||||
actions = {
|
||||
if(!selectionMode) {
|
||||
if (!isEmpty) {
|
||||
IconButton(onClick = { onConfirmationClick(editableTitle) }) {
|
||||
Icon(
|
||||
imageVector = Icons.Outlined.Add,
|
||||
contentDescription = stringResource(R.string.add_album),
|
||||
modifier = Modifier.padding(6.dp)
|
||||
)
|
||||
Box {
|
||||
val primaryColor = MaterialTheme.colorScheme.inversePrimary
|
||||
val secondaryColor = MaterialTheme.colorScheme.secondary
|
||||
IconButton(onClick = { onConfirmationClick(editableTitle) }) {
|
||||
Icon(
|
||||
imageVector = Icons.Outlined.Add,
|
||||
contentDescription = stringResource(R.string.add_album),
|
||||
modifier = Modifier.padding(6.dp)
|
||||
)
|
||||
}
|
||||
if (!showSpotlight) {
|
||||
Canvas(modifier = Modifier.matchParentSize()) {
|
||||
drawCircle(
|
||||
color = primaryColor,
|
||||
radius = radius1,
|
||||
center = Offset(size.width / 2, size.height / 2),
|
||||
style = Stroke(width = 5f)
|
||||
)
|
||||
drawCircle(
|
||||
color = secondaryColor,
|
||||
radius = radius2,
|
||||
center = Offset(size.width / 2, size.height / 2),
|
||||
style = Stroke(width = 5f)
|
||||
)
|
||||
drawCircle(
|
||||
color = primaryColor,
|
||||
radius = radius3,
|
||||
center = Offset(size.width / 2, size.height / 2),
|
||||
style = Stroke(width = 5f)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,9 +2,7 @@ package com.anthonyla.paperize.feature.wallpaper.presentation.album
|
||||
|
||||
import android.app.Application
|
||||
import android.content.Context
|
||||
import android.webkit.MimeTypeMap
|
||||
import androidx.core.net.toUri
|
||||
import androidx.documentfile.provider.DocumentFile
|
||||
import androidx.lifecycle.AndroidViewModel
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import com.anthonyla.paperize.feature.wallpaper.domain.model.Folder
|
||||
@@ -12,6 +10,7 @@ import com.anthonyla.paperize.feature.wallpaper.domain.model.Wallpaper
|
||||
import com.anthonyla.paperize.feature.wallpaper.domain.repository.AlbumRepository
|
||||
import com.lazygeniouz.dfc.file.DocumentFileCompat
|
||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.SharingStarted
|
||||
import kotlinx.coroutines.flow.first
|
||||
@@ -34,22 +33,20 @@ class AlbumsViewModel @Inject constructor (
|
||||
)
|
||||
|
||||
init {
|
||||
viewModelScope.launch {
|
||||
updateAlbums()
|
||||
refreshAlbums()
|
||||
}
|
||||
updateAlbums()
|
||||
refreshAlbums()
|
||||
}
|
||||
|
||||
|
||||
fun onEvent(event: AlbumsEvent) {
|
||||
when (event) {
|
||||
is AlbumsEvent.DeleteAlbumWithWallpapers -> {
|
||||
viewModelScope.launch {
|
||||
viewModelScope.launch(Dispatchers.IO) {
|
||||
repository.cascadeDeleteAlbum(event.albumWithWallpaperAndFolder.album)
|
||||
}
|
||||
}
|
||||
is AlbumsEvent.ChangeAlbumName -> {
|
||||
viewModelScope.launch {
|
||||
viewModelScope.launch(Dispatchers.IO) {
|
||||
if (!(_state.value.albumsWithWallpapers.any { it.album.displayedAlbumName == event.title })) {
|
||||
repository.updateAlbum(
|
||||
event.albumWithWallpaperAndFolder.album.copy(displayedAlbumName = event.title)
|
||||
@@ -58,13 +55,11 @@ class AlbumsViewModel @Inject constructor (
|
||||
}
|
||||
}
|
||||
is AlbumsEvent.RefreshAlbums -> {
|
||||
viewModelScope.launch {
|
||||
updateAlbums()
|
||||
refreshAlbums()
|
||||
}
|
||||
updateAlbums()
|
||||
refreshAlbums()
|
||||
}
|
||||
is AlbumsEvent.InitializeAlbum -> {
|
||||
viewModelScope.launch {
|
||||
viewModelScope.launch(Dispatchers.IO) {
|
||||
repository.updateAlbum(
|
||||
event.albumWithWallpaperAndFolder.album.copy(
|
||||
initialized = true
|
||||
@@ -73,7 +68,7 @@ class AlbumsViewModel @Inject constructor (
|
||||
}
|
||||
}
|
||||
is AlbumsEvent.Reset -> {
|
||||
viewModelScope.launch {
|
||||
viewModelScope.launch(Dispatchers.IO) {
|
||||
_state.update { AlbumsState() }
|
||||
repository.deleteAllData()
|
||||
}
|
||||
@@ -85,12 +80,12 @@ class AlbumsViewModel @Inject constructor (
|
||||
* Verify and remove stale data in Room database
|
||||
*/
|
||||
private fun updateAlbums() {
|
||||
viewModelScope.launch {
|
||||
viewModelScope.launch(Dispatchers.IO) {
|
||||
var albumWithWallpapers = repository.getAlbumsWithWallpaperAndFolder().first()
|
||||
albumWithWallpapers.forEach { albumWithWallpaper ->
|
||||
// Delete wallpaper if the URI is invalid
|
||||
val invalidWallpapers = albumWithWallpaper.wallpapers.filterNot { wallpaper ->
|
||||
val file = DocumentFile.fromSingleUri(context, wallpaper.wallpaperUri.toUri())
|
||||
val file = DocumentFileCompat.fromSingleUri(context, wallpaper.wallpaperUri.toUri())
|
||||
file?.exists() == true
|
||||
}
|
||||
if (invalidWallpapers.isNotEmpty()) {
|
||||
@@ -99,12 +94,12 @@ class AlbumsViewModel @Inject constructor (
|
||||
|
||||
// Update folder cover uri and children uri
|
||||
albumWithWallpaper.folders.forEach { folder ->
|
||||
DocumentFile.fromTreeUri(context, folder.folderUri.toUri())?.let { folderDirectory ->
|
||||
if (!folderDirectory.isDirectory) {
|
||||
DocumentFileCompat.fromTreeUri(context, folder.folderUri.toUri())?.let { folderDirectory ->
|
||||
if (!folderDirectory.isDirectory()) {
|
||||
repository.deleteFolder(folder)
|
||||
} else {
|
||||
val wallpapers = getWallpaperFromFolder(folder.folderUri, context)
|
||||
val folderCoverFile = folder.coverUri?.let { DocumentFile.fromSingleUri(context, it.toUri()) }
|
||||
val folderCoverFile = folder.coverUri?.let { DocumentFileCompat.fromSingleUri(context, it.toUri()) }
|
||||
val folderCover = folderCoverFile?.takeIf { it.exists() }?.uri?.toString() ?: wallpapers.randomOrNull()
|
||||
repository.updateFolder(folder.copy(coverUri = folderCover, wallpapers = wallpapers))
|
||||
}
|
||||
@@ -114,7 +109,7 @@ class AlbumsViewModel @Inject constructor (
|
||||
albumWithWallpapers = repository.getAlbumsWithWallpaperAndFolder().first()
|
||||
albumWithWallpapers.forEach { albumWithWallpaper ->
|
||||
// Update album cover uri if null or invalid
|
||||
val albumCoverFile = albumWithWallpaper.album.coverUri?.toUri()?.let { DocumentFile.fromSingleUri(context, it) }
|
||||
val albumCoverFile = albumWithWallpaper.album.coverUri?.toUri()?.let { DocumentFileCompat.fromSingleUri(context, it) }
|
||||
if (albumCoverFile == null || !albumCoverFile.exists()) {
|
||||
val newCoverUri = findFirstValidUri(albumWithWallpaper.wallpapers, albumWithWallpaper.folders)
|
||||
repository.updateAlbum(albumWithWallpaper.album.copy(coverUri = newCoverUri))
|
||||
@@ -127,7 +122,7 @@ class AlbumsViewModel @Inject constructor (
|
||||
* Retrieve albums from database into viewModel
|
||||
*/
|
||||
private fun refreshAlbums() {
|
||||
viewModelScope.launch {
|
||||
viewModelScope.launch(Dispatchers.IO) {
|
||||
repository.getAlbumsWithWallpaperAndFolder().collect { albumWithWallpapers ->
|
||||
_state.update { it.copy(
|
||||
albumsWithWallpapers = albumWithWallpapers
|
||||
@@ -153,9 +148,8 @@ class AlbumsViewModel @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) {
|
||||
val allowedExtensions = listOf("jpg", "jpeg", "png", "heif", "webp", "JPG", "JPEG", "PNG", "HEIF", "WEBP")
|
||||
if (file.extension in allowedExtensions) {
|
||||
files.add(file.uri.toString())
|
||||
}
|
||||
}
|
||||
@@ -169,14 +163,14 @@ class AlbumsViewModel @Inject constructor (
|
||||
*/
|
||||
private fun findFirstValidUri(wallpapers: List<Wallpaper>, folders: List<Folder>): String? {
|
||||
wallpapers.forEach { wallpaper ->
|
||||
val file = DocumentFile.fromSingleUri(context, wallpaper.wallpaperUri.toUri())
|
||||
val file = DocumentFileCompat.fromSingleUri(context, wallpaper.wallpaperUri.toUri())
|
||||
if (file?.exists() == true) {
|
||||
return wallpaper.wallpaperUri
|
||||
}
|
||||
}
|
||||
folders.forEach { folder ->
|
||||
folder.wallpapers.forEach { wallpaper ->
|
||||
val file = DocumentFile.fromSingleUri(context, wallpaper.toUri())
|
||||
val file = DocumentFileCompat.fromSingleUri(context, wallpaper.toUri())
|
||||
if (file?.exists() == true) {
|
||||
return wallpaper
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.anthonyla.paperize.feature.wallpaper.presentation.home_screen
|
||||
|
||||
import android.app.Activity
|
||||
import androidx.activity.compose.BackHandler
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.pager.HorizontalPager
|
||||
@@ -23,7 +21,6 @@ import androidx.compose.runtime.saveable.rememberSaveable
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.runtime.snapshotFlow
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.anthonyla.paperize.feature.wallpaper.domain.model.SelectedAlbum
|
||||
import com.anthonyla.paperize.feature.wallpaper.presentation.add_album_screen.components.AddAlbumDialog
|
||||
@@ -39,13 +36,15 @@ fun HomeScreen(
|
||||
onAlbumViewClick: (String) -> Unit,
|
||||
onScheduleWallpaperChanger: (Int) -> Unit,
|
||||
onSetLockWithHome: (Boolean) -> Unit,
|
||||
onToggleChanger: (Boolean) -> Unit,
|
||||
onStop: () -> Unit,
|
||||
animate : Boolean,
|
||||
interval: Int,
|
||||
setLockWithHome: Boolean,
|
||||
lastSetTime: String?,
|
||||
nextSetTime: String?,
|
||||
selectedAlbum: SelectedAlbum?
|
||||
selectedAlbum: SelectedAlbum?,
|
||||
enableChanger: Boolean
|
||||
) {
|
||||
var tabIndex by rememberSaveable { mutableIntStateOf(0) }
|
||||
val pagerState = rememberPagerState { tabItems.size }
|
||||
@@ -56,12 +55,6 @@ fun HomeScreen(
|
||||
onConfirmation = { navigateToAddWallpaperScreen(it) }
|
||||
)
|
||||
|
||||
val context = LocalContext.current
|
||||
val activity = context as? Activity
|
||||
BackHandler {
|
||||
activity?.moveTaskToBack(true)
|
||||
}
|
||||
|
||||
Scaffold (
|
||||
topBar = {
|
||||
HomeTopBar(
|
||||
@@ -125,8 +118,10 @@ fun HomeScreen(
|
||||
setLockWithHome = setLockWithHome,
|
||||
lastSetTime = lastSetTime,
|
||||
nextSetTime = nextSetTime,
|
||||
onSetLockWithHome = { onSetLockWithHome(it) },
|
||||
selectedAlbum = selectedAlbum
|
||||
onSetLockWithHome = onSetLockWithHome,
|
||||
selectedAlbum = selectedAlbum,
|
||||
enableChanger = enableChanger,
|
||||
onToggleChanger = onToggleChanger
|
||||
)
|
||||
1 -> LibraryScreen(
|
||||
onAddNewAlbumClick = { addAlbumDialog = true },
|
||||
|
||||
@@ -11,6 +11,7 @@ import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.fillMaxHeight
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.outlined.ArrowCircleRight
|
||||
import androidx.compose.material.icons.outlined.Info
|
||||
@@ -111,7 +112,8 @@ fun NotificationScreen(
|
||||
snackbar = { data ->
|
||||
Snackbar(
|
||||
snackbarData = data,
|
||||
modifier = Modifier.padding(PaddingValues(horizontal = 8.dp, vertical = 8.dp))
|
||||
modifier = Modifier.padding(PaddingValues(horizontal = 8.dp, vertical = 8.dp)),
|
||||
shape = RoundedCornerShape(24.dp)
|
||||
)
|
||||
}
|
||||
) },
|
||||
|
||||
@@ -10,4 +10,5 @@ sealed class SettingsEvent {
|
||||
data class SetAnimate(val animate: Boolean): SettingsEvent()
|
||||
data class SetWallpaperInterval(val interval: Int): SettingsEvent()
|
||||
data class SetLockWithHome(val lockWithHome: Boolean): SettingsEvent()
|
||||
data class SetChangerToggle(val toggle: Boolean): SettingsEvent()
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package com.anthonyla.paperize.feature.wallpaper.presentation.settings_screen
|
||||
import com.anthonyla.paperize.core.SettingsConstants.WALLPAPER_CHANGE_INTERVAL_DEFAULT
|
||||
|
||||
data class SettingsState (
|
||||
val isDataLoaded: Boolean = false,
|
||||
val firstLaunch: Boolean = true,
|
||||
val darkMode: Boolean? = null,
|
||||
val dynamicTheming: Boolean = false,
|
||||
@@ -9,5 +10,6 @@ data class SettingsState (
|
||||
val interval: Int = WALLPAPER_CHANGE_INTERVAL_DEFAULT,
|
||||
val setLockWithHome: Boolean = false,
|
||||
val lastSetTime: String? = null,
|
||||
val nextSetTime: String? = null
|
||||
val nextSetTime: String? = null,
|
||||
val enableChanger: Boolean = false
|
||||
)
|
||||
@@ -5,6 +5,7 @@ import androidx.lifecycle.viewModelScope
|
||||
import com.anthonyla.paperize.core.SettingsConstants
|
||||
import com.anthonyla.paperize.data.settings.SettingsDataStore
|
||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.Job
|
||||
import kotlinx.coroutines.async
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
@@ -27,30 +28,18 @@ class SettingsViewModel @Inject constructor (
|
||||
)
|
||||
|
||||
private var currentGetJob: Job? = null
|
||||
var setKeepOnScreenCondition: Boolean = true
|
||||
|
||||
init {
|
||||
currentGetJob = viewModelScope.launch {
|
||||
val darkMode =
|
||||
async { settingsDataStoreImpl.getBoolean(SettingsConstants.DARK_MODE_TYPE) }
|
||||
val dynamicTheming = async {
|
||||
settingsDataStoreImpl.getBoolean(SettingsConstants.DYNAMIC_THEME_TYPE) ?: false
|
||||
}
|
||||
val wallpaperInterval = async {
|
||||
settingsDataStoreImpl.getInt(SettingsConstants.WALLPAPER_CHANGE_INTERVAL)
|
||||
?: SettingsConstants.WALLPAPER_CHANGE_INTERVAL_DEFAULT
|
||||
}
|
||||
val firstLaunch =
|
||||
async { settingsDataStoreImpl.getBoolean(SettingsConstants.FIRST_LAUNCH) ?: true }
|
||||
val setLockWithHome = async {
|
||||
settingsDataStoreImpl.getBoolean(SettingsConstants.SET_LOCK_WITH_HOME) ?: false
|
||||
}
|
||||
val lastSetTime =
|
||||
async { settingsDataStoreImpl.getString(SettingsConstants.LAST_SET_TIME) }
|
||||
val nextSetTime =
|
||||
async { settingsDataStoreImpl.getString(SettingsConstants.NEXT_SET_TIME) }
|
||||
val animate =
|
||||
async { settingsDataStoreImpl.getBoolean(SettingsConstants.ANIMATE_TYPE) ?: true }
|
||||
currentGetJob = viewModelScope.launch(Dispatchers.IO) {
|
||||
val darkMode = async { settingsDataStoreImpl.getBoolean(SettingsConstants.DARK_MODE_TYPE) }
|
||||
val dynamicTheming = async { settingsDataStoreImpl.getBoolean(SettingsConstants.DYNAMIC_THEME_TYPE) ?: false }
|
||||
val wallpaperInterval = async { settingsDataStoreImpl.getInt(SettingsConstants.WALLPAPER_CHANGE_INTERVAL) ?: SettingsConstants.WALLPAPER_CHANGE_INTERVAL_DEFAULT }
|
||||
val firstLaunch = async { settingsDataStoreImpl.getBoolean(SettingsConstants.FIRST_LAUNCH) ?: true }
|
||||
val setLockWithHome = async { settingsDataStoreImpl.getBoolean(SettingsConstants.SET_LOCK_WITH_HOME) ?: false }
|
||||
val lastSetTime = async { settingsDataStoreImpl.getString(SettingsConstants.LAST_SET_TIME) }
|
||||
val nextSetTime = async { settingsDataStoreImpl.getString(SettingsConstants.NEXT_SET_TIME) }
|
||||
val animate = async { settingsDataStoreImpl.getBoolean(SettingsConstants.ANIMATE_TYPE) ?: true }
|
||||
val enableChanger = async { settingsDataStoreImpl.getBoolean(SettingsConstants.ENABLE_CHANGER) ?: false }
|
||||
|
||||
_state.update {
|
||||
it.copy(
|
||||
@@ -61,17 +50,18 @@ class SettingsViewModel @Inject constructor (
|
||||
firstLaunch = firstLaunch.await(),
|
||||
lastSetTime = lastSetTime.await(),
|
||||
nextSetTime = nextSetTime.await(),
|
||||
animate = animate.await()
|
||||
animate = animate.await(),
|
||||
enableChanger = enableChanger.await(),
|
||||
isDataLoaded = true
|
||||
)
|
||||
}
|
||||
setKeepOnScreenCondition = false
|
||||
}
|
||||
}
|
||||
|
||||
fun onEvent(event: SettingsEvent) {
|
||||
when (event) {
|
||||
is SettingsEvent.SetFirstLaunch -> {
|
||||
viewModelScope.launch {
|
||||
viewModelScope.launch(Dispatchers.IO) {
|
||||
settingsDataStoreImpl.putBoolean(SettingsConstants.FIRST_LAUNCH, false)
|
||||
_state.update {
|
||||
it.copy(
|
||||
@@ -81,32 +71,31 @@ class SettingsViewModel @Inject constructor (
|
||||
}
|
||||
}
|
||||
|
||||
is SettingsEvent.SetChangerToggle -> {
|
||||
viewModelScope.launch(Dispatchers.IO) {
|
||||
when (event.toggle) {
|
||||
true -> { settingsDataStoreImpl.putBoolean(SettingsConstants.ENABLE_CHANGER, true) }
|
||||
false -> { settingsDataStoreImpl.putBoolean(SettingsConstants.ENABLE_CHANGER, false) }
|
||||
}
|
||||
_state.update {
|
||||
it.copy(
|
||||
enableChanger = event.toggle
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
is SettingsEvent.Refresh -> {
|
||||
currentGetJob = viewModelScope.launch {
|
||||
val darkMode =
|
||||
async { settingsDataStoreImpl.getBoolean(SettingsConstants.DARK_MODE_TYPE) }
|
||||
val dynamicTheming = async {
|
||||
settingsDataStoreImpl.getBoolean(SettingsConstants.DYNAMIC_THEME_TYPE)
|
||||
?: false
|
||||
}
|
||||
val wallpaperInterval = async {
|
||||
settingsDataStoreImpl.getInt(SettingsConstants.WALLPAPER_CHANGE_INTERVAL)
|
||||
?: SettingsConstants.WALLPAPER_CHANGE_INTERVAL_DEFAULT
|
||||
}
|
||||
val firstLaunch = async {
|
||||
settingsDataStoreImpl.getBoolean(SettingsConstants.FIRST_LAUNCH) ?: true
|
||||
}
|
||||
val setLockWithHome = async {
|
||||
settingsDataStoreImpl.getBoolean(SettingsConstants.SET_LOCK_WITH_HOME)
|
||||
?: false
|
||||
}
|
||||
val lastSetTime =
|
||||
async { settingsDataStoreImpl.getString(SettingsConstants.LAST_SET_TIME) }
|
||||
val nextSetTime =
|
||||
async { settingsDataStoreImpl.getString(SettingsConstants.NEXT_SET_TIME) }
|
||||
val animate = async {
|
||||
settingsDataStoreImpl.getBoolean(SettingsConstants.ANIMATE_TYPE) ?: true
|
||||
}
|
||||
currentGetJob = viewModelScope.launch(Dispatchers.IO) {
|
||||
val darkMode = async { settingsDataStoreImpl.getBoolean(SettingsConstants.DARK_MODE_TYPE) }
|
||||
val dynamicTheming = async { settingsDataStoreImpl.getBoolean(SettingsConstants.DYNAMIC_THEME_TYPE) ?: false }
|
||||
val wallpaperInterval = async { settingsDataStoreImpl.getInt(SettingsConstants.WALLPAPER_CHANGE_INTERVAL) ?: SettingsConstants.WALLPAPER_CHANGE_INTERVAL_DEFAULT }
|
||||
val firstLaunch = async { settingsDataStoreImpl.getBoolean(SettingsConstants.FIRST_LAUNCH) ?: true }
|
||||
val setLockWithHome = async { settingsDataStoreImpl.getBoolean(SettingsConstants.SET_LOCK_WITH_HOME) ?: false }
|
||||
val lastSetTime = async { settingsDataStoreImpl.getString(SettingsConstants.LAST_SET_TIME) }
|
||||
val nextSetTime = async { settingsDataStoreImpl.getString(SettingsConstants.NEXT_SET_TIME) }
|
||||
val animate = async { settingsDataStoreImpl.getBoolean(SettingsConstants.ANIMATE_TYPE) ?: true }
|
||||
val enableChanger = async { settingsDataStoreImpl.getBoolean(SettingsConstants.ENABLE_CHANGER) ?: false }
|
||||
|
||||
_state.update {
|
||||
it.copy(
|
||||
@@ -117,29 +106,19 @@ class SettingsViewModel @Inject constructor (
|
||||
firstLaunch = firstLaunch.await(),
|
||||
lastSetTime = lastSetTime.await(),
|
||||
nextSetTime = nextSetTime.await(),
|
||||
animate = animate.await()
|
||||
animate = animate.await(),
|
||||
enableChanger = enableChanger.await()
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
is SettingsEvent.SetDarkMode -> {
|
||||
viewModelScope.launch {
|
||||
viewModelScope.launch(Dispatchers.IO) {
|
||||
when (event.darkMode) {
|
||||
true -> {
|
||||
settingsDataStoreImpl.putBoolean(SettingsConstants.DARK_MODE_TYPE, true)
|
||||
}
|
||||
|
||||
false -> {
|
||||
settingsDataStoreImpl.putBoolean(
|
||||
SettingsConstants.DARK_MODE_TYPE,
|
||||
false
|
||||
)
|
||||
}
|
||||
|
||||
null -> {
|
||||
settingsDataStoreImpl.deleteBoolean(SettingsConstants.DARK_MODE_TYPE)
|
||||
}
|
||||
true -> { settingsDataStoreImpl.putBoolean(SettingsConstants.DARK_MODE_TYPE, true) }
|
||||
false -> { settingsDataStoreImpl.putBoolean(SettingsConstants.DARK_MODE_TYPE, false) }
|
||||
null -> { settingsDataStoreImpl.deleteBoolean(SettingsConstants.DARK_MODE_TYPE) }
|
||||
}
|
||||
_state.update {
|
||||
it.copy(
|
||||
@@ -150,21 +129,10 @@ class SettingsViewModel @Inject constructor (
|
||||
}
|
||||
|
||||
is SettingsEvent.SetDynamicTheming -> {
|
||||
viewModelScope.launch {
|
||||
viewModelScope.launch(Dispatchers.IO) {
|
||||
when (event.dynamicTheming) {
|
||||
true -> {
|
||||
settingsDataStoreImpl.putBoolean(
|
||||
SettingsConstants.DYNAMIC_THEME_TYPE,
|
||||
true
|
||||
)
|
||||
}
|
||||
|
||||
false -> {
|
||||
settingsDataStoreImpl.putBoolean(
|
||||
SettingsConstants.DYNAMIC_THEME_TYPE,
|
||||
false
|
||||
)
|
||||
}
|
||||
true -> { settingsDataStoreImpl.putBoolean(SettingsConstants.DYNAMIC_THEME_TYPE, true) }
|
||||
false -> { settingsDataStoreImpl.putBoolean(SettingsConstants.DYNAMIC_THEME_TYPE, false) }
|
||||
}
|
||||
_state.update {
|
||||
it.copy(
|
||||
@@ -175,15 +143,10 @@ class SettingsViewModel @Inject constructor (
|
||||
}
|
||||
|
||||
is SettingsEvent.SetAnimate -> {
|
||||
viewModelScope.launch {
|
||||
viewModelScope.launch(Dispatchers.IO) {
|
||||
when (event.animate) {
|
||||
true -> {
|
||||
settingsDataStoreImpl.putBoolean(SettingsConstants.ANIMATE_TYPE, true)
|
||||
}
|
||||
|
||||
false -> {
|
||||
settingsDataStoreImpl.putBoolean(SettingsConstants.ANIMATE_TYPE, false)
|
||||
}
|
||||
true -> { settingsDataStoreImpl.putBoolean(SettingsConstants.ANIMATE_TYPE, true) }
|
||||
false -> { settingsDataStoreImpl.putBoolean(SettingsConstants.ANIMATE_TYPE, false) }
|
||||
}
|
||||
_state.update {
|
||||
it.copy(
|
||||
@@ -194,24 +157,14 @@ class SettingsViewModel @Inject constructor (
|
||||
}
|
||||
|
||||
is SettingsEvent.SetWallpaperInterval -> {
|
||||
viewModelScope.launch {
|
||||
viewModelScope.launch(Dispatchers.IO) {
|
||||
val formatter = DateTimeFormatter.ofPattern("MM/dd/yy hh:mm\na")
|
||||
val time = LocalDateTime.now()
|
||||
val formattedLastSetTime = time.format(formatter)
|
||||
val formattedNextSetTime =
|
||||
time.plusMinutes(event.interval.toLong()).format(formatter)
|
||||
settingsDataStoreImpl.putString(
|
||||
SettingsConstants.LAST_SET_TIME,
|
||||
formattedLastSetTime
|
||||
)
|
||||
settingsDataStoreImpl.putString(
|
||||
SettingsConstants.NEXT_SET_TIME,
|
||||
formattedNextSetTime
|
||||
)
|
||||
settingsDataStoreImpl.putInt(
|
||||
SettingsConstants.WALLPAPER_CHANGE_INTERVAL,
|
||||
event.interval
|
||||
)
|
||||
val formattedNextSetTime = time.plusMinutes(event.interval.toLong()).format(formatter)
|
||||
settingsDataStoreImpl.putString(SettingsConstants.LAST_SET_TIME, formattedLastSetTime)
|
||||
settingsDataStoreImpl.putString(SettingsConstants.NEXT_SET_TIME, formattedNextSetTime)
|
||||
settingsDataStoreImpl.putInt(SettingsConstants.WALLPAPER_CHANGE_INTERVAL, event.interval)
|
||||
_state.update {
|
||||
it.copy(
|
||||
interval = event.interval,
|
||||
@@ -223,21 +176,10 @@ class SettingsViewModel @Inject constructor (
|
||||
}
|
||||
|
||||
is SettingsEvent.SetLockWithHome -> {
|
||||
viewModelScope.launch {
|
||||
viewModelScope.launch(Dispatchers.IO) {
|
||||
when (event.lockWithHome) {
|
||||
true -> {
|
||||
settingsDataStoreImpl.putBoolean(
|
||||
SettingsConstants.SET_LOCK_WITH_HOME,
|
||||
true
|
||||
)
|
||||
}
|
||||
|
||||
false -> {
|
||||
settingsDataStoreImpl.putBoolean(
|
||||
SettingsConstants.SET_LOCK_WITH_HOME,
|
||||
false
|
||||
)
|
||||
}
|
||||
true -> { settingsDataStoreImpl.putBoolean(SettingsConstants.SET_LOCK_WITH_HOME, true) }
|
||||
false -> { settingsDataStoreImpl.putBoolean(SettingsConstants.SET_LOCK_WITH_HOME, false) }
|
||||
}
|
||||
_state.update {
|
||||
it.copy(
|
||||
@@ -248,7 +190,7 @@ class SettingsViewModel @Inject constructor (
|
||||
}
|
||||
|
||||
is SettingsEvent.Reset -> {
|
||||
viewModelScope.launch {
|
||||
viewModelScope.launch(Dispatchers.IO) {
|
||||
settingsDataStoreImpl.deleteBoolean(SettingsConstants.DARK_MODE_TYPE)
|
||||
settingsDataStoreImpl.deleteBoolean(SettingsConstants.DYNAMIC_THEME_TYPE)
|
||||
settingsDataStoreImpl.deleteBoolean(SettingsConstants.FIRST_LAUNCH)
|
||||
@@ -257,6 +199,7 @@ class SettingsViewModel @Inject constructor (
|
||||
settingsDataStoreImpl.deleteString(SettingsConstants.NEXT_SET_TIME)
|
||||
settingsDataStoreImpl.deleteBoolean(SettingsConstants.ANIMATE_TYPE)
|
||||
settingsDataStoreImpl.deleteInt(SettingsConstants.WALLPAPER_CHANGE_INTERVAL)
|
||||
settingsDataStoreImpl.deleteBoolean(SettingsConstants.ENABLE_CHANGER)
|
||||
_state.update {
|
||||
it.copy(
|
||||
darkMode = null,
|
||||
@@ -266,7 +209,8 @@ class SettingsViewModel @Inject constructor (
|
||||
firstLaunch = true,
|
||||
lastSetTime = null,
|
||||
nextSetTime = null,
|
||||
animate = true
|
||||
animate = true,
|
||||
enableChanger = false
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ fun PaperizeListItem(onGitHubClick: () -> Unit, onPlaystoreClick: () -> Unit, on
|
||||
fontSize = MaterialTheme.typography.titleLarge.fontSize
|
||||
)
|
||||
Text(
|
||||
text = "Version: 1.0.1",
|
||||
text = "Version: 1.1.0",
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
fontSize = MaterialTheme.typography.bodyMedium.fontSize
|
||||
)
|
||||
|
||||
@@ -6,18 +6,17 @@ import android.os.Build
|
||||
import androidx.activity.SystemBarStyle
|
||||
import androidx.compose.foundation.isSystemInDarkTheme
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.lightColorScheme
|
||||
import androidx.compose.material3.darkColorScheme
|
||||
import androidx.compose.material3.dynamicDarkColorScheme
|
||||
import androidx.compose.material3.dynamicLightColorScheme
|
||||
import androidx.compose.material3.lightColorScheme
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.SideEffect
|
||||
import androidx.compose.runtime.State
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.platform.LocalView
|
||||
import androidx.core.view.WindowCompat
|
||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||
import com.anthonyla.paperize.feature.wallpaper.presentation.settings_screen.SettingsState
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
|
||||
|
||||
private val LightColors = lightColorScheme(
|
||||
@@ -91,14 +90,13 @@ private val DarkColors = darkColorScheme(
|
||||
*/
|
||||
@Composable
|
||||
fun PaperizeTheme(
|
||||
settingsState: StateFlow<SettingsState>,
|
||||
settingsState: State<SettingsState>,
|
||||
content: @Composable () -> Unit
|
||||
) {
|
||||
val state = settingsState.collectAsStateWithLifecycle()
|
||||
val context = LocalContext.current
|
||||
|
||||
val isDarkMode = isDarkMode(darkMode = state.value.darkMode)
|
||||
val isDynamicTheming = isDynamicTheming(dynamicTheming = state.value.dynamicTheming)
|
||||
val isDarkMode = isDarkMode(darkMode = settingsState.value.darkMode)
|
||||
val isDynamicTheming = isDynamicTheming(dynamicTheming = settingsState.value.dynamicTheming)
|
||||
val dynamicThemingSupported = Build.VERSION.SDK_INT >= Build.VERSION_CODES.S
|
||||
val colors = when {
|
||||
isDynamicTheming && dynamicThemingSupported && isDarkMode -> dynamicDarkColorScheme(context)
|
||||
|
||||
@@ -22,9 +22,11 @@ import androidx.compose.runtime.saveable.rememberSaveable
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
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.domain.model.SelectedAlbum
|
||||
import com.anthonyla.paperize.feature.wallpaper.domain.model.Wallpaper
|
||||
import com.anthonyla.paperize.feature.wallpaper.presentation.album.AlbumsViewModel
|
||||
@@ -44,18 +46,21 @@ fun WallpaperScreen(
|
||||
settingsViewModel: SettingsViewModel = hiltViewModel(),
|
||||
onScheduleWallpaperChanger: (Int) -> Unit,
|
||||
onSetLockWithHome: (Boolean) -> Unit,
|
||||
onToggleChanger: (Boolean) -> Unit,
|
||||
onStop: () -> Unit,
|
||||
animate: Boolean,
|
||||
interval: Int,
|
||||
setLockWithHome: Boolean,
|
||||
lastSetTime: String?,
|
||||
nextSetTime: String?,
|
||||
selectedAlbum: SelectedAlbum?
|
||||
selectedAlbum: SelectedAlbum?,
|
||||
enableChanger: Boolean
|
||||
) {
|
||||
val albumState = albumsViewModel.state.collectAsStateWithLifecycle()
|
||||
var openBottomSheet by rememberSaveable { mutableStateOf(false) }
|
||||
val scope = rememberCoroutineScope()
|
||||
val snackbarHostState = remember { SnackbarHostState() }
|
||||
val context = LocalContext.current
|
||||
|
||||
Scaffold(
|
||||
snackbarHost = {
|
||||
@@ -88,15 +93,29 @@ fun WallpaperScreen(
|
||||
scope.launch {
|
||||
snackbarHostState.currentSnackbarData?.dismiss()
|
||||
snackbarHostState.showSnackbar(
|
||||
message = "${selectedAlbum.album.displayedAlbumName} has been unselected.",
|
||||
actionLabel = "Dismiss",
|
||||
message = context.getString(R.string.has_been_unselected, selectedAlbum.album.displayedAlbumName),
|
||||
actionLabel = context.getString(R.string.dismiss),
|
||||
duration = SnackbarDuration.Short
|
||||
)
|
||||
}
|
||||
onStop()
|
||||
}
|
||||
},
|
||||
animate = animate
|
||||
animate = animate,
|
||||
enableChanger = enableChanger,
|
||||
onToggleChanger = {
|
||||
if (!it) {
|
||||
scope.launch {
|
||||
snackbarHostState.currentSnackbarData?.dismiss()
|
||||
snackbarHostState.showSnackbar(
|
||||
message = context.getString(R.string.wallpaper_changer_has_been_disabled),
|
||||
actionLabel = context.getString(R.string.dismiss),
|
||||
duration = SnackbarDuration.Short
|
||||
)
|
||||
}
|
||||
}
|
||||
onToggleChanger(it)
|
||||
}
|
||||
)
|
||||
}
|
||||
item {
|
||||
@@ -126,7 +145,7 @@ fun WallpaperScreen(
|
||||
) {
|
||||
if (selectedAlbum != null) {
|
||||
SetLockScreenSwitch(
|
||||
albumUri = selectedAlbum.album.coverUri,
|
||||
albumUri = selectedAlbum.album.currentWallpaper,
|
||||
checked = setLockWithHome,
|
||||
onCheckedChange = { onSetLockWithHome(it) },
|
||||
animate = true
|
||||
@@ -137,7 +156,7 @@ fun WallpaperScreen(
|
||||
else {
|
||||
if (selectedAlbum != null) {
|
||||
SetLockScreenSwitch(
|
||||
albumUri = selectedAlbum.album.coverUri,
|
||||
albumUri = selectedAlbum.album.currentWallpaper,
|
||||
checked = setLockWithHome,
|
||||
onCheckedChange = { onSetLockWithHome(it) },
|
||||
animate = false
|
||||
@@ -156,9 +175,6 @@ fun WallpaperScreen(
|
||||
timeInMinutes = interval,
|
||||
onTimeChange = { days, hours, minutes ->
|
||||
val totalMinutes = 24 * days * 60 + hours * 60 + minutes
|
||||
settingsViewModel.onEvent(
|
||||
SettingsEvent.SetWallpaperInterval(totalMinutes)
|
||||
)
|
||||
onScheduleWallpaperChanger(totalMinutes)
|
||||
}
|
||||
)
|
||||
@@ -170,9 +186,6 @@ fun WallpaperScreen(
|
||||
timeInMinutes = interval,
|
||||
onTimeChange = { days, hours, minutes ->
|
||||
val totalMinutes = 24 * days * 60 + hours * 60 + minutes
|
||||
settingsViewModel.onEvent(
|
||||
SettingsEvent.SetWallpaperInterval(totalMinutes)
|
||||
)
|
||||
onScheduleWallpaperChanger(totalMinutes)
|
||||
}
|
||||
)
|
||||
@@ -195,23 +208,19 @@ fun WallpaperScreen(
|
||||
)
|
||||
}
|
||||
}.toList()
|
||||
val shuffledWallpapers = wallpapers.map { it.wallpaperUri }.shuffled()
|
||||
val newSelectedAlbum = SelectedAlbum(
|
||||
album = album.album.copy(
|
||||
wallpapersInQueue = wallpapers.map { it.wallpaperUri }.shuffled()
|
||||
wallpapersInQueue = shuffledWallpapers,
|
||||
currentWallpaper = shuffledWallpapers.firstOrNull()
|
||||
),
|
||||
wallpapers = wallpapers
|
||||
)
|
||||
settingsViewModel.onEvent(SettingsEvent.SetChangerToggle(true))
|
||||
wallpaperScreenViewModel.onEvent(WallpaperEvent.UpdateSelectedAlbum(newSelectedAlbum))
|
||||
openBottomSheet = false
|
||||
scope.launch {
|
||||
snackbarHostState.currentSnackbarData?.dismiss()
|
||||
snackbarHostState.showSnackbar(
|
||||
message = "${album.album.displayedAlbumName} has been selected.",
|
||||
actionLabel = "Dismiss",
|
||||
duration = SnackbarDuration.Short
|
||||
)
|
||||
}
|
||||
onScheduleWallpaperChanger(interval)
|
||||
onToggleChanger(true)
|
||||
},
|
||||
animate = animate
|
||||
)
|
||||
|
||||
@@ -11,7 +11,6 @@ import kotlinx.coroutines.flow.SharingStarted
|
||||
import kotlinx.coroutines.flow.stateIn
|
||||
import kotlinx.coroutines.flow.update
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
import javax.inject.Inject
|
||||
|
||||
@HiltViewModel
|
||||
@@ -26,31 +25,36 @@ class WallpaperScreenViewModel @Inject constructor (
|
||||
)
|
||||
|
||||
init {
|
||||
viewModelScope.launch {
|
||||
refreshAlbums()
|
||||
viewModelScope.launch(Dispatchers.IO) {
|
||||
repository.getSelectedAlbum().collect { selectedAlbum ->
|
||||
_state.update {
|
||||
it.copy(
|
||||
selectedAlbum = selectedAlbum.firstOrNull(),
|
||||
isDataLoaded = true
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun onEvent(event: WallpaperEvent) {
|
||||
when (event) {
|
||||
is WallpaperEvent.UpdateSelectedAlbum -> {
|
||||
viewModelScope.launch {
|
||||
withContext(Dispatchers.IO) {
|
||||
repository.deleteAll()
|
||||
repository.upsertSelectedAlbum(event.selectedAlbum)
|
||||
}
|
||||
viewModelScope.launch(Dispatchers.IO) {
|
||||
repository.deleteAll()
|
||||
repository.upsertSelectedAlbum(event.selectedAlbum)
|
||||
}
|
||||
}
|
||||
is WallpaperEvent.Refresh -> {
|
||||
refreshAlbums()
|
||||
}
|
||||
is WallpaperEvent.Reset -> {
|
||||
viewModelScope.launch {
|
||||
withContext(Dispatchers.IO) {
|
||||
repository.deleteAll()
|
||||
_state.update {
|
||||
WallpaperState()
|
||||
}
|
||||
viewModelScope.launch(Dispatchers.IO) {
|
||||
repository.deleteAll()
|
||||
_state.update {
|
||||
it.copy(
|
||||
selectedAlbum = null
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -59,10 +63,10 @@ class WallpaperScreenViewModel @Inject constructor (
|
||||
|
||||
// Retrieve album from database into viewModel
|
||||
private fun refreshAlbums() {
|
||||
viewModelScope.launch {
|
||||
viewModelScope.launch(Dispatchers.IO) {
|
||||
repository.getSelectedAlbum().collect { selectedAlbum ->
|
||||
_state.update { it.copy(
|
||||
selectedAlbum = selectedAlbum.firstOrNull()
|
||||
selectedAlbum = selectedAlbum.firstOrNull(),
|
||||
) }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,5 +3,6 @@ package com.anthonyla.paperize.feature.wallpaper.presentation.wallpaper_screen
|
||||
import com.anthonyla.paperize.feature.wallpaper.domain.model.SelectedAlbum
|
||||
|
||||
data class WallpaperState (
|
||||
val isDataLoaded: Boolean = false,
|
||||
val selectedAlbum: SelectedAlbum? = null
|
||||
)
|
||||
@@ -72,6 +72,7 @@ fun AlbumBottomSheet(
|
||||
tonalElevation = 5.dp
|
||||
) {
|
||||
albums.forEach {
|
||||
if (it.folders.sumOf { folder -> folder.wallpapers.size } + it.wallpapers.size == 0) return@forEach
|
||||
ListItem(
|
||||
modifier = Modifier
|
||||
.padding(4.dp)
|
||||
|
||||
@@ -3,7 +3,9 @@ package com.anthonyla.paperize.feature.wallpaper.presentation.wallpaper_screen.c
|
||||
import android.content.Context
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.PaddingValues
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.aspectRatio
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
@@ -19,11 +21,14 @@ import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.IconButton
|
||||
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.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.draw.rotate
|
||||
import androidx.compose.ui.draw.scale
|
||||
import androidx.compose.ui.layout.ContentScale
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.res.stringResource
|
||||
@@ -43,9 +48,11 @@ import com.skydoves.landscapist.glide.GlideImage
|
||||
@Composable
|
||||
fun CurrentSelectedAlbum(
|
||||
selectedAlbum: SelectedAlbum?,
|
||||
enableChanger: Boolean,
|
||||
onOpenBottomSheet: () -> Unit,
|
||||
onStop: () -> Unit,
|
||||
animate: Boolean
|
||||
animate: Boolean,
|
||||
onToggleChanger: (Boolean) -> Unit
|
||||
) {
|
||||
fun isValidUri(context: Context, uriString: String?): Boolean {
|
||||
val uri = uriString?.toUri()
|
||||
@@ -62,9 +69,15 @@ fun CurrentSelectedAlbum(
|
||||
|
||||
ListItem(
|
||||
modifier = Modifier
|
||||
.padding(16.dp)
|
||||
.padding(PaddingValues(vertical = 8.dp, horizontal = 16.dp))
|
||||
.clip(RoundedCornerShape(16.dp))
|
||||
.clickable { onOpenBottomSheet() },
|
||||
.clickable {
|
||||
if (selectedAlbum != null) {
|
||||
onToggleChanger(!enableChanger)
|
||||
} else {
|
||||
onOpenBottomSheet()
|
||||
}
|
||||
},
|
||||
headlineContent = {
|
||||
Text(
|
||||
text = selectedAlbum?.album?.displayedAlbumName ?: stringResource(R.string.no_album_selected),
|
||||
@@ -119,7 +132,10 @@ fun CurrentSelectedAlbum(
|
||||
}
|
||||
},
|
||||
trailingContent = {
|
||||
Row {
|
||||
Row (
|
||||
horizontalArrangement = Arrangement.spacedBy((-8).dp),
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
if (selectedAlbum != null) {
|
||||
IconButton(onClick = { onStop() }) {
|
||||
Icon(imageVector = Icons.Default.Stop, contentDescription = stringResource(R.string.stop_the_album))
|
||||
@@ -131,6 +147,15 @@ fun CurrentSelectedAlbum(
|
||||
imageVector = Icons.Filled.ArrowDropDown,
|
||||
)
|
||||
}
|
||||
if (selectedAlbum != null) {
|
||||
Switch(
|
||||
checked = enableChanger,
|
||||
onCheckedChange = onToggleChanger,
|
||||
modifier = Modifier
|
||||
.rotate(270f)
|
||||
.scale(0.75f)
|
||||
)
|
||||
}
|
||||
}
|
||||
},
|
||||
tonalElevation = 10.dp
|
||||
|
||||
@@ -57,7 +57,7 @@ fun SetLockScreenSwitch(
|
||||
}
|
||||
if (animate) {
|
||||
AnimatedVisibility(
|
||||
visible = checked,
|
||||
visible = checked && albumUri != null,
|
||||
enter = expandVertically(animationSpec = spring(dampingRatio = Spring.DampingRatioMediumBouncy, stiffness = Spring.StiffnessLow)),
|
||||
exit = shrinkVertically(animationSpec = tween(durationMillis = 700, easing = LinearOutSlowInEasing))
|
||||
) {
|
||||
@@ -19,9 +19,10 @@ import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.platform.LocalView
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.unit.dp
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import com.anthonyla.paperize.R
|
||||
import kotlinx.coroutines.Job
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.launch
|
||||
@@ -51,21 +52,25 @@ fun TimeSliders(
|
||||
val displayHours = (totalMinutes % (24 * 60)) / 60
|
||||
val displayMinutes = totalMinutes % 60
|
||||
val formattedDays = when {
|
||||
displayDays > 1 -> "$displayDays days"
|
||||
displayDays == 1 -> "$displayDays day"
|
||||
displayDays > 1 -> stringResource(R.string.days, displayDays)
|
||||
displayDays == 1 -> stringResource(R.string.day, displayDays)
|
||||
else -> ""
|
||||
}
|
||||
val formattedHours = when {
|
||||
displayHours > 1 -> "$displayHours hours"
|
||||
displayHours == 1 -> "$displayHours hour"
|
||||
displayHours > 1 -> stringResource(R.string.hours, displayHours)
|
||||
displayHours == 1 -> stringResource(R.string.hour, displayHours)
|
||||
else -> ""
|
||||
}
|
||||
val formattedMinutes = when {
|
||||
displayMinutes > 1 -> "$displayMinutes minutes"
|
||||
displayMinutes == 1 -> "$displayMinutes minute"
|
||||
displayMinutes > 1 -> stringResource(R.string.minutes, displayMinutes)
|
||||
displayMinutes == 1 -> stringResource(R.string.minute, displayMinutes)
|
||||
else -> ""
|
||||
}
|
||||
val formattedTime = "Interval | ${listOf(formattedDays, formattedHours, formattedMinutes).filter { it.isNotEmpty() }.joinToString(", ")}"
|
||||
val formattedTime = stringResource(
|
||||
R.string.interval,
|
||||
listOf(formattedDays, formattedHours, formattedMinutes).filter { it.isNotEmpty() }
|
||||
.joinToString(", ")
|
||||
)
|
||||
|
||||
Text(
|
||||
text = formattedTime,
|
||||
@@ -78,8 +83,8 @@ fun TimeSliders(
|
||||
onValueChange = { newDays ->
|
||||
view.performHapticFeedback(HapticFeedbackConstants.CLOCK_TICK)
|
||||
days = newDays
|
||||
val totalMinutes = (newDays.toInt() * 24 * 60) + (hours.toInt() * 60) + minutes.toInt()
|
||||
if (totalMinutes < 15) {
|
||||
val totalMinute = (newDays.toInt() * 24 * 60) + (hours.toInt() * 60) + minutes.toInt()
|
||||
if (totalMinute < 15) {
|
||||
minutes = 15f - (hours.toInt() * 60)
|
||||
}
|
||||
job?.cancel()
|
||||
@@ -98,8 +103,8 @@ fun TimeSliders(
|
||||
onValueChange = { newHours ->
|
||||
view.performHapticFeedback(HapticFeedbackConstants.CLOCK_TICK)
|
||||
hours = newHours
|
||||
val totalMinutes = (days.toInt() * 24 * 60) + (newHours.toInt() * 60) + minutes.toInt()
|
||||
if (totalMinutes < 15) {
|
||||
val totalMinute = (days.toInt() * 24 * 60) + (newHours.toInt() * 60) + minutes.toInt()
|
||||
if (totalMinute < 15) {
|
||||
minutes = 15f - (newHours.toInt() * 60)
|
||||
}
|
||||
job?.cancel()
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.anthonyla.paperize.feature.wallpaper.wallpaperservice
|
||||
|
||||
import android.app.Notification
|
||||
import android.app.NotificationManager
|
||||
import android.app.PendingIntent
|
||||
import android.app.Service
|
||||
import android.app.WallpaperManager
|
||||
import android.content.Context
|
||||
@@ -19,7 +20,9 @@ import androidx.core.net.toUri
|
||||
import com.anthonyla.paperize.R
|
||||
import com.anthonyla.paperize.core.SettingsConstants
|
||||
import com.anthonyla.paperize.data.settings.SettingsDataStore
|
||||
import com.anthonyla.paperize.feature.wallpaper.domain.repository.AlbumRepository
|
||||
import com.anthonyla.paperize.feature.wallpaper.domain.repository.SelectedAlbumRepository
|
||||
import com.anthonyla.paperize.feature.wallpaper.presentation.MainActivity
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
@@ -33,7 +36,8 @@ import javax.inject.Inject
|
||||
|
||||
@AndroidEntryPoint
|
||||
class WallpaperService: Service() {
|
||||
@Inject lateinit var repository: SelectedAlbumRepository
|
||||
@Inject lateinit var selectedRepository: SelectedAlbumRepository
|
||||
@Inject lateinit var albumRepository: AlbumRepository
|
||||
@Inject lateinit var settingsDataStoreImpl: SettingsDataStore
|
||||
private val handler = Handler(Looper.getMainLooper())
|
||||
private lateinit var runnableCode: Runnable
|
||||
@@ -110,7 +114,6 @@ class WallpaperService: Service() {
|
||||
* Clean up the service when it is destroyed
|
||||
*/
|
||||
override fun onDestroy() {
|
||||
Log.d("PaperizeWallpaperChanger", "Service destroyed")
|
||||
super.onDestroy()
|
||||
handler.removeCallbacks(runnableCode)
|
||||
CoroutineScope(Dispatchers.IO).launch {
|
||||
@@ -123,10 +126,13 @@ class WallpaperService: Service() {
|
||||
* Creates a notification for the wallpaper service
|
||||
*/
|
||||
private fun createNotification(current: Int = 0, total: Int = 0): Notification {
|
||||
val intent = Intent(this, MainActivity::class.java)
|
||||
val pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT)
|
||||
return NotificationCompat.Builder(this, "wallpaper_service_channel")
|
||||
.setContentTitle("Paperize")
|
||||
.setContentText("Rotation: $current/$total wallpapers\nInterval: ${formatTime(timeInMinutes)}")
|
||||
.setSmallIcon(R.drawable.notification_icon)
|
||||
.setContentIntent(pendingIntent)
|
||||
.build()
|
||||
}
|
||||
|
||||
@@ -140,43 +146,84 @@ class WallpaperService: Service() {
|
||||
settingsDataStoreImpl.putString(SettingsConstants.LAST_SET_TIME, time.format(formatter))
|
||||
settingsDataStoreImpl.putString(SettingsConstants.NEXT_SET_TIME, time.plusMinutes(timeInMinutes.toLong()).format(formatter))
|
||||
val setLockWithHome = settingsDataStoreImpl.getBoolean(SettingsConstants.SET_LOCK_WITH_HOME) ?: false
|
||||
val album = repository.getSelectedAlbum().first().firstOrNull()
|
||||
album?.let {
|
||||
val notification = createNotification(it.album.wallpapersInQueue.size, it.wallpapers.size)
|
||||
val notificationManager = getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
|
||||
notificationManager.notify(1, notification)
|
||||
val selectedAlbum = selectedRepository.getSelectedAlbum().first().firstOrNull()
|
||||
selectedAlbum?.let { it ->
|
||||
var wallpaper = it.album.wallpapersInQueue.firstOrNull()
|
||||
// Pick the next wallpaper in the queue
|
||||
if (wallpaper != null) {
|
||||
setWallpaper(context, wallpaper.toUri(), setLockWithHome)
|
||||
repository.upsertSelectedAlbum(
|
||||
it.copy(
|
||||
album = it.album.copy(
|
||||
wallpapersInQueue = it.album.wallpapersInQueue.drop(1)
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
else {
|
||||
val newWallpaperInQueue = it.wallpapers.map { it.wallpaperUri }.shuffled()
|
||||
wallpaper = newWallpaperInQueue.firstOrNull()
|
||||
if (wallpaper != null) {
|
||||
setWallpaper(context, wallpaper.toUri(), setLockWithHome)
|
||||
repository.upsertSelectedAlbum(
|
||||
val notification = createNotification(it.album.wallpapersInQueue.size, it.wallpapers.size)
|
||||
val notificationManager = getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
|
||||
notificationManager.notify(1, notification)
|
||||
if (!setWallpaper(context, wallpaper.toUri(), setLockWithHome)) {
|
||||
selectedAlbum.wallpapers.firstOrNull{ it.wallpaperUri == wallpaper }
|
||||
?.let { it1 ->
|
||||
selectedRepository.deleteWallpaper(it1)
|
||||
selectedRepository.upsertSelectedAlbum(
|
||||
it.copy(
|
||||
album = it.album.copy(
|
||||
wallpapersInQueue = it.album.wallpapersInQueue.drop(1),
|
||||
currentWallpaper = null
|
||||
),
|
||||
wallpapers = it.wallpapers.filter { it == it1 },
|
||||
)
|
||||
)
|
||||
albumRepository.deleteWallpaper(it1)
|
||||
}
|
||||
}
|
||||
else {
|
||||
selectedRepository.upsertSelectedAlbum(
|
||||
it.copy(
|
||||
album = it.album.copy(
|
||||
wallpapersInQueue = newWallpaperInQueue.drop(1)
|
||||
wallpapersInQueue = it.album.wallpapersInQueue.drop(1),
|
||||
currentWallpaper = wallpaper
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
// No more wallpapers in the queue -- reshuffle the wallpapers
|
||||
else {
|
||||
val notification = createNotification(it.wallpapers.size, it.wallpapers.size)
|
||||
val notificationManager = getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
|
||||
notificationManager.notify(1, notification)
|
||||
val newWallpaperInQueue = it.wallpapers.map { it.wallpaperUri }.shuffled()
|
||||
wallpaper = newWallpaperInQueue.firstOrNull()
|
||||
if (wallpaper != null) {
|
||||
if (!setWallpaper(context, wallpaper.toUri(), setLockWithHome)) {
|
||||
selectedAlbum.wallpapers.firstOrNull{ it.wallpaperUri == wallpaper }
|
||||
?.let { it1 ->
|
||||
selectedRepository.deleteWallpaper(it1)
|
||||
selectedRepository.upsertSelectedAlbum(
|
||||
it.copy(
|
||||
album = it.album.copy(
|
||||
wallpapersInQueue = it.album.wallpapersInQueue.drop(1),
|
||||
currentWallpaper = null
|
||||
),
|
||||
wallpapers = it.wallpapers.filter { it == it1 }
|
||||
)
|
||||
)
|
||||
albumRepository.deleteWallpaper(it1)
|
||||
}
|
||||
}
|
||||
else {
|
||||
selectedRepository.upsertSelectedAlbum(
|
||||
it.copy(
|
||||
album = it.album.copy(
|
||||
wallpapersInQueue = newWallpaperInQueue.drop(1),
|
||||
currentWallpaper = wallpaper
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
} else { onDestroy() }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the wallpaper to the given uri
|
||||
*/
|
||||
private fun setWallpaper(context: Context, wallpaper: Uri, setLockWithHome: Boolean) {
|
||||
private fun setWallpaper(context: Context, wallpaper: Uri, setLockWithHome: Boolean): Boolean {
|
||||
val wallpaperManager = WallpaperManager.getInstance(context)
|
||||
try {
|
||||
val bitmap = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||
@@ -198,9 +245,8 @@ class WallpaperService: Service() {
|
||||
false -> WallpaperManager.FLAG_SYSTEM
|
||||
})
|
||||
}
|
||||
} catch (e: IOException) {
|
||||
Log.e("PaperizeWallpaperChanger", "Error changing wallpaper", e)
|
||||
}
|
||||
return true
|
||||
} catch (e: IOException) { return false }
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,170 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<path
|
||||
android:fillColor="#3DDC84"
|
||||
android:pathData="M0,0h108v108h-108z" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M9,0L9,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,0L19,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,0L29,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,0L39,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,0L49,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,0L59,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,0L69,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,0L79,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M89,0L89,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M99,0L99,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,9L108,9"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,19L108,19"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,29L108,29"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,39L108,39"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,49L108,49"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,59L108,59"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,69L108,69"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,79L108,79"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,89L108,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,99L108,99"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,29L89,29"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,39L89,39"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,49L89,49"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,59L89,59"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,69L89,69"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,79L89,79"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,19L29,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,19L39,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,19L49,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,19L59,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,19L69,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,19L79,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
</vector>
|
||||
@@ -1,30 +0,0 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:aapt="http://schemas.android.com/aapt"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
|
||||
<aapt:attr name="android:fillColor">
|
||||
<gradient
|
||||
android:endX="85.84757"
|
||||
android:endY="92.4963"
|
||||
android:startX="42.9492"
|
||||
android:startY="49.59793"
|
||||
android:type="linear">
|
||||
<item
|
||||
android:color="#44000000"
|
||||
android:offset="0.0" />
|
||||
<item
|
||||
android:color="#00000000"
|
||||
android:offset="1.0" />
|
||||
</gradient>
|
||||
</aapt:attr>
|
||||
</path>
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:fillType="nonZero"
|
||||
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
|
||||
android:strokeWidth="1"
|
||||
android:strokeColor="#00000000" />
|
||||
</vector>
|
||||
@@ -2,4 +2,5 @@
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@color/app_icon_background"/>
|
||||
<foreground android:drawable="@drawable/app_icon_foreground"/>
|
||||
<monochrome android:drawable="@drawable/app_icon_foreground"/>
|
||||
</adaptive-icon>
|
||||
@@ -2,4 +2,5 @@
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@color/app_icon_background"/>
|
||||
<foreground android:drawable="@drawable/app_icon_foreground"/>
|
||||
<monochrome android:drawable="@drawable/app_icon_foreground"/>
|
||||
</adaptive-icon>
|
||||
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
||||
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
||||
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 982 B |
|
Before Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 5.8 KiB |
|
Before Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 7.6 KiB |
@@ -61,4 +61,19 @@
|
||||
<string name="reset_all_data">Reset all data</string>
|
||||
<string name="are_you_sure_you_want_to_reset_all_settings_and_data_to_default">Are you sure you want to reset all settings and data to default?</string>
|
||||
<string name="confirm">Confirm</string>
|
||||
<string name="spotlight_animation">Spotlight animation</string>
|
||||
<string name="circle_2_animation">Circle 2 animation</string>
|
||||
<string name="circle_1_animation">Circle 1 animation</string>
|
||||
<string name="circle_3_animation">Circle 3 animation</string>
|
||||
<string name="wallpaper_changer_has_been_enabled">Wallpaper changer has been enabled.</string>
|
||||
<string name="wallpaper_changer_has_been_disabled">Wallpaper changer has been disabled.</string>
|
||||
<string name="dismiss">Dismiss</string>
|
||||
<string name="has_been_unselected">%1$s has been unselected.</string>
|
||||
<string name="interval">Interval | %1$s</string>
|
||||
<string name="minutes">%1$s minutes</string>
|
||||
<string name="minute">%1$s minute</string>
|
||||
<string name="hour">%1$s hour</string>
|
||||
<string name="hours">%1$s hours</string>
|
||||
<string name="day">%1$s day</string>
|
||||
<string name="days">%1$s days</string>
|
||||
</resources>
|
||||
@@ -0,0 +1,8 @@
|
||||
v1.1.0
|
||||
Added toggle for enabling wallpaper changer
|
||||
Added current set wallpaper preview
|
||||
Added adaptive icon support
|
||||
Updated splash screen loading animation
|
||||
Refactored code to be more performant
|
||||
Fixed an issue when trying to change wallpaper to an invalid one
|
||||
Fixed an issue where users could select an empty album
|
||||