Fixed wallpaper alarm not properly rescheduling
Fixed out of bounds array access Added tasker shortcut
This commit is contained in:
1 parent
e8f8a145ea
commit
064237bed4
13 files changed
+260
-106
No files matched your search
@@ -112,6 +112,7 @@ dependencies {
|
||||
implementation("com.mikepenz:aboutlibraries-compose-m3:11.2.2")
|
||||
implementation("androidx.compose.foundation:foundation:1.7.0-beta07")
|
||||
implementation("com.github.nanihadesuka:LazyColumnScrollbar:2.2.0")
|
||||
implementation("com.joaomgcd:taskerpluginlibrary:0.4.10")
|
||||
testImplementation("junit:junit:4.13.2")
|
||||
androidTestImplementation("androidx.test.ext:junit:1.2.1")
|
||||
androidTestImplementation("androidx.test.espresso:espresso-core:3.6.1")
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
<uses-permission android:name="android.permission.SET_WALLPAPER"/>
|
||||
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" tools:node="remove"/>
|
||||
|
||||
<application
|
||||
@@ -59,5 +60,14 @@
|
||||
<meta-data android:name="androidx.emoji2.text.EmojiCompatInitializer"
|
||||
tools:node="remove" />
|
||||
</provider>
|
||||
<activity
|
||||
android:name=".feature.wallpaper.tasker_shortcut.ActivityConfigBasicAction"
|
||||
android:exported="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="Change wallpaper">
|
||||
<intent-filter>
|
||||
<action android:name="com.twofortyfouram.locale.intent.action.EDIT_SETTING" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
</manifest>
|
||||
@@ -32,4 +32,6 @@ object SettingsConstants {
|
||||
const val BLUR_PERCENTAGE = "blur_percentage"
|
||||
const val HOME_NEXT_SET_TIME = "next_set_time_1"
|
||||
const val LOCK_NEXT_SET_TIME = "next_set_time_2"
|
||||
const val NEXT_HOME_WALLPAPER = "next_home_wallpaper"
|
||||
const val NEXT_LOCK_WALLPAPER = "next_lock_wallpaper"
|
||||
}
|
||||
+65
-56
@@ -107,7 +107,7 @@ fun PaperizeApp(
|
||||
selectedAlbum.album.coverUri != album.album.coverUri ||
|
||||
selectedAlbum.wallpapers.size != album.wallpapers.size + album.folders.sumOf { it.wallpapers.size })
|
||||
{
|
||||
wallpaperScreenViewModel.onEvent(WallpaperEvent.UpdateSelectedAlbum(album, selectedAlbum.album.initialAlbumName))
|
||||
wallpaperScreenViewModel.onEvent(WallpaperEvent.AddSelectedAlbum(album, selectedAlbum.album.initialAlbumName))
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -315,46 +315,10 @@ fun PaperizeApp(
|
||||
if (!selectedState.value.selectedAlbum.isNullOrEmpty() && !settingsState.value.homeAlbumName.isNullOrEmpty() && !settingsState.value.lockAlbumName.isNullOrEmpty()) {
|
||||
settingsViewModel.onEvent(SettingsEvent.SetChangerToggle(enableWallpaperChanger))
|
||||
if (enableWallpaperChanger) {
|
||||
settingsViewModel.onEvent(SettingsEvent.RefreshNextSetTime)
|
||||
val currentHomeAlbum = selectedState.value.selectedAlbum?.find { it.album.initialAlbumName == settingsState.value.homeAlbumName }
|
||||
val currentLockAlbum = selectedState.value.selectedAlbum?.find { it.album.initialAlbumName == settingsState.value.lockAlbumName }
|
||||
when {
|
||||
settingsState.value.scheduleSeparately && settingsState.value.setHomeWallpaper && settingsState.value.setLockWallpaper -> {
|
||||
if (currentHomeAlbum != null && currentLockAlbum != null) {
|
||||
settingsViewModel.onEvent(SettingsEvent.SetCurrentWallpaper(
|
||||
currentHomeWallpaper = currentHomeAlbum.album.homeWallpapersInQueue.firstOrNull() ?: currentHomeAlbum.wallpapers.firstOrNull()?.wallpaperUri,
|
||||
currentLockWallpaper = currentLockAlbum.album.lockWallpapersInQueue.firstOrNull() ?: currentLockAlbum.wallpapers.firstOrNull()?.wallpaperUri
|
||||
))
|
||||
}
|
||||
}
|
||||
!settingsState.value.scheduleSeparately && settingsState.value.setHomeWallpaper && settingsState.value.setLockWallpaper -> {
|
||||
if (currentHomeAlbum != null && currentLockAlbum != null) {
|
||||
settingsViewModel.onEvent(SettingsEvent.SetCurrentWallpaper(
|
||||
currentHomeWallpaper = currentHomeAlbum.album.homeWallpapersInQueue.firstOrNull() ?: currentHomeAlbum.wallpapers.firstOrNull()?.wallpaperUri,
|
||||
currentLockWallpaper = currentHomeAlbum.album.homeWallpapersInQueue.firstOrNull() ?: currentHomeAlbum.wallpapers.firstOrNull()?.wallpaperUri
|
||||
))
|
||||
}
|
||||
}
|
||||
settingsState.value.setHomeWallpaper -> {
|
||||
if (currentHomeAlbum != null) {
|
||||
settingsViewModel.onEvent(SettingsEvent.SetCurrentWallpaper(
|
||||
currentHomeWallpaper = currentHomeAlbum.album.homeWallpapersInQueue.firstOrNull() ?: currentHomeAlbum.wallpapers.firstOrNull()?.wallpaperUri,
|
||||
currentLockWallpaper = if (settingsState.value.scheduleSeparately) null else currentHomeAlbum.album.homeWallpapersInQueue.firstOrNull() ?: currentHomeAlbum.wallpapers.firstOrNull()?.wallpaperUri
|
||||
))
|
||||
}
|
||||
}
|
||||
settingsState.value.setLockWallpaper -> {
|
||||
if (currentLockAlbum != null) {
|
||||
settingsViewModel.onEvent(SettingsEvent.SetCurrentWallpaper(
|
||||
currentHomeWallpaper = if (settingsState.value.scheduleSeparately) null else currentLockAlbum.album.lockWallpapersInQueue.firstOrNull() ?: currentLockAlbum.wallpapers.firstOrNull()?.wallpaperUri,
|
||||
currentLockWallpaper = currentLockAlbum.album.lockWallpapersInQueue.firstOrNull() ?: currentLockAlbum.wallpapers.firstOrNull()?.wallpaperUri
|
||||
))
|
||||
}
|
||||
}
|
||||
}
|
||||
job?.cancel()
|
||||
job = scope.launch {
|
||||
settingsViewModel.onEvent(SettingsEvent.RefreshNextSetTime)
|
||||
settingsViewModel.onEvent(SettingsEvent.RefreshNextWallpaper)
|
||||
delay(1000)
|
||||
val alarmItem = WallpaperAlarmItem(
|
||||
homeInterval = settingsState.value.homeInterval,
|
||||
@@ -383,7 +347,7 @@ fun PaperizeApp(
|
||||
homeAlbumName = album.album.initialAlbumName,
|
||||
lockAlbumName = album.album.initialAlbumName,
|
||||
))
|
||||
wallpaperScreenViewModel.onEvent(WallpaperEvent.UpdateSelectedAlbum(
|
||||
wallpaperScreenViewModel.onEvent(WallpaperEvent.AddSelectedAlbum(
|
||||
album = album,
|
||||
deleteAlbumName = if (notSameAlbum) settingsState.value.lockAlbumName else null)
|
||||
)
|
||||
@@ -393,7 +357,7 @@ fun PaperizeApp(
|
||||
homeAlbumName = null,
|
||||
lockAlbumName = album.album.initialAlbumName,
|
||||
))
|
||||
wallpaperScreenViewModel.onEvent(WallpaperEvent.UpdateSelectedAlbum(
|
||||
wallpaperScreenViewModel.onEvent(WallpaperEvent.AddSelectedAlbum(
|
||||
album = album,
|
||||
deleteAlbumName = if (notSameAlbum) settingsState.value.lockAlbumName else null)
|
||||
)
|
||||
@@ -403,7 +367,7 @@ fun PaperizeApp(
|
||||
homeAlbumName = album.album.initialAlbumName,
|
||||
lockAlbumName = null,
|
||||
))
|
||||
wallpaperScreenViewModel.onEvent(WallpaperEvent.UpdateSelectedAlbum(
|
||||
wallpaperScreenViewModel.onEvent(WallpaperEvent.AddSelectedAlbum(
|
||||
album = album,
|
||||
deleteAlbumName = if (notSameAlbum) settingsState.value.homeAlbumName else null)
|
||||
)
|
||||
@@ -420,10 +384,14 @@ fun PaperizeApp(
|
||||
if (currentHomeAlbum != null && currentLockAlbum != null) {
|
||||
settingsViewModel.onEvent(
|
||||
SettingsEvent.SetCurrentWallpaper(
|
||||
currentHomeWallpaper = currentHomeAlbum.album.homeWallpapersInQueue.firstOrNull()
|
||||
?: currentHomeAlbum.wallpapers.firstOrNull()?.wallpaperUri,
|
||||
currentHomeWallpaper = currentHomeAlbum.album.homeWallpapersInQueue.firstOrNull(),
|
||||
currentLockWallpaper = currentLockAlbum.album.lockWallpapersInQueue.firstOrNull()
|
||||
?: currentLockAlbum.wallpapers.firstOrNull()?.wallpaperUri
|
||||
)
|
||||
)
|
||||
settingsViewModel.onEvent(
|
||||
SettingsEvent.SetNextWallpaper(
|
||||
nextHomeWallpaper = if (currentHomeAlbum.album.homeWallpapersInQueue.size > 1) currentHomeAlbum.album.homeWallpapersInQueue[1] else currentHomeAlbum.album.homeWallpapersInQueue.firstOrNull(),
|
||||
nextLockWallpaper = if (currentLockAlbum.album.lockWallpapersInQueue.size > 1) currentLockAlbum.album.lockWallpapersInQueue[1] else currentLockAlbum.album.lockWallpapersInQueue.firstOrNull()
|
||||
)
|
||||
)
|
||||
}
|
||||
@@ -433,10 +401,14 @@ fun PaperizeApp(
|
||||
if (currentHomeAlbum != null && currentLockAlbum != null) {
|
||||
settingsViewModel.onEvent(
|
||||
SettingsEvent.SetCurrentWallpaper(
|
||||
currentHomeWallpaper = currentHomeAlbum.album.homeWallpapersInQueue.firstOrNull()
|
||||
?: currentHomeAlbum.wallpapers.firstOrNull()?.wallpaperUri,
|
||||
currentHomeWallpaper = currentHomeAlbum.album.homeWallpapersInQueue.firstOrNull(),
|
||||
currentLockWallpaper = currentHomeAlbum.album.homeWallpapersInQueue.firstOrNull()
|
||||
?: currentHomeAlbum.wallpapers.firstOrNull()?.wallpaperUri
|
||||
)
|
||||
)
|
||||
settingsViewModel.onEvent(
|
||||
SettingsEvent.SetNextWallpaper(
|
||||
nextHomeWallpaper = if (currentHomeAlbum.album.homeWallpapersInQueue.size > 1) currentHomeAlbum.album.homeWallpapersInQueue[1] else currentHomeAlbum.album.homeWallpapersInQueue.firstOrNull(),
|
||||
nextLockWallpaper = if (currentHomeAlbum.album.homeWallpapersInQueue.size > 1) currentHomeAlbum.album.homeWallpapersInQueue[1] else currentHomeAlbum.album.homeWallpapersInQueue.firstOrNull(),
|
||||
)
|
||||
)
|
||||
}
|
||||
@@ -446,10 +418,14 @@ fun PaperizeApp(
|
||||
if (currentHomeAlbum != null) {
|
||||
settingsViewModel.onEvent(
|
||||
SettingsEvent.SetCurrentWallpaper(
|
||||
currentHomeWallpaper = currentHomeAlbum.album.homeWallpapersInQueue.firstOrNull()
|
||||
?: currentHomeAlbum.wallpapers.firstOrNull()?.wallpaperUri,
|
||||
currentHomeWallpaper = currentHomeAlbum.album.homeWallpapersInQueue.firstOrNull(),
|
||||
currentLockWallpaper = if (settingsState.value.scheduleSeparately) null else currentHomeAlbum.album.homeWallpapersInQueue.firstOrNull()
|
||||
?: currentHomeAlbum.wallpapers.firstOrNull()?.wallpaperUri
|
||||
)
|
||||
)
|
||||
settingsViewModel.onEvent(
|
||||
SettingsEvent.SetNextWallpaper(
|
||||
nextHomeWallpaper = if (currentHomeAlbum.album.homeWallpapersInQueue.size > 1) currentHomeAlbum.album.homeWallpapersInQueue[1] else currentHomeAlbum.album.homeWallpapersInQueue.firstOrNull(),
|
||||
nextLockWallpaper = if (settingsState.value.scheduleSeparately) null else if (currentHomeAlbum.album.homeWallpapersInQueue.size > 1) currentHomeAlbum.album.homeWallpapersInQueue[1] else currentHomeAlbum.album.homeWallpapersInQueue.firstOrNull()
|
||||
)
|
||||
)
|
||||
}
|
||||
@@ -459,10 +435,14 @@ fun PaperizeApp(
|
||||
if (currentLockAlbum != null) {
|
||||
settingsViewModel.onEvent(
|
||||
SettingsEvent.SetCurrentWallpaper(
|
||||
currentHomeWallpaper = if (settingsState.value.scheduleSeparately) null else currentLockAlbum.album.lockWallpapersInQueue.firstOrNull()
|
||||
?: currentLockAlbum.wallpapers.firstOrNull()?.wallpaperUri,
|
||||
currentHomeWallpaper = if (settingsState.value.scheduleSeparately) null else currentLockAlbum.album.lockWallpapersInQueue.firstOrNull(),
|
||||
currentLockWallpaper = currentLockAlbum.album.lockWallpapersInQueue.firstOrNull()
|
||||
?: currentLockAlbum.wallpapers.firstOrNull()?.wallpaperUri
|
||||
)
|
||||
)
|
||||
settingsViewModel.onEvent(
|
||||
SettingsEvent.SetNextWallpaper(
|
||||
nextHomeWallpaper = if (settingsState.value.scheduleSeparately) null else if (currentLockAlbum.album.lockWallpapersInQueue.size > 1) currentLockAlbum.album.lockWallpapersInQueue[1] else currentLockAlbum.album.lockWallpapersInQueue.firstOrNull(),
|
||||
nextLockWallpaper = if (currentLockAlbum.album.lockWallpapersInQueue.size > 1) currentLockAlbum.album.lockWallpapersInQueue[1] else currentLockAlbum.album.lockWallpapersInQueue.firstOrNull()
|
||||
)
|
||||
)
|
||||
}
|
||||
@@ -524,15 +504,26 @@ fun PaperizeApp(
|
||||
if (!selectedState.value.selectedAlbum.isNullOrEmpty() && !setHome && !settingsState.value.setLockWallpaper) {
|
||||
settingsViewModel.onEvent(SettingsEvent.SetChangerToggle(false))
|
||||
settingsViewModel.onEvent(SettingsEvent.SetCurrentWallpaper("", ""))
|
||||
selectedState.value.selectedAlbum?.let {
|
||||
wallpaperScreenViewModel.onEvent(WallpaperEvent.Reset())
|
||||
}
|
||||
selectedState.value.selectedAlbum?.let { wallpaperScreenViewModel.onEvent(WallpaperEvent.Reset()) }
|
||||
scheduler.cancelWallpaperAlarm()
|
||||
}
|
||||
else if (!selectedState.value.selectedAlbum.isNullOrEmpty() && (setHome && !settingsState.value.setLockWallpaper) || (!setHome && settingsState.value.setLockWallpaper)) {
|
||||
settingsViewModel.onEvent(SettingsEvent.SetScheduleSeparately(false))
|
||||
job?.cancel()
|
||||
job = scope.launch {
|
||||
if (!setHome && settingsState.value.setLockWallpaper) {
|
||||
val homeAlbum = selectedState.value.selectedAlbum?.find { it.album.initialAlbumName == settingsState.value.homeAlbumName }
|
||||
if (homeAlbum != null) {
|
||||
wallpaperScreenViewModel.onEvent(WallpaperEvent.UpdateSelectedAlbum(
|
||||
album = homeAlbum.copy(
|
||||
album = homeAlbum.album.copy(
|
||||
lockWallpapersInQueue = homeAlbum.album.homeWallpapersInQueue,
|
||||
homeWallpapersInQueue = homeAlbum.wallpapers.map { it.wallpaperUri }.shuffled()
|
||||
)
|
||||
),
|
||||
))
|
||||
}
|
||||
}
|
||||
delay(1000)
|
||||
scheduler.updateWallpaper(false, setHome, settingsState.value.setLockWallpaper)
|
||||
val alarmItem = WallpaperAlarmItem(
|
||||
@@ -554,6 +545,15 @@ fun PaperizeApp(
|
||||
else if (!selectedState.value.selectedAlbum.isNullOrEmpty() && settingsState.value.enableChanger) {
|
||||
job?.cancel()
|
||||
job = scope.launch {
|
||||
val homeAlbum = selectedState.value.selectedAlbum?.find { it.album.initialAlbumName == settingsState.value.homeAlbumName }
|
||||
if (homeAlbum != null) {
|
||||
settingsViewModel.onEvent(
|
||||
SettingsEvent.SetNextWallpaper(
|
||||
nextHomeWallpaper = homeAlbum.album.homeWallpapersInQueue.firstOrNull() ?: homeAlbum.wallpapers.firstOrNull()?.wallpaperUri,
|
||||
nextLockWallpaper = homeAlbum.album.homeWallpapersInQueue.firstOrNull() ?: homeAlbum.wallpapers.firstOrNull()?.wallpaperUri
|
||||
)
|
||||
)
|
||||
}
|
||||
delay(1000)
|
||||
scheduler.updateWallpaper(settingsState.value.scheduleSeparately, settingsState.value.setHomeWallpaper, settingsState.value.setLockWallpaper)
|
||||
}
|
||||
@@ -593,6 +593,15 @@ fun PaperizeApp(
|
||||
else if (!selectedState.value.selectedAlbum.isNullOrEmpty() && settingsState.value.enableChanger) {
|
||||
job?.cancel()
|
||||
job = scope.launch {
|
||||
val homeAlbum = selectedState.value.selectedAlbum?.find { it.album.initialAlbumName == settingsState.value.homeAlbumName }
|
||||
if (homeAlbum != null) {
|
||||
settingsViewModel.onEvent(
|
||||
SettingsEvent.SetNextWallpaper(
|
||||
nextHomeWallpaper = homeAlbum.album.homeWallpapersInQueue.firstOrNull() ?: homeAlbum.wallpapers.firstOrNull()?.wallpaperUri,
|
||||
nextLockWallpaper = homeAlbum.album.homeWallpapersInQueue.firstOrNull() ?: homeAlbum.wallpapers.firstOrNull()?.wallpaperUri
|
||||
)
|
||||
)
|
||||
}
|
||||
delay(1000)
|
||||
scheduler.updateWallpaper(settingsState.value.scheduleSeparately, settingsState.value.setHomeWallpaper, settingsState.value.setLockWallpaper)
|
||||
}
|
||||
|
||||
+4
@@ -29,4 +29,8 @@ sealed class SettingsEvent {
|
||||
data class SetBlurPercentage(val blurPercentage: Int): SettingsEvent()
|
||||
data class SetChangerToggle(val toggle: Boolean): SettingsEvent()
|
||||
data class SetWallpaperScaling(val scaling: ScalingConstants): SettingsEvent()
|
||||
data class SetNextHomeWallpaper(val nextHomeWallpaper: String?): SettingsEvent()
|
||||
data class SetNextLockWallpaper(val nextLockWallpaper: String?): SettingsEvent()
|
||||
data class SetNextWallpaper(val nextHomeWallpaper: String?, val nextLockWallpaper: String?): SettingsEvent()
|
||||
data object RefreshNextWallpaper: SettingsEvent()
|
||||
}
|
||||
+3
-1
@@ -26,5 +26,7 @@ data class SettingsState(
|
||||
val darken: Boolean = false,
|
||||
val blur: Boolean = false,
|
||||
val blurPercentage: Int = 0,
|
||||
val wallpaperScaling: ScalingConstants = ScalingConstants.FILL
|
||||
val wallpaperScaling: ScalingConstants = ScalingConstants.FILL,
|
||||
val nextHomeWallpaper: String? = null,
|
||||
val nextLockWallpaper: String? = null
|
||||
)
|
||||
+75
-2
@@ -56,6 +56,8 @@ class SettingsViewModel @Inject constructor (
|
||||
val scheduleSeparately = async { settingsDataStoreImpl.getBoolean(SettingsConstants.SCHEDULE_SEPARATELY) ?: false }
|
||||
val blur = async { settingsDataStoreImpl.getBoolean(SettingsConstants.BLUR) ?: false }
|
||||
val blurPercentage = async { settingsDataStoreImpl.getInt(SettingsConstants.BLUR_PERCENTAGE) ?: 0 }
|
||||
val nextHomeWallpaper = async { settingsDataStoreImpl.getString(SettingsConstants.HOME_NEXT_SET_TIME) }
|
||||
val nextLockWallpaper = async { settingsDataStoreImpl.getString(SettingsConstants.LOCK_NEXT_SET_TIME) }
|
||||
|
||||
_state.update {
|
||||
it.copy(
|
||||
@@ -80,7 +82,9 @@ class SettingsViewModel @Inject constructor (
|
||||
currentLockWallpaper = setCurrentLockWallpaper.await(),
|
||||
scheduleSeparately = scheduleSeparately.await(),
|
||||
blur = blur.await(),
|
||||
blurPercentage = blurPercentage.await()
|
||||
blurPercentage = blurPercentage.await(),
|
||||
nextHomeWallpaper = nextHomeWallpaper.await(),
|
||||
nextLockWallpaper = nextLockWallpaper.await()
|
||||
)
|
||||
}
|
||||
setKeepOnScreenCondition = false
|
||||
@@ -135,6 +139,8 @@ class SettingsViewModel @Inject constructor (
|
||||
val scheduleSeparately = async { settingsDataStoreImpl.getBoolean(SettingsConstants.SCHEDULE_SEPARATELY) ?: false }
|
||||
val blur = async { settingsDataStoreImpl.getBoolean(SettingsConstants.BLUR) ?: false }
|
||||
val blurPercentage = async { settingsDataStoreImpl.getInt(SettingsConstants.BLUR_PERCENTAGE) ?: 0 }
|
||||
val nextHomeWallpaper = async { settingsDataStoreImpl.getString(SettingsConstants.HOME_NEXT_SET_TIME) }
|
||||
val nextLockWallpaper = async { settingsDataStoreImpl.getString(SettingsConstants.LOCK_NEXT_SET_TIME) }
|
||||
_state.update {
|
||||
it.copy(
|
||||
darkMode = darkMode.await(),
|
||||
@@ -158,6 +164,8 @@ class SettingsViewModel @Inject constructor (
|
||||
scheduleSeparately = scheduleSeparately.await(),
|
||||
blur = blur.await(),
|
||||
blurPercentage = blurPercentage.await(),
|
||||
nextHomeWallpaper = nextHomeWallpaper.await(),
|
||||
nextLockWallpaper = nextLockWallpaper.await()
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -485,6 +493,8 @@ class SettingsViewModel @Inject constructor (
|
||||
lockAlbumName = if (event.removeLock) null else it.lockAlbumName,
|
||||
currentHomeWallpaper = null,
|
||||
currentLockWallpaper = null,
|
||||
nextHomeWallpaper = null,
|
||||
nextLockWallpaper = null,
|
||||
enableChanger = false,
|
||||
lastSetTime = null,
|
||||
nextSetTime = null
|
||||
@@ -539,6 +549,65 @@ class SettingsViewModel @Inject constructor (
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
is SettingsEvent.SetNextHomeWallpaper -> {
|
||||
viewModelScope.launch(Dispatchers.IO) {
|
||||
event.nextHomeWallpaper?.let {
|
||||
settingsDataStoreImpl.putString(SettingsConstants.NEXT_HOME_WALLPAPER, it)
|
||||
}
|
||||
_state.update {
|
||||
it.copy(
|
||||
nextHomeWallpaper = event.nextHomeWallpaper
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
is SettingsEvent.SetNextLockWallpaper -> {
|
||||
viewModelScope.launch(Dispatchers.IO) {
|
||||
event.nextLockWallpaper?.let {
|
||||
settingsDataStoreImpl.putString(SettingsConstants.NEXT_LOCK_WALLPAPER, it)
|
||||
}
|
||||
_state.update {
|
||||
it.copy(
|
||||
nextLockWallpaper = event.nextLockWallpaper
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
is SettingsEvent.SetNextWallpaper -> {
|
||||
viewModelScope.launch(Dispatchers.IO) {
|
||||
if (event.nextHomeWallpaper != null) {
|
||||
settingsDataStoreImpl.putString(SettingsConstants.NEXT_HOME_WALLPAPER, event.nextHomeWallpaper)
|
||||
}
|
||||
if (event.nextLockWallpaper != null) {
|
||||
settingsDataStoreImpl.putString(SettingsConstants.NEXT_LOCK_WALLPAPER, event.nextLockWallpaper)
|
||||
}
|
||||
_state.update {
|
||||
it.copy(
|
||||
nextHomeWallpaper = event.nextHomeWallpaper ?: it.nextHomeWallpaper,
|
||||
nextLockWallpaper = event.nextLockWallpaper ?: it.nextLockWallpaper
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
is SettingsEvent.RefreshNextWallpaper -> {
|
||||
viewModelScope.launch(Dispatchers.IO) {
|
||||
val nextHomeWallpaper = async { settingsDataStoreImpl.getString(SettingsConstants.NEXT_HOME_WALLPAPER) }
|
||||
val nextLockWallpaper = async { settingsDataStoreImpl.getString(SettingsConstants.NEXT_LOCK_WALLPAPER) }
|
||||
_state.update {
|
||||
it.copy(
|
||||
nextHomeWallpaper = nextHomeWallpaper.await(),
|
||||
nextLockWallpaper = nextLockWallpaper.await(),
|
||||
currentHomeWallpaper = nextHomeWallpaper.await(),
|
||||
currentLockWallpaper = nextLockWallpaper.await()
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
is SettingsEvent.Reset -> {
|
||||
viewModelScope.launch(Dispatchers.IO) {
|
||||
settingsDataStoreImpl.deleteBoolean(SettingsConstants.DARK_MODE_TYPE)
|
||||
@@ -566,6 +635,8 @@ class SettingsViewModel @Inject constructor (
|
||||
settingsDataStoreImpl.deleteBoolean(SettingsConstants.FIRST_SET)
|
||||
settingsDataStoreImpl.deleteString(SettingsConstants.HOME_NEXT_SET_TIME)
|
||||
settingsDataStoreImpl.deleteString(SettingsConstants.LOCK_NEXT_SET_TIME)
|
||||
settingsDataStoreImpl.deleteString(SettingsConstants.NEXT_HOME_WALLPAPER)
|
||||
settingsDataStoreImpl.deleteString(SettingsConstants.NEXT_LOCK_WALLPAPER)
|
||||
|
||||
_state.update {
|
||||
it.copy(
|
||||
@@ -590,7 +661,9 @@ class SettingsViewModel @Inject constructor (
|
||||
lockAlbumName = null,
|
||||
scheduleSeparately = false,
|
||||
blur = false,
|
||||
blurPercentage = 0
|
||||
blurPercentage = 0,
|
||||
nextHomeWallpaper = null,
|
||||
nextLockWallpaper = null
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -4,8 +4,8 @@ import com.anthonyla.paperize.feature.wallpaper.domain.model.AlbumWithWallpaperA
|
||||
import com.anthonyla.paperize.feature.wallpaper.domain.model.SelectedAlbum
|
||||
|
||||
sealed class WallpaperEvent {
|
||||
data class UpdateSelectedAlbum(val album: AlbumWithWallpaperAndFolder, val deleteAlbumName: String? = null
|
||||
): WallpaperEvent()
|
||||
data class AddSelectedAlbum(val album: AlbumWithWallpaperAndFolder, val deleteAlbumName: String? = null): WallpaperEvent()
|
||||
data class UpdateSelectedAlbum(val album: SelectedAlbum): WallpaperEvent()
|
||||
data class Reset(val album: SelectedAlbum? = null) : WallpaperEvent()
|
||||
data object Refresh : WallpaperEvent()
|
||||
}
|
||||
+17
-1
@@ -41,7 +41,7 @@ class WallpaperScreenViewModel @Inject constructor (
|
||||
|
||||
fun onEvent(event: WallpaperEvent) {
|
||||
when (event) {
|
||||
is WallpaperEvent.UpdateSelectedAlbum -> {
|
||||
is WallpaperEvent.AddSelectedAlbum -> {
|
||||
viewModelScope.launch(Dispatchers.IO) {
|
||||
val deleted = event.deleteAlbumName?.let {
|
||||
repository.cascadeDeleteAlbum(it)
|
||||
@@ -73,6 +73,22 @@ class WallpaperScreenViewModel @Inject constructor (
|
||||
}
|
||||
}
|
||||
}
|
||||
is WallpaperEvent.UpdateSelectedAlbum -> {
|
||||
viewModelScope.launch(Dispatchers.IO) {
|
||||
repository.upsertSelectedAlbum(event.album)
|
||||
_state.update {
|
||||
it.copy(
|
||||
selectedAlbum = it.selectedAlbum?.map { selectedAlbum ->
|
||||
if (selectedAlbum.album.initialAlbumName == event.album.album.initialAlbumName) {
|
||||
event.album
|
||||
} else {
|
||||
selectedAlbum
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
is WallpaperEvent.Refresh -> {
|
||||
refreshAlbums()
|
||||
}
|
||||
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
package com.anthonyla.paperize.feature.wallpaper.tasker_shortcut
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import com.anthonyla.paperize.feature.wallpaper.wallpaper_alarmmanager.WallpaperBootAndChangeReceiver
|
||||
import com.joaomgcd.taskerpluginlibrary.action.TaskerPluginRunnerActionNoOutputOrInput
|
||||
import com.joaomgcd.taskerpluginlibrary.config.TaskerPluginConfig
|
||||
import com.joaomgcd.taskerpluginlibrary.config.TaskerPluginConfigHelperNoOutputOrInput
|
||||
import com.joaomgcd.taskerpluginlibrary.config.TaskerPluginConfigNoInput
|
||||
import com.joaomgcd.taskerpluginlibrary.input.TaskerInput
|
||||
import com.joaomgcd.taskerpluginlibrary.runner.TaskerPluginResult
|
||||
import com.joaomgcd.taskerpluginlibrary.runner.TaskerPluginResultSucess
|
||||
|
||||
/**
|
||||
* Tasker Shortcut to change wallpaper
|
||||
*/
|
||||
class ShortcutHelper(config: TaskerPluginConfig<Unit>) : TaskerPluginConfigHelperNoOutputOrInput<ShortcutActionRunner>(config) {
|
||||
override val runnerClass: Class<ShortcutActionRunner> get() = ShortcutActionRunner::class.java
|
||||
}
|
||||
|
||||
class ActivityConfigBasicAction : Activity(), TaskerPluginConfigNoInput {
|
||||
override val context: Context get() = applicationContext
|
||||
private val taskerHelper by lazy { ShortcutHelper(this) }
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
taskerHelper.finishForTasker()
|
||||
}
|
||||
}
|
||||
|
||||
class ShortcutActionRunner : TaskerPluginRunnerActionNoOutputOrInput() {
|
||||
override fun run(context: Context, input: TaskerInput<Unit>): TaskerPluginResult<Unit> {
|
||||
val intent = Intent(context, WallpaperBootAndChangeReceiver::class.java)
|
||||
context.sendBroadcast(intent)
|
||||
return TaskerPluginResultSucess()
|
||||
}
|
||||
}
|
||||
+1
@@ -111,6 +111,7 @@ class WallpaperAlarmSchedulerImpl (
|
||||
private fun scheduleWallpaper(wallpaperAlarmItem: WallpaperAlarmItem, type: Type, origin: Int? = null, update: Boolean = false) {
|
||||
val nextTime = when (type) {
|
||||
Type.LOCK -> LocalDateTime.now().plusMinutes(wallpaperAlarmItem.lockInterval.toLong())
|
||||
Type.HOME -> if (wallpaperAlarmItem.scheduleSeparately) LocalDateTime.now().plusMinutes(wallpaperAlarmItem.homeInterval.toLong()).plusSeconds(10) else LocalDateTime.now().plusMinutes(wallpaperAlarmItem.homeInterval.toLong())
|
||||
else -> LocalDateTime.now().plusMinutes(wallpaperAlarmItem.homeInterval.toLong())
|
||||
}
|
||||
val intent = Intent(context, WallpaperReceiver::class.java).apply {
|
||||
|
||||
+27
-29
@@ -87,6 +87,7 @@ class HomeWallpaperService: Service() {
|
||||
if (intent != null) {
|
||||
when (intent.action) {
|
||||
Actions.START.toString() -> {
|
||||
Log.d("PaperizeWallpaperChanger", "Home starting service")
|
||||
homeInterval = intent.getIntExtra("homeInterval", SettingsConstants.WALLPAPER_CHANGE_INTERVAL_DEFAULT)
|
||||
lockInterval = intent.getIntExtra("lockInterval", SettingsConstants.WALLPAPER_CHANGE_INTERVAL_DEFAULT)
|
||||
scheduleSeparately = intent.getBooleanExtra("scheduleSeparately", false)
|
||||
@@ -119,7 +120,6 @@ class HomeWallpaperService: Service() {
|
||||
private fun workerTaskStart() {
|
||||
workerHandler.post {
|
||||
CoroutineScope(Dispatchers.IO).launch {
|
||||
delay(1000)
|
||||
changeWallpaper(this@HomeWallpaperService)
|
||||
}
|
||||
stopSelf()
|
||||
@@ -210,11 +210,10 @@ class HomeWallpaperService: Service() {
|
||||
onDestroy()
|
||||
return
|
||||
}
|
||||
|
||||
Log.d("PaperizeWallpaperChanger", "Size of home ${homeAlbum.album.homeWallpapersInQueue.size}")
|
||||
when {
|
||||
// Case: Set home and lock screen wallpapers using separate albums (home screen and lock screen album)
|
||||
setHome && setLock && scheduleSeparately -> {
|
||||
val delay = ((homeInterval % lockInterval == 0) || (lockInterval % homeInterval == 0)) && (homeAlbumName == lockAlbumName)
|
||||
var wallpaper = homeAlbum.album.homeWallpapersInQueue.firstOrNull()
|
||||
if (wallpaper == null) {
|
||||
// Reshuffle the wallpapers and pick the first one
|
||||
@@ -236,31 +235,24 @@ class HomeWallpaperService: Service() {
|
||||
blur = blur,
|
||||
blurPercent = blurPercentage
|
||||
)
|
||||
if (delay) {
|
||||
delay(5000)
|
||||
selectedAlbum = selectedRepository.getSelectedAlbum().first()
|
||||
homeAlbum = selectedAlbum.find { it.album.initialAlbumName == homeAlbumName }
|
||||
delay(1000)
|
||||
settingsDataStoreImpl.putString(SettingsConstants.NEXT_HOME_WALLPAPER, if (newWallpapers.size > 1) newWallpapers[1] else "")
|
||||
if (success) {
|
||||
selectedRepository.upsertSelectedAlbum(homeAlbum.copy(album = homeAlbum.album.copy(homeWallpapersInQueue = newWallpapers.drop(1))))
|
||||
settingsDataStoreImpl.putString(SettingsConstants.CURRENT_HOME_WALLPAPER, wallpaper.toString())
|
||||
}
|
||||
if (homeAlbum != null) {
|
||||
if (success) {
|
||||
selectedRepository.upsertSelectedAlbum(homeAlbum.copy(album = homeAlbum.album.copy(homeWallpapersInQueue = newWallpapers.drop(1))))
|
||||
settingsDataStoreImpl.putString(SettingsConstants.CURRENT_HOME_WALLPAPER, wallpaper.toString())
|
||||
}
|
||||
else {
|
||||
val wallpaperToDelete = homeAlbum.wallpapers.find { it.wallpaperUri == wallpaper }
|
||||
if (wallpaperToDelete != null) {
|
||||
albumRepository.deleteWallpaper(wallpaperToDelete)
|
||||
selectedRepository.deleteWallpaper(wallpaperToDelete)
|
||||
selectedRepository.upsertSelectedAlbum(
|
||||
homeAlbum.copy(
|
||||
album = homeAlbum.album.copy(
|
||||
homeWallpapersInQueue = homeAlbum.album.homeWallpapersInQueue.filterNot { it == wallpaper }
|
||||
),
|
||||
wallpapers = homeAlbum.wallpapers.filterNot { it.wallpaperUri == wallpaper }
|
||||
)
|
||||
else {
|
||||
val wallpaperToDelete = homeAlbum.wallpapers.find { it.wallpaperUri == wallpaper }
|
||||
if (wallpaperToDelete != null) {
|
||||
albumRepository.deleteWallpaper(wallpaperToDelete)
|
||||
selectedRepository.deleteWallpaper(wallpaperToDelete)
|
||||
selectedRepository.upsertSelectedAlbum(
|
||||
homeAlbum.copy(
|
||||
album = homeAlbum.album.copy(
|
||||
homeWallpapersInQueue = homeAlbum.album.homeWallpapersInQueue.filterNot { it == wallpaper }
|
||||
),
|
||||
wallpapers = homeAlbum.wallpapers.filterNot { it.wallpaperUri == wallpaper }
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -275,11 +267,11 @@ class HomeWallpaperService: Service() {
|
||||
blur = blur,
|
||||
blurPercent = blurPercentage
|
||||
)
|
||||
if (delay) {
|
||||
delay(5000)
|
||||
settingsDataStoreImpl.putString(SettingsConstants.NEXT_HOME_WALLPAPER, if (homeAlbum.album.homeWallpapersInQueue.size > 1) homeAlbum.album.homeWallpapersInQueue[1] else "")
|
||||
if ((homeInterval % lockInterval == 0) || (lockInterval % homeInterval == 0) && (homeAlbumName == lockAlbumName)) {
|
||||
delay(1000)
|
||||
selectedAlbum = selectedRepository.getSelectedAlbum().first()
|
||||
homeAlbum = selectedAlbum.find { it.album.initialAlbumName == homeAlbumName }
|
||||
delay(1000)
|
||||
}
|
||||
if (homeAlbum != null) {
|
||||
if (success) {
|
||||
@@ -327,6 +319,7 @@ class HomeWallpaperService: Service() {
|
||||
blur = blur,
|
||||
blurPercent = blurPercentage
|
||||
)
|
||||
settingsDataStoreImpl.putString(SettingsConstants.NEXT_HOME_WALLPAPER, if (newWallpapers.size > 1) newWallpapers[1] else "")
|
||||
if (success) {
|
||||
selectedRepository.upsertSelectedAlbum(homeAlbum.copy(album = homeAlbum.album.copy(homeWallpapersInQueue = newWallpapers.drop(1))))
|
||||
settingsDataStoreImpl.putString(SettingsConstants.CURRENT_HOME_WALLPAPER, wallpaper.toString())
|
||||
@@ -358,6 +351,7 @@ class HomeWallpaperService: Service() {
|
||||
blur = blur,
|
||||
blurPercent = blurPercentage
|
||||
)
|
||||
settingsDataStoreImpl.putString(SettingsConstants.NEXT_HOME_WALLPAPER, if (homeAlbum.album.homeWallpapersInQueue.size > 1) homeAlbum.album.homeWallpapersInQueue[1] else "")
|
||||
if (success) {
|
||||
selectedRepository.upsertSelectedAlbum(homeAlbum.copy(album = homeAlbum.album.copy(homeWallpapersInQueue = homeAlbum.album.homeWallpapersInQueue.drop(1))))
|
||||
settingsDataStoreImpl.putString(SettingsConstants.CURRENT_HOME_WALLPAPER, wallpaper.toString())
|
||||
@@ -402,6 +396,8 @@ class HomeWallpaperService: Service() {
|
||||
blur = blur,
|
||||
blurPercent = blurPercentage
|
||||
)
|
||||
settingsDataStoreImpl.putString(SettingsConstants.NEXT_HOME_WALLPAPER, if (newWallpapers.size > 1) newWallpapers[1] else "")
|
||||
settingsDataStoreImpl.putString(SettingsConstants.NEXT_LOCK_WALLPAPER, if (newWallpapers.size > 1) newWallpapers[1] else "")
|
||||
if (success) {
|
||||
selectedRepository.upsertSelectedAlbum(homeAlbum.copy(album = homeAlbum.album.copy(homeWallpapersInQueue = newWallpapers.drop(1))))
|
||||
settingsDataStoreImpl.putString(SettingsConstants.CURRENT_HOME_WALLPAPER, wallpaper.toString())
|
||||
@@ -435,6 +431,8 @@ class HomeWallpaperService: Service() {
|
||||
blur = blur,
|
||||
blurPercent = blurPercentage
|
||||
)
|
||||
settingsDataStoreImpl.putString(SettingsConstants.NEXT_HOME_WALLPAPER, if (homeAlbum.album.homeWallpapersInQueue.size > 1) homeAlbum.album.homeWallpapersInQueue[1] else "")
|
||||
settingsDataStoreImpl.putString(SettingsConstants.NEXT_LOCK_WALLPAPER, if (homeAlbum.album.homeWallpapersInQueue.size > 1) homeAlbum.album.homeWallpapersInQueue[1] else "")
|
||||
if (success) {
|
||||
selectedRepository.upsertSelectedAlbum(homeAlbum.copy(album = homeAlbum.album.copy(homeWallpapersInQueue = homeAlbum.album.homeWallpapersInQueue.drop(1))))
|
||||
settingsDataStoreImpl.putString(SettingsConstants.CURRENT_HOME_WALLPAPER, wallpaper.toString())
|
||||
|
||||
+15
-15
@@ -42,6 +42,7 @@ import com.lazygeniouz.dfc.file.DocumentFileCompat
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.flow.first
|
||||
import kotlinx.coroutines.launch
|
||||
import java.io.IOException
|
||||
@@ -86,6 +87,7 @@ class LockWallpaperService: Service() {
|
||||
if (intent != null) {
|
||||
when (intent.action) {
|
||||
Actions.START.toString() -> {
|
||||
Log.d("PaperizeWallpaperChanger", "Lock starting service")
|
||||
homeInterval = intent.getIntExtra("homeInterval", SettingsConstants.WALLPAPER_CHANGE_INTERVAL_DEFAULT)
|
||||
lockInterval = intent.getIntExtra("lockInterval", SettingsConstants.WALLPAPER_CHANGE_INTERVAL_DEFAULT)
|
||||
scheduleSeparately = intent.getBooleanExtra("scheduleSeparately", false)
|
||||
@@ -202,14 +204,12 @@ class LockWallpaperService: Service() {
|
||||
val blur = settingsDataStoreImpl.getBoolean(SettingsConstants.BLUR) ?: false
|
||||
val blurPercentage = settingsDataStoreImpl.getInt(SettingsConstants.BLUR_PERCENTAGE) ?: 0
|
||||
val lockAlbumName = settingsDataStoreImpl.getString(SettingsConstants.LOCK_ALBUM_NAME) ?: ""
|
||||
val homeAlbumName = settingsDataStoreImpl.getString(SettingsConstants.HOME_ALBUM_NAME) ?: ""
|
||||
val homeAlbum = selectedAlbum.find { it.album.initialAlbumName == homeAlbumName }
|
||||
val lockAlbum = selectedAlbum.find { it.album.initialAlbumName == lockAlbumName }
|
||||
if (lockAlbum == null) {
|
||||
onDestroy()
|
||||
return
|
||||
}
|
||||
|
||||
Log.d("PaperizeWallpaperChanger", "Size of lock ${lockAlbum.album.homeWallpapersInQueue.size}")
|
||||
when {
|
||||
// Case: Set home and lock screen wallpapers using separate albums (home screen and lock screen album)
|
||||
setHome && setLock && scheduleSeparately -> {
|
||||
@@ -234,6 +234,7 @@ class LockWallpaperService: Service() {
|
||||
blur = blur,
|
||||
blurPercent = blurPercentage
|
||||
)
|
||||
settingsDataStoreImpl.putString(SettingsConstants.NEXT_LOCK_WALLPAPER, if (newWallpapers.size > 1) newWallpapers[1] else "")
|
||||
if (success) {
|
||||
selectedRepository.upsertSelectedAlbum(lockAlbum.copy(album = lockAlbum.album.copy(lockWallpapersInQueue = newWallpapers.drop(1))))
|
||||
settingsDataStoreImpl.putString(SettingsConstants.CURRENT_LOCK_WALLPAPER, wallpaper.toString())
|
||||
@@ -265,6 +266,7 @@ class LockWallpaperService: Service() {
|
||||
blur = blur,
|
||||
blurPercent = blurPercentage
|
||||
)
|
||||
settingsDataStoreImpl.putString(SettingsConstants.NEXT_LOCK_WALLPAPER, if (lockAlbum.album.lockWallpapersInQueue.size > 1) lockAlbum.album.lockWallpapersInQueue[1] else "")
|
||||
if (success) {
|
||||
selectedRepository.upsertSelectedAlbum(lockAlbum.copy(album = lockAlbum.album.copy(lockWallpapersInQueue = lockAlbum.album.lockWallpapersInQueue.drop(1))))
|
||||
settingsDataStoreImpl.putString(SettingsConstants.CURRENT_LOCK_WALLPAPER, wallpaper.toString())
|
||||
@@ -286,22 +288,15 @@ class LockWallpaperService: Service() {
|
||||
}
|
||||
}
|
||||
if (homeInterval != lockInterval) {
|
||||
wallpaper = settingsDataStoreImpl.getString(SettingsConstants.CURRENT_HOME_WALLPAPER)
|
||||
if (!wallpaper.isNullOrEmpty()) {
|
||||
setWallpaper(
|
||||
context = context,
|
||||
wallpaper = wallpaper.toUri(),
|
||||
darken = darken,
|
||||
darkenPercent = darkenPercentage,
|
||||
scaling = scaling,
|
||||
blur = blur,
|
||||
blurPercent = blurPercentage
|
||||
)
|
||||
}
|
||||
delay(15000)
|
||||
val serviceIntent = Intent(context, HomeWallpaperService::class.java).apply { this.action = HomeWallpaperService.Actions.UPDATE.toString() }
|
||||
context.startService(serviceIntent)
|
||||
}
|
||||
}
|
||||
// Case: Set home and lock screen wallpapers using the same album (home screen album)
|
||||
setHome && setLock && !scheduleSeparately -> {
|
||||
val homeAlbumName = settingsDataStoreImpl.getString(SettingsConstants.HOME_ALBUM_NAME) ?: ""
|
||||
val homeAlbum = selectedAlbum.find { it.album.initialAlbumName == homeAlbumName }
|
||||
if (homeAlbum == null) {
|
||||
onDestroy()
|
||||
return
|
||||
@@ -317,6 +312,7 @@ class LockWallpaperService: Service() {
|
||||
blur = blur,
|
||||
blurPercent = blurPercentage
|
||||
)
|
||||
settingsDataStoreImpl.putString(SettingsConstants.NEXT_LOCK_WALLPAPER, if (homeAlbum.album.homeWallpapersInQueue.size > 1) homeAlbum.album.homeWallpapersInQueue[1] else "")
|
||||
if (success) {
|
||||
settingsDataStoreImpl.putString(SettingsConstants.CURRENT_LOCK_WALLPAPER, wallpaper.toString())
|
||||
}
|
||||
@@ -345,6 +341,8 @@ class LockWallpaperService: Service() {
|
||||
blur = blur,
|
||||
blurPercent = blurPercentage
|
||||
)
|
||||
settingsDataStoreImpl.putString(SettingsConstants.NEXT_LOCK_WALLPAPER, if (newWallpapers.size > 1) newWallpapers[1] else "")
|
||||
settingsDataStoreImpl.putString(SettingsConstants.NEXT_HOME_WALLPAPER, if (newWallpapers.size > 1) newWallpapers[1] else "")
|
||||
if (success) {
|
||||
selectedRepository.upsertSelectedAlbum(lockAlbum.copy(album = lockAlbum.album.copy(lockWallpapersInQueue = newWallpapers.drop(1))))
|
||||
settingsDataStoreImpl.putString(SettingsConstants.CURRENT_LOCK_WALLPAPER, wallpaper.toString())
|
||||
@@ -377,6 +375,8 @@ class LockWallpaperService: Service() {
|
||||
blur = blur,
|
||||
blurPercent = blurPercentage
|
||||
)
|
||||
settingsDataStoreImpl.putString(SettingsConstants.NEXT_LOCK_WALLPAPER, if (lockAlbum.album.lockWallpapersInQueue.size > 1) lockAlbum.album.lockWallpapersInQueue[1] else "")
|
||||
settingsDataStoreImpl.putString(SettingsConstants.NEXT_HOME_WALLPAPER, if (lockAlbum.album.lockWallpapersInQueue.size > 1) lockAlbum.album.lockWallpapersInQueue[1] else "")
|
||||
if (success) {
|
||||
selectedRepository.upsertSelectedAlbum(lockAlbum.copy(album = lockAlbum.album.copy(lockWallpapersInQueue = lockAlbum.album.lockWallpapersInQueue.drop(1))))
|
||||
settingsDataStoreImpl.putString(SettingsConstants.CURRENT_LOCK_WALLPAPER, wallpaper.toString())
|
||||
|
||||
Reference in new issue
Block a user