Skip to content

ADFA-2944 | Fix crash when restoring BottomSheet state#969

Merged
jatezzz merged 1 commit intostagefrom
fix/ADFA-2944-bottom-sheet-crash
Feb 18, 2026
Merged

ADFA-2944 | Fix crash when restoring BottomSheet state#969
jatezzz merged 1 commit intostagefrom
fix/ADFA-2944-bottom-sheet-crash

Conversation

@jatezzz
Copy link
Copy Markdown
Collaborator

@jatezzz jatezzz commented Feb 11, 2026

Description

Fixed a crash caused by attempting to programmatically set the BottomSheetBehavior state to STATE_SETTLING or STATE_DRAGGING.

These are read-only internal states representing transient movement. If the Activity is recreated (e.g., during rotation or theme toggle) while the bottom sheet is settling, the ViewModel restores this state and attempts to apply it to the new view, causing an IllegalArgumentException.

Details

The fix involves filtering out these transient states in updateBottomSheetState before applying them to the view.

Error fixed:
java.lang.IllegalArgumentException: STATE_SETTLING should not be set externally.

Before changes

Screen.Recording.2026-02-11.at.12.46.00.PM.mov

After changes

Screen.Recording.2026-02-11.at.1.07.38.PM.mov

Ticket

ADFA-2944

Observation

This resolves the race condition observed in Sentry reports where the app crashes upon restoration if the user was interacting with the bottom sheet during a configuration change.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Feb 11, 2026

Warning

Rate limit exceeded

@jatezzz has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 28 minutes and 40 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📝 Walkthrough

Walkthrough

The change adds an early return condition in updateBottomSheetState to prevent further state updates when the bottom sheet is in intermediate DRAGGING or SETTLING animation states, avoiding unwanted UI changes during those transient phases.

Changes

Cohort / File(s) Summary
Bottom Sheet State Management
app/src/main/java/com/itsaky/androidide/activities/editor/BaseEditorActivity.kt
Added early return guard when bottom sheet state is DRAGGING or SETTLING, preventing state propagation during intermediate animation phases.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Suggested reviewers

  • Daniel-ADFA
  • alexmmiller

Poem

🐰 Hops with glee!
The bottom sheet now knows its place,
No dragging distractions mid-grace,
Just steady states, smooth and neat—
A rabbit's hop cannot be beat! 🎉

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: fixing a crash when restoring BottomSheet state, which directly relates to the changeset's core modification.
Description check ✅ Passed The description is comprehensive and directly related to the changeset, explaining the crash cause, the fix applied, and providing context about the issue and its resolution.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/ADFA-2944-bottom-sheet-crash

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@jatezzz jatezzz force-pushed the fix/ADFA-2944-bottom-sheet-crash branch from 6c82d05 to 40b0575 Compare February 12, 2026 14:39
@jatezzz jatezzz requested a review from a team February 12, 2026 16:11
@jatezzz jatezzz force-pushed the fix/ADFA-2944-bottom-sheet-crash branch 2 times, most recently from ab31572 to 4e57290 Compare February 13, 2026 21:58
@jatezzz jatezzz force-pushed the fix/ADFA-2944-bottom-sheet-crash branch from 4e57290 to deb856e Compare February 18, 2026 20:56
@jatezzz jatezzz merged commit 56c465b into stage Feb 18, 2026
2 checks passed
@jatezzz jatezzz deleted the fix/ADFA-2944-bottom-sheet-crash branch February 18, 2026 21:12
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.

2 participants