Navigation
All routes and user flows in Scanly v1.0.22.
Navigation is implemented with Navigation Compose in ScanlyNavHost.kt. Route helpers follow the *Destination object pattern with routePattern and route() factory functions.
Navigation shell
| Form factor | Chrome |
|---|---|
| Phone | Scaffold + bottom NavigationBar |
| Tablet | Destination-owned NavigationRail (92 dp) with app logo on top-level screens |
- Start destination:
home - Tab switches: no transition animation
- Detail pushes: short fade with a small forward offset; back navigation reverses the motion
- Large-screen stability: the tablet rail is composed inside each top-level destination, so entering or leaving a detail route never resizes the
NavHostmid-transition - Top inset: each screen applies status-bar padding once (not doubled by the activity shell)
Top-level tabs
| Route | Screen | In bottom nav / rail |
|---|---|---|
home | Home dashboard | Yes |
library | Full library | Yes |
tools | Tools hub (Scan, PDF, Utilities) | Yes |
settings | Settings | Yes |
Legacy placeholder routes
These top-level routes still exist but show FeaturePlaceholderScreen — they are sprint-era stubs, not active flows:
| Route | Note |
|---|---|
camera | Use camera/session/{documentId} instead |
review | Review happens in document detail and page preview |
editor | Use editor/page/{pageId} instead |
Typed routes (active flows)
| Route pattern | Helper object | Screen |
|---|---|---|
document/{documentId} | DocumentDestination | Document detail |
library/search | LibrarySearchDestination | Search document/folder names and recognized page text; owns query, filters, and result state |
document/{documentId}/text?page={page}&query={query} | PageTextDestination | Extracted text in Text or On page view, with optional search context |
camera/session/{documentId}?replacePageId={pageId} | ScanSessionDestination | Scan session |
preview/page/{pageId} | PageImagePreviewDestination | Page preview |
editor/page/{pageId} | PageEditorDestination | Page editor (preview, filters/adjust overlays, retake, delete) |
crop/page/{pageId} | PageCropDestination | AI detect, rotate, four-point crop, reset, apply |
group/{groupId} | GroupDetailDestination | Group detail |
legal/{documentType} | LegalDocumentDestination | Privacy or terms viewer |
settings/appearance | SettingsAppearanceDestination | Theme + pure black |
settings/language | SettingsLanguageDestination | Select System default or one of 25 app languages and tap Apply to save and switch |
settings/pip | SettingsPipDestination | Pip master switch, tips, camera coaching, export cheers, animation |
settings/detection | SettingsDetectionDestination | Models, gate, benchmark link |
settings/widgets | SettingsWidgetsDestination | Pin home-screen widgets |
settings/about | SettingsAboutDestination | Version, updates, legal, support |
settings/faq | SettingsFaqDestination | FAQ sub-screen |
settings/licenses | SettingsLicensesDestination | Open-source licenses |
settings/storage | SettingsStorageDestination | Storage usage, export destination, cleanup, clear data |
settings/model-benchmark | SettingsModelBenchmarkDestination | Temporary local model comparison |
tools/qr | ToolsQrDestination | QR scan, typed result, create, and history (in-route screens) |
tools/text | ToolsImageTextDestination | Image to text: pick photos (imported as a new document, then replaced by its text screen) or a scan → document/{documentId}/text |
tools/pdf/reader?filePath={filePath}&fileName={fileName} | ToolsPdfReaderDestination | PDF reader; optional app-owned result file opens directly |
tools/pdf/merge?source={source} | ToolsPdfMergeDestination | PDF merge |
tools/pdf/split?source={source} | ToolsPdfSplitDestination | PDF split |
tools/pdf/compress?source={source} | ToolsPdfCompressDestination | PDF compress |
tools/pdf/password?source={source} | ToolsPdfPasswordDestination | PDF password protect/remove |
tools/pdf/watermark?source={source} | ToolsPdfWatermarkDestination | PDF text watermark |
tools/pdf/to-images?source={source} | ToolsPdfToImagesDestination | PDF to JPG/PNG images saved to Pictures/Scanly |
tools/pdf/sign?source={source} | ToolsPdfSignDestination | Sign a device or Scanly library PDF, then save or share the signed copy |
document/{documentId}/sign?page={page} | DocumentSignDestination | Place editable marks on Scanly pages in place |
document/{documentId}/split | DocumentSplitDestination | Split a document into new documents |
signatures/manage | SignatureManageDestination | Manage saved signatures and initials |
signatures/create?kind={kind} | SignatureCreateDestination | Draw or import a reusable signature or initials |
PDF tool source argument: optional; built by pdfToolRoute() in PdfToolSourceArgument.kt. It encodes a PdfToolSource (app file path, device uri, or lib document id, plus a display label) so a tool can start with a file already chosen — used by the reader's ⋮ menu. Plain routes without the argument still match and open the file picker.
Editor overlays (not NavHost routes): FilterPickerScreen and FilterCustomizeScreen share PageEditorViewModel and replace the editor content in place (same pattern as a full-screen mode, not a bottom sheet).
Back behavior
- When opened from Tools, Back from a PDF reader returns to the file picker; Back from that picker exits to Tools. A PDF preview opened from a PDF tool returns to that tool's result screen. Choose another opens a temporary picker, where Back returns to the current reader.
- A tool opened from the reader's ⋮ menu starts on its options step with the reader's file; Back returns to the reader.
- In PDF compression, Back from options returns to the file picker; Back from that picker exits to Tools. Change opens a temporary picker, where Back returns to options.
- In watermarking, Back from the editor returns to the picker; Change opens a temporary picker, where Back returns to the current editor.
- Android Back closes the editor's full-screen filter and adjustment modes before leaving the editor. It is blocked while a page is being captured, cropped/saved, filter-saved, or processed by a PDF tool.
Scan session arguments
documentId(required) — target documentreplacePageId(optional) — when set, capture replaces this page instead of adding a new one. On complete, navigates toeditor/page/{replacePageId}.
Settings sub-screen ViewModel sharing
Settings sub-screens that edit preferences (appearance, detection, widgets, about, faq, licenses, storage) share SettingsViewModel via the parent settings back stack entry. The model benchmark owns a separate ViewModel because its runs and results are temporary.
External launch actions (widgets & shortcuts)
MainActivity accepts explicit launch actions from widgets and launcher shortcuts (singleTop). LaunchActionViewModel queues the action until onboarding is complete, then redirects:
| Action | Intent action | Redirect |
|---|---|---|
| Scan | in.c1ph3rj.scanly.action.SCAN | Suggest title → create document → camera/session/{documentId} |
| Import | in.c1ph3rj.scanly.action.IMPORT | System photo picker → import pipeline → document/{documentId} |
| QR | in.c1ph3rj.scanly.action.QR | Tools tab → tools/qr?mode=scan |
| Library | in.c1ph3rj.scanly.action.LIBRARY | Top-level library |
Config: AndroidManifest.xml receivers + res/xml/shortcuts.xml; providers live under feature/widget/.
Open with Scanly (PDFs from other apps)
MainActivity also has ACTION_VIEW (content/file, application/pdf) and ACTION_SEND (application/pdf) intent filters labelled Open in Scanly. IncomingPdf.uriFrom() reads the URI from the cold-start or new intent; once onboarding is COMPLETE, IncomingPdf.copyToCache() copies it to cache/incoming_pdf/ (keeping the newest few) and the app navigates to tools/pdf/reader?filePath=…&fileName=…. If the copy fails, a "Couldn't open that PDF." toast is shown. The source file is never modified.
Files / Gmail / Drive / chat → "Open in Scanly"
└─► MainActivity (VIEW or SEND, application/pdf)
└─► (after onboarding) copy to cache/incoming_pdf/
└─► tools/pdf/reader?filePath=…&fileName=…
Widget / shortcut → scan
Widget or quick action (Scan)
└─► MainActivity (action.SCAN)
└─► (after onboarding) suggest title + create document
└─► camera/session/{newDocId}
User flow diagrams
App startup
Launch
└─► Onboarding required?
├─ Yes → OnboardingFlow (Welcome + language → Capture → Find → Share → optional camera sheet) → complete → Home
└─ No → Home
└─► (background) update check if cooldown expired
Create and scan
Home / Library
└─► Create + Scan (default name prefilled; clear or Suggest name)
└─► camera/session/{newDocId}
└─► capture page(s)
└─► document/{docId}
Edit a page
document/{docId}
└─► preview/page/{pageId}
├─► overflow: Share / Edit / Retake / Delete
└─► editor/page/{pageId}
├─► Filters → full-screen FilterPickerScreen (live preview + presets; Done → editor)
├─► Adjust → full-screen FilterCustomizeScreen (sliders + compare; Done → editor)
├─► crop/page/{pageId}
│ ├─► AI Detect / rotate / handles / Reset
│ └─► Done → reprocess crop+rotation → navigateUp → editor
├─► editor Done → reprocess filter + adjustments → back to preview/detail
└─► retake → camera/session/{docId}?replacePageId={pageId}
└─► editor/page/{pageId} (replacement complete)
Gallery import
Home (new doc) or document/{docId} (add pages)
└─► system image picker (≤50 images)
└─► import pipeline (same as capture finalize)
└─► document/{docId}
Group workflow
Library (Folders filter) or Home (recent groups)
└─► group/{groupId}
├─► document/{docId} (open member)
├─► rename / delete group
├─► add/remove documents
└─► export merged PDF or zipped PDFs
Export
document/{docId} or group/{groupId}
└─► export sheet (PDF options: password, page numbers, orientation, size, margins)
├─► Save → configured Downloads/SAF destination (unique filenames)
└─► Share → cache/exports → FileProvider share sheet
Search page text
Home or Library → library/search
└─► Search names or page text
├─► Page result → document/{documentId}/text?page={page}&query={query}
└─► Filter by Everywhere / Names / Text in pages or document type
Sign documents
Tools → Sign PDF → choose phone/library PDF → add marks across pages
└─► Review → Save to phone or Share (source PDF remains unchanged)
Document detail → Sign document → place marks on scan pages → save in place
└─► Marks remain editable and are included in previews and exports
Settings
settings
├─► Look & feel: theme mode + pure black (AMOLED) toggle
├─► settings/storage (usage, export destination, temporary-export cleanup, clear data)
├─► Document detection: automatic or manual live/post models
├─► Document detection: physical-document gate on/off
├─► settings/model-benchmark (gate + four corner models on local images)
├─► settings/faq
├─► legal/{PRIVACY} or legal/{TERMS}
├─► settings/licenses
└─► check for updates → AppUpdateDialog (channel-specific)
Onboarding gate
MainActivity uses AnimatedContent to switch between onboarding states:
| State | UI |
|---|---|
LOADING | Blank / loading |
REQUIRED | OnboardingFlow: WelcomeScreen (logo, summary, app language), then three-page OnboardingScreen, then optional camera-permission bottom sheet |
COMPLETE | ScanlyNavHost |
Automatic update checks run on ON_START only when onboarding is COMPLETE.
The welcome screen comes first on a fresh install. It shows the launcher logo, a one-line summary and the app language list (Phone language plus the 25 AppLanguage entries, searchable by native, current-language or English name). A pick calls AppLocales.setLanguage immediately, so the screen and the introduction re-render in that language. Below 600 dp it is one column with the list filling the remaining height; at 600 dp and wider, or in short landscape windows, the summary and the list sit side by side. Continue is always outside the scrolling list. Back from the first introduction page returns to it.
The onboarding pager retains its page across recreation and adapts to available bounds, including split screen. Below 600 dp, the approved mint, teal and peach document illustrations sit above localized headings and expanded descriptions. Portrait windows from 600–839 dp center that stack; wider or medium landscape windows use two panes. Main actions and page controls stay outside the scrollable content. Transparent WebP illustrations decode in the background, while native layers animate the capture scan line and search-word reveal. Illustration entrances and page transitions respect the existing motion preference and disabled system animations; off-screen scenes stop animating. Skip moves to Finish without completing onboarding. Scan my first page completes onboarding and queues scanning when camera access is granted; otherwise it opens a modal permission sheet. Enable camera launches the system request; granting it starts scanning, while Not now or denial completes to Home. Dismissing the sheet returns to Finish. Permanent denial offers Settings, and returning after granting starts scanning. Existing incoming PDF and shortcut destinations retain priority. The final introduction page has no import-photo button. The illustrative sample search term stays in English; all surrounding UI descriptions are localized in the 25 supported languages.
The capture beam scales with the artwork, follows the illustrated phone angle and casts a short light trail clipped to the page. The onboarding search example is decorative, with a search strip and matching highlighted word over the document illustration. The query is centred in the area after the magnifier, aligned to the bar angle, with font padding removed; both sample words scale with the illustration. It has no input, clipboard action or accessibility focus targets. Each pager page clips its artwork so layer motion stays within that page. Pagination uses 48 dp selectable targets with a small circular focus ring and press halo; focus remains attached while the pager settles.
Related docs
- screens.md — screen and ViewModel mapping
- ../overview/user-guide.md — user-facing walkthrough
- overview.md — architecture layers