Fix wallpaper transparency, Recents setup guide, drawer animation, and widget resizing #2

Merged
nandi merged 2 commits from geordi/151e76f4 into main 2026-11-23 05:36:23 +00:00
Owner

Summary

Fixes four issues in the MoonBit Android launcher (experiments/launcher):

1. System wallpaper hidden behind WebView

  • Root cause: web/style.css had .light, .dark { background: var(--background); ... } (specificity 0,1,0) overriding html, body { background: transparent; } (0,0,1), painting opaque oklch(.145 0 0) across <html class="dark"> and covering the transparent WebView.
  • Fix:
    • Removed background: var(--background) from .light, .dark and explicitly set html, html.dark, html.light, body { background: transparent; } before html.demo so desktop demo mode keeps its gradient backdrop while Android stays transparent.
    • Added WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER, API 29+ setNavigationBarContrastEnforced(false) / setStatusBarContrastEnforced(false), and explicit Color.TRANSPARENT on root and widgetLayer in HomeActivity.java while keeping WebView hardware acceleration.

2. "Restricted setting" on Windows (Recents) button on Android 13+

  • Root cause: Sideloaded APKs cannot enable RecentsService in Accessibility settings until Allow restricted settings is toggled once in App info, and HomeActivity.openRecents() previously dropped users straight into Accessibility settings with no explanation or App info shortcut.
  • Fix:
    • Exposed RecentsService.isRunning() and added recentsEnabled(), openAccessibilitySettings(), and openSelfAppInfo() on HomeActivity.Bridge, with openRecents() returning boolean (true when RecentsService is active, false when disabled).
    • Added Sheet::RecentsSetup, Msg::{RecentsUnavailable, OpenAccessibilitySettings, OpenSelfAppInfo}, and corresponding effects + bottom sheet explaining Restricted setting and Allow restricted settings with direct buttons for Open Accessibility settings and Open App info (plus updated recents_service_description in strings.xml).

3. Smooth app drawer animations

  • Root cause: Unkeyed top-level nodes in app/view.mbt caused patch_children to recycle .sheet-overlay / .notice as .drawer; full-height translateY(-100%) with backdrop-filter: blur(24px) plus a 50ms mid-animation showKeyboard() call and per-frame getBoundingClientRect() polling in cover() caused jank; closing had no exit transition; and drawer icons popped in on first open.
  • Fix:
    • Keyed all top-level #app nodes (home=1, drawer=2, sheet-overlay=3, sheet=4, resize-bar=5, notice=6) so overlays never recycle across DOM types.
    • Replaced full-screen backdrop-filter and translateY(-100%) with a translucent scrim (rgb(10 10 14 / .84)) and GPU-composited drawer-in (180ms) / drawer-out (140ms, .drawer.closing) animations managed via drawer_closing and drawer_gen (Delay(140, DrawerClosed(gen))), keeping prefers-reduced-motion: reduce supported.
    • Replaced per-frame getBoundingClientRect() rAF polling in cover() with immediate coverWidgets(-1) on open and coverWidgets(0) on close/closing.
    • Delayed HomeActivity.Bridge.showKeyboard() to 190ms (cancelled by hideKeyboard() / createWebView() / onDestroy()) so the IME opens right after the drawer entrance finishes.
    • Pre-warmed uncached app icons in web/main.mbt after apps.json loads.

