Skip to content

Morph the Session Chat composer and smooth the Android keyboard animation - #963

Merged
ivanfenenko merged 3 commits into
mainfrom
fix/android-pill-visibility
Nov 2, 2026
Merged

ivanfenenko merged 3 commits into
mainfrom
fix/android-pill-visibility

Conversation

@ivanfenenko

@ivanfenenko ivanfenenko commented Nov 2, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

No linked issue. This follows up on screen recordings of the composer and list animations.

  • Composer morph (both apps). When the composer switches between the prompt and a question or permission request, it now morphs in place instead of sliding down. Content is pinned to the bottom of the shell, so it no longer sits at the top. The old content fades out while the new content fades in, and the shell resizes on one ease-in-out curve: 280 ms on Android, 0.24 s on iOS.
  • List, pills and composer move together (iOS). On iOS, the timeline inset and the corner pills used to jump to the new composer height while the shell was still animating. They now follow the composer's curve. MessageListTimelineHost runs its FLIP glide with that animation, using UIView.animate(_:changes:) on iOS 18 and later.
  • Android keyboard animation. Inside Session Chat on a slower tablet, the keyboard animation stuttered. There were two causes:
    • The composer was measured including the keyboard padding, so every keyboard frame stored a new height and recomposed the whole screen. The chat area now takes windowInsetsPadding(ime - navigationBars), which only re-runs layout, so the composer keeps a constant height.
    • When the list was already at its end, re-pinning it after a layout change still launched a scroll that moved nothing. That scroll flipped isProgrammaticScrolling and recomposed the timeline twice per frame. It now settles in place instead.
  • Playground. M3 "Agent replies" gets a turn with three inline images in the reply, on both platforms.

Checks

  • iOS and Android both covered: the morph is on both apps. The keyboard fix is Android only; iOS was not affected.
  • Screenshots for UI changes: GIFs in a comment, from the Playground and the scenario harness.
  • Tests run: 243 related Android unit tests pass (MessageList*, ScrollToEnd*, SessionChatTimeline*, Playground*). Both apps build.
  • Tablet measurement used dumpsys gfxinfo while the keyboard opened in Session Chat, on a release-like benchmark build:
    • Before: 15–26 ms median per frame, with 12–18% janky frames.
    • After: 12–13 ms median, with 4–10% janky frames. The tablet runs at 60 Hz, so the frame budget is 16.7 ms.

Risks / Follow-ups

  • Debug builds on the tablet still lag during the keyboard animation, because the list re-lays out on every frame. A further step would translate the list during the animation and resize it only at the end; that is not done here.
  • I did not run the full Android unit suite or the iOS unit tests.
  • On iOS I checked only the iPhone Duo simulator, because the iPad simulators don't support the installed runtime. I didn't check dark mode.

🤖 Generated with Claude Code


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

ivanfenenko and others added 3 commits November 2, 2026 20:07
The composer content was top-aligned inside a bottom-pinned shell, so
switching from a permission or question to the prompt slid the old card
down while the new one faded in after it. Both platforms now keep the
content on the shell's bottom edge and crossfade the two modes while the
shell resizes, so it reads as one surface changing shape.

On iOS the corner pills and the timeline also follow the composer's edge
on its own curve: a height measured for a new composer mode is applied
with the composer's animation, and the end-pinned list's inset glide uses
that curve instead of its spring while the composer morphs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Two per-frame recompositions made the keyboard animation drop most frames
on a Redmi Pad SE (57 ms median per frame in debug, 15-26 ms in a
release-like build):

- The composer was measured outside its keyboard padding, so its height
  changed on every inset frame and the whole screen recomposed. The chat
  area now takes the keyboard part above the navigation bar as layout-only
  inset padding, which also keeps the composer's measured height constant.
- The viewport change re-pinned the list on every frame with a scroll that
  did not move it, flipping isProgrammaticScrolling twice and recomposing
  the timeline. A list already resting at its end now settles in place.

Release-like build on the same tablet: 12-13 ms median, 4-10% janky frames.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Adds a turn to M3 where the agent answers with text and three images,
so image galleries inside assistant replies can be checked without a
server.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ivanfenenko

Copy link
Copy Markdown
Collaborator Author

Composer morph, captured from the Session Chat Playground and the scenario harness:

Android: permission ↔ prompt iOS: prompt → permission iOS: permission → prompt
android composer morph ios composer expand ios composer collapse

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated review: 2 finding(s) that 2+ of 3 passes agreed on.

Outside the diff lines:

  • ios/OpenCode Mobile/OpenCode Mobile/UI/SessionChat/SessionChatView.swift:567 medium: Stale morph timer clears flag mid-morph
1 finding(s) from a single pass, not posted
  • ios/OpenCode Mobile/OpenCode Mobile/UI/SessionChat/SessionChatView.swift:1002 low: Async kind sync misclassifies typing growth as morph (muse-spark-1.3-contributor)

opencode pr-review · passes: muse-spark-1.3-contributor, glm-5.3-flash, deepseek-v4.1-flash · $0.141 · 1 pass(es) stopped early

modifier =
Modifier
.weight(1f)
.windowInsetsPadding(WindowInsets.ime.exclude(WindowInsets.navigationBars)),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high: Double-applied IME insets leaves gap above keyboard

The timeline/composer container now pads with ime.exclude(navigationBars) while the inner composer column still pads with ime.union(navigationBars). Window insets are window-global and windowInsetsPadding does not consume them, so both paddings stack. The composer background ends up lifted by roughly 2ime instead of 1ime.

Failure scenario: Open Session Chat on a device with navigation bars and open the keyboard: the composer floats about one keyboard-height above the keyboard leaving a blank gap, and the timeline is pushed too far up, instead of sitting just above the keyboard.

Found by 2 of 3 passes.

@ivanfenenko
ivanfenenko merged commit 811f14a into main Nov 2, 2026
@ivanfenenko
ivanfenenko deleted the fix/android-pill-visibility branch November 2, 2026 20:30
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