-
-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: rework wallpaper changer - allow multiple configs at the same time
- Loading branch information
Showing
10 changed files
with
363 additions
and
187 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,5 +4,4 @@ enum class WallpaperSource { | |
ONLINE, | ||
FAVORITES, | ||
LOCAL, | ||
NONE; | ||
} |
26 changes: 25 additions & 1 deletion
26
app/src/main/java/com/bnyro/wallpaper/obj/WallpaperConfig.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,39 @@ | ||
package com.bnyro.wallpaper.obj | ||
|
||
import android.content.Context | ||
import androidx.work.NetworkType | ||
import com.bnyro.wallpaper.R | ||
import com.bnyro.wallpaper.enums.WallpaperSource | ||
import com.bnyro.wallpaper.enums.WallpaperTarget | ||
import com.bnyro.wallpaper.ext.formatMinutes | ||
import com.bnyro.wallpaper.ui.nav.DrawerScreens | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class WallpaperConfig( | ||
val id: Int, | ||
var changeIntervalMinutes: Int = 12 * 60, | ||
var networkType: NetworkType = NetworkType.CONNECTED, | ||
var target: WallpaperTarget = WallpaperTarget.BOTH, | ||
var source: WallpaperSource = WallpaperSource.ONLINE, | ||
var applyImageFilters: Boolean = true, | ||
var selectedApiRoutes: List<String> = listOf(DrawerScreens.apiScreens[0].route), | ||
var localFolderUris: List<String> = listOf() | ||
) | ||
) { | ||
fun getSummary(context: Context): String { | ||
val targetString = when (target) { | ||
WallpaperTarget.HOME -> R.string.home | ||
WallpaperTarget.LOCK -> R.string.lockscreen | ||
WallpaperTarget.BOTH -> R.string.both | ||
} | ||
val sourceString = when (source) { | ||
WallpaperSource.LOCAL -> R.string.local | ||
WallpaperSource.ONLINE -> R.string.online | ||
WallpaperSource.FAVORITES -> R.string.favorites | ||
} | ||
|
||
return "${context.getString(sourceString)} - ${context.getString(targetString)} (${ | ||
changeIntervalMinutes.toLong().formatMinutes() | ||
})" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.