Skip to content

fix: the attach tray is the tile grid again - #507

Merged
an1ndra merged 2 commits into
Developfrom
fix/attach-tray-ui
Nov 19, 2026
Merged

an1ndra merged 2 commits into
Developfrom
fix/attach-tray-ui

Conversation

@an1ndra

@an1ndra an1ndra commented Nov 19, 2026

Copy link
Copy Markdown
Owner

What changed

The chat opens AttachTray in its own bottom bar, under the composer: the camera as the tall tile, gallery, audio, location and contact beside it. The old list sheet (AttachSheet) and its preview are gone.

  • The + turns into the × that closes the tray, and closing it hands focus back to the field, so the draft is never lost.
  • Opening the tray clears focus and hides the keyboard, and the tray is built to the measured keyboard height, so the composer holds still (0 px across the swap).
  • Closing the tray now holds the slot it vacated until the keyboard actually arrives, and the tray leaves in 90 ms instead of 200 ms, so it is off screen before the returning keyboard reaches it.
  • The composer's keyboard height comes from ImeGuard, so an OEM that overstates the IME inset cannot hand the tray a window-sized slot.
  • Back closes the tray before it leaves the chat, and every picker still goes through launchOrExplain.

Why

Merging feat/attach-tray resolved ChatScreen.kt by keeping Develop's older list sheet, so AttachTray compiled and shipped unused: attaching still dimmed the conversation behind a scrim, left the keyboard up underneath it, and covered the message being replied to.

Closing the tray then had a second problem: the composer cleared its inset the moment the tray left, while the keyboard had not arrived yet, so it dropped to the bottom of the window and climbed back with the keyboard — the ~800 px flicker in the recording.

Testing

  • ./gradlew testDebugUnitTest passes
  • JUnit test added under app/src/test/java/ for the changed logic (AttachTrayWiringTest; AudioAttachmentTest now reads the tray's Audio tile)
  • scripts/test-*.sh added, and it fails before the fix / passes after

scripts/test-attach-tray.sh on emulator-5556: 27 passed, 0 failed.

On the old sheet build the same script fails on "the keyboard stayed up under the tray" and "the conversation disappeared behind the tray". On the build without the swap hold it reports:

[FAIL] the composer dropped below the tray's slot on the way back: ime=331.8095 composer=283.8095

The fixed build across the close (from the app's own AttachTrayHeight log):

slot=295.2381 composer=0.0      open=false   tray still fading out
slot=295.2381 composer=295.2381 open=false   keyboard rising, bar holds
slot=295.2381 composer=295.2381 open=false   keyboard arrived, no jump

scripts/test-tray-follows-keyboard.sh: 5 passed, 0 failed at 420 dpi (295 dp) and 320 dpi (374 dp).

Scripts side, merged to Messages-scripts Develop first: 3836f4e (the location prompt the app actually shows) and 0649647 (the composer holds still on the way back).

Related issue

None — reported with a screen recording of the flicker.

Merging feat/attach-tray kept Develop's older list sheet wired into the
chat: AttachTray shipped, the sheet stayed, and attach still dimmed the
conversation behind a scrim with the keyboard up underneath. Only the
tray's own view was left out of the merge; everything it needs was there.

The chat now opens AttachTray in its own bottom bar, under the composer:

- the plus turns into the cross that closes the tray, and closing it
  hands focus back to the field, so the draft is never lost;
- opening the tray clears focus and hides the keyboard, and the tray is
  built to the measured keyboard height, so the composer holds still
  (0 px across the swap, per AttachTrayHeight);
- the composer clears nothing while the tray holds that slot, and its
  keyboard height comes from ImeGuard, so an OEM that overstates the
  inset cannot hand the tray a window-sized slot;
- Back closes the tray before it leaves the chat;
- every picker still goes through launchOrExplain, so a device without a
  camera app explains itself instead of crashing.

AttachSheet is removed with its preview: with the tray wired in it was a
second, unused attach UI.

JUnit: AttachTrayWiringTest (the tray in the bottom bar, all five tiles,
the keyboard swap, the Back handler, the dead sheet) and AudioAttachmentTest
reads the tray's Audio tile instead of the sheet's row.

scripts/test-attach-tray.sh: 26 checks on emulator-5556, 0 failed; on the
sheet build the same script fails 5, including "the keyboard stayed up
under the tray" and "the conversation disappeared behind the tray".
Tapping the crossed attach button closed the tray and the composer fell
to the bottom of the window, then climbed back up as the keyboard rose —
a 800 px flicker over the swap. It happened because the composer cleared
its inset the moment the tray closed, while the keyboard had not arrived
yet: its padding went to zero and the keyboard's own animation pushed it
back afterwards.

The tray's visibility is now read through a transition state, so the
composer clears nothing for as long as the tray is on screen (including
its fade-out), and a swap flag holds the slot the tray vacated until the
keyboard actually arrives. The tray also leaves in 90 ms instead of 200,
so it is off screen before the returning keyboard reaches it rather than
hanging over the keys.

The tray's fade-in and the whole of the keyboard's rise are unchanged, so
the composer sits at the same height throughout: 0 px in the regression
script's measurement, and no frame in a screen recording shows it move.

scripts/test-attach-tray.sh reads the composer's height from the app's own
AttachTrayHeight log for the swap back (27 checks, 0 failed; the build
without the hold reports a composer of 283 dp against a 295 dp slot while
the keyboard returns).

JUnit: AttachTrayWiringTest pins the swap-aware inset, the held slot and
the faster tray exit.
@an1ndra
an1ndra merged commit 92af162 into Develop Nov 19, 2026
1 check passed
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