4. Widget resizing handles, edge anchoring, scroll sync, and axis limits

  • Root cause:
    • .resize-handle strips sat completely outside the widget (16px wide/tall), falling into the bezel/gesture zone on full-width widgets while WidgetView intercepted touches just inside the border as widget drags.
    • Holding a resize handle for >= 500ms bubbled Press to .widget-slot's Lift(i), setting lifted while resize stayed active.
    • Resizing an unpinned widget didn't pin its cell, Right didn't cap width at cols - s.x, only r/b/rb handles existed, measure() wasn't synced on scroll, QueryLimits wasn't fetched until drag start (so non-resizable edges still showed handles), and placeWidgets() bit-packed r[5] without masking.
  • Fix:
    • Added WidgetView.dispatchTouchEvent pass-through within 18dp (capped at 30%) of active resize edges when editingWidget == id and masked (r[5] & 0xffffffffL) in HomeActivity.placeWidgets().
    • Enlarged .resize-handle targets to 36px–40px straddling the border (inside viewport bounds), added .active visual feedback and a .resize-size (cols × rows) badge in .resize-bar.
    • Added Left and Top edge resizing alongside Right, Bottom, and Corner, pinning unpinned widgets on begin_resize and anchoring opposite edges without shifting s.x/s.y when clamped.
    • Added press: Some(Nop) on handles and m.resize is None guard on Lift(i).
    • Queried QueryLimits immediately when entering resize mode, filtered rendered handles by lim.h / lim.v, and synced measure() (including scroll_y) on window.scroll, pointerdown, and native widgetMenu/widgetGrab.

Verification

  • moon check --target js (0 errors, 0 warnings)
  • moon test --target js (68/68 passed)
  • moon test --target wasm-gc (68/68 passed)
  • scripts/build-web.sh --demo + node tests/e2e.cjs (launcher ok) + node tests/android-sim.cjs (android bridge ok)
  • android/build.sh built, zipaligned, and verified build/ultra-launcher.apk locally (aapt2, javac --release 17, d8, apksigner verify) against Android SDK 35
  • sweet doctor (No release problems found.)
