Skip to content

Commit

Permalink
feature: reload the current wallpaper when changing the layout
Browse files Browse the repository at this point in the history
  • Loading branch information
ciriousjoker committed Aug 18, 2023
1 parent c806510 commit 46721d5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions js/MainActivity.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
12 changes: 12 additions & 0 deletions js/WallpaperManager.js
Original file line number Diff line number Diff line change
@@ -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();

Expand Down

0 comments on commit 46721d5

Please sign in to comment.