8000 orientation: apply lock before layout and re-evaluate on resume by Mubashir78 · Pull Request #4037 · quran/quran_android · GitHub
[go: up one dir, main page]

Skip to content

orientation: apply lock before layout and re-evaluate on resume - #4037

Open
Mubashir78 wants to merge 1 commit into
quran:mainfrom
Mubashir78:fix/3947-orientation-lock
Open

Mubashir78 wants to merge 1 commit into
quran:mainfrom
Mubashir78:fix/3947-orientation-lock

Conversation

@Mubashir78
Copy link
Copy Markdown

Fixes #3947

Two user-visible problems with the lock screen orientation preference, both reported in the issue:

  1. With the lock enabled, the reading screen first appeared in the current orientation for a frame before rotating to the locked one. The enforcement logic moved into a small enforceOrientationLock() helper that is called in onCreate right after field injection and before setContentView, so the activity is created directly in the locked orientation.
  2. Disabling the lock only took effect after leaving to the surah list, because the previously requested orientation persisted. onResume now re-evaluates the preference: when the lock is disabled or unsupported it falls back to SCREEN_ORIENTATION_UNSPECIFIED, otherwise it enforces the lock again. Toggling the preference (or its direction) while the reading screen is in the back stack now takes effect on return.

Verification

  • No Gradle build on my current machine (no Android SDK at the moment), so CI review is needed.
  • The moved block no longer returns early from initialize(), so analytics logging and recitation presenter binding now run even when a rotation is pending. That matches the behavior when the current orientation already matches the lock.

Issue quran#3947. Two user-visible problems with the lock screen orientation
preference:

- With the lock enabled, the reading screen appeared in the current
  orientation for a frame before rotating to the locked one. Extract
  the enforcement into enforceOrientationLock() and call it in onCreate
  right after field injection, before setContentView, so the activity is
  created directly in the locked orientation.
- Disabling the lock took effect only after leaving to the surah list.
  The requestedOrientation set on a previous run persisted. Re-evaluate
  the preference in onResume: when the lock is off or unsupported, fall
  back to SCREEN_ORIENTATION_UNSPECIFIED, otherwise enforce it again.

The old block in initialize() also returned early and skipped analytics
and recitation binding whenever a rotation was pending; moving it to
onCreate removes that early return.

(cherry picked from commit c140872)
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.

Bug in Lock screen orientation

1 participant

0