Skip to content

Rebuild the media viewer's motion with standard Compose - #102

Merged
Tarquinen merged 1 commit into
devfrom
feat-viewer-motion
Nov 16, 2026
Merged

Tarquinen merged 1 commit into
devfrom
feat-viewer-motion

Conversation

@Tarquinen

@Tarquinen Tarquinen commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

The full-screen viewer's motion is now built from standard Compose, so about 330 fewer lines do the same job, and the motion looks the same as before or better.

Before, opening and closing flew a bitmap copy of the image over the app, with its own drag, back, recovery and trace code ported from iOS. Now the media itself moves: one animated frame and rounded clip that the image page draws at, or that the whole page follows for videos, loading pages and documents.

  • Images grow out of their thumbnail and fly home on close, from the zoomed frame when zoomed, and to the swiped-to page's own thumbnail
  • Videos grow out of their file card once their first frame is up, and shrink back into it
  • PDFs and other documents grow from their card; their swipe-down is unchanged
  • A clipped or off-screen thumbnail gets a fade-and-scale instead, and Reduce Motion a fade
  • Drag to dismiss keeps the same rule, so its tests still apply
  • Adding a marked-up image to the prompt (Slide a marked-up image into its composer thumbnail #98) looks the same

It doesn't use SharedTransitionLayout: that wraps the whole app, which hid the composer's model chip and needed frame waits to avoid fake transitions. Nothing outside the viewer changes.

dev on the left, this PR on the right: open, close, drag, back, then each hand-off case at 1× and 1/4 speed:

viewer-motion-dev-vs-pr.mp4

Checked on the emulator against session-lab at 1× and 0.1× in light and dark, side by side with dev: open and close from a chat image, a gallery, a clipped thumbnail, a video file card and a PDF card; swiping a gallery then closing; drag to dismiss and spring back; back and predictive back (cancel and commit); zoomed close; Reduce Motion; 2× font; TalkBack focus after close. The hand-off matched dev for a chat image, a paused video frame, a re-edited composer photo, a long draft, three images, an overflowing row, a long draft with an overflowing row, and Reduce Motion. scripts/check.sh passes.

Deleted: the flight layer, the controller's flight, drag, back and touch-recovery code, and MediaTransitionTrace.kt (−824 / +494 lines).

The viewer's open, close, drag to dismiss and predictive back were a
hand-built port of iOS's flight: a bitmap copy flown over the app, its
own drag, back and recovery paths, and a trace. Now one animated frame
and rounded clip moves the media itself: the selected image page draws
at it, and video, loading pages and documents move as a whole layer.

- Images grow out of their thumbnail and fly home on close, from the
  zoomed frame when zoomed, and to the swiped-to page's own thumbnail.
- Videos grow out of their file card once the first frame is up (up to
  1 s), and shrink back on close.
- Documents and agent file cards grow from their card; the swipe-down
  and nested-scroll hand-over are unchanged.
- A source that's clipped or off screen gets a fade-and-scale, and
  Reduce Motion a fade, as before.
- The drag keeps MediaDismissDrag's rule, so its tests still apply.
- The drawing hand-off into the composer is unchanged (#98).
- No SharedTransitionLayout: it would wrap the whole app in a lookahead
  scope, which broke the composer's model chip and needed frame waits.

Removed: the flight layer, the controller's flight, drag, back and touch
recovery paths, and MediaTransitionTrace (-824/+494 lines).

Checked on the emulator against dev: open, close, drag, spring back,
gallery swipe, zoomed close, predictive back, video, PDF, Reduce Motion,
dark mode, 2x font, TalkBack focus after close, and all eight hand-off
cases. scripts/check.sh passes.
@Tarquinen
Tarquinen merged commit aafb3ec into dev Nov 16, 2026
3 checks passed
@Tarquinen Tarquinen mentioned this pull request Nov 16, 2026

This branch was previously deployed

1 inactive deployment
release — 017632f8 Deployed Nov 16, 2026 by Tarquinen via check #349
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant