Repository navigation
orientation: apply lock before layout and re-evaluate on resume - #4037
Open
Mubashir78 wants to merge 1 commit into
Open
Mubashir78 wants to merge 1 commit into
Mubashir78 wants to merge 1 commit into
Conversation
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)
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.
Fixes #3947
Two user-visible problems with the lock screen orientation preference, both reported in the issue:
enforceOrientationLock()helper that is called inonCreateright after field injection and beforesetContentView, so the activity is created directly in the locked orientation.onResumenow re-evaluates the preference: when the lock is disabled or unsupported it falls back toSCREEN_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
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.