Compare commits

...
807 Commits
Author SHA1 Message Date
YaqiongWu 073df232f2 fix(import): skip files trashed under their old display name
HyperOS renames a deleted file to .trashed-… but keeps reporting its old display name, so only the document id shows it.
2026-11-18 08:27:33 -08:00
Anthonyy232 16f5a1682b docs: say that a rescan drops deleted folder images 2026-11-17 18:22:36 -08:00
YaqiongWu e7c6c5b850 fix(import): drop deleted and trashed images on folder refresh
Some galleries delete a photo by renaming it to .trashed-… in place. A rescan imported those as new wallpapers and kept the deleted originals.
2026-11-17 18:18:24 -08:00
Pbg4444 548bc9b32a fix: skip screen-off change if the screen comes back on 2026-11-17 11:41:30 -08:00
Anthonyy232 cb6e7b83be fix: retry the live wallpaper until its images can be read
Waiting for the provider to announce a change did not recover on a Galaxy Tab: nothing was announced, so the home screen stayed black. Retry on a timer instead, and test readability by opening the file.

Refs #646
2026-11-17 08:55:17 -08:00
Anthonyy232 b506ac179f chore: release v4.3.1 2026-11-17 00:41:38 -08:00
Anthonyy232 8eb3d501cd fix: load the live wallpaper once its storage becomes readable
After a reboot the engine can start before the storage volume is
mounted. Every candidate then failed validation, the home screen
stayed black until the next change and the unreadable items were
dropped from the queue, in static mode too.

Refs #646
2026-11-17 00:24:44 -08:00
Anthonyy232 47aa0a6f25 docs: give the language count as a floor
The Crowdin sync adds a language once it is 90% reviewed, which left an exact count stale.
2026-11-16 20:39:06 -08:00
Anthonyy232 0f988dd1a7 refactor: drop unused defaults for the continue-rotation flag 2026-11-16 20:04:08 -08:00
Anthonyy232 39dc628de6 chore: release v4.3.0 2026-11-15 22:06:20 -08:00
Anthonyy232 12c3d67fc2 fix: change on screen off only once the wallpaper is hidden
Some skins keep drawing the wallpaper through their screen-off animation, so the swap was visible. Fixes #644
2026-11-15 22:06:20 -08:00
Anthonyy232 2be0653c37 build: skip the missing plural form lint rule for crowdin exports 2026-11-15 22:06:20 -08:00
Anthonyy232 20f3254016 build: target android 17 (sdk 37) 2026-11-15 19:13:24 -08:00
Anthonyy232 78df576bf8 docs: say how many languages ship 2026-11-15 13:38:25 -08:00
github-actions[bot] 96181409e9 chore: update translations 2026-11-15 13:38:19 -08:00
Anthonyy232 36141d0ac7 fix(i18n): stop offering the app name for translation 2026-11-15 13:38:19 -08:00
Anthonyy232 c198f26a86 ci: auto-merge only the minor-patch group and drop the renovate stub 2026-11-15 13:38:19 -08:00
Anthonyy232 ac6a04b0f4 ci: keep toolchain updates out of the auto-merged group 2026-11-15 13:38:19 -08:00
Anthonyy232 51a67a709d build: move dependency updates from renovate to dependabot
Monthly, grouped, minor and patch merge themselves once the required checks pass. Toolchain updates stay manual because F-Droid compares its rebuild with the release APK. renovate.json stays only to keep the installed app from re-onboarding.
2026-11-15 10:10:41 -08:00
Anthonyy232 007740d626 docs: recapture the screenshots with a fixed status bar 2026-11-15 10:02:17 -08:00
Anthonyy232 98ada25d02 docs: add a security policy 2026-11-15 10:02:17 -08:00
Anthonyy232 4a7f22bbc6 docs: send translators to crowdin 2026-11-15 10:02:17 -08:00
Anthonyy232 99c79daa0c ci: sync translations with crowdin
Only approved translations come back, shipped strings are never dropped, and a new locale waits until it is 90% approved. CI can be dispatched because the pull request it opens with GITHUB_TOKEN starts no workflows.
2026-11-15 10:02:09 -08:00
Anthonyy232 2b9cb6def2 build: baseline the two deliberate lint warnings
Battery optimisation exemption is needed for reliable scheduling outside Play. targetSdk 37 waits for an Android 17 test pass.
2026-11-15 10:02:09 -08:00
Anthonyy232 9fdd5bb3fd refactor: use platform and library apis over hand-rolled code 2026-11-15 10:01:57 -08:00
Anthonyy232 7140c970e1 fix(i18n): put counts inside the plural and format strings
Translators can now place the number and pick the plural form instead of the code gluing words together.
2026-11-15 10:01:57 -08:00
Anthonyy232 f4d6e995b3 refactor(ui): size the wallpaper preview from the window info
Configuration.screenWidthDp is deprecated in Compose; the window container size also includes the system bars the wallpaper sits behind.
2026-11-15 10:01:57 -08:00
Anthonyy232 a5788dac33 docs: rebuild the readme, site and store images from the media branch
The images are now generated from committed emulator captures and demo wallpapers on media, so they can be rebuilt. The fresh captures show a different clock time.
2026-11-15 10:01:57 -08:00
Anthonyy232 3cc8a4230d docs: put the store screenshots on a flat background 2026-11-15 02:30:44 -08:00
Anthonyy232 2a6db2fad7 docs(site): add the copyright line to the footer 2026-11-15 02:30:44 -08:00
Anthonyy232 f8b96084c6 test: check the continued rotation against the real database 2026-11-15 02:30:44 -08:00
Anthonyy232 1b8505d7e4 fix: make continue rotation opt-in and wait for settings to show it
Applying a single wallpaper keeps its 4.2.2 behaviour unless the box is ticked.
2026-11-15 02:30:44 -08:00
Anthonyy232 5902af44c7 docs: match agents.md to the standard and correct the f-droid flow 2026-11-15 02:30:44 -08:00
Anthonyy232 b9c2ab868f docs: note that the release job reuses a prepared draft 2026-11-15 02:30:44 -08:00
Anthonyy232 a34726a506 docs: list traditional chinese and the continue rotation option 2026-11-15 02:30:44 -08:00
Anthonyy232 9a13e3ba09 refactor: trim the rotation helper comment and its duplicate tests 2026-11-15 02:30:44 -08:00
Anthonyy232 de4442cfe5 fix(i18n): drop removed strings and translate the rotation option 2026-11-15 02:30:44 -08:00
Akiro e58830610a feat: continue the rotation from a picked wallpaper (#648)
In ordered mode, setting a single wallpaper only took that item out of the queue, so the next change carried on from the old position. The Set wallpaper dialog now has a "Continue rotation from here" checkbox, on by default and hidden while shuffling, that rebuilds the queue with the wallpapers after the picked one.
2026-11-15 02:30:44 -08:00
魔王少年(maou shonen) a4386df20c feat(i18n): add Traditional Chinese (#629)
Traditional Chinese devices do not match the Simplified Chinese resources and fell back to English.
2026-11-15 02:30:44 -08:00
Anthonyy232 c36ca574d5 ci: keep hand-written notes when the release job reuses a draft
The release action appends generated notes to an existing draft for the tag. Notes are written by hand, so stop generating them.
2026-11-15 02:30:44 -08:00
Anthonyy232 bd679b9d79 ci: update the pinned action digests 2026-11-15 02:30:43 -08:00
Anthonyy232 83e69d2503 build: update gradle to 9.9.1, ksp and kotlinx serialization 2026-11-15 02:30:43 -08:00
Anthonyy232 c20f266ecf docs: recrop store screenshots 2 and 3 to start on a whole row 2026-11-15 02:30:43 -08:00
Anthonyy232 a30504d633 docs: redraw the store feature graphic flat at 1024x500 2026-11-15 02:30:43 -08:00
Anthonyy232 91823ba76b test: track the room schema the migration test reads 2026-11-15 02:30:43 -08:00
Anthonyy232 393cf3f56b chore: stop the renovate cooldown from holding action digests
Digest updates have no release date, so stability-days never passed. Renovate now merges by itself once its own checks pass, as repo auto-merge is off.
2026-11-15 02:30:43 -08:00
Anthonyy232 d42d01ea8c build: drop the unused compose preview dependency 2026-11-15 02:30:43 -08:00
Anthonyy232 bddab1e116 ci: let a started pages deploy finish 2026-11-15 02:30:43 -08:00
Anthonyy232 b76a941e87 docs: rewrite the store listing from what the app does 2026-11-15 02:30:43 -08:00
Anthonyy232 65bc22f1eb fix(site): say which languages ship and drop an untrue policy sentence 2026-11-15 02:30:43 -08:00
Anthonyy232 6703329696 docs: rewrite the readme text for users and drop the dead crowdin link 2026-11-15 02:30:43 -08:00
Anthonyy232 d1de5f1194 docs: trim agents.md to project context and durable rules 2026-11-15 02:30:43 -08:00
Anthonyy232 2888fd3d7f docs: drop the changelog file, release notes are the record 2026-11-15 02:30:43 -08:00
Anthonyy232 7cabc6ff75 feat(site): add the product site and bring the privacy policy back 2026-11-15 02:30:43 -08:00
Anthonyy232 641596f58d ci: cancel superseded runs, run the documented check and use issue forms 2026-11-15 02:30:43 -08:00
Anthonyy232 d75a8af634 docs: add agents.md and keep the readme for users 2026-11-15 02:30:43 -08:00
Anthonyy232 20757e2d1d chore: drop the outdated store video link and the duplicate store icon 2026-11-15 02:30:43 -08:00
Anthonyy232 e521f26903 docs: refresh the store screenshots, banner and format list 2026-11-15 02:30:43 -08:00
Anthonyy232 185994b962 docs: turn the readme into a product page with new screenshots 2026-11-15 02:30:43 -08:00
Anthonyy232 374a078007 feat: group settings into joined rows and put current wallpapers first 2026-11-15 02:30:43 -08:00
Anthonyy232 7fb2843b48 feat: draw the colour palette from the new icon 2026-11-15 02:30:43 -08:00
Anthonyy232 8bae038508 feat: add a launcher icon of three fanned wallpaper sheets 2026-11-15 02:30:43 -08:00
Anthonyy232 cef26f42f8 docs: correct the v4.2.2 permission note
WorkManager still contributes RECEIVE_BOOT_COMPLETED to the merged manifest.
2026-11-14 21:07:56 -08:00
renovate[bot] 063e5dcc28 chore(deps): update dependency com.google.devtools.ksp to v2.3.13 (#649)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-11-13 23:57:35 +00:00
Anthonyy232 df5985f3d6 chore: release v4.2.2 2026-11-10 23:44:16 -08:00
Anthonyy232 e4e19faa24 chore: update the build plugins and dependencies
AGP 9.5.1, Kotlin plugins 2.4.21, Compose BOM 2026.09.00, material3
1.5.0-rc01, DataStore 1.3.0, WorkManager 2.12.0, serialization 1.12.0,
mockk 1.14.12 and zoomable 2.16.0.
2026-11-10 23:40:10 -08:00
Anthonyy232 e41920b65f chore: drop the redundant v26 qualifier from the launcher icon folder
minSdk is 31, so the qualifier never selects anything.
2026-11-10 23:35:43 -08:00
Anthonyy232 c21f9d11df refactor: drop code the platform and libraries already provide
- decode wallpapers with ImageDecoder only; the BitmapFactory and manual EXIF fallback could not be needed at minSdk 31
- remove BootReceiver: WorkManager reschedules periodic work after reboot
- replace the in-process reload broadcast with a shared flow
- remove the Room enum converter; Room stores enums by name
- stop importing SVG, which neither apply path can decode, and drop coil-svg
- remove the unused special-use foreground service permission
2026-11-10 15:12:40 -08:00
Anthonyy232 d2ffa9745b refactor: merge duplicated dialogs, switch rows, comparators and settings lookups
One ConfirmDialog, SettingSwitchRow, launchBusy and sort comparator replace their copies. ScheduleSettings gains albumId(screen) and isRotating(mode). CreateAlbumUseCase is now the only owner of the duplicate-name rule (case-insensitive, as the user already saw); the unused name query is gone. TimeIntervalPicker splits durations with kotlin.time.
2026-11-10 15:12:40 -08:00
Anthonyy232 d6bd404add refactor: move test fixtures and test-only queries out of main
The empty() model factories and four DAO methods were only called by tests. Fixtures now live in a source dir shared by unit and instrumented tests.
2026-11-10 12:25:33 -08:00
Anthonyy232 b3c2264bd3 fix: hide shuffle and adaptive brightness descriptions whenever enabled
They depended on the unrelated individual scheduling switch; the other toggles hide the description when on.
2026-11-10 12:25:33 -08:00
Anthonyy232 11724d99d3 refactor: use the SliderState slider overload
The value overload is deprecated in material3 1.5; this is what it did internally.
2026-11-10 12:25:33 -08:00
Anthonyy232 4e05b62d6e fix: load one live wallpaper at start and redraw on theme change
The engine requested a wallpaper in onCreate and again on the first settings emission, consuming two queue items. Adaptive brightness now gets a new frame when dark mode changes while visible.

Also drops the reload throttle, which only the album switch used, the renderer teardown that could never run because the surface is destroyed before the engine, and the catch that silently ended settings observation.
2026-11-10 08:25:05 -08:00
Anthonyy232 2044748e20 fix: stop the library tab padding system bars twice
The nested Scaffold re-applied the insets the home Scaffold had already padded, on edge-to-edge devices.
2026-11-10 08:25:05 -08:00
Anthonyy232 97dc38bbfb test: cut tests that cannot fail and tighten weak ones
- Remove tests that repeat another test, only verify a one-line delegate,
  compare a helper with itself, or exercise the platform.
- Make the EXIF rotation, lock interval validation, partial import and
  render selection tests fail when the behaviour breaks.
- Round-trip every schedule setting through the settings repository.
2026-11-10 02:47:40 -08:00
Anthonyy232 d169b84430 refactor: untangle the UI, remove the dead sort screen and trim leftovers
Dead code
- Remove the manual sort screen, unreachable since sorting moved into the
  album screen, with its route, strings, reorder repository/DAO methods and
  the reorderable dependency.
- Remove unused parameters, defaults, typography styles and constants.

UI
- Share the settings card, selectable grid card, wallpaper grid, back top
  bar, album cover, snackbar effect and onboarding button instead of
  keeping copies per screen; move shared pieces to common/components.
- HomeViewModel owns the duplicate album name rule and exposes only the
  animate flag; WallpaperViewViewModel exposes its own route arguments.
- The wallpaper viewer title shows the decoded file name.
- The empty library uses the same empty state as albums and folders.

Data and services
- Keep document-provider scanning next to AndroidDocumentSource and return
  SourceImage directly.
- Define preference keys where they are used; query the current wallpaper
  once.
- Use runCatchingCancellable for the remaining hand-written rethrows.

Live wallpaper
- Draw the crossfade without the always-opaque alpha helper and drop
  redundant program binds, guards and dead stores.
- Stop checking GL errors after deletes, which threw stale errors from
  cleanup and leaked tiles.
- A crashed GL thread refuses queued events instead of holding them.
2026-11-10 02:47:40 -08:00
renovate[bot] f153eebc71 fix(deps): update dependency androidx.compose.material3:material3 to v1.5.0-beta01 (#643)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-10-21 22:24:08 +00:00
Anthonyy232 66766c7926 chore: release v4.2.1 2026-10-13 09:15:11 -07:00
Anthonyy232 3b85cdb822 refactor: strip release debug logs and drop hand-rolled catches
- Strip Log.d/Log.v in release via R8; remove the per-frame parallax log.
- Use runCatchingCancellable instead of manual cancellation rethrows.
- Remove an unreachable catch in AlbumViewViewModel.deleteSelected.
- Reduce AlbumRefreshWorker to the work itself; drop log-only counters.
- Replace a force-unwrap in HomeScreen with a local val.
2026-10-13 09:10:03 -07:00
Anthonyy232 7dc1171678 refactor: simplify architecture and remove dead and duplicated code
Error handling
- Replace the custom Result type with exceptions; callers catch at the
  edge via runCatchingCancellable so cancellation always propagates.
- Log live wallpaper queue failures that were previously ignored.

Architecture
- Add SettingsCoordinator to own settings edits and their scheduling side
  effects; ViewModels now only hold UI state.
- Add a domain WallpaperRenderer interface (Android implementation in
  data/source) and drop Context from use cases; the service maps
  exceptions to messages.
- Share queue dequeuing between static changes and the live wallpaper.
- Merge PreferencesManager into SettingsRepositoryImpl with generated
  effect keys (stored key names unchanged).
- Start WallpaperChangeService only through its helpers; merge the
  duplicate change actions and share one error path for all actions.
- Fold AlbumRefreshScheduler into WallpaperScheduler.
- Move WallpaperSorter, AppModule and design tokens to their owners.

Cleanup
- Remove unused constants, WorkManager tags, single-value enums and
  converters (Room schema unchanged), brand-based texture limits and
  single-use design tokens.
- Deduplicate effect controls, interval fields, sort events and
  StateFlow sharing.
- Cut trivial tests and comments that restated the code.
2026-10-13 00:59:21 -07:00
renovate[bot] a84bfabbed fix(deps): update dependency androidx.navigation:navigation-compose to v2.10.2 (#634)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-10-08 12:01:59 +00:00
renovate[bot] fb1c8a22f2 fix(deps): update dependency androidx.core:core-ktx to v1.19.1 (#633)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-10-08 05:53:49 +00:00
renovate[bot] ddc7c8e5ca fix(deps): update dependency androidx.compose.material3:material3 to v1.5.0-alpha29 (#632)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-10-08 02:21:46 +00:00
renovate[bot] 1810f8cc9e fix(deps): update coil to v3.6.3 (#630)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-10-02 14:14:35 +00:00
Anthony La ca28dcd3ca Merge pull request #628 from Anthonyy232/codex/reliability-release
Improve wallpaper reliability and simplify app for v4.2.0
2026-09-26 11:06:02 -07:00
Anthonyy232 1ba3d10aa7 Improve wallpaper reliability and simplify app for v4.2.0 2026-09-26 10:58:04 -07:00
Anthonyy232 f8fa13d487 fix: make album imports and refreshes reliable
Add cancellable imports, preserve inaccessible sources, and update covers and queues atomically. Share folder refresh logic, improve collection controls and accessibility, and simplify repository and selection code.

Validated with 299 unit tests, 29 device tests, lint, and a debug build.
2026-09-26 10:58:04 -07:00
renovate[bot] 7e942a2c83 fix(deps): update dependency androidx.room:room-runtime to v2.8.5 (#626)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-09-26 07:58:55 +00:00
renovate[bot] 80468834fc fix(deps): update dependency androidx.room:room-ktx to v2.8.5 (#625)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-09-26 01:05:55 +00:00
renovate[bot] 426bfd1763 fix(deps): update dependency androidx.room:room-compiler to v2.8.5 (#624)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-09-25 23:21:47 +00:00
renovate[bot] 2dc2790eba fix(deps): update dependency androidx.navigation:navigation-compose to v2.10.1 (#623)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-09-25 19:51:10 +00:00
renovate[bot] 3bd03c87d4 fix(deps): update dependency androidx.compose.material3:material3 to v1.5.0-alpha28 (#622)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-09-25 12:10:18 +00:00
renovate[bot] d28d343c8f chore(deps): update dependency com.google.devtools.ksp to v2.3.12 (#620)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-09-24 23:36:50 +00:00
Anthony La fdc9dc2591 ci: gate dependency updates on lint and toolchain review (#616) 2026-09-21 21:16:13 -07:00
renovate[bot] e00c356ac2 fix(deps): update coil to v3.6.2 (#611)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-09-18 20:55:12 +00:00
renovate[bot] 174f5b17e6 fix(deps): update coil to v3.6.1 (#609)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-09-15 23:30:22 +00:00
Anthony La e18f3eceb9 fix: defer automatic rotation after manual changes
Preserve the full interval with an in-place next-run override and add request-level and real WorkManager regression coverage.
2026-09-12 12:06:19 -07:00
Anthony La 22cc66687e chore: prepare Paperize v4.1.1 (#606)
Bump the app to version 4.1.1 (56) and add release notes for Simplified Chinese support and corrected notification privacy text.
2026-09-12 11:26:44 -07:00
Anthony La fc90aeaa78 Merge pull request #605 from zxiaoshen/i18n/zh-CN
feat(i18n): add Simplified Chinese (zh-CN) translation
2026-09-12 11:18:31 -07:00
Anthonyy232 7fb0f8e824 fix(i18n): qualify Simplified Chinese and correct privacy copy 2026-09-12 11:13:18 -07:00
dsh 3fccae4273 feat(i18n): add Simplified Chinese (zh-CN) translation 2026-09-11 23:21:38 +08:00
Anthony La 65a2f66344 feat: prepare Paperize v4.1.0 (#598) 2026-08-30 09:42:54 -07:00
renovate[bot] 93af870235 chore(deps): update dependency com.google.devtools.ksp to v2.3.11 (#592)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-08-18 01:04:25 +00:00
renovate[bot] 51f4ac310a chore(deps): update androidgradleplugin to v9.3.1 (#582)
Verified with 271 unit tests, lint, debug APK compilation, instrumentation APK compilation, and CodeQL.
2026-08-06 23:40:44 -07:00
Anthony La e651cdc248 Fix static wallpaper rendering and scheduling regressions (#583)
Correct natural-orientation static rendering, make Fill scrolling opt-in, add persistent pause/resume scheduling controls, and remove the unused network-state permission.
2026-08-06 23:24:43 -07:00
renovate[bot] 4175b09196 fix(deps): update Hilt to 2.60.1 (#576)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-08-06 22:28:28 -07:00
renovate[bot] 1edfcfd837 fix(deps): update kotlinx-coroutines-test to 1.11.0 (#575)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-08-06 22:28:25 -07:00
Anthony La 15c9b47131 fix: harden wallpaper engines for v4.0.2 (#571)
* fix: harden wallpaper engines for v4.0.2

* fix: restore launcher wallpaper shortcut

* fix: keep launcher shortcut entry point private

* chore: remove unused legacy dependencies

* ci: validate final audited tree
2026-07-30 00:44:03 -07:00
Anthony La 87a69e748f fix: make notification intents explicitly targeted (#570)
Make notification destinations explicit in an analyzer-visible form while retaining immutable PendingIntent flags, resolving the high-severity CodeQL finding.
2026-07-29 23:16:40 -07:00
Anthony La 3b746ad354 ci: add Android-aware CodeQL analysis (#567)
Add pinned CodeQL analysis for GitHub Actions and Android Java/Kotlin builds, and restrict the release workflow token to read-only by default.
2026-07-29 23:04:12 -07:00
Anthony La 797a407f3c fix: harden wallpaper updates for v4.0.1 (#566) 2026-07-29 22:28:01 -07:00
renovate[bot] 145899d9a6 chore(deps): update github artifact actions (#563)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-07-29 22:20:18 -07:00
renovate[bot] af72b78a7b fix(deps): update dependency androidx.hilt:hilt-work to v1.4.0 (#562)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-07-29 22:19:34 -07:00
renovate[bot] 13367165e6 fix(deps): update dependency androidx.hilt:hilt-compiler to v1.4.0 (#560)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-07-29 22:15:10 -07:00
renovate[bot] b5f4b52f60 chore(deps): update gradle to v9.6.1 (#551)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-07-29 22:07:38 -07:00
renovate[bot] 434830cfdd chore(deps): pin dependencies (#548)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-07-29 22:01:30 -07:00
renovate[bot] 7c426d5d63 fix(deps): update dependency io.mockk:mockk to v1.14.11 (#550)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-07-29 14:29:24 +00:00
Anthonyy232 d940d9e112 docs: align v4.0.0 release notes 2026-07-28 22:32:48 -07:00
Anthonyy232 153cdbe798 chore: prepare Paperize 4.0.0 release 2026-07-28 22:03:50 -07:00
malteish 063f05bdba feat: restore an in-app change-now action
Integrates the aligned portion of #537 while retaining platform-controlled home-screen sizing.
2026-07-28 22:03:50 -07:00
Anthonyy232 bc513d666e fix: stabilize synchronized changes and foldable rendering 2026-07-28 22:03:50 -07:00
malteishandClaude Opus 4.8 3793aaae65 fix: render current-wallpaper preview from URI instead of getDrawable
The preview read the live wallpaper via WallpaperManager.getDrawable(), which
is privacy-restricted on modern Android and returns null without the optional
all-files-access permission - leaving both previews blank/grey.

Render the wallpaper Paperize last recorded instead, loading its source URI
with Coil. A new reactive getCurrentWallpaperFlow (DAO + repository) drives
HomeViewModel.current{Home,Lock}WallpaperUri, so the preview updates whenever
the wallpaper changes and needs no extra permission. Falls back to the
BOTH-mode record when home/lock are synced.

Shows the source image rather than the exact cropped/effected result; a
pixel-exact cached-bitmap preview can follow later.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-28 22:03:50 -07:00
malteishandClaude Opus 4.8 ade1fd4673 feat: show live import progress when adding folders/wallpapers
Adding a large folder previously gave no feedback at all (the FAB's
isLoading hook was hardcoded false), so a long import looked frozen.

Surface an ImportProgress state from AlbumViewViewModel and show a modal
dialog with a live count: a counting-up 'Scanning... N found' during the
folder walk, then a determinate 'Saving X / total' bar while rows are
written. scanFolderImages now reports discovery progress (throttled), and
inserts run in chunks that report saved/total - which also avoids
materializing the full entity list at once.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-28 22:03:50 -07:00
malteishandClaude Opus 4.8 e2e9d6f4f9 perf: scan folders via DocumentsContract cursor instead of DocumentFile
Adding a folder walked the tree with DocumentFile.listFiles(), which issues
a separate ContentResolver IPC for every file and for every attribute access
(name, isDirectory, lastModified). For folders with tens of thousands of
images this dominates the add/refresh time and risks ANRs.

Replace it with a single DocumentsContract cursor query per directory that
returns document id, name, mime type and last-modified in one round-trip, and
traverse directories iteratively to avoid deep-recursion stack overflow. The
album-view add path additionally dropped its per-file getFileName() and
detectMediaType() lookups by reusing the name returned from the scan.

Returned URIs are built from the same tree document id as before, so existing
wallpaper URIs remain stable. Both folder-scan call sites now share one helper.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-28 22:03:50 -07:00
renovate[bot] 9c8fbaf1cc fix(deps): update dependency androidx.navigation:navigation-compose to v2.9.8 (#527)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-07-29 05:00:22 +00:00
Malteish 8e8be164bd fix: restore compilation (#534)
Remove the stale navigation callback left behind after sorting moved into the album screen. This restores compilation on master and unblocks CI.
2026-07-28 21:38:04 -07:00
Anthonyy232 e7d5022d02 fix: throw prevents lock from rendering 2026-03-28 15:31:23 -07:00
Anthonyy232andClaude Opus 4.6 83d1bafcf8 perf: prevent OOM from oversized FILL bitmaps and BOTH-mode double allocation
Two memory optimizations:

1. ImageDecoder FILL path: use setCrop() to crop to canvas during decode
   instead of allocating the full fill-scale bitmap first. For a portrait
   2000x3000 image on a 4032x2992 parallax canvas, this avoids a ~97MB
   intermediate (4032x6048) — the output is directly 4032x2992 (~48MB).

2. BOTH mode: recycle the HOME bitmap before rendering the LOCK bitmap,
   so they are never in memory simultaneously. Removes the fallback that
   reused the HOME bitmap for LOCK (which kept it alive during LOCK
   rendering). If LOCK rendering fails, the lock screen retains its
   previous wallpaper rather than getting the oversized HOME bitmap.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 15:17:24 -07:00
Anthonyy232andClaude Opus 4.6 2abf5a1804 fix: BOTH mode renders lock screen separately at physical screen dimensions
In BOTH mode, the same HOME-sized bitmap (wide parallax canvas, e.g.
4032x2992) was reused for the lock screen via setBitmap(FLAG_LOCK).
The lock screen has no parallax, so Android center-cropped the wide
bitmap — defeating FIT/NONE modes which should letterbox, not crop.

Fix: after setting HOME, sync the LOCK queue, then re-render the same
wallpaper via reapplyEffectsUseCase(ScreenType.LOCK) at the physical
screen dimensions. Falls back to the old behavior if re-render fails.

Applied to both WallpaperChangeService and WallpaperChangeWorker.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 15:14:14 -07:00
Anthonyy232andClaude Sonnet 4.6 6884559b6b fix: all scaling modes now produce exact-canvas-sized bitmaps
retrieveBitmap previously returned bitmaps sized to the image content (e.g.
1994x2992 for FIT on a portrait image), leaving the launcher to scale/position
them — which silently broke the chosen scaling mode:

  FIT   → narrower than canvas → launcher scaled up → cropped height again
  FILL  → taller than canvas  → launcher behaviour undefined / distorted
  NONE  → smaller than canvas → launcher stretched it

New finalizeToCanvas() step ensures every path returns a bitmap of exactly
canvasW×canvasH pixels:
  FILL   → center-crop the fill-scaled source to canvas size;
           upscale first when BitmapFactory fallback returns a small source
  FIT    → center the fit-scaled source on a black canvas (letterbox/pillarbox)
  NONE   → center the original-size source on a black canvas
  STRETCH → source was decoded to exact canvas dimensions; no-op

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-28 15:06:05 -07:00
Anthonyy232andClaude Sonnet 4.6 8d805ad17d fix: FIT/FILL scaling broken on launchers with parallax scrolling (Pixel Launcher)
Wallpapers were rendered at physical screen size (e.g. 1344x2992) then passed
to WallpaperManager.setBitmap() with a null visibleCropHint. The Pixel Launcher
(and others) declare a desired minimum width ~3x the screen width for horizontal
parallax across home-screen pages. Android scales the bitmap up to fill that
canvas, which proportionally enlarges the height and crops the top/bottom --
making FIT indistinguishable from FILL and always cutting off portrait subjects.

Fix: introduce getWallpaperRenderSize() which uses WallpaperManager
.getDesiredMinimumWidth/Height for HOME/BOTH screen types. The bitmap is now
rendered to fill the full parallax canvas upfront, so Android has nothing to
scale and the user's chosen scaling mode is preserved. LOCK screen is unchanged
(no parallax, physical screen size is correct).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-28 14:59:39 -07:00
Anthonyy232andClaude Sonnet 4.6 5efb272dcb fix: scheduleWallpaperChanges fire-and-forget in BootReceiver
scheduleWallpaperChanges internally launched on schedulerScope and returned
immediately, so BootReceiver called pendingResult.finish() before WorkManager
enqueued the jobs — the process could be recycled before the scheduling ran.
Converted to a suspend function so callers await completion.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-28 14:43:21 -07:00
Anthonyy232andClaude Sonnet 4.6 456fea3c17 fix: move settings debounce from composable-local state to HomeViewModel
pendingSettings was stored in WallpaperScreen's remember{} scope — navigating
away (e.g. to AlbumView) cancelled the LaunchedEffect and silently discarded
in-flight slider/interval changes. Moved the debounce Job to viewModelScope so
pending updates survive composition changes.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-28 14:29:48 -07:00
Anthonyy232andClaude Sonnet 4.6 8f357f8767 fix: reset wasCleared on each DataStore edit retry in clearAlbumSelectionsIfMatches
DataStore's edit lambda can be retried when a concurrent write conflict
is detected. wasCleared was captured from the outer scope and never reset
between retries, so a true from a failed first attempt could leak into the
final return value even if the condition no longer held on the retry.
Added wasCleared = false at the top of the lambda so each attempt starts
from a clean state.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-28 14:06:12 -07:00
Anthonyy232andClaude Sonnet 4.6 73ca207301 fix: prevent GL texture leak when tile creation fails mid-array
If Bitmap.createBitmap() or loadTexture() threw (e.g. OutOfMemoryError)
while building the GLPicture tiles Array, any textures already uploaded
to the GPU in previous iterations were abandoned because the tiles field
was never assigned and recycle() could not be called. Switched from the
Array{} lambda (which only exposes partial state through the exception)
to an explicit loop that tracks created tiles in a List, and added a
catch-rethrow that deletes all partial textures before propagating.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-28 14:05:24 -07:00
Anthonyy232andClaude Sonnet 4.6 34031fe89d fix: stop foreground service immediately on null/unknown action
If onStartCommand received a null intent (possible when START_STICKY
restarts a killed service) or an unrecognized action, the service would
start foreground (showing a persistent notification) but never call
stopSelf(), leaving it running indefinitely. Added an else branch to
call stopSelf(startId) immediately in these cases.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-28 14:02:53 -07:00
Anthonyy232andClaude Sonnet 4.6 4e14adfc01 fix: recycle bitmaps on exception in wallpaper processing pipeline
ChangeWallpaperUseCase and ReapplyEffectsUseCase both leaked the
processedBitmap when processBitmap() or adaptiveBrightnessAdjustment()
threw an exception — the outer catch returned Result.Error without
recycling the allocated bitmap. Added an inner try-catch-rethrow that
recycles whichever bitmap is live at the point of failure before
re-throwing so the outer handler can record the skip.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-28 14:01:17 -07:00
Anthonyy232andClaude Sonnet 4.6 8e4b0771c8 perf: eliminate O(n²) queue merges, N+1 refresh queries, and dead schema columns
- QueueBuilder: convert List.contains to HashSet lookups in mergeWithExistingQueue
  and mergeWithExistingQueueDeterministic (O(n²) → O(n))
- AlbumRefreshWorker: load existing folder URIs once per folder with
  getExistingWallpaperUris() instead of one DB query per scanned wallpaper (N+1 → 1)
- WallpaperEntity: remove unused cropOffsetX/Y/Scale columns (always null, never read)
- DATABASE_VERSION bumped to 4; fallbackToDestructiveMigration handles upgrade

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-28 13:49:49 -07:00
Anthonyy232andClaude Sonnet 4.6 4565893787 refactor: rename shadowed local variable in addWallpapers
Local `val wallpapers` shadowed the `StateFlow<List<Wallpaper>> wallpapers`
class property, making it hard to tell which was being referenced.
Renamed to `newWallpapers` for clarity.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-28 11:38:28 -07:00
Anthonyy232andClaude Sonnet 4.6 4ff25cad78 fix: skip-not-delete on invalid URI in live wallpaper; rename enableChangeOnScreenOn to enableChangeOnScreenOff
- PaperizeLiveWallpaperService: stop permanently deleting wallpapers when
  URI is transiently inaccessible; now skips the cycle like ChangeWallpaperUseCase does.
  AlbumRefreshWorker handles authoritative URI pruning on its daily run.
- WallpaperEffects/PreferencesManager/WallpaperScreen: rename enableChangeOnScreenOn
  → enableChangeOnScreenOff to match actual trigger (ACTION_SCREEN_OFF).
  DataStore key string is unchanged so existing user prefs are preserved.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-28 11:33:55 -07:00
Anthonyy232andClaude Sonnet 4.6 6d8a9a9302 fix: remove dead deleteFirstQueueItem from WallpaperQueueDao
This position-based delete was superseded by deleteQueueItem (which
deletes by wallpaperId) and has zero call sites.  Removing it
eliminates confusion about which dequeue strategy is active.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-28 11:25:38 -07:00
Anthonyy232andClaude Sonnet 4.6 8d945a63a4 fix: validate homeAlbumId==lockAlbumId in Worker BOTH mode
WallpaperChangeService already guards against the case where home and
lock albums diverge in BOTH mode.  WallpaperChangeWorker was using
homeAlbumId unconditionally, silently applying the wrong album to the
lock screen during transient state transitions.  Add the same guard
and fall back to independent per-screen changes when albums differ.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-28 11:25:18 -07:00
Anthonyy232andClaude Sonnet 4.6 c72cdc39a8 fix: use integer division (floor) in calculateInSampleSize
fastRoundToInt() can round the inSampleSize ratio UP, causing the
decoded bitmap to be smaller than the target screen dimensions and
requiring upscaling.  Integer division always floors, guaranteeing
the decoded bitmap is at least as large as needed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-28 11:24:09 -07:00
Anthonyy232andClaude Sonnet 4.6 c93e2f71f1 fix: share WallpaperChangeLock singleton between service and worker
WallpaperChangeService and WallpaperChangeWorker each had their own
private companion-object Mutex, so simultaneous runs (manual change +
scheduled worker) were not mutually excluded.  Extract a @Singleton
WallpaperChangeLock and inject it into both so the same Mutex is used
across all wallpaper-change entry points.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-28 11:23:41 -07:00
Anthonyy232 bc26d3c75f fix: more bug fixes 2026-03-25 22:19:21 -07:00
renovate[bot] eadd1952fe fix(deps): update dependency androidx.compose.animation:animation to v1.10.6 (#517)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-03-26 01:56:04 +00:00
renovate[bot] fd7e69f43a fix(deps): update dependency com.lazygeniouz:dfc to v1.5 (#514)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-03-25 05:05:47 +00:00
Anthonyy232 26a13bdeb2 Merge branch 'master' of https://github.com/Anthonyy232/Paperize 2026-03-24 21:06:43 -07:00
Anthonyy232 89dc845f1b fix: bug hunt 2026-03-24 21:05:37 -07:00
renovate[bot] d0cda6cc36 fix(deps): update dependency androidx.core:core-ktx to v1.18.0 (#513)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-03-21 13:06:30 +00:00
renovate[bot] bedfbe7afd fix(deps): update dependency androidx.datastore:datastore-preferences to v1.2.1 (#511)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-03-21 08:47:20 +00:00
renovate[bot] 6f2cb0b995 fix(deps): update dependency androidx.datastore:datastore to v1.2.1 (#510)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-03-21 05:27:31 +00:00
renovate[bot] a6aaf55c3c fix(deps): update dependency androidx.activity:activity-compose to v1.13.0 (#512)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-03-21 00:39:52 +00:00
renovate[bot] f2aa714b17 fix(deps): update dependency androidx.compose.ui:ui-tooling-preview to v1.10.5 (#509)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-03-20 20:52:04 +00:00
renovate[bot] 2464907a9c fix(deps): update dependency androidx.compose.ui:ui-tooling to v1.10.5 (#507)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-03-20 18:13:00 +00:00
renovate[bot] 304a384cd0 fix(deps): update dependency androidx.compose.ui:ui to v1.10.5 (#503)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-03-20 13:43:03 +00:00
renovate[bot] 5dfb1c6a6c fix(deps): update dependency androidx.compose.ui:ui-test-junit4 to v1.10.5 (#505)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-03-20 08:57:11 +00:00
renovate[bot] 9e84837a68 fix(deps): update dependency androidx.compose.ui:ui-graphics to v1.10.5 (#504)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-03-20 05:25:26 +00:00
renovate[bot] 600db80998 chore(deps): update kotlin monorepo to v2.3.20 (#508)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-03-20 01:09:52 +00:00
renovate[bot] e6a0a607d2 fix(deps): update dependency androidx.compose.ui:ui-test-manifest to v1.10.5 (#506)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-03-19 21:40:30 +00:00
renovate[bot] 0cff2f3a0a chore(deps): update gradle to v9.4.1 (#499)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-03-19 17:14:58 +00:00
renovate[bot] 2e9768c3b5 fix(deps): update dependency androidx.compose.material:material to v1.10.5 (#502)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-03-15 05:23:09 +00:00
renovate[bot] 1df9368330 fix(deps): update dependency androidx.compose.foundation:foundation to v1.10.5 (#501)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-03-15 01:21:59 +00:00
renovate[bot] 7014fc06fe fix(deps): update dependency androidx.compose.animation:animation to v1.10.5 (#500)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-03-12 01:37:32 +00:00
renovate[bot] 464ea59a4c fix(deps): update dependency androidx.compose.ui:ui-tooling-preview to v1.10.4 (#493)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-02-27 20:50:13 +00:00
renovate[bot] dba8d9199d fix(deps): update dependency net.engawapg.lib:zoomable to v2.11.1 (#483)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-02-27 18:08:20 +00:00
renovate[bot] 9358348549 fix(deps): update dependency androidx.compose.ui:ui-tooling to v1.10.4 (#492)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-02-27 14:08:00 +00:00
renovate[bot] 1764f092ae fix(deps): update dependency androidx.compose.ui:ui-test-junit4 to v1.10.4 (#490)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-02-27 09:00:58 +00:00
renovate[bot] 8c25786a1c fix(deps): update dependency androidx.compose.ui:ui to v1.10.4 (#494)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-02-27 04:35:16 +00:00
renovate[bot] f358478355 fix(deps): update dependency androidx.compose.foundation:foundation to v1.10.4 (#486)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-02-27 02:02:06 +00:00
renovate[bot] e6ec42c015 fix(deps): update dependency androidx.compose.ui:ui-test-manifest to v1.10.4 (#491)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-02-26 21:14:10 +00:00
renovate[bot] 9e7aabe7a7 fix(deps): update dependency androidx.compose.ui:ui-graphics to v1.10.4 (#489)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-02-26 17:43:17 +00:00
renovate[bot] 6396857b66 fix(deps): update dependency androidx.compose.material3:material3 to v1.5.0-alpha15 (#488)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-02-26 13:43:00 +00:00
renovate[bot] 51e498e8e7 fix(deps): update dependency androidx.compose.animation:animation to v1.10.4 (#485)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-02-26 08:36:26 +00:00
renovate[bot] 85a39183f0 fix(deps): update dependency androidx.compose.material:material to v1.10.4 (#487)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-02-26 05:01:12 +00:00
renovate[bot] 09ce9e83b4 fix(deps): update dependency androidx.compose.ui:ui-tooling-preview to v1.10.3 (#480)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-02-25 04:43:50 +00:00
renovate[bot] 63b0e15a9f fix(deps): update coil to v3.4.0 (#484)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-02-25 01:04:30 +00:00
renovate[bot] 4013e5e2ac chore(deps): update dependency com.google.devtools.ksp to v2.3.6 (#481)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-02-18 02:04:34 +00:00
renovate[bot] 69988fa0cc fix(deps): update dependency com.lazygeniouz:dfc to v1.3 (#469)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-02-13 18:34:18 +00:00
renovate[bot] fcf92878a3 fix(deps): update dependency androidx.compose.ui:ui-tooling to v1.10.3 (#479)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-02-13 14:15:21 +00:00
renovate[bot] 9fa1536c78 fix(deps): update dependency androidx.compose.ui:ui-test-manifest to v1.10.3 (#478)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-02-13 09:34:50 +00:00
renovate[bot] 8a4f6b429d fix(deps): update dependency androidx.compose.material3:material3 to v1.5.0-alpha14 (#474)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-02-13 05:39:07 +00:00
renovate[bot] 53c5e87dca fix(deps): update dependency androidx.compose.ui:ui-test-junit4 to v1.10.3 (#477)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-02-13 02:50:22 +00:00
renovate[bot] 9737dd70b6 fix(deps): update dependency androidx.compose.ui:ui to v1.10.3 (#475)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-02-12 20:50:51 +00:00
renovate[bot] 57794f6588 fix(deps): update dependency androidx.compose.ui:ui-graphics to v1.10.3 (#476)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-02-12 19:07:34 +00:00
renovate[bot] dd79170859 fix(deps): update dependency androidx.activity:activity-compose to v1.12.4 (#470)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-02-12 14:51:25 +00:00
renovate[bot] 6f972ef2d5 fix(deps): update dependency androidx.compose.material:material to v1.10.3 (#473)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-02-12 08:49:35 +00:00
renovate[bot] 8ec4baac6d fix(deps): update dependency androidx.compose.foundation:foundation to v1.10.3 (#472)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-02-12 05:52:40 +00:00
renovate[bot] 9bf160f379 fix(deps): update dependency androidx.compose.animation:animation to v1.10.3 (#471)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-02-12 02:46:27 +00:00
renovate[bot] aaf533535b fix(deps): update dependency net.engawapg.lib:zoomable to v2.11.0 (#466)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-02-07 13:26:57 +00:00
renovate[bot] 508c5bfd23 fix(deps): update dependency io.mockk:mockk to v1.14.9 (#449)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-02-05 22:26:04 +00:00
renovate[bot] 63e224aa5b fix(deps): update dependency androidx.work:work-runtime-ktx to v2.11.1 (#465)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-02-05 18:08:02 +00:00
renovate[bot] 46d051ab8a chore(deps): update kotlin monorepo to v2.3.10 (#467)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-02-05 13:00:52 +00:00
renovate[bot] 53659c73f0 fix(deps): update dependency androidx.navigation:navigation-compose to v2.9.7 (#464)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-01-31 12:53:13 +00:00
renovate[bot] 226260def4 fix(deps): update dependency androidx.compose.ui:ui-tooling to v1.10.2 (#461)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-01-31 09:35:38 +00:00
renovate[bot] cb24374230 fix(deps): update dependency androidx.compose.ui:ui-tooling-preview to v1.10.2 (#463)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-01-31 05:48:09 +00:00
renovate[bot] 2db01c9906 fix(deps): update dependency androidx.compose.ui:ui to v1.10.2 (#456)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-01-31 01:13:47 +00:00
renovate[bot] 55f07becd0 fix(deps): update dependency androidx.compose.ui:ui-test-manifest to v1.10.2 (#460)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-01-30 20:59:50 +00:00
renovate[bot] 3740431e96 fix(deps): update dependency androidx.compose.ui:ui-test-junit4 to v1.10.2 (#458)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-01-30 16:25:50 +00:00
renovate[bot] 26ef5b63ff fix(deps): update dependency androidx.activity:activity-compose to v1.12.3 (#462)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-01-30 12:52:19 +00:00
renovate[bot] 33360a3e1e fix(deps): update dependency androidx.compose.ui:ui-graphics to v1.10.2 (#457)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-01-30 10:33:46 +00:00
renovate[bot] 859d42a7fa fix(deps): update dependency androidx.compose.foundation:foundation to v1.10.2 (#453)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-01-30 04:49:55 +00:00
renovate[bot] eac9ba5f7e chore(deps): update gradle to v9.3.1 (#459)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-01-30 00:24:20 +00:00
renovate[bot] 0b7da6f2a9 fix(deps): update dependency androidx.compose.material3:material3 to v1.5.0-alpha13 (#455)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-01-29 21:59:43 +00:00
renovate[bot] 1c725a611f fix(deps): update dependency androidx.compose.animation:animation to v1.10.2 (#452)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-01-29 18:38:00 +00:00
renovate[bot] 763291c5ba chore(deps): update dependency com.google.devtools.ksp to v2.3.5 (#451)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-01-29 14:06:11 +00:00
renovate[bot] d0de92a019 fix(deps): update dependency androidx.compose.material:material to v1.10.2 (#454)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-01-29 09:13:33 +00:00
renovate[bot] 4acd6fd56f fix(deps): update dependency org.jetbrains.kotlinx:kotlinx-serialization-json to v1.10.0 (#446)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-01-25 12:45:08 +00:00
renovate[bot] 3c23179842 fix(deps): update dependency net.engawapg.lib:zoomable to v2.9.1-test01 (#448)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-01-25 08:24:40 +00:00
renovate[bot] c6be577be3 chore(deps): update gradle to v9.3.0 (#443)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-01-17 05:35:45 +00:00
renovate[bot] db3a7972a4 fix(deps): update hilt to v2.58 (#442)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-01-17 00:24:50 +00:00
renovate[bot] dc44eebbac fix(deps): update dependency androidx.compose.ui:ui-tooling to v1.10.1 (#438)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-01-16 21:28:07 +00:00
renovate[bot] 88b0ffa95c fix(deps): update dependency androidx.compose.ui:ui-tooling-preview to v1.10.1 (#439)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-01-16 19:11:22 +00:00
renovate[bot] 55150e58db fix(deps): update dependency androidx.compose.ui:ui-graphics to v1.10.1 (#435)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-01-16 15:43:05 +00:00
renovate[bot] a02cb73e75 fix(deps): update dependency androidx.compose.ui:ui-test-manifest to v1.10.1 (#437)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-01-16 11:37:23 +00:00
renovate[bot] 7801f06252 fix(deps): update dependency androidx.compose.ui:ui to v1.10.1 (#434)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-01-16 06:04:04 +00:00
renovate[bot] ce3234f0c2 fix(deps): update dependency androidx.compose.material3:material3 to v1.5.0-alpha12 (#433)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-01-16 02:32:34 +00:00
renovate[bot] 42422b4a48 fix(deps): update dependency androidx.compose.material:material to v1.10.1 (#432)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-01-15 21:11:45 +00:00
renovate[bot] 54ffe54d73 fix(deps): update dependency androidx.compose.animation:animation to v1.10.1 (#430)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-01-15 18:51:06 +00:00
renovate[bot] 14651c1cc4 fix(deps): update dependency androidx.compose.ui:ui-test-junit4 to v1.10.1 (#436)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-01-15 12:46:37 +00:00
renovate[bot] f428647995 fix(deps): update dependency androidx.compose.foundation:foundation to v1.10.1 (#431)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-01-15 02:13:36 +00:00
Anthonyy232 be482fefbc fix: fix adaptive icons 2026-01-08 20:48:54 -08:00
Anthonyy232 0f1db0fb22 fix: onboarding screens invalid layout and reseting 2025-12-31 18:00:55 -08:00
Anthonyy232 a292bddbe8 fix: notification icons 2025-12-26 23:18:57 -08:00
Anthonyy232 2aa4e6960d fix: fix app icon bad format 2025-12-26 23:00:04 -08:00
Anthonyy232 c947b6fc6f fix: various bugs 2025-12-26 22:19:56 -08:00
Anthonyy232 0385acd539 fix: hide select album row if neither home or lock is enabled 2025-12-25 20:35:55 -08:00
Anthonyy232 c92f7e5e03 fix: added write permission for making release 2025-12-21 22:17:13 -08:00
Anthonyy232 c49ddf85cb fix(actions): fixed cached test not working 2025-12-21 21:31:54 -08:00
Anthonyy232 da02d23032 Merge branch 'master' of https://github.com/Anthonyy232/Paperize 2025-12-21 21:17:27 -08:00
Anthonyy232 f977687b27 chore: update readme and docs 2025-12-21 21:16:53 -08:00
renovate[bot] 31077727e1 chore(deps): update github artifact actions 2025-12-21 21:00:29 -08:00
renovate[bot] 6a783a701c chore(deps): update actions/checkout action to v6 2025-12-21 21:00:27 -08:00
Anthonyy232 8a5db6b89e feat(test): added unit testing and added to cicd 2025-12-21 20:55:46 -08:00
renovate[bot] c46006858f Update dependency com.google.devtools.ksp to v2.3.4 2025-12-21 18:33:09 -08:00
renovate[bot] 0e5366a81a Update actions/checkout action to v6 2025-12-21 18:32:43 -08:00
Anthonyy232 318ba07ed5 continue rewrite 2025-12-21 18:30:23 -08:00
Anthonyy232 391bbb6bc0 add live wallpaper 2025-12-21 18:30:23 -08:00
Anthonyy232 572252b187 fix some bugs 2025-12-21 18:30:23 -08:00
Anthonyy232andClaude 894b86cd14 Clear album selections when toggling home or lock screens
When user changes which screens are enabled (homeEnabled/lockEnabled),
clear all album selections to ensure clean state:

**Scenarios where albums are cleared:**
- Lock only → Both screens enabled
- Home only → Both screens enabled
- Both screens → Lock only
- Both screens → Home only
- Lock only → Home only (both toggles change)

**Why this is needed:**
- Album requirements change when switching between single/dual screen modes
- Both screens enabled requires TWO albums selected
- Single screen requires ONE album selected
- Clearing prevents invalid state where old selections don't match new requirements

**Implementation:**
- Detect when homeEnabled or lockEnabled changes in updateScheduleSettings()
- If screen toggles changed, clear both homeAlbumId and lockAlbumId
- Apply validation to cleared settings
- Auto-toggle logic will disable changer (no albums selected)
- User must select appropriate albums for new screen configuration

**User flow:**
1. User toggles screen on/off
2. Albums automatically cleared
3. Changer disabled (no albums)
4. User selects new albums
5. Changer re-enabled with correct albums

This ensures users always have the correct album setup for their
chosen screen configuration.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-21 18:30:23 -08:00
Anthonyy232andClaude 1006902d07 Add check to prevent unnecessary rescheduling on app startup
Prevent redundant WorkManager job rescheduling when app starts:

**Problem:**
- Every time app starts, wallpaper change workers were being rescheduled
- Same with album refresh worker
- This caused unnecessary database writes and WorkManager operations
- Even when jobs were already correctly scheduled

**Solution:**
Added `onlyIfNotScheduled` parameter throughout the scheduling chain:

1. **WallpaperScheduler:**
   - Added `isWorkScheduled()` and `isAlbumRefreshScheduled()` helpers
   - Check WorkInfo state (ENQUEUED or RUNNING) before scheduling
   - Skip scheduling if work already exists and `onlyIfNotScheduled = true`

2. **HomeViewModel:**
   - Added `onlyIfNotScheduled` parameter to `toggleWallpaperChanger()`
   - Added `onlyIfNotScheduled` parameter to `scheduleAlarms()`
   - Skip immediate wallpaper change when checking if scheduled
   - Propagate parameter through scheduling chain

3. **BootReceiver:**
   - Use `onlyIfNotScheduled = true` on device boot
   - Prevents rescheduling if jobs survived device restart

4. **HomeScreen:**
   - Auto-toggle uses `onlyIfNotScheduled = true`
   - Prevents rescheduling on every app startup
   - User actions still always reschedule (parameter defaults to false)

**Behavior:**
- App startup: Only schedule if not already scheduled
- Device boot: Only schedule if not already scheduled
- User actions (album selection, settings changes): Always reschedule
- Album refresh: Only schedule if not already scheduled

This improves app startup performance and reduces unnecessary
WorkManager operations while maintaining correct scheduling behavior.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-21 18:30:23 -08:00
Anthonyy232andClaude 49fecf56af Fix queue handling when running out of wallpapers during validation
Improve robustness of wallpaper queue management:

**Problem:**
When the queue runs out DURING the validation loop (all remaining
wallpapers are invalid), the code returned an error without trying
to rebuild the queue. This could happen when:
- Album has both valid and invalid wallpapers
- Queue contains only invalid wallpapers after valid ones are used
- Validation loop dequeues all invalid wallpapers
- Queue becomes empty but is never rebuilt

**Solution:**
When getAndDequeueWallpaper returns null during validation loop:
1. Try rebuilding the queue (up to 2 attempts)
2. Continue validation loop to get wallpaper from rebuilt queue
3. Only return "no wallpapers" error after 2 rebuild attempts fail

**Edge Cases Handled:**
- Queue runs out due to invalid wallpapers being removed: rebuild and retry
- Album truly has no valid wallpapers: error after 2 rebuild attempts
- Shuffle mode: queue rebuilt with correct shuffle order
- Sequential mode: queue rebuilt with correct display order

This ensures the wallpaper changer continues working even when
encountering invalid wallpapers, and properly cycles through the
album whether shuffle is enabled or not.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-21 18:30:23 -08:00
Anthonyy232andClaude ca59cd8155 Hide toggle effect descriptions when enabled in non-individual scheduling
When wallpaper effects are toggled on and individual scheduling is off,
hide the description text for a cleaner UI:
- Grayscale effect
- Adaptive brightness
- Shuffle

Changes:
- Make SettingSwitch description parameter nullable
- Conditionally hide description when:
  - Effect is enabled (checked = true)
  - AND individual scheduling is OFF (separateSchedules = false)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-21 18:30:23 -08:00
Anthonyy232andClaude 9820581723 Fix wallpaper scheduling and effects handling bugs
Multiple fixes for scheduling logic and UI behavior:

**Scheduling Fixes:**
- Add required albums validation before scheduling WorkManager jobs
- Only schedule when all required albums are selected based on enabled screens
- Prevent scheduling with incomplete album selection (both screens enabled requires both albums)
- Add hasRequiredAlbums check in HomeViewModel, WallpaperScreen, and BootReceiver

**Race Condition Fixes:**
- Fix toggleWallpaperChanger race condition with atomic updateEnableChanger()
- Prevent phantom album selections by using atomic DataStore updates
- Fix startup race condition - only cleanup stale album IDs after albums load

**Display Settings:**
- Separate scheduling changes from display changes (ScheduleSettings.kt)
- Add hasSchedulingChanges() - intervals, screen enable/disable, separate schedules
- Add hasDisplayChanges() - scaling, effects, adaptive brightness
- Reapply wallpaper immediately when display settings change (no reschedule needed)
- Prevent unnecessary WorkManager rescheduling for display-only changes

**Effect Sliders:**
- Fix effect sliders to respect separateSchedules setting
- Show synchronized slider when individual scheduling OFF
- Show separate sliders when individual scheduling ON
- Applies to brightness/darken, blur, and vignette sliders

**AlbumRefreshWorker:**
- Fix duplicate detection to check both direct and folder wallpapers
- Fix failure counting (increment failedCount on addWallpaper errors)
- Prevent false error logs and database constraint violations

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-21 18:30:23 -08:00
Anthonyy232 9079306f8f Rewrite initial commit 2025-12-21 18:30:23 -08:00
Gian 3b2f739254 Fix switch position on long text 2025-11-13 17:38:18 -08:00
Gian c6c841f7c0 Unify switch components into two generic implementations 2025-11-13 17:38:18 -08:00
Anthonyy232 66c3a4bb2e Bump version 2025-09-15 12:47:15 -07:00
Anthonyy232 1b317798a4 fix effects not applying to lock when singular
https://github.com/Anthonyy232/Paperize/issues/393
2025-09-15 12:46:18 -07:00
Anthonyy232 95feb975ea Bump version code 2025-09-13 16:06:10 -07:00
renovate[bot] bf1d2d4793 Update dependency com.google.devtools.ksp to v2.2.20-2.0.3 2025-09-13 14:29:01 -07:00
Anthonyy232 1f66b1c616 Updated dependencies and localization 2025-09-13 14:08:17 -07:00
renovate[bot] 8cee52fcd6 Update dependency androidx.compose.ui:ui-test-manifest to v1.9.1 2025-09-13 10:56:58 -07:00
renovate[bot] 44692cde8e Update dependency androidx.compose.ui:ui to v1.9.1 2025-09-13 10:55:00 -07:00
renovate[bot] 23359ee714 Update dependency androidx.compose.material3:material3 to v1.4.0-rc01 2025-09-13 10:54:50 -07:00
renovate[bot] 25004356b5 Update dependency androidx.compose.material:material to v1.9.1 2025-09-13 10:54:44 -07:00
renovate[bot] 7e4e5ff452 Update dependency androidx.compose.foundation:foundation to v1.9.1 2025-09-13 10:54:36 -07:00
renovate[bot] d63c1005b7 Update dependency androidx.compose.animation:animation to v1.9.1 2025-09-13 10:54:15 -07:00
renovate[bot] bf71bca11a Update kotlin monorepo to v2.2.20 2025-09-13 10:54:02 -07:00
Anthonyy232 c35b87a1da Updated localization 2025-09-13 10:53:42 -07:00
malteish afa520a68a enable large collections through larger cursor window 2025-09-12 11:43:08 -07:00
Anthonyy232 b67734b8e1 Fix file picker not limiting user for large image imports 2025-09-12 11:42:30 -07:00
Anthonyy232 d124da717d Fix crash on launch during db changes 2025-09-12 11:21:22 -07:00
Anthonyy232 40417b99b1 fix crash on adding through image virtual directory
https://github.com/Anthonyy232/Paperize/issues/374
2025-09-12 11:18:48 -07:00
Anthony La ba7d29990c Merge pull request #352 from Anthonyy232/renovate/androidx.lifecycle-lifecycle-runtime-compose-2.x
Update dependency androidx.lifecycle:lifecycle-runtime-compose to v2.9.3
2025-08-28 11:31:36 -07:00
renovate[bot] b18c5bdb1e Update dependency androidx.lifecycle:lifecycle-runtime-compose to v2.9.3 2025-08-28 18:31:17 +00:00
Anthony La 1191872b3e Merge pull request #351 from Anthonyy232/renovate/androidx.compose.material3-material3-1.x
Update dependency androidx.compose.material3:material3 to v1.4.0-beta03
2025-08-28 11:30:59 -07:00
Anthony La ae5a533baf Merge pull request #350 from Anthonyy232/renovate/androidx.compose-compose-bom-2025.x
Update dependency androidx.compose:compose-bom to v2025.08.01
2025-08-28 11:30:51 -07:00
renovate[bot] 9cc7c0e26a Update dependency androidx.compose.material3:material3 to v1.4.0-beta03 2025-08-28 18:30:44 +00:00
renovate[bot] 7ca5e2bac4 Update dependency androidx.compose:compose-bom to v2025.08.01 2025-08-28 18:30:41 +00:00
Anthony La e064c31175 Merge pull request #353 from Anthonyy232/renovate/androidx.lifecycle-lifecycle-runtime-ktx-2.x
Update dependency androidx.lifecycle:lifecycle-runtime-ktx to v2.9.3
2025-08-28 11:30:36 -07:00
Anthony La 8959e239fe Merge pull request #354 from Anthonyy232/renovate/actions-checkout-5.x
Update actions/checkout action to v5
2025-08-28 11:30:28 -07:00
Anthony La 06c9566df4 Merge pull request #355 from Anthonyy232/renovate/actions-setup-java-5.x
Update actions/setup-java action to v5
2025-08-28 11:30:22 -07:00
Anthony La 108f5cd9c1 Merge pull request #356 from Anthonyy232/renovate/major-github-artifact-actions
Update actions/download-artifact action to v5
2025-08-28 11:30:14 -07:00
renovate[bot] 9b86b54ae1 Update actions/setup-java action to v5 2025-08-28 18:26:05 +00:00
renovate[bot] 40e0884ee7 Update actions/download-artifact action to v5 2025-08-28 18:26:02 +00:00
renovate[bot] e1fa4e7890 Update actions/checkout action to v5 2025-08-28 18:25:59 +00:00
renovate[bot] 4161b8817b Update dependency androidx.lifecycle:lifecycle-runtime-ktx to v2.9.3 2025-08-28 18:25:53 +00:00
Anthony La 4554190912 Refactor CI/CD pipeline by removing lint job 2025-08-28 11:24:57 -07:00
Anthony La b714ad8eb6 Change branch reference from 'main' to 'master' 2025-08-28 11:19:29 -07:00
Anthony La 6cd5c1eed3 Change default branch to 'main' and enhance artifact management 2025-08-28 11:19:14 -07:00
Anthony La 6784e2a2de Change CI/CD branch from 'main' to 'master' 2025-08-28 11:09:36 -07:00
Anthony La 7f69debe1d Update CI/CD workflow for Android release process 2025-08-28 11:01:37 -07:00
Anthonyy232 f8df7c2a6a Fix master branch naming 2025-08-28 10:54:04 -07:00
Anthonyy232 b3fb2b82f2 Update CI/CD 2025-08-28 10:53:11 -07:00
Anthony La 04d0c57cb0 Add CI workflow for Android release 2025-08-28 10:48:57 -07:00
Anthonyy232 27b0fe62c8 Bump version code 2025-08-28 10:38:50 -07:00
Anthonyy232 096beb22d7 Bump version to 3.1.2 2025-08-28 10:37:50 -07:00
Anthonyy232 21766a5dc6 Fix app losing permission after some time https://github.com/Anthonyy232/Paperize/issues/349 2025-08-28 10:36:29 -07:00
Anthonyy232 fd5e8b63b2 Revert AGP
https://github.com/Anthonyy232/Paperize/issues/310#issuecomment-3226685236
2025-08-26 22:31:49 -07:00
Anthonyy232 2f514e6464 Remove unused AAR dependency
https://github.com/Anthonyy232/Paperize/issues/310#issuecomment-3226539843
2025-08-26 19:45:54 -07:00
Anthonyy232 74d2c614fd Update version code 2025-08-26 18:31:55 -07:00
Anthonyy232 da0d8c45e6 Fixed bad decompressing of URi 2025-08-26 18:11:07 -07:00
Anthony La e87d8116a6 Merge pull request #344 from Anthonyy232/renovate/hilt
Update hilt to v2.57.1
2025-08-26 18:04:42 -07:00
renovate[bot] 8aaff066b3 Update hilt to v2.57.1 2025-08-27 01:04:32 +00:00
Anthony La 685c9d1981 Merge pull request #346 from Anthonyy232/renovate/actions-upload-pages-artifact-4.x
Update actions/upload-pages-artifact action to v4
2025-08-26 18:04:25 -07:00
Anthony La 81ae25035e Merge pull request #347 from OasisAkari/skip_non-interactive
add skip in non-interactive state setting
2025-08-26 18:04:07 -07:00
yzhh 530ff36a16 add skip in non-interactive state setting 2025-08-25 22:18:15 +08:00
renovate[bot] 9fd52e7bc4 Update actions/upload-pages-artifact action to v4 2025-08-22 17:58:36 +00:00
Anthonyy232 0c2ca68dcd Fixed last change time not updating from initial 2025-08-20 11:09:33 -07:00
Anthony La e7c92eae71 Merge pull request #338 from Anthonyy232/renovate/androidx.compose.ui-ui-tooling-preview-1.x
Update dependency androidx.compose.ui:ui-tooling-preview to v1.9.0
2025-08-19 16:55:26 -07:00
Anthony La 7b26e323ac Merge pull request #339 from Anthonyy232/renovate/androidx.core-core-ktx-1.x
Update dependency androidx.core:core-ktx to v1.17.0
2025-08-19 16:55:19 -07:00
Anthony La b0069e3bc9 Merge pull request #340 from Anthonyy232/renovate/actions-checkout-5.x
Update actions/checkout action to v5
2025-08-19 16:55:13 -07:00
Anthony La 8582bc903b Merge pull request #341 from Anthonyy232/renovate/gradle-9.x
Update dependency gradle to v9
2025-08-19 16:55:07 -07:00
Anthony La 8690284ac2 Merge pull request #342 from Anthonyy232/renovate/sh.calvin.reorderable-reorderable-3.x
Update dependency sh.calvin.reorderable:reorderable to v3
2025-08-19 16:55:02 -07:00
Anthonyy232 c9e485ac88 Fixed time drift issue when setting wallpaper https://github.com/Anthonyy232/Paperize/issues/343 2025-08-19 16:49:28 -07:00
renovate[bot] 9d577880e0 Update dependency sh.calvin.reorderable:reorderable to v3 2025-08-19 22:26:59 +00:00
renovate[bot] 09bacfb3e5 Update dependency gradle to v9 2025-08-19 22:26:56 +00:00
renovate[bot] 3fd9cec67d Update actions/checkout action to v5 2025-08-19 22:23:59 +00:00
renovate[bot] ac7a1e0cb0 Update dependency androidx.core:core-ktx to v1.17.0 2025-08-19 22:23:56 +00:00
renovate[bot] 53ba0a2347 Update dependency androidx.compose.ui:ui-tooling-preview to v1.9.0 2025-08-19 22:23:54 +00:00
Anthonyy232 83cc89e1b3 Updated gradle version 2025-08-19 15:22:58 -07:00
Anthony La 655c4a91e5 Merge pull request #336 from Anthonyy232/renovate/androidx.compose.ui-ui-test-manifest-1.x
Update dependency androidx.compose.ui:ui-test-manifest to v1.9.0
2025-08-18 09:32:18 -07:00
renovate[bot] 083f269605 Update dependency androidx.compose.ui:ui-test-manifest to v1.9.0 2025-08-18 16:32:08 +00:00
Anthony La 9880bac0c6 Merge pull request #309 from Anthonyy232/renovate/ksp-monorepo
Update dependency com.google.devtools.ksp to v2.2.10-2.0.2
2025-08-18 09:31:46 -07:00
Anthony La 0f87776d16 Merge pull request #337 from Anthonyy232/renovate/androidx.compose.ui-ui-tooling-1.x
Update dependency androidx.compose.ui:ui-tooling to v1.9.0
2025-08-18 09:31:37 -07:00
renovate[bot] ed291459d1 Update dependency com.google.devtools.ksp to v2.2.10-2.0.2 2025-08-18 16:31:29 +00:00
Anthony La bc1eb7f996 Merge pull request #334 from Anthonyy232/renovate/androidx.compose.ui-ui-graphics-1.x
Update dependency androidx.compose.ui:ui-graphics to v1.9.0
2025-08-18 09:31:22 -07:00
Anthony La 8366965a03 Merge pull request #330 from Anthonyy232/renovate/androidx.compose.animation-animation-1.x
Update dependency androidx.compose.animation:animation to v1.9.0
2025-08-18 09:31:08 -07:00
Anthony La 904f77191c Merge pull request #315 from Anthonyy232/renovate/com.github.skydoves-landscapist-glide-2.x
Update dependency com.github.skydoves:landscapist-glide to v2.5.2
2025-08-18 09:31:01 -07:00
renovate[bot] ec9f56cf1e Update dependency androidx.compose.ui:ui-tooling to v1.9.0 2025-08-18 16:30:49 +00:00
renovate[bot] 980527cdde Update dependency androidx.compose.ui:ui-graphics to v1.9.0 2025-08-18 16:30:42 +00:00
renovate[bot] efe794c63f Update dependency androidx.compose.animation:animation to v1.9.0 2025-08-18 16:30:38 +00:00
renovate[bot] 65a677ea91 Update dependency com.github.skydoves:landscapist-glide to v2.5.2 2025-08-18 16:30:29 +00:00
Anthony La dabf63fc58 Merge pull request #331 from Anthonyy232/renovate/androidx.compose.foundation-foundation-1.x
Update dependency androidx.compose.foundation:foundation to v1.9.0
2025-08-18 09:28:28 -07:00
Anthony La 1da95e09b5 Merge pull request #332 from Anthonyy232/renovate/androidx.compose.material-material-1.x
Update dependency androidx.compose.material:material to v1.9.0
2025-08-18 09:28:19 -07:00
Anthony La ad195a985e Merge pull request #333 from Anthonyy232/renovate/androidx.compose.ui-ui-1.x
Update dependency androidx.compose.ui:ui to v1.9.0
2025-08-18 09:28:11 -07:00
Anthony La 0e06584780 Merge pull request #335 from Anthonyy232/renovate/androidx.compose.ui-ui-test-junit4-1.x
Update dependency androidx.compose.ui:ui-test-junit4 to v1.9.0
2025-08-18 09:27:47 -07:00
Anthony La a6f44ecad5 Merge pull request #329 from Anthonyy232/renovate/androidx.compose-compose-bom-2025.x
Update dependency androidx.compose:compose-bom to v2025.08.00
2025-08-18 09:27:36 -07:00
Anthony La d527fa9a80 Merge pull request #320 from Anthonyy232/renovate/gradle-8.x
Update dependency gradle to v8.14.3
2025-08-18 09:26:52 -07:00
Anthony La ffe360ee80 Merge pull request #316 from Anthonyy232/renovate/androidx.compose.material3-material3-1.x
Update dependency androidx.compose.material3:material3 to v1.4.0-beta02
2025-08-18 09:26:25 -07:00
renovate[bot] 8fd9c9b80e Update dependency androidx.compose.material3:material3 to v1.4.0-beta02 2025-08-18 16:26:17 +00:00
Anthony La d77f2fe8df Merge pull request #308 from Anthonyy232/renovate/kotlin-monorepo
Update kotlin monorepo to v2.2.10
2025-08-18 09:25:51 -07:00
renovate[bot] 86c44825d9 Update dependency androidx.compose.ui:ui-test-junit4 to v1.9.0 2025-08-15 18:37:57 +00:00
renovate[bot] b5d8bb5548 Update dependency androidx.compose.ui:ui to v1.9.0 2025-08-15 18:37:51 +00:00
renovate[bot] 9000be1951 Update dependency androidx.compose.material:material to v1.9.0 2025-08-15 18:37:48 +00:00
renovate[bot] 38ba5154f9 Update dependency androidx.compose.foundation:foundation to v1.9.0 2025-08-15 18:37:45 +00:00
renovate[bot] 9f670031b1 Update dependency androidx.compose:compose-bom to v2025.08.00 2025-08-15 18:37:40 +00:00
renovate[bot] c0dd7baeaa Update kotlin monorepo to v2.2.10 2025-08-15 18:37:37 +00:00
renovate[bot] 1c96dcfc4a Update dependency gradle to v8.14.3 2025-08-15 18:37:34 +00:00
Anthonyy232 2a3821e1e7 Improved robustness of image picker for album view screen 2025-08-15 09:40:03 -07:00
Anthonyy232 8b61b1d719 Improved robustness of image picker 2025-08-15 09:38:46 -07:00
Anthonyy232 431df5c334 Fixed next and last time label swapped based on temporal locality https://github.com/Anthonyy232/Paperize/issues/327 2025-08-15 09:35:46 -07:00
Anthonyy232 2b49a01eb4 Added setting to prevent changing wallpaper during landscape mode https://github.com/Anthonyy232/Paperize/issues/328 2025-08-14 23:33:40 -07:00
Anthonyy232 3bc438a06d Migrated blur to rendereffect and min version to 31 2025-08-13 19:50:49 -07:00
Anthonyy232 57d6b7dc8e Fixed broken blur effect using home percentage for all cases https://github.com/Anthonyy232/Paperize/issues/322 2025-08-12 17:05:12 -07:00
Anthonyy232 5d87257516 Fixed scanning for new wallpapers/folders https://github.com/Anthonyy232/Paperize/issues/326 2025-08-11 11:28:29 -07:00
Anthonyy232 cb9ab7d1af Fixed crash due to interpreting string as int without cast https://github.com/Anthonyy232/Paperize/issues/323 2025-08-07 11:28:23 -07:00
Anthony La 598f00c536 Merge pull request #305 from Anthonyy232/renovate/gradle-8.x
Update dependency gradle to v8.14.2
2025-06-24 10:39:51 -07:00
renovate[bot] 426dbf1457 Update dependency gradle to v8.14.2 2025-06-24 17:38:34 +00:00
Anthony La ba1b139f40 Merge pull request #304 from Anthonyy232/renovate/ksp-monorepo
Update dependency com.google.devtools.ksp to v2.1.21-2.0.2
2025-06-24 10:31:17 -07:00
renovate[bot] 40dc4b788d Update dependency com.google.devtools.ksp to v2.1.21-2.0.2 2025-06-24 17:30:04 +00:00
Anthony La 69d5ec6477 Updated dependencies 2025-06-24 10:29:13 -07:00
Anthony La 96cb5538da Updated localization 2025-06-24 10:07:02 -07:00
Anthony La c3101ea5f6 Update in sample calculation for None scaling 2025-06-24 10:06:21 -07:00
Anthony La 493e6559df Major refactor and localization update 2025-06-07 14:02:49 -07:00
Anthony La 8945002652 Updated WallpaperManager usage 2025-05-15 17:00:51 -07:00
Anthony La 8f30f3558a Update renderscript dependency and refactored wallpaper alarm code 2025-05-15 15:30:19 -07:00
Anthony La 15ba07198d Merge pull request #288 from Anthonyy232/renovate/ksp-monorepo
Update dependency com.google.devtools.ksp to v2.1.21-2.0.1
2025-05-14 18:21:18 -07:00
Anthony La 39fff2bfc9 Merge pull request #267 from Anthonyy232/renovate/com.google.dagger-hilt-android-2.x
Update dependency com.google.dagger:hilt-android to v2.56.2
2025-05-14 18:21:06 -07:00
Anthony La 8339c2d86b Merge pull request #287 from Anthonyy232/renovate/com.google.code.gson-gson-2.x
Update dependency com.google.code.gson:gson to v2.13.1
2025-05-14 18:20:54 -07:00
renovate[bot] 29ca2d1c50 Update dependency com.google.devtools.ksp to v2.1.21-2.0.1 2025-05-15 01:20:40 +00:00
renovate[bot] 8b2cd301c9 Update dependency com.google.dagger:hilt-android to v2.56.2 2025-05-15 01:20:38 +00:00
renovate[bot] 5240320d99 Update dependency com.google.code.gson:gson to v2.13.1 2025-05-15 01:20:34 +00:00
Anthony La 25205d579b Merge pull request #268 from Anthonyy232/renovate/com.google.dagger-hilt-android-compiler-2.x
Update dependency com.google.dagger:hilt-android-compiler to v2.56.2
2025-05-14 18:19:26 -07:00
Anthony La 32c904f504 Merge pull request #285 from Anthonyy232/renovate/com.github.skydoves-landscapist-glide-2.x
Update dependency com.github.skydoves:landscapist-glide to v2.4.8
2025-05-14 18:19:15 -07:00
Anthony La 9e3a62a283 Merge pull request #286 from Anthonyy232/renovate/com.google.accompanist-accompanist-permissions-0.x
Update dependency com.google.accompanist:accompanist-permissions to v0.37.3
2025-05-14 18:19:07 -07:00
Anthony La 050e172949 Merge pull request #266 from Anthonyy232/renovate/hilt
Update dependency com.google.dagger.hilt.android to v2.56.2
2025-05-14 18:18:55 -07:00
renovate[bot] b231fe8f4e Update dependency com.google.dagger.hilt.android to v2.56.2 2025-05-15 00:30:23 +00:00
renovate[bot] 14c2fd8aed Update dependency com.google.dagger:hilt-android-compiler to v2.56.2 2025-05-15 00:30:20 +00:00
renovate[bot] 27ac32648c Update dependency com.google.accompanist:accompanist-permissions to v0.37.3 2025-05-15 00:30:13 +00:00
renovate[bot] f6c3a4b34a Update dependency com.github.skydoves:landscapist-glide to v2.4.8 2025-05-15 00:30:08 +00:00
Anthony La fcf0513356 Updated dependencies 2025-05-14 17:29:18 -07:00
Anthony La 26f51acc0c Merge pull request #277 from Nikster3k/master
Add scrollable Column to AlbumBottomSheet
2025-04-28 19:14:37 -07:00
Nikster3k 9a36ad35e4 Fix album selection taking up too much space 2025-04-27 17:15:20 +00:00
Anthony La 4771eaaa7e Merge pull request #278 from Anthonyy232/docFileCompat_test
Improve reliability of alarm manager
2025-04-25 23:30:07 -07:00
Anthony La 170a642858 Fix alarm manager handler crash 2025-04-25 23:29:29 -07:00
Nikster3k 2dd4fb9e58 Add scrollable Column to AlbumBottomSheet
When you had more than 10 albums they would be hidden
2025-04-25 15:01:10 +00:00
Anthony La 77c95ed14a Fix test code 2025-04-14 13:43:38 -07:00
Anthony La 75b3467f89 Remove unused imports 2025-04-14 13:41:22 -07:00
Anthony La 7c77f4a75e Merge pull request #204 from Anthonyy232/renovate/gradle-8.x
Update dependency gradle to v8.14-rc-1
2025-04-12 00:51:24 -07:00
Anthony La a36403ee14 Merge pull request #257 from Anthonyy232/renovate/ksp-monorepo
Update dependency com.google.devtools.ksp to v2.1.20-2.0.0
2025-04-12 00:51:13 -07:00
Anthony La 31c99f3e6e Remove unused imports 2025-04-12 00:31:56 -07:00
Anthony La fdd85b2df3 Removed unused marker 2025-04-12 00:31:00 -07:00
Anthony La 1e971d4ec3 Implemented toggle for wallpaper refresh 2025-04-12 00:20:17 -07:00
renovate[bot] 1274349fc9 Update dependency gradle to v8.14-rc-1 2025-04-12 06:10:59 +00:00
renovate[bot] f2065c3ec8 Update dependency com.google.devtools.ksp to v2.1.20-2.0.0 2025-04-12 06:07:51 +00:00
Anthony La bb34c1e02f Updated dependencies and reset database and app version 2025-04-11 23:07:10 -07:00
Anthony La 41ac2482d8 Update zoomable dependency 2025-04-06 23:13:15 -07:00
Anthony La 9baacea029 Fixed a bug where using only folders would cause album to self-delete 2025-04-05 01:07:21 -07:00
Anthony La 1d87208dca Localization fix 2025-04-02 22:20:13 -07:00
Anthony La af315b7775 Localization fix 2025-04-02 22:15:36 -07:00
Anthony La 212d21761b Localization update 2025-04-02 22:04:20 -07:00
Anthony La eb48200149 Implemented wallpaper changer widget (1x1 icon) 2025-04-01 13:46:23 -07:00
Anthony La 814db9020a Fix wallpaper changing time not accurate 2025-04-01 12:04:00 -07:00
Anthony La 893a729093 Fix wallpaper changing time not accurate 2025-04-01 12:03:46 -07:00
Anthony La 43b06d11eb Fix wallpaper color banding 2025-03-31 22:52:21 -07:00
Anthony La 3e9e8ca299 Fixed service not starting 2025-03-07 18:01:56 -08:00
Anthony La 0a6ce5bf07 Improved memory usage 2025-02-16 14:07:55 -08:00
Anthony La 813eb7fb32 Refactored wallpaper service 2025-02-16 11:45:11 -08:00
Anthony La e30056eb5d Implement non-shuffle setting 2025-01-25 15:32:15 -08:00
Anthony La 7f039fa2b4 Refactored app flow and album logic 2025-01-24 12:07:59 -08:00
Anthony La 9be3a9c6d3 Refactored app flow and album logic 2025-01-24 12:07:59 -08:00
Anthony La a8989b0810 Merge pull request #238 from DevBhalavat/master
Update CurrentAndNextChange.kt
2025-01-22 18:03:34 -08:00
bhalavatdev c9f27e3157 Update CurrentAndNextChange.kt 2025-01-03 00:03:53 +05:30
Anthony La 26f1e17b7c Refactored album view and album logic 2024-11-14 22:18:23 -08:00
Anthony La 47fa7563c0 Refactored folder view 2024-11-13 22:06:59 -08:00
Anthony La f2fc197df7 Added sorting 2024-11-13 21:30:14 -08:00
Anthony La 647ebea95b Fixed scoping for service 2024-11-04 11:06:43 -08:00
Anthony La eebc4d4ee4 Fixed slow updates when wallpaper changing 2024-11-04 11:02:11 -08:00
Anthony La e1ff89d3d9 chore/Refactor WallpaperScreenViewModel.kt and selected album for flow usage 2024-11-04 10:48:13 -08:00
Anthony La 11d72a2336 chore/Refactor usage of flow for settings viewmodel 2024-11-04 10:34:53 -08:00
Anthony La 68e6544da8 chore/Refactor code 2024-11-03 16:53:14 -08:00
Anthony La a26f7e30a4 Fixed staggered alarms 2024-11-03 16:53:14 -08:00
Anthony La b989a47b9e Fixed staggered alarms 2024-11-03 16:53:14 -08:00
Anthony La a7f98989b3 Merge pull request #220 from Anthonyy232/renovate/composebom
Update dependency androidx.compose:compose-bom to v2024.10.01
2024-10-31 12:22:16 -07:00
renovate[bot] 4aaded50ac Update dependency androidx.compose:compose-bom to v2024.10.01 2024-10-31 19:04:20 +00:00
Anthony La 3089841a05 Merge pull request #212 from Anthonyy232/renovate/animation
Update dependency androidx.compose.animation:animation to v1.7.5
2024-10-31 12:01:30 -07:00
Anthony La eeabdd24fd Merge pull request #213 from Anthonyy232/renovate/foundation
Update dependency androidx.compose.foundation:foundation to v1.7.5
2024-10-31 12:01:23 -07:00
Anthony La 8c82ed7d8c Merge pull request #214 from Anthonyy232/renovate/material3
Update dependency androidx.compose.material3:material3 to v1.3.1
2024-10-31 12:01:16 -07:00
renovate[bot] 5fd289afb5 Update dependency androidx.compose.material3:material3 to v1.3.1 2024-10-31 19:01:00 +00:00
renovate[bot] 8d0213c7bb Update dependency androidx.compose.foundation:foundation to v1.7.5 2024-10-31 19:00:57 +00:00
renovate[bot] 7e8b83aefe Update dependency androidx.compose.animation:animation to v1.7.5 2024-10-31 19:00:54 +00:00
Anthony La 136432b97b Merge pull request #215 from Anthonyy232/renovate/workruntimektx
Update dependency androidx.work:work-runtime-ktx to v2.10.0
2024-10-31 11:58:24 -07:00
renovate[bot] cbcf71da8a Update dependency androidx.work:work-runtime-ktx to v2.10.0 2024-10-31 18:58:18 +00:00
Anthony La 9bc58aa9fe Merge pull request #216 from Anthonyy232/renovate/lifecycleruntimektx
Update lifecycleRuntimeKtx to v2.8.7
2024-10-31 11:58:17 -07:00
Anthony La 74e3fd8878 Merge pull request #217 from Anthonyy232/renovate/material
Update material to v1.7.5
2024-10-31 11:58:02 -07:00
Anthony La c857f4a1e7 Merge pull request #218 from Anthonyy232/renovate/ui
Update ui to v1.7.5
2024-10-31 11:57:53 -07:00
Anthony La fb853086e6 Merge pull request #219 from Anthonyy232/renovate/corektx
Update dependency androidx.core:core-ktx to v1.15.0
2024-10-31 11:57:47 -07:00
renovate[bot] 54f4130bab Update dependency androidx.core:core-ktx to v1.15.0 2024-10-31 04:42:07 +00:00
renovate[bot] 2acc11875b Update ui to v1.7.5 2024-10-31 04:42:03 +00:00
renovate[bot] 0c1b341ce9 Update material to v1.7.5 2024-10-31 01:32:48 +00:00
renovate[bot] b4d89a54e3 Update lifecycleRuntimeKtx to v2.8.7 2024-10-31 01:32:45 +00:00
Anthony La c7d3ae137f Merge pull request #211 from Anthonyy232/renovate/lottiecompose
Update dependency com.airbnb.android:lottie-compose to v6.6.0
2024-10-28 00:39:51 -07:00
renovate[bot] e71ae4fda1 Update dependency com.airbnb.android:lottie-compose to v6.6.0 2024-10-27 21:52:59 +00:00
Anthony La 8c111ffaf2 Merge pull request #208 from Anthonyy232/renovate/ksp
Update dependency com.google.devtools.ksp to v2.0.21-1.0.26
2024-10-24 13:04:06 -07:00
Anthony La 238c7b512a Merge pull request #210 from Anthonyy232/renovate/workruntimektx
Update dependency androidx.work:work-runtime-ktx to v2.10.0-rc01
2024-10-24 13:03:57 -07:00
renovate[bot] 68e5be5214 Update dependency androidx.work:work-runtime-ktx to v2.10.0-rc01 2024-10-24 18:02:57 +00:00
renovate[bot] b417da22a2 Update dependency com.google.devtools.ksp to v2.0.21-1.0.26 2024-10-23 21:05:36 +00:00
Anthony La 3758363dd3 Downgraded Gradle to 8.10
Upgraded AGP to 8.7.1
Updated dependencies
2024-10-17 22:04:13 -07:00
Anthony La b7587e419b Downgraded AGP to 8.6.0 2024-10-14 10:50:16 -07:00
Anthony La 4decb78017 Revert baseline profiles due to reproducible build error 2024-10-14 01:09:57 -07:00
Anthony La 129e0c36fa Merge pull request #193 from Anthonyy232/renovate/landscapistglide
Update dependency com.github.skydoves:landscapist-glide to v2.4.1
2024-10-13 12:29:58 -07:00
renovate[bot] a784ff2cd8 Update dependency com.github.skydoves:landscapist-glide to v2.4.1 2024-10-13 19:26:51 +00:00
Anthony La 52badae681 Updated version code 2024-10-13 12:26:25 -07:00
Anthony La 2bfd46d5f5 Updated baseline profile dependencies 2024-10-13 01:40:51 -07:00
Anthony La 10240aaa4e Remove duplicate line 2024-10-13 01:34:52 -07:00
Anthony La 4855d59e99 Revert NDK version upgrade 2024-10-13 01:27:28 -07:00
Anthony La 59594878ab Downgraded NDK version to LTS 2024-10-12 01:27:29 -07:00
Anthony La 7fc552ab67 Updated apk naming 2024-10-12 00:47:15 -07:00
Anthony La 5197800b55 Updated apk naming 2024-10-11 11:59:18 -07:00
Anthony La 6fe29dfe53 Updated apk naming 2024-10-11 11:58:59 -07:00
Anthony La ea84410eb6 Migrated to libs.versions.toml 2024-10-11 11:53:38 -07:00
Anthony La 0a8a52ea3c Merge pull request #189 from Anthonyy232/renovate/androidx.baselineprofile-1.x
Update plugin androidx.baselineprofile to v1.3.2
2024-10-11 10:22:35 -07:00
Anthony La d115339a99 Merge pull request #191 from Anthonyy232/renovate/com.google.devtools.ksp-2.x
Update plugin com.google.devtools.ksp to v2.0.21-1.0.25
2024-10-11 10:22:28 -07:00
Anthony La 0c01f0dba2 Merge pull request #188 from Anthonyy232/renovate/kotlin-monorepo
Update kotlin monorepo to v2.0.21
2024-10-11 10:22:21 -07:00
Anthony La 7b35b2eb80 Updated version code 2024-10-11 10:21:50 -07:00
renovate[bot] 3508205328 Update plugin com.google.devtools.ksp to v2.0.21-1.0.25 2024-10-11 06:59:26 +00:00
renovate[bot] 0c7ec55414 Update plugin androidx.baselineprofile to v1.3.2 2024-10-11 03:05:00 +00:00
renovate[bot] 8cf43373c8 Update kotlin monorepo to v2.0.21 2024-10-11 03:04:56 +00:00
Anthony La e14e402c2f Added baseline profile for app and UI tests 2024-10-10 20:04:18 -07:00
Anthony La 84e93a652b Changed refresh alarm to be inexact to improve battery 2024-10-09 22:13:32 -07:00
Anthony La 23a9f10939 Updated README.md 2024-10-08 23:16:24 -07:00
Anthony La 8c485c6157 Updated localization 2024-10-08 22:59:23 -07:00
Anthony La 618e896393 Added ability to change starting time
Added settings item for notification permission access
Fixed UI elements being out of frame in certain languages
2024-10-08 22:36:19 -07:00
Anthony La 18ca6283ee Added grayscale filter 2024-10-02 19:30:57 -07:00
Anthony La 9b7f9c9217 Update README.md 2024-10-02 18:16:01 -07:00
Anthony La 7f32f76da9 Refactored collapsable top bar for settings page
Updated permission to USE_EXACT_ALARM
Updated dependencies
2024-10-02 18:14:26 -07:00
Anthony La 9a31467584 Merge pull request #185 from Anthonyy232/renovate/androidx.compose.ui-ui-1.x
Update dependency androidx.compose.ui:ui to v1.7.3
2024-10-02 17:37:51 -07:00
renovate[bot] 23884b53a7 Update dependency androidx.compose.ui:ui to v1.7.3 2024-10-03 00:37:40 +00:00
Anthony La 497860369c Merge pull request #186 from Anthonyy232/renovate/androidx.compose.ui-ui-graphics-1.x
Update dependency androidx.compose.ui:ui-graphics to v1.7.3
2024-10-02 17:37:02 -07:00
Anthony La 6800830280 Merge pull request #181 from Anthonyy232/renovate/androidx.compose.animation-animation-1.x
Update dependency androidx.compose.animation:animation to v1.7.3
2024-10-02 17:36:49 -07:00
renovate[bot] 6111913de4 Update dependency androidx.compose.ui:ui-graphics to v1.7.3 2024-10-03 00:36:44 +00:00
renovate[bot] 5c9994940d Update dependency androidx.compose.animation:animation to v1.7.3 2024-10-03 00:36:35 +00:00
Anthony La b399dae19d Merge pull request #182 from Anthonyy232/renovate/androidx.compose.foundation-foundation-1.x
Update dependency androidx.compose.foundation:foundation to v1.7.3
2024-10-02 17:36:29 -07:00
Anthony La f2921a8069 Merge pull request #183 from Anthonyy232/renovate/androidx.compose.material-material-1.x
Update dependency androidx.compose.material:material to v1.7.3
2024-10-02 17:36:20 -07:00
Anthony La 344e5b6e8c Merge pull request #184 from Anthonyy232/renovate/androidx.compose.material-material-icons-extended-1.x
Update dependency androidx.compose.material:material-icons-extended to v1.7.3
2024-10-02 17:36:10 -07:00
renovate[bot] efbecd2a56 Update dependency androidx.compose.material:material-icons-extended to v1.7.3 2024-10-02 21:04:48 +00:00
renovate[bot] 650b12460a Update dependency androidx.compose.material:material to v1.7.3 2024-10-02 21:04:44 +00:00
renovate[bot] cb3f19a5d0 Update dependency androidx.compose.foundation:foundation to v1.7.3 2024-10-02 19:55:31 +00:00
Anthony La 5b6768723d Merge pull request #178 from Anthonyy232/renovate/com.android.library-8.x
Update plugin com.android.library to v8.7.0
2024-10-01 13:36:42 -07:00
renovate[bot] 326dda6662 Update plugin com.android.library to v8.7.0 2024-10-01 20:36:23 +00:00
Anthony La f73939ed2c Merge pull request #177 from Anthonyy232/renovate/com.android.application-8.x
Update plugin com.android.application to v8.7.0
2024-10-01 13:36:00 -07:00
renovate[bot] 0684b03b5e Update plugin com.android.application to v8.7.0 2024-10-01 19:46:43 +00:00
Anthony La 1127ff86d9 Merge pull request #175 from Anthonyy232/renovate/com.github.skydoves-landscapist-glide-2.x
Update dependency com.github.skydoves:landscapist-glide to v2.4.0
2024-09-26 10:35:30 -07:00
Anthony La 4e8160496b Merge pull request #174 from Anthonyy232/renovate/gradle-8.x
Update dependency gradle to v8.10.2
2024-09-26 10:35:21 -07:00
renovate[bot] e18cb0c75c Update dependency com.github.skydoves:landscapist-glide to v2.4.0 2024-09-25 17:30:22 +00:00
renovate[bot] d11d7a1b9b Update dependency gradle to v8.10.2 2024-09-25 17:30:19 +00:00
Anthony La aa3ce3bbd5 Added support for Tasker event trigger when wallpaper changes 2024-09-25 10:27:19 -07:00
Anthony La 1c7ae9771a Merge pull request #171 from Anthonyy232/renovate/androidx.work-work-runtime-ktx-2.x
Update dependency androidx.work:work-runtime-ktx to v2.10.0-alpha04
2024-09-21 10:54:12 -07:00
Anthony La f1c6f3e36f Merge pull request #172 from Anthonyy232/renovate/org.jetbrains.kotlinx-kotlinx-serialization-json-1.x
Update dependency org.jetbrains.kotlinx:kotlinx-serialization-json to v1.7.3
2024-09-21 10:54:00 -07:00
renovate[bot] a04da0801a Update dependency org.jetbrains.kotlinx:kotlinx-serialization-json to v1.7.3 2024-09-21 00:57:21 +00:00
renovate[bot] 9ef38cb086 Update dependency androidx.work:work-runtime-ktx to v2.10.0-alpha04 2024-09-21 00:57:18 +00:00
Anthony La 3fe29db05b Merge pull request #169 from Anthonyy232/renovate/androidx.lifecycle-lifecycle-runtime-ktx-2.x
Update dependency androidx.lifecycle:lifecycle-runtime-ktx to v2.8.6
2024-09-20 17:56:59 -07:00
Anthony La 09626a9226 Merge pull request #170 from Anthonyy232/renovate/androidx.navigation-navigation-compose-2.x
Update dependency androidx.navigation:navigation-compose to v2.8.1
2024-09-20 17:56:54 -07:00
renovate[bot] e822b18624 Update dependency androidx.navigation:navigation-compose to v2.8.1 2024-09-20 22:22:35 +00:00
renovate[bot] 5bb7ba9399 Update dependency androidx.lifecycle:lifecycle-runtime-ktx to v2.8.6 2024-09-20 22:22:31 +00:00
Anthony La c794ea0b60 Merge pull request #167 from Anthonyy232/renovate/androidx.compose-compose-bom-2024.x
Update dependency androidx.compose:compose-bom to v2024.09.02
2024-09-20 12:10:38 -07:00
Anthony La 4a72f8dbc0 Merge pull request #168 from Anthonyy232/renovate/androidx.lifecycle-lifecycle-runtime-compose-2.x
Update dependency androidx.lifecycle:lifecycle-runtime-compose to v2.8.6
2024-09-20 12:10:31 -07:00
renovate[bot] ef61d3b028 Update dependency androidx.lifecycle:lifecycle-runtime-compose to v2.8.6 2024-09-20 19:09:57 +00:00
renovate[bot] ead7bd36fe Update dependency androidx.compose:compose-bom to v2024.09.02 2024-09-20 19:09:54 +00:00
Anthony La 240f30b187 Merge pull request #165 from Anthonyy232/renovate/androidx.compose.ui-ui-tooling-1.x
Update dependency androidx.compose.ui:ui-tooling to v1.7.2
2024-09-20 12:09:13 -07:00
renovate[bot] 24eb0bc20c Update dependency androidx.compose.ui:ui-tooling to v1.7.2 2024-09-20 19:09:03 +00:00
Anthony La b0bf5d875a Merge pull request #162 from Anthonyy232/renovate/androidx.compose.ui-ui-graphics-1.x
Update dependency androidx.compose.ui:ui-graphics to v1.7.2
2024-09-20 12:08:28 -07:00
Anthony La cea07a185b Merge pull request #164 from Anthonyy232/renovate/androidx.compose.ui-ui-test-manifest-1.x
Update dependency androidx.compose.ui:ui-test-manifest to v1.7.2
2024-09-20 12:08:15 -07:00
renovate[bot] 2db9a330ad Update dependency androidx.compose.ui:ui-graphics to v1.7.2 2024-09-20 19:08:12 +00:00
Anthony La 3f952796a3 Merge pull request #163 from Anthonyy232/renovate/androidx.compose.ui-ui-test-junit4-1.x
Update dependency androidx.compose.ui:ui-test-junit4 to v1.7.2
2024-09-20 12:08:02 -07:00
Anthony La 350addbefa Merge pull request #161 from Anthonyy232/renovate/androidx.compose.ui-ui-1.x
Update dependency androidx.compose.ui:ui to v1.7.2
2024-09-20 12:07:49 -07:00
renovate[bot] 23c8a82390 Update dependency androidx.compose.ui:ui-test-manifest to v1.7.2 2024-09-20 19:07:41 +00:00
renovate[bot] c063814b93 Update dependency androidx.compose.ui:ui-test-junit4 to v1.7.2 2024-09-20 19:07:39 +00:00
Anthony La 3c4fa741c6 Merge pull request #160 from Anthonyy232/renovate/androidx.compose.material-material-icons-extended-1.x
Update dependency androidx.compose.material:material-icons-extended to v1.7.2
2024-09-20 12:07:36 -07:00
renovate[bot] 49da709574 Update dependency androidx.compose.ui:ui to v1.7.2 2024-09-20 19:07:33 +00:00
renovate[bot] 177f3e21bf Update dependency androidx.compose.material:material-icons-extended to v1.7.2 2024-09-20 19:07:30 +00:00
Anthony La 82ce78fc0e Merge pull request #159 from Anthonyy232/renovate/androidx.compose.material-material-1.x
Update dependency androidx.compose.material:material to v1.7.2
2024-09-20 12:07:23 -07:00
Anthony La 346a4640c1 Merge pull request #158 from Anthonyy232/renovate/androidx.compose.foundation-foundation-1.x
Update dependency androidx.compose.foundation:foundation to v1.7.2
2024-09-20 12:07:13 -07:00
Anthony La d9998715cb Merge pull request #157 from Anthonyy232/renovate/androidx.compose.animation-animation-1.x
Update dependency androidx.compose.animation:animation to v1.7.2
2024-09-20 12:07:04 -07:00
renovate[bot] 842a77b8c5 Update dependency androidx.compose.material:material to v1.7.2 2024-09-20 19:05:48 +00:00
renovate[bot] 4b235d07ba Update dependency androidx.compose.foundation:foundation to v1.7.2 2024-09-20 19:05:45 +00:00
renovate[bot] f615dfe527 Update dependency androidx.compose.animation:animation to v1.7.2 2024-09-20 19:05:43 +00:00
Anthony La 92e530432f Merge pull request #166 from Anthonyy232/renovate/androidx.compose.ui-ui-tooling-preview-1.x
Update dependency androidx.compose.ui:ui-tooling-preview to v1.7.2
2024-09-20 12:05:19 -07:00
renovate[bot] 4a0f0f371a Update dependency androidx.compose.ui:ui-tooling-preview to v1.7.2 2024-09-19 06:05:23 +00:00
Anthony La 333d0692e8 Merge pull request #155 from Anthonyy232/renovate/com.android.application-8.x
Update plugin com.android.application to v8.6.1
2024-09-17 19:10:42 -07:00
renovate[bot] 241d0ce861 Update plugin com.android.application to v8.6.1 2024-09-18 02:10:28 +00:00
Anthony La 77d2deae0c Merge pull request #156 from Anthonyy232/renovate/com.android.library-8.x
Update plugin com.android.library to v8.6.1
2024-09-17 19:09:51 -07:00
renovate[bot] 7cc31f43b1 Update plugin com.android.library to v8.6.1 2024-09-17 21:45:34 +00:00
Anthony La bdd89a27b9 Added support for disabling auto-wallpaper changing while still allowing manual changes 2024-09-12 21:08:35 -07:00
Anthony La 77481770a6 Merge pull request #151 from Anthonyy232/renovate/com.github.skydoves-landscapist-glide-2.x
Update dependency com.github.skydoves:landscapist-glide to v2.3.8
2024-09-12 13:53:28 -07:00
renovate[bot] c9f616e1c0 Update dependency com.github.skydoves:landscapist-glide to v2.3.8 2024-09-12 06:20:37 +00:00
Anthony La 167f82edea Merge pull request #150 from Anthonyy232/renovate/androidx.compose-compose-bom-2024.x
Update dependency androidx.compose:compose-bom to v2024.09.01
2024-09-11 21:08:47 -07:00
renovate[bot] 8032f13f0e Update dependency androidx.compose:compose-bom to v2024.09.01 2024-09-12 04:08:42 +00:00
Anthony La 71fe478d54 Merge pull request #149 from Anthonyy232/renovate/androidx.compose.ui-ui-tooling-preview-1.x
Update dependency androidx.compose.ui:ui-tooling-preview to v1.7.1
2024-09-11 21:08:07 -07:00
Anthony La e3af22bbeb Merge pull request #144 from Anthonyy232/renovate/androidx.compose.ui-ui-1.x
Update dependency androidx.compose.ui:ui to v1.7.1
2024-09-11 21:07:50 -07:00
renovate[bot] 87ee6b7041 Update dependency androidx.compose.ui:ui-tooling-preview to v1.7.1 2024-09-12 04:07:30 +00:00
renovate[bot] b6b26f6732 Update dependency androidx.compose.ui:ui to v1.7.1 2024-09-12 04:07:28 +00:00
Anthony La ab1a9ab5af Merge pull request #146 from Anthonyy232/renovate/androidx.compose.ui-ui-test-junit4-1.x
Update dependency androidx.compose.ui:ui-test-junit4 to v1.7.1
2024-09-11 21:05:34 -07:00
Anthony La 0fe8dc724e Merge pull request #147 from Anthonyy232/renovate/androidx.compose.ui-ui-test-manifest-1.x
Update dependency androidx.compose.ui:ui-test-manifest to v1.7.1
2024-09-11 21:05:26 -07:00
Anthony La b5836bea95 Merge pull request #139 from Anthonyy232/renovate/gradle-8.x
Update dependency gradle to v8.10.1
2024-09-11 21:05:12 -07:00
Anthony La 3fd427afc1 Merge pull request #140 from Anthonyy232/renovate/androidx.compose.animation-animation-1.x
Update dependency androidx.compose.animation:animation to v1.7.1
2024-09-11 21:05:01 -07:00
renovate[bot] d2bd26ba38 Update dependency androidx.compose.ui:ui-test-manifest to v1.7.1 2024-09-12 04:04:54 +00:00
Anthony La 6ffeebb6a2 Merge pull request #141 from Anthonyy232/renovate/androidx.compose.foundation-foundation-1.x
Update dependency androidx.compose.foundation:foundation to v1.7.1
2024-09-11 21:04:54 -07:00
renovate[bot] ccd4bab93d Update dependency androidx.compose.ui:ui-test-junit4 to v1.7.1 2024-09-12 04:04:50 +00:00
Anthony La bbaa0cf9ee Merge pull request #142 from Anthonyy232/renovate/androidx.compose.material-material-1.x
Update dependency androidx.compose.material:material to v1.7.1
2024-09-11 21:04:48 -07:00
Anthony La 19b65999fd Merge pull request #143 from Anthonyy232/renovate/androidx.compose.material-material-icons-extended-1.x
Update dependency androidx.compose.material:material-icons-extended to v1.7.1
2024-09-11 21:04:41 -07:00
renovate[bot] 04ef14e5f1 Update dependency androidx.compose.material:material to v1.7.1 2024-09-12 04:04:39 +00:00
renovate[bot] c500fb773e Update dependency androidx.compose.foundation:foundation to v1.7.1 2024-09-12 04:04:36 +00:00
renovate[bot] 8c325ed5de Update dependency androidx.compose.animation:animation to v1.7.1 2024-09-12 04:04:32 +00:00
Anthony La 4fde150bbe Merge pull request #145 from Anthonyy232/renovate/androidx.compose.ui-ui-graphics-1.x
Update dependency androidx.compose.ui:ui-graphics to v1.7.1
2024-09-11 21:04:25 -07:00
Anthony La cebb14e60b Merge pull request #148 from Anthonyy232/renovate/androidx.compose.ui-ui-tooling-1.x
Update dependency androidx.compose.ui:ui-tooling to v1.7.1
2024-09-11 21:04:11 -07:00
renovate[bot] 0fc6a38b12 Update dependency androidx.compose.ui:ui-tooling to v1.7.1 2024-09-11 06:01:20 +00:00
renovate[bot] 17340fb74e Update dependency androidx.compose.ui:ui-graphics to v1.7.1 2024-09-11 01:39:28 +00:00
renovate[bot] 9ec4c5d20b Update dependency gradle to v8.10.1 2024-09-10 21:28:06 +00:00
renovate[bot] a8164da137 Update dependency androidx.compose.material:material-icons-extended to v1.7.1 2024-09-10 21:24:57 +00:00
Anthony La 886b7cb27e Update README.md 2024-09-10 13:22:35 -07:00
Anthony La 9f67243f0d Added None scaling option 2024-09-09 14:42:50 -07:00
Anthony La 78d7e0972b Merge pull request #135 from Anthonyy232/renovate/com.google.devtools.ksp-2.x
Update plugin com.google.devtools.ksp to v2.0.20-1.0.25
2024-09-05 19:14:32 -07:00
renovate[bot] 683f434030 Update plugin com.google.devtools.ksp to v2.0.20-1.0.25 2024-09-06 02:09:58 +00:00
Anthony La df0ac6191f Updated version code 2024-09-05 19:08:38 -07:00
Anthony La 1d3ad86341 Merge pull request #133 from Anthonyy232/renovate/androidx.compose.ui-ui-test-manifest-1.x
Update dependency androidx.compose.ui:ui-test-manifest to v1.7.0
2024-09-05 18:34:43 -07:00
renovate[bot] bac5c662ef Update dependency androidx.compose.ui:ui-test-manifest to v1.7.0 2024-09-06 01:34:34 +00:00
Anthony La 8d447f0068 Merge pull request #134 from Anthonyy232/renovate/androidx.compose.ui-ui-tooling-1.x
Update dependency androidx.compose.ui:ui-tooling to v1.7.0
2024-09-05 18:33:59 -07:00
renovate[bot] 7a2b67ed57 Update dependency androidx.compose.ui:ui-tooling to v1.7.0 2024-09-06 01:33:50 +00:00
Anthony La c55b8f44f0 Merge pull request #120 from Anthonyy232/renovate/com.airbnb.android-lottie-compose-6.x
Update dependency com.airbnb.android:lottie-compose to v6.5.2
2024-09-05 18:33:48 -07:00
Anthony La 43806aa694 Merge pull request #122 from Anthonyy232/renovate/androidx.activity-activity-compose-1.x
Update dependency androidx.activity:activity-compose to v1.9.2
2024-09-05 18:33:35 -07:00
Anthony La 90efcaaae1 Merge pull request #123 from Anthonyy232/renovate/androidx.compose.animation-animation-1.x
Update dependency androidx.compose.animation:animation to v1.7.0
2024-09-05 18:33:23 -07:00
Anthony La 8fdb0920e6 Merge pull request #124 from Anthonyy232/renovate/androidx.compose.foundation-foundation-1.x
Update dependency androidx.compose.foundation:foundation to v1.7.0
2024-09-05 18:33:17 -07:00
renovate[bot] e74f6a258a Update dependency com.airbnb.android:lottie-compose to v6.5.2 2024-09-06 01:33:07 +00:00
Anthony La 54e8b1816f Merge pull request #129 from Anthonyy232/renovate/androidx.compose.ui-ui-1.x
Update dependency androidx.compose.ui:ui to v1.7.0
2024-09-05 18:33:05 -07:00
Anthony La efa3cbc6e1 Merge pull request #125 from Anthonyy232/renovate/androidx.compose.material3-material3-1.x
Update dependency androidx.compose.material3:material3 to v1.3.0
2024-09-05 18:32:59 -07:00
renovate[bot] 12165d41c2 Update dependency androidx.compose.ui:ui to v1.7.0 2024-09-06 01:32:58 +00:00
renovate[bot] fe3aa1bda8 Update dependency androidx.compose.material3:material3 to v1.3.0 2024-09-06 01:32:53 +00:00
renovate[bot] 83ae1c721e Update dependency androidx.compose.foundation:foundation to v1.7.0 2024-09-06 01:32:49 +00:00
renovate[bot] 50cae3e04e Update dependency androidx.compose.animation:animation to v1.7.0 2024-09-06 01:32:47 +00:00
Anthony La e6b2a2af18 Merge pull request #127 from Anthonyy232/renovate/androidx.compose.material-material-1.x
Update dependency androidx.compose.material:material to v1.7.0
2024-09-05 18:32:46 -07:00
renovate[bot] 02671c0804 Update dependency androidx.activity:activity-compose to v1.9.2 2024-09-06 01:32:44 +00:00
Anthony La a3c57bf6ef Merge pull request #128 from Anthonyy232/renovate/androidx.compose.material-material-icons-extended-1.x
Update dependency androidx.compose.material:material-icons-extended to v1.7.0
2024-09-05 18:32:34 -07:00
Anthony La 72c8d1313f Merge pull request #130 from Anthonyy232/renovate/androidx.compose.ui-ui-graphics-1.x
Update dependency androidx.compose.ui:ui-graphics to v1.7.0
2024-09-05 18:32:21 -07:00
renovate[bot] 89ca480c0c Update dependency androidx.compose.ui:ui-graphics to v1.7.0 2024-09-06 01:30:41 +00:00
renovate[bot] b2a6b17c5a Update dependency androidx.compose.material:material-icons-extended to v1.7.0 2024-09-06 01:30:34 +00:00
renovate[bot] a6926f25bc Update dependency androidx.compose.material:material to v1.7.0 2024-09-06 01:30:31 +00:00
Anthony La 335a3f7084 Merge pull request #132 from Anthonyy232/renovate/androidx.compose.ui-ui-test-junit4-1.x
Update dependency androidx.compose.ui:ui-test-junit4 to v1.7.0
2024-09-05 18:29:09 -07:00
Anthony La 58c35c1bbb Fixed tasker plugin integration 2024-09-05 18:27:52 -07:00
renovate[bot] 27000d9fa2 Update dependency androidx.compose.ui:ui-test-junit4 to v1.7.0 2024-09-05 16:48:08 +00:00
Anthony La c5ed7684cf Update README.md 2024-09-03 22:13:46 -07:00
Anthony La d8b92d5cdb Update issue templates 2024-09-03 18:59:42 -07:00
Anthony La c7989db3c7 Update issue templates 2024-09-02 14:45:40 -07:00
Anthony La 353e3c3610 Update issue templates 2024-09-02 14:43:18 -07:00
Anthony La 2d35dc0620 Updated localization 2024-09-02 12:58:38 -07:00
Anthony La 5a1f11ba4f Fixed wallpaper having incorrect dimensions when in landscape mode
Updated version code
2024-09-02 11:54:29 -07:00
Anthonyy232 c1de9ec1a9 Updated FAB animations 2024-09-01 14:19:57 -07:00
Anthony La b02bb044a3 Merge pull request #116 from Anthonyy232/renovate/com.android.application-8.x
Update plugin com.android.application to v8.6.0
2024-08-29 19:24:50 -07:00
renovate[bot] 002ad6e4f9 Update plugin com.android.application to v8.6.0 2024-08-30 02:24:42 +00:00
Anthony La c05ea1ced5 Merge pull request #117 from Anthonyy232/renovate/com.android.library-8.x
Update plugin com.android.library to v8.6.0
2024-08-29 19:24:19 -07:00
renovate[bot] 6537ecfac7 Update plugin com.android.library to v8.6.0 2024-08-30 02:00:07 +00:00
Anthonyy232 0d8fee5929 Added vignette effect 2024-08-29 16:22:50 -07:00
Anthonyy232 9563bf2057 Updated blur strength factor 2024-08-28 13:54:01 -07:00
Anthony La 7b75db3437 Merge pull request #110 from Anthonyy232/renovate/kotlin-monorepo
Update kotlin monorepo to v2.0.20
2024-08-28 13:49:08 -07:00
Anthony La 6273412d9e Merge pull request #111 from Anthonyy232/renovate/com.google.devtools.ksp-2.x
Update plugin com.google.devtools.ksp to v2.0.20-1.0.24
2024-08-28 13:49:00 -07:00
Anthony La 87f71c599c Merge pull request #108 from Anthonyy232/renovate/com.mikepenz-aboutlibraries-compose-m3-11.x
Update dependency com.mikepenz:aboutlibraries-compose-m3 to v11.2.3
2024-08-28 13:48:49 -07:00
renovate[bot] 3261862c7d Update plugin com.google.devtools.ksp to v2.0.20-1.0.24 2024-08-28 20:48:49 +00:00
renovate[bot] afadfc0d2d Update kotlin monorepo to v2.0.20 2024-08-28 20:48:46 +00:00
renovate[bot] f6fdaf1673 Update dependency com.mikepenz:aboutlibraries-compose-m3 to v11.2.3 2024-08-28 20:48:43 +00:00
Anthony La 7e21d6c564 Merge pull request #106 from Anthonyy232/renovate/androidx.compose.ui-ui-tooling-preview-1.x
Update dependency androidx.compose.ui:ui-tooling-preview to v1.7.0-rc01
2024-08-28 13:47:59 -07:00
Anthony La 89c0bb3b1b Merge pull request #107 from Anthonyy232/renovate/androidx.navigation-navigation-compose-2.x
Update dependency androidx.navigation:navigation-compose to v2.8.0-rc01
2024-08-28 13:47:49 -07:00
renovate[bot] f18b751714 Update dependency androidx.navigation:navigation-compose to v2.8.0-rc01 2024-08-28 20:47:34 +00:00
Anthony La 250817ffbf Merge pull request #109 from Anthonyy232/renovate/com.mikepenz-aboutlibraries-core-11.x
Update dependency com.mikepenz:aboutlibraries-core to v11.2.3
2024-08-28 13:47:32 -07:00
renovate[bot] 5e52b7098d Update dependency androidx.compose.ui:ui-tooling-preview to v1.7.0-rc01 2024-08-28 20:47:31 +00:00
Anthony La ffdbf54561 Merge pull request #112 from Anthonyy232/renovate/com.mikepenz.aboutlibraries.plugin-11.x
Update plugin com.mikepenz.aboutlibraries.plugin to v11.2.3
2024-08-28 13:47:11 -07:00
Anthony La b11d89ceda Merge pull request #113 from Anthonyy232/renovate/androidx.compose-compose-bom-2024.x
Update dependency androidx.compose:compose-bom to v2024.08.00
2024-08-28 13:47:02 -07:00
Anthony La 045ee268e1 Merge pull request #114 from Anthonyy232/renovate/com.airbnb.android-lottie-compose-6.x
Update dependency com.airbnb.android:lottie-compose to v6.5.1
2024-08-28 13:46:51 -07:00
Anthony La f5915bff31 Merge pull request #115 from Anthonyy232/renovate/org.jetbrains.kotlinx-kotlinx-serialization-json-1.x
Update dependency org.jetbrains.kotlinx:kotlinx-serialization-json to v1.7.2
2024-08-28 13:46:44 -07:00
renovate[bot] d153ec969e Update dependency org.jetbrains.kotlinx:kotlinx-serialization-json to v1.7.2 2024-08-28 20:10:42 +00:00
renovate[bot] bfcabe29c0 Update dependency com.airbnb.android:lottie-compose to v6.5.1 2024-08-28 20:10:37 +00:00
renovate[bot] 08c71e275e Update dependency androidx.compose:compose-bom to v2024.08.00 2024-08-26 09:35:57 +00:00
renovate[bot] d211b6416c Update plugin com.mikepenz.aboutlibraries.plugin to v11.2.3 2024-08-26 09:35:54 +00:00
renovate[bot] 010a197b94 Update dependency com.mikepenz:aboutlibraries-core to v11.2.3 2024-08-26 04:41:52 +00:00
Anthony La bd4a809cac Merge pull request #100 from Anthonyy232/renovate/androidx.compose.ui-ui-1.x
Update dependency androidx.compose.ui:ui to v1.7.0-rc01
2024-08-25 19:11:59 -07:00
Anthony La cd5c53a662 Merge pull request #102 from Anthonyy232/renovate/androidx.compose.ui-ui-test-junit4-1.x
Update dependency androidx.compose.ui:ui-test-junit4 to v1.7.0-rc01
2024-08-25 19:11:52 -07:00
Anthony La 5e6211035c Merge pull request #104 from Anthonyy232/renovate/androidx.compose.ui-ui-test-manifest-1.x
Update dependency androidx.compose.ui:ui-test-manifest to v1.7.0-rc01
2024-08-25 19:11:46 -07:00
renovate[bot] 2260f7032c Update dependency androidx.compose.ui:ui-test-manifest to v1.7.0-rc01 2024-08-26 02:11:36 +00:00
renovate[bot] 1cab7cca82 Update dependency androidx.compose.ui:ui-test-junit4 to v1.7.0-rc01 2024-08-26 02:11:33 +00:00
renovate[bot] 018aa9d3a9 Update dependency androidx.compose.ui:ui to v1.7.0-rc01 2024-08-26 02:11:30 +00:00
Anthony La 423e65990f Merge pull request #95 from Anthonyy232/renovate/androidx.compose.animation-animation-1.x
Update dependency androidx.compose.animation:animation to v1.7.0-rc01
2024-08-25 19:11:06 -07:00
Anthony La 644e2ace3c Merge pull request #96 from Anthonyy232/renovate/androidx.compose.material-material-1.x
Update dependency androidx.compose.material:material to v1.7.0-rc01
2024-08-25 19:10:59 -07:00
Anthony La e61a1dc7f4 Merge pull request #97 from Anthonyy232/renovate/androidx.compose.foundation-foundation-1.x
Update dependency androidx.compose.foundation:foundation to v1.7.0-rc01
2024-08-25 19:10:52 -07:00
Anthony La 03378e6947 Merge pull request #98 from Anthonyy232/renovate/androidx.compose.material3-material3-1.x
Update dependency androidx.compose.material3:material3 to v1.3.0-rc01
2024-08-25 19:10:46 -07:00
Anthony La 0d22efa21b Merge pull request #99 from Anthonyy232/renovate/androidx.compose.material-material-icons-extended-1.x
Update dependency androidx.compose.material:material-icons-extended to v1.7.0-rc01
2024-08-25 19:10:39 -07:00
Anthony La 72175fd7b2 Merge pull request #101 from Anthonyy232/renovate/androidx.compose.ui-ui-graphics-1.x
Update dependency androidx.compose.ui:ui-graphics to v1.7.0-rc01
2024-08-25 19:10:27 -07:00
Anthony La 94576238c4 Merge pull request #105 from Anthonyy232/renovate/androidx.compose.ui-ui-tooling-1.x
Update dependency androidx.compose.ui:ui-tooling to v1.7.0-rc01
2024-08-25 19:10:12 -07:00
renovate[bot] 6dda721a0b Update dependency androidx.compose.ui:ui-tooling to v1.7.0-rc01 2024-08-22 05:22:13 +00:00
renovate[bot] 9db120bce9 Update dependency androidx.compose.ui:ui-graphics to v1.7.0-rc01 2024-08-22 00:31:41 +00:00
renovate[bot] 1c48dcd01d Update dependency androidx.compose.material:material-icons-extended to v1.7.0-rc01 2024-08-21 21:56:50 +00:00
renovate[bot] 62b296a293 Update dependency androidx.compose.material3:material3 to v1.3.0-rc01 2024-08-21 18:34:08 +00:00
renovate[bot] 5ad27fd477 Update dependency androidx.compose.foundation:foundation to v1.7.0-rc01 2024-08-21 18:34:04 +00:00
renovate[bot] d846384bdc Update dependency androidx.compose.material:material to v1.7.0-rc01 2024-08-21 17:14:03 +00:00
renovate[bot] 5c18fa1074 Update dependency androidx.compose.animation:animation to v1.7.0-rc01 2024-08-21 17:13:59 +00:00
Anthony La 9b13a2158a Update README.md 2024-08-16 21:13:24 -07:00
Anthony La 6edbc2560f Update README.md 2024-08-16 21:00:24 -07:00
Anthony La 3a1f53b7fc Update README.md 2024-08-16 20:58:49 -07:00
Anthony La cad7839a36 Update README.md 2024-08-16 20:54:31 -07:00
Anthony La 219121f400 Merge pull request #88 from Anthonyy232/2.0
Version 2.0
2024-08-16 20:48:51 -07:00
Anthonyy232 3afbb1dbe0 Updated localization 2024-08-16 20:48:04 -07:00
Anthonyy232 d39a670e4d Updated metadata images 2024-08-16 18:17:45 -07:00
Anthonyy232 7036b17b93 Merge branch 'refs/heads/master' into 2.0 2024-08-16 16:26:33 -07:00
Anthonyy232 624c9c3dbb Refactored wallpaper changer code 2024-08-16 16:23:57 -07:00
Anthony La 99cc362fdb Merge pull request #87 from Anthonyy232/renovate/gradle-8.x
Update dependency gradle to v8.10
2024-08-15 22:04:16 -07:00
Anthonyy232 92563b84ec Refactored wallpaper changer code 2024-08-15 20:30:35 -07:00
renovate[bot] 873d68a715 Update dependency gradle to v8.10 2024-08-14 12:59:29 +00:00
Anthonyy232 7c3c64149a Fixed album of size 1 not working properly 2024-08-14 01:29:51 -07:00
Anthonyy232 7615d7786a Added separate screen settings for blur and brightness
Replaced GPlay link with IzzyOnDroid
2024-08-12 17:26:14 -07:00
Anthonyy232 064237bed4 Fixed wallpaper alarm not properly rescheduling
Fixed out of bounds array access
Added tasker shortcut
2024-08-12 15:33:41 -07:00
Anthonyy232 e8f8a145ea Fixed wallpaper setting with the wrong dimensions 2024-08-11 00:03:08 -07:00
Anthonyy232 b03e860dee Fixed wallpaper setting with the wrong dimensions 2024-08-10 00:56:19 -07:00
Anthony La 359c4b40e9 Update README.md 2024-08-09 17:33:12 -07:00
Anthony La c4852b3830 Update README.md 2024-08-09 16:07:20 -07:00
Anthony La e006bea84e Update README.md 2024-08-09 14:17:52 -07:00
Anthony La 766d54cc13 Update README.md 2024-08-09 14:16:38 -07:00
Anthonyy232 f9b6a96fc5 Changed from LazyStaggeredVerticalGrid to LazyVerticalGrid and added support for scrollbar 2024-08-09 14:06:31 -07:00
Anthonyy232 4467aa9085 Added change wallpaper button to notification 2024-08-09 00:59:09 -07:00
Anthonyy232 9240a89663 Updated DAO version 2024-08-08 23:22:34 -07:00
Anthonyy232 c15bea8b37 Updated auto-restart alarm manager
Fixed large list of string navigation crashing
2024-08-08 23:21:41 -07:00
Anthonyy232 e58de859cd Merge branch 'refs/heads/master' into 2.0 2024-08-08 23:00:11 -07:00
Anthony La 22a219e985 Merge pull request #85 from Anthonyy232/renovate/com.android.application-8.x
Update plugin com.android.application to v8.5.2
2024-08-08 22:59:53 -07:00
Anthonyy232 7823fe0327 Updated auto-restart alarm manager 2024-08-08 22:59:05 -07:00
renovate[bot] d0d48f4ad1 Update plugin com.android.application to v8.5.2 2024-08-09 05:18:29 +00:00
Anthonyy232 cd1ed25ba1 Merge branch 'refs/heads/master' into 2.0 2024-08-08 22:18:11 -07:00
Anthony La 9e864858c0 Merge pull request #84 from Anthonyy232/renovate/com.android.library-8.x
Update plugin com.android.library to v8.5.2
2024-08-08 22:17:51 -07:00
Anthonyy232 d72596f3a0 Fixed notification not appearing when only setting lock screen 2024-08-08 22:16:52 -07:00
renovate[bot] f56d0c7d1b Update plugin com.android.library to v8.5.2 2024-08-09 01:12:25 +00:00
Anthonyy232 98e0b4ae2f Fixed selected album not showing up in bottom sheet as selected 2024-08-08 12:03:46 -07:00
Anthony La 8cb643b8c9 Merge pull request #83 from Anthonyy232/renovate/composeoptions-1.x
Update dependency composeOptions to v1.5.15
2024-08-08 10:47:52 -07:00
renovate[bot] 0df52203be Update dependency composeOptions to v1.5.15 2024-08-08 13:33:23 +00:00
Anthonyy232 7cf4f85b0d Updated version code 2024-08-08 01:53:11 -07:00
Anthonyy232 e89403dff3 Merge branch 'refs/heads/master' into 2.0
# Conflicts:
#	app/build.gradle.kts
#	app/src/main/java/com/anthonyla/paperize/data/settings/SettingsDataStoreImpl.kt
2024-08-08 01:52:39 -07:00
Anthony La 9a63bffca9 Update README.md 2024-08-08 01:50:38 -07:00
Anthonyy232 b8a14332c5 Updated compileSDK to 35
Updated dependencies
2024-08-08 01:50:03 -07:00
Anthonyy232 65342ed8f5 Removed unused parameters 2024-08-08 01:20:09 -07:00
Anthonyy232 f76313b998 Major refactor of wallpaper changer functionality to allow different albums for lock screen and home screen 2024-08-08 01:17:36 -07:00
Anthony La 6e821e9db4 Merge pull request #72 from Anthonyy232/renovate/com.google.dagger-hilt-android-2.x
Update dependency com.google.dagger:hilt-android to v2.52
2024-08-08 01:12:45 -07:00
renovate[bot] 696ec185bf Update dependency com.google.dagger:hilt-android to v2.52 2024-08-08 08:12:32 +00:00
Anthony La 3f7cfcd079 Merge pull request #69 from Anthonyy232/renovate/com.airbnb.android-lottie-compose-6.x
Update dependency com.airbnb.android:lottie-compose to v6.5.0
2024-08-08 01:12:18 -07:00
Anthony La 38c5b91eb2 Merge pull request #81 from Anthonyy232/renovate/androidx.compose.ui-ui-1.x
Update dependency androidx.compose.ui:ui to v1.7.0-beta07
2024-08-08 01:12:03 -07:00
renovate[bot] 2138c0b22c Update dependency com.airbnb.android:lottie-compose to v6.5.0 2024-08-08 08:11:48 +00:00
renovate[bot] c32ffbae68 Update dependency androidx.compose.ui:ui to v1.7.0-beta07 2024-08-08 08:11:45 +00:00
Anthony La 100422fc63 Merge pull request #73 from Anthonyy232/renovate/com.google.dagger-hilt-android-compiler-2.x
Update dependency com.google.dagger:hilt-android-compiler to v2.52
2024-08-08 01:11:43 -07:00
Anthony La 3f7984808c Merge pull request #74 from Anthonyy232/renovate/com.google.dagger.hilt.android-2.x
Update plugin com.google.dagger.hilt.android to v2.52
2024-08-08 01:11:34 -07:00
Anthony La 524baa1271 Merge pull request #82 from Anthonyy232/renovate/androidx.compose.ui-ui-graphics-1.x
Update dependency androidx.compose.ui:ui-graphics to v1.7.0-beta07
2024-08-08 01:11:19 -07:00
renovate[bot] b0fe869954 Update plugin com.google.dagger.hilt.android to v2.52 2024-08-08 08:10:26 +00:00
renovate[bot] e88f83dd15 Update dependency com.google.dagger:hilt-android-compiler to v2.52 2024-08-08 08:10:22 +00:00
renovate[bot] 2b9ed09211 Update dependency androidx.compose.ui:ui-graphics to v1.7.0-beta07 2024-08-08 08:10:12 +00:00
Anthony La 9278dd1e76 Merge pull request #75 from Anthonyy232/renovate/kotlin-monorepo
Update kotlin monorepo to v2.0.10
2024-08-08 01:08:59 -07:00
Anthony La a2f66c29be Merge pull request #76 from Anthonyy232/renovate/com.google.devtools.ksp-2.x
Update plugin com.google.devtools.ksp to v2.0.10-1.0.24
2024-08-08 01:08:50 -07:00
Anthony La 086ca2e049 Merge pull request #77 from Anthonyy232/renovate/androidx.compose.animation-animation-1.x
Update dependency androidx.compose.animation:animation to v1.7.0-beta07
2024-08-08 01:08:37 -07:00
Anthony La 6a8648728b Merge pull request #78 from Anthonyy232/renovate/androidx.compose.foundation-foundation-1.x
Update dependency androidx.compose.foundation:foundation to v1.7.0-beta07
2024-08-08 01:08:17 -07:00
renovate[bot] 5e796605be Update plugin com.google.devtools.ksp to v2.0.10-1.0.24 2024-08-08 08:08:11 +00:00
Anthony La abe1d10440 Merge pull request #79 from Anthonyy232/renovate/androidx.compose.material-material-1.x
Update dependency androidx.compose.material:material to v1.7.0-beta07
2024-08-08 01:08:09 -07:00
renovate[bot] adddb21fbf Update kotlin monorepo to v2.0.10 2024-08-08 08:08:08 +00:00
renovate[bot] 67ad5f3bad Update dependency androidx.compose.material:material to v1.7.0-beta07 2024-08-08 08:08:01 +00:00
renovate[bot] 0cf2302d00 Update dependency androidx.compose.foundation:foundation to v1.7.0-beta07 2024-08-08 08:07:58 +00:00
renovate[bot] e23b95b514 Update dependency androidx.compose.animation:animation to v1.7.0-beta07 2024-08-08 08:07:54 +00:00
Anthony La ba8fe59bf0 Merge pull request #80 from Anthonyy232/renovate/androidx.compose.material-material-icons-extended-1.x
Update dependency androidx.compose.material:material-icons-extended to v1.7.0-beta07
2024-08-08 01:07:45 -07:00
Anthony La 380328b401 Merge pull request #70 from navneetpal01/master
Updated the SettingsDataStoreImpl injection
2024-08-08 01:07:15 -07:00
renovate[bot] 15fc31b131 Update dependency androidx.compose.material:material-icons-extended to v1.7.0-beta07 2024-08-07 22:02:33 +00:00
Anthonyy232 65972a9ae6 Baseline code refactor for home/lock separate album functionality
Added F-Droid Link
2024-08-05 21:44:27 -07:00
navneet 5351f95cf4 Updated the SettingsDataStoreImpl 2024-08-04 11:35:08 +05:30
Anthonyy232 e0bc6ccb22 Refactored WallpaperScreen and added F-Droid link 2024-07-31 18:45:40 -07:00
Anthony La 58b82e87be Update README.md 2024-07-31 18:43:44 -07:00
Anthony La 54c7066a4a Merge pull request #68 from Anthonyy232/renovate/com.google.devtools.ksp-2.x
Update plugin com.google.devtools.ksp to v2.0.0-1.0.24
2024-07-31 09:26:08 -07:00
renovate[bot] da2e085e7b Update plugin com.google.devtools.ksp to v2.0.0-1.0.24 2024-07-30 01:09:38 +00:00
Anthonyy232 69e9f91814 Fixed navigation bug due to passing large list of strings (reverted to JSON convert instead of type-safe for FolderView screen) 2024-07-28 23:27:02 -07:00
Anthony La edfc942a6d Update README.md 2024-07-25 11:00:46 -07:00
Anthony La 71f8ee26de Create sponsorship button on GitHub website 2024-07-25 10:59:26 -07:00
Anthony La 02ac267c27 Update README.md 2024-07-25 09:37:52 -07:00
Anthonyy232 8ae92ef552 Updated app document and gradle dependency information 2024-07-25 09:34:59 -07:00
Anthonyy232 4006671f99 Remove unnecessary permission (ACCESS_NETWORK_STATE) 2024-07-25 09:27:00 -07:00
Anthonyy232 a19ac36801 Fixed memory usage for setting wallpaper 2024-07-24 23:12:46 -07:00
Anthonyy232 86d718b5f5 Updated icon for app shortcut 2024-07-24 22:45:30 -07:00
Anthonyy232 e95c923a6a Added app shortcut for changing wallpaper
Updated localization
2024-07-24 22:32:47 -07:00
Anthonyy232 ee0a04bf09 Updated .gitignore 2024-07-24 21:25:32 -07:00
Anthonyy232 4f7129f5f4 Fixed high-res images having blurry/low-res applied wallpapers
Updated dependencies
Updated localization
2024-07-24 21:20:50 -07:00
Anthony La 4e5f0d63cc Delete .idea directory 2024-07-24 19:46:25 -07:00
Anthony La c40e70d18e Merge pull request #41 from Anthonyy232/renovate/androidx.compose.ui-ui-graphics-1.x
Update dependency androidx.compose.ui:ui-graphics to v1.7.0-beta06
2024-07-24 14:12:46 -07:00
renovate[bot] b3ca913921 Update dependency androidx.compose.ui:ui-graphics to v1.7.0-beta06 2024-07-24 21:12:40 +00:00
Anthony La 99bdcf6637 Merge pull request #43 from Anthonyy232/renovate/androidx.compose.ui-ui-test-manifest-1.x
Update dependency androidx.compose.ui:ui-test-manifest to v1.7.0-beta06
2024-07-24 14:12:39 -07:00
Anthony La 8f8650ef7c Merge pull request #42 from Anthonyy232/renovate/androidx.compose.ui-ui-test-junit4-1.x
Update dependency androidx.compose.ui:ui-test-junit4 to v1.7.0-beta06
2024-07-24 14:12:29 -07:00
renovate[bot] da2747306b Update dependency androidx.compose.ui:ui-test-manifest to v1.7.0-beta06 2024-07-24 21:12:11 +00:00
renovate[bot] bb7dc87027 Update dependency androidx.compose.ui:ui-test-junit4 to v1.7.0-beta06 2024-07-24 21:12:08 +00:00
Anthony La 4464cbf7f0 Merge pull request #40 from Anthonyy232/renovate/androidx.compose.ui-ui-1.x
Update dependency androidx.compose.ui:ui to v1.7.0-beta06
2024-07-24 14:12:05 -07:00
renovate[bot] c33d567a6a Update dependency androidx.compose.ui:ui to v1.7.0-beta06 2024-07-24 21:11:58 +00:00
Anthony La 2c626db54f Merge pull request #39 from Anthonyy232/renovate/androidx.compose.material-material-icons-extended-1.x
Update dependency androidx.compose.material:material-icons-extended to v1.7.0-beta06
2024-07-24 14:11:53 -07:00
Anthony La fec52ca412 Merge pull request #38 from Anthonyy232/renovate/androidx.compose.material-material-1.x
Update dependency androidx.compose.material:material to v1.7.0-beta06
2024-07-24 14:11:43 -07:00
Anthony La 2cece3dc05 Merge pull request #37 from Anthonyy232/renovate/androidx.compose.foundation-foundation-1.x
Update dependency androidx.compose.foundation:foundation to v1.7.0-beta06
2024-07-24 14:11:34 -07:00
Anthony La 37e85c4a6b Merge pull request #36 from Anthonyy232/renovate/androidx.compose.animation-animation-1.x
Update dependency androidx.compose.animation:animation to v1.7.0-beta06
2024-07-24 14:11:23 -07:00
renovate[bot] b9f3f158b0 Update dependency androidx.compose.material:material-icons-extended to v1.7.0-beta06 2024-07-24 21:11:19 +00:00
renovate[bot] e9c4c41d3e Update dependency androidx.compose.material:material to v1.7.0-beta06 2024-07-24 21:11:15 +00:00
renovate[bot] f2b87a5e0e Update dependency androidx.compose.foundation:foundation to v1.7.0-beta06 2024-07-24 21:11:13 +00:00
Anthony La 6175338b99 Merge pull request #35 from Anthonyy232/renovate/androidx.activity-activity-compose-1.x
Update dependency androidx.activity:activity-compose to v1.9.1
2024-07-24 14:11:13 -07:00
renovate[bot] 729b5bd45a Update dependency androidx.compose.animation:animation to v1.7.0-beta06 2024-07-24 21:11:10 +00:00
renovate[bot] 5139692f2c Update dependency androidx.activity:activity-compose to v1.9.1 2024-07-24 21:11:07 +00:00
Anthony La d6bd048012 Merge pull request #44 from Anthonyy232/renovate/androidx.compose.ui-ui-tooling-1.x
Update dependency androidx.compose.ui:ui-tooling to v1.7.0-beta06
2024-07-24 14:10:30 -07:00
Anthony La ca839b2e1f Merge pull request #45 from Anthonyy232/renovate/androidx.compose.ui-ui-tooling-preview-1.x
Update dependency androidx.compose.ui:ui-tooling-preview to v1.7.0-beta06
2024-07-24 14:10:20 -07:00
Anthony La 02ba6f986b Merge pull request #46 from Anthonyy232/renovate/androidx.lifecycle-lifecycle-runtime-compose-2.x
Update dependency androidx.lifecycle:lifecycle-runtime-compose to v2.8.4
2024-07-24 14:10:07 -07:00
Anthony La 417cabcaeb Merge pull request #47 from Anthonyy232/renovate/androidx.lifecycle-lifecycle-runtime-ktx-2.x
Update dependency androidx.lifecycle:lifecycle-runtime-ktx to v2.8.4
2024-07-24 14:09:47 -07:00
Anthony La 5218dd4174 Merge pull request #48 from Anthonyy232/renovate/androidx.navigation-navigation-compose-2.x
Update dependency androidx.navigation:navigation-compose to v2.8.0-beta06
2024-07-24 14:09:36 -07:00
renovate[bot] 35836d7778 Update dependency androidx.navigation:navigation-compose to v2.8.0-beta06 2024-07-24 19:58:45 +00:00
renovate[bot] be9cb13971 Update dependency androidx.lifecycle:lifecycle-runtime-ktx to v2.8.4 2024-07-24 19:58:42 +00:00
renovate[bot] 2a7191b7be Update dependency androidx.lifecycle:lifecycle-runtime-compose to v2.8.4 2024-07-24 19:58:38 +00:00
renovate[bot] 4b930308f8 Update dependency androidx.compose.ui:ui-tooling-preview to v1.7.0-beta06 2024-07-24 19:58:35 +00:00
renovate[bot] 2567781e63 Update dependency androidx.compose.ui:ui-tooling to v1.7.0-beta06 2024-07-24 19:58:33 +00:00
Anthony La 13485cb19c Update renovate.json 2024-07-24 12:55:22 -07:00
Anthony La eae4e344b6 Update renovate.json 2024-07-24 12:35:01 -07:00
Anthonyy232 e5fab5cb5e Updated version code 2024-07-23 09:52:07 -07:00
Anthonyy232 5fd233e790 Added AMOLED dark mode setting
Reverted lazy column back to column due to stutter
2024-07-22 18:25:02 -07:00
Anthonyy232 48a730e4a9 Fixed WallpaperBootAndChangeReceiver not changing wallpaper immediately
Refactored WallpaperAlarmSchedulerImpl.kt name
2024-07-19 20:28:29 -07:00
Anthonyy232 4c3d5af7f7 Removed FAB animation when scrolling due to recomposition inefficiency
Refactored viewmodel injection code
Changed column to lazy column on WallpaperScreen.kt
2024-07-17 22:42:10 -07:00
Anthonyy232 829d982d23 Refactored albums viewmodel injecting 2024-07-16 23:34:34 -07:00
Anthonyy232 b01b9a87d6 Updated version code 2024-07-12 10:38:18 -07:00
Anthony La c4395b364c Merge pull request #31 from Anthonyy232/renovate/com.android.application-8.x
Update plugin com.android.application to v8.5.1
2024-07-12 10:33:05 -07:00
renovate[bot] dc1f8b9802 Update plugin com.android.application to v8.5.1 2024-07-12 17:32:59 +00:00
Anthony La 4279dd3be7 Merge pull request #30 from Anthonyy232/renovate/gradle-8.x
Update dependency gradle to v8.9
2024-07-12 10:32:34 -07:00
Anthony La 373f784fb6 Merge pull request #32 from Anthonyy232/renovate/com.google.devtools.ksp-2.x
Update plugin com.google.devtools.ksp to v2.0.0-1.0.23
2024-07-12 10:32:13 -07:00
Anthony La fe12b2116c Merge pull request #33 from Anthonyy232/renovate/com.android.library-8.x
Update plugin com.android.library to v8.5.1
2024-07-12 10:32:03 -07:00
renovate[bot] 9f906aa11c Update plugin com.android.library to v8.5.1 2024-07-12 00:30:16 +00:00
renovate[bot] e20b3c7c49 Update plugin com.google.devtools.ksp to v2.0.0-1.0.23 2024-07-11 21:48:28 +00:00
renovate[bot] 9bab8ad4b6 Update dependency gradle to v8.9 2024-07-11 15:33:27 +00:00
Anthonyy232 31b976c258 Updated localizations 2024-07-10 18:49:51 -07:00
Anthonyy232 660116fb60 Remove lint for broadcast receiver 2024-07-10 18:41:40 -07:00
Anthonyy232 984e34f425 Added quick-setting tile for changing wallpaper 2024-07-10 18:40:17 -07:00
Anthonyy232 cd06c87263 Updated localization 2024-07-10 18:40:05 -07:00
Anthony La 633ae66a80 Merge pull request #27 from Anthonyy232/renovate/androidx.compose.ui-ui-tooling-1.x
Update dependency androidx.compose.ui:ui-tooling to v1.7.0-beta05
2024-07-10 12:31:25 -07:00
renovate[bot] 005843ec00 Update dependency androidx.compose.ui:ui-tooling to v1.7.0-beta05 2024-07-10 19:30:56 +00:00
Anthony La 4327a94c14 Merge pull request #26 from Anthonyy232/renovate/androidx.compose.ui-ui-test-manifest-1.x
Update dependency androidx.compose.ui:ui-test-manifest to v1.7.0-beta05
2024-07-10 12:30:06 -07:00
Anthony La fb4ffea292 Merge pull request #25 from Anthonyy232/renovate/androidx.compose.ui-ui-test-junit4-1.x
Update dependency androidx.compose.ui:ui-test-junit4 to v1.7.0-beta05
2024-07-10 12:29:58 -07:00
Anthony La 7570ab5405 Merge pull request #24 from Anthonyy232/renovate/androidx.compose.ui-ui-graphics-1.x
Update dependency androidx.compose.ui:ui-graphics to v1.7.0-beta05
2024-07-10 12:29:50 -07:00
renovate[bot] 8899c5c743 Update dependency androidx.compose.ui:ui-graphics to v1.7.0-beta05 2024-07-10 19:29:46 +00:00
Anthony La cc69b4b63b Merge pull request #23 from Anthonyy232/renovate/androidx.compose.ui-ui-1.x
Update dependency androidx.compose.ui:ui to v1.7.0-beta05
2024-07-10 12:29:04 -07:00
Anthony La 0f77761380 Merge pull request #22 from Anthonyy232/renovate/androidx.compose.material-material-icons-extended-1.x
Update dependency androidx.compose.material:material-icons-extended to v1.7.0-beta05
2024-07-10 12:28:55 -07:00
Anthony La cdf124319f Merge pull request #21 from Anthonyy232/renovate/androidx.compose.material-material-1.x
Update dependency androidx.compose.material:material to v1.7.0-beta05
2024-07-10 12:28:43 -07:00
Anthony La 63fe703a6d Merge pull request #20 from Anthonyy232/renovate/androidx.compose.foundation-foundation-1.x
Update dependency androidx.compose.foundation:foundation to v1.7.0-beta05
2024-07-10 12:28:27 -07:00
Anthony La 84043b06e7 Merge pull request #19 from Anthonyy232/renovate/androidx.compose.animation-animation-1.x
Update dependency androidx.compose.animation:animation to v1.7.0-beta05
2024-07-10 12:28:17 -07:00
Anthony La bf35b34ce2 Merge pull request #28 from Anthonyy232/renovate/androidx.compose.ui-ui-tooling-preview-1.x
Update dependency androidx.compose.ui:ui-tooling-preview to v1.7.0-beta05
2024-07-10 12:27:43 -07:00
renovate[bot] 1cde08bef6 Update dependency androidx.compose.material:material to v1.7.0-beta05 2024-07-10 19:27:20 +00:00
Anthony La e37f7e36db Merge pull request #29 from Anthonyy232/renovate/androidx.navigation-navigation-compose-2.x
Update dependency androidx.navigation:navigation-compose to v2.8.0-beta05
2024-07-10 12:26:43 -07:00
renovate[bot] e6c6184c9d Update dependency androidx.navigation:navigation-compose to v2.8.0-beta05 2024-07-10 19:25:45 +00:00
renovate[bot] 512637b23c Update dependency androidx.compose.ui:ui-tooling-preview to v1.7.0-beta05 2024-07-10 19:25:42 +00:00
renovate[bot] 398e43469f Update dependency androidx.compose.ui:ui-test-manifest to v1.7.0-beta05 2024-07-10 19:25:36 +00:00
renovate[bot] 1f5cab1d5b Update dependency androidx.compose.ui:ui-test-junit4 to v1.7.0-beta05 2024-07-10 19:25:33 +00:00
renovate[bot] a185c727a2 Update dependency androidx.compose.ui:ui to v1.7.0-beta05 2024-07-10 19:25:27 +00:00
renovate[bot] 28b9a74c3d Update dependency androidx.compose.material:material-icons-extended to v1.7.0-beta05 2024-07-10 19:25:23 +00:00
renovate[bot] 2e8d8b8603 Update dependency androidx.compose.foundation:foundation to v1.7.0-beta05 2024-07-10 19:14:35 +00:00
renovate[bot] a0a4bc9e4e Update dependency androidx.compose.animation:animation to v1.7.0-beta05 2024-07-10 19:14:31 +00:00
Anthony La 97c23f9d44 Update README.md 2024-07-09 10:19:15 -07:00
Anthonyy232 bde2f7dd1f Removed unused imports 2024-07-09 10:17:45 -07:00
Anthonyy232 d005102716 Fixed device dynamic theming issue not correctly sourcing from the home screen wallpaper 2024-07-09 10:17:45 -07:00
Anthony La 953dc65428 Merge pull request #15 from Anthonyy232/renovate/composeoptions-1.x
Update dependency composeOptions to v1.5.14
2024-07-09 10:15:21 -07:00
Anthony La 69f8a09ceb Merge pull request #16 from Anthonyy232/renovate/com.google.devtools.ksp-2.x
Update plugin com.google.devtools.ksp to v2.0.0-1.0.22
2024-07-09 10:14:41 -07:00
renovate[bot] bf56df28fa Update plugin com.google.devtools.ksp to v2.0.0-1.0.22 2024-07-09 17:14:18 +00:00
Anthony La 3e49bc1836 Merge pull request #18 from Anthonyy232/renovate/com.mikepenz.aboutlibraries.plugin-11.x
Update plugin com.mikepenz.aboutlibraries.plugin to v11.2.2
2024-07-09 10:13:51 -07:00
renovate[bot] ad069e5e9f Update plugin com.mikepenz.aboutlibraries.plugin to v11.2.2 2024-07-08 23:48:32 +00:00
renovate[bot] 5adfac4db2 Update dependency composeOptions to v1.5.14 2024-07-07 16:13:24 +00:00
Anthony La 1ecfa1566f Merge pull request #14 from Anthonyy232/renovate/configure
Configure Renovate
2024-07-07 09:12:46 -07:00
renovate[bot] 724cb5e9f5 Add renovate.json 2024-07-07 16:11:33 +00:00
Anthony La 69a9f36100 Update README.md 2024-07-06 18:27:31 -07:00
Anthonyy232 450dfed0a3 Updated Chinese simplified and Arabic translations 2024-07-06 18:25:52 -07:00
Anthonyy232 c1404ec522 Updated dependencies
Updated navigation for FolderView to type-safe navigation
Updated error checking for tab navigation
2024-07-05 11:19:22 -07:00
Anthony La bcff2f338f Updated version code for F-Droid release 2024-06-18 16:48:03 -07:00
Anthony La 5582a5851f Update README.md 2024-06-15 18:20:49 -07:00
Anthony La 1d0794d135 Updated Serialization version to 2.0.0
Updated Dagger Hilt to 2.51.1
Updated Accompanist to 0.35.1-alpha-03
Updated Zoomable to 2.0.0-beta-03
2024-06-15 18:19:28 -07:00
425 changed files with 21893 additions and 18521 deletions

No files matched your search

+1
View File
@@ -0,0 +1 @@
github: Anthonyy232
+35
View File
@@ -0,0 +1,35 @@
name: Bug report
description: Something in Paperize doesn't work as it should
labels: [bug]
body:
- type: textarea
id: what
attributes:
label: What happened
description: What you did, what you expected and what you got. Screenshots help.
validations:
required: true
- type: input
id: version
attributes:
label: Paperize version
placeholder: 4.2.2 from F-Droid
validations:
required: true
- type: input
id: device
attributes:
label: Device and Android version
placeholder: Pixel 9, Android 16
validations:
required: true
- type: dropdown
id: mode
attributes:
label: Wallpaper mode
options:
- Static
- Live
- Not sure
validations:
required: true
+8
View File
@@ -0,0 +1,8 @@
blank_issues_enabled: true
contact_links:
- name: Feature idea
url: https://github.com/Anthonyy232/Paperize/discussions/categories/ideas
about: Suggest a feature or improvement in Discussions
- name: Question
url: https://github.com/Anthonyy232/Paperize/discussions/categories/q-a
about: Ask how something works
+39
View File
@@ -0,0 +1,39 @@
version: 2
updates:
- package-ecosystem: gradle
directory: /
schedule:
interval: monthly
cooldown:
default-days: 5
groups:
# F-Droid rebuilds each release and compares it with ours: toolchain updates are merged by hand
toolchain:
patterns:
- gradle-wrapper
- com.android.application*
- com.android.tools.build*
- org.jetbrains.kotlin*
- com.google.devtools.ksp*
# "*" ranks below toolchain's patterns; without patterns these groups would outrank it
minor-patch:
patterns: ["*"]
update-types: [minor, patch]
major:
patterns: ["*"]
update-types: [major]
commit-message:
prefix: chore(deps)
- package-ecosystem: github-actions
directory: /
schedule:
interval: monthly
cooldown:
default-days: 5
groups:
minor-patch:
update-types: [minor, patch]
major:
update-types: [major]
commit-message:
prefix: chore(deps)
+7
View File
@@ -0,0 +1,7 @@
## What
## Why
## Checked
<!-- e.g. ./gradlew testDebugUnitTest lintDebug, and what you saw on a device or emulator -->
Binary file not shown.

After

Width:  |  Height:  |  Size: 249 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 234 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 235 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 193 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 262 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 252 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 271 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 237 KiB

+110
View File
@@ -0,0 +1,110 @@
name: Paperize CI/CD Pipeline
on:
push:
branches: [ "master" ]
tags: [ 'v*' ]
pull_request:
branches: [ "master" ]
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ !startsWith(github.ref, 'refs/tags/') }}
jobs:
test:
name: Run Unit Tests
runs-on: ubuntu-latest
steps:
- name: Checkout repository source code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- name: Set up JDK 17
uses: actions/setup-java@d1374f8ac74474200d16ef8ecee22c7ae7a51880 # v6
with:
java-version: '17'
distribution: 'temurin'
cache: gradle
- name: Run unit tests and lint
run: ./gradlew testDebugUnitTest lintDebug
build:
name: Build Signed APK
runs-on: ubuntu-latest
needs: test
if: github.event_name == 'push'
steps:
- name: Checkout repository source code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- name: Set up JDK 17
uses: actions/setup-java@d1374f8ac74474200d16ef8ecee22c7ae7a51880 # v6
with:
java-version: '17'
distribution: 'temurin'
cache: gradle
- name: Decode Base64 Keystore
env:
SIGNING_KEYSTORE_BASE64: ${{ secrets.SIGNING_KEYSTORE_BASE64 }}
run: |
echo $SIGNING_KEYSTORE_BASE64 | base64 --decode > ${{ github.workspace }}/keystore.jks
- name: Build Release APK
env:
SIGNING_KEYSTORE_PATH: ${{ github.workspace }}/keystore.jks
SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }}
SIGNING_STORE_PASSWORD: ${{ secrets.SIGNING_STORE_PASSWORD }}
SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }}
run: ./gradlew assembleRelease
- name: Get Version Name
id: get_version
shell: bash
run: |
if [[ $GITHUB_REF == refs/tags/v* ]]; then
VERSION_NAME=${GITHUB_REF_NAME}
else
RAW_VERSION=$(grep "versionName =" app/build.gradle.kts | awk -F'"' '{print $2}')
VERSION_NAME="v${RAW_VERSION}"
fi
echo "VERSION_NAME=$VERSION_NAME" >> $GITHUB_OUTPUT
- name: Name APK for distribution
shell: bash
run: |
mv app/build/outputs/apk/release/app-release.apk \
"app/build/outputs/apk/release/paperize-${{ steps.get_version.outputs.VERSION_NAME }}.apk"
- name: Upload APK as a build artifact
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7
with:
name: paperize-${{ steps.get_version.outputs.VERSION_NAME }}
path: app/build/outputs/apk/release/paperize-${{ steps.get_version.outputs.VERSION_NAME }}.apk
if-no-files-found: error
release:
name: Create GitHub Release
runs-on: ubuntu-latest
needs: build
if: startsWith(github.ref, 'refs/tags/')
permissions:
contents: write
steps:
- name: Download signed APK artifact
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8
with:
pattern: paperize-v*
path: ./apk-artifact
merge-multiple: true
- name: Create Draft Release
uses: softprops/action-gh-release@8a0cd651e5b2365bd640854a3fa5dfc70e4875f3 # v3
with:
files: ./apk-artifact/paperize-v*.apk
draft: true
+60
View File
@@ -0,0 +1,60 @@
name: CodeQL
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
schedule:
- cron: "24 6 * * 3"
permissions:
contents: read
security-events: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
analyze-actions:
name: Analyze GitHub Actions
runs-on: ubuntu-latest
steps:
- name: Checkout repository source code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- name: Initialize CodeQL
uses: github/codeql-action/init@33d7b85da1a04171e211befe2c739303b9a4c066 # v4
with:
languages: actions
build-mode: none
- name: Perform CodeQL analysis
uses: github/codeql-action/analyze@33d7b85da1a04171e211befe2c739303b9a4c066 # v4
analyze-java-kotlin:
name: Analyze Java and Kotlin
runs-on: ubuntu-latest
steps:
- name: Checkout repository source code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- name: Set up JDK 17
uses: actions/setup-java@d1374f8ac74474200d16ef8ecee22c7ae7a51880 # v6
with:
java-version: "17"
distribution: temurin
cache: gradle
- name: Initialize CodeQL
uses: github/codeql-action/init@33d7b85da1a04171e211befe2c739303b9a4c066 # v4
with:
languages: java-kotlin
build-mode: manual
- name: Build application for analysis
run: ./gradlew assembleDebug
- name: Perform CodeQL analysis
uses: github/codeql-action/analyze@33d7b85da1a04171e211befe2c739303b9a4c066 # v4
+107
View File
@@ -0,0 +1,107 @@
name: Crowdin Sync
on:
push:
branches: [ "master" ]
paths:
- app/src/main/res/values/strings.xml
- crowdin.yml
- .github/workflows/crowdin.yml
schedule:
- cron: "0 8 * * 1"
workflow_dispatch:
inputs:
upload_translations:
description: Send the translations in the repository to Crowdin as approved first
type: boolean
default: false
concurrency:
group: crowdin-sync
permissions:
actions: write
contents: write
pull-requests: write
env:
BRANCH: crowdin-translations
jobs:
synchronize-with-crowdin:
name: Synchronize with Crowdin
runs-on: ubuntu-latest
steps:
- name: Checkout repository source code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- name: Upload sources and download approved translations
uses: crowdin/github-action@d651c77756acbe11a31d77a6fb79d8a239e1e05a # v3
with:
crowdin_branch_name: main
upload_sources: true
upload_translations: ${{ inputs.upload_translations || false }}
auto_approve_imported: true
download_translations: false
download_bundle: 15
push_translations: false
create_pull_request: false
env:
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
# Keeps every string the repository already ships, drops strings English no longer has,
# and only adds a new locale once it covers 90% of the English strings.
- name: Merge into the shipped translations
shell: python
run: |
import os, re, shutil, subprocess
from pathlib import Path
res = Path("app/src/main/res")
entry = re.compile(r'<(string|plurals|string-array)\b[^>]*?\bname="([^"]+)"[^>]*>.*?</\1>', re.S)
# Crowdin adds the string's context as a comment attribute.
def entries(text):
return {m.group(2): re.sub(r' comment="[^"]*"', "", m.group(0), count=1) for m in entry.finditer(text)}
def shipped(path):
out = subprocess.run(["git", "show", f"HEAD:{path.as_posix()}"], capture_output=True, text=True)
return out.stdout if out.returncode == 0 else None
subprocess.run(["sudo", "chown", "-R", str(os.getuid()), str(res)], check=True)
source = [k for k, v in entries((res / "values/strings.xml").read_text("utf-8")).items()
if 'translatable="false"' not in v.split(">", 1)[0]]
for path in sorted(res.glob("values-*/strings.xml")):
old_text = shipped(path)
new, old = entries(path.read_text("utf-8")), entries(old_text or "")
merged = [new.get(k) or old[k] for k in source if k in new or k in old]
if old_text is None and len(merged) < 0.9 * len(source):
shutil.rmtree(path.parent)
continue
if merged == [old[k] for k in source if k in old]:
subprocess.run(["git", "checkout", "--", str(path)], check=True)
continue
body = "".join(f" {e}\n" for e in merged)
path.write_text(f'<?xml version="1.0" encoding="utf-8"?>\n<resources>\n{body}</resources>\n', "utf-8")
# Pull requests opened with GITHUB_TOKEN start no workflows, so the checks are dispatched.
- name: Open the translations pull request
env:
GH_TOKEN: ${{ github.token }}
run: |
if [ -z "$(git status --porcelain app/src/main/res)" ]; then
echo "No translation changes"
exit 0
fi
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git switch -C "$BRANCH"
git add app/src/main/res
git commit -m "chore: update translations"
git push --force origin "$BRANCH"
if [ -z "$(gh pr list --head "$BRANCH" --state open --json number --jq '.[].number')" ]; then
gh pr create --base master --head "$BRANCH" --title "chore: update translations" \
--body "Approved translations from [Crowdin](https://crowdin.com/project/paperize)."
fi
gh workflow run android-release.yml --ref "$BRANCH"
@@ -0,0 +1,21 @@
name: Dependabot auto-merge
on: pull_request
permissions:
contents: write
pull-requests: write
jobs:
auto-merge:
if: github.event.pull_request.user.login == 'dependabot[bot]'
runs-on: ubuntu-latest
steps:
- id: meta
uses: dependabot/fetch-metadata@25dd0e34f4fe68f24cc83900b1fe3fe149efef98 # v3
# Waits for the ruleset's required checks
- if: steps.meta.outputs.dependency-group == 'minor-patch' && contains(fromJSON('["version-update:semver-minor", "version-update:semver-patch"]'), steps.meta.outputs.update-type)
run: gh pr merge --auto --squash "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+40
View File
@@ -0,0 +1,40 @@
name: Pages
on:
push:
branches: [ "master" ]
paths:
- "site/**"
- ".github/workflows/pages.yml"
workflow_dispatch:
permissions:
contents: read
concurrency:
group: pages
cancel-in-progress: false
jobs:
deploy:
name: Deploy site
runs-on: ubuntu-latest
permissions:
contents: read
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Checkout repository source code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- name: Upload site
uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5
with:
path: site
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@368f82528645a54fb793d4d04e342629a3f51346 # v5
-43
View File
@@ -1,43 +0,0 @@
# Simple workflow for deploying static content to GitHub Pages
name: Deploy static content to Pages
on:
# Runs on pushes targeting the default branch
push:
branches: ["master"]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
# Single deploy job since we're just deploying
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
# Upload entire repository
path: '.'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
+5
View File
@@ -1,5 +1,6 @@
*.iml
.gradle
.idea
/local.properties
/.idea/caches
/.idea/libraries
@@ -13,3 +14,7 @@
.externalNativeBuild
.cxx
local.properties
/app/build
/app/release
.kotlin
/.kotlin/sessions
-3
View File
@@ -1,3 +0,0 @@
# Default ignored files
/shelf/
/workspace.xml
Generated
-1
View File
@@ -1 +0,0 @@
Paperize
-41
View File
@@ -1,41 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AppInsightsSettings">
<option name="selectedTabId" value="Android Vitals" />
<option name="tabSettings">
<map>
<entry key="Android Vitals">
<value>
<InsightsFilterSettings>
<option name="connection">
<ConnectionSetting>
<option name="appId" value="com.anthonyla.paperize" />
</ConnectionSetting>
</option>
<option name="signal" value="SIGNAL_UNSPECIFIED" />
<option name="timeIntervalDays" value="SEVEN_DAYS" />
<option name="visibilityType" value="ALL" />
</InsightsFilterSettings>
</value>
</entry>
<entry key="Firebase Crashlytics">
<value>
<InsightsFilterSettings>
<option name="connection">
<ConnectionSetting>
<option name="appId" value="PLACEHOLDER" />
<option name="mobileSdkAppId" value="" />
<option name="projectId" value="" />
<option name="projectNumber" value="" />
</ConnectionSetting>
</option>
<option name="signal" value="SIGNAL_UNSPECIFIED" />
<option name="timeIntervalDays" value="THIRTY_DAYS" />
<option name="visibilityType" value="ALL" />
</InsightsFilterSettings>
</value>
</entry>
</map>
</option>
</component>
</project>
-123
View File
@@ -1,123 +0,0 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<JetCodeStyleSettings>
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
</JetCodeStyleSettings>
<codeStyleSettings language="XML">
<option name="FORCE_REARRANGE_MODE" value="1" />
<indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="4" />
</indentOptions>
<arrangement>
<rules>
<section>
<rule>
<match>
<AND>
<NAME>xmlns:android</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>xmlns:.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:id</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:name</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>name</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>style</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
<order>ANDROID_ATTRIBUTE_ORDER</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>.*</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
</rules>
</arrangement>
</codeStyleSettings>
<codeStyleSettings language="kotlin">
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
</codeStyleSettings>
</code_scheme>
</component>
-5
View File
@@ -1,5 +0,0 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</state>
</component>
-6
View File
@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="17" />
</component>
</project>
-23
View File
@@ -1,23 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="deploymentTargetDropDown">
<value>
<entry key="Paperize">
<State>
<runningDeviceTargetSelectedWithDropDown>
<Target>
<type value="RUNNING_DEVICE_TARGET" />
<deviceKey>
<Key>
<type value="SERIAL_NUMBER" />
<value value="RFCTA1MRS4H" />
</Key>
</deviceKey>
</Target>
</runningDeviceTargetSelectedWithDropDown>
<timeTargetWasSelectedWithDropDown value="2024-04-30T06:47:19.015867100Z" />
</State>
</entry>
</value>
</component>
</project>
-19
View File
@@ -1,19 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleJvm" value="jbr-17" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
</set>
</option>
<option name="resolveExternalAnnotations" value="false" />
</GradleProjectSettings>
</option>
</component>
</project>
-32
View File
@@ -1,32 +0,0 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="PreviewAnnotationInFunctionWithParameters" enabled="true" level="ERROR" enabled_by_default="true">
<option name="composableFile" value="true" />
</inspection_tool>
<inspection_tool class="PreviewApiLevelMustBeValid" enabled="true" level="ERROR" enabled_by_default="true">
<option name="composableFile" value="true" />
</inspection_tool>
<inspection_tool class="PreviewDimensionRespectsLimit" enabled="true" level="WARNING" enabled_by_default="true">
<option name="composableFile" value="true" />
</inspection_tool>
<inspection_tool class="PreviewFontScaleMustBeGreaterThanZero" enabled="true" level="ERROR" enabled_by_default="true">
<option name="composableFile" value="true" />
</inspection_tool>
<inspection_tool class="PreviewMultipleParameterProviders" enabled="true" level="ERROR" enabled_by_default="true">
<option name="composableFile" value="true" />
</inspection_tool>
<inspection_tool class="PreviewMustBeTopLevelFunction" enabled="true" level="ERROR" enabled_by_default="true">
<option name="composableFile" value="true" />
</inspection_tool>
<inspection_tool class="PreviewNeedsComposableAnnotation" enabled="true" level="ERROR" enabled_by_default="true">
<option name="composableFile" value="true" />
</inspection_tool>
<inspection_tool class="PreviewNotSupportedInUnitTestFiles" enabled="true" level="ERROR" enabled_by_default="true">
<option name="composableFile" value="true" />
</inspection_tool>
<inspection_tool class="PreviewPickerAnnotation" enabled="true" level="ERROR" enabled_by_default="true">
<option name="composableFile" value="true" />
</inspection_tool>
</profile>
</component>
-9
View File
@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Kotlin2JvmCompilerArguments">
<option name="jvmTarget" value="1.8" />
</component>
<component name="KotlinJpsPluginSettings">
<option name="version" value="2.0.0" />
</component>
</project>
-10
View File
@@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectMigrations">
<option name="MigrateToGradleLocalJavaHome">
<set>
<option value="$PROJECT_DIR$" />
</set>
</option>
</component>
</project>
-54
View File
@@ -1,54 +0,0 @@
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="NullableNotNullManager">
<option name="myDefaultNullable" value="androidx.annotation.Nullable" />
<option name="myDefaultNotNull" value="androidx.annotation.NonNull" />
<option name="myNullables">
<value>
<list size="15">
<item index="0" class="java.lang.String" itemvalue="org.jspecify.annotations.Nullable" />
<item index="1" class="java.lang.String" itemvalue="com.android.annotations.Nullable" />
<item index="2" class="java.lang.String" itemvalue="androidx.annotation.RecentlyNullable" />
<item index="3" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NullableDecl" />
<item index="4" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
<item index="5" class="java.lang.String" itemvalue="androidx.annotation.Nullable" />
<item index="6" class="java.lang.String" itemvalue="org.eclipse.jdt.annotation.Nullable" />
<item index="7" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
<item index="8" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
<item index="9" class="java.lang.String" itemvalue="jakarta.annotation.Nullable" />
<item index="10" class="java.lang.String" itemvalue="javax.annotation.CheckForNull" />
<item index="11" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
<item index="12" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.qual.Nullable" />
<item index="13" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NullableType" />
<item index="14" class="java.lang.String" itemvalue="android.annotation.Nullable" />
</list>
</value>
</option>
<option name="myNotNulls">
<value>
<list size="14">
<item index="0" class="java.lang.String" itemvalue="androidx.annotation.RecentlyNonNull" />
<item index="1" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.qual.NonNull" />
<item index="2" class="java.lang.String" itemvalue="org.jspecify.annotations.NonNull" />
<item index="3" class="java.lang.String" itemvalue="jakarta.annotation.Nonnull" />
<item index="4" class="java.lang.String" itemvalue="androidx.annotation.NonNull" />
<item index="5" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NonNullType" />
<item index="6" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
<item index="7" class="java.lang.String" itemvalue="com.android.annotations.NonNull" />
<item index="8" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
<item index="9" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NonNullDecl" />
<item index="10" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
<item index="11" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
<item index="12" class="java.lang.String" itemvalue="org.eclipse.jdt.annotation.NonNull" />
<item index="13" class="java.lang.String" itemvalue="android.annotation.NonNull" />
</list>
</value>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="jbr-17" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
</project>
-263
View File
@@ -1,263 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="direct_access_persist.xml">
<option name="deviceSelectionList">
<list>
<PersistentDeviceSelectionData>
<option name="api" value="27" />
<option name="brand" value="DOCOMO" />
<option name="codename" value="F01L" />
<option name="id" value="F01L" />
<option name="manufacturer" value="FUJITSU" />
<option name="name" value="F-01L" />
<option name="screenDensity" value="360" />
<option name="screenX" value="720" />
<option name="screenY" value="1280" />
</PersistentDeviceSelectionData>
<PersistentDeviceSelectionData>
<option name="api" value="28" />
<option name="brand" value="DOCOMO" />
<option name="codename" value="SH-01L" />
<option name="id" value="SH-01L" />
<option name="manufacturer" value="SHARP" />
<option name="name" value="AQUOS sense2 SH-01L" />
<option name="screenDensity" value="480" />
<option name="screenX" value="1080" />
<option name="screenY" value="2160" />
</PersistentDeviceSelectionData>
<PersistentDeviceSelectionData>
<option name="api" value="31" />
<option name="brand" value="samsung" />
<option name="codename" value="a51" />
<option name="id" value="a51" />
<option name="manufacturer" value="Samsung" />
<option name="name" value="Galaxy A51" />
<option name="screenDensity" value="420" />
<option name="screenX" value="1080" />
<option name="screenY" value="2400" />
</PersistentDeviceSelectionData>
<PersistentDeviceSelectionData>
<option name="api" value="34" />
<option name="brand" value="google" />
<option name="codename" value="akita" />
<option name="id" value="akita" />
<option name="manufacturer" value="Google" />
<option name="name" value="Pixel 8a" />
<option name="screenDensity" value="420" />
<option name="screenX" value="1080" />
<option name="screenY" value="2400" />
</PersistentDeviceSelectionData>
<PersistentDeviceSelectionData>
<option name="api" value="33" />
<option name="brand" value="samsung" />
<option name="codename" value="b0q" />
<option name="id" value="b0q" />
<option name="manufacturer" value="Samsung" />
<option name="name" value="Galaxy S22 Ultra" />
<option name="screenDensity" value="600" />
<option name="screenX" value="1440" />
<option name="screenY" value="3088" />
</PersistentDeviceSelectionData>
<PersistentDeviceSelectionData>
<option name="api" value="32" />
<option name="brand" value="google" />
<option name="codename" value="bluejay" />
<option name="id" value="bluejay" />
<option name="manufacturer" value="Google" />
<option name="name" value="Pixel 6a" />
<option name="screenDensity" value="420" />
<option name="screenX" value="1080" />
<option name="screenY" value="2400" />
</PersistentDeviceSelectionData>
<PersistentDeviceSelectionData>
<option name="api" value="29" />
<option name="brand" value="samsung" />
<option name="codename" value="crownqlteue" />
<option name="id" value="crownqlteue" />
<option name="manufacturer" value="Samsung" />
<option name="name" value="Galaxy Note9" />
<option name="screenDensity" value="420" />
<option name="screenX" value="2220" />
<option name="screenY" value="1080" />
</PersistentDeviceSelectionData>
<PersistentDeviceSelectionData>
<option name="api" value="34" />
<option name="brand" value="samsung" />
<option name="codename" value="dm3q" />
<option name="id" value="dm3q" />
<option name="manufacturer" value="Samsung" />
<option name="name" value="Galaxy S23 Ultra" />
<option name="screenDensity" value="600" />
<option name="screenX" value="1440" />
<option name="screenY" value="3088" />
</PersistentDeviceSelectionData>
<PersistentDeviceSelectionData>
<option name="api" value="33" />
<option name="brand" value="google" />
<option name="codename" value="felix" />
<option name="id" value="felix" />
<option name="manufacturer" value="Google" />
<option name="name" value="Pixel Fold" />
<option name="screenDensity" value="420" />
<option name="screenX" value="2208" />
<option name="screenY" value="1840" />
</PersistentDeviceSelectionData>
<PersistentDeviceSelectionData>
<option name="api" value="33" />
<option name="brand" value="google" />
<option name="codename" value="felix_camera" />
<option name="id" value="felix_camera" />
<option name="manufacturer" value="Google" />
<option name="name" value="Pixel Fold (Camera-enabled)" />
<option name="screenDensity" value="420" />
<option name="screenX" value="2208" />
<option name="screenY" value="1840" />
</PersistentDeviceSelectionData>
<PersistentDeviceSelectionData>
<option name="api" value="33" />
<option name="brand" value="samsung" />
<option name="codename" value="gts8uwifi" />
<option name="id" value="gts8uwifi" />
<option name="manufacturer" value="Samsung" />
<option name="name" value="Galaxy Tab S8 Ultra" />
<option name="screenDensity" value="320" />
<option name="screenX" value="1848" />
<option name="screenY" value="2960" />
</PersistentDeviceSelectionData>
<PersistentDeviceSelectionData>
<option name="api" value="34" />
<option name="brand" value="google" />
<option name="codename" value="husky" />
<option name="id" value="husky" />
<option name="manufacturer" value="Google" />
<option name="name" value="Pixel 8 Pro" />
<option name="screenDensity" value="390" />
<option name="screenX" value="1008" />
<option name="screenY" value="2244" />
</PersistentDeviceSelectionData>
<PersistentDeviceSelectionData>
<option name="api" value="30" />
<option name="brand" value="motorola" />
<option name="codename" value="java" />
<option name="id" value="java" />
<option name="manufacturer" value="Motorola" />
<option name="name" value="G20" />
<option name="screenDensity" value="280" />
<option name="screenX" value="720" />
<option name="screenY" value="1600" />
</PersistentDeviceSelectionData>
<PersistentDeviceSelectionData>
<option name="api" value="33" />
<option name="brand" value="google" />
<option name="codename" value="lynx" />
<option name="id" value="lynx" />
<option name="manufacturer" value="Google" />
<option name="name" value="Pixel 7a" />
<option name="screenDensity" value="420" />
<option name="screenX" value="1080" />
<option name="screenY" value="2400" />
</PersistentDeviceSelectionData>
<PersistentDeviceSelectionData>
<option name="api" value="31" />
<option name="brand" value="google" />
<option name="codename" value="oriole" />
<option name="id" value="oriole" />
<option name="manufacturer" value="Google" />
<option name="name" value="Pixel 6" />
<option name="screenDensity" value="420" />
<option name="screenX" value="1080" />
<option name="screenY" value="2400" />
</PersistentDeviceSelectionData>
<PersistentDeviceSelectionData>
<option name="api" value="33" />
<option name="brand" value="google" />
<option name="codename" value="panther" />
<option name="id" value="panther" />
<option name="manufacturer" value="Google" />
<option name="name" value="Pixel 7" />
<option name="screenDensity" value="420" />
<option name="screenX" value="1080" />
<option name="screenY" value="2400" />
</PersistentDeviceSelectionData>
<PersistentDeviceSelectionData>
<option name="api" value="31" />
<option name="brand" value="samsung" />
<option name="codename" value="q2q" />
<option name="id" value="q2q" />
<option name="manufacturer" value="Samsung" />
<option name="name" value="Galaxy Z Fold3" />
<option name="screenDensity" value="420" />
<option name="screenX" value="1768" />
<option name="screenY" value="2208" />
</PersistentDeviceSelectionData>
<PersistentDeviceSelectionData>
<option name="api" value="34" />
<option name="brand" value="samsung" />
<option name="codename" value="q5q" />
<option name="id" value="q5q" />
<option name="manufacturer" value="Samsung" />
<option name="name" value="Galaxy Z Fold5" />
<option name="screenDensity" value="420" />
<option name="screenX" value="1812" />
<option name="screenY" value="2176" />
</PersistentDeviceSelectionData>
<PersistentDeviceSelectionData>
<option name="api" value="30" />
<option name="brand" value="google" />
<option name="codename" value="r11" />
<option name="id" value="r11" />
<option name="manufacturer" value="Google" />
<option name="name" value="Pixel Watch" />
<option name="screenDensity" value="320" />
<option name="screenX" value="384" />
<option name="screenY" value="384" />
<option name="type" value="WEAR_OS" />
</PersistentDeviceSelectionData>
<PersistentDeviceSelectionData>
<option name="api" value="30" />
<option name="brand" value="google" />
<option name="codename" value="redfin" />
<option name="id" value="redfin" />
<option name="manufacturer" value="Google" />
<option name="name" value="Pixel 5" />
<option name="screenDensity" value="440" />
<option name="screenX" value="1080" />
<option name="screenY" value="2340" />
</PersistentDeviceSelectionData>
<PersistentDeviceSelectionData>
<option name="api" value="34" />
<option name="brand" value="google" />
<option name="codename" value="shiba" />
<option name="id" value="shiba" />
<option name="manufacturer" value="Google" />
<option name="name" value="Pixel 8" />
<option name="screenDensity" value="420" />
<option name="screenX" value="1080" />
<option name="screenY" value="2400" />
</PersistentDeviceSelectionData>
<PersistentDeviceSelectionData>
<option name="api" value="33" />
<option name="brand" value="google" />
<option name="codename" value="tangorpro" />
<option name="id" value="tangorpro" />
<option name="manufacturer" value="Google" />
<option name="name" value="Pixel Tablet" />
<option name="screenDensity" value="320" />
<option name="screenX" value="1600" />
<option name="screenY" value="2560" />
</PersistentDeviceSelectionData>
<PersistentDeviceSelectionData>
<option name="api" value="29" />
<option name="brand" value="samsung" />
<option name="codename" value="x1q" />
<option name="id" value="x1q" />
<option name="manufacturer" value="Samsung" />
<option name="name" value="Galaxy S20" />
<option name="screenDensity" value="480" />
<option name="screenX" value="1440" />
<option name="screenY" value="3200" />
</PersistentDeviceSelectionData>
</list>
</option>
</component>
</project>
Generated
-6
View File
@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>
+81
View File
@@ -0,0 +1,81 @@
# Working on Paperize
An Android app that changes the home and lock screen wallpaper on a schedule: Kotlin, Jetpack Compose, Material 3, Hilt, Room. Users get it from GitHub releases, F-Droid and IzzyOnDroid.
## Code
- Simple and direct. No speculative abstractions, options or extension points.
- Stay in scope; suggest extras instead of adding them.
- Use what the platform, framework, dependencies and this repo already provide before writing a helper.
- Validate only at real boundaries (user input, storage, network, other processes). No checks, fallbacks or try/catch for cases that can't happen.
- One source of truth for each value or rule.
- Delete dead code you find or create.
- Match the surrounding code.
- Fix root causes, and fix the same pattern everywhere it occurs.
## Comments
- Only where the reason isn't clear from the code: a quirk, a race, a non-obvious decision.
- Short fragments, not sentences. Never restate code, narrate, or label sections.
- Delete comments that no longer match.
## Tests
- Behaviour and the edges that can break. No trivial, duplicate, obvious or low-signal tests.
- A regression test fails without its fix.
- Deterministic: fake time and observable events, no sleeps.
- A failing test is a bug until shown otherwise.
## Paperize
- The UI can only be seen on an emulator or device. Run `./gradlew connectedDebugAndroidTest` there for anything touching rendering, scheduling, storage or imports.
- Dynamic colour swaps the brand palette for the system one, so a design must work with it on and off.
- English is the source language. Translations come through Crowdin: the sync workflow uploads `values/strings.xml` and opens its own pull request with approved translations only, adding a locale once most of it is approved. Add or reword strings in English only, and remove deleted strings from every locale. A locale file fixed by hand must also be sent to Crowdin with the sync workflow's upload option, or a later sync can replace the fix.
- A database schema change needs a migration that keeps user data, never a destructive fallback. Commit the exported schema.
- `metadata/en-US` is the F-Droid and IzzyOnDroid store listing: keep its text and screenshots true to the app.
- F-Droid rebuilds every release from source and compares it with the GitHub APK, so the build must stay reproducible. Its recipe deletes the `foojay` line from `settings.gradle.kts` with `sed`: keep that plugin on one line, and keep `dependenciesInfo` off.
- F-Droid pins the commit of every version: never rewrite a released commit or move a tag. `crowdin-translations` and `media` are live branches, not stale ones.
- `app/lint-baseline.xml` holds only deliberate exceptions; fix new warnings instead of adding them to it.
## Done means
- Diff reviewed against this file.
- `./gradlew testDebugUnitTest lintDebug` passes with zero warnings.
- UI changes seen in the running app, light and dark. Docs and metadata changes need no end-to-end run.
- README updated for anything users will notice; behaviour changes called out.
## Docs
- README is for users: what it does, how to get it, how to use it. No internals, no agent instructions.
- This file is for agents: only what can't be found quickly in the code.
- No meta docs in the repo (notes, audits, plans, reports).
## Git
- `type: summary` or `type(scope): summary`: lowercase, imperative, no full stop, about 70 characters at most. Types: `feat` `fix` `refactor` `perf` `test` `docs` `style` `build` `ci` `chore`.
- Body only to say why. `Fixes #123` closes an issue.
- One logical change per commit. Squash fix-ups before merging.
- Branch off `master`. A single commit fast-forwards; several merge with `merge: <summary>`.
- No AI attribution in commits, branches, PRs or releases.
- One maintainer: amending and force-pushing to tidy history is fine. Keep contributors as authors. Delete stale branches.
## Pull requests
- Title in commit format. Body: what changed, why, how it was checked. Short.
## Releases
- Bump commit `chore: release vX.Y.Z`; tag `vX.Y.Z`.
- A pushed `v*` tag is the store submission. F-Droid picks the tag up by itself as soon as it is pushed, builds it, and compares its build with the release APK. CI attaches the signed `paperize-vX.Y.Z.apk` to the draft release for that tag, reusing a draft that already has the notes, but the APK is not public while the release is a draft: publish the draft as soon as CI has attached the APK, or the F-Droid comparison fails and has to be retried. Never rename a tag or asset.
- Title `Paperize X.Y.Z`.
- Notes: banner image first, then `### New`, `### Improved`, `### Fixed` (only those that apply). One line per change, written for users; no internals, dependency lists or test counts. End with the install links (APK, F-Droid, IzzyOnDroid) and the full changelog link.
- Banner: generated and hosted on the orphan `media` branch; use `https://raw.githubusercontent.com/Anthonyy232/Paperize/media/releases/vX.Y.Z.png`.
- The README, site and store listing images are built on the `media` branch too, from emulator captures; its README has the steps for both.
- The site in `site/` hosts the privacy policy the store listing links to at `#privacy`; keep that anchor.
## Agents
- Pushing, amending and force-pushing are allowed. Ask before publishing a release or submitting to a store.
- Leave changes you didn't make alone. Clean up scratch files, processes and emulators.
- Say what was checked and how, and what wasn't.
- Short replies; one recommendation, not a list of options.
+76 -63
View File
@@ -1,88 +1,101 @@
<picture>
<source media="(prefers-color-scheme: dark)" srcset=".github/readme/hero-dark.png">
<img src=".github/readme/hero-light.png" alt="Paperize: a fresh wallpaper, right on time. Three phones show the wallpaper tab, the album library and the effects.">
</picture>
<div align="center">
<img width="300" height="300" style="display: block; border-radius: 9999px;" src="https://github.com/Anthonyy232/Paperize/assets/60626873/c40018a1-bc0a-4efd-bd4a-bc83fb23589e">
<h1>Paperize</h1>
<p align="center">
<p align="center">
<a href="https://github.com/Anthonyy232/Paperize/releases/latest"><b>Download the APK</b></a>
&nbsp;·&nbsp;
<a href="https://f-droid.org/en/packages/com.anthonyla.paperize/"><b>F-Droid</b></a>
&nbsp;·&nbsp;
<a href="https://apt.izzysoft.de/fdroid/index/apk/com.anthonyla.paperize"><b>IzzyOnDroid</b></a>
&nbsp;·&nbsp;
<a href="https://anthonyy232.github.io/Paperize/"><b>Website</b></a>
</p>
<p>Paperize is a dynamic wallpaper changer application designed to keep your device's aesthetic fresh and exciting</p>
</div>
Paperize is an Android app that changes your home and lock screen wallpaper on a schedule, from albums you build out of your own images and folders. It works offline, has no internet permission, and needs Android 12 or newer.
<picture>
<source media="(prefers-color-scheme: dark)" srcset=".github/readme/feature-albums-dark.png">
<img src=".github/readme/feature-albums-light.png" alt="01. Albums, on rotation. The library with two albums, and an album open showing its wallpapers.">
</picture>
## Features
- **Dynamic Wallpaper Changer**: Set your wallpaper to change at specific time intervals
- **Supports Various Image Types**: Paperize can handle a wide range of image types
- Including: JPEG, PNG, AVIF, WEBP
- **Folder Support**: Organize your wallpapers into folders for auto-updating
- **Home and Lock Screen Wallpaper**: Choose to change either your home screen, lock screen, or both
- **On-Device Storage**: All your wallpapers and settings are stored on your device
<div align="center">
<br/>
<img src="https://github.com/Anthonyy232/Paperize/assets/60626873/57122f72-78f8-45ed-a9ac-de943061d6a2" width="30%" alt="onboarding" />
<img src="https://github.com/Anthonyy232/Paperize/assets/60626873/9f41d715-7b14-4ff2-9c30-87ad3d86d94c" width="30%" alt="wallpaper" />
<img src="https://github.com/Anthonyy232/Paperize/assets/60626873/47aa95c3-ef80-4c3c-a8cd-a51ac6824507" width="30%" alt="interval" />
<img src="https://github.com/Anthonyy232/Paperize/assets/60626873/4ce1b28d-f4b2-4048-a261-203156222263" width="30%" alt="album" />
<img src="https://github.com/Anthonyy232/Paperize/assets/60626873/66b092e5-4af4-4396-b145-63ee506d9257" width="30%" alt="settings" />
<br/>
<br/>
<div><video controls src="https://github.com/Anthonyy232/Paperize/assets/60626873/015afb04-e3f3-4641-b8f9-707cfa26d16f" muted="true"></video></div>
</div>
An album holds single images, whole folders, or both. Paperize rescans folders each time you open the app, and once a day while a schedule is running, so new files join the rotation and deleted ones leave it by themselves; **Refresh folder** rescans one straight away. Removing something from an album never touches the file on your device.
## Download
[<img src="https://play.google.com/intl/en_us/badges/static/images/badges/en_badge_web_generic.png" alt="Download app from Google Play" height="80">](https://play.google.com/store/apps/details?id=com.anthonyla.paperize)
[<img src="https://github.com/Anthonyy232/Paperize/assets/60626873/1c034414-21cd-4a0a-838d-89fe7bd56910" alt="Download app from GitHub" height="80">](https://github.com/Anthonyy232/Paperize/releases)
Supported formats: JPG, PNG, WEBP, AVIF, HEIC/HEIF, BMP, GIF and TIFF.
F-Droid will be added soon
<picture>
<source media="(prefers-color-scheme: dark)" srcset=".github/readme/feature-schedule-dark.png">
<img src=".github/readme/feature-schedule-light.png" alt="02. Home and lock, your call. The wallpaper tab with the current lock and home wallpapers, an album for each, and the time interval.">
</picture>
## Localization
I want to allow more people to use the app. Currently, translations are provided using machine translation and AI -- which is not optimal.
Turn on **Lock**, **Home** or both and pick an album for each. One interval covers both screens, from 15 minutes to 30 days; **Individual Scheduling** gives each screen its own. Wallpapers go in order unless **Shuffle** is on.
I would love some help translating the app! Help me out with that [here](https://crowdin.com/project/paperize/invite?h=d8d7a7513d2beb0c96ba9b2a5f85473e2084922)!
<picture>
<source media="(prefers-color-scheme: dark)" srcset=".github/readme/feature-effects-dark.png">
<img src=".github/readme/feature-effects-light.png" alt="03. Effects, to taste. Brightness, blur and vignette, each with a switch for home and lock and a strength slider.">
</picture>
[![Crowdin](https://badges.crowdin.net/paperize/localized.svg)](https://crowdin.com/project/paperize)
Brightness, blur, vignette and a gray filter each have a strength slider and separate switches for home and lock. **Adaptive Brightness** adjusts the wallpaper to the system's light or dark mode. Scaling is Fill, Fit, Stretch or None, and **Horizontal scrolling** lets a wide Fill wallpaper move between home-screen pages.
## Technologies
## How it works
- [Kotlin](https://kotlinlang.org/) - A programming language that is used for Android app development
- [Jetpack Compose](https://developer.android.com/develop/ui/compose) - A declarative UI toolkit for building native Android UI
- [Material 3](https://m3.material.io/) - A UI design system git for modern UI guidelines
- [Dagger Hilt](https://dagger.dev/hilt/) - A dependency injection library
- [Room](https://developer.android.com/training/data-storage/room) - A persistence library that provides an abstraction layer over SQLite interfacing with Kotlin
- [AboutLibraries](https://github.com/mikepenz/AboutLibraries) - A library to offer some information of libraries
- [Lottie Compose](https://github.com/airbnb/lottie) - A library that provides Lottie animation support for Jetpack Compose
- [Landscapist](https://github.com/skydoves/landscapist) - A Compose and KPP image loading library that streamlines Glide, Coil, and Fresco
- [Zoomable](https://github.com/usuiat/Zoomable) - A library that provides a zoomable and pannable view, which can be used with any view you want
- [AnimatedFABMenu](https://github.com/rajaumair7890/AnimatedFABMenu) - A animated floating action button with Material 3 design
- [DocumentFileCompat](https://github.com/ItzNotABug/DocumentFileCompat) - A DocumentFile wrapper that caches the result to improve efficiency
1. On first launch, choose **Static Mode** or **Live Wallpaper Mode**.
2. In **Library**, tap **+** to create an album, then add images or a folder to it.
3. In **Wallpaper**, choose the screens and their albums, and set the time interval.
4. Leave the rest to Paperize. **Wallpaper changing** pauses and resumes the schedule without clearing your albums.
Thanks to the creators and maintainers of the open-source libraries used in this project.
To skip ahead, use **Change wallpaper now** in the app, the Quick Settings tile, or the shortcut you get by long-pressing the app icon. In static mode you can also open any image in an album and set it as the wallpaper yourself. Tick **Continue rotation from here** to have the rotation carry on from that image; it is off by default and hidden while **Shuffle** is on.
## Build
## Static and live modes
This project is built using Kotlin, Java, and Gradle. Here are the steps to build the project:
**Static mode** sets ordinary wallpapers through the system, which is simple and light on the battery.
### Prerequisites
- Java 8 (1.8)
- Android Studio Jellyfish | 2023.3.1 or later
- Android Gradle Plugin 8.4.1 or later
- Gradle 8.8
- Minimum SDK 26
**Live wallpaper mode** runs Paperize as a live wallpaper showing one album on both screens, and adds:
### Steps
- Open a terminal and run the following git command: <pre>git clone https://github.com/Anthonyy232/Paperize.git </pre>
- Launch Android Studio and choose Open an existing Android Studio project. Navigate to the cloned repository and select the root folder of the project.
- In Android Studio, click on Build -> Generate Signed Bundle / APK and follow the instructions to generate an APK
- Alternatively, click `▶ Run` and build the app and run it immediately
- a crossfade between wallpapers
- **Double-Tap to Change**
- **Change on Screen Off**
- **Parallax Effect**, which moves the wallpaper as you swipe between home-screen pages (your launcher has to support it)
- intervals down to 1 minute; intervals under 15 minutes only run while the wallpaper is visible
Switching modes in Settings resets your albums, wallpapers and settings.
## Contributions
## Settings
All contributions to the app is welcome. Feel free to report any issues and create pull requests for any issues or pull requests.
- **Wallpaper Mode**: switch between static and live.
- **Dark Mode**, **Dynamic Theming** (Material You colours from your system) and **Animation**.
- **Battery Optimization**: Android may delay scheduled changes for apps it optimizes. Exempting Paperize keeps them on time.
- **Reset all data**: clears every album and setting.
Inspiration from j4velin for their wallpaper changer app
## Privacy
Albums and settings stay on your device, and Paperize has no internet permission. Read the [privacy policy](https://anthonyy232.github.io/Paperize/#privacy).
## Translations
Paperize ships in more than 35 languages. To add or improve a language, translate it on [Crowdin](https://crowdin.com/project/paperize). Translations are reviewed there before they reach the app, and a new language is added once 90% of it has been reviewed.
## Building from source
You need Java 17 and the Android SDK (`ANDROID_HOME`, or `sdk.dir` in `local.properties`). Paperize compiles against SDK 37 and runs on Android 12 (SDK 31) and newer.
```bash
git clone https://github.com/Anthonyy232/Paperize.git
cd Paperize
./gradlew assembleDebug
```
The APK lands in `app/build/outputs/apk/debug`. Or open the folder in Android Studio and press Run.
## Contributing
Contributions are welcome. Report bugs in [issues](https://github.com/Anthonyy232/Paperize/issues), suggest features in [Discussions](https://github.com/Anthonyy232/Paperize/discussions), and read [AGENTS.md](AGENTS.md) before opening a pull request.
If Paperize is useful to you, you can support it through [GitHub Sponsors](https://github.com/sponsors/Anthonyy232).
## License
Contact on my GitHub profile
Anthony La © GNU GPL v3.0
Copyright (c) 2023-2026 Anthony La.
Paperize is free software, licensed under the [GNU General Public License v3.0](LICENSE) only, and comes with no warranty.
+3
View File
@@ -0,0 +1,3 @@
# Security
Please report vulnerabilities privately through the repository's [Report a vulnerability](https://github.com/Anthonyy232/Paperize/security/advisories/new) form on GitHub, not in a public issue.
+91 -81
View File
@@ -1,127 +1,137 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
plugins {
id("com.android.application")
id("org.jetbrains.kotlin.android")
id("com.google.devtools.ksp")
id("com.google.dagger.hilt.android")
id("com.mikepenz.aboutlibraries.plugin")
id("org.jetbrains.kotlin.plugin.serialization")
id("org.jetbrains.kotlin.plugin.compose")
alias(libs.plugins.androidApplication)
alias(libs.plugins.kotlinCompose)
alias(libs.plugins.hiltAndroid)
alias(libs.plugins.ksp)
alias(libs.plugins.kotlinSerialization)
}
ksp {
arg("room.schemaLocation", "$projectDir/schemas")
}
android {
namespace = "com.anthonyla.paperize"
compileSdk = 34
compileSdk = 37
signingConfigs {
create("release") {
val storeFilePath = System.getenv("SIGNING_KEYSTORE_PATH")
if (storeFilePath != null) {
storeFile = file(storeFilePath)
storePassword = System.getenv("SIGNING_STORE_PASSWORD")
keyAlias = System.getenv("SIGNING_KEY_ALIAS")
keyPassword = System.getenv("SIGNING_KEY_PASSWORD")
}
}
}
sourceSets.getByName("androidTest").assets.directories.add("$projectDir/schemas")
listOf("test", "androidTest").forEach {
sourceSets.getByName(it).kotlin.directories.add("$projectDir/src/sharedTest/java")
}
defaultConfig {
applicationId = "com.anthonyla.paperize"
minSdk = 26
targetSdk = 34
versionCode = 23
versionName = "1.5.5"
minSdk = 31
targetSdk = 37
versionCode = 61
versionName = "4.3.1"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
useSupportLibrary = true
}
ndk {
debugSymbolLevel = "FULL"
}
}
buildTypes {
release {
isMinifyEnabled = true
isShrinkResources = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
signingConfig = signingConfigs.getByName("release")
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
freeCompilerArgs += strongSkippingConfiguration()
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
buildFeatures {
compose = true
viewBinding = true
buildConfig = true
}
composeOptions {
kotlinCompilerExtensionVersion = "1.5.10"
}
androidResources {
@Suppress("UnstableApiUsage")
generateLocaleConfig = true
}
ndkVersion = "26.3.11579264"
buildToolsVersion = "34.0.0"
aboutLibraries {
excludeFields = arrayOf("generated")
lint {
baseline = file("lint-baseline.xml")
// Crowdin exports no "many" form for Romance languages; Android falls back to "other".
disable += "MissingQuantity"
}
dependenciesInfo {
includeInApk = false
includeInBundle = false
}
}
androidComponents {
onVariants(selector().withBuildType("release")) {
it.packaging.resources.excludes.add("META-INF/**")
kotlin {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_17)
}
}
dependencies {
implementation("androidx.core:core-ktx:1.13.1")
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.8.2")
implementation("androidx.activity:activity-compose:1.9.0")
implementation(platform("androidx.compose:compose-bom:2024.06.00"))
implementation("androidx.compose.ui:ui:1.7.0-beta03")
implementation("androidx.compose.ui:ui-graphics:1.7.0-beta03")
implementation("androidx.compose.ui:ui-tooling-preview:1.7.0-beta03")
implementation("androidx.compose.material3:material3:1.3.0-beta03")
implementation("androidx.navigation:navigation-compose:2.8.0-beta03")
implementation("androidx.compose.material:material:1.7.0-beta03")
implementation("androidx.datastore:datastore:1.1.1")
implementation("androidx.datastore:datastore-preferences:1.1.1")
implementation("androidx.compose.material:material-icons-extended:1.7.0-beta03")
implementation("com.google.accompanist:accompanist-adaptive:0.34.0")
implementation("androidx.hilt:hilt-navigation-compose:1.2.0")
implementation("androidx.compose.animation:animation:1.7.0-beta03")
implementation("androidx.core:core-splashscreen:1.2.0-alpha01")
implementation("androidx.lifecycle:lifecycle-runtime-compose:2.8.2")
implementation("com.google.code.gson:gson:2.11.0")
implementation("androidx.documentfile:documentfile:1.1.0-alpha01")
implementation("net.engawapg.lib:zoomable:1.7.0-beta02")
implementation("com.github.skydoves:landscapist-glide:2.3.4")
implementation("androidx.work:work-runtime-ktx:2.10.0-alpha02")
implementation("androidx.hilt:hilt-work:1.2.0")
implementation("com.airbnb.android:lottie-compose:6.4.1")
implementation("com.google.accompanist:accompanist-permissions:0.35.0-alpha")
implementation("com.mikepenz:aboutlibraries-core:11.2.1")
implementation("com.mikepenz:aboutlibraries-compose-m3:11.2.1")
implementation("androidx.compose.foundation:foundation:1.7.0-beta03")
testImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.test.ext:junit:1.1.5")
androidTestImplementation("androidx.test.espresso:espresso-core:3.6.0-rc01")
androidTestImplementation("androidx.compose.ui:ui-test-junit4:1.7.0-beta03")
debugImplementation("androidx.compose.ui:ui-tooling:1.7.0-beta03")
debugImplementation("androidx.compose.ui:ui-test-manifest:1.7.0-beta03")
implementation("com.google.dagger:hilt-android:2.51.1")
ksp("com.google.dagger:hilt-android-compiler:2.51.1")
implementation("androidx.room:room-runtime:2.6.1")
ksp("androidx.room:room-compiler:2.6.1")
implementation("androidx.room:room-ktx:2.6.1")
implementation("com.lazygeniouz:dfc:1.0.8")
implementation ("org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.0")
implementation("com.github.android:renderscript-intrinsics-replacement-toolkit:b6363490c3")
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.lifecycle.runtime.ktx)
implementation(libs.androidx.lifecycle.process)
implementation(libs.androidx.activity.compose)
implementation(platform(libs.androidx.compose.bom))
implementation(libs.androidx.ui)
implementation(libs.androidx.ui.graphics)
implementation(libs.androidx.material3)
implementation(libs.google.material)
implementation(libs.androidx.navigation.compose)
implementation(libs.coil.compose)
implementation(libs.coil.gif)
implementation(libs.androidx.datastore.preferences)
implementation(libs.androidx.material.icons.extended)
implementation(libs.androidx.hilt.navigation.compose)
implementation(libs.androidx.animation)
implementation(libs.androidx.core.splashscreen)
implementation(libs.androidx.lifecycle.runtime.compose)
implementation(libs.androidx.documentfile)
implementation(libs.zoomable)
implementation(libs.androidx.work.runtime.ktx)
implementation(libs.androidx.hilt.work)
implementation(libs.androidx.foundation)
implementation(libs.androidx.profileinstaller)
testImplementation(libs.junit)
testImplementation(libs.mockk)
testImplementation(libs.kotlinx.coroutines.test)
androidTestImplementation(platform(libs.androidx.compose.bom))
androidTestImplementation(libs.androidx.junit)
androidTestImplementation(libs.androidx.espresso.core)
androidTestImplementation(libs.androidx.exifinterface)
androidTestImplementation(libs.androidx.ui.test.junit4)
debugImplementation(platform(libs.androidx.compose.bom))
debugImplementation(libs.androidx.ui.tooling)
debugImplementation(libs.androidx.ui.test.manifest)
implementation(libs.hilt.android)
ksp(libs.hilt.android.compiler)
ksp(libs.androidx.hilt.compiler)
implementation(libs.androidx.room.runtime)
ksp(libs.androidx.room.compiler)
implementation(libs.androidx.room.ktx)
implementation (libs.kotlinx.serialization.json)
}
private fun strongSkippingConfiguration() = listOf(
"-P",
"plugin:androidx.compose.compiler.plugins.kotlin:experimentalStrongSkipping=true",
)
+15
View File
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<issues format="6" by="lint 9.5.1" type="baseline" client="gradle" dependencies="false" name="AGP (9.5.1)" variant="all" version="9.5.1">
<issue
id="BatteryLife"
message="Use of `REQUEST_IGNORE_BATTERY_OPTIMIZATIONS` violates the Play Store Content Policy regarding acceptable use cases, as described in https://developer.android.com/training/monitoring-device-state/doze-standby.html"
errorLine1=" val intent = Intent(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS).apply {"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/main/java/com/anthonyla/paperize/core/util/BatteryOptimizationUtil.kt"
line="20"
column="42"/>
</issue>
</issues>
+5 -34
View File
@@ -1,37 +1,8 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
# Library consumer rules preserve their runtime entry points. Keep release crash locations.
-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
-keepattributes Signature
-keep class com.google.gson.reflect.TypeToken { *; }
-keep class * extends com.google.gson.reflect.TypeToken
-keep class kotlin.coroutines.Continuation
-keepclassmembers class com.anthonyla.paperize.feature.wallpaper.domain.model.Album {
!transient <fields>;
}
-keepclassmembers class com.anthonyla.paperize.feature.wallpaper.domain.model.AlbumWithWallpaperAndFolder {
!transient <fields>;
}
-keepclassmembers class com.anthonyla.paperize.feature.wallpaper.domain.model.Wallpaper {
!transient <fields>;
}
-keepclassmembers class com.anthonyla.paperize.feature.wallpaper.domain.model.Folder {
!transient <fields>;
# Strip debug and verbose logging from release builds.
-assumenosideeffects class android.util.Log {
public static int d(...);
public static int v(...);
}
@@ -0,0 +1,444 @@
{
"formatVersion": 1,
"database": {
"version": 4,
"identityHash": "d071c2eda238d0ca9c8f55b5bf591395",
"entities": [
{
"tableName": "albums",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `name` TEXT NOT NULL, `coverUri` TEXT, `createdAt` INTEGER NOT NULL, `modifiedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "coverUri",
"columnName": "coverUri",
"affinity": "TEXT"
},
{
"fieldPath": "createdAt",
"columnName": "createdAt",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "modifiedAt",
"columnName": "modifiedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "wallpapers",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `albumId` TEXT NOT NULL, `folderId` TEXT, `uri` TEXT NOT NULL, `fileName` TEXT NOT NULL, `dateModified` INTEGER NOT NULL, `displayOrder` INTEGER NOT NULL, `sourceType` TEXT NOT NULL, `addedAt` INTEGER NOT NULL, `mediaType` TEXT NOT NULL, PRIMARY KEY(`id`), FOREIGN KEY(`albumId`) REFERENCES `albums`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE , FOREIGN KEY(`folderId`) REFERENCES `folders`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "albumId",
"columnName": "albumId",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "folderId",
"columnName": "folderId",
"affinity": "TEXT"
},
{
"fieldPath": "uri",
"columnName": "uri",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "fileName",
"columnName": "fileName",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "dateModified",
"columnName": "dateModified",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "displayOrder",
"columnName": "displayOrder",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "sourceType",
"columnName": "sourceType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "addedAt",
"columnName": "addedAt",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "mediaType",
"columnName": "mediaType",
"affinity": "TEXT",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
},
"indices": [
{
"name": "index_wallpapers_albumId",
"unique": false,
"columnNames": [
"albumId"
],
"orders": [],
"createSql": "CREATE INDEX IF NOT EXISTS `index_wallpapers_albumId` ON `${TABLE_NAME}` (`albumId`)"
},
{
"name": "index_wallpapers_folderId",
"unique": false,
"columnNames": [
"folderId"
],
"orders": [],
"createSql": "CREATE INDEX IF NOT EXISTS `index_wallpapers_folderId` ON `${TABLE_NAME}` (`folderId`)"
},
{
"name": "index_wallpapers_uri",
"unique": false,
"columnNames": [
"uri"
],
"orders": [],
"createSql": "CREATE INDEX IF NOT EXISTS `index_wallpapers_uri` ON `${TABLE_NAME}` (`uri`)"
}
],
"foreignKeys": [
{
"table": "albums",
"onDelete": "CASCADE",
"onUpdate": "NO ACTION",
"columns": [
"albumId"
],
"referencedColumns": [
"id"
]
},
{
"table": "folders",
"onDelete": "CASCADE",
"onUpdate": "NO ACTION",
"columns": [
"folderId"
],
"referencedColumns": [
"id"
]
}
]
},
{
"tableName": "folders",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `albumId` TEXT NOT NULL, `name` TEXT NOT NULL, `uri` TEXT NOT NULL, `coverUri` TEXT, `dateModified` INTEGER NOT NULL, `displayOrder` INTEGER NOT NULL, `addedAt` INTEGER NOT NULL, PRIMARY KEY(`id`), FOREIGN KEY(`albumId`) REFERENCES `albums`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "albumId",
"columnName": "albumId",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "uri",
"columnName": "uri",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "coverUri",
"columnName": "coverUri",
"affinity": "TEXT"
},
{
"fieldPath": "dateModified",
"columnName": "dateModified",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "displayOrder",
"columnName": "displayOrder",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "addedAt",
"columnName": "addedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
},
"indices": [
{
"name": "index_folders_albumId",
"unique": false,
"columnNames": [
"albumId"
],
"orders": [],
"createSql": "CREATE INDEX IF NOT EXISTS `index_folders_albumId` ON `${TABLE_NAME}` (`albumId`)"
},
{
"name": "index_folders_uri",
"unique": false,
"columnNames": [
"uri"
],
"orders": [],
"createSql": "CREATE INDEX IF NOT EXISTS `index_folders_uri` ON `${TABLE_NAME}` (`uri`)"
}
],
"foreignKeys": [
{
"table": "albums",
"onDelete": "CASCADE",
"onUpdate": "NO ACTION",
"columns": [
"albumId"
],
"referencedColumns": [
"id"
]
}
]
},
{
"tableName": "wallpaper_queue",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `albumId` TEXT NOT NULL, `wallpaperId` TEXT NOT NULL, `screenType` TEXT NOT NULL, `queuePosition` INTEGER NOT NULL, `addedAt` INTEGER NOT NULL, FOREIGN KEY(`albumId`) REFERENCES `albums`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE , FOREIGN KEY(`wallpaperId`) REFERENCES `wallpapers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "albumId",
"columnName": "albumId",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "wallpaperId",
"columnName": "wallpaperId",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "screenType",
"columnName": "screenType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "queuePosition",
"columnName": "queuePosition",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "addedAt",
"columnName": "addedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": true,
"columnNames": [
"id"
]
},
"indices": [
{
"name": "index_wallpaper_queue_albumId_screenType",
"unique": false,
"columnNames": [
"albumId",
"screenType"
],
"orders": [],
"createSql": "CREATE INDEX IF NOT EXISTS `index_wallpaper_queue_albumId_screenType` ON `${TABLE_NAME}` (`albumId`, `screenType`)"
},
{
"name": "index_wallpaper_queue_wallpaperId",
"unique": false,
"columnNames": [
"wallpaperId"
],
"orders": [],
"createSql": "CREATE INDEX IF NOT EXISTS `index_wallpaper_queue_wallpaperId` ON `${TABLE_NAME}` (`wallpaperId`)"
},
{
"name": "index_wallpaper_queue_queuePosition",
"unique": false,
"columnNames": [
"queuePosition"
],
"orders": [],
"createSql": "CREATE INDEX IF NOT EXISTS `index_wallpaper_queue_queuePosition` ON `${TABLE_NAME}` (`queuePosition`)"
}
],
"foreignKeys": [
{
"table": "albums",
"onDelete": "CASCADE",
"onUpdate": "NO ACTION",
"columns": [
"albumId"
],
"referencedColumns": [
"id"
]
},
{
"table": "wallpapers",
"onDelete": "CASCADE",
"onUpdate": "NO ACTION",
"columns": [
"wallpaperId"
],
"referencedColumns": [
"id"
]
}
]
},
{
"tableName": "wallpaper_current",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`albumId` TEXT NOT NULL, `screenType` TEXT NOT NULL, `wallpaperId` TEXT NOT NULL, `appliedAt` INTEGER NOT NULL, PRIMARY KEY(`albumId`, `screenType`), FOREIGN KEY(`albumId`) REFERENCES `albums`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE , FOREIGN KEY(`wallpaperId`) REFERENCES `wallpapers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
"fields": [
{
"fieldPath": "albumId",
"columnName": "albumId",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "screenType",
"columnName": "screenType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "wallpaperId",
"columnName": "wallpaperId",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "appliedAt",
"columnName": "appliedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"albumId",
"screenType"
]
},
"indices": [
{
"name": "index_wallpaper_current_wallpaperId",
"unique": false,
"columnNames": [
"wallpaperId"
],
"orders": [],
"createSql": "CREATE INDEX IF NOT EXISTS `index_wallpaper_current_wallpaperId` ON `${TABLE_NAME}` (`wallpaperId`)"
}
],
"foreignKeys": [
{
"table": "albums",
"onDelete": "CASCADE",
"onUpdate": "NO ACTION",
"columns": [
"albumId"
],
"referencedColumns": [
"id"
]
},
{
"table": "wallpapers",
"onDelete": "CASCADE",
"onUpdate": "NO ACTION",
"columns": [
"wallpaperId"
],
"referencedColumns": [
"id"
]
}
]
}
],
"setupQueries": [
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, 'd071c2eda238d0ca9c8f55b5bf591395')"
]
}
}
@@ -0,0 +1,225 @@
package com.anthonyla.paperize.core.util
import android.content.ContentProvider
import android.content.ContentResolver
import android.content.ContentValues
import android.content.Context
import android.content.ContextWrapper
import android.database.Cursor
import android.database.MatrixCursor
import android.net.Uri
import android.os.Bundle
import android.os.CancellationSignal
import android.provider.DocumentsContract
import android.provider.OpenableColumns
import androidx.room.Room
import androidx.test.core.app.ApplicationProvider
import androidx.test.ext.junit.runners.AndroidJUnit4
import com.anthonyla.paperize.data.database.PaperizeDatabase
import com.anthonyla.paperize.data.database.entities.AlbumEntity
import com.anthonyla.paperize.data.database.entities.WallpaperEntity
import com.anthonyla.paperize.data.source.isDocumentMissing
import com.anthonyla.paperize.data.source.scanFolderImages
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking
import org.junit.Assert.*
import org.junit.Test
import org.junit.runner.RunWith
import java.util.concurrent.CountDownLatch
import java.util.concurrent.TimeUnit
@RunWith(AndroidJUnit4::class)
class DocumentAccessInstrumentedTest {
private val appContext = ApplicationProvider.getApplicationContext<Context>()
private val provider = TestProvider()
private val resolver = ContentResolver.wrap(provider)
private val context = object : ContextWrapper(appContext) {
override fun getContentResolver(): ContentResolver = resolver
}
private val documentUri = Uri.parse("content://test/document/image")
private val treeUri = Uri.parse("content://test/tree/root")
@Test fun missingRequiresACompleteSuccessfulQuery() {
provider.answer = { MatrixCursor(arrayOf(OpenableColumns.DISPLAY_NAME)) }
assertTrue(documentUri.isDocumentMissing(resolver))
provider.answer = { MatrixCursor(arrayOf(OpenableColumns.DISPLAY_NAME)).apply { addRow(arrayOf<Any>("photo")) } }
assertFalse(documentUri.isDocumentMissing(resolver))
provider.answer = { null }
assertFalse(documentUri.isDocumentMissing(resolver))
provider.answer = { throw SecurityException("Permission revoked") }
assertFalse(documentUri.isDocumentMissing(resolver))
provider.answer = { throw IllegalStateException("Offline") }
assertFalse(documentUri.isDocumentMissing(resolver))
}
@Test fun loadingAndErrorResponsesDoNotProveDeletion() {
for (metadata in listOf(
Bundle().apply { putBoolean(DocumentsContract.EXTRA_LOADING, true) },
Bundle().apply { putString(DocumentsContract.EXTRA_ERROR, "Offline") }
)) {
provider.answer = {
MatrixCursor(arrayOf(OpenableColumns.DISPLAY_NAME)).apply { extras = metadata }
}
assertFalse(documentUri.isDocumentMissing(resolver))
}
}
@Test fun scanRejectsPartialResultsAndClosesItsCursor() = runBlocking {
val cursor = directoryCursor().apply {
addRow(arrayOf<Any>("image", "photo.png", "image/png", 1L))
extras = Bundle().apply { putBoolean(DocumentsContract.EXTRA_LOADING, true) }
}
provider.answer = { cursor }
try {
treeUri.scanFolderImages(context)
fail("Expected incomplete scan failure")
} catch (_: java.io.IOException) { }
assertTrue(cursor.isClosed)
}
@Test fun scanDetectsCyclesAndKeepsMetadata() = runBlocking {
provider.answer = { uri ->
when (DocumentsContract.getDocumentId(uri)) {
"root" -> directoryCursor().apply {
addRow(arrayOf<Any>("child", "Child", DocumentsContract.Document.MIME_TYPE_DIR, 0L))
addRow(arrayOf<Any>("image", "photo.PNG", "image/png", 42L))
}
else -> directoryCursor().apply {
addRow(arrayOf<Any>("root", "Root", DocumentsContract.Document.MIME_TYPE_DIR, 0L))
addRow(arrayOf<Any>("image", "photo.PNG", "image/png", 42L))
}
}
}
val found = treeUri.scanFolderImages(context)
assertEquals(1, found.size)
assertEquals("photo.PNG", found.single().name)
assertEquals(42L, found.single().modifiedAt)
assertEquals(2, provider.queries)
}
@Test fun scanSkipsTrashedFilesButKeepsImagesInHiddenFolders() = runBlocking {
provider.answer = { uri ->
when (DocumentsContract.getDocumentId(uri)) {
"root" -> directoryCursor().apply {
addRow(arrayOf<Any>("trashed", ".trashed54970.jpg", "image/jpeg", 1L))
addRow(arrayOf<Any>("trash", ".Trash-123.png", "image/png", 2L))
addRow(arrayOf<Any>("primary:Pictures/.trashed-1797497267-old.jpg", "old.jpg", "image/jpeg", 5L))
addRow(arrayOf<Any>("primary:.trashed-1797497267-top.jpg", "top.jpg", "image/jpeg", 6L))
addRow(arrayOf<Any>("primary:Pictures/.walls", ".walls", DocumentsContract.Document.MIME_TYPE_DIR, 0L))
addRow(arrayOf<Any>("plain", "photo.jpg", "image/jpeg", 3L))
}
"primary:Pictures/.walls" -> directoryCursor().apply {
addRow(arrayOf<Any>("primary:Pictures/.walls/wall.png", "wall.png", "image/png", 4L))
}
else -> directoryCursor()
}
}
val found = treeUri.scanFolderImages(context)
assertEquals(setOf("photo.jpg", "wall.png"), found.map { it.name }.toSet())
}
@Test fun failureInChildFolderDoesNotReturnPartialImport() = runBlocking {
provider.answer = { uri ->
if (DocumentsContract.getDocumentId(uri) == "root") directoryCursor().apply {
addRow(arrayOf<Any>("image", "photo.png", "image/png", 42L))
addRow(arrayOf<Any>("child", "Child", DocumentsContract.Document.MIME_TYPE_DIR, 0L))
} else null
}
try {
treeUri.scanFolderImages(context)
fail("Expected child folder failure")
} catch (_: java.io.IOException) { }
}
@Test fun cancellingAnActiveScanCancelsTheProviderQuery() = runBlocking {
val started = CountDownLatch(1)
val cancelled = CountDownLatch(1)
provider.onQuery = { signal ->
signal?.setOnCancelListener { cancelled.countDown() }
started.countDown()
check(cancelled.await(5, TimeUnit.SECONDS)) { "Provider query was not cancelled" }
signal?.throwIfCanceled()
}
val scan = launch(Dispatchers.IO) { treeUri.scanFolderImages(context) }
assertTrue(started.await(5, TimeUnit.SECONDS))
scan.cancel()
scan.join()
assertEquals(0L, cancelled.count)
}
@Test fun cleanupHandlesDuplicateUrisAndConcurrentReorderingWithoutTouchingOtherAlbums() = runBlocking {
val db = Room.inMemoryDatabaseBuilder(context, PaperizeDatabase::class.java).build()
try {
db.albumDao().insertAlbum(AlbumEntity("one", "One", documentUri.toString(), 0L, 0L))
db.albumDao().insertAlbum(AlbumEntity("two", "Two", null, 0L, 0L))
val uri = documentUri.toString()
val missing = WallpaperEntity("first", "one", null, uri, "photo.png", 0L)
db.wallpaperDao().insertWallpapers((0..504).map { missing.copy(id = "missing-$it") })
db.wallpaperDao().insertWallpapers(listOf(missing.copy(id = "other-album", albumId = "two")))
provider.answer = {
if (provider.queries == 1) {
// Move an unread image before the first page while that page is being scanned.
db.openHelper.writableDatabase.execSQL("UPDATE wallpapers SET displayOrder = -1 WHERE id = 'missing-99'")
}
MatrixCursor(arrayOf(OpenableColumns.DISPLAY_NAME))
}
val repository = com.anthonyla.paperize.data.repository.AlbumRepositoryImpl(
com.anthonyla.paperize.data.source.AndroidDocumentSource(context), db)
assertEquals(505, repository.pruneMissingEntries("one"))
assertEquals(0, db.wallpaperDao().getWallpaperIdsByAlbum("one").size)
assertNull(db.albumDao().getAlbumById("one")?.coverUri)
assertNotNull(db.wallpaperDao().getWallpaperById("other-album"))
} finally { db.close() }
}
@Test fun cancelledCleanupDoesNotLeavePartialDeletions() = runBlocking {
val db = Room.inMemoryDatabaseBuilder(context, PaperizeDatabase::class.java).build()
try {
db.albumDao().insertAlbum(AlbumEntity("album", "Album", "content://test/document/first"))
db.wallpaperDao().insertWallpapers(listOf("first", "second").map {
WallpaperEntity(it, "album", null, "content://test/document/$it", "$it.png", 0L)
})
provider.answer = {
if (provider.queries == 2) throw kotlinx.coroutines.CancellationException()
MatrixCursor(arrayOf(OpenableColumns.DISPLAY_NAME))
}
val repository = com.anthonyla.paperize.data.repository.AlbumRepositoryImpl(
com.anthonyla.paperize.data.source.AndroidDocumentSource(context), db)
try {
repository.pruneMissingEntries("album")
fail("Expected cancellation")
} catch (_: kotlinx.coroutines.CancellationException) { }
assertEquals(2, db.wallpaperDao().getWallpaperIdsByAlbum("album").size)
assertEquals("content://test/document/first", db.albumDao().getAlbumById("album")?.coverUri)
} finally { db.close() }
}
private fun directoryCursor() = MatrixCursor(arrayOf(
DocumentsContract.Document.COLUMN_DOCUMENT_ID,
DocumentsContract.Document.COLUMN_DISPLAY_NAME,
DocumentsContract.Document.COLUMN_MIME_TYPE,
DocumentsContract.Document.COLUMN_LAST_MODIFIED
))
private class TestProvider : ContentProvider() {
var queries = 0
var answer: (Uri) -> Cursor? = { null }
var onQuery: ((CancellationSignal?) -> Unit)? = null
override fun onCreate() = true
override fun query(uri: Uri, projection: Array<out String>?, selection: String?,
selectionArgs: Array<out String>?, sortOrder: String?): Cursor? {
queries++
return answer(uri)
}
override fun query(uri: Uri, projection: Array<out String>?, selection: String?,
selectionArgs: Array<out String>?, sortOrder: String?, cancellationSignal: CancellationSignal?): Cursor? {
onQuery?.invoke(cancellationSignal)
return query(uri, projection, selection, selectionArgs, sortOrder)
}
override fun getType(uri: Uri): String? = null
override fun insert(uri: Uri, values: ContentValues?): Uri? = null
override fun delete(uri: Uri, selection: String?, selectionArgs: Array<out String>?) = 0
override fun update(uri: Uri, values: ContentValues?, selection: String?, selectionArgs: Array<out String>?) = 0
}
}
@@ -0,0 +1,251 @@
package com.anthonyla.paperize.core.util
import android.graphics.Bitmap
import android.graphics.Color
import android.net.Uri
import androidx.exifinterface.media.ExifInterface
import androidx.test.core.app.ApplicationProvider
import androidx.test.ext.junit.runners.AndroidJUnit4
import com.anthonyla.paperize.core.ScalingType
import java.io.File
import org.junit.After
import org.junit.Assert.assertEquals
import org.junit.Assert.assertNotNull
import org.junit.Assert.assertSame
import org.junit.Assert.assertTrue
import org.junit.Test
import org.junit.runner.RunWith
@RunWith(AndroidJUnit4::class)
class WallpaperUtilInstrumentedTest {
private val context = ApplicationProvider.getApplicationContext<android.content.Context>()
private val files = mutableListOf<File>()
@After
fun cleanUp() {
files.forEach(File::delete)
}
@Test
fun narrowImagesRetainAtLeastOnePixelInBothDecodePaths() {
val image = createJpeg(width = 1, height = 1000)
val uri = Uri.fromFile(image)
for (scaling in listOf(ScalingType.FIT, ScalingType.NONE)) {
val live = com.anthonyla.paperize.service.livewallpaper.renderer.ContentUriImageLoader(
context.contentResolver, uri, scaling
).load(20, 20)
assertNotNull(live)
assertEquals(1, live?.width)
assertEquals(if (scaling == ScalingType.FIT) 20 else 40, live?.height)
live?.recycle()
val static = retrieveBitmap(context, uri, 20, 20, scaling)
assertNotNull(static)
assertEquals(20, static?.width)
assertEquals(20, static?.height)
static?.recycle()
}
}
@Test
fun imageDecoderAppliesExifRotation() {
val image = createJpeg(width = 40, height = 20)
ExifInterface(image).apply {
setAttribute(
ExifInterface.TAG_ORIENTATION,
ExifInterface.ORIENTATION_ROTATE_90.toString()
)
saveAttributes()
}
val result = retrieveBitmap(
context = context,
wallpaperUri = Uri.fromFile(image),
width = 20,
height = 40,
scaling = ScalingType.FILL,
preserveSourceOverflow = true
)
// Rotated, the 20x40 source covers the canvas at scale 1. Unrotated, the 40x20 source
// would need scale 2 to cover the height and come back 80x40.
assertNotNull(result)
assertEquals(20, result?.width)
assertEquals(40, result?.height)
result?.recycle()
}
@Test
fun staticFillRetainsWideSourceOverflow() {
val image = createJpeg(width = 400, height = 200)
val scrolling = retrieveBitmap(
context = context,
wallpaperUri = Uri.fromFile(image),
width = 100,
height = 200,
scaling = ScalingType.FILL,
preserveSourceOverflow = true
)
val exactCanvas = retrieveBitmap(
context = context,
wallpaperUri = Uri.fromFile(image),
width = 100,
height = 200,
scaling = ScalingType.FILL,
preserveSourceOverflow = false
)
assertEquals(400, scrolling?.width)
assertEquals(200, scrolling?.height)
assertEquals(100, exactCanvas?.width)
assertEquals(200, exactCanvas?.height)
scrolling?.recycle()
exactCanvas?.recycle()
}
@Test
fun everyStaticScalingModeProducesOneExactScreenCanvas() {
val image = createJpeg(width = 160, height = 90)
ScalingType.entries.forEach { scaling ->
val result = retrieveBitmap(
context = context,
wallpaperUri = Uri.fromFile(image),
width = 120,
height = 200,
scaling = scaling,
preserveSourceOverflow = false
)
assertNotNull("Expected a bitmap for $scaling", result)
assertEquals("Unexpected width for $scaling", 120, result?.width)
assertEquals("Unexpected height for $scaling", 200, result?.height)
result?.recycle()
}
}
@Test
fun fallbackBitmapsUseTheRequestedScalingAndCenterCrop() {
ScalingType.entries.forEach { scaling ->
val source = mutableBitmap(80, 40, Color.RED)
for (y in 0 until 40) {
for (x in 20 until 60) source.setPixel(x, y, Color.GREEN)
}
val result = finalizeToCanvas(source, 40, 80, scaling)
try {
assertTrue(source.isRecycled)
assertEquals(40, result.width)
assertEquals(80, result.height)
assertEquals("Center for $scaling", Color.GREEN, result.getPixel(20, 40))
val top = if (scaling == ScalingType.FIT || scaling == ScalingType.NONE) Color.BLACK else Color.GREEN
assertEquals("Top for $scaling", top, result.getPixel(20, 0))
val side = if (scaling == ScalingType.FIT || scaling == ScalingType.STRETCH) Color.RED else Color.GREEN
assertEquals("Side for $scaling", side, result.getPixel(2, 40))
} finally {
result.recycle()
}
}
}
@Test
fun disabledStaticEffectsLeaveBitmapUntouched() {
val source = mutableBitmap(32, 32, Color.rgb(240, 80, 20))
val result = processBitmap(
source = source,
enableDarken = false,
darkenPercent = 100,
enableBlur = false,
blurPercent = 100,
enableVignette = false,
vignettePercent = 100,
enableGrayscale = false,
grayscalePercent = 100
)
assertSame(source, result)
assertEquals(Color.rgb(240, 80, 20), result.getPixel(16, 16))
result.recycle()
}
@Test
fun staticDarkenAndGrayscaleEffectsChangePixels() {
val white = mutableBitmap(32, 32, Color.WHITE)
val darkened = processBitmap(
source = white,
enableDarken = true,
darkenPercent = 100
)
assertTrue(Color.red(darkened.getPixel(16, 16)) <= 2)
if (darkened !== white) white.recycle()
darkened.recycle()
val red = mutableBitmap(32, 32, Color.RED)
val grayscale = processBitmap(
source = red,
enableGrayscale = true,
grayscalePercent = 100
)
val grayPixel = grayscale.getPixel(16, 16)
assertTrue(kotlin.math.abs(Color.red(grayPixel) - Color.green(grayPixel)) <= 2)
assertTrue(kotlin.math.abs(Color.green(grayPixel) - Color.blue(grayPixel)) <= 2)
if (grayscale !== red) red.recycle()
grayscale.recycle()
}
@Test
fun staticVignetteDarkensEdgesMoreThanCenter() {
val source = mutableBitmap(96, 96, Color.WHITE)
val result = processBitmap(
source = source,
enableVignette = true,
vignettePercent = 75
)
val center = Color.red(result.getPixel(48, 48))
val corner = Color.red(result.getPixel(0, 0))
assertTrue("Expected vignette corner ($corner) below center ($center)", corner < center)
if (result !== source) source.recycle()
result.recycle()
}
@Test
fun staticBlurSoftensSharpBoundary() {
val source = Bitmap.createBitmap(96, 96, Bitmap.Config.ARGB_8888)
for (y in 0 until source.height) {
for (x in 0 until source.width) {
source.setPixel(x, y, if (x < 48) Color.BLACK else Color.WHITE)
}
}
val result = processBitmap(
source = source,
enableBlur = true,
blurPercent = 60
)
val boundary = Color.red(result.getPixel(48, 48))
assertTrue("Expected blurred boundary, got $boundary", boundary in 2..253)
if (result !== source) source.recycle()
result.recycle()
}
private fun mutableBitmap(width: Int, height: Int, color: Int): Bitmap =
Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888).apply {
eraseColor(color)
}
private fun createJpeg(width: Int, height: Int): File {
val file = File.createTempFile("paperize-test-", ".jpg", context.cacheDir)
files += file
val bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888)
bitmap.eraseColor(Color.MAGENTA)
file.outputStream().use { output ->
check(bitmap.compress(Bitmap.CompressFormat.JPEG, 95, output))
}
bitmap.recycle()
return file
}
}
@@ -0,0 +1,80 @@
package com.anthonyla.paperize.data.database
import android.content.Context
import android.database.sqlite.SQLiteDatabase
import androidx.room.Room
import androidx.test.core.app.ApplicationProvider
import androidx.test.platform.app.InstrumentationRegistry
import com.anthonyla.paperize.core.ScreenType
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.runBlocking
import org.json.JSONObject
import org.junit.Assert.*
import org.junit.Test
class LibraryMigrationInstrumentedTest {
private val context = ApplicationProvider.getApplicationContext<Context>()
@Test fun everyLegacyVersionPreservesLibraryAndQueue() = runBlocking {
for (version in 1..3) {
val name = "migration-test-$version"
context.deleteDatabase(name)
try {
createLegacyDatabase(name, version)
val db = Room.databaseBuilder(context, PaperizeDatabase::class.java, name)
.addMigrations(*LIBRARY_MIGRATIONS).build()
try {
assertEquals("My album", db.albumDao().getAlbumById("album")?.name)
assertEquals("content://image", db.albumDao().getAlbumById("album")?.coverUri)
val image = db.wallpaperDao().getWallpaperById("image")!!
assertEquals("folder", image.folderId)
assertEquals("photo.jpg", image.fileName)
assertEquals(7, image.displayOrder)
assertEquals(42L, image.addedAt)
assertEquals("content://image", db.folderDao().getFolderById("folder")?.coverUri)
assertEquals(listOf("image"), db.wallpaperQueueDao().getQueueItems("album", ScreenType.HOME).map { it.wallpaperId })
assertEquals(if (version >= 3) "image" else null, db.wallpaperCurrentDao().getCurrentWallpaperFlow("album", ScreenType.HOME).first()?.id)
db.openHelper.readableDatabase.query("PRAGMA foreign_key_check").use { assertEquals(0, it.count) }
db.albumDao().deleteAlbumById("album")
assertNull(db.wallpaperDao().getWallpaperById("image"))
assertTrue(db.wallpaperQueueDao().getQueueItems("album", ScreenType.HOME).isEmpty())
} finally { db.close() }
} finally { context.deleteDatabase(name) }
}
}
private fun createLegacyDatabase(name: String, version: Int) {
val schema = InstrumentationRegistry.getInstrumentation().context.assets
.open("com.anthonyla.paperize.data.database.PaperizeDatabase/4.json")
.bufferedReader().use { JSONObject(it.readText()).getJSONObject("database").getJSONArray("entities") }
val path = context.getDatabasePath(name)
path.parentFile!!.mkdirs()
SQLiteDatabase.openOrCreateDatabase(path, null).use { db ->
db.setForeignKeyConstraintsEnabled(true)
for (index in 0 until schema.length()) {
val entity = schema.getJSONObject(index)
val table = entity.getString("tableName")
if (table == "wallpaper_current" && version < 3) continue
var create = entity.getString("createSql").replace("\${TABLE_NAME}", table)
// Verified against the version 1, 2 and 3 entities in Git history.
if (table == "wallpapers") {
create = if (version == 1) create.replace("`mediaType` TEXT NOT NULL, ", "")
else create.replace("PRIMARY KEY(`id`)", "`cropOffsetX` REAL, `cropOffsetY` REAL, `cropScale` REAL, PRIMARY KEY(`id`)")
}
db.execSQL(create)
val indices = entity.optJSONArray("indices")
if (indices != null) for (i in 0 until indices.length()) {
db.execSQL(indices.getJSONObject(i).getString("createSql").replace("\${TABLE_NAME}", table))
}
}
db.execSQL("INSERT INTO albums VALUES ('album', 'My album', 'content://image', 1, 2)")
db.execSQL("INSERT INTO folders (id, albumId, name, uri, coverUri, dateModified, displayOrder, addedAt) VALUES ('folder', 'album', 'Photos', 'content://tree', 'content://image', 3, 0, 4)")
val mediaColumn = if (version > 1) ", mediaType" else ""
val mediaValue = if (version > 1) ", 'IMAGE'" else ""
db.execSQL("INSERT INTO wallpapers (id, albumId, folderId, uri, fileName, dateModified, displayOrder, sourceType, addedAt$mediaColumn) VALUES ('image', 'album', 'folder', 'content://image', 'photo.jpg', 5, 7, 'FOLDER', 42$mediaValue)")
db.execSQL("INSERT INTO wallpaper_queue VALUES (1, 'album', 'image', 'HOME', 2, 6)")
if (version >= 3) db.execSQL("INSERT INTO wallpaper_current VALUES ('album', 'HOME', 'image', 9)")
db.version = version
}
}
}
@@ -0,0 +1,171 @@
package com.anthonyla.paperize.data.repository
import com.anthonyla.paperize.testFolder
import com.anthonyla.paperize.testWallpaper
import android.content.Context
import androidx.room.Room
import androidx.test.core.app.ApplicationProvider
import androidx.test.ext.junit.runners.AndroidJUnit4
import com.anthonyla.paperize.core.ScreenType
import com.anthonyla.paperize.data.database.PaperizeDatabase
import com.anthonyla.paperize.data.database.entities.AlbumEntity
import com.anthonyla.paperize.data.mapper.toEntity
import com.anthonyla.paperize.domain.model.Folder
import com.anthonyla.paperize.domain.model.ScheduleSettings
import com.anthonyla.paperize.domain.model.Wallpaper
import com.anthonyla.paperize.domain.source.WallpaperRenderer
import com.anthonyla.paperize.domain.usecase.ChangeWallpaperUseCase
import kotlinx.coroutines.async
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.runBlocking
import org.junit.After
import org.junit.Assert.*
import org.junit.Test
import org.junit.runner.RunWith
@RunWith(AndroidJUnit4::class)
class AlbumRepositoryInstrumentedTest {
private val context = ApplicationProvider.getApplicationContext<Context>()
private val db = Room.inMemoryDatabaseBuilder(context, PaperizeDatabase::class.java).build()
private val wallpapers = WallpaperRepositoryImpl(db)
private val albums = AlbumRepositoryImpl(com.anthonyla.paperize.data.source.AndroidDocumentSource(context), db)
@After fun close() = db.close()
@Test fun cancellingAChunkedFolderImportRollsBackAllRows() = runBlocking {
db.albumDao().insertAlbum(AlbumEntity("album", "Album", null))
val folder = testFolder("folder", "album").copy(
wallpapers = (0..599).map { testWallpaper("image-$it", "album").copy(folderId = "folder", uri = "content://image-$it") }
)
try {
albums.addFolderToAlbum("album", folder) { saved, _ ->
if (saved >= 500) throw CancellationException("User cancelled")
}
fail("Expected cancellation")
} catch (_: CancellationException) { }
assertEquals(0, db.wallpaperDao().getWallpaperIdsByAlbum("album").size)
assertNull(db.folderDao().getFolderWithWallpapers("folder").first())
assertNull(db.albumDao().getAlbumById("album")?.coverUri)
}
@Test fun importingImagesUpdatesCoverAndRotationQueueTogether() = runBlocking {
db.albumDao().insertAlbum(AlbumEntity("album", "Album", null))
val first = testWallpaper("first", "album").copy(uri = "content://first")
db.wallpaperDao().insertWallpapers(listOf(first.toEntity()))
db.wallpaperQueueDao().rebuildQueue("album", ScreenType.HOME, listOf("first"))
db.folderDao().insertFolder(testFolder("folder", "album").toEntity())
val second = first.copy(id = "second", uri = "content://second", folderId = "folder")
assertEquals(1, albums.addWallpapersToAlbum("album", listOf(second)))
assertTrue(db.wallpaperQueueDao().getQueueItems("album", ScreenType.HOME).isEmpty())
assertEquals(2, db.wallpaperDao().getWallpaperIdsByAlbum("album").size)
assertEquals("content://second", db.folderDao().getFolderById("folder")?.coverUri)
}
@Test fun removingCoverUsesOnlyWallpapersFromThatAlbum() = runBlocking {
db.albumDao().insertAlbum(AlbumEntity("one", "One", "content://shared"))
db.albumDao().insertAlbum(AlbumEntity("two", "Two", "content://shared"))
val cover = testWallpaper("cover", "one").copy(uri = "content://shared")
val replacement = cover.copy(id = "replacement", uri = "content://replacement", displayOrder = 1)
db.wallpaperDao().insertWallpapers(listOf(cover, replacement, cover.copy(id = "other", albumId = "two")).map { it.toEntity() })
albums.removeWallpapersFromAlbum("one", listOf("cover", "other"))
assertEquals("content://replacement", db.albumDao().getAlbumById("one")?.coverUri)
assertEquals("content://shared", db.albumDao().getAlbumById("two")?.coverUri)
assertNotNull(db.wallpaperDao().getWallpaperById("other"))
}
@Test fun coverRefreshUsesDisplayOrderAndClearsEmptyFolders() = runBlocking {
db.albumDao().insertAlbum(AlbumEntity("album", "Album", null))
db.folderDao().insertFolder(testFolder("folder", "album").toEntity())
val later = testWallpaper("later", "album").copy(folderId = "folder", uri = "content://later", displayOrder = 9)
val first = later.copy(id = "first", uri = "content://first", displayOrder = 1)
val direct = later.copy(id = "direct", folderId = null, uri = "content://direct", displayOrder = 99)
db.wallpaperDao().insertWallpapers(listOf(later, first, direct).map { it.toEntity() })
db.folderDao().refreshFolderCovers("album")
assertEquals("content://first", db.folderDao().getFolderById("folder")?.coverUri)
assertEquals("content://direct", db.wallpaperDao().getAlbumCoverUri("album"))
db.wallpaperDao().deleteAlbumWallpapers("album", listOf("later", "first"))
db.folderDao().refreshFolderCovers("album")
assertNull(db.folderDao().getFolderById("folder")?.coverUri)
}
@Test fun concurrentImportsDeduplicateInsideTheTransaction() = runBlocking {
db.albumDao().insertAlbum(AlbumEntity("album", "Album", null))
val image = testWallpaper("one", "album").copy(uri = "content://same")
val first = async(Dispatchers.IO) { albums.addWallpapersToAlbum("album", listOf(image)) }
val second = async(Dispatchers.IO) { albums.addWallpapersToAlbum("album", listOf(image.copy(id = "two"))) }
assertEquals(1, first.await() + second.await())
assertEquals(1, db.wallpaperDao().getWallpaperIdsByAlbum("album").size)
db.folderDao().insertFolder(testFolder("folder", "album").toEntity())
assertEquals(1, albums.addWallpapersToAlbum("album", listOf(image.copy(id = "folder-image", folderId = "folder"))))
db.folderDao().deleteAlbumFolder("album", "folder")
assertEquals(0, albums.addWallpapersToAlbum("album", listOf(image.copy(id = "stale", folderId = "folder"))))
}
@Test fun continuingFromAPickedWallpaperFollowsAlbumOrderAndWraps() = runBlocking {
db.albumDao().insertAlbum(AlbumEntity("album", "Album", null))
db.wallpaperDao().insertWallpapers((1..5).map {
testWallpaper("$it", "album").copy(uri = "content://$it", displayOrder = it).toEntity()
})
val change = ChangeWallpaperUseCase(wallpapers, SettingsRepositoryImpl(context), object : WallpaperRenderer {
override suspend fun render(wallpaper: Wallpaper, screen: ScreenType, settings: ScheduleSettings) = null
})
suspend fun next() = change.dequeueNext("album", ScreenType.HOME, shuffle = false).id
change.completeSpecific("album", ScreenType.HOME, "3", shuffle = false, startSequenceHere = true)
assertEquals(listOf("4", "5", "1"), List(3) { next() })
change.completeSpecific("album", ScreenType.HOME, "5", shuffle = false, startSequenceHere = true)
assertEquals("1", next())
}
@Test fun concurrentQueueCreationKeepsBothScreensInSyncAndDoesNotRefillConsumedItems() = runBlocking {
db.albumDao().insertAlbum(AlbumEntity("album", "Album", null))
albums.addWallpapersToAlbum("album", (1..8).map {
testWallpaper("image-$it", "album").copy(uri = "content://image-$it")
})
val home = async(Dispatchers.IO) { wallpapers.ensureWallpaperQueue("album", ScreenType.HOME, true) }
val lock = async(Dispatchers.IO) { wallpapers.ensureWallpaperQueue("album", ScreenType.LOCK, true) }
home.await(); lock.await()
val expected = db.wallpaperQueueDao().getQueueItems("album", ScreenType.HOME).map { it.wallpaperId }
assertEquals(8, expected.toSet().size)
assertEquals(expected, db.wallpaperQueueDao().getQueueItems("album", ScreenType.LOCK).map { it.wallpaperId })
wallpapers.getAndDequeueWallpaper("album", ScreenType.HOME)
wallpapers.ensureWallpaperQueue("album", ScreenType.HOME, true)
assertEquals(expected.drop(1), db.wallpaperQueueDao().getQueueItems("album", ScreenType.HOME).map { it.wallpaperId })
}
@Test fun syncFolderWallpapersRemovesOnlyThatFoldersMissingFilesAndAddsNewOnes() = runBlocking {
db.albumDao().insertAlbum(AlbumEntity("album", "Album", null))
albums.addFolderToAlbum("album", testFolder("folder", "album").copy(
wallpapers = (1..5).map { testWallpaper("image-$it", "album").copy(folderId = "folder", uri = "content://photo-$it") }
))
albums.addWallpapersToAlbum("album", listOf(testWallpaper("direct", "album").copy(uri = "content://photo-3")))
val scanned = listOf(1, 2, 4, 5, 6).map { testWallpaper("image-$it", "album").copy(folderId = "folder", uri = "content://photo-$it") }
val added = albums.syncFolderWallpapers("album", "folder", scanned)
assertEquals(1, added)
assertEquals(
listOf(1, 2, 4, 5, 6).map { "content://photo-$it" }.toSet(),
db.wallpaperDao().getUrisInCollection("album", "folder").toSet()
)
assertEquals(listOf("content://photo-3"), db.wallpaperDao().getUrisInCollection("album", null))
}
@Test fun syncFolderWallpapersKeepsRowsWhenScanIsEmpty() = runBlocking {
db.albumDao().insertAlbum(AlbumEntity("album", "Album", null))
albums.addFolderToAlbum("album", testFolder("folder", "album").copy(
wallpapers = listOf(testWallpaper("image-1", "album").copy(folderId = "folder", uri = "content://photo-1"))
))
assertEquals(0, albums.syncFolderWallpapers("album", "folder", emptyList()))
assertEquals(1, db.wallpaperDao().getUrisInCollection("album", "folder").size)
}
}
@@ -0,0 +1,100 @@
package com.anthonyla.paperize.data.repository
import android.content.Context
import androidx.test.core.app.ApplicationProvider
import com.anthonyla.paperize.core.ScreenType
import com.anthonyla.paperize.core.ScalingType
import com.anthonyla.paperize.core.WallpaperMode
import com.anthonyla.paperize.domain.model.ScheduleSettings
import com.anthonyla.paperize.domain.model.WallpaperEffects
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.coroutineScope
import kotlinx.coroutines.launch
import org.junit.Assert.*
import org.junit.Test
class SettingsRepositoryInstrumentedTest {
@Test fun concurrentScheduleEditsReadTheLatestValueWithoutLosingSelections() = runBlocking {
val preferences = SettingsRepositoryImpl(ApplicationProvider.getApplicationContext<Context>())
val previousSettings = preferences.getScheduleSettings()
try {
val initial = ScheduleSettings(homeAlbumId = "home", homeIntervalMinutes = 30)
preferences.updateScheduleSettings(initial)
coroutineScope {
repeat(20) {
launch {
preferences.updateScheduleSettings { current ->
current.copy(homeIntervalMinutes = current.homeIntervalMinutes + 1)
}
}
}
launch { preferences.updateAlbumId(ScreenType.HOME, "new-home") }
}
assertEquals(initial.copy(homeAlbumId = "new-home", homeIntervalMinutes = 50), preferences.getScheduleSettings())
} finally {
preferences.updateScheduleSettings(previousSettings)
}
}
@Test fun resettingSchedulesPreservesAppearanceAndWallpaperMode() = runBlocking {
val preferences = SettingsRepositoryImpl(ApplicationProvider.getApplicationContext<Context>())
val previousSettings = preferences.getScheduleSettings()
val previousMode = preferences.getWallpaperMode()
val appearance = preferences.getAppSettings()
try {
preferences.updateWallpaperMode(WallpaperMode.LIVE)
val effects = WallpaperEffects(
enableBlur = true, blurPercentage = 30, enableDarken = true, darkenPercentage = 20,
enableVignette = true, vignettePercentage = 40, enableGrayscale = true, grayscalePercentage = 50,
enableDoubleTap = true, enableChangeOnScreenOff = true, enableParallax = true, parallaxIntensity = 60
)
// Each screen gets distinct effects so a cross-screen key swap cannot round-trip.
val lockEffects = effects.copy(
blurPercentage = 31, darkenPercentage = 21, vignettePercentage = 41, grayscalePercentage = 51,
enableVignette = false, enableDoubleTap = false, parallaxIntensity = 61
)
val liveEffects = effects.copy(
blurPercentage = 32, darkenPercentage = 22, vignettePercentage = 42, grayscalePercentage = 52,
enableGrayscale = false, enableChangeOnScreenOff = false, parallaxIntensity = 62
)
val full = ScheduleSettings(
enableChanger = true, separateSchedules = true, shuffleEnabled = true,
homeEnabled = true, lockEnabled = true, homeAlbumId = "home", lockAlbumId = "lock", liveAlbumId = "live",
homeIntervalMinutes = 25, lockIntervalMinutes = 35, liveIntervalMinutes = 45,
homeScalingType = ScalingType.FIT, lockScalingType = ScalingType.STRETCH, liveScalingType = ScalingType.NONE,
homeScrollingEnabled = true, homeEffects = effects, lockEffects = lockEffects, liveEffects = liveEffects,
adaptiveBrightness = true
)
preferences.updateScheduleSettings(full)
assertEquals(full, preferences.getScheduleSettings())
preferences.clearScheduleSettings()
assertEquals(ScheduleSettings(), preferences.getScheduleSettings())
assertEquals(appearance, preferences.getAppSettings())
assertEquals(WallpaperMode.LIVE, preferences.getWallpaperMode())
} finally {
preferences.updateScheduleSettings(previousSettings)
preferences.updateWallpaperMode(previousMode)
}
}
@Test fun clearingAnEmptyAlbumPreservesNewSelectionsAndOtherSettings() = runBlocking {
val preferences = SettingsRepositoryImpl(ApplicationProvider.getApplicationContext<Context>())
val previousSettings = preferences.getScheduleSettings()
val previousMode = preferences.getWallpaperMode()
try {
preferences.updateWallpaperMode(WallpaperMode.STATIC)
val settings = ScheduleSettings(enableChanger = true, homeEnabled = true, lockEnabled = true,
homeAlbumId = "new-home", lockAlbumId = "lock", homeIntervalMinutes = 75)
preferences.updateScheduleSettings(settings)
preferences.clearEmptyAlbumSelection("old-home", ScreenType.HOME)
assertEquals(settings, preferences.getScheduleSettings())
preferences.clearEmptyAlbumSelection("new-home", ScreenType.HOME)
assertEquals(settings.copy(homeAlbumId = null), preferences.getScheduleSettings())
preferences.clearEmptyAlbumSelection("lock", ScreenType.LOCK)
assertEquals(settings.copy(homeAlbumId = null, lockAlbumId = null, enableChanger = false), preferences.getScheduleSettings())
} finally {
preferences.updateScheduleSettings(previousSettings)
preferences.updateWallpaperMode(previousMode)
}
}
}
@@ -0,0 +1,20 @@
package com.anthonyla.paperize.domain.model
import com.anthonyla.paperize.testFolder
import com.anthonyla.paperize.testWallpaper
import org.junit.Assert.assertEquals
import org.junit.Test
class DisplayNameInstrumentedTest {
@Test fun documentNamesDecodeEscapesAndPreserveLiteralPlusSigns() {
mapOf(
"primary%3APictures%2FSummer%20%2B%20Sun.jpg" to "Summer + Sun.jpg",
"primary%3APictures" to "Pictures",
"Pictures/Summer+Sun.jpg" to "Summer+Sun.jpg",
"" to ""
).forEach { (stored, displayed) ->
assertEquals(displayed, testFolder().copy(name = stored).displayName)
assertEquals(displayed, testWallpaper().copy(fileName = stored).displayFileName)
}
}
}
@@ -0,0 +1,185 @@
package com.anthonyla.paperize.presentation
import com.anthonyla.paperize.testAlbumSummary
import android.content.Context
import android.graphics.Bitmap
import android.graphics.Color
import androidx.compose.runtime.mutableStateOf
import androidx.compose.ui.graphics.toArgb
import androidx.compose.ui.graphics.toPixelMap
import com.anthonyla.paperize.domain.model.AlbumSummary
import com.anthonyla.paperize.presentation.screens.library.components.AlbumItem
import java.io.File
import androidx.compose.runtime.mutableIntStateOf
import com.anthonyla.paperize.core.constants.Constants
import com.anthonyla.paperize.presentation.screens.wallpaper.components.TimeIntervalPicker
import androidx.compose.ui.test.*
import androidx.compose.ui.test.junit4.v2.createComposeRule
import androidx.test.core.app.ApplicationProvider
import com.anthonyla.paperize.R
import com.anthonyla.paperize.presentation.common.theme.PaperizeTheme
import com.anthonyla.paperize.presentation.common.components.SortBottomSheet
import com.anthonyla.paperize.presentation.common.components.SortOption
import com.anthonyla.paperize.presentation.common.components.WallpaperItem
import androidx.compose.foundation.layout.size
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import org.junit.Assert.*
import org.junit.Rule
import org.junit.Test
import com.anthonyla.paperize.presentation.screens.library.LibraryScreen
import kotlinx.coroutines.CompletableDeferred
import androidx.compose.ui.semantics.SemanticsActions
import com.anthonyla.paperize.core.WallpaperMode
import com.anthonyla.paperize.domain.model.ScheduleSettings
import com.anthonyla.paperize.domain.model.WallpaperEffects
import com.anthonyla.paperize.presentation.screens.wallpaper.WallpaperScreen
class AlbumUiInstrumentedTest {
@get:Rule val compose = createComposeRule()
private val context = ApplicationProvider.getApplicationContext<Context>()
@Test fun effectSlidersRouteDraftChangesToEnabledScreensAndLiveMode() {
val settings = mutableStateOf(ScheduleSettings(
homeEnabled = true, lockEnabled = true,
homeEffects = WallpaperEffects(enableBlur = true, blurPercentage = 45),
lockEffects = WallpaperEffects(enableBlur = true, blurPercentage = 65),
liveEffects = WallpaperEffects(enableBlur = true, blurPercentage = 80)
))
val mode = mutableStateOf(WallpaperMode.STATIC)
var latest = settings.value
compose.setContent {
PaperizeTheme(false, false) {
WallpaperScreen(
albums = emptyList(), persistedScheduleSettings = settings.value,
animate = true, wallpaperMode = mode.value,
onToggleChanger = {}, onSelectAlbum = { _, _ -> },
onUpdateScheduleSettings = { latest = it },
onUpdateScheduleSettingsDebounced = { latest = it },
onChangeWallpaperNow = {}, homeWallpaperUri = null, lockWallpaperUri = null
)
}
}
fun slide(index: Int, percentage: Float) {
compose.onAllNodes(SemanticsMatcher.keyIsDefined(SemanticsActions.SetProgress))[index]
.performScrollTo()
.performSemanticsAction(SemanticsActions.SetProgress) { it(percentage) }
}
slide(0, 20f)
slide(1, 75f)
compose.runOnIdle {
assertEquals(20, latest.homeEffects.blurPercentage)
assertEquals(75, latest.lockEffects.blurPercentage)
settings.value = latest.copy(homeEnabled = false)
}
slide(0, 55f)
compose.runOnIdle {
assertEquals(20, latest.homeEffects.blurPercentage)
assertEquals(55, latest.lockEffects.blurPercentage)
settings.value = latest
mode.value = WallpaperMode.LIVE
}
slide(0, 40f)
compose.runOnIdle {
assertEquals(20, latest.homeEffects.blurPercentage)
assertEquals(55, latest.lockEffects.blurPercentage)
assertEquals(40, latest.liveEffects.blurPercentage)
}
}
@Test fun failedAlbumCreationKeepsNameAndAllowsRetryAfterPendingSave() {
val pending = CompletableDeferred<Int?>()
var attempts = 0
compose.setContent {
PaperizeTheme(false, false) {
LibraryScreen(emptyList(), {}, { name ->
assertEquals("Mountains", name)
attempts++
if (attempts == 1) pending.await() else null
})
}
}
compose.onNodeWithContentDescription(context.getString(R.string.add_album)).performClick()
compose.onNodeWithText(context.getString(R.string.album_name)).performTextInput("Mountains")
compose.onNodeWithText(context.getString(R.string.save)).performClick().assertIsNotEnabled()
compose.runOnIdle { pending.complete(R.string.album_create_failed) }
compose.onNodeWithText(context.getString(R.string.album_create_failed)).assertIsDisplayed()
compose.onNodeWithText(context.getString(R.string.album_name)).assertTextContains("Mountains")
compose.onNodeWithText(context.getString(R.string.save)).performClick()
compose.onNodeWithText(context.getString(R.string.album_name)).assertDoesNotExist()
compose.runOnIdle { assertEquals(2, attempts) }
}
@Test fun sortSheetExposesCurrentSelectionAndAppliesNewChoice() {
var chosen: SortOption? = null
var dismissed = false
compose.setContent {
PaperizeTheme(false, false) {
SortBottomSheet(SortOption.DATE_ADDED_DESC, { chosen = it }, { dismissed = true })
}
}
compose.onNodeWithText(context.getString(R.string.sort_date_added_desc)).assertIsSelected()
compose.onNodeWithText(context.getString(R.string.sort_name_asc)).performClick()
compose.runOnIdle { assertEquals(SortOption.NAME_ASC, chosen); assertTrue(dismissed) }
}
@Test fun wallpaperThumbnailsExposeNameAndSelection() {
compose.setContent {
PaperizeTheme(false, false) {
WallpaperItem("content://test/image", "Mountains.jpg", true, true, {}, {}, Modifier.size(160.dp))
}
}
compose.onNodeWithContentDescription("Mountains.jpg")
.assertIsSelected().assertHasClickAction()
}
@Test fun albumCoverLoadsThroughCoilAndFallsBackForMissingFiles() {
val file = File.createTempFile("album-cover", ".png", context.cacheDir)
val bitmap = Bitmap.createBitmap(20, 20, Bitmap.Config.ARGB_8888)
bitmap.eraseColor(Color.RED)
file.outputStream().use { bitmap.compress(Bitmap.CompressFormat.PNG, 100, it) }
bitmap.recycle()
val uri = mutableStateOf<String?>(file.toURI().toString())
try {
compose.setContent {
PaperizeTheme(false, false) {
AlbumItem(testAlbumSummary("album").copy(name = "Cover", coverUri = uri.value), {}, Modifier.size(180.dp))
}
}
fun centerColor(): Int {
val pixels = compose.onNodeWithContentDescription("Cover").captureToImage().toPixelMap()
return pixels[pixels.width / 2, pixels.height / 2].toArgb()
}
compose.waitUntil(5_000) { centerColor() == Color.RED }
compose.runOnIdle { uri.value = File(context.cacheDir, "missing-cover.png").toURI().toString() }
compose.waitUntil(5_000) { centerColor() != Color.RED }
compose.onNodeWithContentDescription("Cover").assertIsDisplayed()
} finally {
file.delete()
}
}
@Test fun intervalEditsDebounceAndExternalValuesCancelPendingEdits() {
val minutes = mutableIntStateOf(60)
val changes = mutableListOf<Int>()
compose.setContent {
PaperizeTheme(false, false) {
TimeIntervalPicker("Interval", minutes.intValue, { changes.add(it) })
}
}
compose.mainClock.autoAdvance = false
compose.mainClock.advanceTimeBy(Constants.DEBOUNCE_DELAY_MS + 50)
compose.runOnIdle { assertTrue(changes.isEmpty()) }
compose.onNodeWithText(context.getString(R.string.hours_txt)).performTextReplacement("0")
compose.mainClock.advanceTimeBy(100)
compose.onNodeWithText(context.getString(R.string.mins)).performTextReplacement("1")
compose.mainClock.advanceTimeBy(Constants.DEBOUNCE_DELAY_MS + 50)
compose.runOnIdle { assertEquals(listOf(Constants.MIN_INTERVAL_MINUTES), changes) }
compose.onNodeWithText(context.getString(R.string.mins)).performTextReplacement("30")
compose.runOnIdle { minutes.intValue = 120 }
compose.mainClock.advanceTimeBy(Constants.DEBOUNCE_DELAY_MS + 50)
compose.runOnIdle { assertEquals(1, changes.size) }
compose.onNodeWithText(context.getString(R.string.hours_txt)).assertTextContains("2")
}
}
@@ -0,0 +1,350 @@
package com.anthonyla.paperize.service.livewallpaper.renderer
import android.graphics.Bitmap
import android.graphics.Color
import android.opengl.EGL14
import android.opengl.EGLConfig
import android.opengl.EGLContext
import android.opengl.EGLDisplay
import android.opengl.EGLSurface
import android.opengl.GLES20
import android.opengl.GLUtils
import android.opengl.Matrix
import androidx.test.ext.junit.runners.AndroidJUnit4
import com.anthonyla.paperize.service.livewallpaper.gl.GLUtil
import java.nio.ByteBuffer
import java.nio.ByteOrder
import java.nio.FloatBuffer
import org.junit.After
import org.junit.Assert.assertTrue
import org.junit.Assert.assertEquals
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
@RunWith(AndroidJUnit4::class)
class LiveWallpaperShaderInstrumentedTest {
private lateinit var display: EGLDisplay
private lateinit var context: EGLContext
private lateinit var surface: EGLSurface
@Before
fun createGlContext() {
display = EGL14.eglGetDisplay(EGL14.EGL_DEFAULT_DISPLAY)
assertTrue(display != EGL14.EGL_NO_DISPLAY)
assertTrue(EGL14.eglInitialize(display, IntArray(2), 0, IntArray(2), 0))
val configs = arrayOfNulls<EGLConfig>(1)
val configCount = IntArray(1)
assertTrue(
EGL14.eglChooseConfig(
display,
intArrayOf(
EGL14.EGL_SURFACE_TYPE, EGL14.EGL_PBUFFER_BIT,
EGL14.EGL_RENDERABLE_TYPE, EGL14.EGL_OPENGL_ES2_BIT,
EGL14.EGL_RED_SIZE, 8,
EGL14.EGL_GREEN_SIZE, 8,
EGL14.EGL_BLUE_SIZE, 8,
EGL14.EGL_ALPHA_SIZE, 8,
EGL14.EGL_NONE
),
0,
configs,
0,
configs.size,
configCount,
0
)
)
val config = requireNotNull(configs.first())
context = EGL14.eglCreateContext(
display,
config,
EGL14.EGL_NO_CONTEXT,
intArrayOf(EGL14.EGL_CONTEXT_CLIENT_VERSION, 2, EGL14.EGL_NONE),
0
)
surface = EGL14.eglCreatePbufferSurface(
display,
config,
intArrayOf(EGL14.EGL_WIDTH, SIZE, EGL14.EGL_HEIGHT, SIZE, EGL14.EGL_NONE),
0
)
assertTrue(EGL14.eglMakeCurrent(display, surface, surface, context))
GLES20.glViewport(0, 0, SIZE, SIZE)
GLES20.glDisable(GLES20.GL_BLEND)
}
@After
fun destroyGlContext() {
EGL14.eglMakeCurrent(
display,
EGL14.EGL_NO_SURFACE,
EGL14.EGL_NO_SURFACE,
EGL14.EGL_NO_CONTEXT
)
EGL14.eglDestroySurface(display, surface)
EGL14.eglDestroyContext(display, context)
EGL14.eglTerminate(display)
}
@Test
fun wallpaperConfigSupportsEs2WindowSurfaces() {
val egl = javax.microedition.khronos.egl.EGLContext.getEGL() as javax.microedition.khronos.egl.EGL10
val eglDisplay = egl.eglGetCurrentDisplay()
val config = com.anthonyla.paperize.service.livewallpaper.gl.WallpaperEglConfigChooser()
.chooseConfig(egl, eglDisplay)
val attribute = IntArray(1)
assertTrue(egl.eglGetConfigAttrib(eglDisplay, config, EGL14.EGL_RENDERABLE_TYPE, attribute))
assertTrue(attribute[0] and EGL14.EGL_OPENGL_ES2_BIT != 0)
assertTrue(egl.eglGetConfigAttrib(eglDisplay, config, EGL14.EGL_SURFACE_TYPE, attribute))
assertTrue(attribute[0] and EGL14.EGL_WINDOW_BIT != 0)
}
@Test
fun rendererSurvivesSupersededUploadsCrossfadeResizeAndContextLoss() {
val app = androidx.test.core.app.ApplicationProvider.getApplicationContext<android.content.Context>()
val uploads = java.util.concurrent.LinkedBlockingQueue<() -> Unit>()
var renderRequests = 0
val renderer = PaperizeWallpaperRenderer(app, object : PaperizeWallpaperRenderer.Callbacks {
override fun queueEventOnGlThread(event: () -> Unit): Boolean = uploads.offer(event)
override fun requestRender() { renderRequests++ }
})
val egl = javax.microedition.khronos.egl.EGLContext.getEGL() as javax.microedition.khronos.egl.EGL10
val gl = egl.eglGetCurrentContext().gl as javax.microedition.khronos.opengles.GL10
val config = com.anthonyla.paperize.service.livewallpaper.gl.WallpaperEglConfigChooser()
.chooseConfig(egl, egl.eglGetCurrentDisplay())
val file = java.io.File.createTempFile("live-renderer", ".png", app.cacheDir)
val replacement = java.io.File.createTempFile("live-renderer-next", ".png", app.cacheDir)
try {
val bitmap = solidBitmap(Color.WHITE)
file.outputStream().use { bitmap.compress(Bitmap.CompressFormat.PNG, 100, it) }
bitmap.recycle()
val loader = ContentUriImageLoader(app.contentResolver, android.net.Uri.fromFile(file))
renderer.onSurfaceCreated(gl, config)
renderer.onSurfaceChanged(gl, SIZE, SIZE)
renderer.queueWallpaper(loader)
val staleUpload = checkNotNull(uploads.poll(5, java.util.concurrent.TimeUnit.SECONDS))
renderer.queueWallpaper(loader)
val activeUpload = checkNotNull(uploads.poll(5, java.util.concurrent.TimeUnit.SECONDS))
staleUpload()
assertEquals(0, renderRequests)
activeUpload()
renderer.onDrawFrame(gl)
android.os.SystemClock.sleep(com.anthonyla.paperize.core.constants.Constants.CROSSFADE_DURATION_MS.toLong() + 50L)
val requestsBeforeFinalFrame = renderRequests
renderer.onDrawFrame(gl)
assertEquals(requestsBeforeFinalFrame, renderRequests)
assertTrue(Color.red(readPixel(SIZE / 2, SIZE / 2)) >= 253)
renderer.updateEffects(com.anthonyla.paperize.domain.model.WallpaperEffects(
enableBlur = true, blurPercentage = 50
))
renderer.onDrawFrame(gl)
assertTrue(Color.red(readPixel(SIZE / 2, SIZE / 2)) >= 253)
val red = solidBitmap(Color.RED)
replacement.outputStream().use { red.compress(Bitmap.CompressFormat.PNG, 100, it) }
red.recycle()
renderer.queueWallpaper(ContentUriImageLoader(app.contentResolver, android.net.Uri.fromFile(replacement)))
val uploadBeforeResize = checkNotNull(uploads.poll(5, java.util.concurrent.TimeUnit.SECONDS))
renderer.onSurfaceChanged(gl, SIZE, SIZE - 2)
uploadBeforeResize()
checkNotNull(uploads.poll(5, java.util.concurrent.TimeUnit.SECONDS)).invoke()
renderer.onDrawFrame(gl)
assertTrue(Color.red(readPixel(SIZE / 2, SIZE / 2)) >= 253)
assertTrue(Color.green(readPixel(SIZE / 2, SIZE / 2)) <= 2)
destroyGlContext()
createGlContext()
renderer.onSurfaceCreated(gl, config)
renderer.onSurfaceChanged(gl, SIZE, SIZE)
checkNotNull(uploads.poll(5, java.util.concurrent.TimeUnit.SECONDS)).invoke()
renderer.onDrawFrame(gl)
assertTrue(Color.red(readPixel(SIZE / 2, SIZE / 2)) >= 253)
assertTrue(Color.green(readPixel(SIZE / 2, SIZE / 2)) <= 2)
GLUtil.checkGLError("recreated wallpaper surface")
} finally {
renderer.cancelLoading()
file.delete()
replacement.delete()
}
}
@Test
fun liveColorEffectsChangeRenderedPixels() {
val sourceColor = Color.rgb(200, 100, 40)
val texture = createTexture(solidBitmap(sourceColor))
val program = GLUtil.createProgram(GLShaders.VERTEX_SHADER, GLShaders.EFFECTS_FRAGMENT_SHADER)
try {
drawEffects(program, texture)
val baseline = readPixel(SIZE / 2, SIZE / 2)
assertTrue(Color.red(baseline) in 195..205)
assertTrue(Color.green(baseline) in 95..105)
drawEffects(program, texture, darken = 1f)
assertTrue(Color.red(readPixel(SIZE / 2, SIZE / 2)) <= 2)
drawEffects(program, texture, grayscale = 1f)
val gray = readPixel(SIZE / 2, SIZE / 2)
assertTrue(kotlin.math.abs(Color.red(gray) - Color.green(gray)) <= 2)
assertTrue(kotlin.math.abs(Color.green(gray) - Color.blue(gray)) <= 2)
drawEffects(program, texture, adaptiveBrightness = 0.5f)
val dimmed = readPixel(SIZE / 2, SIZE / 2)
assertTrue(Color.red(dimmed) in 95..105)
drawEffects(program, texture, vignette = 1f)
val center = Color.red(readPixel(SIZE / 2, SIZE / 2))
val corner = Color.red(readPixel(1, 1))
assertTrue("Expected vignette corner $corner below center $center", corner < center)
} finally {
GLES20.glDeleteProgram(program)
GLES20.glDeleteTextures(1, intArrayOf(texture), 0)
}
}
@Test
fun liveBlurShadersSoftenHorizontalAndVerticalBoundaries() {
val horizontal = boundaryBitmap(horizontalBoundary = true)
val vertical = boundaryBitmap(horizontalBoundary = false)
val horizontalTexture = createTexture(horizontal)
val verticalTexture = createTexture(vertical)
val blurProgram = GLUtil.createProgram(
GLShaders.VERTEX_SHADER,
GLShaders.BLUR_FRAGMENT_SHADER
)
try {
drawBlur(blurProgram, horizontalTexture, 1f, 0f)
assertTrue(Color.red(readPixel(SIZE / 2, SIZE / 2)) in 10..245)
drawBlur(blurProgram, verticalTexture, 0f, 1f)
assertTrue(Color.red(readPixel(SIZE / 2, SIZE / 2)) in 10..245)
} finally {
GLES20.glDeleteProgram(blurProgram)
GLES20.glDeleteTextures(2, intArrayOf(horizontalTexture, verticalTexture), 0)
}
}
private fun drawEffects(
program: Int,
texture: Int,
darken: Float = 0f,
vignette: Float = 0f,
grayscale: Float = 0f,
adaptiveBrightness: Float = 1f
) {
prepareDraw(program, texture)
GLES20.glUniform1f(GLES20.glGetUniformLocation(program, "u_alpha"), 1f)
GLES20.glUniform1f(GLES20.glGetUniformLocation(program, "u_darkenFactor"), darken)
GLES20.glUniform1f(GLES20.glGetUniformLocation(program, "u_vignetteFactor"), vignette)
GLES20.glUniform1f(GLES20.glGetUniformLocation(program, "u_grayscaleFactor"), grayscale)
GLES20.glUniform1f(
GLES20.glGetUniformLocation(program, "u_adaptiveBrightnessFactor"),
adaptiveBrightness
)
finishDraw(program)
}
private fun drawBlur(program: Int, texture: Int, x: Float, y: Float) {
prepareDraw(program, texture)
GLES20.glUniform2f(GLES20.glGetUniformLocation(program, "u_resolution"), SIZE.toFloat(), SIZE.toFloat())
GLES20.glUniform1f(GLES20.glGetUniformLocation(program, "u_blurRadius"), 4f)
GLES20.glUniform2f(GLES20.glGetUniformLocation(program, "u_direction"), x, y)
finishDraw(program)
}
private fun prepareDraw(program: Int, texture: Int) {
GLES20.glClearColor(0f, 0f, 0f, 1f)
GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT)
GLES20.glUseProgram(program)
GLES20.glActiveTexture(GLES20.GL_TEXTURE0)
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, texture)
GLES20.glUniform1i(GLES20.glGetUniformLocation(program, "u_texture"), 0)
val identity = FloatArray(16).also { Matrix.setIdentityM(it, 0) }
GLES20.glUniformMatrix4fv(
GLES20.glGetUniformLocation(program, "u_mvpMatrix"),
1,
false,
identity,
0
)
val position = GLES20.glGetAttribLocation(program, "a_position")
val textureCoordinate = GLES20.glGetAttribLocation(program, "a_texCoord")
GLES20.glEnableVertexAttribArray(position)
GLES20.glEnableVertexAttribArray(textureCoordinate)
GLES20.glVertexAttribPointer(position, 2, GLES20.GL_FLOAT, false, 0, floatBuffer(VERTICES))
GLES20.glVertexAttribPointer(
textureCoordinate,
2,
GLES20.GL_FLOAT,
false,
0,
floatBuffer(TEXTURE_COORDINATES)
)
}
private fun finishDraw(program: Int) {
GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4)
GLES20.glFinish()
GLES20.glDisableVertexAttribArray(GLES20.glGetAttribLocation(program, "a_position"))
GLES20.glDisableVertexAttribArray(GLES20.glGetAttribLocation(program, "a_texCoord"))
GLUtil.checkGLError("live wallpaper shader draw")
}
private fun createTexture(bitmap: Bitmap): Int {
val texture = IntArray(1)
GLES20.glGenTextures(1, texture, 0)
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, texture[0])
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR)
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR)
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE)
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE)
GLUtils.texImage2D(GLES20.GL_TEXTURE_2D, 0, bitmap, 0)
if (!bitmap.isRecycled) bitmap.recycle()
return texture[0]
}
private fun readPixel(x: Int, y: Int): Int {
val buffer = ByteBuffer.allocateDirect(4)
GLES20.glReadPixels(x, y, 1, 1, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, buffer)
return Color.argb(
buffer.get(3).toInt() and 0xff,
buffer.get(0).toInt() and 0xff,
buffer.get(1).toInt() and 0xff,
buffer.get(2).toInt() and 0xff
)
}
private fun solidBitmap(color: Int): Bitmap =
Bitmap.createBitmap(SIZE, SIZE, Bitmap.Config.ARGB_8888).apply { eraseColor(color) }
private fun boundaryBitmap(horizontalBoundary: Boolean): Bitmap =
Bitmap.createBitmap(SIZE, SIZE, Bitmap.Config.ARGB_8888).apply {
for (y in 0 until SIZE) {
for (x in 0 until SIZE) {
val white = if (horizontalBoundary) x >= SIZE / 2 else y >= SIZE / 2
setPixel(x, y, if (white) Color.WHITE else Color.BLACK)
}
}
}
private fun floatBuffer(values: FloatArray): FloatBuffer =
ByteBuffer.allocateDirect(values.size * Float.SIZE_BYTES)
.order(ByteOrder.nativeOrder())
.asFloatBuffer()
.apply {
put(values)
position(0)
}
private companion object {
const val SIZE = 64
val VERTICES = floatArrayOf(-1f, -1f, 1f, -1f, -1f, 1f, 1f, 1f)
val TEXTURE_COORDINATES = floatArrayOf(0f, 0f, 1f, 0f, 0f, 1f, 1f, 1f)
}
}
@@ -0,0 +1,171 @@
package com.anthonyla.paperize.service.worker
import android.annotation.SuppressLint
import android.content.Context
import android.os.SystemClock
import androidx.test.core.app.ApplicationProvider
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.work.WorkInfo
import androidx.work.WorkManager
import androidx.work.impl.WorkManagerImpl
import com.anthonyla.paperize.core.ScreenType
import com.anthonyla.paperize.core.WallpaperMode
import com.anthonyla.paperize.core.constants.Constants
import com.anthonyla.paperize.domain.model.ScheduleSettings
import java.util.concurrent.TimeUnit
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.withTimeout
import org.junit.After
import org.junit.Assert.assertEquals
import org.junit.Assert.assertTrue
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
@SuppressLint("RestrictedApi")
@RunWith(AndroidJUnit4::class)
class WallpaperSchedulerInstrumentedTest {
private val context = ApplicationProvider.getApplicationContext<Context>()
private val workManager = WorkManager.getInstance(context) as WorkManagerImpl
private val scheduler = WallpaperScheduler(context)
private val targets = mapOf(
ScreenType.HOME to Constants.WORK_NAME_HOME,
ScreenType.LOCK to Constants.WORK_NAME_LOCK,
ScreenType.BOTH to Constants.WORK_NAME_BOTH,
ScreenType.LIVE to Constants.WORK_NAME_LIVE
)
@Before
@After
fun clearTestSchedules() {
(targets.values + Constants.WORK_NAME_REFRESH).forEach { name ->
workManager.cancelUniqueWork(name).result.get(10, TimeUnit.SECONDS)
}
}
@Test
fun manualResetJobsRemainInTheirFirstPeriodUntilTheFullDelay() = runBlocking {
val delayMillis = TimeUnit.MINUTES.toMillis(15)
val jobs = targets.map { (screen, name) ->
val before = System.currentTimeMillis()
scheduler.scheduleWallpaperChange(screen, 15, resetInterval = true)
val info = awaitEnqueued(name)
assertTrue(info.nextScheduleTimeMillis >= before + delayMillis)
info.id to before
}
// Checking only the next countdown can miss an immediate first run: after that run,
// periodic work also shows a full interval. Inspect the persisted first-period state.
SystemClock.sleep(2_000)
jobs.forEach { (id, before) ->
val spec = requireNotNull(workManager.workDatabase.workSpecDao().getWorkSpec(id.toString()))
assertEquals(delayMillis, spec.intervalDuration)
assertEquals(0, spec.periodCount)
assertEquals(WorkInfo.State.ENQUEUED, spec.state)
assertTrue(spec.calculateNextRunTime() >= before + delayMillis)
assertTrue(spec.calculateNextRunTime() <= System.currentTimeMillis() + delayMillis)
}
}
@Test
fun settingsUpdatePreservesThePendingManualResetDelay() = runBlocking {
scheduler.scheduleWallpaperChange(ScreenType.HOME, 60, resetInterval = true)
val reset = awaitEnqueued(Constants.WORK_NAME_HOME)
scheduler.scheduleWallpaperChange(ScreenType.HOME, 60)
val updated = awaitEnqueued(Constants.WORK_NAME_HOME, minimumGeneration = reset.generation + 1)
assertEquals(reset.id, updated.id)
assertEquals(reset.nextScheduleTimeMillis, updated.nextScheduleTimeMillis)
val spec = requireNotNull(workManager.workDatabase.workSpecDao().getWorkSpec(updated.id.toString()))
assertEquals(0, spec.periodCount)
}
@Test
fun repeatedHomeResetLeavesTheIndependentLockCountdownUntouched() = runBlocking {
scheduler.scheduleWallpaperChange(ScreenType.HOME, 60, resetInterval = true)
scheduler.scheduleWallpaperChange(ScreenType.LOCK, 90, resetInterval = true)
val home = awaitEnqueued(Constants.WORK_NAME_HOME)
val lock = awaitEnqueued(Constants.WORK_NAME_LOCK)
val before = System.currentTimeMillis()
scheduler.resetAfterManualChange(
ScreenType.HOME,
ScheduleSettings(
enableChanger = true,
separateSchedules = true,
homeEnabled = true,
lockEnabled = true,
homeAlbumId = "home",
lockAlbumId = "lock",
homeIntervalMinutes = 60,
lockIntervalMinutes = 90
),
WallpaperMode.STATIC
)
val newHome = awaitEnqueued(Constants.WORK_NAME_HOME, minimumGeneration = home.generation + 1)
val sameLock = awaitEnqueued(Constants.WORK_NAME_LOCK)
assertEquals(home.id, newHome.id)
assertTrue(newHome.nextScheduleTimeMillis >= before + TimeUnit.MINUTES.toMillis(60))
assertEquals(lock.id, sameLock.id)
assertEquals(lock.nextScheduleTimeMillis, sameLock.nextScheduleTimeMillis)
}
@Test
fun startupKeepsExistingCountdownsAndSwitchesBetweenCombinedAndSeparateJobs() = runBlocking {
scheduler.scheduleWallpaperChange(ScreenType.HOME, 60, resetInterval = true)
scheduler.scheduleWallpaperChange(ScreenType.LOCK, 90, resetInterval = true)
val home = awaitEnqueued(Constants.WORK_NAME_HOME)
val lock = awaitEnqueued(Constants.WORK_NAME_LOCK)
val settings = ScheduleSettings(
enableChanger = true, homeEnabled = true, lockEnabled = true,
homeAlbumId = "home", lockAlbumId = "lock", separateSchedules = true,
homeIntervalMinutes = 15, lockIntervalMinutes = 15
)
scheduler.updateSchedules(settings, WallpaperMode.STATIC, onlyIfNotScheduled = true)
awaitEnqueued(Constants.WORK_NAME_REFRESH)
for ((name, previous) in listOf(Constants.WORK_NAME_HOME to home, Constants.WORK_NAME_LOCK to lock)) {
val kept = awaitEnqueued(name)
assertEquals(previous.id, kept.id)
assertEquals(previous.generation, kept.generation)
assertEquals(previous.nextScheduleTimeMillis, kept.nextScheduleTimeMillis)
}
scheduler.updateSchedules(settings.copy(homeIntervalMinutes = 60, lockAlbumId = "home", separateSchedules = false), WallpaperMode.STATIC, onlyIfNotScheduled = true)
awaitEnqueued(Constants.WORK_NAME_BOTH)
awaitCancelled(Constants.WORK_NAME_HOME)
awaitCancelled(Constants.WORK_NAME_LOCK)
scheduler.updateSchedules(settings.copy(homeIntervalMinutes = 30, lockIntervalMinutes = 45), WallpaperMode.STATIC, onlyIfNotScheduled = true)
val newHome = awaitEnqueued(Constants.WORK_NAME_HOME)
val newLock = awaitEnqueued(Constants.WORK_NAME_LOCK)
awaitCancelled(Constants.WORK_NAME_BOTH)
assertTrue(home.id != newHome.id)
assertTrue(lock.id != newLock.id)
}
private suspend fun awaitCancelled(name: String) = withTimeout(10_000) {
workManager.getWorkInfosForUniqueWorkFlow(name).first { infos ->
infos.isNotEmpty() && infos.all { it.state == WorkInfo.State.CANCELLED }
}
}
private suspend fun awaitEnqueued(
name: String,
minimumGeneration: Int = 0
): WorkInfo =
withTimeout(10_000) {
workManager.getWorkInfosForUniqueWorkFlow(name).first { infos ->
infos.any {
it.state == WorkInfo.State.ENQUEUED &&
it.generation >= minimumGeneration
}
}.single {
it.state == WorkInfo.State.ENQUEUED &&
it.generation >= minimumGeneration
}
}
}
+84 -31
View File
@@ -2,49 +2,102 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />
<uses-permission android:name="android.permission.SET_WALLPAPER"/>
<!-- Permissions -->
<uses-permission android:name="android.permission.SET_WALLPAPER" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
<!-- WorkManager contributes this permission for optional network constraints. Paperize never
schedules network-constrained work, so keep it out of the final manifest. -->
<uses-permission
android:name="android.permission.ACCESS_NETWORK_STATE"
tools:node="remove" />
<!-- Features -->
<uses-feature
android:name="android.software.wallpaper"
android:required="false" />
<application
android:name=".PaperizeApplication"
android:allowBackup="false"
android:name=".App"
android:persistent="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/app_icon"
android:fullBackupContent="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.Paperize" tools:targetApi="tiramisu">
<activity
android:name=".feature.wallpaper.presentation.MainActivity"
android:windowSoftInputMode="adjustResize"
android:exported="true"
android:theme="@style/Theme.Paperize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<receiver android:name=".feature.wallpaper.wallpaper_alarmmanager.WallpaperReceiver" />
<service android:name=".feature.wallpaper.wallpaper_service.WallpaperService1"/>
<service android:name=".feature.wallpaper.wallpaper_service.WallpaperService2"/>
<receiver android:name=".feature.wallpaper.wallpaper_alarmmanager.WallpaperBootAndTimeChangeReceiver"
android:exported="false">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.TIME_SET" />
<action android:name="android.intent.action.TIMEZONE_CHANGED" />
</intent-filter>
</receiver>
android:theme="@style/Theme.Paperize">
<!-- Disable default WorkManager initialization (using custom Configuration.Provider) -->
<provider
android:name="androidx.startup.InitializationProvider"
android:authorities="${applicationId}.androidx-startup"
android:exported="false"
tools:node="merge">
<meta-data android:name="androidx.emoji2.text.EmojiCompatInitializer"
<meta-data
android:name="androidx.work.WorkManagerInitializer"
android:value="androidx.startup"
tools:node="remove" />
</provider>
<!-- Main Activity -->
<activity
android:name=".presentation.MainActivity"
android:exported="true"
android:configChanges="uiMode|density|orientation|screenSize|screenLayout|keyboardHidden|keyboard"
android:theme="@style/Theme.App.Starting">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data
android:name="android.app.shortcuts"
android:resource="@xml/shortcuts" />
</activity>
<activity
android:name=".service.shortcut.WallpaperShortcutActivity"
android:excludeFromRecents="true"
android:exported="false"
android:noHistory="true"
android:taskAffinity=""
android:theme="@android:style/Theme.NoDisplay" />
<service
android:name=".service.wallpaper.WallpaperChangeService"
android:enabled="true"
android:exported="false"
android:foregroundServiceType="dataSync" />
<!-- Quick Settings Tile -->
<service
android:name=".service.tile.WallpaperTileService"
android:exported="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:permission="android.permission.BIND_QUICK_SETTINGS_TILE">
<intent-filter>
<action android:name="android.service.quicksettings.action.QS_TILE" />
</intent-filter>
</service>
<!-- Live Wallpaper Service -->
<service
android:name=".service.livewallpaper.PaperizeLiveWallpaperService"
android:enabled="true"
android:exported="true"
android:label="@string/live_wallpaper_name"
android:permission="android.permission.BIND_WALLPAPER">
<intent-filter>
<action android:name="android.service.wallpaper.WallpaperService" />
</intent-filter>
<meta-data
android:name="android.service.wallpaper"
android:resource="@xml/wallpaper" />
</service>
</application>
</manifest>
</manifest>
+6
View File
@@ -0,0 +1,6 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 108 108">
<rect width="108" height="108" fill="#ffd9e2"/>
<path d="M68.25 36.59L77.37 42.74A5.5 5.5 0 0 1 78.85 50.38L65.01 70.9L64.68 70.08L68.2 36.56A5.5 5.5 0 0 1 68.25 36.59Z" fill="#e03a72"/>
<path d="M49.61 32.64L60.55 33.79A5.5 5.5 0 0 1 65.44 39.83L62.76 65.34L49.55 32.63A5.5 5.5 0 0 1 49.61 32.64Z" fill="#c2255c"/>
<path d="M31.29 37.9L41.49 33.78A5.5 5.5 0 0 1 48.65 36.82L61.01 67.42A5.5 5.5 0 0 1 57.97 74.58L47.77 78.7A5.5 5.5 0 0 1 40.61 75.66L28.25 45.06A5.5 5.5 0 0 1 31.29 37.9Z" fill="#000000"/>
</svg>

After

Width:  |  Height:  |  Size: 584 B

@@ -1,20 +0,0 @@
package com.anthonyla.paperize
import android.app.Application
import android.app.NotificationChannel
import android.app.NotificationManager
import android.content.Context
import dagger.hilt.android.HiltAndroidApp
/**
* Application class for Hilt
*/
@HiltAndroidApp
class App: Application() {
override fun onCreate() {
super.onCreate()
val channel = NotificationChannel("wallpaper_service_channel", "Paperize", NotificationManager.IMPORTANCE_LOW)
val notificationManager = getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
notificationManager.createNotificationChannel(channel)
}
}
@@ -0,0 +1,61 @@
package com.anthonyla.paperize
import android.app.Application
import android.app.NotificationChannel
import android.app.NotificationManager
import androidx.hilt.work.HiltWorkerFactory
import androidx.lifecycle.DefaultLifecycleObserver
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.ProcessLifecycleOwner
import androidx.work.Configuration
import com.anthonyla.paperize.core.constants.Constants
import com.anthonyla.paperize.core.util.DataResetManager
import com.anthonyla.paperize.service.worker.WallpaperScheduler
import dagger.hilt.android.HiltAndroidApp
import javax.inject.Inject
@HiltAndroidApp
class PaperizeApplication : Application(), Configuration.Provider, DefaultLifecycleObserver {
@Inject
lateinit var workerFactory: HiltWorkerFactory
@Inject
lateinit var wallpaperScheduler: WallpaperScheduler
override fun onCreate() {
super<Application>.onCreate()
// Must run before any other initialization that accesses DB/preferences
DataResetManager.performResetIfNeeded(this)
createNotificationChannel()
// Process lifecycle distinguishes real background/foreground transitions from activity
// recreation, so folder-backed albums are refreshed whenever the user returns to the app.
ProcessLifecycleOwner.get().lifecycle.addObserver(this)
}
override val workManagerConfiguration: Configuration
get() = Configuration.Builder()
.setWorkerFactory(workerFactory)
.build()
private fun createNotificationChannel() {
val channel = NotificationChannel(
Constants.NOTIFICATION_CHANNEL_ID,
getString(R.string.app_name),
NotificationManager.IMPORTANCE_LOW
).apply {
description = getString(R.string.notification_channel_description)
setShowBadge(false)
}
val notificationManager = getSystemService(NotificationManager::class.java)
notificationManager.createNotificationChannel(channel)
}
override fun onStart(owner: LifecycleOwner) {
wallpaperScheduler.refreshAlbumsNow()
}
}
@@ -0,0 +1,13 @@
package com.anthonyla.paperize.core
import kotlinx.coroutines.CancellationException
/** [runCatching] for suspend callers: coroutine cancellation propagates instead of becoming a failure. */
inline fun <T> runCatchingCancellable(block: () -> T): Result<T> =
try {
Result.success(block())
} catch (e: CancellationException) {
throw e
} catch (e: Exception) {
Result.failure(e)
}
@@ -1,7 +0,0 @@
package com.anthonyla.paperize.core
enum class ScalingConstants {
FIT,
FILL,
STRETCH
}
@@ -0,0 +1,14 @@
package com.anthonyla.paperize.core
enum class ScalingType {
FILL,
FIT,
STRETCH,
NONE;
companion object {
fun fromString(value: String?): ScalingType {
return entries.find { it.name.equals(value, ignoreCase = true) } ?: FILL
}
}
}
@@ -0,0 +1,14 @@
package com.anthonyla.paperize.core
enum class ScreenType {
HOME,
LOCK,
BOTH,
LIVE;
companion object {
fun fromString(value: String?): ScreenType {
return entries.find { it.name.equals(value, ignoreCase = true) } ?: BOTH
}
}
}
@@ -1,29 +0,0 @@
package com.anthonyla.paperize.core
/**
* Constants for application settings
*/
object SettingsConstants {
const val SETTINGS_DATASTORE = "settings_datastore"
const val DARK_MODE_TYPE = "dark_mode_type"
const val DYNAMIC_THEME_TYPE = "dynamic_theme_type"
const val ANIMATE_TYPE = "animate_type"
const val ENABLE_CHANGER = "enable_changer"
const val HOME_WALLPAPER = "home_wallpaper"
const val LOCK_WALLPAPER = "lock_wallpaper"
const val HOME_WALLPAPER_CHANGE_INTERVAL = "home_wallpaper_change_interval"
const val LOCK_WALLPAPER_CHANGE_INTERVAL = "lock_wallpaper_change_interval"
const val WALLPAPER_CHANGE_INTERVAL_DEFAULT = 15
const val FIRST_LAUNCH = "first_launch"
const val FIRST_SET = "first_set"
const val LAST_SET_TIME = "last_set_time"
const val NEXT_SET_TIME = "next_set_time"
const val DARKEN_PERCENTAGE = "darken_percentage"
const val DARKEN = "darken"
const val WALLPAPER_SCALING = "wallpaper_scaling"
const val SCHEDULE_SEPARATELY = "schedule_separately"
const val BLUR = "blur"
const val BLUR_PERCENTAGE = "blur_percentage"
const val NEXT_SET_TIME_1 = "next_set_time_1"
const val NEXT_SET_TIME_2 = "next_set_time_2"
}
@@ -0,0 +1,5 @@
package com.anthonyla.paperize.core
class EmptyAlbumException : Exception("Album has no wallpapers")
class NoValidWallpaperException : Exception("No readable wallpaper found")
@@ -0,0 +1,17 @@
package com.anthonyla.paperize.core
/**
* How wallpapers are applied: [STATIC] via WallpaperManager.setBitmap, or [LIVE] via the
* Paperize WallpaperService (continuous rendering, double-tap and parallax, higher battery use).
* Users pick a mode during onboarding; switching later resets all data.
*/
enum class WallpaperMode {
STATIC,
LIVE;
companion object {
fun fromString(value: String?): WallpaperMode {
return entries.find { it.name.equals(value, ignoreCase = true) } ?: STATIC
}
}
}
@@ -1,263 +0,0 @@
package com.anthonyla.paperize.core
import android.app.WallpaperManager
import android.content.Context
import android.graphics.Bitmap
import android.graphics.BitmapFactory
import android.graphics.Canvas
import android.graphics.ColorMatrix
import android.graphics.ColorMatrixColorFilter
import android.graphics.Paint
import android.net.Uri
import android.util.Log
import android.util.Size
import androidx.compose.ui.util.fastRoundToInt
import androidx.core.net.toUri
import androidx.documentfile.provider.DocumentFile
import androidx.exifinterface.media.ExifInterface
import com.anthonyla.paperize.feature.wallpaper.domain.model.Folder
import com.anthonyla.paperize.feature.wallpaper.domain.model.Wallpaper
import com.google.android.renderscript.Toolkit
import com.lazygeniouz.dfc.file.DocumentFileCompat
enum class Type { HOME, LOCK, BOTH, REFRESH }
/**
* Get the dimensions of the image from the uri
*/
fun Uri.getImageDimensions(context: Context): Size? {
try {
context.contentResolver.openInputStream(this)?.use { inputStream ->
val exif = ExifInterface(inputStream)
var width = exif.getAttributeInt(ExifInterface.TAG_IMAGE_WIDTH, 0)
var height = exif.getAttributeInt(ExifInterface.TAG_IMAGE_LENGTH, 0)
if (width == 0 || height == 0) {
val options = BitmapFactory.Options().apply {
inJustDecodeBounds = true
}
BitmapFactory.decodeStream(
context.contentResolver.openInputStream(this),
null,
options
)
width = options.outWidth
height = options.outHeight
}
return Size(width, height)
}
return null
} catch (e: Exception) { return null }
}
/**
* Calculate the inSampleSize for the image
*/
fun calculateInSampleSize(imageSize: Size, width: Int, height: Int): Int {
return if (imageSize.width <= width && imageSize.height <= height) { 1 }
else { (imageSize.width/ width.toFloat()).fastRoundToInt() }
}
/**
* Scale a bitmap using the fit width method
* The bitmap will fit into the given width while maintaining the same aspect ratio
*/
fun fitBitmap(source: Bitmap, width: Int, height: Int): Bitmap {
val aspectRatio = source.height.toFloat() / source.width.toFloat()
val newHeight = (width * aspectRatio).toInt()
val newBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888)
val canvas = Canvas(newBitmap)
val scaledBitmap = Bitmap.createScaledBitmap(source, width, newHeight, true)
val top = (height - newHeight) / 2f
canvas.drawBitmap(scaledBitmap, 0f, top, null)
scaledBitmap.recycle()
return newBitmap
}
/**
* Scale a bitmap using the fill height method
*/
fun fillBitmap(source: Bitmap, width: Int, height: Int): Bitmap {
try {
val aspectRatio = source.width.toFloat() / source.height.toFloat()
var newWidth = width
var newHeight = (newWidth / aspectRatio).toInt()
if (newHeight < height) {
newHeight = height
newWidth = (newHeight * aspectRatio).toInt()
}
val scaledBitmap = Bitmap.createScaledBitmap(source, newWidth, newHeight, true)
val x = (width - newWidth) / 2f
val y = (height - newHeight) / 2f
val bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888)
val canvas = Canvas(bitmap)
canvas.drawBitmap(scaledBitmap, x, y, null)
scaledBitmap.recycle()
return bitmap
} catch (e: Exception) {
Log.e("WallpaperUtil", "Error filling bitmap: $e")
return source
}
}
/**
* Stretch the bitmap to fit the given width and height
*/
fun stretchBitmap(source: Bitmap, width: Int, height: Int): Bitmap {
try {
val newBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888)
val canvas = Canvas(newBitmap)
val bitmap = Bitmap.createScaledBitmap(source, width, height, true)
canvas.drawBitmap(bitmap, 0f, 0f, null)
bitmap.recycle()
return newBitmap
} catch (e: Exception) {
Log.e("WallpaperUtil", "Error stretching bitmap: $e")
return source
}
}
/**
* Darken the bitmap by a certain percentage - 0 is darkest, 100 is original
*/
fun darkenBitmap(source: Bitmap, percent: Int): Bitmap {
try {
val safePercentage = (100 - percent).coerceIn(0, 100)
val factor = 1 - safePercentage / 100f
val canvas = Canvas(source)
val paint = Paint().apply {
colorFilter = ColorMatrixColorFilter(ColorMatrix().apply {
setScale(factor, factor, factor, 1f)
})
}
canvas.drawBitmap(source, 0f, 0f, paint)
return source
} catch (e: Exception) {
Log.e("WallpaperUtil", "Error darkening bitmap: $e")
return source
}
}
fun blurBitmap(source: Bitmap, percent: Int): Bitmap {
try {
val factor = percent.toFloat().div(100f) * 10
return Toolkit.blur(source, factor.toInt())
} catch (e: Exception) {
Log.e("WallpaperUtil", "Error darkening bitmap: $e")
return source
}
}
/**
* Retrieve wallpaper URIs from a folder directory URI
*/
fun getWallpaperFromFolder(folderUri: String, context: Context): List<String> {
try {
val folderDocumentFile = DocumentFileCompat.fromTreeUri(context, folderUri.toUri())
return listFilesRecursive(folderDocumentFile, context)
} catch (e: Exception) {
val folderDocumentFile = DocumentFile.fromTreeUri(context, folderUri.toUri())
return listFilesRecursive(folderDocumentFile, context)
}
}
/**
* Helper function to recursively list files in a directory for DocumentFileCompat
*/
fun listFilesRecursive(parent: DocumentFileCompat?, context: Context): List<String> {
val files = mutableListOf<String>()
parent?.listFiles()?.forEach { file ->
if (file.isDirectory()) {
files.addAll(listFilesRecursive(file, context))
} else {
val allowedExtensions = listOf("jpg", "jpeg", "png", "heif", "webp", "JPG", "JPEG", "PNG", "HEIF", "WEBP")
if (file.extension in allowedExtensions) {
files.add(file.uri.toString())
}
}
}
return files
}
/** Overloaded version of the function for DocumentFile */
fun listFilesRecursive(parent: DocumentFile?, context: Context): List<String> {
val files = mutableListOf<String>()
parent?.listFiles()?.forEach { file ->
if (file.isDirectory) {
files.addAll(listFilesRecursive(file, context))
} else {
val allowedExtensions = listOf("jpg", "jpeg", "png", "heif", "webp", "JPG", "JPEG", "PNG", "HEIF", "WEBP")
if ((file.name?.substringAfterLast(".") ?: "") in allowedExtensions) {
files.add(file.uri.toString())
}
}
}
return files
}
/**
* Helper function to find the first valid URI from a list of wallpapers
* It will search through all wallpapers of an album first, and then all wallpapers of every folder of an album
*/
fun findFirstValidUri(context: Context, wallpapers: List<Wallpaper>, folders: List<Folder>): String? {
wallpapers.forEach { wallpaper ->
try {
val file = DocumentFileCompat.fromSingleUri(context, wallpaper.wallpaperUri.toUri())
if (file?.exists() == true) {
return wallpaper.wallpaperUri
}
} catch (e: Exception) {
val file = DocumentFile.fromSingleUri(context, wallpaper.wallpaperUri.toUri())
if (file?.exists() == true) {
return wallpaper.wallpaperUri
}
}
}
folders.forEach { folder ->
folder.wallpapers.forEach { wallpaper ->
try {
val file = DocumentFileCompat.fromSingleUri(context, wallpaper.toUri())
if (file?.exists() == true) {
return wallpaper
}
} catch (e: Exception) {
val file = DocumentFile.fromSingleUri(context, wallpaper.toUri())
if (file?.exists() == true) {
return wallpaper
}
}
}
}
return null
}
/**
* Get the folder name from the folder URI
*/
fun getFolderNameFromUri(folderUri: String, context: Context): String? {
return try {
DocumentFileCompat.fromTreeUri(context, folderUri.toUri())?.name
} catch (e: Exception) {
DocumentFile.fromTreeUri(context, folderUri.toUri())?.name
}
}
/**
* Check if a URI is valid
*/
fun isValidUri(context: Context, uriString: String?): Boolean {
val uri = uriString?.toUri()
return try {
uri?.let {
val inputStream = context.contentResolver.openInputStream(it)
inputStream?.close()
}
true
} catch (e: Exception) { false }
}
/**
* Check if device uses a live wallpaper
*/
fun isLiveWallpaperSet(context: Context): Boolean {
val wallpaperManager = WallpaperManager.getInstance(context)
return wallpaperManager.wallpaperInfo != null
}
@@ -0,0 +1,77 @@
package com.anthonyla.paperize.core.constants
object Constants {
const val DATABASE_NAME = "paperize_database"
const val DATABASE_VERSION = 4
const val PREFERENCES_NAME = "paperize_preferences"
const val NOTIFICATION_CHANNEL_ID = "paperize_channel"
const val NOTIFICATION_ID = 1
const val WORK_NAME_HOME = "wallpaper_change_home"
const val WORK_NAME_LOCK = "wallpaper_change_lock"
const val WORK_NAME_BOTH = "wallpaper_change_both"
const val WORK_NAME_LIVE = "wallpaper_change_live"
const val WORK_NAME_REFRESH = "album_refresh"
const val MAX_WORK_RETRY_ATTEMPTS = 3
const val EXTRA_SCREEN_TYPE = "screen_type"
const val DEFAULT_BLUR_PERCENTAGE = 0
const val DEFAULT_DARKEN_PERCENTAGE = 0
const val DEFAULT_VIGNETTE_PERCENTAGE = 0
const val DEFAULT_PARALLAX_INTENSITY = 50
const val DEFAULT_GRAYSCALE_PERCENTAGE = 0
const val MAX_EFFECT_PERCENTAGE = 100
const val SLIDER_EFFECT_STEPS = 99
const val DIALOG_MESSAGE_MAX_LINES = 10
const val MIN_EFFECT_PERCENTAGE = 0
const val MIN_LIVE_INTERVAL_MINUTES = 1
const val MIN_INTERVAL_MINUTES = 15
const val MAX_INTERVAL_MINUTES = 43200 // 30 days in minutes
const val DEFAULT_INTERVAL_MINUTES = 60
const val ANIMATION_DURATION_LONG_MS = 800
const val DEBOUNCE_DELAY_MS = 500L
const val SETTINGS_DEBOUNCE_MS = 2000L
const val WALLPAPER_ASPECT_RATIO = 9f / 16f
const val GRID_THUMBNAIL_WIDTH = 300
const val GRID_THUMBNAIL_HEIGHT = 500
const val LIST_THUMBNAIL_SIZE = 150
const val PREVIEW_THUMBNAIL_WIDTH = 600
const val PREVIEW_THUMBNAIL_HEIGHT = 1200
const val MAX_BLUR_RADIUS = 25.0f
const val BRIGHTNESS_SAMPLE_SIZE = 10
// ITU-R BT.709
const val LUMINANCE_RED = 0.2126
const val LUMINANCE_GREEN = 0.7152
const val LUMINANCE_BLUE = 0.0722
// Adaptive brightness thresholds follow WallYou.
const val LIGHT_BRIGHTNESS_MIN = 0.8f
const val DARK_BRIGHTNESS_MAX = 0.3f
const val TARGET_BRIGHTNESS_DARK = 0.7f
const val TARGET_BRIGHTNESS_LIGHT = 0.4f
const val VIGNETTE_DIVISOR = 150f
const val VIGNETTE_MIN_RADIUS = 1f // guards against zero-radius RadialGradient crash
const val VIGNETTE_INNER_ALPHA = 0.1f
const val VIGNETTE_OUTER_ALPHA = 0.8f
val VIGNETTE_GRADIENT_POSITIONS = floatArrayOf(0f, 0.7f, 1f)
const val MAX_DAYS_INPUT_LENGTH = 3
const val MAX_HOURS_MINUTES_INPUT_LENGTH = 2
val SUPPORTED_IMAGE_EXTENSIONS = setOf(
"jpg", "jpeg", "png", "webp", "avif", "heic", "heif", "bmp", "gif", "tiff", "tif"
)
const val CROSSFADE_DURATION_MS = 750f
const val BLUR_MIN_THRESHOLD = 0.01f
const val MAX_WALLPAPER_LOAD_RETRIES = 10
}
@@ -0,0 +1,37 @@
package com.anthonyla.paperize.core.util
import android.content.Context
import android.content.Intent
import androidx.core.net.toUri
import android.os.PowerManager
import android.provider.Settings
import android.util.Log
object BatteryOptimizationUtil {
private const val TAG = "BatteryOptimizationUtil"
fun isIgnoringBatteryOptimizations(context: Context): Boolean {
val powerManager = context.getSystemService(PowerManager::class.java)
return powerManager.isIgnoringBatteryOptimizations(context.packageName)
}
fun requestIgnoreBatteryOptimizations(context: Context) {
try {
val intent = Intent(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS).apply {
data = "package:${context.packageName}".toUri()
addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
}
context.startActivity(intent)
} catch (e: Exception) {
Log.e(TAG, "Error requesting battery optimization exclusion", e)
try {
val fallbackIntent = Intent(Settings.ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS).apply {
addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
}
context.startActivity(fallbackIntent)
} catch (e2: Exception) {
Log.e(TAG, "Error opening battery optimization settings", e2)
}
}
}
}
@@ -0,0 +1,48 @@
package com.anthonyla.paperize.core.util
import android.graphics.Bitmap
import com.anthonyla.paperize.core.constants.Constants
object BrightnessCalculator {
/** Estimates luminance with BT.709 coefficients; channels remain in their encoded color space. */
private fun calculateLuminance(pixel: Int): Double {
val r = ((pixel shr 16) and 0xFF) / 255.0
val g = ((pixel shr 8) and 0xFF) / 255.0
val b = (pixel and 0xFF) / 255.0
return Constants.LUMINANCE_RED * r + Constants.LUMINANCE_GREEN * g + Constants.LUMINANCE_BLUE * b
}
/** Samples rows in bulk to avoid a JNI call for every pixel. Returns brightness in 0..1. */
fun calculateBitmapBrightness(bitmap: Bitmap): Float {
val sampleSize = Constants.BRIGHTNESS_SAMPLE_SIZE
val w = bitmap.width
val h = bitmap.height
val rowBuffer = IntArray(w)
var totalLuminance = 0.0
var pixelCount = 0
for (y in 0 until h step sampleSize) {
bitmap.getPixels(rowBuffer, 0, w, 0, y, w, 1)
for (x in 0 until w step sampleSize) {
totalLuminance += calculateLuminance(rowBuffer[x])
pixelCount++
}
}
return (totalLuminance / pixelCount).toFloat()
}
fun getAdaptiveMultiplier(isDarkMode: Boolean, brightness: Float): Float {
// Avoid issues with very dark items or division by zero
if (brightness < 0.01f) return 1.0f
return when {
isDarkMode && brightness > Constants.LIGHT_BRIGHTNESS_MIN -> Constants.TARGET_BRIGHTNESS_DARK / brightness
!isDarkMode && brightness < Constants.DARK_BRIGHTNESS_MAX -> Constants.TARGET_BRIGHTNESS_LIGHT / brightness
else -> 1.0f
}
}
}
@@ -0,0 +1,39 @@
package com.anthonyla.paperize.core.util
import android.content.Context
import android.util.Log
import androidx.core.content.edit
import androidx.datastore.preferences.preferencesDataStoreFile
import com.anthonyla.paperize.core.constants.Constants
/**
* Wipes all data once when upgrading across a major version whose data is incompatible.
* The flag lives in its own preferences file so it survives the wipe.
*/
object DataResetManager {
private const val TAG = "DataResetManager"
private const val VERSION_PREFS_NAME = "version_prefs"
private const val KEY_LAST_RESET_VERSION = "last_reset_version"
/** Increment for a release that needs a wipe. 4 = the v4.0.0 rewrite. */
private const val TARGET_RESET_VERSION = 4
/** Must run before anything opens the database or preferences. */
fun performResetIfNeeded(context: Context) {
val versionPrefs = context.getSharedPreferences(VERSION_PREFS_NAME, Context.MODE_PRIVATE)
val lastResetVersion = versionPrefs.getInt(KEY_LAST_RESET_VERSION, 0)
if (lastResetVersion >= TARGET_RESET_VERSION) return
Log.w(TAG, "Performing data reset: upgrading from version $lastResetVersion to $TARGET_RESET_VERSION")
try {
context.deleteDatabase(Constants.DATABASE_NAME)
context.preferencesDataStoreFile(Constants.PREFERENCES_NAME).delete()
} catch (e: Exception) {
Log.e(TAG, "Error during data reset", e)
} finally {
// Do not repeat a destructive upgrade attempt on the next launch after a failure.
versionPrefs.edit { putInt(KEY_LAST_RESET_VERSION, TARGET_RESET_VERSION) }
}
}
}
@@ -0,0 +1,16 @@
package com.anthonyla.paperize.core.util
import android.content.ContentResolver
import android.net.Uri
import java.util.UUID
fun Uri.isReadable(contentResolver: ContentResolver): Boolean {
if (scheme != ContentResolver.SCHEME_CONTENT) return false
return try {
contentResolver.openFileDescriptor(this, "r")?.use { true } ?: false
} catch (_: Exception) {
false
}
}
fun generateId(): String = UUID.randomUUID().toString()
@@ -0,0 +1,24 @@
package com.anthonyla.paperize.core.util
import com.anthonyla.paperize.core.ScalingType
import kotlin.math.roundToInt
internal fun calculateDecodeSize(
sourceWidth: Int,
sourceHeight: Int,
targetWidth: Int,
targetHeight: Int,
scaling: ScalingType
): Pair<Int, Int> {
val widthRatio = targetWidth.toFloat() / sourceWidth
val heightRatio = targetHeight.toFloat() / sourceHeight
val scale = when (scaling) {
ScalingType.FILL -> maxOf(widthRatio, heightRatio)
ScalingType.FIT -> minOf(widthRatio, heightRatio)
// Keep native size unless decoding would exceed twice the screen size.
ScalingType.NONE -> minOf(1f, widthRatio * 2, heightRatio * 2)
ScalingType.STRETCH -> return targetWidth to targetHeight
}
return (sourceWidth * scale).roundToInt().coerceAtLeast(1) to
(sourceHeight * scale).roundToInt().coerceAtLeast(1)
}
@@ -0,0 +1,22 @@
package com.anthonyla.paperize.core.util
import android.Manifest
import android.content.Context
import android.content.pm.PackageManager
import android.os.Build
import androidx.core.content.ContextCompat
object PermissionUtil {
fun hasNotificationPermission(context: Context): Boolean {
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
ContextCompat.checkSelfPermission(
context,
Manifest.permission.POST_NOTIFICATIONS
) == PackageManager.PERMISSION_GRANTED
} else {
true
}
}
}
@@ -0,0 +1,20 @@
package com.anthonyla.paperize.core.util
object QueueBuilder {
fun mergeWithExistingQueue(
existingQueueIds: List<String>,
allWallpaperIds: List<String>
): List<String> {
val allSet = allWallpaperIds.toHashSet()
val existingSet = existingQueueIds.toHashSet()
val existingValid = existingQueueIds.filter { it in allSet }
val newWallpaperIds = allWallpaperIds.filter { it !in existingSet }
return existingValid + newWallpaperIds.shuffled()
}
/** Ids before [pickedId] are left out: the ordered rebuild of an empty queue starts at the first item. */
fun idsAfter(orderedIds: List<String>, pickedId: String): List<String> {
val index = orderedIds.indexOf(pickedId)
return if (index < 0) orderedIds else orderedIds.subList(index + 1, orderedIds.size).toList()
}
}
@@ -0,0 +1,11 @@
package com.anthonyla.paperize.core.util
import android.app.WallpaperManager
import android.graphics.Bitmap
import java.io.IOException
/** Apply a bitmap and treat WallpaperManager's documented zero return value as a failure. */
fun WallpaperManager.setBitmapChecked(bitmap: Bitmap, which: Int): Int =
setBitmap(bitmap, null, true, which).also { wallpaperId ->
if (wallpaperId == 0) throw IOException("WallpaperManager rejected the wallpaper")
}
@@ -0,0 +1,414 @@
package com.anthonyla.paperize.core.util
import android.content.Context
import android.graphics.Bitmap
import androidx.core.graphics.createBitmap
import android.graphics.Canvas
import android.graphics.Color
import android.graphics.ColorMatrix
import android.graphics.ColorMatrixColorFilter
import android.graphics.HardwareRenderer
import android.graphics.ImageDecoder
import android.graphics.Paint
import android.graphics.PixelFormat
import android.graphics.PorterDuff
import android.graphics.PorterDuffXfermode
import android.graphics.RadialGradient
import android.graphics.RenderEffect
import android.graphics.RenderNode
import android.graphics.Rect
import android.graphics.RectF
import android.graphics.Shader
import android.hardware.display.DisplayManager
import android.hardware.HardwareBuffer
import android.media.ImageReader
import android.net.Uri
import android.util.Log
import android.util.Size
import android.view.Display
import android.view.WindowManager
import android.view.WindowMetrics
import androidx.compose.ui.util.fastRoundToInt
import androidx.core.graphics.scale
import com.anthonyla.paperize.core.ScalingType
import com.anthonyla.paperize.core.ScreenType
import com.anthonyla.paperize.core.constants.Constants
import kotlin.math.hypot
private const val TAG = "WallpaperUtil"
private const val BUILT_IN_DISPLAY_CATEGORY =
"android.hardware.display.category.BUILT_IN_DISPLAYS"
fun getDeviceScreenSize(context: Context): Size {
val windowManager = context.getSystemService(WindowManager::class.java)
val metrics: WindowMetrics = windowManager.currentWindowMetrics
val currentWindow = metrics.bounds.width() to metrics.bounds.height()
// Display.Mode dimensions are reported in the panel's natural orientation. Prefer them
// over currentWindowMetrics so a scheduled change while a landscape game is foregrounded
// cannot permanently rotate and over-crop the wallpaper bitmap.
val displayManager = context.getSystemService(DisplayManager::class.java)
val builtInDisplays = displayManager
?.getDisplays(BUILT_IN_DISPLAY_CATEGORY)
.orEmpty()
val candidateDisplays = if (builtInDisplays.isNotEmpty()) {
// Android 17+ returns all built-in panels, including currently inactive panels.
builtInDisplays.asSequence()
} else {
// Compatibility fallback for releases where the built-in category is unknown.
// Exclude presentation and app-owned virtual displays.
displayManager?.displays
?.asSequence()
?.filter { display ->
display.flags and Display.FLAG_PRESENTATION == 0 &&
display.flags and Display.FLAG_PRIVATE == 0
}
.orEmpty()
}
val supportedModes = candidateDisplays
.flatMap { display ->
display.supportedModes.asSequence().map { mode ->
mode.physicalWidth to mode.physicalHeight
}
}
.toList()
val selected = selectWallpaperDisplayDimensions(currentWindow, supportedModes)
return Size(selected.first, selected.second)
}
internal fun selectWallpaperDisplayDimensions(
currentWindow: Pair<Int, Int>,
supportedModes: Iterable<Pair<Int, Int>>
): Pair<Int, Int> = selectLargestDisplayDimensions(supportedModes)
?: currentWindow.takeIf { (width, height) -> width > 0 && height > 0 }
?: (1 to 1)
internal fun selectLargestDisplayDimensions(
candidates: Iterable<Pair<Int, Int>>
): Pair<Int, Int>? = candidates
.filter { (width, height) -> width > 0 && height > 0 }
.maxWithOrNull(
compareBy<Pair<Int, Int>>(
{ (width, height) -> width.toLong() * height.toLong() },
{ (width, height) -> maxOf(width, height) },
{ (width, height) -> minOf(width, height) }
)
)
/**
* Whether a static wallpaper should retain source overflow for launcher-managed scrolling.
*
* FIT/STRETCH/NONE use an exact launcher canvas so Android cannot rescale them into FILL.
*/
internal fun usesLauncherManagedScrolling(
screenType: ScreenType,
scaling: ScalingType,
scrollingEnabled: Boolean
): Boolean =
scrollingEnabled &&
(screenType == ScreenType.HOME ||
screenType == ScreenType.BOTH) &&
scaling == ScalingType.FILL
fun retrieveBitmap(
context: Context,
wallpaperUri: Uri,
width: Int,
height: Int,
scaling: ScalingType = ScalingType.FIT,
preserveSourceOverflow: Boolean = false
): Bitmap? {
// ImageDecoder applies EXIF orientation and reports dimensions after it.
val bitmap = try {
val source = ImageDecoder.createSource(context.contentResolver, wallpaperUri)
ImageDecoder.decodeBitmap(source) { decoder, info, _ ->
val (targetW, targetH) = calculateDecodeSize(
info.size.width, info.size.height, width, height, scaling
)
decoder.setTargetSize(targetW, targetH)
// Crop during decode to avoid allocating fill-scale overflow.
if (scaling == ScalingType.FILL && !preserveSourceOverflow &&
(targetW > width || targetH > height)
) {
val cropX = ((targetW - width) / 2).coerceAtLeast(0)
val cropY = ((targetH - height) / 2).coerceAtLeast(0)
decoder.setCrop(Rect(cropX, cropY, cropX + width, cropY + height))
}
decoder.isMutableRequired = true
decoder.allocator = ImageDecoder.ALLOCATOR_SOFTWARE
decoder.setOnPartialImageListener { true }
}
} catch (e: Exception) {
Log.w(TAG, "Could not decode $wallpaperUri: $e")
null
} catch (e: OutOfMemoryError) {
Log.e(TAG, "OOM during retrieveBitmap for $wallpaperUri: $e")
null
}
// An exact canvas prevents the launcher from undoing the selected scaling mode.
return bitmap?.let {
if (preserveSourceOverflow && scaling == ScalingType.FILL) {
scaleToFillPreservingOverflow(it, width, height)
} else {
finalizeToCanvas(it, width, height, scaling)
}
}
}
/**
* Scale [source] just enough to cover one screen while retaining any overflow.
*
* The returned bitmap may be wider than [width] or taller than [height]. That overflow is what a
* launcher uses to scroll a static wallpaper without moving past the source image's real edge.
*/
private fun scaleToFillPreservingOverflow(
source: Bitmap,
width: Int,
height: Int
): Bitmap {
val scale = maxOf(
width.toFloat() / source.width,
height.toFloat() / source.height
)
val targetW = (source.width * scale).fastRoundToInt()
val targetH = (source.height * scale).fastRoundToInt()
if (targetW == source.width && targetH == source.height) return source
val scaled = source.scale(targetW, targetH)
if (scaled !== source) source.recycle()
return scaled
}
/** Render the decoded bitmap onto the requested canvas; consumes [source]. */
internal fun finalizeToCanvas(source: Bitmap, canvasW: Int, canvasH: Int, scaling: ScalingType): Bitmap {
if (source.width == canvasW && source.height == canvasH) return source
val widthRatio = canvasW.toFloat() / source.width
val heightRatio = canvasH.toFloat() / source.height
val scale = when (scaling) {
ScalingType.FILL -> maxOf(widthRatio, heightRatio)
ScalingType.FIT -> minOf(widthRatio, heightRatio)
ScalingType.NONE, ScalingType.STRETCH -> 1f
}
val width = if (scaling == ScalingType.STRETCH) canvasW.toFloat() else source.width * scale
val height = if (scaling == ScalingType.STRETCH) canvasH.toFloat() else source.height * scale
val left = (canvasW - width) / 2f
val top = (canvasH - height) / 2f
val result = createBitmap(canvasW, canvasH)
Canvas(result).apply {
drawColor(Color.BLACK)
drawBitmap(source, null, RectF(left, top, left + width, top + height), Paint(Paint.FILTER_BITMAP_FLAG))
}
source.recycle()
return result
}
private fun drawVignette(canvas: Canvas, width: Int, height: Int, percent: Int) {
val centerX = width / 2f
val centerY = height / 2f
val radius = (hypot(centerX, centerY) *
(1 - percent.coerceIn(0, 100) / Constants.VIGNETTE_DIVISOR))
.coerceAtLeast(Constants.VIGNETTE_MIN_RADIUS)
val paint = Paint(Paint.ANTI_ALIAS_FLAG).apply {
shader = RadialGradient(
centerX, centerY, radius,
intArrayOf(
Color.TRANSPARENT,
Color.argb((Constants.VIGNETTE_INNER_ALPHA * 255).toInt(), 0, 0, 0),
Color.argb((Constants.VIGNETTE_OUTER_ALPHA * 255).toInt(), 0, 0, 0)
),
Constants.VIGNETTE_GRADIENT_POSITIONS, Shader.TileMode.CLAMP
)
}
canvas.drawRect(0f, 0f, width.toFloat(), height.toFloat(), paint)
}
fun adjustBitmapBrightness(source: Bitmap, brightnessFactor: Float): Bitmap {
if (brightnessFactor == 1.0f) return source
if (!source.isMutable) {
Log.w(TAG, "adjustBitmapBrightness received an immutable bitmap. Returning a copy.")
val mutableCopy = source.copy(source.config ?: Bitmap.Config.ARGB_8888, true)
// Do not recycle source here — caller owns the lifecycle and handles recycling
return adjustBitmapBrightness(mutableCopy, brightnessFactor)
}
val paint = Paint().apply {
colorFilter = ColorMatrixColorFilter(ColorMatrix().apply {
setScale(brightnessFactor, brightnessFactor, brightnessFactor, 1f)
})
xfermode = PorterDuffXfermode(PorterDuff.Mode.SRC)
}
Canvas(source).drawBitmap(source, 0f, 0f, paint)
return source
}
fun getAdaptiveBrightnessMultiplier(context: Context, brightness: Float): Float {
return BrightnessCalculator.getAdaptiveMultiplier(context.resources.configuration.isNightModeActive, brightness)
}
fun adaptiveBrightnessAdjustment(context: Context, source: Bitmap): Bitmap {
val brightness = BrightnessCalculator.calculateBitmapBrightness(source)
return adjustBitmapBrightness(source, getAdaptiveBrightnessMultiplier(context, brightness))
}
fun processBitmap(
source: Bitmap,
enableDarken: Boolean = false,
darkenPercent: Int = 0,
enableBlur: Boolean = false,
blurPercent: Int = 0,
enableVignette: Boolean = false,
vignettePercent: Int = 0,
enableGrayscale: Boolean = false,
grayscalePercent: Int = 0
): Bitmap {
val hasDarken = enableDarken && darkenPercent > 0
val hasBlur = enableBlur && blurPercent > 0
val hasVignette = enableVignette && vignettePercent > 0
val hasGrayscale = enableGrayscale && grayscalePercent > 0
if (!hasDarken && !hasBlur && !hasVignette && !hasGrayscale) return source
try {
return processBitmapGpu(
source,
hasDarken, darkenPercent,
hasBlur, blurPercent,
hasVignette, vignettePercent,
hasGrayscale, grayscalePercent
)
} catch (e: Exception) {
Log.w(TAG, "GPU effects pipeline failed, falling back to CPU: $e")
} catch (e: OutOfMemoryError) {
Log.w(TAG, "OOM in GPU effects pipeline, falling back to CPU: $e")
}
return processBitmapCpu(
source,
hasDarken, darkenPercent,
hasVignette, vignettePercent,
hasGrayscale, grayscalePercent
)
}
/**
* GPU-accelerated effects pipeline.
*
* Chains darken, blur, and grayscale as [RenderEffect]s on a single [RenderNode],
* draws the vignette overlay on the same canvas, and reads back the result once.
*/
private fun processBitmapGpu(
source: Bitmap,
hasDarken: Boolean, darkenPercent: Int,
hasBlur: Boolean, blurPercent: Int,
hasVignette: Boolean, vignettePercent: Int,
hasGrayscale: Boolean, grayscalePercent: Int
): Bitmap {
val w = source.width
val h = source.height
val imageReader = ImageReader.newInstance(
w, h, PixelFormat.RGBA_8888, 1,
HardwareBuffer.USAGE_GPU_SAMPLED_IMAGE or HardwareBuffer.USAGE_GPU_COLOR_OUTPUT
)
val renderNode = RenderNode("EffectsChain")
val hardwareRenderer = HardwareRenderer()
try {
hardwareRenderer.setSurface(imageReader.surface)
hardwareRenderer.setContentRoot(renderNode)
renderNode.setPosition(0, 0, w, h)
var effect: RenderEffect? = null
if (hasDarken) {
val factor = (100 - darkenPercent.coerceIn(0, 100)) / 100f
val cm = ColorMatrix().apply { setScale(factor, factor, factor, 1f) }
val darkenEffect = RenderEffect.createColorFilterEffect(ColorMatrixColorFilter(cm))
effect = darkenEffect
}
if (hasBlur) {
val radius = (blurPercent.coerceIn(0, 100) / 100f) * Constants.MAX_BLUR_RADIUS
val blurEffect = RenderEffect.createBlurEffect(radius, radius, Shader.TileMode.CLAMP)
effect = if (effect != null) {
RenderEffect.createChainEffect(blurEffect, effect)
} else {
blurEffect
}
}
if (hasGrayscale) {
val factor = grayscalePercent.coerceIn(0, 100) / 100f
val cm = ColorMatrix().apply { setSaturation(1 - factor) }
val gsEffect = RenderEffect.createColorFilterEffect(ColorMatrixColorFilter(cm))
effect = if (effect != null) {
RenderEffect.createChainEffect(gsEffect, effect)
} else {
gsEffect
}
}
if (effect != null) {
renderNode.setRenderEffect(effect)
}
val canvas = renderNode.beginRecording()
canvas.drawBitmap(source, 0f, 0f, null)
if (hasVignette) {
drawVignette(canvas, w, h, vignettePercent)
}
renderNode.endRecording()
hardwareRenderer.createRenderRequest()
.setWaitForPresent(true)
.syncAndDraw()
return checkNotNull(imageReader.acquireNextImage()) { "Failed to acquire rendered image" }.use { image ->
checkNotNull(image.hardwareBuffer) { "Failed to acquire hardware buffer" }.use { buffer ->
val bitmap = checkNotNull(Bitmap.wrapHardwareBuffer(buffer, null)) { "Failed to wrap hardware buffer" }
try {
checkNotNull(bitmap.copy(Bitmap.Config.ARGB_8888, true)) { "Failed to copy hardware bitmap" }
} finally {
bitmap.recycle()
}
}
}
} finally {
hardwareRenderer.destroy()
renderNode.discardDisplayList()
imageReader.close()
}
}
/**
* Fallback when the GPU pipeline fails. Darken, grayscale and vignette are plain canvas
* operations; blur requires [RenderEffect], so it is skipped here.
*/
private fun processBitmapCpu(
source: Bitmap,
hasDarken: Boolean, darkenPercent: Int,
hasVignette: Boolean, vignettePercent: Int,
hasGrayscale: Boolean, grayscalePercent: Int
): Bitmap {
// The caller owns and recycles [source] if a copy is returned.
val result = if (source.isMutable) source else source.copy(source.config ?: Bitmap.Config.ARGB_8888, true)
val canvas = Canvas(result)
if (hasDarken || hasGrayscale) {
val colorMatrix = ColorMatrix()
if (hasGrayscale) colorMatrix.setSaturation(1 - grayscalePercent.coerceIn(0, 100) / 100f)
if (hasDarken) {
val factor = (100 - darkenPercent.coerceIn(0, 100)) / 100f
colorMatrix.postConcat(ColorMatrix().apply { setScale(factor, factor, factor, 1f) })
}
val paint = Paint().apply {
colorFilter = ColorMatrixColorFilter(colorMatrix)
xfermode = PorterDuffXfermode(PorterDuff.Mode.SRC)
}
canvas.drawBitmap(result, 0f, 0f, paint)
}
if (hasVignette) drawVignette(canvas, result.width, result.height, vignettePercent)
return result
}
@@ -1,26 +0,0 @@
package com.anthonyla.paperize.data
import android.content.Context
import android.content.Intent
import android.net.Uri
import androidx.compose.runtime.Composable
import androidx.core.content.ContextCompat.startActivity
/**
* Opens an email intent to contact the developer.
*/
@Composable
fun Contact(context: Context) {
val authorEmail = "anthonyyla.dev@gmail.com"
val cc = ""
val subject = "[Support] Paperize"
val bodyText = "This is regarding the Paperize app for Android:\n"
val mailto = "mailto:" + Uri.encode(authorEmail) +
"?cc=" + Uri.encode(cc) +
"&subject=" + Uri.encode(subject) +
"&body=" + Uri.encode(bodyText)
val emailIntent = Intent(Intent.ACTION_SENDTO)
emailIntent.setData(Uri.parse(mailto))
startActivity(context, emailIntent, null)
}
@@ -0,0 +1,42 @@
package com.anthonyla.paperize.data.database
import androidx.room.migration.Migration
import androidx.sqlite.db.SupportSQLiteDatabase
/** Versions 1–3 used the same library tables, with extra crop columns in versions 2–3. */
val LIBRARY_MIGRATIONS: Array<Migration> = (1..3).map { version ->
object : Migration(version, 4) {
override fun migrate(db: SupportSQLiteDatabase) {
// Rebuilding the parent table would cascade-delete these rows; preserve them first.
db.execSQL("CREATE TEMP TABLE saved_queue AS SELECT * FROM wallpaper_queue")
db.execSQL("DROP TABLE wallpaper_queue")
if (version >= 3) {
db.execSQL("CREATE TEMP TABLE saved_current AS SELECT * FROM wallpaper_current")
db.execSQL("DROP TABLE wallpaper_current")
}
db.execSQL("CREATE TABLE IF NOT EXISTS `wallpapers_new` (`id` TEXT NOT NULL, `albumId` TEXT NOT NULL, `folderId` TEXT, `uri` TEXT NOT NULL, `fileName` TEXT NOT NULL, `dateModified` INTEGER NOT NULL, `displayOrder` INTEGER NOT NULL, `sourceType` TEXT NOT NULL, `addedAt` INTEGER NOT NULL, `mediaType` TEXT NOT NULL, PRIMARY KEY(`id`), FOREIGN KEY(`albumId`) REFERENCES `albums`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE , FOREIGN KEY(`folderId`) REFERENCES `folders`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )")
val mediaType = if (version == 1) "'IMAGE'" else "mediaType"
db.execSQL("""
INSERT INTO wallpapers_new (id, albumId, folderId, uri, fileName, dateModified, displayOrder, sourceType, addedAt, mediaType)
SELECT id, albumId, folderId, uri, fileName, dateModified, displayOrder, sourceType, addedAt, $mediaType FROM wallpapers
""")
db.execSQL("DROP TABLE wallpapers")
db.execSQL("ALTER TABLE wallpapers_new RENAME TO wallpapers")
db.execSQL("CREATE INDEX IF NOT EXISTS `index_wallpapers_albumId` ON `wallpapers` (`albumId`)")
db.execSQL("CREATE INDEX IF NOT EXISTS `index_wallpapers_folderId` ON `wallpapers` (`folderId`)")
db.execSQL("CREATE INDEX IF NOT EXISTS `index_wallpapers_uri` ON `wallpapers` (`uri`)")
db.execSQL("CREATE TABLE IF NOT EXISTS `wallpaper_queue` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `albumId` TEXT NOT NULL, `wallpaperId` TEXT NOT NULL, `screenType` TEXT NOT NULL, `queuePosition` INTEGER NOT NULL, `addedAt` INTEGER NOT NULL, FOREIGN KEY(`albumId`) REFERENCES `albums`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE , FOREIGN KEY(`wallpaperId`) REFERENCES `wallpapers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )")
db.execSQL("CREATE INDEX IF NOT EXISTS `index_wallpaper_queue_albumId_screenType` ON `wallpaper_queue` (`albumId`, `screenType`)")
db.execSQL("CREATE INDEX IF NOT EXISTS `index_wallpaper_queue_wallpaperId` ON `wallpaper_queue` (`wallpaperId`)")
db.execSQL("CREATE INDEX IF NOT EXISTS `index_wallpaper_queue_queuePosition` ON `wallpaper_queue` (`queuePosition`)")
db.execSQL("CREATE TABLE IF NOT EXISTS `wallpaper_current` (`albumId` TEXT NOT NULL, `screenType` TEXT NOT NULL, `wallpaperId` TEXT NOT NULL, `appliedAt` INTEGER NOT NULL, PRIMARY KEY(`albumId`, `screenType`), FOREIGN KEY(`albumId`) REFERENCES `albums`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE , FOREIGN KEY(`wallpaperId`) REFERENCES `wallpapers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )")
db.execSQL("CREATE INDEX IF NOT EXISTS `index_wallpaper_current_wallpaperId` ON `wallpaper_current` (`wallpaperId`)")
db.execSQL("INSERT INTO wallpaper_queue SELECT * FROM saved_queue")
db.execSQL("DROP TABLE saved_queue")
if (version >= 3) {
db.execSQL("INSERT INTO wallpaper_current SELECT * FROM saved_current")
db.execSQL("DROP TABLE saved_current")
}
}
}
}.toTypedArray()
@@ -0,0 +1,34 @@
package com.anthonyla.paperize.data.database
import androidx.room.Database
import androidx.room.RoomDatabase
import com.anthonyla.paperize.data.database.dao.AlbumDao
import com.anthonyla.paperize.data.database.dao.FolderDao
import com.anthonyla.paperize.data.database.dao.WallpaperCurrentDao
import com.anthonyla.paperize.data.database.dao.WallpaperDao
import com.anthonyla.paperize.data.database.dao.WallpaperQueueDao
import com.anthonyla.paperize.data.database.entities.AlbumEntity
import com.anthonyla.paperize.data.database.entities.FolderEntity
import com.anthonyla.paperize.data.database.entities.WallpaperCurrentEntity
import com.anthonyla.paperize.data.database.entities.WallpaperEntity
import com.anthonyla.paperize.data.database.entities.WallpaperQueueEntity
import com.anthonyla.paperize.core.constants.Constants
@Database(
entities = [
AlbumEntity::class,
WallpaperEntity::class,
FolderEntity::class,
WallpaperQueueEntity::class,
WallpaperCurrentEntity::class
],
version = Constants.DATABASE_VERSION,
exportSchema = true
)
abstract class PaperizeDatabase : RoomDatabase() {
abstract fun albumDao(): AlbumDao
abstract fun wallpaperDao(): WallpaperDao
abstract fun folderDao(): FolderDao
abstract fun wallpaperQueueDao(): WallpaperQueueDao
abstract fun wallpaperCurrentDao(): WallpaperCurrentDao
}
@@ -0,0 +1,50 @@
package com.anthonyla.paperize.data.database.dao
import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import androidx.room.Transaction
import com.anthonyla.paperize.data.database.entities.AlbumEntity
import com.anthonyla.paperize.data.database.entities.AlbumSummaryEntity
import com.anthonyla.paperize.data.database.relations.AlbumWithDetails
import kotlinx.coroutines.flow.Flow
@Dao
interface AlbumDao {
@Query("""
SELECT
a.id,
a.name,
a.coverUri,
a.createdAt,
a.modifiedAt,
(SELECT COUNT(*) FROM wallpapers w WHERE w.albumId = a.id) as wallpaperCount,
(SELECT COUNT(*) FROM folders f WHERE f.albumId = a.id) as folderCount
FROM albums a
ORDER BY a.modifiedAt DESC
""")
fun getAlbumSummaries(): Flow<List<AlbumSummaryEntity>>
@Transaction
@Query("SELECT * FROM albums WHERE id = :albumId")
fun getAlbumWithDetails(albumId: String): Flow<AlbumWithDetails?>
@Query("SELECT * FROM albums WHERE id = :albumId")
suspend fun getAlbumById(albumId: String): AlbumEntity?
@Insert(onConflict = OnConflictStrategy.REPLACE)
suspend fun insertAlbum(album: AlbumEntity)
@Query("DELETE FROM albums WHERE id = :albumId")
suspend fun deleteAlbumById(albumId: String)
@Query("UPDATE albums SET coverUri = :coverUri, modifiedAt = :modifiedAt WHERE id = :albumId")
suspend fun updateAlbumCover(albumId: String, coverUri: String?, modifiedAt: Long)
@Query("UPDATE albums SET modifiedAt = :modifiedAt WHERE id = :albumId")
suspend fun updateAlbumModifiedTime(albumId: String, modifiedAt: Long)
@Query("DELETE FROM albums")
suspend fun deleteAllAlbums()
}
@@ -0,0 +1,45 @@
package com.anthonyla.paperize.data.database.dao
import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import androidx.room.Transaction
import com.anthonyla.paperize.data.database.entities.FolderEntity
import com.anthonyla.paperize.data.database.relations.FolderWithWallpapers
import kotlinx.coroutines.flow.Flow
@Dao
interface FolderDao {
@Query("SELECT * FROM folders WHERE albumId = :albumId ORDER BY displayOrder, id")
suspend fun getFoldersByAlbum(albumId: String): List<FolderEntity>
@Query("DELETE FROM folders WHERE id = :folderId AND albumId = :albumId")
suspend fun deleteAlbumFolder(albumId: String, folderId: String): Int
@Query("SELECT EXISTS(SELECT 1 FROM folders WHERE albumId = :albumId AND uri = :uri)")
suspend fun containsUri(albumId: String, uri: String): Boolean
@Query("SELECT COALESCE(MAX(displayOrder), -1) FROM folders WHERE albumId = :albumId")
suspend fun getMaxOrder(albumId: String): Int
@Transaction
@Query("SELECT * FROM folders WHERE id = :folderId")
fun getFolderWithWallpapers(folderId: String): Flow<FolderWithWallpapers?>
@Query("SELECT * FROM folders WHERE id = :folderId")
suspend fun getFolderById(folderId: String): FolderEntity?
@Insert(onConflict = OnConflictStrategy.REPLACE)
suspend fun insertFolder(folder: FolderEntity)
@Query("UPDATE folders SET coverUri = :coverUri WHERE id = :folderId")
suspend fun updateFolderCover(folderId: String, coverUri: String?)
@Query("""
UPDATE folders SET coverUri = (
SELECT uri FROM wallpapers WHERE folderId = folders.id ORDER BY displayOrder, id LIMIT 1
) WHERE albumId = :albumId
""")
suspend fun refreshFolderCovers(albumId: String)
}
@@ -0,0 +1,26 @@
package com.anthonyla.paperize.data.database.dao
import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import com.anthonyla.paperize.core.ScreenType
import com.anthonyla.paperize.data.database.entities.WallpaperCurrentEntity
import com.anthonyla.paperize.data.database.entities.WallpaperEntity
import kotlinx.coroutines.flow.Flow
@Dao
interface WallpaperCurrentDao {
/** Emits null until a wallpaper is applied, and again if that wallpaper or album is deleted. */
@Query("""
SELECT w.* FROM wallpapers w
INNER JOIN wallpaper_current wc ON w.id = wc.wallpaperId
WHERE wc.albumId = :albumId AND wc.screenType = :screenType
LIMIT 1
""")
fun getCurrentWallpaperFlow(albumId: String, screenType: ScreenType): Flow<WallpaperEntity?>
@Insert(onConflict = OnConflictStrategy.REPLACE)
suspend fun upsertCurrentWallpaper(entity: WallpaperCurrentEntity)
}
@@ -0,0 +1,43 @@
package com.anthonyla.paperize.data.database.dao
import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import com.anthonyla.paperize.data.database.entities.WallpaperEntity
@Dao
interface WallpaperDao {
@Query("DELETE FROM wallpapers WHERE albumId = :albumId AND id IN (:ids)")
suspend fun deleteAlbumWallpapers(albumId: String, ids: List<String>): Int
@Query("SELECT uri FROM wallpapers WHERE albumId = :albumId AND folderId IS :folderId")
suspend fun getUrisInCollection(albumId: String, folderId: String?): List<String>
@Query("DELETE FROM wallpapers WHERE albumId = :albumId AND folderId = :folderId AND uri IN (:uris)")
suspend fun deleteFolderWallpapersByUris(albumId: String, folderId: String, uris: List<String>): Int
@Query("SELECT COALESCE(MAX(displayOrder), -1) FROM wallpapers WHERE albumId = :albumId")
suspend fun getMaxOrder(albumId: String): Int
@Query("SELECT * FROM wallpapers WHERE albumId = :albumId AND (:afterId IS NULL OR id > :afterId) ORDER BY id LIMIT :limit")
suspend fun getWallpapersByAlbumPage(albumId: String, limit: Int, afterId: String?): List<WallpaperEntity>
@Query("SELECT uri FROM wallpapers WHERE albumId = :albumId ORDER BY folderId IS NOT NULL, displayOrder, id LIMIT 1")
suspend fun getAlbumCoverUri(albumId: String): String?
@Query("SELECT uri FROM wallpapers WHERE folderId = :folderId ORDER BY displayOrder, id LIMIT 1")
suspend fun getFolderCoverUri(folderId: String): String?
@Query("SELECT * FROM wallpapers WHERE id = :wallpaperId")
suspend fun getWallpaperById(wallpaperId: String): WallpaperEntity?
@Insert(onConflict = OnConflictStrategy.REPLACE)
suspend fun insertWallpapers(wallpapers: List<WallpaperEntity>)
@Query("SELECT id FROM wallpapers WHERE albumId = :albumId")
suspend fun getWallpaperIdsByAlbum(albumId: String): List<String>
@Query("SELECT id FROM wallpapers WHERE albumId = :albumId ORDER BY displayOrder, id")
suspend fun getOrderedWallpaperIdsByAlbum(albumId: String): List<String>
}
@@ -0,0 +1,97 @@
package com.anthonyla.paperize.data.database.dao
import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import androidx.room.Transaction
import com.anthonyla.paperize.core.ScreenType
import com.anthonyla.paperize.data.database.entities.WallpaperEntity
import com.anthonyla.paperize.data.database.entities.WallpaperQueueEntity
@Dao
interface WallpaperQueueDao {
@Query("""
SELECT w.* FROM wallpapers w
INNER JOIN wallpaper_queue wq ON w.id = wq.wallpaperId
WHERE wq.albumId = :albumId AND wq.screenType = :screenType
ORDER BY wq.queuePosition ASC
LIMIT 1
""")
suspend fun getNextWallpaperInQueue(albumId: String, screenType: ScreenType): WallpaperEntity?
@Transaction
suspend fun getAndDequeueWallpaper(albumId: String, screenType: ScreenType): WallpaperEntity? {
val wallpaper = getNextWallpaperInQueue(albumId, screenType)
if (wallpaper != null) {
deleteQueueItem(albumId, screenType, wallpaper.id)
}
return wallpaper
}
@Query("SELECT * FROM wallpaper_queue WHERE albumId = :albumId AND screenType = :screenType ORDER BY queuePosition ASC")
suspend fun getQueueItems(albumId: String, screenType: ScreenType): List<WallpaperQueueEntity>
@Insert(onConflict = OnConflictStrategy.REPLACE)
suspend fun insertQueueItems(items: List<WallpaperQueueEntity>)
@Query("""
DELETE FROM wallpaper_queue
WHERE albumId = :albumId AND screenType = :screenType
AND wallpaperId = :wallpaperId
""")
suspend fun deleteQueueItem(albumId: String, screenType: ScreenType, wallpaperId: String)
@Query("""
SELECT MIN(queuePosition) FROM wallpaper_queue
WHERE albumId = :albumId AND screenType = :screenType
""")
suspend fun getFirstQueuePosition(albumId: String, screenType: ScreenType): Int?
@Transaction
suspend fun restoreQueueItem(
albumId: String,
screenType: ScreenType,
wallpaperId: String
) {
deleteQueueItem(albumId, screenType, wallpaperId)
val firstPosition = getFirstQueuePosition(albumId, screenType) ?: 0
insertQueueItems(
listOf(
WallpaperQueueEntity(
albumId = albumId,
wallpaperId = wallpaperId,
screenType = screenType,
queuePosition = firstPosition - 1
)
)
)
}
@Query("DELETE FROM wallpaper_queue WHERE albumId = :albumId AND screenType = :screenType")
suspend fun clearQueue(albumId: String, screenType: ScreenType)
@Query("DELETE FROM wallpaper_queue WHERE albumId = :albumId")
suspend fun clearAllQueues(albumId: String)
@Query("DELETE FROM wallpaper_queue")
suspend fun deleteAllQueueItems()
@Transaction
suspend fun rebuildQueue(
albumId: String,
screenType: ScreenType,
wallpaperIds: List<String>
) {
clearQueue(albumId, screenType)
val items = wallpaperIds.mapIndexed { index, wallpaperId ->
WallpaperQueueEntity(
albumId = albumId,
wallpaperId = wallpaperId,
screenType = screenType,
queuePosition = index
)
}
insertQueueItems(items)
}
}
@@ -0,0 +1,14 @@
package com.anthonyla.paperize.data.database.entities
import androidx.room.Entity
import androidx.room.PrimaryKey
@Entity(tableName = "albums")
data class AlbumEntity(
@PrimaryKey
val id: String,
val name: String,
val coverUri: String?,
val createdAt: Long = System.currentTimeMillis(),
val modifiedAt: Long = System.currentTimeMillis()
)
@@ -0,0 +1,11 @@
package com.anthonyla.paperize.data.database.entities
data class AlbumSummaryEntity(
val id: String,
val name: String,
val coverUri: String?,
val wallpaperCount: Int,
val folderCount: Int,
val createdAt: Long,
val modifiedAt: Long
)
@@ -0,0 +1,35 @@
package com.anthonyla.paperize.data.database.entities
import androidx.room.Entity
import androidx.room.ForeignKey
import androidx.room.Index
import androidx.room.PrimaryKey
@Entity(
tableName = "folders",
foreignKeys = [
ForeignKey(
entity = AlbumEntity::class,
parentColumns = ["id"],
childColumns = ["albumId"],
onDelete = ForeignKey.CASCADE
)
],
indices = [
Index(value = ["albumId"]),
Index(value = ["uri"])
]
)
data class FolderEntity(
@PrimaryKey
val id: String,
val albumId: String,
val name: String,
val uri: String,
val coverUri: String?,
val dateModified: Long,
val displayOrder: Int = 0,
val addedAt: Long = System.currentTimeMillis()
)
@@ -0,0 +1,42 @@
package com.anthonyla.paperize.data.database.entities
import androidx.room.Entity
import androidx.room.ForeignKey
import androidx.room.Index
import com.anthonyla.paperize.core.ScreenType
/**
* Room entity tracking the last-applied wallpaper per (album, screen).
*
* A CASCADE on both FKs means: if the album or wallpaper is deleted the entry
* disappears automatically — the service will then fall back to a normal queue
* advance instead of reapplying a stale URI.
*/
@Entity(
tableName = "wallpaper_current",
primaryKeys = ["albumId", "screenType"],
foreignKeys = [
ForeignKey(
entity = AlbumEntity::class,
parentColumns = ["id"],
childColumns = ["albumId"],
onDelete = ForeignKey.CASCADE
),
ForeignKey(
entity = WallpaperEntity::class,
parentColumns = ["id"],
childColumns = ["wallpaperId"],
onDelete = ForeignKey.CASCADE
)
],
indices = [Index(value = ["wallpaperId"])]
)
data class WallpaperCurrentEntity(
val albumId: String,
val screenType: ScreenType,
val wallpaperId: String,
val appliedAt: Long = System.currentTimeMillis()
)
@@ -0,0 +1,48 @@
package com.anthonyla.paperize.data.database.entities
import androidx.room.Entity
import androidx.room.ForeignKey
import androidx.room.Index
import androidx.room.PrimaryKey
@Entity(
tableName = "wallpapers",
foreignKeys = [
ForeignKey(
entity = AlbumEntity::class,
parentColumns = ["id"],
childColumns = ["albumId"],
onDelete = ForeignKey.CASCADE
),
ForeignKey(
entity = FolderEntity::class,
parentColumns = ["id"],
childColumns = ["folderId"],
onDelete = ForeignKey.CASCADE
)
],
indices = [
Index(value = ["albumId"]),
Index(value = ["folderId"]),
Index(value = ["uri"])
]
)
data class WallpaperEntity(
@PrimaryKey
val id: String,
val albumId: String,
val folderId: String? = null,
val uri: String,
val fileName: String,
val dateModified: Long,
val displayOrder: Int = 0,
// Legacy: always derived from [folderId] ("DIRECT" or "FOLDER").
val sourceType: String = "DIRECT",
val addedAt: Long = System.currentTimeMillis(),
// Legacy: Paperize only stores images.
val mediaType: String = "IMAGE",
)
@@ -0,0 +1,42 @@
package com.anthonyla.paperize.data.database.entities
import androidx.room.Entity
import androidx.room.ForeignKey
import androidx.room.Index
import androidx.room.PrimaryKey
import com.anthonyla.paperize.core.ScreenType
@Entity(
tableName = "wallpaper_queue",
foreignKeys = [
ForeignKey(
entity = AlbumEntity::class,
parentColumns = ["id"],
childColumns = ["albumId"],
onDelete = ForeignKey.CASCADE
),
ForeignKey(
entity = WallpaperEntity::class,
parentColumns = ["id"],
childColumns = ["wallpaperId"],
onDelete = ForeignKey.CASCADE
)
],
indices = [
Index(value = ["albumId", "screenType"]),
Index(value = ["wallpaperId"]),
Index(value = ["queuePosition"])
]
)
data class WallpaperQueueEntity(
@PrimaryKey(autoGenerate = true)
val id: Long = 0,
val albumId: String,
val wallpaperId: String,
val screenType: ScreenType,
val queuePosition: Int,
val addedAt: Long = System.currentTimeMillis()
)
@@ -0,0 +1,26 @@
package com.anthonyla.paperize.data.database.relations
import androidx.room.Embedded
import androidx.room.Relation
import com.anthonyla.paperize.data.database.entities.AlbumEntity
import com.anthonyla.paperize.data.database.entities.FolderEntity
import com.anthonyla.paperize.data.database.entities.WallpaperEntity
data class AlbumWithDetails(
@Embedded
val album: AlbumEntity,
@Relation(
parentColumn = "id",
entityColumn = "albumId",
entity = WallpaperEntity::class
)
val wallpapers: List<WallpaperEntity> = emptyList(),
@Relation(
parentColumn = "id",
entityColumn = "albumId",
entity = FolderEntity::class
)
val folders: List<FolderEntity> = emptyList()
)
@@ -0,0 +1,18 @@
package com.anthonyla.paperize.data.database.relations
import androidx.room.Embedded
import androidx.room.Relation
import com.anthonyla.paperize.data.database.entities.FolderEntity
import com.anthonyla.paperize.data.database.entities.WallpaperEntity
data class FolderWithWallpapers(
@Embedded
val folder: FolderEntity,
@Relation(
parentColumn = "id",
entityColumn = "folderId",
entity = WallpaperEntity::class
)
val wallpapers: List<WallpaperEntity> = emptyList()
)
@@ -0,0 +1,56 @@
package com.anthonyla.paperize.data.mapper
import com.anthonyla.paperize.data.database.entities.AlbumEntity
import com.anthonyla.paperize.data.database.entities.AlbumSummaryEntity
import com.anthonyla.paperize.data.database.relations.AlbumWithDetails
import com.anthonyla.paperize.domain.model.Album
import com.anthonyla.paperize.domain.model.AlbumSummary
import com.anthonyla.paperize.domain.model.Folder
import com.anthonyla.paperize.domain.model.Wallpaper
fun AlbumEntity.toDomainModel(
wallpapers: List<Wallpaper> = emptyList(),
folders: List<Folder> = emptyList()
): Album = Album(
id = id,
name = name,
coverUri = coverUri,
wallpapers = wallpapers,
folders = folders,
createdAt = createdAt,
modifiedAt = modifiedAt
)
fun Album.toEntity(): AlbumEntity = AlbumEntity(
id = id,
name = name,
coverUri = coverUri,
createdAt = createdAt,
modifiedAt = modifiedAt
)
fun AlbumWithDetails.toDomainModel(): Album {
val wallpapersByFolder = wallpapers.groupBy { it.folderId }
val domainWallpapers = wallpapersByFolder[null]?.map { it.toDomainModel() } ?: emptyList()
val domainFolders = folders.map { folderEntity ->
val folderWallpapers = wallpapersByFolder[folderEntity.id]?.map { it.toDomainModel() } ?: emptyList()
folderEntity.toDomainModel(folderWallpapers)
}
return album.toDomainModel(
wallpapers = domainWallpapers,
folders = domainFolders
)
}
fun AlbumSummaryEntity.toDomainModel(): AlbumSummary = AlbumSummary(
id = id,
name = name,
coverUri = coverUri,
wallpaperCount = wallpaperCount,
folderCount = folderCount,
createdAt = createdAt,
modifiedAt = modifiedAt
)
@@ -0,0 +1,35 @@
package com.anthonyla.paperize.data.mapper
import com.anthonyla.paperize.data.database.entities.FolderEntity
import com.anthonyla.paperize.data.database.relations.FolderWithWallpapers
import com.anthonyla.paperize.domain.model.Folder
import com.anthonyla.paperize.domain.model.Wallpaper
fun FolderEntity.toDomainModel(
wallpapers: List<Wallpaper> = emptyList()
): Folder = Folder(
id = id,
albumId = albumId,
name = name,
uri = uri,
coverUri = coverUri,
dateModified = dateModified,
displayOrder = displayOrder,
wallpapers = wallpapers,
addedAt = addedAt
)
fun Folder.toEntity(): FolderEntity = FolderEntity(
id = id,
albumId = albumId,
name = name,
uri = uri,
coverUri = coverUri,
dateModified = dateModified,
displayOrder = displayOrder,
addedAt = addedAt
)
fun FolderWithWallpapers.toDomainModel(): Folder = folder.toDomainModel(
wallpapers = wallpapers.map { it.toDomainModel() }
)
@@ -0,0 +1,27 @@
package com.anthonyla.paperize.data.mapper
import com.anthonyla.paperize.data.database.entities.WallpaperEntity
import com.anthonyla.paperize.domain.model.Wallpaper
fun WallpaperEntity.toDomainModel(): Wallpaper = Wallpaper(
id = id,
albumId = albumId,
folderId = folderId,
uri = uri,
fileName = fileName,
dateModified = dateModified,
displayOrder = displayOrder,
addedAt = addedAt
)
fun Wallpaper.toEntity(): WallpaperEntity = WallpaperEntity(
id = id,
albumId = albumId,
folderId = folderId,
uri = uri,
fileName = fileName,
dateModified = dateModified,
displayOrder = displayOrder,
sourceType = if (folderId == null) "DIRECT" else "FOLDER",
addedAt = addedAt
)
@@ -1,62 +0,0 @@
package com.anthonyla.paperize.data
import androidx.compose.foundation.lazy.LazyListState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.MutableState
import androidx.compose.runtime.SideEffect
import androidx.compose.runtime.State
import androidx.compose.runtime.derivedStateOf
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.remember
/**
* Remember the current offset of a [LazyListState].
* Source:
* https://stackoverflow.com/a/75677163
* https://stackoverflow.com/a/70558512
*/
@Composable
fun rememberCurrentOffset(state: LazyListState): State<Int> {
val position = remember { derivedStateOf { state.firstVisibleItemIndex } }
val itemOffset = remember { derivedStateOf { state.firstVisibleItemScrollOffset } }
val lastPosition = rememberPrevious(position.value)
val lastItemOffset = rememberPrevious(itemOffset.value)
val currentOffset = remember { mutableIntStateOf(0) }
LaunchedEffect(position.value, itemOffset.value) {
currentOffset.intValue = when {
lastPosition == null || position.value == 0 -> itemOffset.value
lastPosition == position.value -> currentOffset.intValue + (itemOffset.value - (lastItemOffset ?: 0))
lastPosition > position.value -> currentOffset.intValue - (lastItemOffset ?: 0)
else -> currentOffset.intValue + itemOffset.value
}
}
return currentOffset
}
@Composable
fun <T> rememberPrevious(
current: T,
shouldUpdate: (prev: T?, curr: T) -> Boolean = { prev, curr -> prev != curr },
): T? {
val ref = rememberRef<T>()
SideEffect {
if (shouldUpdate(ref.value, current)) {
ref.value = current
}
}
return ref.value
}
@Composable
fun <T> rememberRef(): MutableState<T?> {
return remember {
object : MutableState<T?> {
override var value: T? = null
override fun component1(): T? = value
override fun component2(): (T?) -> Unit = { value = it }
}
}
}
@@ -0,0 +1,204 @@
package com.anthonyla.paperize.data.repository
import androidx.room.withTransaction
import com.anthonyla.paperize.core.util.generateId
import com.anthonyla.paperize.data.database.PaperizeDatabase
import com.anthonyla.paperize.data.mapper.toDomainModel
import com.anthonyla.paperize.data.mapper.toEntity
import com.anthonyla.paperize.domain.model.Album
import com.anthonyla.paperize.domain.model.AlbumSummary
import com.anthonyla.paperize.domain.model.Folder
import com.anthonyla.paperize.domain.model.Wallpaper
import com.anthonyla.paperize.domain.repository.AlbumRepository
import com.anthonyla.paperize.domain.source.DocumentSource
import javax.inject.Inject
import javax.inject.Singleton
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.map
@Singleton
class AlbumRepositoryImpl @Inject constructor(
private val documents: DocumentSource,
private val database: PaperizeDatabase
) : AlbumRepository {
private val albumDao = database.albumDao()
private val wallpaperDao = database.wallpaperDao()
private val folderDao = database.folderDao()
companion object {
private const val WALLPAPER_BATCH_SIZE = 500
}
override fun getAlbumSummaries(): Flow<List<AlbumSummary>> =
albumDao.getAlbumSummaries().map { it.map { summary -> summary.toDomainModel() } }
override fun getAlbumById(albumId: String): Flow<Album?> =
albumDao.getAlbumWithDetails(albumId).map { it?.toDomainModel() }
override fun getFolderById(folderId: String): Flow<Folder?> =
folderDao.getFolderWithWallpapers(folderId).map { it?.toDomainModel() }
override suspend fun createAlbum(name: String, coverUri: String?): Album {
val now = System.currentTimeMillis()
val album = Album(id = generateId(), name = name, coverUri = coverUri, createdAt = now, modifiedAt = now)
albumDao.insertAlbum(album.toEntity())
return album
}
override suspend fun deleteAlbum(albumId: String) {
albumDao.deleteAlbumById(albumId)
}
override suspend fun addWallpapersToAlbum(
albumId: String,
wallpapers: List<Wallpaper>,
onProgress: (saved: Int, total: Int) -> Unit
): Int = database.withTransaction {
checkNotNull(albumDao.getAlbumById(albumId))
insertNewWallpapers(albumId, wallpapers, onProgress)
}
override suspend fun addFolderToAlbum(
albumId: String,
folder: Folder,
onProgress: (saved: Int, total: Int) -> Unit
): Boolean = database.withTransaction {
checkNotNull(albumDao.getAlbumById(albumId))
if (folderDao.containsUri(albumId, folder.uri)) return@withTransaction false
folderDao.insertFolder(folder.toEntity().copy(
albumId = albumId, displayOrder = folderDao.getMaxOrder(albumId) + 1, coverUri = null
))
insertNewWallpapers(albumId, folder.wallpapers.map { it.copy(folderId = folder.id) }, onProgress)
albumDao.updateAlbumModifiedTime(albumId, System.currentTimeMillis())
true
}
override suspend fun syncFolderWallpapers(
albumId: String,
folderId: String,
wallpapers: List<Wallpaper>,
onProgress: (Int, Int) -> Unit
): Int = database.withTransaction {
checkNotNull(albumDao.getAlbumById(albumId))
val scanned = wallpapers.mapTo(HashSet()) { it.uri }
// An empty scan can be an unavailable provider, so it removes nothing.
val stale = if (scanned.isEmpty()) emptyList()
else wallpaperDao.getUrisInCollection(albumId, folderId).filterNot { it in scanned }
var removed = 0
stale.chunked(WALLPAPER_BATCH_SIZE).forEach {
removed += wallpaperDao.deleteFolderWallpapersByUris(albumId, folderId, it)
}
val added = insertNewWallpapers(albumId, wallpapers, onProgress)
if (removed > 0) {
folderDao.updateFolderCover(folderId, wallpaperDao.getFolderCoverUri(folderId))
updateAlbumCoverIfNeeded(albumId)
albumDao.updateAlbumModifiedTime(albumId, System.currentTimeMillis())
}
added
}
private suspend fun insertNewWallpapers(
albumId: String,
wallpapers: List<Wallpaper>,
onProgress: (Int, Int) -> Unit
): Int {
var nextOrder = wallpaperDao.getMaxOrder(albumId) + 1
val additions = wallpapers.groupBy { it.folderId }.flatMap { (folderId, images) ->
// A folder can be removed while its provider scan is in flight.
if (folderId != null && folderDao.getFolderById(folderId)?.albumId != albumId) {
emptyList()
} else {
val existing = wallpaperDao.getUrisInCollection(albumId, folderId).toHashSet()
images.filter { existing.add(it.uri) }.map {
it.copy(albumId = albumId, displayOrder = nextOrder++)
}
}
}
if (additions.isEmpty()) return 0
insertWallpapersChunked(additions, onProgress)
additions.mapNotNull { it.folderId }.toSet().forEach { folderId ->
folderDao.updateFolderCover(folderId, wallpaperDao.getFolderCoverUri(folderId))
}
database.wallpaperQueueDao().clearAllQueues(albumId)
albumDao.updateAlbumModifiedTime(albumId, System.currentTimeMillis())
updateAlbumCoverIfNeeded(albumId)
return additions.size
}
/** Report chunk progress within the caller's transaction; cancellation rolls back every chunk. */
private suspend fun insertWallpapersChunked(
wallpapers: List<Wallpaper>,
onProgress: (saved: Int, total: Int) -> Unit
) {
val total = wallpapers.size
var saved = 0
wallpapers.chunked(WALLPAPER_BATCH_SIZE).forEach { chunk ->
wallpaperDao.insertWallpapers(chunk.map { it.toEntity() })
saved += chunk.size
onProgress(saved, total)
}
}
override suspend fun removeWallpapersFromAlbum(
albumId: String,
wallpaperIds: List<String>
) {
if (wallpaperIds.isEmpty()) return
database.withTransaction {
wallpaperIds.chunked(WALLPAPER_BATCH_SIZE).forEach {
wallpaperDao.deleteAlbumWallpapers(albumId, it)
}
albumDao.updateAlbumModifiedTime(albumId, System.currentTimeMillis())
folderDao.refreshFolderCovers(albumId)
updateAlbumCoverIfNeeded(albumId)
}
}
override suspend fun removeFolderFromAlbum(albumId: String, folderId: String) {
database.withTransaction {
folderDao.deleteAlbumFolder(albumId, folderId)
albumDao.updateAlbumModifiedTime(albumId, System.currentTimeMillis())
updateAlbumCoverIfNeeded(albumId)
}
}
override suspend fun deleteAllAlbums() {
albumDao.deleteAllAlbums()
}
override suspend fun pruneMissingEntries(albumId: String): Int {
val missingFolders = folderDao.getFoldersByAlbum(albumId)
.filter { documents.isMissing(it.uri, isTree = true) }.map { it.id }.toSet()
val missingImages = mutableListOf<String>()
var afterId: String? = null
while (true) {
val batch = wallpaperDao.getWallpapersByAlbumPage(albumId, WALLPAPER_BATCH_SIZE, afterId)
if (batch.isEmpty()) break
batch.filter { it.folderId !in missingFolders && documents.isMissing(it.uri) }
.mapTo(missingImages) { it.id }
afterId = batch.last().id
}
return database.withTransaction {
var removed = missingFolders.sumOf { folderDao.deleteAlbumFolder(albumId, it) }
missingImages.chunked(WALLPAPER_BATCH_SIZE).forEach {
removed += wallpaperDao.deleteAlbumWallpapers(albumId, it)
}
if (removed > 0) {
folderDao.refreshFolderCovers(albumId)
updateAlbumCoverIfNeeded(albumId)
albumDao.updateAlbumModifiedTime(albumId, System.currentTimeMillis())
}
removed
}
}
/** Call within a transaction; direct wallpapers take priority over folder images. */
private suspend fun updateAlbumCoverIfNeeded(albumId: String) {
val album = albumDao.getAlbumById(albumId) ?: return
val newCoverUri = wallpaperDao.getAlbumCoverUri(albumId)
if (album.coverUri != newCoverUri) {
albumDao.updateAlbumCover(albumId, newCoverUri, System.currentTimeMillis())
}
}
}
@@ -0,0 +1,252 @@
package com.anthonyla.paperize.data.repository
import android.content.Context
import androidx.datastore.core.DataStore
import androidx.datastore.preferences.core.MutablePreferences
import androidx.datastore.preferences.core.Preferences
import androidx.datastore.preferences.core.booleanPreferencesKey
import androidx.datastore.preferences.core.edit
import androidx.datastore.preferences.core.intPreferencesKey
import androidx.datastore.preferences.core.stringPreferencesKey
import androidx.datastore.preferences.preferencesDataStore
import com.anthonyla.paperize.core.ScalingType
import com.anthonyla.paperize.core.ScreenType
import com.anthonyla.paperize.core.WallpaperMode
import com.anthonyla.paperize.core.constants.Constants
import com.anthonyla.paperize.domain.model.AppSettings
import com.anthonyla.paperize.domain.model.ScheduleSettings
import com.anthonyla.paperize.domain.model.WallpaperEffects
import com.anthonyla.paperize.domain.repository.SettingsRepository
import dagger.hilt.android.qualifiers.ApplicationContext
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.flow.map
import javax.inject.Inject
import javax.inject.Singleton
private val Context.dataStore: DataStore<Preferences> by preferencesDataStore(
name = Constants.PREFERENCES_NAME
)
private val DARK_MODE = booleanPreferencesKey("dark_mode")
private val DYNAMIC_THEMING = booleanPreferencesKey("dynamic_theming")
private val ANIMATE = booleanPreferencesKey("animate")
private val FIRST_LAUNCH = booleanPreferencesKey("first_launch")
private val WALLPAPER_MODE = stringPreferencesKey("wallpaper_mode")
private val ENABLE_CHANGER = booleanPreferencesKey("enable_changer")
private val SEPARATE_SCHEDULES = booleanPreferencesKey("separate_schedules")
private val SHUFFLE_ENABLED = booleanPreferencesKey("shuffle_enabled")
private val HOME_ENABLED = booleanPreferencesKey("home_enabled")
private val LOCK_ENABLED = booleanPreferencesKey("lock_enabled")
private val HOME_ALBUM_ID = stringPreferencesKey("home_album_id")
private val LOCK_ALBUM_ID = stringPreferencesKey("lock_album_id")
private val LIVE_ALBUM_ID = stringPreferencesKey("live_album_id")
private val HOME_INTERVAL_MINUTES = intPreferencesKey("home_interval_minutes")
private val LOCK_INTERVAL_MINUTES = intPreferencesKey("lock_interval_minutes")
private val LIVE_INTERVAL_MINUTES = intPreferencesKey("live_interval_minutes")
private val HOME_SCALING_TYPE = stringPreferencesKey("home_scaling_type")
private val LOCK_SCALING_TYPE = stringPreferencesKey("lock_scaling_type")
private val LIVE_SCALING_TYPE = stringPreferencesKey("live_scaling_type")
private val HOME_SCROLLING_ENABLED = booleanPreferencesKey("home_scrolling_enabled")
private val ADAPTIVE_BRIGHTNESS = booleanPreferencesKey("adaptive_brightness")
/** Effect keys are "<screen>_<field>", e.g. "home_enable_blur" or "live_parallax_intensity". */
private class EffectKeys(screen: String) {
val enableBlur = booleanPreferencesKey("${screen}_enable_blur")
val blur = intPreferencesKey("${screen}_blur")
val enableDarken = booleanPreferencesKey("${screen}_enable_darken")
val darken = intPreferencesKey("${screen}_darken")
val enableVignette = booleanPreferencesKey("${screen}_enable_vignette")
val vignette = intPreferencesKey("${screen}_vignette")
val enableGrayscale = booleanPreferencesKey("${screen}_enable_grayscale")
val grayscale = intPreferencesKey("${screen}_grayscale")
val enableDoubleTap = booleanPreferencesKey("${screen}_enable_double_tap")
val enableChangeOnScreenOff = booleanPreferencesKey("${screen}_enable_change_on_screen_off")
val enableParallax = booleanPreferencesKey("${screen}_enable_parallax")
val parallaxIntensity = intPreferencesKey("${screen}_parallax_intensity")
}
private val HOME_EFFECTS = EffectKeys("home")
private val LOCK_EFFECTS = EffectKeys("lock")
private val LIVE_EFFECTS = EffectKeys("live")
@Singleton
class SettingsRepositoryImpl @Inject constructor(
@ApplicationContext context: Context
) : SettingsRepository {
private val dataStore = context.dataStore
override suspend fun getAppSettings(): AppSettings = getAppSettingsFlow().first()
override fun getAppSettingsFlow(): Flow<AppSettings> = dataStore.data.map { prefs ->
val defaults = AppSettings()
AppSettings(
darkMode = prefs[DARK_MODE],
dynamicTheming = prefs[DYNAMIC_THEMING] ?: defaults.dynamicTheming,
animate = prefs[ANIMATE] ?: defaults.animate,
firstLaunch = prefs[FIRST_LAUNCH] ?: defaults.firstLaunch
)
}
override suspend fun getWallpaperMode(): WallpaperMode = getWallpaperModeFlow().first()
override fun getWallpaperModeFlow(): Flow<WallpaperMode> =
dataStore.data.map { WallpaperMode.fromString(it[WALLPAPER_MODE]) }
override suspend fun updateWallpaperMode(mode: WallpaperMode) {
dataStore.edit { it[WALLPAPER_MODE] = mode.name }
}
override suspend fun getScheduleSettings(): ScheduleSettings = getScheduleSettingsFlow().first()
override fun getScheduleSettingsFlow(): Flow<ScheduleSettings> = dataStore.data.map(::scheduleSettings)
override suspend fun updateScheduleSettings(settings: ScheduleSettings) {
updateScheduleSettings { settings }
}
override suspend fun updateScheduleSettings(transform: (ScheduleSettings) -> ScheduleSettings): ScheduleSettings {
val updated = dataStore.edit { prefs ->
val settings = transform(scheduleSettings(prefs))
prefs[ENABLE_CHANGER] = settings.enableChanger
prefs[SEPARATE_SCHEDULES] = settings.separateSchedules
prefs[SHUFFLE_ENABLED] = settings.shuffleEnabled
prefs[HOME_ENABLED] = settings.homeEnabled
prefs[LOCK_ENABLED] = settings.lockEnabled
prefs.setOrRemove(HOME_ALBUM_ID, settings.homeAlbumId)
prefs.setOrRemove(LOCK_ALBUM_ID, settings.lockAlbumId)
prefs.setOrRemove(LIVE_ALBUM_ID, settings.liveAlbumId)
prefs[HOME_INTERVAL_MINUTES] = settings.homeIntervalMinutes
prefs[LOCK_INTERVAL_MINUTES] = settings.lockIntervalMinutes
prefs[LIVE_INTERVAL_MINUTES] = settings.liveIntervalMinutes
prefs[HOME_SCALING_TYPE] = settings.homeScalingType.name
prefs[LOCK_SCALING_TYPE] = settings.lockScalingType.name
prefs[LIVE_SCALING_TYPE] = settings.liveScalingType.name
prefs[HOME_SCROLLING_ENABLED] = settings.homeScrollingEnabled
prefs.writeEffects(HOME_EFFECTS, settings.homeEffects)
prefs.writeEffects(LOCK_EFFECTS, settings.lockEffects)
prefs.writeEffects(LIVE_EFFECTS, settings.liveEffects)
prefs[ADAPTIVE_BRIGHTNESS] = settings.adaptiveBrightness
}
return scheduleSettings(updated)
}
override suspend fun clearAllSettings() {
dataStore.edit { it.clear() }
}
override suspend fun clearScheduleSettings() = updateScheduleSettings(ScheduleSettings())
override suspend fun updateAlbumId(screen: ScreenType, albumId: String?) {
dataStore.edit { prefs -> albumIdKeys(screen).forEach { prefs.setOrRemove(it, albumId) } }
}
override suspend fun clearAlbumSelectionsIfMatches(albumId: String): Boolean {
var wasCleared = false
dataStore.edit { prefs ->
val targets = listOf(HOME_ALBUM_ID, LOCK_ALBUM_ID, LIVE_ALBUM_ID).filter { prefs[it] == albumId }
targets.forEach { prefs.remove(it) }
wasCleared = targets.isNotEmpty()
}
return wasCleared
}
override suspend fun clearEmptyAlbumSelection(albumId: String, screen: ScreenType) {
dataStore.edit { prefs ->
val targets = albumIdKeys(screen).filter { prefs[it] == albumId }
if (targets.isEmpty()) return@edit
targets.forEach { prefs.remove(it) }
val mode = WallpaperMode.fromString(prefs[WALLPAPER_MODE])
if (scheduleSettings(prefs).activeScreens(mode).isEmpty()) prefs[ENABLE_CHANGER] = false
}
}
override suspend fun updateDarkMode(enabled: Boolean) {
dataStore.edit { it[DARK_MODE] = enabled }
}
override suspend fun updateDynamicTheming(enabled: Boolean) {
dataStore.edit { it[DYNAMIC_THEMING] = enabled }
}
override suspend fun updateAnimate(enabled: Boolean) {
dataStore.edit { it[ANIMATE] = enabled }
}
override suspend fun completeFirstLaunch() {
dataStore.edit { it[FIRST_LAUNCH] = false }
}
override suspend fun updateEnableChanger(enabled: Boolean) {
dataStore.edit { it[ENABLE_CHANGER] = enabled }
}
private fun scheduleSettings(prefs: Preferences): ScheduleSettings {
val defaults = ScheduleSettings()
return ScheduleSettings(
enableChanger = prefs[ENABLE_CHANGER] ?: defaults.enableChanger,
separateSchedules = prefs[SEPARATE_SCHEDULES] ?: defaults.separateSchedules,
shuffleEnabled = prefs[SHUFFLE_ENABLED] ?: defaults.shuffleEnabled,
homeEnabled = prefs[HOME_ENABLED] ?: defaults.homeEnabled,
lockEnabled = prefs[LOCK_ENABLED] ?: defaults.lockEnabled,
homeAlbumId = prefs[HOME_ALBUM_ID],
lockAlbumId = prefs[LOCK_ALBUM_ID],
liveAlbumId = prefs[LIVE_ALBUM_ID],
homeIntervalMinutes = prefs[HOME_INTERVAL_MINUTES] ?: defaults.homeIntervalMinutes,
lockIntervalMinutes = prefs[LOCK_INTERVAL_MINUTES] ?: defaults.lockIntervalMinutes,
liveIntervalMinutes = prefs[LIVE_INTERVAL_MINUTES] ?: defaults.liveIntervalMinutes,
homeScalingType = ScalingType.fromString(prefs[HOME_SCALING_TYPE]),
lockScalingType = ScalingType.fromString(prefs[LOCK_SCALING_TYPE]),
liveScalingType = ScalingType.fromString(prefs[LIVE_SCALING_TYPE]),
homeScrollingEnabled = prefs[HOME_SCROLLING_ENABLED] ?: defaults.homeScrollingEnabled,
homeEffects = prefs.readEffects(HOME_EFFECTS),
lockEffects = prefs.readEffects(LOCK_EFFECTS),
liveEffects = prefs.readEffects(LIVE_EFFECTS),
adaptiveBrightness = prefs[ADAPTIVE_BRIGHTNESS] ?: defaults.adaptiveBrightness
)
}
private fun Preferences.readEffects(keys: EffectKeys): WallpaperEffects {
val defaults = WallpaperEffects()
return WallpaperEffects(
enableBlur = this[keys.enableBlur] ?: defaults.enableBlur,
blurPercentage = this[keys.blur] ?: defaults.blurPercentage,
enableDarken = this[keys.enableDarken] ?: defaults.enableDarken,
darkenPercentage = this[keys.darken] ?: defaults.darkenPercentage,
enableVignette = this[keys.enableVignette] ?: defaults.enableVignette,
vignettePercentage = this[keys.vignette] ?: defaults.vignettePercentage,
enableGrayscale = this[keys.enableGrayscale] ?: defaults.enableGrayscale,
grayscalePercentage = this[keys.grayscale] ?: defaults.grayscalePercentage,
enableDoubleTap = this[keys.enableDoubleTap] ?: defaults.enableDoubleTap,
enableChangeOnScreenOff = this[keys.enableChangeOnScreenOff] ?: defaults.enableChangeOnScreenOff,
enableParallax = this[keys.enableParallax] ?: defaults.enableParallax,
parallaxIntensity = this[keys.parallaxIntensity] ?: defaults.parallaxIntensity
)
}
private fun MutablePreferences.writeEffects(keys: EffectKeys, effects: WallpaperEffects) {
this[keys.enableBlur] = effects.enableBlur
this[keys.blur] = effects.blurPercentage
this[keys.enableDarken] = effects.enableDarken
this[keys.darken] = effects.darkenPercentage
this[keys.enableVignette] = effects.enableVignette
this[keys.vignette] = effects.vignettePercentage
this[keys.enableGrayscale] = effects.enableGrayscale
this[keys.grayscale] = effects.grayscalePercentage
this[keys.enableDoubleTap] = effects.enableDoubleTap
this[keys.enableChangeOnScreenOff] = effects.enableChangeOnScreenOff
this[keys.enableParallax] = effects.enableParallax
this[keys.parallaxIntensity] = effects.parallaxIntensity
}
private fun MutablePreferences.setOrRemove(key: Preferences.Key<String>, value: String?) {
if (value != null) this[key] = value else remove(key)
}
private fun albumIdKeys(screen: ScreenType) = when (screen) {
ScreenType.HOME -> listOf(HOME_ALBUM_ID)
ScreenType.LOCK -> listOf(LOCK_ALBUM_ID)
ScreenType.BOTH -> listOf(HOME_ALBUM_ID, LOCK_ALBUM_ID)
ScreenType.LIVE -> listOf(LIVE_ALBUM_ID)
}
}
@@ -0,0 +1,103 @@
package com.anthonyla.paperize.data.repository
import androidx.room.withTransaction
import com.anthonyla.paperize.core.ScreenType
import com.anthonyla.paperize.core.util.QueueBuilder
import com.anthonyla.paperize.data.database.PaperizeDatabase
import com.anthonyla.paperize.data.database.entities.WallpaperCurrentEntity
import com.anthonyla.paperize.data.mapper.toDomainModel
import com.anthonyla.paperize.domain.model.Wallpaper
import com.anthonyla.paperize.domain.repository.WallpaperRepository
import javax.inject.Inject
import javax.inject.Singleton
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.flow.map
@Singleton
class WallpaperRepositoryImpl @Inject constructor(
private val database: PaperizeDatabase
) : WallpaperRepository {
private val wallpaperDao = database.wallpaperDao()
private val wallpaperQueueDao = database.wallpaperQueueDao()
private val wallpaperCurrentDao = database.wallpaperCurrentDao()
override suspend fun getWallpaperById(wallpaperId: String): Wallpaper? =
wallpaperDao.getWallpaperById(wallpaperId)?.toDomainModel()
override suspend fun getAndDequeueWallpaper(albumId: String, screenType: ScreenType): Wallpaper? =
wallpaperQueueDao.getAndDequeueWallpaper(albumId, screenType)?.toDomainModel()
override suspend fun removeWallpaperFromQueue(
albumId: String,
screenType: ScreenType,
wallpaperId: String
) {
wallpaperQueueDao.deleteQueueItem(albumId, screenType, wallpaperId)
}
override suspend fun restoreWallpaperToQueueFront(
albumId: String,
screenType: ScreenType,
wallpaperId: String
) {
wallpaperQueueDao.restoreQueueItem(albumId, screenType, wallpaperId)
}
override suspend fun ensureWallpaperQueue(
albumId: String,
screenType: ScreenType,
shuffle: Boolean
) {
database.withTransaction {
// Recheck inside the transaction: another caller may already have filled it.
if (wallpaperQueueDao.getNextWallpaperInQueue(albumId, screenType) != null) return@withTransaction
val otherScreen = if (shuffle) when (screenType) {
ScreenType.HOME -> ScreenType.LOCK
ScreenType.LOCK -> ScreenType.HOME
else -> null
} else null
val otherQueue = otherScreen?.let { wallpaperQueueDao.getQueueItems(albumId, it) }.orEmpty()
val ids = if (shuffle) {
val available = wallpaperDao.getWallpaperIdsByAlbum(albumId)
if (otherQueue.isEmpty()) available.shuffled()
else QueueBuilder.mergeWithExistingQueue(otherQueue.map { it.wallpaperId }, available)
} else {
wallpaperDao.getOrderedWallpaperIdsByAlbum(albumId)
}
wallpaperQueueDao.rebuildQueue(albumId, screenType, ids)
if (otherScreen != null && otherQueue.isEmpty()) {
wallpaperQueueDao.rebuildQueue(albumId, otherScreen, ids)
}
}
}
override suspend fun startSequenceAfter(
albumId: String,
screenType: ScreenType,
wallpaperId: String
) {
database.withTransaction {
val ordered = wallpaperDao.getOrderedWallpaperIdsByAlbum(albumId)
wallpaperQueueDao.rebuildQueue(albumId, screenType, QueueBuilder.idsAfter(ordered, wallpaperId))
}
}
override suspend fun clearAllQueues() {
wallpaperQueueDao.deleteAllQueueItems()
}
override suspend fun getCurrentWallpaper(albumId: String, screenType: ScreenType): Wallpaper? =
getCurrentWallpaperFlow(albumId, screenType).first()
override fun getCurrentWallpaperFlow(albumId: String, screenType: ScreenType): Flow<Wallpaper?> =
wallpaperCurrentDao.getCurrentWallpaperFlow(albumId, screenType).map { it?.toDomainModel() }
override suspend fun setCurrentWallpaper(albumId: String, screenType: ScreenType, wallpaperId: String) {
wallpaperCurrentDao.upsertCurrentWallpaper(
WallpaperCurrentEntity(albumId = albumId, screenType = screenType, wallpaperId = wallpaperId)
)
}
}
@@ -1,17 +0,0 @@
package com.anthonyla.paperize.data.settings
/**
* Interface for the data store that handles the settings for application
*/
interface SettingsDataStore {
suspend fun putBoolean(key: String, value: Boolean)
suspend fun putString(key: String, value: String)
suspend fun putInt(key: String, value: Int)
suspend fun getBoolean(key: String): Boolean?
suspend fun getString(key: String): String?
suspend fun getInt(key: String): Int?
suspend fun deleteBoolean(key: String)
suspend fun deleteString(key: String)
suspend fun deleteInt(key: String)
suspend fun clearPreferences()
}
@@ -1,97 +0,0 @@
package com.anthonyla.paperize.data.settings
import android.content.Context
import androidx.datastore.core.DataStore
import androidx.datastore.preferences.core.Preferences
import androidx.datastore.preferences.core.booleanPreferencesKey
import androidx.datastore.preferences.core.edit
import androidx.datastore.preferences.core.stringPreferencesKey
import androidx.datastore.preferences.preferencesDataStore
import com.anthonyla.paperize.core.SettingsConstants.SETTINGS_DATASTORE
import kotlinx.coroutines.flow.first
import javax.inject.Inject
private val Context.dataStore : DataStore<Preferences> by preferencesDataStore(name = SETTINGS_DATASTORE)
class SettingsDataStoreImpl @Inject constructor (private val context: Context): SettingsDataStore {
override suspend fun putBoolean(key: String, value: Boolean) {
val preferencesKey = booleanPreferencesKey(key)
context.dataStore.edit {
it[preferencesKey] = value
}
}
override suspend fun putString(key: String, value: String) {
val preferencesKey = stringPreferencesKey(key)
context.dataStore.edit {
it[preferencesKey] = value
}
}
override suspend fun putInt(key: String, value: Int) {
val preferencesKey = stringPreferencesKey(key)
context.dataStore.edit {
it[preferencesKey] = value.toString()
}
}
override suspend fun getBoolean(key: String): Boolean? {
val head = context.dataStore.data.first()
val preferencesKey = booleanPreferencesKey(key)
return head[preferencesKey]
}
override suspend fun getString(key: String): String? {
return try {
val head = context.dataStore.data.first()
val preferencesKey = stringPreferencesKey(key)
head[preferencesKey]
} catch (exception: Exception) {
exception.printStackTrace()
null
}
}
override suspend fun getInt(key: String): Int? {
return try {
val head = context.dataStore.data.first()
val preferencesKey = stringPreferencesKey(key)
head[preferencesKey]?.toInt()
} catch (exception: Exception) {
exception.printStackTrace()
null
}
}
override suspend fun deleteBoolean(key: String) {
val preferencesKey = booleanPreferencesKey(key)
context.dataStore.edit {
if (it.contains(preferencesKey)) {
it.remove(preferencesKey)
}
}
}
override suspend fun deleteString(key: String) {
val preferencesKey = stringPreferencesKey(key)
context.dataStore.edit {
if (it.contains(preferencesKey)) {
it.remove(preferencesKey)
}
}
}
override suspend fun deleteInt(key: String) {
val preferencesKey = stringPreferencesKey(key)
context.dataStore.edit {
if (it.contains(preferencesKey)) {
it.remove(preferencesKey)
}
}
}
override suspend fun clearPreferences() {
context.dataStore.edit {
it.clear()
}
}
}
@@ -0,0 +1,155 @@
package com.anthonyla.paperize.data.source
import android.content.ContentResolver
import android.content.Context
import android.content.Intent
import android.database.Cursor
import android.net.Uri
import android.os.CancellationSignal
import android.provider.DocumentsContract
import android.provider.OpenableColumns
import androidx.core.net.toUri
import androidx.documentfile.provider.DocumentFile
import com.anthonyla.paperize.core.constants.Constants
import com.anthonyla.paperize.core.runCatchingCancellable
import com.anthonyla.paperize.domain.source.DocumentSource
import com.anthonyla.paperize.domain.source.SourceFolder
import com.anthonyla.paperize.domain.source.SourceImage
import dagger.hilt.android.qualifiers.ApplicationContext
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.currentCoroutineContext
import kotlinx.coroutines.ensureActive
import kotlinx.coroutines.suspendCancellableCoroutine
import kotlinx.coroutines.withContext
import java.io.IOException
import javax.inject.Inject
import kotlin.coroutines.resumeWithException
class AndroidDocumentSource @Inject constructor(
@param:ApplicationContext private val context: Context
) : DocumentSource {
override suspend fun retainReadPermission(uri: String): Unit = withContext(Dispatchers.IO) {
context.contentResolver.takePersistableUriPermission(uri.toUri(), Intent.FLAG_GRANT_READ_URI_PERMISSION)
}
override suspend fun readImage(uri: String): SourceImage = withContext(Dispatchers.IO) {
val document = DocumentFile.fromSingleUri(context, uri.toUri())
SourceImage(uri, document?.name ?: uri.substringAfterLast('/'), document?.lastModified() ?: 0L)
}
override suspend fun readFolder(uri: String, onProgress: (Int) -> Unit): SourceFolder = withContext(Dispatchers.IO) {
val tree = uri.toUri()
SourceFolder(
DocumentFile.fromTreeUri(context, tree)?.name ?: uri.substringAfterLast('/'),
tree.scanFolderImages(context, onProgress)
)
}
override suspend fun isMissing(uri: String, isTree: Boolean): Boolean = withContext(Dispatchers.IO) {
val source = uri.toUri()
val document = if (isTree) {
DocumentsContract.buildDocumentUriUsingTree(source, DocumentsContract.getTreeDocumentId(source))
} else source
document.isDocumentMissing(context.contentResolver)
}
}
/** Only a successful, complete query with no rows proves that a document was removed. */
internal fun Uri.isDocumentMissing(contentResolver: ContentResolver): Boolean {
if (scheme != ContentResolver.SCHEME_CONTENT) return false
// Offline providers, revoked permissions and query failures do not prove deletion.
return runCatchingCancellable {
contentResolver.query(this, arrayOf(OpenableColumns.DISPLAY_NAME), null, null, null)
?.use { cursor ->
cursor.requireComplete()
!cursor.moveToFirst()
} ?: false
}.getOrDefault(false)
}
private fun Cursor.requireComplete() {
val metadata = extras
if (metadata.getBoolean(DocumentsContract.EXTRA_LOADING, false) ||
metadata.getString(DocumentsContract.EXTRA_ERROR) != null) {
throw IOException("Document provider has not returned a complete result")
}
}
/**
* Traverses directories iteratively, querying metadata once per directory.
* Rejects incomplete provider results and cancels in-flight queries with the caller.
* [onProgress] reports every [PROGRESS_REPORT_INTERVAL] discoveries and on completion.
*/
internal suspend fun Uri.scanFolderImages(context: Context, onProgress: (found: Int) -> Unit = {}): List<SourceImage> {
val rootDocumentId = DocumentsContract.getTreeDocumentId(this)
val projection = arrayOf(
DocumentsContract.Document.COLUMN_DOCUMENT_ID,
DocumentsContract.Document.COLUMN_DISPLAY_NAME,
DocumentsContract.Document.COLUMN_MIME_TYPE,
DocumentsContract.Document.COLUMN_LAST_MODIFIED
)
val results = mutableListOf<SourceImage>()
var lastReported = 0
val pendingDirs = ArrayDeque<String>()
val visitedDocuments = mutableSetOf(rootDocumentId)
pendingDirs.addLast(rootDocumentId)
while (pendingDirs.isNotEmpty()) {
currentCoroutineContext().ensureActive()
val parentDocumentId = pendingDirs.removeLast()
val childrenUri = DocumentsContract.buildChildDocumentsUriUsingTree(this, parentDocumentId)
val cursor = suspendCancellableCoroutine<Cursor> { continuation ->
val signal = CancellationSignal()
continuation.invokeOnCancellation { signal.cancel() }
try {
val result = context.contentResolver.query(childrenUri, projection, null, null, null, signal)
?: throw IOException("Document provider could not read the folder")
continuation.resume(result) { _, value, _ -> value.close() }
} catch (e: Exception) {
continuation.resumeWithException(e)
}
}
cursor.use {
cursor.requireComplete()
val idColumn = cursor.getColumnIndexOrThrow(DocumentsContract.Document.COLUMN_DOCUMENT_ID)
val nameColumn = cursor.getColumnIndexOrThrow(DocumentsContract.Document.COLUMN_DISPLAY_NAME)
val mimeColumn = cursor.getColumnIndexOrThrow(DocumentsContract.Document.COLUMN_MIME_TYPE)
val modifiedColumn = cursor.getColumnIndexOrThrow(DocumentsContract.Document.COLUMN_LAST_MODIFIED)
while (cursor.moveToNext()) {
currentCoroutineContext().ensureActive()
val documentId = cursor.getString(idColumn) ?: continue
if (!visitedDocuments.add(documentId)) continue
val name = cursor.getString(nameColumn) ?: continue
// Galleries rename deleted files in place: .trashed-…, .Trash-…
// HyperOS keeps reporting the old display name, so the id is checked too.
val fileName = documentId.substringAfterLast('/').substringAfterLast(':')
if (listOf(name, fileName).any { it.startsWith(".trash", ignoreCase = true) }) continue
if (cursor.getString(mimeColumn) == DocumentsContract.Document.MIME_TYPE_DIR) {
pendingDirs.addLast(documentId)
} else {
val extension = name.substringAfterLast('.', "").lowercase()
if (extension in Constants.SUPPORTED_IMAGE_EXTENSIONS) {
results.add(
SourceImage(
uri = DocumentsContract.buildDocumentUriUsingTree(this, documentId).toString(),
name = name,
modifiedAt = if (cursor.isNull(modifiedColumn)) 0L else cursor.getLong(modifiedColumn)
)
)
if (results.size - lastReported >= PROGRESS_REPORT_INTERVAL) {
lastReported = results.size
onProgress(results.size)
}
}
}
}
}
}
onProgress(results.size)
return results
}
private const val PROGRESS_REPORT_INTERVAL = 512
@@ -0,0 +1,60 @@
package com.anthonyla.paperize.data.source
import android.content.Context
import android.graphics.Bitmap
import androidx.core.net.toUri
import com.anthonyla.paperize.core.ScreenType
import com.anthonyla.paperize.core.util.adaptiveBrightnessAdjustment
import com.anthonyla.paperize.core.util.getDeviceScreenSize
import com.anthonyla.paperize.core.util.processBitmap
import com.anthonyla.paperize.core.util.retrieveBitmap
import com.anthonyla.paperize.core.util.usesLauncherManagedScrolling
import com.anthonyla.paperize.domain.model.ScheduleSettings
import com.anthonyla.paperize.domain.model.Wallpaper
import com.anthonyla.paperize.domain.source.WallpaperRenderer
import dagger.hilt.android.qualifiers.ApplicationContext
import javax.inject.Inject
import kotlinx.coroutines.currentCoroutineContext
import kotlinx.coroutines.ensureActive
class AndroidWallpaperRenderer @Inject constructor(
@param:ApplicationContext private val context: Context
) : WallpaperRenderer {
override suspend fun render(wallpaper: Wallpaper, screen: ScreenType, settings: ScheduleSettings): Bitmap? {
currentCoroutineContext().ensureActive()
val effects = when (screen) {
ScreenType.HOME, ScreenType.BOTH -> settings.homeEffects
ScreenType.LOCK -> settings.lockEffects
ScreenType.LIVE -> settings.liveEffects
}
val scaling = when (screen) {
ScreenType.HOME, ScreenType.BOTH -> settings.homeScalingType
ScreenType.LOCK -> settings.lockScalingType
ScreenType.LIVE -> settings.liveScalingType
}
val size = getDeviceScreenSize(context)
var bitmap = retrieveBitmap(context, wallpaper.uri.toUri(), size.width, size.height, scaling,
usesLauncherManagedScrolling(screen, scaling, settings.homeScrollingEnabled)) ?: return null
try {
val processed = processBitmap(
source = bitmap,
enableDarken = effects.enableDarken, darkenPercent = effects.darkenPercentage,
enableBlur = effects.enableBlur, blurPercent = effects.blurPercentage,
enableVignette = effects.enableVignette, vignettePercent = effects.vignettePercentage,
enableGrayscale = effects.enableGrayscale, grayscalePercent = effects.grayscalePercentage
)
if (processed !== bitmap) bitmap.recycle()
bitmap = processed
if (settings.adaptiveBrightness) {
val adjusted = adaptiveBrightnessAdjustment(context, bitmap)
if (adjusted !== bitmap) bitmap.recycle()
bitmap = adjusted
}
currentCoroutineContext().ensureActive()
return bitmap
} catch (e: Exception) {
bitmap.recycle()
throw e
}
}
}
@@ -1,16 +1,22 @@
package com.anthonyla.paperize.di
import android.app.Application
import android.app.WallpaperManager
import android.content.Context
import androidx.room.Room
import com.anthonyla.paperize.data.settings.SettingsDataStore
import com.anthonyla.paperize.data.settings.SettingsDataStoreImpl
import com.anthonyla.paperize.feature.wallpaper.data.data_source.AlbumDatabase
import com.anthonyla.paperize.feature.wallpaper.data.data_source.SelectedAlbumDatabase
import com.anthonyla.paperize.feature.wallpaper.data.repository.AlbumRepositoryImpl
import com.anthonyla.paperize.feature.wallpaper.data.repository.SelectedAlbumRepositoryImpl
import com.anthonyla.paperize.feature.wallpaper.domain.repository.AlbumRepository
import com.anthonyla.paperize.feature.wallpaper.domain.repository.SelectedAlbumRepository
import com.anthonyla.paperize.core.constants.Constants
import com.anthonyla.paperize.data.database.LIBRARY_MIGRATIONS
import com.anthonyla.paperize.data.database.PaperizeDatabase
import com.anthonyla.paperize.data.repository.AlbumRepositoryImpl
import com.anthonyla.paperize.data.repository.SettingsRepositoryImpl
import com.anthonyla.paperize.data.repository.WallpaperRepositoryImpl
import com.anthonyla.paperize.data.source.AndroidDocumentSource
import com.anthonyla.paperize.data.source.AndroidWallpaperRenderer
import com.anthonyla.paperize.domain.repository.AlbumRepository
import com.anthonyla.paperize.domain.repository.SettingsRepository
import com.anthonyla.paperize.domain.repository.WallpaperRepository
import com.anthonyla.paperize.domain.source.DocumentSource
import com.anthonyla.paperize.domain.source.WallpaperRenderer
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
@@ -18,65 +24,33 @@ import dagger.hilt.android.qualifiers.ApplicationContext
import dagger.hilt.components.SingletonComponent
import javax.inject.Singleton
/**
* AppModule provides dependencies for the application for Dagger Hilt to inject
*/
@Module
@InstallIn(SingletonComponent::class)
object AppModule {
@Provides
@Singleton
fun provideAlbumDatabase(app: Application): AlbumDatabase {
return Room.databaseBuilder(
app,
AlbumDatabase::class.java,
AlbumDatabase.DATABASE_NAME
).fallbackToDestructiveMigration().addMigrations().build()
}
@Provides
@Singleton
fun provideSelectedAlbumDatabase(app: Application): SelectedAlbumDatabase {
return Room.databaseBuilder(
app,
SelectedAlbumDatabase::class.java,
SelectedAlbumDatabase.DATABASE_NAME
).fallbackToDestructiveMigration().addMigrations().build()
}
fun providePaperizeDatabase(app: Application): PaperizeDatabase =
Room.databaseBuilder(app, PaperizeDatabase::class.java, Constants.DATABASE_NAME)
.addMigrations(*LIBRARY_MIGRATIONS)
.build()
@Provides
@Singleton
fun provideAlbumDao(db: AlbumDatabase) = db.albumDao
fun provideWallpaperManager(@ApplicationContext context: Context): WallpaperManager =
WallpaperManager.getInstance(context)
@Provides
@Singleton
fun provideAlbumRepository(
db: AlbumDatabase
): AlbumRepository {
return AlbumRepositoryImpl(db.albumDao)
}
fun provideDocumentSource(source: AndroidDocumentSource): DocumentSource = source
@Provides
@Singleton
fun provideSelectedAlbumDao(db: SelectedAlbumDatabase) = db.selectedAlbumDao
fun provideWallpaperRenderer(renderer: AndroidWallpaperRenderer): WallpaperRenderer = renderer
@Provides
@Singleton
fun provideSelectedAlbumRepository(
db: SelectedAlbumDatabase
): SelectedAlbumRepository {
return SelectedAlbumRepositoryImpl(db.selectedAlbumDao)
}
fun provideAlbumRepository(repository: AlbumRepositoryImpl): AlbumRepository = repository
@Provides
@Singleton
fun provideSettingsDataStore (
@ApplicationContext context: Context
): SettingsDataStore = SettingsDataStoreImpl(context)
fun provideWallpaperRepository(repository: WallpaperRepositoryImpl): WallpaperRepository = repository
@Provides
@Singleton
fun provideContext(
@ApplicationContext context: Context,
): Context { return context }
}
fun provideSettingsRepository(repository: SettingsRepositoryImpl): SettingsRepository = repository
}
Loaded 100 of 425 files, more files were not shown because too many files have changed in this diff. Show more