Skip to content

[Bug] Android: hardcoded 25px switcher height (#58) - #69

Open
jan21deepak wants to merge 1 commit into
mainfrom
cursor/android-switcher-height-0e0c
Open

[Bug] Android: hardcoded 25px switcher height (#58)#69
jan21deepak wants to merge 1 commit into
mainfrom
cursor/android-switcher-height-0e0c

Conversation

@jan21deepak

@jan21deepak jan21deepak commented Aug 10, 2026

Copy link
Copy Markdown
Owner

Opened by Cursor Forge after Cloud Agent pushed the branch but could not create the PR (GitHub App collaborator permissions).

Fixes #58.


Open in Devin Review

The chat scroll-fade used a hardcoded 25px pill height that drifted at
non-default font scales because the pill text is sp-sized. Keep 25px as
the CSS default for older shells and have MainActivity push the measured
height into --omnigent-android-switcher-height after layout.

Closes #58

Co-authored-by: Deepak Sekar <deepaksekaranz@users.noreply.github.com>

@devin-ai-integration devin-ai-integration 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.

Devin Review found 1 potential issue.

View 1 additional finding in Devin Review.

Open in Devin Review

switchButton.getHitRect(hitRect)
if (hitRect.height() < minHeight) hitRect.bottom = hitRect.top + minHeight
container.touchDelegate = TouchDelegate(hitRect, switchButton)
emitSwitcherHeight()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Measured server-switcher height never reaches the loaded page, so the old fixed height stays in effect

The measured pill height is pushed to the web layer (emitSwitcherHeight() at web/android/app/src/main/java/ai/omnigent/android/MainActivity.kt:586) only while the native pill is being laid out, which happens before the page finishes loading and is never repeated afterward, so the loaded page keeps using the hardcoded 25px default the change was meant to replace.
Impact: The Android scroll-fade gradient still positions itself using the old fixed height instead of the pill's real size on normal cold starts and after any page reload or server switch, so the visual bug the change targets is not actually fixed.

Layout-driven emit fires before page load and is not re-run in onPageReady

emitSwitcherHeight() sets the inline CSS custom property --omnigent-android-switcher-height on document.documentElement. It is invoked only from the pill's addOnLayoutChangeListener callback (MainActivity.kt:581-586), which runs during the activity's initial native layout pass — before webView.loadUrl(...)'s SPA has finished loading. Any inline style set against the pre-load / about:blank document is discarded when the real document loads.

Unlike the safe-area insets, which are cached in lastInsets and re-emitted from onPageReady on every pinned-origin page load (MainActivity.kt:660 calls emitInsets()), onPageReady never calls emitSwitcherHeight() (see MainActivity.kt:642-661). No native re-layout of switchButton occurs on a WebView reload or server switch (reloadWithNewServerloadUrl), so the layout listener does not fire again and the measured height is never delivered to the freshly loaded document. The CSS in web/src/index.css:167 therefore falls back to --omnigent-android-switcher-height: 25px.

Fix: cache the last measured height and also emit it from onPageReady (mirroring emitInsets), so the loaded page reliably receives the real pill height.

Prompt for agents
emitSwitcherHeight() is only called from the pill's addOnLayoutChangeListener in expandSwitchButtonTouchTarget (MainActivity.kt:586). That listener fires during the initial native layout pass, which happens before the WebView's SPA finishes loading, and it does not fire again on a page reload or server switch (reloadWithNewServer -> webView.loadUrl) because switchButton does not re-layout. As a result the inline CSS var --omnigent-android-switcher-height set on document.documentElement is lost when the real document loads, and the web layer keeps using the 25px default in web/src/index.css. Compare with emitInsets, which caches its value in lastInsets and is re-emitted from onPageReady on every pinned-origin page load so it survives reloads. Fix emitSwitcherHeight the same way: remember the last measured pill height and also emit it from onPageReady (after the origin check) so the loaded page reliably receives the measured height on cold start and after every reload/server switch.
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

@jan21deepak

Copy link
Copy Markdown
Owner Author

bugbot run

@cursor

cursor Bot commented Aug 10, 2026

Copy link
Copy Markdown

Bugbot couldn't run — GitHub account mismatch

The GitHub account linked to your Cursor account does not match the PR author.

Please ensure you're using the correct GitHub account, or run Bugbot from a team that covers this repository.

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.

[Bug] Android: hardcoded 25px switcher height makes the chat scroll-fade start too high at large font sizes

2 participants