## Summary Fixes four issues in the MoonBit Android launcher (`experiments/launcher`): ### 1. System wallpaper hidden behind WebView - **Root cause:** `web/style.css` had `.light, .dark { background: var(--background); ... }` (specificity `0,1,0`) overriding `html, body { background: transparent; }` (`0,0,1`), painting opaque `oklch(.145 0 0)` across `<html class="dark">` and covering the transparent WebView. - **Fix:** - Removed `background: var(--background)` from `.light, .dark` and explicitly set `html, html.dark, html.light, body { background: transparent; }` before `html.demo` so desktop demo mode keeps its gradient backdrop while Android stays transparent. - Added `WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER`, API 29+ `setNavigationBarContrastEnforced(false)` / `setStatusBarContrastEnforced(false)`, and explicit `Color.TRANSPARENT` on `root` and `widgetLayer` in `HomeActivity.java` while keeping WebView hardware acceleration. ### 2. "Restricted setting" on Windows (Recents) button on Android 13+ - **Root cause:** Sideloaded APKs cannot enable `RecentsService` in Accessibility settings until **Allow restricted settings** is toggled once in **App info**, and `HomeActivity.openRecents()` previously dropped users straight into Accessibility settings with no explanation or App info shortcut. - **Fix:** - Exposed `RecentsService.isRunning()` and added `recentsEnabled()`, `openAccessibilitySettings()`, and `openSelfAppInfo()` on `HomeActivity.Bridge`, with `openRecents()` returning `boolean` (`true` when `RecentsService` is active, `false` when disabled). - Added `Sheet::RecentsSetup`, `Msg::{RecentsUnavailable, OpenAccessibilitySettings, OpenSelfAppInfo}`, and corresponding effects + bottom sheet explaining **Restricted setting** and **Allow restricted settings** with direct buttons for **Open Accessibility settings** and **Open App info** (plus updated `recents_service_description` in `strings.xml`). ### 3. Smooth app drawer animations - **Root cause:** Unkeyed top-level nodes in `app/view.mbt` caused `patch_children` to recycle `.sheet-overlay` / `.notice` as `.drawer`; full-height `translateY(-100%)` with `backdrop-filter: blur(24px)` plus a `50ms` mid-animation `showKeyboard()` call and per-frame `getBoundingClientRect()` polling in `cover()` caused jank; closing had no exit transition; and drawer icons popped in on first open. - **Fix:** - Keyed all top-level `#app` nodes (`home=1`, `drawer=2`, `sheet-overlay=3`, `sheet=4`, `resize-bar=5`, `notice=6`) so overlays never recycle across DOM types. - Replaced full-screen `backdrop-filter` and `translateY(-100%)` with a translucent scrim (`rgb(10 10 14 / .84)`) and GPU-composited `drawer-in` (`180ms`) / `drawer-out` (`140ms`, `.drawer.closing`) animations managed via `drawer_closing` and `drawer_gen` (`Delay(140, DrawerClosed(gen))`), keeping `prefers-reduced-motion: reduce` supported. - Replaced per-frame `getBoundingClientRect()` rAF polling in `cover()` with immediate `coverWidgets(-1)` on open and `coverWidgets(0)` on close/closing. - Delayed `HomeActivity.Bridge.showKeyboard()` to `190ms` (cancelled by `hideKeyboard()` / `createWebView()` / `onDestroy()`) so the IME opens right after the drawer entrance finishes. - Pre-warmed uncached app icons in `web/main.mbt` after `apps.json` loads. ### 4. Widget resizing handles, edge anchoring, scroll sync, and axis limits - **Root cause:** - `.resize-handle` strips sat completely outside the widget (`16px` wide/tall), falling into the bezel/gesture zone on full-width widgets while `WidgetView` intercepted touches just inside the border as widget drags. - Holding a resize handle for `>= 500ms` bubbled `Press` to `.widget-slot`'s `Lift(i)`, setting `lifted` while `resize` stayed active. - Resizing an unpinned widget didn't pin its cell, `Right` didn't cap width at `cols - s.x`, only `r`/`b`/`rb` handles existed, `measure()` wasn't synced on scroll, `QueryLimits` wasn't fetched until drag start (so non-resizable edges still showed handles), and `placeWidgets()` bit-packed `r[5]` without masking. - **Fix:** - Added `WidgetView.dispatchTouchEvent` pass-through within `18dp` (capped at `30%`) of active resize edges when `editingWidget == id` and masked `(r[5] & 0xffffffffL)` in `HomeActivity.placeWidgets()`. - Enlarged `.resize-handle` targets to `36px–40px` straddling the border (inside viewport bounds), added `.active` visual feedback and a `.resize-size` (`cols × rows`) badge in `.resize-bar`. - Added `Left` and `Top` edge resizing alongside `Right`, `Bottom`, and `Corner`, pinning unpinned widgets on `begin_resize` and anchoring opposite edges without shifting `s.x`/`s.y` when clamped. - Added `press: Some(Nop)` on handles and `m.resize is None` guard on `Lift(i)`. - Queried `QueryLimits` immediately when entering resize mode, filtered rendered handles by `lim.h` / `lim.v`, and synced `measure()` (including `scroll_y`) on `window.scroll`, `pointerdown`, and native `widgetMenu`/`widgetGrab`. ## Verification - `moon check --target js` (0 errors, 0 warnings) - `moon test --target js` (68/68 passed) - `moon test --target wasm-gc` (68/68 passed) - `scripts/build-web.sh --demo` + `node tests/e2e.cjs` (`launcher ok`) + `node tests/android-sim.cjs` (`android bridge ok`) - `android/build.sh` built, zipaligned, and verified `build/ultra-launcher.apk` locally (`aapt2`, `javac --release 17`, `d8`, `apksigner verify`) against Android SDK 35 - `sweet doctor` (`No release problems found.`)
nandi added 1 commit 2026-11-23 04:55:41 +00:00
Fix wallpaper transparency, Recents setup guide, and drawer animation
Launcher / test (pull_request) Successful in 1m12s
Launcher / apk (pull_request) Skipped
216c80252d
nandi added 1 commit 2026-11-23 05:29:34 +00:00
Fix widget resizing handles, edge anchoring, scroll sync, and axis limits
Launcher / test (pull_request) Successful in 1m19s
Launcher / apk (pull_request) Skipped
bb978fd6de
nandi changed title from Fix wallpaper transparency, Recents setup guide, and drawer animation to Fix wallpaper transparency, Recents setup guide, drawer animation, and widget resizing 2026-11-23 05:29:46 +00:00
nandi merged commit 3070db4fb4 into main 2026-11-23 05:36:23 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: experiments/launcher#2