feat(settings): add screen rotation mode setting#40
Merged
Conversation
Add a rotation-mode setting so users can control screen orientation independently of the previously hard-wired behavior. A new "Auto-rotate" row in Settings > Appearance opens a dialog with three modes: - System (default): rotate only while the OS auto-rotate flag is on, observed via Settings.System.ACCELEROMETER_ROTATION (no new permission) - Always: rotate regardless of the system lock (prior behavior) - Portrait: never rotate The mode is threaded through rememberDeviceOrientation, which gates the OrientationEventListener (and the system-flag ContentObserver in System mode) so both the window lock and the timer's in-Compose counter-rotation follow the setting. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Owner
Author
|
Closes #38 |
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
Adds a rotation-mode setting so users can control screen orientation, which was previously hard-wired (Timer screen locked to portrait with in-Compose counter-rotation; other screens followed the device pose — ignoring the system-wide auto-rotate lock entirely).
A new Auto-rotate row in Settings → Appearance opens a dialog (same pattern as the existing screen-lock dialog) with three modes:
Settings.System.ACCELEROMETER_ROTATION(no new permission; the app stays network/permission-free).The mode is stored in DataStore as an
AutoRotateModeenum (mirroring the existingThemeIdpattern) and threaded throughrememberDeviceOrientation(mode), which gates theOrientationEventListener— and, in System mode, aContentObserveron the system flag. Everything downstream (the window lock inAppOrientationController, the nav-fade guard, and the timer's in-Compose counter-rotation) follows from the resolved orientation, so no per-call-site branching was needed.Implementation notes
AutoRotateModeenum,AutoRotateModeDialog(mirrorsScreenLockMethodDialog, with the selected option accent-tinted per the theme-picker's selection language), andAppOrientationViewModel(lets the ViewModel-lessSleepTimerNavHostobserve the setting).ContentObserveronly exists in the composition while in System mode, so it self-disposes when the mode changes; it's process-scoped, so quick-settings flips made while backgrounded still land before the user returns.values/andvalues-de/.Verification
./gradlew assembleDebug lint— green.🤖 Generated with Claude Code