|
@@ -16,10 +16,13 @@ import java.io.IOException
|
|
|
|
|
|
|
|
class WallpaperManager(private val mainActivity: MainActivity) {
|
|
class WallpaperManager(private val mainActivity: MainActivity) {
|
|
|
fun onApplyThemeResource(theme: Resources.Theme?, @StyleRes resid: Int) {
|
|
fun onApplyThemeResource(theme: Resources.Theme?, @StyleRes resid: Int) {
|
|
|
|
|
+ if(!isActivityDefaultLauncher(mainActivity)) {
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
// Cannot inject here because this is called too early in the lifecycle
|
|
// Cannot inject here because this is called too early in the lifecycle
|
|
|
val unlauncherDataSource = UnlauncherDataSource(mainActivity, mainActivity.lifecycleScope)
|
|
val unlauncherDataSource = UnlauncherDataSource(mainActivity, mainActivity.lifecycleScope)
|
|
|
unlauncherDataSource.corePreferencesRepo.liveData().observe(mainActivity) {
|
|
unlauncherDataSource.corePreferencesRepo.liveData().observe(mainActivity) {
|
|
|
- if (!it.setThemeWallpaper && mainActivity.getUserSelectedThemeRes() == resid) {
|
|
|
|
|
|
|
+ if (it.keepDeviceWallpaper && mainActivity.getUserSelectedThemeRes() == resid) {
|
|
|
// only change the wallpaper when user has allowed it and
|
|
// only change the wallpaper when user has allowed it and
|
|
|
// preventing to change the wallpaper multiple times once it is rechecked in the settings
|
|
// preventing to change the wallpaper multiple times once it is rechecked in the settings
|
|
|
return@observe
|
|
return@observe
|