Fix bottom sheet peek-to-expanded jump on show#6648
Open
loganrosen wants to merge 1 commit intohome-assistant:mainfrom
Open
Fix bottom sheet peek-to-expanded jump on show#6648loganrosen wants to merge 1 commit intohome-assistant:mainfrom
loganrosen wants to merge 1 commit intohome-assistant:mainfrom
Conversation
Configure BottomSheetBehavior before the dialog is shown instead of in an onShowListener. The previous approach set STATE_EXPANDED after the sheet had already started its show animation at peek height, causing a visible two-step animation (peek then jump to expanded). Now the behavior is configured directly in onViewCreated (before onStart shows the dialog), so the sheet starts directly in the expanded state. Also adds skipCollapsed so dismissal goes straight to hidden. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the shared BottomSheetDialogFragment configuration helper so modal bottom sheets start expanded immediately (avoiding a visible peek-to-expanded jump) and dismiss directly to hidden by skipping the collapsed state.
Changes:
- Configure
BottomSheetDialog.behavior(expanded +skipCollapsed) directly instead of via anOnShowListener - Keep existing window defaults (dim amount + soft input resize) while applying them earlier
Member
|
@loganrosen do you mind adding 2 videos in the PR description showing what is changing? |
Member
You just beat me to it. I spent the last 15 minutes fiddling with the animation scale and while the change sounds logical, I'm not seeing any difference. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When opening a bottom sheet (e.g. the server chooser via 3-finger swipe up), the sheet visibly jumps from peek height to expanded. This is because
setLayoutAndExpandedByDefault()configuresSTATE_EXPANDEDin anonShowListener, which fires after the sheet has already started its show animation at peek height.This changes the approach to configure the
BottomSheetBehaviordirectly inonViewCreated(beforeonStartshows the dialog), so the sheet starts directly in the expanded state without an intermediate peek. Also addsskipCollapsedso dismissal goes straight to hidden instead of stopping at collapsed.Affects all callers:
ServerChooserFragment,ImprovSetupDialog, andImprovPermissionDialog.Checklist
Any other notes
No tests added — the fix is about when behavior properties are configured (before vs after dialog show), which is a timing concern that can't be meaningfully validated in a unit test. Tested manually on device.
Note: to test this on a debug build, I had to temporarily set
WIPFeature.USE_FRONTEND_V2 = falsebecause the new Compose frontend (FrontendScreen/HAWebView) doesn't have gesture detection yet — the swipe listener is only set up in the legacyWebViewActivitypath.