feat(timer): native rotation for settings, lock portrait only in timer#25
Merged
Conversation
The Activity was locked to portrait globally so the custom in-app rotation on TimerScreen would always work. This meant Settings / About / ThemePicker were stuck in portrait too. Flip the default: let the Activity follow the sensor, and lock to portrait only while TimerContent is composed (DisposableEffect restores the previous requestedOrientation on dispose). Add configChanges so the orientation-lock flip during navigation doesn't recreate the Activity. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The per-screen DisposableEffect approach left a disposal gap when releasing the portrait lock: Android's sensor-based rotation had to re-sample and debounce, causing a 1–2s delay before Settings rotated. Move the controller up to SleepTimerNavHost as a single always-on composable driven by DeviceOrientation. When the lock releases, the current pose is already known and mapped to an explicit requestedOrientation (LANDSCAPE / REVERSE_*), so the Activity rotates immediately without Android's debounce. Also skip the NavHost fade when the device is tilted: combined with the orientation flip, the fade briefly shows Timer's counter-rotated content being rotated by the window manager, appearing upside-down. In natural portrait there is no flip, so the fade is kept. 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
TimerContentlocksrequestedOrientation = SCREEN_ORIENTATION_PORTRAITfor the duration it is composed (viaDisposableEffect), so the existing in-app Compose rotation still owns the timer screen. The previous orientation is restored on dispose when navigating away.configChanges="orientation|screenSize|screenLayout|keyboardHidden"so the orientation-lock flip during navigation does not recreate the Activity.Test plan
🤖 Generated with Claude Code