Refactored wallpaper changer code
This commit is contained in:
1 parent
92563b84ec
commit
624c9c3dbb
2 files changed
-10
No files matched your search
-6
@@ -205,11 +205,9 @@ class HomeWallpaperService: Service() {
|
||||
setHome && setLock && scheduleSeparately -> {
|
||||
var wallpaper = homeAlbum.album.homeWallpapersInQueue.firstOrNull()
|
||||
if (wallpaper == null) {
|
||||
// Reshuffle the wallpapers and pick the first one
|
||||
val newWallpapers = homeAlbum.wallpapers.map { it.wallpaperUri }.shuffled()
|
||||
wallpaper = newWallpapers.firstOrNull()
|
||||
if (wallpaper == null) {
|
||||
// Delete invalid album if no valid wallpaper
|
||||
selectedRepository.cascadeDeleteAlbum(homeAlbum.album.initialAlbumName)
|
||||
onDestroy()
|
||||
return
|
||||
@@ -289,11 +287,9 @@ class HomeWallpaperService: Service() {
|
||||
setHome && setLock && !scheduleSeparately -> {
|
||||
var wallpaper = homeAlbum.album.homeWallpapersInQueue.firstOrNull()
|
||||
if (wallpaper == null) {
|
||||
// Reshuffle the wallpapers and pick the first one
|
||||
val newWallpapers = homeAlbum.wallpapers.map { it.wallpaperUri }.shuffled()
|
||||
wallpaper = newWallpapers.firstOrNull()
|
||||
if (wallpaper == null) {
|
||||
// Delete invalid album if no valid wallpaper
|
||||
selectedRepository.cascadeDeleteAlbum(homeAlbum.album.initialAlbumName)
|
||||
onDestroy()
|
||||
return
|
||||
@@ -381,11 +377,9 @@ class HomeWallpaperService: Service() {
|
||||
setHome -> {
|
||||
var wallpaper = homeAlbum.album.homeWallpapersInQueue.firstOrNull()
|
||||
if (wallpaper == null) {
|
||||
// Reshuffle the wallpapers and pick the first one
|
||||
val newWallpapers = homeAlbum.wallpapers.map { it.wallpaperUri }.shuffled()
|
||||
wallpaper = newWallpapers.firstOrNull()
|
||||
if (wallpaper == null) {
|
||||
// Delete invalid album if no valid wallpaper
|
||||
selectedRepository.cascadeDeleteAlbum(homeAlbum.album.initialAlbumName)
|
||||
onDestroy()
|
||||
return
|
||||
|
||||
-4
@@ -205,11 +205,9 @@ class LockWallpaperService: Service() {
|
||||
setHome && setLock && scheduleSeparately -> {
|
||||
var wallpaper = lockAlbum.album.lockWallpapersInQueue.firstOrNull()
|
||||
if (wallpaper == null) {
|
||||
// Reshuffle the wallpapers and pick the first one
|
||||
val newWallpapers = lockAlbum.wallpapers.map { it.wallpaperUri }.shuffled()
|
||||
wallpaper = newWallpapers.firstOrNull()
|
||||
if (wallpaper == null) {
|
||||
// Delete invalid album if no valid wallpaper
|
||||
selectedRepository.cascadeDeleteAlbum(lockAlbum.album.initialAlbumName)
|
||||
onDestroy()
|
||||
return
|
||||
@@ -312,11 +310,9 @@ class LockWallpaperService: Service() {
|
||||
setLock -> {
|
||||
var wallpaper = lockAlbum.album.lockWallpapersInQueue.firstOrNull()
|
||||
if (wallpaper == null) {
|
||||
// Reshuffle the wallpapers and pick the first one
|
||||
val newWallpapers = lockAlbum.wallpapers.map { it.wallpaperUri }.shuffled()
|
||||
wallpaper = newWallpapers.firstOrNull()
|
||||
if (wallpaper == null) {
|
||||
// Delete invalid album if no valid wallpaper
|
||||
selectedRepository.cascadeDeleteAlbum(lockAlbum.album.initialAlbumName)
|
||||
onDestroy()
|
||||
return
|
||||
|
||||
Reference in new issue
Block a user