Skip to content

Dual-Editor Split-Screen System - #63

Open
diekaiju wants to merge 2 commits into
shardulvs:masterfrom
diekaiju:master
Open

Dual-Editor Split-Screen System#63
diekaiju wants to merge 2 commits into
shardulvs:masterfrom
diekaiju:master

Conversation

@diekaiju

Copy link
Copy Markdown

Feature: Dual-Editor Split-Screen Support

Description

This pull request implements a fully functional split-screen feature allowing users to open, view, and edit two notes/PDFs side-by-side.

Rather than rendering a static, read-only PDF viewer in the split pane, this implementation runs two isolated and fully featured instances of the standard note editor (editorLeft and editorRight). When the split screen is enabled, the secondary pane displays the in-app explorer list, allowing the user to select and edit any existing note.

Key Technical Details

  1. File System and Session Isolation: Parameterized the Editor class constructor to accept an instanceName (e.g. "left" / "right"). This isolates all active session stores and temporary directories (pdfsrc, noteimg, savetmp, session) on disk, preventing thread/file collisions.
  2. Concurrent Session Restore & Persistence: Modified MainActivity to concurrently initialize, restore, and persist both editor sessions throughout the activity lifecycle (onCreate, onPause, onDestroy).
  3. Dynamic Focus Routing: Implemented pointer-input wrappers to track which pane is currently focused, routing hardware keys, stylus actions, and fullscreen preferences accordingly.
  4. Symmetrical Layout Layout: Integrated standard Compose Row splits with a vertical hairline divider, rendering self-contained toolbars and format bars within each pane.

Changed Files & Line Analysis

1. app/src/main/java/com/xnotes/ui/Editor.kt

  • Lines 120-151: Parameterized the Editor class constructor with instanceName and updated directories (pdfDir, imageDir, saveTmpDir) to append _$instanceName.
  • Line 191: Isolated the SessionStore directory path using instanceName.
  • Lines 393-395: Declared Compose states tracking split screen visibility.
  • Lines 3698-3704: Added toggleSplitScreen and closeSplitScreen lifecycle controls.

2. app/src/main/java/com/xnotes/MainActivity.kt

  • Lines 15-18: Added imports for Compose gesture detectors (detectTapGestures, pointerInput).
  • Lines 98-100: Declared class-level instances for editorLeft and editorRight.
  • Lines 109-138: Updated onCreate's setContent to instantiate both editors, load sessions concurrently, and bind listeners to the active editor.
  • Lines 185-196: Modified onPause and onDestroy lifecycles to persist and release resources for both editor instances.
  • Lines 211-218: Updated EditorScreen Composable parameters to accept left, right, and active editor states.
  • Lines 535-570: Registered split back-handlers and independent snackbar message observers.
  • Lines 593-690: Reworked the Scaffold body to split the screen into left/right columns when active, rendering backstage file selectors or editor layers independently.

3. app/src/main/java/com/xnotes/ui/Popups.kt

  • Lines 366-371: Added the "SPLIT SCREEN" toggle row to the View Configuration dropdown menu.

@diekaiju

Copy link
Copy Markdown
Author

@diekaiju

Copy link
Copy Markdown
Author

@shardulvs
At least implement the idea.

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