Open-source Android PDF and document toolkit with PDF tools, Office viewing, XLSX editing, scanning, and image editing. Built with Kotlin and Jetpack Compose.
Rust androiddocument-scannerdocximage-editorjetpack-composekotlinliquid-glassofflineopen-sourcepdfpdf-compressorpdf-editorpdf-mergerpdf-readerpdf-splitterpdf-toolspdf-viewerpptxspreadsheet-editorxlsx
Search in sheets, edit pictures from the Images shelf; plan and handoff updated
chethan616833d6d376e85
diff --git a/HANDOFF.md b/HANDOFF.mdindex e581e1c..15bae06 100644--- a/HANDOFF.md+++ b/HANDOFF.md@@ -217,6 +217,23 @@ The card is a `Squircle` (new in `ui/glass/Shapes.kt`: kyant's continuous cornercontent clipped inside its own moving layer) with a radius concentric with the screen's corners(`RoundedCorner` bottom-left radius minus the 10 dp inset, 24..48 dp; 34 dp without it).+## 2026-11-07 pass (built and installed; not driven on the phone: owner was using it)++- Office bars: `QuickTool.barFor(doc, arranged)` (Word / slides lists), `QuickToolbar(onMoreTools =+ null)` hides More tools; `ViewerSheet.SaveAs` → `SaveAsSheet` (formats from `exportFormats`);+ `vm.exportOffice(doc, format)` delivers to Downloads; `vm.print` prints office docs via their PDF.+- Present: `ui/viewer/PresentMode.kt`, `vm.presenting`, hosted in ClearApp's tool-screen box.+- Sheet search: in `SheetViewer` (search circle in the top row).+- Files ▸ ⋯: `DocumentTypes.Kind` filter; `.txt`/`.md` open (Word engine: `office::sniff` by name).+- Thought of the day: the card shows the day's quote; past thoughts never written on are deleted at+ start (AppViewModel init).+- Quick Preview → app: `vm.open(copy = …, fromPreview = true)` reuses the preview's copy;+ `vm.expandingPreview` paints the viewer ground over a desk that isn't drawn until the reveal covers;+ window animation is an 180 ms fade (`res/anim/preview_open_*`).+- Licences page rewritten (groups, roles, tap for licence text, arrow for source); About has one+ "Built with open source" row.+- Images shelf: a picture card opens the LightCraft editor; long press ▸ Edit picture.+## Desk flicker (2026-11-06, fix built, not yet seen on the phone)The owner saw the desk's cards "appear again for a second" after tapping a card. Cause found indiff --git a/PLAN.md b/PLAN.mdindex be8b856..9c27fe7 100644--- a/PLAN.md+++ b/PLAN.md@@ -145,8 +145,16 @@ all three → editing, one format at a time, each built and run on the phone befdevelop, pipeline only: no GPU, faces or catalog). Tap a note's picture: glass editor withExposure, Contrast, Highlights, Shadows, Vibrance, Saturation and rotate; Done saves a new JPEG.[ ] seen on the phone; [ ] crop; [ ] markup.-- [ ] Export to PDF for all three (wordcraft-pdf / deckcraft-pdf through craft-pdf + krilla, already- patched in; gridcraft's own writer: check non-Latin text).+- [x] **Export and print for all three** (2026-11-07): `export_office(doc, format, path)` /+ `export_formats(doc)`: Word → pdf, docx, odt, rtf, html, md, txt; slides → pdf, pptx; sheets →+ pdf (gridcraft's `file.exportPdf`, every sheet), xlsx, csv. Office bars: Word = Read aloud ·+ Export PDF · Save as · Print; slides add **Present** (full screen, swipe/tap, bars hidden);+ sheets: **search** (glass field, hits ringed, ↑↓). No PDF More tools for office documents.+ [ ] check gridcraft's PDF with non-Latin text.+- [ ] Map each engine's remaining features into the UI, one format at a time (they are large: Word+ 422 commands, slides 320, sheets 313, LightCraft's develop panel): next are Word's navigation+ pane (headings), slide notes and thumbnails, sheet charts and pictures, LightCraft crop,+ presets and auto, then editing (typing, formatting) per format.- [ ] Editing, one format at a time (wordcraft's 422 commands through `Session::run`, then deckcraft'sand gridcraft's registries).diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/home/HomeScreen.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/home/HomeScreen.ktindex 47c81eb..6604f8c 100644--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/home/HomeScreen.kt+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/home/HomeScreen.kt@@ -239,9 +239,11 @@ fun HomeScreen(vm: AppViewModel, desk: DeskState) {}is DeskItem.Picture -> {val n = item.note+ // on the Images shelf a picture opens in the editor; elsewhere its note opens+ val open = if (filter == DeskFilter.Images) ({ vm.editingPhoto = n.id to n.images.first() }) else ({ vm.openNote = n.id })StackCard(n.title.ifBlank { stringResource(R.string.desk_filter_images) }, shortDate(n.updated),- listOf(clear.tone(Tone.Blush), clear.tone(Tone.Peach)), { vm.openNote = n.id }, m, onLong = { actionsFor = n },+ listOf(clear.tone(Tone.Blush), clear.tone(Tone.Peach)), open, m, onLong = { actionsFor = n },chips = {if (n.images.size > 1) PhotoChip("+${n.images.size - 1}", { vm.openNote = n.id }, Modifier.align(Alignment.BottomEnd).padding(12.dp))},@@ -447,6 +449,7 @@ private fun NoteActions(vm: AppViewModel, n: Note, onRename: () -> Unit, onDismiif (voice) GlassRow(stringResource(R.string.notes_rename), { onDismiss(); onRename() }, icon = LucideIcons.PenLine, accent = Candy.Grape)GlassRow(stringResource(if (n.pinned) R.string.notes_unpin else R.string.notes_pin), { vm.notes.put(n.copy(pinned = !n.pinned)); onDismiss() }, icon = LucideIcons.Pin, accent = Candy.Tangerine)if (!voice) GlassRow(stringResource(R.string.notes_open), { vm.openNote = n.id; onDismiss() }, icon = LucideIcons.SquarePen, accent = Candy.Sky)+ n.images.firstOrNull()?.let { pic -> GlassRow(stringResource(R.string.photo_edit), { onDismiss(); vm.editingPhoto = n.id to pic }, icon = LucideIcons.SlidersHorizontal, accent = Candy.Bubblegum) }val feel = com.chethan616.clearpdf.ui.glass.rememberFeel()GlassRow(stringResource(R.string.common_delete), { feel(com.chethan616.clearpdf.ui.glass.Feel.Reject); vm.notes.delete(n.id); onDismiss() }, icon = LucideIcons.Trash2, destructive = true)}diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/sheets/SheetViewer.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/sheets/SheetViewer.ktindex c6b68ff..d490424 100644--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/sheets/SheetViewer.kt+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/sheets/SheetViewer.kt@@ -71,6 +71,7 @@ import com.chethan616.clearpdf.ui.theme.clearimport com.kyant.backdrop.backdrops.layerBackdropimport com.kyant.backdrop.backdrops.rememberLayerBackdropimport kotlinx.coroutines.flow.distinctUntilChanged+import kotlinx.coroutines.launchimport kotlin.math.maximport kotlin.math.min@@ -132,6 +133,12 @@ fun SheetViewer(vm: AppViewModel, doc: OpenDocument) {val blocks = remember { mutableStateMapOf<Triple<Int, Int, Int>, List<CellView>>() }var scale by remember { mutableStateOf(1f) }var pan by remember { mutableStateOf(Offset.Zero) }+ // search: the cells showing the query, and the one shown+ var searching by remember { mutableStateOf(false) }+ var query by remember { mutableStateOf("") }+ var hits by remember { mutableStateOf<List<CellSpan>>(emptyList()) }+ var hit by remember { mutableIntStateOf(0) }+ val scope = androidx.compose.runtime.rememberCoroutineScope()val density = LocalDensity.current// the grid starts under the top row of glass (it runs on beneath it, for the glass to refract)val topPx = with(density) { WindowInsets.statusBars.getTop(this) + 64.dp.toPx() }@@ -144,6 +151,7 @@ fun SheetViewer(vm: AppViewModel, doc: OpenDocument) {val info = sheets.getOrNull(current) ?: return@LaunchedEffectlayout = nullpan = Offset.Zero+ hits = emptyList()val rows = min(info.rows.toInt() + SPARE_ROWS, 20_000)val cols = min(info.cols.toInt() + SPARE_COLS, 2_000)val l = runCatching {@@ -188,6 +196,18 @@ fun SheetViewer(vm: AppViewModel, doc: OpenDocument) {}}}+ // a hit brought into view: its cell near the top left, under the heading strips+ LaunchedEffect(hit, hits) {+ val h = hits.getOrNull(hit) ?: return@LaunchedEffect+ val k = px * scale+ val r = h.row0.toInt().coerceIn(0, l.rows - 1)+ val col = h.col0.toInt().coerceIn(0, l.cols - 1)+ val fr = l.info.frozenRows.toInt()+ val fc = l.info.frozenCols.toInt()+ val x = if (col < fc) pan.x else -(l.colX[col] - l.colX[minOf(fc, l.cols)]) * k + 24 * px+ val y = if (r < fr) pan.y else -(l.rowY[r] - l.rowY[minOf(fr, l.rows)]) * k + 24 * px+ pan = Offset(x.coerceAtMost(0f), y.coerceAtMost(0f))+ }Canvas(Modifier.fillMaxSize()@@ -207,7 +227,7 @@ fun SheetViewer(vm: AppViewModel, doc: OpenDocument) {.pointerInput(Unit) { detectTapGestures(onDoubleTap = { scale = if (scale > 1.2f) 1f else 2f; pan = Offset.Zero }) },) {drawRect(Color.White)- translate(top = topPx) { drawSheet(l, blocks, sheetIndex, px * scale, pan, measurer, c.ink) }+ translate(top = topPx) { drawSheet(l, blocks, sheetIndex, px * scale, pan, measurer, c.ink, hits.getOrNull(hit)) }}}}@@ -223,8 +243,29 @@ fun SheetViewer(vm: AppViewModel, doc: OpenDocument) {sheets.getOrNull(current)?.let { Text(it.name, style = ClearType.Caption, color = c.inkSoft, maxLines = 1) }}Spacer(Modifier.size(10.dp))+ GlassCircle(onClick = { searching = !searching; if (!searching) hits = emptyList() }, label = stringResource(R.string.viewer_find_in_document)) { GlassIcon(LucideIcons.Search, null, Modifier.size(20.dp)) }+ Spacer(Modifier.size(10.dp))GlassCircle(onClick = { vm.share(doc) }, label = stringResource(R.string.common_share)) { GlassIcon(LucideIcons.Share2, null, Modifier.size(20.dp)) }}+ // the search row: the query, how many cells show it, and the way through them+ if (searching) Row(Modifier.fillMaxWidth().padding(horizontal = 12.dp), verticalAlignment = Alignment.CenterVertically) {+ Row(Modifier.weight(1f).glassBar().padding(horizontal = 16.dp, vertical = 4.dp), verticalAlignment = Alignment.CenterVertically) {+ com.chethan616.clearpdf.ui.glass.GlassTextField(query, { query = it }, stringResource(R.string.viewer_find_in_document), Modifier.weight(1f), keyboardActions = androidx.compose.foundation.text.KeyboardActions(onDone = {+ val q = query.trim()+ scope.launch {+ hits = if (q.isEmpty()) emptyList() else runCatching { eng.command { sheetFind(doc.id, current.toUInt(), q, false, 1000u) } }.getOrDefault(emptyList())+ hit = 0+ }+ }), keyboardOptions = androidx.compose.foundation.text.KeyboardOptions(imeAction = androidx.compose.ui.text.input.ImeAction.Done))+ if (hits.isNotEmpty()) Text("${hit + 1}/${hits.size}", style = ClearType.Caption, color = c.inkSoft)+ }+ if (hits.size > 1) {+ Spacer(Modifier.size(8.dp))+ GlassCircle(onClick = { hit = (hit - 1 + hits.size) % hits.size }, size = 40.dp, label = stringResource(R.string.viewer_find_previous)) { GlassIcon(LucideIcons.ChevronUp, null, Modifier.size(18.dp)) }+ Spacer(Modifier.size(6.dp))+ GlassCircle(onClick = { hit = (hit + 1) % hits.size }, size = 40.dp, label = stringResource(R.string.viewer_find_next)) { GlassIcon(LucideIcons.ChevronDown, null, Modifier.size(18.dp)) }+ }+ }}// the sheet tabsval visible = sheets.withIndex().filter { !it.value.hidden }@@ -260,6 +301,7 @@ private fun DrawScope.drawSheet(pan: Offset,measurer: TextMeasurer,ink: Color,+ found: CellSpan?,) {val head = Offset(HEAD_W * k.coerceAtMost(density * 1.5f), HEAD_H * k.coerceAtMost(density * 1.5f))val fr = min(l.info.frozenRows.toInt(), l.rows)@@ -310,6 +352,16 @@ private fun DrawScope.drawSheet(edge(v.right, r.topRight, r.bottomRight)edge(v.bottom, r.bottomLeft, r.bottomRight)}+ // the search hit in this region: an accent ring round its cell+ found?.let { f ->+ val r = f.row0.toInt()+ val col = f.col0.toInt()+ if (r in r0 until r1 && col in c0 until c1) {+ val box = cell(r, col)+ drawRect(Color(0x330A84FF), box.topLeft, box.size)+ drawRect(Color(0xFF0A84FF), box.topLeft, box.size, style = androidx.compose.ui.graphics.drawscope.Stroke(width = 2.5f * density))+ }+ }for (v in shown) {if (v.text.isEmpty()) continueval r = spanOf(v)