feat(timer): handle rotation in-app without relaunching activity#23
Merged
Conversation
Design for handling device rotation internally in Compose while locking the Activity to portrait, so layout elements stay in place and only text/icons rotate to match device pose. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The timer screen's layout was portrait-only, so system rotation pushed the dial off-screen. Lock MainActivity to portrait and detect device pose via OrientationEventListener, rotating text and icons inside Compose so the UI stays readable when the phone is tilted. Layout rules: - Portrait: unchanged. - Landscape (90° / 270°): title crossfades from the TopBar centre to the right edge, inline with the settings icon. "Endet um" slides down via translationY so it sits midway between the dial and the buttons, with the shift computed from BoxWithConstraints so the dial stays put on every screen size. - Reverse portrait (180°): same layout as portrait, every element rotated 180° — the text reuses the same space it had upright. All rotating elements share one animated angle (shortest-path aware, 350ms tween) so the effect reads as a single synchronised rotation. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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
MainActivityto portrait and detect device pose viaOrientationEventListener, then rotate text/icons inside Compose so the UI stays readable when the phone is tilted — the dial no longer overflows on system rotation.translationYso it sits midway between the dial and the buttons. The required shift is computed fromBoxWithConstraints, so the dial stays put on any screen size.Design doc:
docs/plans/2026-04-18-in-app-rotation-design.md.Test plan
🤖 Generated with Claude Code