Skip to content

feat(timer): native rotation for settings, lock portrait only in timer#25

Merged
Xitee1 merged 2 commits into
mainfrom
feat/native-rotation-for-settings
Apr 18, 2026
Merged

feat(timer): native rotation for settings, lock portrait only in timer#25
Xitee1 merged 2 commits into
mainfrom
feat/native-rotation-for-settings

Conversation

@Xitee1
Copy link
Copy Markdown
Owner

@Xitee1 Xitee1 commented Apr 18, 2026

Summary

  • Activity is no longer globally locked to portrait. Settings, About and ThemePicker now rotate natively with the device.
  • TimerContent locks requestedOrientation = SCREEN_ORIENTATION_PORTRAIT for the duration it is composed (via DisposableEffect), so the existing in-app Compose rotation still owns the timer screen. The previous orientation is restored on dispose when navigating away.
  • Added configChanges="orientation|screenSize|screenLayout|keyboardHidden" so the orientation-lock flip during navigation does not recreate the Activity.

Test plan

  • Launch app in portrait — timer screen renders unchanged, in-app rotation still works when tilting the device.
  • Tilt device to landscape while on timer screen — Activity stays in portrait, Compose rotates contents as before.
  • Tilt device to landscape, then navigate to Settings — Settings rotates to landscape natively.
  • Navigate back from Settings (landscape) to Timer — Activity returns to portrait without recreating.
  • Repeat for About and ThemePicker.
  • Rotate while transitioning between Timer and Settings — no crashes, no visual glitches.

🤖 Generated with Claude Code

Xitee1 and others added 2 commits April 18, 2026 23:09
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>
@Xitee1 Xitee1 merged commit 3cf7fae into main Apr 18, 2026
1 check passed
@Xitee1 Xitee1 deleted the feat/native-rotation-for-settings branch April 18, 2026 21:36
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.

1 participant