Open
Conversation
- Implemented vertical scrolling mode to display all PDF pages in a continuous scroll view. - Added styles for vertical layout and page number indicators in CSS. - Enhanced JavaScript logic for rendering all pages and tracking current page based on scroll position. - Introduced a toggle button in the toolbar for switching between vertical scroll mode and traditional page mode. - Updated Android integration to support vertical scroll mode and preserve state during mode switching. - Added new vector drawable for the vertical scroll toggle icon.
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a vertical scrolling layout in the web viewer and a "keep screen on" (wake lock) toggle in the Android PdfViewer.
- Adds JavaScript logic and CSS styles for vertical scroll mode, with page rendering and scroll‐based page tracking.
- Integrates menu actions and Java<->JavaScript interfaces for toggling vertical scroll and wake lock, including state persistence.
Reviewed Changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| viewer/js/index.js | Implements vertical scroll mode, rendering, throttling, and JS APIs |
| viewer/css/pdf_viewer.css | Styles for the vertical scroll container and pages; hides horizontal overflow |
| app/src/main/res/values/strings.xml | New string resources for "Vertical scroll" and "Keep screen on" |
| app/src/main/res/menu/pdf_viewer.xml | Menu entries for toggling vertical scroll and wake lock |
| app/src/main/res/drawable/ic_view_agenda_24dp.xml | Icon for vertical scroll toggle |
| app/src/main/res/drawable/ic_screen_lock_portrait_24dp.xml | Icon for keep screen on toggle |
| app/src/main/java/app/grapheneos/pdfviewer/PdfViewer.java | Manages wake lock, JS interfaces, menu handling, and state |
| app/src/main/AndroidManifest.xml | Declares WAKE_LOCK permission |
Comments suppressed due to low confidence (2)
app/src/main/res/menu/pdf_viewer.xml:50
- This toggle menu item should be checkable and reflect the current vertical scroll state. Add 'android:checkable="true"' in XML and call setChecked(isVerticalScrollMode) in onPrepareOptionsMenu.
app:showAsAction="ifRoom" />
viewer/js/index.js:168
- New behavior for vertical scroll rendering is added here. Consider adding unit or integration tests to cover renderAllPages, scroll listener setup, and page change notifications.
async function renderAllPages(zoom = false) {
| import android.view.MenuInflater; | ||
| import android.view.MenuItem; | ||
| import android.view.View; | ||
| import android.view.WindowManager; |
There was a problem hiding this comment.
The import 'android.view.WindowManager' is unused. Consider removing it to clean up imports.
Suggested change
| import android.view.WindowManager; |
| padding: 20px; | ||
| width: 100%; | ||
| min-height: 100vh; | ||
| `; |
There was a problem hiding this comment.
[nitpick] Consider moving these style rules into the CSS file under '#all-pages-container' to avoid duplication and simplify maintenance.
Author
|
copilot literally nobody asked for your opinion |
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.
No description provided.