diff --git a/js/MainActivity.js b/js/MainActivity.js index 1bc42c5..80e959e 100644 --- a/js/MainActivity.js +++ b/js/MainActivity.js @@ -106,6 +106,7 @@ async function onClickDelayUnit(value) { async function onClickLayoutMode(value) { console.log("Selected layout mode: ", value); await SharedPreferences.set(Constants.Key.layout_mode, value); + reloadCurrentWallpaper() } function setupOnClickHandlers() { diff --git a/js/WallpaperManager.js b/js/WallpaperManager.js index fd6133b..402fb12 100644 --- a/js/WallpaperManager.js +++ b/js/WallpaperManager.js @@ -1,3 +1,15 @@ +async function reloadCurrentWallpaper() { + const rootEntry = await getRoot(); + + const folderContent = await readFolderContent(rootEntry); + + const currentId = await SharedPreferences.get(Constants.Key.current_file_id); + + await _setWallpaper(folderContent.images[currentId]); + + await SharedPreferences.set(Constants.Key.current_file_id, currentId); +} + async function loadNextWallpaper() { const rootEntry = await getRoot();