Add GTC (auto-rotate landscape pages) with scaling fixes - #162
Open
gwchua1976 wants to merge 7 commits into
Open
Add GTC (auto-rotate landscape pages) with scaling fixes#162gwchua1976 wants to merge 7 commits into
gwchua1976 wants to merge 7 commits into
Conversation
Adds a toggleable 'GTC' reader setting (paged reader, single-page layout). When enabled, pages whose longest side is horizontal (landscape pages) are rotated 90 degrees on portrait devices so the longest side aligns with the device height, and the image is scaled to fit before display. - New persisted setting: ImageReaderSettingsRepository.get/putGtcModeEnabled (ImageReaderSettings.gtcModeEnabled, DB column + migration V13) - PagedReaderState: sizing/scaling pipeline swaps the target box for applicable pages so calculateSizeForArea/requestUpdate size the image correctly for the rotated orientation; interactive pan/zoom is bypassed for rotated pages in favor of a fit-to-screen display - PagedReaderContent: SinglePageLayout rotates the measured page 90 degrees via placeRelativeWithLayer when GTC applies - Toggle added to both reading settings menus (desktop side menu and mobile bottom sheet), next to the existing scale type / layout options
Adds LockScreenOrientation, an expect/actual composable (Android locks Activity.requestedOrientation to PORTRAIT and restores the previous value on unlock/dispose; desktop and web are no-ops since they have no OS-level orientation concept). Wired into PagedReaderContent so it's active whenever GTC mode is enabled, preventing the device from rotating into landscape while GTC's portrait-relative sizing logic is in effect.
…ore zoom-limit math
…abel confusion" This reverts commit 45c0ddf.
Author
How to test
|
Isolates GTC-specific decision and scaling logic into its own object so future upstream merges only need to reconcile small call sites in PagedReaderState.kt and PagedReaderContent.kt instead of colliding with inlined GTC logic. Also fixes a null WorkManager dependency crash in App.kt's initWorkManager.
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.
Adds a GTC mode that rotates wide/landscape pages 90 degrees to fit device height when reading in portrait, locking orientation while active. Includes fixes for two scaling bugs found during testing: (1) SinglePageLayout zeroed min constraints instead of swapping them when computing the rotated layout box, causing the image to render at intrinsic size instead of filling it. (2) calculateScreenScale's gtcRotationApplied branch compared a target size computed in rotated-page space against the real (unrotated) screen area, producing an incorrect zoom factor. Fixed by swapping the target size back to real-screen orientation before the zoom-limit math.