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
Liquid glass everywhere, smooth overlays, and a motion lab in Settings
Chethan6168d61ffd0a6b6
diff --git a/HANDOFF.md b/HANDOFF.mdindex 3997c65..5925c56 100644--- a/HANDOFF.md+++ b/HANDOFF.md@@ -17,6 +17,42 @@ Read this first after a `/clear`. The roadmap is `PLAN.md`.Quick Preview test: open Settings, then`adb shell am start -a android.intent.action.VIEW -t application/pdf -d content://media/external/file/1000144849 --grant-read-uri-permission -n com.chethan616.clearpdf.debug/com.chethan616.clearpdf.preview.QuickPreviewActivity`+- **Judge smoothness on the `fast` build, never debug**: `./gradlew installFast -Partefact.abis=arm64-v8a`+ (same `.debug` id and data, debug key, R8, not debuggable, Compose's baseline profiles). Then+ `adb shell cmd package compile -f -m speed-profile com.chethan616.clearpdf.debug` to compile the+ profile at once. A debuggable build runs Compose several times slower.++## Motion rules (2026-11-06)++- **Glass things spring, screens glide** (sheets on their own fixed spring, see Gotchas). Glass controls AND glass popovers (menus, dialogs, toasts, hint toasts, the recorder pill) use+ `GlassMotion` springs (`ui/glass/Motion.kt`:+ `morph`, `pop`, `unfold`/`unfoldLag`, `fold`, `rise`), tuned by Settings ▸ Button motion+ (`MotionSettings.damping/stiffness`). Screen-to-screen transitions use `Fluid`: tweens on UIKit's+ curve `(0.32, 0.72, 0, 1)`, never past the target, ignoring the motion setting. Screens push+ 420 ms / pop 360 ms (`RouteHost` in `ClearApp.kt`); do not change these, the user likes them.+- **Overshoot rule**: a spring may overshoot only draw-time values (scale, translation, rotation) or+ layout values clamped positive (`coerceAtLeast`); alpha is always clamped to 0..1. A spring past 1+ once crashed Quick Preview with negative padding.+- **Every glass part follows Settings ▸ Liquid glass** (`GlassSettings.style` through `glassEffects`)+ and Button motion. New glass uses `glass`/`glassControl`/`GlassChip`, never a hand-rolled `drawBackdrop`.+- A glass thing can't refract its own layer: put the glass in a sibling layer (`GlassCard`, `GlassHost`+ in `ui/glass/Surfaces.kt`) so chips on a card refract the wallpaper behind the card.+- Flat `pressable` sinks to 0.97 on critically damped springs (no jelly).+- Overlays animate out: `GlassOverlay(animatesOut = true)` keeps an entry in the portal after its+ caller leaves; read `rememberOverlayAppear()` (or `LocalOverlayPresence`) and call `done()`.+- Read moving values in draw/layout, never composition (pager offsets, player position, morphs). That+ includes fades: an `animateFloatAsState` read in composition recomposed the whole dock every frame,+ rebuilding every fan chip's `drawBackdrop` (that was the + lag on a busy desk). Use an `Animatable`+ read in `graphicsLayer {}`, plus `derivedStateOf` for "is it shown" flags.+- **Performance rules for busy screens** (welcome, fan): give anything that animates forever (mascots,+ dots) its own `graphicsLayer {}` so its redraws stop at that layer; pause what is off-screen; use+ `CompositingStrategy.ModulateAlpha` on fading content (the default goes offscreen below alpha 1, a+ full-screen texture for a scrim); cache costly still content (22 px glow text shadows, glass pills)+ with `Offscreen` only while it is still or just moving, never when it rotates (soft sampling);+ compose items of a group one by one when each carries live glass (`FanChip`).+- The dock capsule (+ and mic ⇄ recorder) uses `GlassMotion.shape()` / `shapeBack()` (stiffness 105 / 125,+ slow on purpose so the swell and rebound are seen); the other glass springs stay brisk.+## Code map (new UI)| What | Where |@@ -24,14 +60,19 @@ Read this first after a `/clear`. The roadmap is `PLAN.md`.| Tokens, type, tones | `ui/theme/ClearTheme.kt` || Wallpaper, glass stack, overlay portal | `ui/glass/Backdrops.kt` || Glass controls, sheets, menus, loader | `ui/glass/*` (`Loader.kt` = M3 Expressive in glass) |+| Glass chips (filter chips, card chips, check pills, lemon chip) | `GlassChip` in `ui/glass/Buttons.kt` (wraps `glassControl`, same glass as Back/More) |+| Dark theme ("Midnight Aurora", jewel card tones) | `DarkClear` / `DarkTones` in `ui/theme/ClearTheme.kt`; viewer surfaces in `ui/Theme.kt` || Routing (welcome / desk / files / tools / settings / note / viewer) | `ui/ClearApp.kt` || Desk | `ui/home/HomeScreen.kt`, cards `ui/home/Cards.kt`, + and mic `ui/home/CreateDock.kt` || Notes store | `notes/Notes.kt` (JSON in `files/notes`, media in `files/notes/media`) || Note editor | `ui/notes/NoteEditor.kt` |+| Thought of the day | `notes/Thoughts.kt` (`thoughtFor`), `DeskItem.Thought` + `ThoughtCard`, `AppViewModel.openThought/closeNote` || Welcome | `ui/onboarding/Onboarding.kt` || Mascots | `ui/mascot/*` (copied from rewordium; never edit rewordium itself) || Quick Preview | `preview/QuickPreviewActivity.kt` + `preview/QuickPreview.kt` |-| Viewer | `ui/viewer/*` (still mostly the V2 base look) |+| Viewer | `ui/viewer/*`; its glass refracts the pages (`pagesBackdrop` in `ViewerScreen.kt`) |+| Viewer sheets (iOS style) | `PdfSheet`, `SheetHeader`, `SheetSection`, `SheetRow`, `SheetCircleButton` in `ui/Components.kt` |+| Header glass buttons | `HeaderGlassButton`; buttons inside a glass bar are `BarGlyphButton` (no glass on glass) |## Gotchas@@ -42,6 +83,70 @@ Read this first after a `/clear`. The roadmap is `PLAN.md`.- Quick Preview copies the file into the viewer's working-copy folder first, so Expand still opensafter the caller's temporary grant ends.+- Welcome pager: pages are NOT translated at the page level (that put neighbours' cards in view at+ rest); only each card sways, shaped to zero at rest. The Skip button (a `GlassChip`) fades before the+ last page. Continue is a `GlassPill(tintAt = ...)`: the candy colour follows the pager, read in draw.+ `Mascot(paused = true)` freezes a mascot that is off-screen (its infinite animations stop redrawing).+- Recorder pill (`CreateDock.kt`): expand overshoots in layout (clamped), shrink squeezes/stretches in+ draw. Judge it on the `fast` build; the capsule blur re-runs per overshoot frame.+- Performance rules for glass (pass 4): shaders are shared process-wide (`RuntimeShaderCache.kt`; the+ Crystal lens used to compile per node), warmed one per idle moment from `MainActivity`+ (`GlassShaderWarmup`); the press glow in `Press.kt` is shared too. The dispersion shader takes 1 / 3 / 7+ taps by how much the rim bends. `HighlightNode` re-records only when its own inputs change.+ `Modifier.throttleBackdrops { moving }` (`backdrop/BackdropThrottle.kt`) makes glass UNDER it refresh its+ sampled position at most every 100 ms while `moving()` (trailing write on settle): used by the welcome+ cards (`flyIn`, with `cache = true` on page-2 cards) and by `GlassSheet`'s content. Never put it on+ something the eye tracks closely (a fan chip would look like a sticker).+- Jelly: `GlassMotion.shape()` has a damping floor (0.46); the dock's layout overshoot is soft-capped+ (tanh) to the room left on the screen and its squash is bounded: before, a swing wider than the screen+ was clamped by the constraints and the pill froze at the extremes.+- **Bounce tweens were tried and removed** (2026-11-06): the user found them slow. Everything glass is on+ springs again. Sheets use the old ClearPDF sheet's fixed spring (0.82 / 380, never profile-scaled: at+ Jelly a scaled one shivered) with drag-down-to-dismiss; menus/dialogs/toasts/fan/+/mic use `GlassMotion`.+- **Why overlays were slow, and the fix** (measured, Crystal + Jelly, 60 Hz): with the sheet's glass removed+ entirely the long-press sheet still cost ~28 ms GPU a frame. The cost was the *scene under it*: every frame+ of anything moving redrew every glass control on the desk. Two fixes, both in the backdrop/glass layer:+ 1. `GlassStage` keeps wall+screens (and chrome) as one offscreen texture while an overlay is up or chrome+ holds `GlassOverlayHost.stillHolds` (the + fan, the recorder). Sheet frames fell to ~3.5 ms GPU.+ 2. `Modifier.floatingLayer` (backdrop module) records content once into an offscreen layer and animates+ only its transform/alpha/clip (an `ObserverModifierNode`; no re-record, no re-blur). Used by sheets,+ dialogs, menus, toasts, fan chips, the viewer bars and the pop menu. Don't fade content *inside* a+ floating layer with its own graphicsLayer: that dirties the texture and re-blurs every frame.+- **Desk menu is a glass pop** (`GlassMorphMenu`, `ui/glass/MorphMenu.kt`): the four-dot button becomes the+ menu, iOS 26 style (clip opens from the button circle, spring overshoot becomes a swell about the button).+ ~5 ms GPU a frame. The real button hides from tap until `onGone`.+- Settings ▸ Liquid glass & motion (`desk/GlassMotionSettings.kt`): live glass stage, glass presets + every+ `GlassStyle` value, motion presets + spring graph (step response of the `morph` spring at the current+ setting) + the six `MotionStyle` values, a cubic-bezier editor for `MotionSettings.curve` (drives+ `Fluid.Ease`, persisted as `motion_curve`) with presets, `MotionSettings.duration` scaling every `Fluid`+ tween. New strings are English-only so far (other locales fall back). Settings root: small-caps section+ labels, one row opens this page, credits as a footnote. Morph menu is layout-driven like the old app's+ ShareMorphButton (user rejected the clip-reveal pop).+- 2026-11-06 late pass (built, NOT seen on the phone: adb went unauthorized): Back beat 300 ms everywhere+ via `rememberBeat` (ScreenHeader, viewer Back, tool screens); morph menu fades in place when an item is+ chosen (no glyph over the next screen); viewer search field grows from the title pill (`GlassMotion.morph`);+ viewer dock = icon-only ink glyphs on theme glass (`glassBar` default = `clear.glass`, follows the glass+ style, shows the page), More = plain glass circle; dock⇄note toolbar morphs both ways, handing over at 96 %+ (max 600 ms); tool screens (`ToolScaffold`/`ToolPage`) stand on the Aurora in a `GlassHost` with glass+ Back, candy `GlassPill` action, `washPanel()` file cards, glass chips for the scan actions.+- Desk → note: the dock's capsule grows into the note toolbar's size (`CreateDock(intoNote)`, measured via+ `vm.noteBarSize`) on `GlassMotion.morph()`, then hands over (`vm.noteBarHidden`). ClearApp keeps the dock+ composed for it. Sheets enter on 0.74 / 380 (~3 % rise past rest).+- Viewer: no bands. Pages start at y 0 (`setPadding(top = 0f)`), status band and nav band are transparent,+ bars are `Modifier.glassBar()` (frosted, press-reactive by Settings ▸ Motion) and `GlassBars` springs them+ in/out as textures. Things that must sit below the top row use `statusPx + topPx`, not `padTop`.+- Glass circles/pills no longer bloom on a long hold unless they have a long-press job (as the chips).+ ScreenHeader's Back waits 150 ms so its press plays before the screen goes. The logo no longer spins.+- `app/src/main/baseline-prof.txt` AOT-compiles all app + backdrop code: a sideloaded release had been running+ JIT-only while the fast build was force-compiled with `cmd package compile`, so "fast beat release".+- Desk shelf titles use six faces (`ClearType.DeskAll/Notes/Todo/Pdfs/Images/Audio`): "Your Artefacts" is a+ clean bold Bricolage Grotesque (the wonky Fraunces looked bad there); Notes is Fraunces upright (`wonk` 0).+ Both variable fonts are OFL, credited in Settings and `assets/licences`.+- 2026-11-06 passes 1 to 4 (Quick Preview, thought of the day, glass chips, springs, dark theme,+ welcome/fan performance, slower dock, Crystal/Jelly/sheet fixes) build but were not seen on the phone (not+ attached): check them first when it is. Fast APK: `android/app/build/outputs/apk/fast/app-fast.apk`.+ If gradle complains a backdrop class is "outside the root directory", run `./gradlew :backdrop:clean`.+## Next upSee PLAN.md "Next". Immediate: viewer chrome polish, release APK, GitHub master branch + issue + discussion.diff --git a/PLAN.md b/PLAN.mdindex 41d07b0..cb53662 100644--- a/PLAN.md+++ b/PLAN.md@@ -22,12 +22,13 @@ This file is the roadmap. `HANDOFF.md` is the short "where we are right now" for| Token | Light | Dark ||---|---|---|-| Wallpaper | sky gradient `#9AB4DC → #B3C5E8 → #A8BEE3` + blooms (aqua, lilac, pink, periwinkle) | `#0E1A20 → #13262C` + teal / slate / plum blooms |+| Wallpaper | sky gradient `#9AB4DC → #B3C5E8 → #A8BEE3` + blooms (aqua, lilac, pink, periwinkle) | "Midnight Aurora": indigo `#0A0B1E → #14123A → #0B1030` + cobalt, violet, magenta, periwinkle blooms || Hero titles | white + soft glow | white |-| Ink | `#172033` | `#F1F5F9` |+| Ink | `#172033` | `#EEF1FF` |+| Viewer surfaces | `#F5F7FB` / `#E9EDF4` | indigo `#12132B` / `#1C1D3E` / pressed `#2A2B52` || Chip (chosen) | lemon `#EEF27E` | same || Accents (`Candy`) | Apple system hues: red `#FF5B4F`, orange, yellow, green, mint, blue `#0A84FF`, indigo, pink | same |-| Card tones (`Tone`) | Sage (lists), Paper (notes), Lavender (voice), Butter (Files), Orchid (Pdf), Blush, Sky, Peach | same hues, 22 % deeper |+| Card tones (`Tone`) | Sage (lists), Paper (notes), Lavender (voice), Butter (Files), Orchid (Pdf), Blush, Sky, Peach | same hues as jewels: saturated, deep, pale ink on them (`DarkTones`) |Type: Plus Jakarta Sans (all UI), Doto (list titles, dot-matrix), DM Serif Display (collectionwords). All OFL, in `res/font`, licences in `assets/licences`.@@ -50,10 +51,44 @@ bot-avatars) for empty, waiting and error states only.- [x] Welcome (onboarding), 4 pages, shown once, "Show the welcome again" in Settings.- [x] Quick Preview (floating card over the calling app) with Expand / Share / More / Close.- [x] M3 Expressive loader in a glass circle replaces every spinner.+- [x] Motion and speed pass (2026-11-06): Apple-curve screen/sheet motion (`Fluid`), bounce only on+ glass controls, overlays animate out, onboarding/dock/voice card read motion in draw only,+ wallpaper bitmap reused, mic opened off the main thread, Recent rows memoised, `fast` build.+- [x] Material 3 Expressive haptics (`ui/glass/Haptics.kt`: vibrator primitives, `Feel`s) on+ buttons, rows, chips, toggles, tabs, the dock, recording, mascots, sheet pull thresholds.+- [x] Voice card to the mock; voice memos can be named (toast "Name it" after saving, long press ▸ Rename).+- [x] Viewer: glass refracts the pages; iOS-style top bar (grouped buttons), sheets and alerts.+- [x] Tool screens (Compress, Combine, …, signature pad) now open over the viewer (were under it).+- [x] Quick Preview made minimal (header, pages, one Open pill; the rest in More), More menu glass+ fixed (refracts the pages), Open goes straight into the app (no full-screen stage).+- [x] Thought of the day: a Paper card second on the desk (All, Notes), opens a flagged note+ (`Note.thought` = epoch day) with the day's quote as title and a reflection as body, "Tap here+ to continue…" under it; kept only once written on. 30 quotes + reflections in 9 languages+ (`thought_quotes`, `thought_reflections`).+- [x] Glass and motion pass 2 (2026-11-06): welcome no longer shows neighbour pages at rest; menus,+ dialogs, sheets, toasts, hint toasts, the + fan and the recorder pill move on `GlassMotion`+ springs (screen transitions untouched); filter chips, card chips and check pills are+ `GlassChip`s (same glass as Back/More) and the dock capsule is `glass`; every glass part follows+ `GlassSettings.style` and `MotionSettings`; dark theme rebuilt as "Midnight Aurora" with jewel cards.+- [x] Perf and polish pass 3 (2026-11-06): welcome made light (own layers for dots and mascots, mascots+ paused off-screen, glow titles and costly cards cached while still, no offscreen alpha passes),+ Continue is a candy `GlassPill` that takes each page's colour (`tintAt`), Skip is a `GlassChip`;+ the + fan no longer recomposes per frame (scrim in draw, chips composed one by one); the dock+ capsule swells and shrinks on slower springs (`GlassMotion.shape`/`shapeBack`) so the bounce shows.+- [x] Lag pass 4 (2026-11-06): Crystal mode made cheap (shared + pre-warmed shaders, adaptive-tap+ dispersion, highlight skips re-recording), welcome cards throttle the glass under them, Jelly dock no+ longer freezes at its extremes (damping floor, capped layout overshoot), recorder X in dark ink,+ sheets rise/leave on better curves with staggered content, six distinct desk-title fonts.+- [x] Bounce pass (2026-11-06): the + fan and sheets rise on a fixed-time bounce tween (`GlassMotion.bounce`)+ instead of springs, so the glass goes quiet on a known frame; "Your Artefacts" in a clean bold grotesque.## Next (UI first)-- [ ] Viewer chrome to the new look (floating glass top bar, dock), check every tool sheet.+- [ ] Viewer: check every tool sheet against the new sheet parts (VoiceSheet, NoteSheet, ReadAloud,+ DigitalSign, FillSign still use their own layouts inside `PdfSheet`); CommentList, Pages screens.+- [ ] Device check of the four 2026-11-06 passes on the `fast` build (pass 4: Crystal + / welcome page 2 / Jelly mic / long-press sheet) (no phone was attached): welcome swipe+ smoothness, + fan with a busy desk, menu/dialog/sheet/toast springs, recorder pill expand/shrink+ bounce (tune `GlassMotion.shape` stiffness if still too quick/slow), GlassChip rows, dark theme.- [ ] Files / Tools / Settings polish against the mocks; Collection deck (mock 2) for Pdf & notes.- [ ] Signature validation badges drawn by the viewer (Acrobat-style tick), never in the file.- [x] Translations: ar, de, es, fr, it, pt-BR complete + **pt** and **ru**.diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.ktsindex ea0adac..8d3b799 100644--- a/android/app/build.gradle.kts+++ b/android/app/build.gradle.kts@@ -277,6 +277,16 @@ android {// reproducible builds: no record of the checkout in the APKvcsInfo { include = false }}+ // The debug app (same id, same data, debug key) built as a release is: no debugger, R8, and+ // Compose's baseline profiles. A debuggable build runs Compose several times slower, so+ // judge smoothness on this one: `./gradlew installFast -Partefact.abis=arm64-v8a`.+ create("fast") {+ initWith(getByName("release"))+ applicationIdSuffix = ".debug"+ signingConfig = signingConfigs.getByName("debug")+ matchingFallbacks += listOf("release")+ isDebuggable = false+ }}// reproducible builds: no dependency metadata signing block (F-Droid's check rejects it)dependenciesInfo {@@ -345,9 +355,10 @@ androidComponents {}}-// reproducible builds: no baseline profile in the APK (its bytes vary from one build to the next)+// reproducible builds: no baseline profile in the APK (its bytes vary from one build to the next);+// the local `fast` build keeps Compose's, as it isn't publishedtasks.configureEach {- if (name.contains("ArtProfile")) enabled = false+ if (name.contains("ArtProfile") && !name.contains("Fast")) enabled = false}dependencies {diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xmlindex 2a81355..030fee2 100644--- a/android/app/src/main/AndroidManifest.xml+++ b/android/app/src/main/AndroidManifest.xml@@ -6,6 +6,8 @@<!-- Comment ▸ Voice: recording a voice comment (asked for when first used) --><uses-permission android:name="android.permission.RECORD_AUDIO" />+ <!-- Expressive haptics: the vibrator's rich primitives (clicks, ticks, swells) -->+ <uses-permission android:name="android.permission.VIBRATE" /><uses-feature android:name="android.hardware.microphone" android:required="false" /><!-- Scan: the phone's camera app takes the pages. No CAMERA permission: declaring it withoutdiff --git a/android/app/src/main/assets/licences/OFL-BricolageGrotesque.txt b/android/app/src/main/assets/licences/OFL-BricolageGrotesque.txtnew file mode 100644index 0000000..a397658--- /dev/null+++ b/android/app/src/main/assets/licences/OFL-BricolageGrotesque.txt@@ -0,0 +1,93 @@+Copyright 2022 The Bricolage Grotesque Project Authors (https://github.com/ateliertriay/bricolage)++This Font Software is licensed under the SIL Open Font License, Version 1.1.+This license is copied below, and is also available with a FAQ at:+https://scripts.sil.org/OFL+++-----------------------------------------------------------+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007+-----------------------------------------------------------++PREAMBLE+The goals of the Open Font License (OFL) are to stimulate worldwide+development of collaborative font projects, to support the font creation+efforts of academic and linguistic communities, and to provide a free and+open framework in which fonts may be shared and improved in partnership+with others.++The OFL allows the licensed fonts to be used, studied, modified and+redistributed freely as long as they are not sold by themselves. The+fonts, including any derivative works, can be bundled, embedded,+redistributed and/or sold with any software provided that any reserved+names are not used by derivative works. The fonts and derivatives,+however, cannot be released under any other type of license. The+requirement for fonts to remain under this license does not apply+to any document created using the fonts or their derivatives.++DEFINITIONS+"Font Software" refers to the set of files released by the Copyright+Holder(s) under this license and clearly marked as such. This may+include source files, build scripts and documentation.++"Reserved Font Name" refers to any names specified as such after the+copyright statement(s).++"Original Version" refers to the collection of Font Software components as+distributed by the Copyright Holder(s).++"Modified Version" refers to any derivative made by adding to, deleting,+or substituting -- in part or in whole -- any of the components of the+Original Version, by changing formats or by porting the Font Software to a+new environment.++"Author" refers to any designer, engineer, programmer, technical+writer or other person who contributed to the Font Software.++PERMISSION & CONDITIONS+Permission is hereby granted, free of charge, to any person obtaining+a copy of the Font Software, to use, study, copy, merge, embed, modify,+redistribute, and sell modified and unmodified copies of the Font+Software, subject to the following conditions:++1) Neither the Font Software nor any of its individual components,+in Original or Modified Versions, may be sold by itself.++2) Original or Modified Versions of the Font Software may be bundled,+redistributed and/or sold with any software, provided that each copy+contains the above copyright notice and this license. These can be+included either as stand-alone text files, human-readable headers or+in the appropriate machine-readable metadata fields within text or+binary files as long as those fields can be easily viewed by the user.++3) No Modified Version of the Font Software may use the Reserved Font+Name(s) unless explicit written permission is granted by the corresponding+Copyright Holder. This restriction only applies to the primary font name as+presented to the users.++4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font+Software shall not be used to promote, endorse or advertise any+Modified Version, except to acknowledge the contribution(s) of the+Copyright Holder(s) and the Author(s) or with their explicit written+permission.++5) The Font Software, modified or unmodified, in part or in whole,+must be distributed entirely under this license, and must not be+distributed under any other license. The requirement for fonts to+remain under this license does not apply to any document created+using the Font Software.++TERMINATION+This license becomes null and void if any of the above conditions are+not met.++DISCLAIMER+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM+OTHER DEALINGS IN THE FONT SOFTWARE.diff --git a/android/app/src/main/assets/licences/OFL-Fraunces.txt b/android/app/src/main/assets/licences/OFL-Fraunces.txtnew file mode 100644index 0000000..22fa7ce--- /dev/null+++ b/android/app/src/main/assets/licences/OFL-Fraunces.txt@@ -0,0 +1,93 @@+Copyright 2018 The Fraunces Project Authors (https://github.com/undercasetype/Fraunces)++This Font Software is licensed under the SIL Open Font License, Version 1.1.+This license is copied below, and is also available with a FAQ at:+http://scripts.sil.org/OFL+++-----------------------------------------------------------+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007+-----------------------------------------------------------++PREAMBLE+The goals of the Open Font License (OFL) are to stimulate worldwide+development of collaborative font projects, to support the font creation+efforts of academic and linguistic communities, and to provide a free and+open framework in which fonts may be shared and improved in partnership+with others.++The OFL allows the licensed fonts to be used, studied, modified and+redistributed freely as long as they are not sold by themselves. The+fonts, including any derivative works, can be bundled, embedded,+redistributed and/or sold with any software provided that any reserved+names are not used by derivative works. The fonts and derivatives,+however, cannot be released under any other type of license. The+requirement for fonts to remain under this license does not apply+to any document created using the fonts or their derivatives.++DEFINITIONS+"Font Software" refers to the set of files released by the Copyright+Holder(s) under this license and clearly marked as such. This may+include source files, build scripts and documentation.++"Reserved Font Name" refers to any names specified as such after the+copyright statement(s).++"Original Version" refers to the collection of Font Software components as+distributed by the Copyright Holder(s).++"Modified Version" refers to any derivative made by adding to, deleting,+or substituting -- in part or in whole -- any of the components of the+Original Version, by changing formats or by porting the Font Software to a+new environment.++"Author" refers to any designer, engineer, programmer, technical+writer or other person who contributed to the Font Software.++PERMISSION & CONDITIONS+Permission is hereby granted, free of charge, to any person obtaining+a copy of the Font Software, to use, study, copy, merge, embed, modify,+redistribute, and sell modified and unmodified copies of the Font+Software, subject to the following conditions:++1) Neither the Font Software nor any of its individual components,+in Original or Modified Versions, may be sold by itself.++2) Original or Modified Versions of the Font Software may be bundled,+redistributed and/or sold with any software, provided that each copy+contains the above copyright notice and this license. These can be+included either as stand-alone text files, human-readable headers or+in the appropriate machine-readable metadata fields within text or+binary files as long as those fields can be easily viewed by the user.++3) No Modified Version of the Font Software may use the Reserved Font+Name(s) unless explicit written permission is granted by the corresponding+Copyright Holder. This restriction only applies to the primary font name as+presented to the users.++4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font+Software shall not be used to promote, endorse or advertise any+Modified Version, except to acknowledge the contribution(s) of the+Copyright Holder(s) and the Author(s) or with their explicit written+permission.++5) The Font Software, modified or unmodified, in part or in whole,+must be distributed entirely under this license, and must not be+distributed under any other license. The requirement for fonts to+remain under this license does not apply to any document created+using the Font Software.++TERMINATION+This license becomes null and void if any of the above conditions are+not met.++DISCLAIMER+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM+OTHER DEALINGS IN THE FONT SOFTWARE.diff --git a/android/app/src/main/baseline-prof.txt b/android/app/src/main/baseline-prof.txtnew file mode 100644index 0000000..8178719--- /dev/null+++ b/android/app/src/main/baseline-prof.txt@@ -0,0 +1,4 @@+HSPLcom/chethan616/clearpdf/**->**(**)**+Lcom/chethan616/clearpdf/**;+HSPLcom/kyant/**->**(**)**+Lcom/kyant/**;diff --git a/android/app/src/main/java/com/chethan616/clearpdf/MainActivity.kt b/android/app/src/main/java/com/chethan616/clearpdf/MainActivity.ktindex 101947c..7e1f7f0 100644--- a/android/app/src/main/java/com/chethan616/clearpdf/MainActivity.kt+++ b/android/app/src/main/java/com/chethan616/clearpdf/MainActivity.kt@@ -80,6 +80,8 @@ class MainActivity : ComponentActivity() {onPickSignatureImage = { launchSafely { pickSignature.launch(PickVisualMediaRequest(ActivityResultContracts.PickVisualMedia.ImageOnly)) } },)}+ // the glass shaders compile one per idle moment, so the first glass on screen doesn't pay for it+ if (savedInstanceState == null) android.os.Looper.myQueue().addIdleHandler { com.kyant.backdrop.GlassShaderWarmup.next() }}/** The view model's requests that need the activity: other apps, pickers, the camera, printing. */diff --git a/android/app/src/main/java/com/chethan616/clearpdf/notes/Notes.kt b/android/app/src/main/java/com/chethan616/clearpdf/notes/Notes.ktindex 7dc7962..73305c5 100644--- a/android/app/src/main/java/com/chethan616/clearpdf/notes/Notes.kt+++ b/android/app/src/main/java/com/chethan616/clearpdf/notes/Notes.kt@@ -42,6 +42,8 @@ data class Note(val created: Long = System.currentTimeMillis(),val updated: Long = created,val pinned: Boolean = false,+ /** The epoch day this is the "Thought of the day" for, or 0 for an ordinary note. */+ val thought: Long = 0,) {val isEmpty: Boolean get() = title.isBlank() && body.isBlank() && items.none { it.text.isNotBlank() } && images.isEmpty() && audio == null}@@ -80,8 +82,8 @@ class Notes(private val context: Context, private val scope: CoroutineScope) {/** A new file name in the media folder. */fun newMedia(ext: String): File = File(media, "${UUID.randomUUID()}.$ext")- fun create(kind: NoteKind, title: String = "", body: String = "", items: List<CheckItem> = emptyList()): Note {- val n = Note(UUID.randomUUID().toString(), kind, title, body, items)+ fun create(kind: NoteKind, title: String = "", body: String = "", items: List<CheckItem> = emptyList(), thought: Long = 0): Note {+ val n = Note(UUID.randomUUID().toString(), kind, title, body, items, thought = thought)all = listOf(n) + allsave()return n@@ -166,6 +168,7 @@ private fun Note.toJson() = JSONObject().apply {put("created", created)put("updated", updated)put("pinned", pinned)+ if (thought != 0L) put("thought", thought)}private fun JSONObject.toNote(): Note {@@ -187,6 +190,7 @@ private fun JSONObject.toNote(): Note {created = optLong("created", System.currentTimeMillis()),updated = optLong("updated", System.currentTimeMillis()),pinned = optBoolean("pinned"),+ thought = optLong("thought"),)}diff --git a/android/app/src/main/java/com/chethan616/clearpdf/notes/Thoughts.kt b/android/app/src/main/java/com/chethan616/clearpdf/notes/Thoughts.ktnew file mode 100644index 0000000..7c5b9a7--- /dev/null+++ b/android/app/src/main/java/com/chethan616/clearpdf/notes/Thoughts.kt@@ -0,0 +1,19 @@+package com.chethan616.clearpdf.notes++import android.content.res.Resources+import com.chethan616.clearpdf.R+import java.time.LocalDate++/** A day's thought: a short line to lead with, and a few words under it (`**bold**` marks the heart of it). */+class Thought(val quote: String, val reflection: String)++/** Today as a day number, the key a thought note is filed under. */+fun today(): Long = LocalDate.now().toEpochDay()++/** The thought for [day]: one a day, in the app's language, round the list. */+fun thoughtFor(res: Resources, day: Long = today()): Thought {+ val quotes = res.getStringArray(R.array.thought_quotes)+ val reflections = res.getStringArray(R.array.thought_reflections)+ val i = Math.floorMod(day, quotes.size.toLong()).toInt()+ return Thought(quotes[i], reflections[i.coerceAtMost(reflections.lastIndex)])+}diff --git a/android/app/src/main/java/com/chethan616/clearpdf/preview/QuickPreview.kt b/android/app/src/main/java/com/chethan616/clearpdf/preview/QuickPreview.ktindex 33c51c3..c0bee96 100644--- a/android/app/src/main/java/com/chethan616/clearpdf/preview/QuickPreview.kt+++ b/android/app/src/main/java/com/chethan616/clearpdf/preview/QuickPreview.kt@@ -23,8 +23,8 @@ import androidx.compose.foundation.layout.heightimport androidx.compose.foundation.layout.navigationBarsimport androidx.compose.foundation.layout.paddingimport androidx.compose.foundation.layout.size-import androidx.compose.foundation.layout.statusBarsimport androidx.compose.foundation.layout.width+import androidx.compose.foundation.shape.CircleShapeimport androidx.compose.foundation.text.KeyboardActionsimport androidx.compose.foundation.text.KeyboardOptionsimport androidx.compose.material3.Icon@@ -43,6 +43,7 @@ import androidx.compose.ui.Alignmentimport androidx.compose.ui.Modifierimport androidx.compose.ui.draw.clipimport androidx.compose.ui.geometry.Rect+import androidx.compose.ui.graphics.Brushimport androidx.compose.ui.graphics.Colorimport androidx.compose.ui.graphics.graphicsLayerimport androidx.compose.ui.input.pointer.pointerInput@@ -50,31 +51,30 @@ import androidx.compose.ui.layout.boundsInWindowimport androidx.compose.ui.layout.onGloballyPositionedimport androidx.compose.ui.platform.LocalDensityimport androidx.compose.ui.res.stringResource+import androidx.compose.ui.semantics.contentDescription+import androidx.compose.ui.semantics.semanticsimport androidx.compose.ui.text.input.ImeActionimport androidx.compose.ui.text.input.KeyboardTypeimport androidx.compose.ui.text.style.TextAlignimport androidx.compose.ui.text.style.TextOverflowimport androidx.compose.ui.unit.dp-import androidx.compose.ui.util.lerpimport com.chethan616.clearpdf.Rimport com.chethan616.clearpdf.ui.LucideIconsimport com.chethan616.clearpdf.ui.PdfFieldimport com.chethan616.clearpdf.ui.PdfcraftThemeimport com.chethan616.clearpdf.ui.ThemeChoice-import com.chethan616.clearpdf.ui.glass.GlassCircle-import com.chethan616.clearpdf.ui.glass.GlassIconimport com.chethan616.clearpdf.ui.glass.GlassLayerimport com.chethan616.clearpdf.ui.glass.GlassLoaderimport com.chethan616.clearpdf.ui.glass.GlassMenuimport com.chethan616.clearpdf.ui.glass.GlassMenuItem-import com.chethan616.clearpdf.ui.glass.GlassMotion+import com.chethan616.clearpdf.ui.glass.Fluidimport com.chethan616.clearpdf.ui.glass.GlassOverlayHostimport com.chethan616.clearpdf.ui.glass.GlassOverlayLayerimport com.chethan616.clearpdf.ui.glass.GlassPillimport com.chethan616.clearpdf.ui.glass.GlassToastimport com.chethan616.clearpdf.ui.glass.LocalGlassOverlayHostimport com.chethan616.clearpdf.ui.glass.ProvideGlassHaptics-import com.chethan616.clearpdf.ui.glass.glass+import com.chethan616.clearpdf.ui.glass.pressableimport com.chethan616.clearpdf.ui.mascot.Mascotimport com.chethan616.clearpdf.ui.mascot.MascotMoodimport com.chethan616.clearpdf.ui.theme.Candy@@ -94,8 +94,10 @@ private const val CardHeight = 0.84f/*** Quick Preview's window content: a dim (and on newer phones a blur) over the app that opened the- * file, and the card rising from the bottom on a spring. The card's header is glass over the- * pages: Close, the name, Expand, Share and More. Drag the header down to close, up to expand.+ * file, and a card rising from the bottom on the eased curve. The card is as plain as it can be:+ * the pages, the name over them with More and Close, and one Open button. Drag the header down to+ * close, or up to open the file in Artefact. Floating glass (the More menu) lives inside the card's+ * own glass layer, so it refracts the pages.*/@Composableinternal fun QuickPreviewScreen(@@ -114,10 +116,7 @@ internal fun QuickPreviewScreen(PdfcraftTheme(ThemeChoice.System) {ProvideGlassHaptics {CompositionLocalProvider(LocalGlassOverlayHost provides overlays) {- Box(Modifier.fillMaxSize()) {- Preview(state, onClose, onExpand, onShare, onOpenWith, onSaveCopy, onPassword, setBlur)- GlassOverlayLayer(overlays)- }+ Preview(state, onClose, onExpand, onShare, onOpenWith, onSaveCopy, onPassword, setBlur)}}}@@ -138,16 +137,18 @@ private fun Preview(val c = clearval scope = rememberCoroutineScope()val density = LocalDensity.current+ val overlays = LocalGlassOverlayHost.currentval appear = remember { Animatable(0f) }- val grow = remember { Animatable(0f) }var drag by remember { mutableFloatStateOf(0f) }var leaving by remember { mutableStateOf(false) }var toast by remember { mutableStateOf<String?>(null) }+ val paper = if (c.dark) Color(0xFF111A1F) else Color(0xFFE6ECF4)- LaunchedEffect(Unit) { appear.animateTo(1f, GlassMotion.morph()) }+ // the card slides up as an iOS sheet does: one eased curve, never past its place+ LaunchedEffect(Unit) { appear.animateTo(1f, Fluid.rise()) }// the blur behind follows the card in and outLaunchedEffect(Unit) {- snapshotFlow { (appear.value.coerceIn(0f, 1f) * (1f - grow.value) * 36f).toInt() }.collect { setBlur(it) }+ snapshotFlow { (appear.value.coerceIn(0f, 1f) * 36f).toInt() }.collect { setBlur(it) }}LaunchedEffect(toast) {if (toast != null) {@@ -160,68 +161,59 @@ private fun Preview(if (leaving) returnleaving = truescope.launch {- appear.animateTo(0f, GlassMotion.fold())+ appear.animateTo(0f, Fluid.dismiss())onClose()}}- fun expand() {+ // straight into the app: the viewer's own window animation takes over from here, so the card+ // never goes full screen first+ fun open() {if (leaving) returnleaving = true- scope.launch {- // layout grows, so no bounce (a spring past 1 would make the margins negative)- grow.animateTo(1f, GlassMotion.settle())- onExpand()- }+ scope.launch { Animatable(drag).animateTo(0f, Fluid.follow()) { drag = value } }+ onExpand()}BackHandler { close() }BoxWithConstraints(Modifier.fillMaxSize()) {val fullH = constraints.maxHeight.toFloat()val navPx = WindowInsets.navigationBars.getBottom(density).toFloat()- val statusPx = WindowInsets.statusBars.getTop(density).toFloat()// the dim over the caller: tap it to closeBox(Modifier.fillMaxSize()- .graphicsLayer { alpha = appear.value.coerceIn(0f, 1f) * (1f - grow.value * 0.3f) }+ .graphicsLayer { alpha = appear.value.coerceIn(0f, 1f) }.background(Color.Black.copy(alpha = if (c.dark) 0.5f else 0.32f)).clickable(remember { MutableInteractionSource() }, null) { close() },)val margin = with(density) { 10.dp.toPx() }val cardH = fullH * CardHeight - navPx- val g = grow.value.coerceIn(0f, 1f)Box(Modifier.align(Alignment.BottomCenter).graphicsLayer {- val p = appear.value- // rising in, following a drag, growing to the whole screen for Expand- translationY = (1f - p) * cardH * 0.9f + drag.coerceAtLeast(0f) * (1f - g)+ // rising in from below the screen's edge, following a drag+ translationY = (1f - appear.value) * (cardH + margin + navPx) + drag.coerceAtLeast(0f)val pull = (-drag).coerceAtLeast(0f) / fullH- scaleX = lerp(0.94f, 1f, p.coerceIn(0f, 1.2f)) + pull * 0.06f+ scaleX = 1f + pull * 0.04fscaleY = scaleX}- .padding(- start = with(density) { lerp(margin, 0f, g).toDp() },- end = with(density) { lerp(margin, 0f, g).toDp() },- bottom = with(density) { lerp(margin + navPx, 0f, g).toDp() },- )+ .padding(start = 10.dp, end = 10.dp, bottom = with(density) { (margin + navPx).toDp() }).fillMaxWidth()- .height(with(density) { lerp(cardH, fullH, g).toDp() })- .clip(RoundedRectangle(lerp(34f, 0f, g).dp))- .background(if (c.dark) Color(0xFF111A1F) else Color(0xFFE6ECF4))+ .height(with(density) { cardH.toDp() })+ .clip(RoundedRectangle(34.dp))+ .background(paper).clickable(remember { MutableInteractionSource() }, null) {},) {- val headerH = 112.dpGlassLayer(Modifier.fillMaxSize(),content = {AnimatedContent(state, contentKey = { it::class }, label = "preview",- transitionSpec = { fadeIn(GlassMotion.settle()) togetherWith fadeOut(GlassMotion.fold()) },+ transitionSpec = { fadeIn(Fluid.fade()) togetherWith fadeOut(Fluid.fade()) },) { s ->when (s) {- is PreviewState.Ready -> Pages(s, headerH)+ is PreviewState.Ready -> Pages(s, paper)is PreviewState.Loading -> Box(Modifier.fillMaxSize(), contentAlignment = Alignment.Center) { GlassLoader(size = 72.dp) }is PreviewState.Password -> PasswordCard(s, onPassword)is PreviewState.Failed -> FailedCard(s.message) { close() }@@ -229,54 +221,75 @@ private fun Preview(}},) {+ val haptics = com.chethan616.clearpdf.ui.glass.LocalHaptics.current+ val threshold = with(density) { 110.dp.toPx() }Header(- state, Modifier.align(Alignment.TopCenter).padding(top = with(density) { lerp(0f, statusPx, g).toDp() }),- onDrag = { d -> drag += d },+ state, paper, Modifier.align(Alignment.TopCenter),+ onDrag = { d ->+ val before = drag > threshold || drag < -threshold * 0.8f+ drag += d+ // a tick where letting go would close (down) or open (up)+ if (before != (drag > threshold || drag < -threshold * 0.8f)) haptics?.play(com.chethan616.clearpdf.ui.glass.Feel.Tick)+ },onDragEnd = {- val threshold = with(density) { 110.dp.toPx() }when {drag > threshold -> close()- drag < -threshold * 0.8f -> expand()- else -> scope.launch { Animatable(drag).animateTo(0f, GlassMotion.pressOut()) { drag = value } }+ drag < -threshold * 0.8f -> open()+ else -> scope.launch { Animatable(drag).animateTo(0f, Fluid.follow()) { drag = value } }}},- onClose = ::close, onExpand = ::expand, onShare = onShare, onOpenWith = onOpenWith,+ onClose = ::close, onShare = onShare, onOpenWith = onOpenWith,onSaveCopy = { onSaveCopy { toast = it } },)- (state as? PreviewState.Ready)?.let { BottomBar(it, onShare, ::expand, Modifier.align(Alignment.BottomCenter).padding(start = 12.dp, end = 12.dp, bottom = 12.dp)) }+ if (state is PreviewState.Ready) {+ GlassPill(+ onClick = ::open, tint = Candy.Sky, height = 50.dp, horizontalPadding = 30.dp,+ label = stringResource(R.string.preview_expand),+ modifier = Modifier.align(Alignment.BottomCenter).padding(bottom = 18.dp),+ ) {+ Text(stringResource(R.string.preview_open), style = ClearType.BodyStrong, color = Color.White)+ }+ }toast?.let { t -> GlassToast(t, null, {}, Modifier.align(Alignment.BottomCenter).padding(start = 16.dp, end = 16.dp, bottom = 84.dp)) }+ // floating glass (the More menu) is composed here, over the pages, so it refracts them+ overlays?.let { GlassOverlayLayer(it) }}}}}-/** The pages, scrolling under the glass header; pinch and double tap zoom as in the viewer. */+/** The header's height: the pages start below it and fade up into it as they scroll. */+private val HeaderHeight = 84.dp++/** The pages, scrolling under the header; pinch and double tap zoom as in the viewer. */@Composable-private fun Pages(s: PreviewState.Ready, headerTop: androidx.compose.ui.unit.Dp) {- val c = clear+private fun Pages(s: PreviewState.Ready, paper: Color) {val density = LocalDensity.currentLaunchedEffect(s) {- with(density) { s.view.setPadding(headerTop.toPx(), 86.dp.toPx()) }+ with(density) { s.view.setPadding(HeaderHeight.toPx(), 92.dp.toPx()) }}PageCanvas(state = s.view,images = s.images,generation = s.info.generation.toLong(),- look = CanvasLook(background = if (c.dark) Color(0xFF111A1F) else Color(0xFFE6ECF4), pageShadow = Color(0x26000000)),+ look = CanvasLook(background = paper, pageShadow = Color(0x26000000)),gap = 10.dp,margin = 12.dp,)}-/** The glass header: a handle, Close, the document's name and size, and More. Drag it to close or expand. */+/**+ * The header, plain: a handle, the document's name and size, More and Close as quiet round buttons.+ * It sits on the card's own colour and fades into the pages below it. Drag it to close or to open.+ */@Composableprivate fun Header(state: PreviewState,+ paper: Color,modifier: Modifier,onDrag: (Float) -> Unit,onDragEnd: () -> Unit,onClose: () -> Unit,- onExpand: () -> Unit,onShare: () -> Unit,onOpenWith: () -> Unit,onSaveCopy: () -> Unit,@@ -286,23 +299,24 @@ private fun Header(var anchor by remember { mutableStateOf(Rect.Zero) }val ready = state as? PreviewState.ReadyColumn(- modifier.fillMaxWidth().pointerInput(Unit) {- detectVerticalDragGestures(onDragEnd = onDragEnd, onDragCancel = onDragEnd) { ch, d ->- ch.consume()- onDrag(d)- }- },+ modifier.fillMaxWidth()+ .background(Brush.verticalGradient(0f to paper, 0.74f to paper, 1f to paper.copy(alpha = 0f)))+ .pointerInput(Unit) {+ detectVerticalDragGestures(onDragEnd = onDragEnd, onDragCancel = onDragEnd) { ch, d ->+ ch.consume()+ onDrag(d)+ }+ },) {- Box(Modifier.fillMaxWidth().padding(top = 8.dp, bottom = 6.dp), contentAlignment = Alignment.Center) {- Box(Modifier.size(40.dp, 5.dp).clip(Capsule).background(c.ink.copy(alpha = 0.22f)))+ Box(Modifier.fillMaxWidth().padding(top = 8.dp, bottom = 8.dp), contentAlignment = Alignment.Center) {+ Box(Modifier.size(36.dp, 5.dp).clip(Capsule).background(c.ink.copy(alpha = 0.2f)))}Row(- Modifier.padding(horizontal = 10.dp).fillMaxWidth().glass(Capsule, c.frost, blur = 14.dp).padding(6.dp),+ Modifier.fillMaxWidth().padding(start = 22.dp, end = 14.dp, bottom = 18.dp),verticalAlignment = Alignment.CenterVertically,- horizontalArrangement = Arrangement.spacedBy(6.dp),+ horizontalArrangement = Arrangement.spacedBy(8.dp),) {- GlassCircle(onClick = onClose, size = 44.dp, label = stringResource(R.string.preview_close)) { GlassIcon(LucideIcons.X, null, Modifier.size(20.dp)) }- Column(Modifier.weight(1f).padding(horizontal = 4.dp)) {+ Column(Modifier.weight(1f)) {Text(ready?.name?.removeSuffix(".pdf")?.removeSuffix(".PDF") ?: stringResource(R.string.preview_title),style = ClearType.BodyStrong, color = c.ink, maxLines = 1, overflow = TextOverflow.Ellipsis,@@ -315,18 +329,19 @@ private fun Header(}}if (ready != null) {- GlassCircle(- onClick = { menu = true }, size = 44.dp, label = stringResource(R.string.common_more_options),- modifier = Modifier.onGloballyPositioned { anchor = it.boundsInWindow() },- ) { GlassIcon(LucideIcons.Ellipsis, null, Modifier.size(20.dp)) }+ QuietButton(+ { menu = true }, stringResource(R.string.common_more_options),+ Modifier.onGloballyPositioned { anchor = it.boundsInWindow() },+ ) { Icon(LucideIcons.Ellipsis, null, tint = c.ink, modifier = Modifier.size(20.dp)) }}+ QuietButton(onClose, stringResource(R.string.preview_close)) { Icon(LucideIcons.X, null, tint = c.ink, modifier = Modifier.size(18.dp)) }}}if (menu) {GlassMenu(anchor, { menu = false },listOf(- GlassMenuItem(stringResource(R.string.preview_open_in_app), LucideIcons.Maximize2, onClick = onExpand),+ GlassMenuItem(stringResource(R.string.common_share), LucideIcons.Share2, onClick = onShare),GlassMenuItem(stringResource(R.string.preview_save_downloads), LucideIcons.FileDown, onClick = onSaveCopy),GlassMenuItem(stringResource(R.string.home_open_with), LucideIcons.ExternalLink, onClick = onOpenWith),),@@ -334,24 +349,13 @@ private fun Header(}}-/** The card's foot, on glass: Share, the page it's on ("3 / 12"), and Open (Expand) in the app's blue. */+/** A round button with no glass: a faint disc of ink and a glyph, for a plain surface. */@Composable-private fun BottomBar(s: PreviewState.Ready, onShare: () -> Unit, onExpand: () -> Unit, modifier: Modifier) {- val c = clear- Row(- modifier.fillMaxWidth().glass(Capsule, c.frost, blur = 14.dp).padding(6.dp),- verticalAlignment = Alignment.CenterVertically,- ) {- GlassCircle(onClick = onShare, size = 46.dp, label = stringResource(R.string.common_share)) { GlassIcon(LucideIcons.Share2, null, Modifier.size(20.dp)) }- Text(- "${s.view.currentPage + 1} / ${s.info.pages.size}", style = ClearType.Label, color = c.inkSoft,- textAlign = TextAlign.Center, modifier = Modifier.weight(1f),- )- GlassPill(onClick = onExpand, tint = Candy.Sky, height = 46.dp, horizontalPadding = 18.dp, label = stringResource(R.string.preview_expand)) {- Icon(LucideIcons.Maximize2, null, tint = Color.White, modifier = Modifier.size(17.dp))- Text(stringResource(R.string.preview_open), style = ClearType.BodyStrong, color = Color.White)- }- }+private fun QuietButton(onClick: () -> Unit, label: String, modifier: Modifier = Modifier, content: @Composable () -> Unit) {+ Box(+ modifier.size(38.dp).pressable(onClick, pressedScale = 0.9f).clip(CircleShape).background(clear.ink.copy(alpha = 0.08f)).semantics { contentDescription = label },+ contentAlignment = Alignment.Center,+ ) { content() }}/** A locked document: its password, asked for right in the card. */diff --git a/android/app/src/main/java/com/chethan616/clearpdf/preview/QuickPreviewActivity.kt b/android/app/src/main/java/com/chethan616/clearpdf/preview/QuickPreviewActivity.ktindex 016ef51..afac6ae 100644--- a/android/app/src/main/java/com/chethan616/clearpdf/preview/QuickPreviewActivity.kt+++ b/android/app/src/main/java/com/chethan616/clearpdf/preview/QuickPreviewActivity.kt@@ -42,7 +42,7 @@ import kotlinx.coroutines.withContext* The window is translucent (Theme.Artefact.Preview) and joins the caller's task, so the app that* opened the file stays drawn behind it, exactly where it was; Android dims and, where the phone* allows cross-window blur (Android 12+), softly blurs it. The card itself is compact: it never- * covers the whole screen. Expand hands the file to the full viewer; closing just finishes, which+ * covers the whole screen. Open hands the file to the full viewer at once; closing just finishes, which* reveals the caller again. Nothing here draws over other apps: no overlay permission, no PiP.*/class QuickPreviewActivity : ComponentActivity() {@@ -154,10 +154,12 @@ class QuickPreviewActivity : ComponentActivity() {.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)copy?.let { base.putExtra(MainActivity.EXTRA_LOCAL_COPY, it.absolutePath) }val withSource = Intent(base).setDataAndType(u, mime ?: "application/pdf").addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)- // the card has already grown to fill the screen: the viewer just fades in over it- val fade = android.app.ActivityOptions.makeCustomAnimation(this, android.R.anim.fade_in, android.R.anim.fade_out).toBundle()- if (runCatching { startActivity(withSource, fade) }.isFailure) runCatching { startActivity(base, fade) }- finishQuietly()+ // straight into the app, no stop at a full-screen preview: the viewer rises over the card+ // (which holds still under it) on the sheet curve+ val rise = android.app.ActivityOptions.makeCustomAnimation(this, R.anim.preview_open_enter, R.anim.preview_open_exit).toBundle()+ if (runCatching { startActivity(withSource, rise) }.isFailure) runCatching { startActivity(base, rise) }+ // no override here: a (0, 0) override would replace the animation above+ finish()}private fun share() {diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/AppViewModel.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/AppViewModel.ktindex e890379..b5d16ab 100644--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/AppViewModel.kt+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/AppViewModel.kt@@ -2374,6 +2374,12 @@ class AppViewModel(app: Application, private val saved: SavedStateHandle) : Andr/** The note open in the editor. */var openNote by mutableStateOf<String?>(null)+ /** The desk's dock is turning into the open note's toolbar: the toolbar waits, unseen, until it has. */+ var noteBarHidden by mutableStateOf(false)++ /** The note toolbar's glass, measured, for the dock to become. */+ var noteBarSize by mutableStateOf(androidx.compose.ui.unit.IntSize.Zero)+/** Files other apps open show in Quick Preview's floating card first (else straight in the viewer). */var quickPreview by mutableStateOf(appPrefs.getBoolean("quickPreview", true))private set@@ -2423,9 +2429,29 @@ class AppViewModel(app: Application, private val saved: SavedStateHandle) : AndropenNote = notes.create(kind, items = items).id}+ /** Today's "Thought of the day" straight into the editor: its note is made the first time it's opened. */+ fun openThought() {+ val day = com.chethan616.clearpdf.notes.today()+ val note = notes.all.firstOrNull { it.thought == day } ?: com.chethan616.clearpdf.notes.thoughtFor(getApplication<Application>().resources, day).let {+ notes.create(com.chethan616.clearpdf.notes.NoteKind.Text, it.quote, it.reflection, thought = day)+ }+ openNote = note.id+ }+fun closeNote() {- openNote?.let(notes::prune)+ val id = openNote ?: returnopenNote = null+ val note = notes.get(id)+ if (note != null && note.thought != 0L && note.updated == note.created) {+ // a thought read but not written on isn't kept; the editor finishes leaving first+ viewModelScope.launch {+ delay(700)+ val still = notes.get(id)+ if (openNote != id && still != null && still.updated == still.created) notes.delete(id)+ }+ } else {+ notes.prune(id)+ }}/** Run [action] once the microphone is allowed (asking for it first if need be). */@@ -2577,10 +2603,22 @@ class AppViewModel(app: Application, private val saved: SavedStateHandle) : Andr}}- fun recentRows(): List<com.chethan616.clearpdf.ui.home.FileRow> = recentList.map { r ->- com.chethan616.clearpdf.ui.home.FileRow(r.uri, r.name, thumbPathFor(r.uri), locationOf(r.uri), r.opened, r.size, r.starred) { open(Uri.parse(r.uri)) }+ /**+ * Recent's rows, made once per change of the list: making one looks for the file's working copy+ * on disk and its place, which the desk and Files must not do again on every recomposition.+ */+ fun recentRows(): List<com.chethan616.clearpdf.ui.home.FileRow> {+ val list = recentList+ recentRowsMemo?.let { (from, rows) -> if (from === list) return rows }+ val rows = list.map { r ->+ com.chethan616.clearpdf.ui.home.FileRow(r.uri, r.name, thumbPathFor(r.uri), locationOf(r.uri), r.opened, r.size, r.starred) { open(Uri.parse(r.uri)) }+ }+ recentRowsMemo = list to rows+ return rows}+ private var recentRowsMemo: Pair<List<RecentFile>, List<com.chethan616.clearpdf.ui.home.FileRow>>? = null+fun starredRows(): List<com.chethan616.clearpdf.ui.home.FileRow> = recentRows().filter { it.starred }.let { l ->if (starSort == 1) l.sortedBy { it.name.lowercase() } else l.sortedByDescending { it.date }}diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/ClearApp.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/ClearApp.ktindex 27fa5fc..8545138 100644--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/ClearApp.kt+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/ClearApp.kt@@ -39,6 +39,7 @@ import androidx.compose.foundation.text.KeyboardOptionsimport androidx.compose.material3.Iconimport androidx.compose.material3.Textimport androidx.compose.runtime.Composable+import androidx.compose.ui.input.pointer.pointerInputimport androidx.compose.runtime.CompositionLocalProviderimport androidx.compose.runtime.LaunchedEffectimport androidx.compose.runtime.SideEffect@@ -50,6 +51,8 @@ import androidx.compose.runtime.setValueimport androidx.compose.ui.Alignmentimport androidx.compose.ui.Modifierimport androidx.compose.ui.draw.clip+import androidx.compose.ui.draw.drawWithContent+import com.chethan616.clearpdf.ui.glass.Fluidimport androidx.compose.ui.focus.FocusRequesterimport androidx.compose.ui.graphics.Colorimport androidx.compose.ui.graphics.CompositingStrategy@@ -160,6 +163,8 @@ private fun Shell(vm: AppViewModel, onBrowse: () -> Unit, onPickSignatureImage:}val onDesk = doc == null && route == HomeTab.Home.name && vm.toolScreen == null && vm.signaturePad == null && vm.certSign == null && !vm.idCreateval desk = remember { DeskState(scope) }+ var dockIntoNote by remember { mutableStateOf(false) }+ var dockFromNote by remember { mutableStateOf(false) }val mood = when {route == "welcome" -> AuroraMoods.Welcomevm.settingsOpen -> AuroraMoods.Settings@@ -169,11 +174,14 @@ private fun Shell(vm: AppViewModel, onBrowse: () -> Unit, onPickSignatureImage:else -> AuroraMoods.Desk}+ val reveal = remember { RevealState() }+ // under an open document nothing of the desk shows: skip drawing it (and its glass) entirely+ val underDoc = Modifier.drawWithContent { if (!reveal.covering) drawContent() }GlassStage(- wallpaper = { Aurora(mood) },+ wallpaper = { Aurora(mood, underDoc) },screens = {- Box(Modifier.fillMaxSize().windowInsetsPadding(WindowInsets.safeDrawing.only(WindowInsetsSides.Horizontal))) {- AnimatedContent(route, transitionSpec = { push(depth(initialState), depth(targetState)) }, label = "route") { r ->+ Box(Modifier.fillMaxSize().then(underDoc).windowInsetsPadding(WindowInsets.safeDrawing.only(WindowInsetsSides.Horizontal))) {+ RouteHost(route) { r ->when {r == "welcome" -> Onboarding(vm)r == "settings" -> SettingsScreen(vm)@@ -183,24 +191,36 @@ private fun Shell(vm: AppViewModel, onBrowse: () -> Unit, onPickSignatureImage:else -> HomeScreen(vm, desk)}}+ }+ // the document rises over the desk (translation and a cheap fade: no scaling, no layer)+ Reveal(doc, reveal) { Viewer(vm, it) }+ // a tool's own screen opens over whatever it was started from: the desk or a document+ Box(Modifier.fillMaxSize().windowInsetsPadding(WindowInsets.safeDrawing.only(WindowInsetsSides.Horizontal))) {vm.toolScreen?.let { ToolScreenHost(vm, it) }vm.signaturePad?.let { SignaturePadScreen(vm, it, onPickSignatureImage) }vm.certSign?.let { CertSignScreen(vm, it) }if (vm.idCreate) CreateIdScreen(vm)}- // the document opens over the desk, zooming up from it- AnimatedVisibility(- doc != null,- enter = fadeIn(GlassMotion.settle()) + scaleIn(GlassMotion.morph(), initialScale = 0.9f),- exit = fadeOut(GlassMotion.fold()) + scaleOut(GlassMotion.fold(), targetScale = 0.94f),- ) {- val last = remember { arrayOfNulls<OpenDocument>(1) }- if (doc != null) last[0] = doc- last[0]?.let { Viewer(vm, it) }- }},chrome = {- if (onDesk) CreateDock(vm, desk, onBrowse)+ // a note opened from the desk: the dock stays a moment and becomes the note's toolbar; back+ // on the desk, the note's toolbar becomes the dock again+ val lastRoute = remember { arrayOf(route) }+ if (lastRoute[0] != route) {+ val intoNote = lastRoute[0] == HomeTab.Home.name && route.startsWith("note:") && doc == null+ val fromNote = lastRoute[0].startsWith("note:") && route == HomeTab.Home.name && doc == null+ if (intoNote != dockIntoNote) dockIntoNote = intoNote+ if (fromNote != dockFromNote) dockFromNote = fromNote+ if (vm.noteBarHidden != (intoNote || fromNote)) vm.noteBarHidden = intoNote || fromNote+ lastRoute[0] = route+ }+ if (onDesk || dockIntoNote) {+ CreateDock(vm, desk, onBrowse, intoNote = !onDesk, fromNote = onDesk && dockFromNote) {+ dockIntoNote = false+ dockFromNote = false+ vm.noteBarHidden = false+ }+ }toast?.let { m ->Box(Modifier.align(Alignment.BottomCenter).navigationBarsPadding()@@ -244,12 +264,111 @@ private fun depth(route: String): Int = when {else -> 1}-/** A push (or a pop): the new screen slides and grows in on a spring while the old one shrinks back. */-private fun push(from: Int, to: Int): ContentTransform {- val forward = to >= from- val dir = if (forward) 1 else -1- return (slideInHorizontally(GlassMotion.morph()) { it * dir / 3 } + fadeIn(GlassMotion.settle()) + scaleIn(GlassMotion.morph(), initialScale = if (forward) 0.96f else 1.04f)) togetherWith- (slideOutHorizontally(GlassMotion.fold()) { -it * dir / 5 } + fadeOut(GlassMotion.fold()) + scaleOut(GlassMotion.fold(), targetScale = if (forward) 0.94f else 1.04f))+/**+ * The screens, one route at a time, moved the way iOS pushes: on one eased curve (quick to start,+ * long and soft to land, never past its place; no spring, and Settings ▸ Motion doesn't touch it).+ * The new screen glides in from the side as the old one drifts the other way and fades out ahead+ * of it; Back mirrors it, a touch quicker. Both stay one composition throughout (keyed, so the old+ * screen is moved, not rebuilt), each route keeps its state, and the fades modulate alpha per draw+ * instead of rendering whole screens offscreen. The new screen is composed at alpha 0, so a slow+ * first frame is never seen.+ */+@Composable+private fun RouteHost(route: String, content: @Composable (String) -> Unit) {+ val holder = androidx.compose.runtime.saveable.rememberSaveableStateHolder()+ var shown by remember { mutableStateOf(route) }+ var leaving by remember { mutableStateOf<String?>(null) }+ var forward by remember { mutableStateOf(true) }+ val p = remember { Animatable(1f) }+ LaunchedEffect(route) {+ if (route == shown) return@LaunchedEffect+ forward = depth(route) >= depth(shown)+ leaving = shown+ shown = route+ p.snapTo(0f)+ p.animateTo(1f, if (forward) Fluid.push() else Fluid.pop())+ leaving = null+ }+ // The desk stays composed (unseen, untouchable) under the screens pushed over it, so coming back to+ // it rebuilds nothing: no cards, thumbnails or glass appearing a moment after the screen has.+ val desk = HomeTab.Home.name+ var deskSeen by remember { mutableStateOf(route == desk) }+ if (shown == desk) deskSeen = true+ val routes = buildList {+ if (deskSeen && desk != leaving && desk != shown) add(desk)+ leaving?.let(::add)+ add(shown)+ }+ Box(Modifier.fillMaxSize()) {+ for (r in routes) {+ key(r) {+ val isNew = r == shown+ val hidden = r != shown && r != leaving+ Box(+ Modifier.fillMaxSize().then(if (hidden) BlockTouches else Modifier).graphicsLayer {+ if (hidden) {+ alpha = 0f+ return@graphicsLayer+ }+ val v = p.value+ val dir = if (forward) 1f else -1f+ if (isNew) {+ translationX = dir * size.width * 0.24f * (1f - v)+ alpha = (v * 1.25f).coerceIn(0f, 1f)+ } else {+ translationX = -dir * size.width * 0.10f * v+ alpha = (1f - v * 1.6f).coerceIn(0f, 1f)+ }+ compositingStrategy = CompositingStrategy.ModulateAlpha+ },+ ) { holder.SaveableStateProvider(r) { content(r) } }+ }+ }+ }+}++/** Takes every touch before anything inside sees it (a screen kept alive but not shown). */+private val BlockTouches = Modifier.pointerInput(Unit) {+ awaitPointerEventScope {+ while (true) awaitPointerEvent(androidx.compose.ui.input.pointer.PointerEventPass.Initial).changes.forEach { it.consume() }+ }+}++/** How far a document has risen over the desk: 0 gone, 1 covering it. */+private class RevealState {+ val progress = Animatable(0f)++ /** Fully over the desk: what's beneath needn't be drawn at all. */+ val covering by androidx.compose.runtime.derivedStateOf { progress.value >= 1f }+}++/**+ * [value] rising into view while it is set, on the eased curve a sheet rises on, and falling away+ * (quicker) once it's null, still drawn as it was.+ */+@Composable+private fun <T : Any> Reveal(value: T?, state: RevealState, content: @Composable (T) -> Unit) {+ val last = remember { arrayOfNulls<Any>(1) }+ if (value != null) last[0] = value+ val p = state.progress+ LaunchedEffect(value != null) {+ if (value != null) p.animateTo(1f, Fluid.rise()) else p.animateTo(0f, Fluid.dismiss())+ if (value == null) last[0] = null+ }+ // read through a derived state: the content recomposes when it's gone, not on every frame+ val gone by remember { androidx.compose.runtime.derivedStateOf { p.value <= 0f } }+ @Suppress("UNCHECKED_CAST")+ val shown = last[0] as T? ?: return+ if (gone && value == null) return+ Box(+ Modifier.fillMaxSize().graphicsLayer {+ val v = p.value+ translationY = (1f - v) * size.height * 0.07f+ alpha = (v * 1.8f).coerceIn(0f, 1f)+ compositingStrategy = CompositingStrategy.ModulateAlpha+ },+ ) { content(shown) }}/** Everything the view model can ask: passwords, read-only files, links, form alerts, waits. */diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/Components.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/Components.ktindex cd10d2e..e7978b0 100644--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/Components.kt+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/Components.kt@@ -88,7 +88,12 @@ import com.chethan616.clearpdf.ui.glass.GlassDialogimport com.chethan616.clearpdf.ui.glass.GlassIconimport com.chethan616.clearpdf.ui.glass.GlassOverlayimport com.chethan616.clearpdf.ui.glass.GlassToggle+import com.chethan616.clearpdf.ui.glass.Fluidimport com.chethan616.clearpdf.ui.glass.glass+import androidx.compose.foundation.layout.Arrangement+import androidx.compose.ui.draw.drawWithContent+import androidx.compose.ui.graphics.graphicsLayer+import kotlinx.coroutines.flow.firstimport com.chethan616.clearpdf.ui.glass.pressableimport com.chethan616.clearpdf.ui.theme.Candyimport com.chethan616.clearpdf.ui.theme.ClearType@@ -167,10 +172,15 @@ fun <T : Any> SheetHost(key: T?, content: @Composable (T) -> Unit) {}}+/** The sheet being composed's way to close (its header's × uses it). */+private val LocalSheetDismiss = staticCompositionLocalOf<(() -> Unit)?> { null }+/**- * A sheet: a frosted glass card floating along the bottom, rising on a spring. It lives in the app's- * overlay portal, so it refracts whatever is really behind it, wherever it's opened from. A tap- * outside or Back closes it, as does pulling its handle down. [maxHeightFraction] caps its height.+ * The viewer's sheet, iOS-style: a frosted glass panel floating a little inside the screen's edges+ * with big continuous corners and a grabber, rising on the eased curve and sliding back down when+ * it closes (never springing past its place). It lives in the app's overlay portal, so it refracts+ * whatever is really behind it. A tap outside, Back, its header's ×, or pulling it down closes it.+ * [maxHeightFraction] caps its height.*/@Composablefun PdfSheet(@@ -184,7 +194,7 @@ fun PdfSheet(bottomBand: Boolean = true,/** A wash of its own instead of the usual frost. */background: Color? = null,- handleHeight: Dp = 24.dp,+ handleHeight: Dp = 22.dp,aboveNavBar: Boolean = false,/** Whether the sheet always takes its full height. */fill: Boolean = false,@@ -193,18 +203,27 @@ fun PdfSheet(val own = remember { MutableTransitionState(false) }LaunchedEffect(own) { own.targetState = true }val visible = LocalSheetVisible.current ?: own- GlassOverlay {+ GlassOverlay(animatesOut = true) {val c = clear- BackHandler(enabled = visible.targetState, onBack = onDismiss)+ val presence = com.chethan616.clearpdf.ui.glass.LocalOverlayPresence.current+ val leaving = presence?.leaving == true+ // shown on its own (not through a SheetHost), it slides away once whoever showed it is gone+ LaunchedEffect(leaving) {+ if (!leaving) return@LaunchedEffect+ own.targetState = false+ androidx.compose.runtime.snapshotFlow { visible.isIdle && !visible.currentState }.first { it }+ presence?.done()+ }+ BackHandler(enabled = visible.targetState && !leaving, onBack = onDismiss)val scope = rememberCoroutineScope()var drag by remember { mutableFloatStateOf(0f) }var height by remember { mutableIntStateOf(0) }val closeLabel = stringResource(R.string.ui_close_sheet)Box(Modifier.fillMaxSize()) {- AnimatedVisibility(visible, enter = fadeIn(tween(PdfMotion.SHEET_IN_MS)), exit = fadeOut(tween(PdfMotion.SHEET_OUT_MS))) {+ AnimatedVisibility(visible, enter = fadeIn(Fluid.quick()), exit = fadeOut(Fluid.dismiss())) {Box(Modifier.fillMaxSize()- .background(if (dim) Color.Black.copy(alpha = if (c.dark) 0.42f else 0.22f) else Color.Transparent)+ .background(if (dim) Color.Black.copy(alpha = if (c.dark) 0.42f else 0.2f) else Color.Transparent).clickable(interactionSource = remember { MutableInteractionSource() }, indication = null, onClick = onDismiss).semantics { contentDescription = closeLabel },)@@ -214,8 +233,8 @@ fun PdfSheet(AnimatedVisibility(visible,modifier = Modifier.align(Alignment.BottomCenter),- enter = slideInVertically(spring(dampingRatio = 0.82f, stiffness = 420f)) { it } + fadeIn(tween(160)),- exit = slideOutVertically(tween(PdfMotion.SHEET_OUT_MS)) { it } + fadeOut(tween(PdfMotion.SHEET_OUT_MS)),+ enter = slideInVertically(Fluid.rise()) { it + 40 },+ exit = slideOutVertically(Fluid.dismiss()) { it + 40 },) {GlassCard(modifier@@ -227,28 +246,36 @@ fun PdfSheet(.offset { IntOffset(0, drag.roundToInt()) }.onSizeChanged { height = it.height }.pointerInput(Unit) { detectTapGestures() },- shape = RoundedRectangle(32.dp),+ shape = RoundedRectangle(34.dp),wash = background?.copy(alpha = 0.9f) ?: c.frost,- blur = 16.dp,+ blur = 18.dp,) {+ val haptics = com.chethan616.clearpdf.ui.glass.LocalHaptics.currentBox(Modifier.fillMaxWidth().height(handleHeight).pointerInput(Unit) {detectVerticalDragGestures(onDragEnd = {scope.launch {if (drag > height / 4f) onDismiss()- animate(drag, 0f, animationSpec = spring(dampingRatio = 0.7f, stiffness = 500f)) { v, _ -> drag = v }+ animate(drag, 0f, animationSpec = Fluid.follow()) { v, _ -> drag = v }}},- onVerticalDrag = { _, dy -> drag = (drag + dy).coerceAtLeast(0f) },+ onVerticalDrag = { _, dy ->+ val before = drag > height / 4f+ drag = (drag + dy).coerceAtLeast(0f)+ // a tick as the pull passes the point where letting go closes it+ if (before != drag > height / 4f) haptics?.play(com.chethan616.clearpdf.ui.glass.Feel.Tick)+ },)},contentAlignment = Alignment.Center,) {- Box(Modifier.size(36.dp, 5.dp).clip(Capsule).background(c.inkFaint.copy(alpha = 0.35f)))+ Box(Modifier.size(36.dp, 5.dp).clip(Capsule).background(c.ink.copy(alpha = if (c.dark) 0.28f else 0.18f)))}- Column(Modifier.weight(1f, fill = fill)) { content() }- Spacer(Modifier.height(8.dp))+ CompositionLocalProvider(LocalSheetDismiss provides onDismiss) {+ Column(Modifier.weight(1f, fill = fill)) { content() }+ }+ Spacer(Modifier.height(10.dp))}}}@@ -256,9 +283,54 @@ fun PdfSheet(}}+/** The wash of a group of rows on a sheet: white cells on the frost, as iOS groups them. */+@Composable+private fun sectionFill(): Color = if (clear.dark) Color.White.copy(alpha = 0.075f) else Color.White.copy(alpha = 0.66f)+/**- * A row of a sheet: its icon on a soft candy blob (the icon's own colour), the label, then- * [trailing] (a chevron for drill-in rows, a tick when [checked]).+ * A group of rows on a sheet, as iOS sets them out: one rounded cell, inset from the sheet's sides,+ * with a hairline between rows that starts where the labels do ([inset]).+ */+@Composable+fun SheetSection(modifier: Modifier = Modifier, inset: Dp = 58.dp, content: @Composable () -> Unit) {+ val line = clear.ink.copy(alpha = if (clear.dark) 0.14f else 0.09f)+ // where each row ends, written while measuring and read while drawing (no state: draw follows layout)+ val bounds = remember { IntArray(64) }+ val count = remember { IntArray(1) }+ androidx.compose.ui.layout.Layout(+ content,+ modifier+ .padding(horizontal = 12.dp, vertical = 5.dp)+ .fillMaxWidth()+ .clip(RoundedRectangle(22.dp))+ .background(sectionFill())+ .drawWithContent {+ drawContent()+ val x = inset.toPx()+ val w = 0.7.dp.toPx()+ for (i in 0 until count[0]) {+ val y = bounds[i] - w / 2f+ drawLine(line, androidx.compose.ui.geometry.Offset(x, y), androidx.compose.ui.geometry.Offset(size.width, y), w)+ }+ },+ ) { measurables, constraints ->+ val placeables = measurables.map { it.measure(constraints.copy(minHeight = 0)) }.filter { it.height > 0 }+ var y = 0+ count[0] = 0+ placeables.forEachIndexed { i, p ->+ y += p.height+ if (i < placeables.size - 1 && count[0] < bounds.size) bounds[count[0]++] = y+ }+ layout(constraints.maxWidth, y) {+ var top = 0+ placeables.forEach { it.place(0, top); top += it.height }+ }+ }+}++/**+ * A row of a sheet, as iOS Settings draws one: its icon white on a small rounded square of the+ * icon's own candy, the label, then [trailing] (a chevron for drill-in rows, a tick when [checked]).*/@Composablefun SheetRow(@@ -277,67 +349,96 @@ fun SheetRow(val accent = when {danger -> Candy.Tomatotint != null -> tint- checked -> Candy.Skyicon != null -> iconAccent(icon)else -> Candy.Sky}Row(- modifier.fillMaxWidth().heightIn(min = 52.dp).pressable(onClick, enabled = enabled).padding(horizontal = 16.dp, vertical = 6.dp),+ modifier.fillMaxWidth().heightIn(min = 50.dp).pressable(onClick, enabled = enabled, pressedScale = 0.985f).padding(start = 14.dp, end = 14.dp, top = 6.dp, bottom = 6.dp),verticalAlignment = Alignment.CenterVertically,) {if (icon != null) {Box(- Modifier.size(34.dp).clip(RoundedRectangle(11.dp)).background(accent.copy(alpha = if (c.dark) 0.26f else 0.15f)),+ Modifier.size(30.dp).clip(RoundedRectangle(9.dp))+ .background(androidx.compose.ui.graphics.Brush.verticalGradient(listOf(accent.copy(alpha = 0.86f), accent)))+ .graphicsLayer { alpha = if (enabled) 1f else 0.4f },contentAlignment = Alignment.Center,- ) { Icon(icon, null, tint = if (enabled) accent else accent.copy(alpha = 0.4f), modifier = Modifier.size(19.dp)) }+ ) { Icon(icon, null, tint = Color.White, modifier = Modifier.size(17.dp)) }Spacer(Modifier.width(14.dp))}- val ink = if (danger) Candy.Tomato else if (checked) Candy.Sky else c.ink+ val ink = if (danger) Candy.Tomato else c.inkText(- label, style = ClearType.BodyStrong, color = if (enabled) ink else ink.copy(alpha = 0.38f),- maxLines = 2, overflow = TextOverflow.Ellipsis, modifier = Modifier.weight(1f).padding(vertical = 8.dp),+ label, style = ClearType.Body.copy(fontSize = 16.sp), color = if (enabled) ink else ink.copy(alpha = 0.38f),+ maxLines = 2, overflow = TextOverflow.Ellipsis, modifier = Modifier.weight(1f).padding(vertical = 7.dp),)if (trailing != null) trailing()- if (checked) Icon(LucideIcons.Check, null, tint = Candy.Sky, modifier = Modifier.size(22.dp))- if (chevron) Icon(LucideIcons.ChevronRight, null, tint = c.inkFaint, modifier = Modifier.size(20.dp))+ if (checked) Icon(LucideIcons.Check, null, tint = Candy.Sky, modifier = Modifier.size(21.dp))+ if (chevron) Icon(LucideIcons.ChevronRight, null, tint = c.inkFaint, modifier = Modifier.size(19.dp))}}-/** A sub-sheet's header: a round glass back button and the title. */+/**+ * A small round button on a sheet (back, close, a header action): a soft disc with the glyph, no+ * glass of its own (glass inside the sheet's glass would read as one button stacked on another).+ */+@Composable+fun SheetCircleButton(icon: ImageVector, label: String, onClick: () -> Unit, modifier: Modifier = Modifier, tint: Color = Color.Unspecified, size: Dp = 36.dp) {+ val c = clear+ Box(+ modifier.size(size).clip(CircleShape).background(if (c.dark) Color.White.copy(alpha = 0.10f) else c.ink.copy(alpha = 0.06f))+ .pressable(onClick, pressedScale = 0.88f).semantics { contentDescription = label },+ contentAlignment = Alignment.Center,+ ) { Icon(icon, null, tint = if (tint == Color.Unspecified) c.inkSoft else tint, modifier = Modifier.size(size * 0.5f)) }+}++/**+ * A sheet's header, as iOS 26 sets one: the title centred, a round back button on the left when+ * [onBack], and on the right [trailing], else a round × that closes the sheet.+ */@Composable-fun SheetBackHeader(title: String, onBack: () -> Unit, trailing: (@Composable RowScope.() -> Unit)? = null) {- Row(Modifier.fillMaxWidth().padding(start = 12.dp, end = 10.dp, top = 2.dp, bottom = 8.dp), verticalAlignment = Alignment.CenterVertically) {- GlassCircle(onClick = onBack, size = 40.dp, label = stringResource(R.string.common_back)) { GlassIcon(LucideIcons.ChevronLeft, null, Modifier.size(20.dp)) }- Spacer(Modifier.width(12.dp))- Text(title, style = ClearType.Title, color = clear.ink, modifier = Modifier.weight(1f), maxLines = 1, overflow = TextOverflow.Ellipsis)- if (trailing != null) trailing()+fun SheetHeader(title: String, onBack: (() -> Unit)? = null, subtitle: String? = null, trailing: (@Composable RowScope.() -> Unit)? = null) {+ val c = clear+ val dismiss = LocalSheetDismiss.current+ Row(Modifier.fillMaxWidth().padding(start = 14.dp, end = 14.dp, bottom = 10.dp).heightIn(min = 40.dp), verticalAlignment = Alignment.CenterVertically) {+ Box(Modifier.widthIn(min = 36.dp)) {+ if (onBack != null) SheetCircleButton(LucideIcons.ChevronLeft, stringResource(R.string.common_back), onBack)+ }+ Column(Modifier.weight(1f).padding(horizontal = 8.dp), horizontalAlignment = Alignment.CenterHorizontally) {+ Text(title, style = ClearType.Title.copy(fontSize = 17.sp), color = c.ink, maxLines = 1, overflow = TextOverflow.Ellipsis, textAlign = androidx.compose.ui.text.style.TextAlign.Center)+ if (subtitle != null) Text(subtitle, style = ClearType.Caption, color = c.inkSoft, maxLines = 1, overflow = TextOverflow.Ellipsis)+ }+ Row(Modifier.widthIn(min = 36.dp), horizontalArrangement = Arrangement.spacedBy(8.dp, Alignment.End), verticalAlignment = Alignment.CenterVertically) {+ if (trailing != null) trailing()+ else if (dismiss != null) SheetCircleButton(LucideIcons.X, stringResource(R.string.ui_close_sheet), dismiss)+ }}}-/** A sheet's title, in the headline face. */+/** A sub-sheet's header: back on the left, the title centred. */@Composable-fun SheetTitle(title: String) {- Text(title, style = ClearType.Headline, color = clear.ink, modifier = Modifier.padding(start = 20.dp, end = 20.dp, top = 2.dp, bottom = 12.dp))-}+fun SheetBackHeader(title: String, onBack: () -> Unit, trailing: (@Composable RowScope.() -> Unit)? = null) = SheetHeader(title, onBack, trailing = trailing)++/** A sheet's title, centred, with the round × to close it. */+@Composable+fun SheetTitle(title: String) = SheetHeader(title)/** A hairline between groups of rows. */@Composablefun SheetDivider(inset: Dp = 16.dp, vertical: Dp = 0.dp) {- Box(Modifier.padding(horizontal = inset + 4.dp, vertical = vertical + 4.dp).fillMaxWidth().height(1.dp).background(clear.line))+ Box(Modifier.padding(horizontal = inset + 4.dp, vertical = vertical + 4.dp).fillMaxWidth().height(0.7.dp).background(clear.line))}-/** A divider between groups of rows. */+/** Between groups of rows: air, as iOS leaves between its grouped cells. */@Composable-fun GroupDivider() = SheetDivider(vertical = 4.dp)+fun GroupDivider() = Spacer(Modifier.height(14.dp))-/** A hint over the page ("Drag across the text to highlight it"): a frosted glass capsule that pops in. */+/** A hint over the page ("Drag across the text to highlight it"): a frosted glass capsule that fades in. */@Composablefun BoxScope.HintToast(text: String?, modifier: Modifier = Modifier, alignment: Alignment = Alignment.Center, corner: Dp = 4.dp) {AnimatedVisibility(visible = text != null,modifier = modifier.align(alignment),- enter = fadeIn(tween(150)) + scaleIn(spring(dampingRatio = 0.6f, stiffness = 500f), initialScale = 0.85f),- exit = fadeOut(tween(220)) + scaleOut(tween(220), targetScale = 0.92f),+ enter = fadeIn(Fluid.quick()) + scaleIn(com.chethan616.clearpdf.ui.glass.GlassMotion.morph(), initialScale = 0.88f),+ exit = fadeOut(Fluid.dismiss()) + scaleOut(Fluid.dismiss(), targetScale = 0.96f),) {val last = remember { Last<String>() }if (text != null) last.value = text@@ -379,6 +480,7 @@ fun PdfDialog(list: Boolean = false,content: (@Composable ColumnScope.() -> Unit)? = null,) {+ // the viewer's dialogs are alerts: centred, the buttons side by side across the cardGlassDialog(onDismiss = onDismiss,title = title,@@ -388,6 +490,7 @@ fun PdfDialog(onDismissButton = onDismissButton,confirmEnabled = confirmEnabled,destructive = destructive,+ centered = !list,) {content?.invoke(this)}diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/Theme.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/Theme.ktindex 0774012..0b20d5e 100644--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/Theme.kt+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/Theme.kt@@ -89,13 +89,13 @@ enum class ThemeChoice { System, Light, Dark }private fun pdfColorsFrom(cc: com.chethan616.clearpdf.ui.theme.ClearColors): PdfColors {val candy = com.chethan616.clearpdf.ui.theme.Candyval dark = cc.dark- val surface = if (dark) Color(0xFF121B20) else Color(0xFFF5F7FB)- val raised = if (dark) Color(0xFF1B262C) else Color(0xFFE9EDF4)+ val surface = if (dark) Color(0xFF12132B) else Color(0xFFF5F7FB)+ val raised = if (dark) Color(0xFF1C1D3E) else Color(0xFFE9EDF4)return PdfColors(dark = dark,surface = surface,surfaceRaised = raised,- pressed = if (dark) Color(0xFF24323A) else Color(0xFFDDE3EC),+ pressed = if (dark) Color(0xFF2A2B52) else Color(0xFFDDE3EC),desk = cc.desk,pageEdge = if (dark) Color.Transparent else Color(0x1F000000),text = cc.ink,@@ -109,7 +109,7 @@ private fun pdfColorsFrom(cc: com.chethan616.clearpdf.ui.theme.ClearColors): Pdfbutton = candy.Sky,red = candy.Tomato,scrim = if (dark) Color(0x99000000) else Color(0x55000000),- toast = if (dark) Color(0xFF24323A) else Color(0xFF26324A),+ toast = if (dark) Color(0xFF2A2B52) else Color(0xFF26324A),onToast = Color.White,label = cc.ink,toolAccent = candy.Sky,diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/ToolScreens.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/ToolScreens.ktindex d840489..a3a6078 100644--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/ToolScreens.kt+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/ToolScreens.kt@@ -58,6 +58,9 @@ import androidx.compose.foundation.layout.heightInimport androidx.compose.foundation.layout.widthInimport androidx.compose.ui.draw.drawBehindimport androidx.compose.ui.draw.clip+import androidx.compose.ui.draw.alpha+import com.chethan616.clearpdf.ui.home.chipRowFade+import com.chethan616.clearpdf.ui.glass.glassBarimport androidx.compose.ui.geometry.Offsetimport androidx.compose.ui.geometry.Sizeimport androidx.compose.ui.graphics.Color@@ -100,42 +103,52 @@ fun ToolScaffold(viewerBands: Boolean = false,content: @Composable ColumnScope.() -> Unit,) {- val c = pdfColorsBackHandler(onBack = onBack)- Column(- Modifier.fillMaxSize().background(if (viewerBands) Color.Black else c.surface).safeTopPadding()- .background(if (viewerBands) c.navBand else c.surface).navigationBarsPadding().background(c.surface).imePadding(),- ) {- Row(- Modifier.fillMaxWidth().height(com.chethan616.clearpdf.ui.viewer.TopBarHeight).then(- if (viewerBands) Modifier.drawBehind { drawRect(c.divider, Offset(0f, size.height - 1.dp.toPx()), Size(size.width, 1.dp.toPx())) } else Modifier,- ),- verticalAlignment = Alignment.CenterVertically,- ) {- Box(Modifier.width(56.dp), contentAlignment = Alignment.Center) { BarIcon(LucideIcons.ArrowLeft, stringResource(R.string.common_back), onBack, iconSize = 27.dp) }- Spacer(Modifier.width(16.dp))- Text(title, color = c.label, fontSize = 17.sp, fontWeight = FontWeight.SemiBold, modifier = Modifier.weight(1f))- trailing?.invoke()- }- Column(Modifier.weight(1f).fillMaxWidth(), content = content)- if (action != null) {- Button(- onClick = onAction,- enabled = actionEnabled,- colors = ButtonDefaults.buttonColors(containerColor = c.button, contentColor = Color.White, disabledContainerColor = c.pressed),- shape = RoundedCornerShape(24.dp),- modifier = Modifier.fillMaxWidth().padding(16.dp).height(48.dp),- ) { Text(action, fontWeight = FontWeight.SemiBold, fontSize = 16.sp) }+ GlassToolBackground {+ Column(Modifier.fillMaxSize().safeTopPadding().navigationBarsPadding().imePadding()) {+ Row(+ Modifier.fillMaxWidth().height(com.chethan616.clearpdf.ui.viewer.TopBarHeight).padding(horizontal = 12.dp),+ verticalAlignment = Alignment.CenterVertically,+ ) {+ GlassBack(onBack)+ Spacer(Modifier.width(14.dp))+ Text(title, style = com.chethan616.clearpdf.ui.theme.ClearType.Title, color = com.chethan616.clearpdf.ui.theme.clear.ink, maxLines = 1, overflow = TextOverflow.Ellipsis, modifier = Modifier.weight(1f))+ trailing?.invoke()+ }+ Column(Modifier.weight(1f).fillMaxWidth(), content = content)+ if (action != null) ActionPill(action, actionEnabled, onAction, Modifier.fillMaxWidth().padding(16.dp))}}}+/**+ * A tool's screen stands on the app's own wallpaper (a glass layer of its own), so its glass Back,+ * action and panels refract it and follow Settings ▸ liquid glass and motion like the rest of the app.+ */+@Composable+private fun GlassToolBackground(content: @Composable () -> Unit) {+ com.chethan616.clearpdf.ui.glass.GlassHost(+ Modifier.fillMaxSize(),+ paint = { com.chethan616.clearpdf.ui.glass.Aurora(com.chethan616.clearpdf.ui.glass.AuroraMoods.Tools) },+ ) { content() }+}++/** A tool's Back: the round glass Back of every screen, leaving a beat after the tap. */+@Composable+private fun GlassBack(onBack: () -> Unit) {+ com.chethan616.clearpdf.ui.glass.GlassCircle(+ onClick = com.chethan616.clearpdf.ui.glass.rememberBeat(onBack),+ size = 48.dp,+ label = stringResource(R.string.common_back),+ ) { com.chethan616.clearpdf.ui.glass.GlassIcon(LucideIcons.ChevronLeft, null, Modifier.size(23.dp)) }+}+/** A file as the tools show it: an icon, its name and size. */@Composablefun FileCard(name: String, size: Long?, modifier: Modifier = Modifier, trailing: (@Composable () -> Unit)? = null) {val c = pdfColorsRow(- modifier.fillMaxWidth().padding(horizontal = 16.dp, vertical = 6.dp).clip(RoundedCornerShape(8.dp)).background(c.surfaceRaised).padding(12.dp),+ modifier.fillMaxWidth().padding(horizontal = 16.dp, vertical = 6.dp).then(com.chethan616.clearpdf.ui.glass.washPanel()).padding(12.dp),verticalAlignment = Alignment.CenterVertically,) {PdfBadge()@@ -171,34 +184,46 @@ fun ToolPage(trailing: (@Composable () -> Unit)? = null,content: @Composable ColumnScope.() -> Unit,) {- val c = pdfColorsBackHandler(onBack = onBack)// the keyboard covers the pill rather than lifting it, as the reference's does- Column(Modifier.fillMaxSize().background(c.surface).safeTopPadding().background(c.navBand).navigationBarsPadding().background(c.surface)) {- Row(Modifier.fillMaxWidth().height(com.chethan616.clearpdf.ui.viewer.TopBarHeight), verticalAlignment = Alignment.CenterVertically) {- Box(Modifier.width(56.dp), contentAlignment = Alignment.Center) { BarIcon(LucideIcons.ArrowLeft, stringResource(R.string.common_back), onBack, iconSize = 27.dp) }- Spacer(Modifier.weight(1f))- trailing?.invoke()- Spacer(Modifier.width(8.dp))- }- Text(title, color = c.label, fontSize = 20.sp, fontWeight = FontWeight.SemiBold, modifier = Modifier.padding(start = 24.dp, top = 16.dp, bottom = 14.dp))- Column(Modifier.weight(1f).fillMaxWidth(), content = content)- Row(Modifier.fillMaxWidth().padding(end = 24.dp, bottom = 16.dp, top = 8.dp), horizontalArrangement = Arrangement.End) {- ActionPill(action, actionEnabled, onAction)+ GlassToolBackground {+ Column(Modifier.fillMaxSize().safeTopPadding().navigationBarsPadding()) {+ Row(Modifier.fillMaxWidth().height(com.chethan616.clearpdf.ui.viewer.TopBarHeight).padding(horizontal = 12.dp), verticalAlignment = Alignment.CenterVertically) {+ GlassBack(onBack)+ Spacer(Modifier.weight(1f))+ trailing?.invoke()+ }+ Text(title, style = com.chethan616.clearpdf.ui.theme.ClearType.Headline, color = com.chethan616.clearpdf.ui.theme.clear.hero, modifier = Modifier.padding(start = 24.dp, top = 12.dp, bottom = 14.dp))+ Column(Modifier.weight(1f).fillMaxWidth(), content = content)+ Row(Modifier.fillMaxWidth().padding(end = 24.dp, bottom = 16.dp, top = 8.dp), horizontalArrangement = Arrangement.End) {+ ActionPill(action, actionEnabled, onAction)+ }}}}-/** The blue pill a tool page ends with (grey while it can't be used). */+/** A small action on a tool's screen: a glass chip, faint while it can't be used. */+@Composable+private fun GlassTextButton(onClick: () -> Unit, enabled: Boolean = true, content: @Composable () -> Unit) {+ com.chethan616.clearpdf.ui.glass.GlassChip(+ onClick = { if (enabled) onClick() },+ modifier = Modifier.alpha(if (enabled) 1f else 0.5f),+ height = 42.dp,+ ) { content() }+}++/** The candy glass pill a tool ends with (plain glass, faint, while it can't be used). */@Composablefun ActionPill(label: String, enabled: Boolean, onClick: () -> Unit, modifier: Modifier = Modifier) {- val c = pdfColors- Box(- modifier.heightIn(min = 40.dp).widthIn(min = 90.dp).clip(RoundedCornerShape(20.dp))- .background(if (enabled) c.button else c.pressed).clickable(enabled = enabled, role = androidx.compose.ui.semantics.Role.Button, onClick = onClick)- .padding(horizontal = 22.dp),- contentAlignment = Alignment.Center,- ) { Text(label, color = if (enabled) Color.White else c.textSecondary, fontSize = 16.sp, fontWeight = FontWeight.SemiBold) }+ val c = com.chethan616.clearpdf.ui.theme.clear+ com.chethan616.clearpdf.ui.glass.GlassPill(+ onClick = { if (enabled) onClick() },+ modifier = modifier.widthIn(min = 110.dp),+ tint = if (enabled) com.chethan616.clearpdf.ui.theme.Candy.Sky else Color.Unspecified,+ height = 50.dp,+ horizontalPadding = 24.dp,+ label = label,+ ) { Text(label, style = com.chethan616.clearpdf.ui.theme.ClearType.BodyStrong, color = if (enabled) Color.White else c.inkFaint, maxLines = 1) }}/** The file a tool works on, in an outlined card: a picture of its first page, its name, type and size. */@@ -213,7 +238,7 @@ fun OutlinedFileCard(vm: AppViewModel, doc: OpenDocument) {thumb = runCatching { withContext(eng.thumbnails) { eng.session.renderPage(doc.id, 0u, scale, null).toBitmap().asImageBitmap() } }.getOrNull()}Row(- Modifier.fillMaxWidth().padding(horizontal = 24.dp).clip(RoundedCornerShape(8.dp)).border(1.dp, c.divider, RoundedCornerShape(8.dp)).padding(horizontal = 12.dp, vertical = 12.dp),+ Modifier.fillMaxWidth().padding(horizontal = 24.dp).then(com.chethan616.clearpdf.ui.glass.washPanel()).padding(horizontal = 12.dp, vertical = 12.dp),verticalAlignment = Alignment.CenterVertically,) {Box(Modifier.size(34.dp, 40.dp).background(Color.White)) {@@ -235,7 +260,7 @@ private fun ToolChoice(selected: Boolean, name: String, description: String?, onModifier.fillMaxWidth().clickable(onClick = onClick).padding(start = 8.dp, end = 16.dp, top = if (description == null) 0.dp else 6.dp, bottom = if (description == null) 0.dp else 8.dp),verticalAlignment = if (description == null) Alignment.CenterVertically else Alignment.Top,) {- RadioButton(selected = selected, onClick = onClick, colors = RadioButtonDefaults.colors(selectedColor = c.toolAccent, unselectedColor = c.icon))+ com.chethan616.clearpdf.ui.glass.GlassRadio(selected, onClick, Modifier.padding(top = if (description == null) 0.dp else 4.dp))Column(Modifier.padding(start = 6.dp, top = if (description == null) 0.dp else 10.dp)) {Text(name, color = c.label, fontSize = 16.sp, fontWeight = if (description == null) FontWeight.Normal else FontWeight.SemiBold)if (description != null) {@@ -300,7 +325,11 @@ fun ProtectScreen(vm: AppViewModel, doc: OpenDocument) {val bad = pw.isNotEmpty() && (pw.length !in 6..128 || pw.any { it < '!' || it > '~' })val mismatch = confirm.isNotEmpty() && confirm != pwToolPage(stringResource(R.string.common_tool_set_password), { vm.toolScreen = null }, stringResource(R.string.common_tool_set_password), pw.isNotEmpty() && confirm.isNotEmpty() && !bad && !mismatch, { vm.protect(doc, pw) },- trailing = { BarIcon(LucideIcons.Info, stringResource(R.string.tools_about_passwords), { info = true }) }) {+ trailing = {+ com.chethan616.clearpdf.ui.glass.GlassCircle({ info = true }, size = 44.dp, label = stringResource(R.string.tools_about_passwords)) {+ com.chethan616.clearpdf.ui.glass.GlassIcon(LucideIcons.Info, null, Modifier.size(20.dp))+ }+ }) {Column(Modifier.verticalScroll(rememberScrollState())) {Text(stringResource(R.string.tools_protect_intro), color = c.label, fontSize = 16.sp, modifier = Modifier.padding(horizontal = 24.dp))PasswordField(stringResource(R.string.tools_new_password), pw, { pw = it }, visible, { visible = !visible }, bad, focus)@@ -362,34 +391,26 @@ fun ExportScreen(vm: AppViewModel, doc: OpenDocument) {*/@Composablefun CreateSourcesScreen(vm: AppViewModel) {- val c = pdfColorsval back = { vm.toolScreen = null }- BackHandler(onBack = back)- Column(Modifier.fillMaxSize().background(c.surface).safeTopPadding().background(c.navBand).navigationBarsPadding().background(c.surface)) {- Row(Modifier.fillMaxWidth().height(com.chethan616.clearpdf.ui.viewer.TopBarHeight), verticalAlignment = Alignment.CenterVertically) {- Box(Modifier.width(56.dp), contentAlignment = Alignment.Center) { BarIcon(LucideIcons.ArrowLeft, stringResource(R.string.common_back), back, iconSize = 27.dp) }- Spacer(Modifier.width(4.dp))- Text(stringResource(R.string.tools_create_title), color = c.label, fontSize = 17.sp, fontWeight = FontWeight.SemiBold)- }+ ToolScaffold(stringResource(R.string.tools_create_title), back, action = null, actionEnabled = false, onAction = {}) {Spacer(Modifier.height(8.dp))- SourceRow(LucideIcons.Images, stringResource(R.string.home_photos)) { vm.toolScreen = null; vm.pickPhotosToPdf() }- SourceRow(LucideIcons.FolderOpen, stringResource(R.string.tools_browse_files)) { vm.toolScreen = null; vm.pickFiles(FilePickKind.Create) }- Text(stringResource(R.string.tools_or_make_new), color = c.textSecondary, fontSize = 14.sp, modifier = Modifier.padding(start = 20.dp, top = 20.dp, bottom = 6.dp))- Box(Modifier.padding(horizontal = 16.dp).fillMaxWidth().height(1.dp).background(c.divider))- SourceRow(LucideIcons.Camera, stringResource(R.string.tools_scan_document)) { vm.toolScreen = null; vm.startScan() }+ com.chethan616.clearpdf.ui.glass.WashPanel(Modifier.padding(horizontal = 16.dp).fillMaxWidth()) {+ SourceRow(LucideIcons.Images, stringResource(R.string.home_photos), com.chethan616.clearpdf.ui.theme.Candy.Tangerine) { vm.toolScreen = null; vm.pickPhotosToPdf() }+ SourceRow(LucideIcons.FolderOpen, stringResource(R.string.tools_browse_files), com.chethan616.clearpdf.ui.theme.Candy.Grape) { vm.toolScreen = null; vm.pickFiles(FilePickKind.Create) }+ }+ Text(+ stringResource(R.string.tools_or_make_new).uppercase(), style = com.chethan616.clearpdf.ui.theme.ClearType.Eyebrow,+ color = com.chethan616.clearpdf.ui.theme.clear.inkSoft, modifier = Modifier.padding(start = 26.dp, top = 24.dp, bottom = 8.dp),+ )+ com.chethan616.clearpdf.ui.glass.WashPanel(Modifier.padding(horizontal = 16.dp).fillMaxWidth()) {+ SourceRow(LucideIcons.Camera, stringResource(R.string.tools_scan_document), com.chethan616.clearpdf.ui.theme.Candy.Tomato) { vm.toolScreen = null; vm.startScan() }+ }}}@Composable-private fun SourceRow(icon: androidx.compose.ui.graphics.vector.ImageVector, label: String, onClick: () -> Unit) {- val c = pdfColors- Row(Modifier.fillMaxWidth().clickable(onClick = onClick).padding(horizontal = 16.dp, vertical = 10.dp), verticalAlignment = Alignment.CenterVertically) {- Box(Modifier.size(40.dp).clip(RoundedCornerShape(8.dp)).background(c.pressed), contentAlignment = Alignment.Center) {- Icon(icon, null, tint = c.icon, modifier = Modifier.size(22.dp))- }- Spacer(Modifier.width(16.dp))- Text(label, color = c.label, fontSize = 16.sp)- }+private fun SourceRow(icon: androidx.compose.ui.graphics.vector.ImageVector, label: String, accent: Color, onClick: () -> Unit) {+ com.chethan616.clearpdf.ui.glass.GlassRow(label, onClick, icon = icon, accent = accent)}/** The tool screen that is open. */@@ -425,32 +446,32 @@ fun CombineScreen(vm: AppViewModel) {val dragLabel = stringResource(R.string.tools_drag_to_reorder)val removedMessage = stringResource(R.string.tools_file_removed)BackHandler(onBack = back)- Column(Modifier.fillMaxSize().background(c.surface).safeTopPadding().background(c.navBand).navigationBarsPadding().background(c.surface)) {+ val ink = com.chethan616.clearpdf.ui.theme.clear+ GlassToolBackground {+ Column(Modifier.fillMaxSize().safeTopPadding().navigationBarsPadding()) {Row(- Modifier.fillMaxWidth().height(com.chethan616.clearpdf.ui.viewer.TopBarHeight)- .drawBehind { drawRect(c.divider, Offset(0f, size.height - 1.dp.toPx()), Size(size.width, 1.dp.toPx())) },+ Modifier.fillMaxWidth().height(com.chethan616.clearpdf.ui.viewer.TopBarHeight).padding(horizontal = 12.dp),verticalAlignment = Alignment.CenterVertically,) {- Box(Modifier.width(56.dp), contentAlignment = Alignment.Center) { BarIcon(LucideIcons.ArrowLeft, stringResource(R.string.common_back), back, iconSize = 27.dp) }- Spacer(Modifier.width(4.dp))+ GlassBack(back)+ Spacer(Modifier.width(14.dp))Text(if (files.size > 1) pluralStringResource(R.plurals.tools_file_count, files.size, files.size) else stringResource(R.string.common_tool_combine),- color = c.label, fontSize = 17.sp, fontWeight = FontWeight.SemiBold, modifier = Modifier.weight(1f),+ style = com.chethan616.clearpdf.ui.theme.ClearType.Title, color = ink.ink, maxLines = 1, modifier = Modifier.weight(1f),)- Box(- Modifier.padding(end = 20.dp).height(36.dp).clip(RoundedCornerShape(18.dp)).border(2.dp, c.label, RoundedCornerShape(18.dp))- .clickable { vm.pickFiles(FilePickKind.Combine) }.padding(horizontal = 16.dp),- contentAlignment = Alignment.Center,- ) { Text(stringResource(R.string.tools_add_files), color = c.label, fontSize = 16.sp, fontWeight = FontWeight.SemiBold) }+ com.chethan616.clearpdf.ui.glass.GlassPill(onClick = { vm.pickFiles(FilePickKind.Combine) }, height = 44.dp) {+ com.chethan616.clearpdf.ui.glass.GlassIcon(LucideIcons.Plus, null, Modifier.size(18.dp))+ Text(stringResource(R.string.tools_add_files), style = com.chethan616.clearpdf.ui.theme.ClearType.BodyStrong, color = ink.ink, maxLines = 1)+ }}if (files.size > 12) Text(stringResource(R.string.tools_combine_too_many), color = c.red, fontSize = 13.sp, modifier = Modifier.padding(horizontal = 20.dp, vertical = 8.dp))- LazyColumn(Modifier.fillMaxWidth().weight(1f).padding(horizontal = 8.dp)) {+ LazyColumn(Modifier.fillMaxWidth().weight(1f).padding(horizontal = 16.dp), verticalArrangement = Arrangement.spacedBy(8.dp), contentPadding = androidx.compose.foundation.layout.PaddingValues(vertical = 8.dp)) {itemsIndexed(files, key = { _, f -> f.uri.toString() }) { i, f ->Row(- Modifier.fillMaxWidth().height(58.dp)+ Modifier.fillMaxWidth().height(62.dp).offset { IntOffset(0, if (dragIndex == i) dragOffset.roundToInt() else 0) }- .background(if (dragIndex == i) c.pressed else Color.Transparent)- .drawBehind { drawRect(c.divider, Offset(8.dp.toPx(), size.height - 1.dp.toPx()), Size(size.width - 16.dp.toPx(), 1.dp.toPx())) },+ .then(com.chethan616.clearpdf.ui.glass.washPanel())+ .then(if (dragIndex == i) Modifier.border(2.dp, com.chethan616.clearpdf.ui.theme.Candy.Sky, com.kyant.shapes.RoundedRectangle(20.dp)) else Modifier),verticalAlignment = Alignment.CenterVertically,) {Box(@@ -473,20 +494,19 @@ fun CombineScreen(vm: AppViewModel) {}}.semantics { contentDescription = dragLabel },contentAlignment = Alignment.Center,- ) { Icon(LucideIcons.GripVertical, null, tint = c.icon, modifier = Modifier.size(20.dp)) }+ ) { Icon(LucideIcons.GripVertical, null, tint = ink.inkSoft, modifier = Modifier.size(20.dp)) }Column(Modifier.weight(1f)) {- Text(f.name.substringBeforeLast('.'), color = c.label, fontSize = 17.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)- Text(listOfNotNull(f.name.substringAfterLast('.', "").uppercase(), f.size?.let { formatSize(it) }).joinToString(" • "), color = c.text, fontSize = 14.sp)+ Text(f.name.substringBeforeLast('.'), style = com.chethan616.clearpdf.ui.theme.ClearType.BodyStrong, color = ink.ink, maxLines = 1, overflow = TextOverflow.Ellipsis)+ Text(listOfNotNull(f.name.substringAfterLast('.', "").uppercase(), f.size?.let { formatSize(it) }).joinToString(" • "), style = com.chethan616.clearpdf.ui.theme.ClearType.Caption, color = ink.inkSoft)+ }+ com.chethan616.clearpdf.ui.glass.GlassCircle(onClick = { files.remove(f); vm.tell(removedMessage) }, size = 38.dp, label = stringResource(R.string.tools_remove_file, f.name)) {+ com.chethan616.clearpdf.ui.glass.GlassIcon(LucideIcons.Minus, null, Modifier.size(18.dp), tint = com.chethan616.clearpdf.ui.theme.Candy.Tomato)}- BarIcon(LucideIcons.CircleMinus, stringResource(R.string.tools_remove_file, f.name), { files.remove(f); vm.tell(removedMessage) })+ Spacer(Modifier.width(10.dp))}}}- Box(- Modifier.fillMaxWidth().padding(horizontal = 10.dp, vertical = 12.dp).height(42.dp).clip(RoundedCornerShape(21.dp))- .background(if (ok) c.button else c.pressed).clickable(enabled = ok) { naming = true },- contentAlignment = Alignment.Center,- ) { Text(stringResource(R.string.tools_combine_as_pdf), color = if (ok) Color.White else c.textSecondary, fontSize = 17.sp, fontWeight = FontWeight.SemiBold) }+ ActionPill(stringResource(R.string.tools_combine_as_pdf), ok, { naming = true }, Modifier.fillMaxWidth().padding(16.dp))if (naming) {var name by remember { mutableStateOf("Combine " + java.text.DateFormat.getDateInstance(java.text.DateFormat.LONG).format(java.util.Date())) }val focus = remember { androidx.compose.ui.focus.FocusRequester() }@@ -497,6 +517,7 @@ fun CombineScreen(vm: AppViewModel) {) { PdfField(name, { name = it }, stringResource(R.string.common_file_name), focus = focus) }}}+ }}@@ -531,15 +552,12 @@ fun CropScreen(vm: AppViewModel, doc: OpenDocument) {ToolScaffold(stringResource(if (allPages) R.string.tools_all_pages else R.string.tools_current_page), { vm.toolScreen = null }, null, false, {},viewerBands = true,trailing = {- Text(- stringResource(R.string.common_save), color = if (changed) c.label else c.textSecondary.copy(alpha = 0.5f), fontSize = 17.sp,- modifier = Modifier.clickable(enabled = changed) {- val info = p ?: return@clickable- vm.crop(doc, if (allPages) null else page, floatArrayOf(rect[0] * info.width, rect[1] * info.height, rect[2] * info.width, rect[3] * info.height))- }.padding(horizontal = 16.dp, vertical = 12.dp),- )+ ActionPill(stringResource(R.string.common_save), changed, {+ val info = p ?: return@ActionPill+ vm.crop(doc, if (allPages) null else page, floatArrayOf(rect[0] * info.width, rect[1] * info.height, rect[2] * info.width, rect[3] * info.height))+ })}) {- BoxWithConstraints(Modifier.weight(1f).fillMaxWidth().background(c.desk), contentAlignment = Alignment.Center) {+ BoxWithConstraints(Modifier.weight(1f).fillMaxWidth().padding(horizontal = 16.dp, vertical = 8.dp).then(com.chethan616.clearpdf.ui.glass.washPanel()), contentAlignment = Alignment.Center) {val info = p ?: return@BoxWithConstraintsval ratio = info.width / info.height.coerceAtLeast(1f)// the page sits 32 dp in from the sides; touches are taken a margin beyond its edges@@ -634,22 +652,29 @@ fun CropScreen(vm: AppViewModel, doc: OpenDocument) {}}// the page in a grey pill (with arrows to step through the pages when cropping them all)- Row(Modifier.fillMaxWidth().background(c.desk).height(88.dp), verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.Center) {- if (allPages) BarIcon(LucideIcons.ChevronLeft, stringResource(R.string.tools_previous_page), { page = (page - 1).coerceAtLeast(0) }, enabled = page > 0)+ // the page in a glass pill, glass arrows either side when cropping them all+ val ink = com.chethan616.clearpdf.ui.theme.clear+ Row(Modifier.fillMaxWidth().height(76.dp), verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(12.dp, Alignment.CenterHorizontally)) {+ if (allPages) com.chethan616.clearpdf.ui.glass.GlassCircle({ page = (page - 1).coerceAtLeast(0) }, size = 44.dp, label = stringResource(R.string.tools_previous_page)) {+ com.chethan616.clearpdf.ui.glass.GlassIcon(LucideIcons.ChevronLeft, null, Modifier.size(20.dp).alpha(if (page > 0) 1f else 0.35f))+ }Box(- Modifier.widthIn(min = 102.dp).height(32.dp).clip(RoundedCornerShape(16.dp)).background(Color(0xFFD1D1D1)).padding(horizontal = 16.dp),+ Modifier.widthIn(min = 110.dp).height(40.dp).glassBar().padding(horizontal = 18.dp),contentAlignment = Alignment.Center,- ) { Text(stringResource(R.string.tools_page_number, page + 1), color = Color(0xFF2C2C2C), fontSize = 15.sp) }- if (allPages) BarIcon(LucideIcons.ChevronRight, stringResource(R.string.tools_next_page), { page = (page + 1).coerceAtMost(doc.pageCount - 1) }, enabled = page < doc.pageCount - 1)+ ) { Text(stringResource(R.string.tools_page_number, page + 1), style = com.chethan616.clearpdf.ui.theme.ClearType.BodyStrong, color = ink.ink) }+ if (allPages) com.chethan616.clearpdf.ui.glass.GlassCircle({ page = (page + 1).coerceAtMost(doc.pageCount - 1) }, size = 44.dp, label = stringResource(R.string.tools_next_page)) {+ com.chethan616.clearpdf.ui.glass.GlassIcon(LucideIcons.ChevronRight, null, Modifier.size(20.dp).alpha(if (page < doc.pageCount - 1) 1f else 0.35f))+ }}- Row(Modifier.fillMaxWidth().height(54.dp).background(c.surface).padding(start = 12.dp, end = 4.dp), verticalAlignment = Alignment.CenterVertically) {- PdfSwitch(allPages, { allPages = it })- Spacer(Modifier.width(16.dp))- Text(stringResource(R.string.tools_all_pages), color = c.label, fontSize = 16.sp, modifier = Modifier.weight(1f))- Text(- stringResource(R.string.tools_reset), color = if (changed) c.label else c.textSecondary.copy(alpha = 0.5f), fontSize = 16.sp,- modifier = Modifier.clickable(enabled = changed) { rect = floatArrayOf(0f, 0f, 1f, 1f) }.padding(horizontal = 12.dp, vertical = 12.dp),- )+ com.chethan616.clearpdf.ui.glass.WashPanel(Modifier.padding(horizontal = 16.dp, vertical = 6.dp).fillMaxWidth()) {+ Row(Modifier.fillMaxWidth().height(58.dp).padding(start = 18.dp, end = 10.dp), verticalAlignment = Alignment.CenterVertically) {+ Text(stringResource(R.string.tools_all_pages), style = com.chethan616.clearpdf.ui.theme.ClearType.BodyStrong, color = ink.ink, modifier = Modifier.weight(1f))+ com.chethan616.clearpdf.ui.glass.GlassToggle(allPages, { allPages = it })+ Spacer(Modifier.width(10.dp))+ com.chethan616.clearpdf.ui.glass.GlassPill(onClick = { if (changed) rect = floatArrayOf(0f, 0f, 1f, 1f) }, height = 40.dp, horizontalPadding = 14.dp) {+ Text(stringResource(R.string.tools_reset), style = com.chethan616.clearpdf.ui.theme.ClearType.BodyStrong, color = if (changed) ink.ink else ink.inkFaint)+ }+ }}}}@@ -706,17 +731,19 @@ fun ScanScreen(vm: AppViewModel) {if (vm.insertScanAt == null && vm.scanName.isNotBlank()) {val nameLabel = stringResource(R.string.tools_scan_name_description, vm.scanName)Row(- Modifier.fillMaxWidth().clickable { naming = true }.padding(horizontal = 16.dp, vertical = 10.dp).semantics { contentDescription = nameLabel },+ Modifier.padding(horizontal = 16.dp, vertical = 4.dp).fillMaxWidth().then(com.chethan616.clearpdf.ui.glass.washPanel())+ .clickable { naming = true }+ .padding(horizontal = 16.dp, vertical = 12.dp).semantics { contentDescription = nameLabel },verticalAlignment = Alignment.CenterVertically,) {- Icon(LucideIcons.FileText, null, tint = c.icon, modifier = Modifier.size(20.dp))+ com.chethan616.clearpdf.ui.glass.GlassIcon(LucideIcons.FileText, null, Modifier.size(20.dp))Spacer(Modifier.width(12.dp))- Text(vm.scanName, color = c.text, fontSize = 15.sp, maxLines = 1, overflow = TextOverflow.Ellipsis, modifier = Modifier.weight(1f))+ Text(vm.scanName, style = com.chethan616.clearpdf.ui.theme.ClearType.BodyStrong, color = com.chethan616.clearpdf.ui.theme.clear.ink, maxLines = 1, overflow = TextOverflow.Ellipsis, modifier = Modifier.weight(1f))Spacer(Modifier.width(12.dp))- Icon(LucideIcons.Pencil, null, tint = c.icon, modifier = Modifier.size(20.dp))+ com.chethan616.clearpdf.ui.glass.GlassIcon(LucideIcons.Pencil, null, Modifier.size(18.dp))}}- Box(Modifier.weight(1f).fillMaxWidth().background(c.desk), contentAlignment = Alignment.Center) {+ Box(Modifier.weight(1f).fillMaxWidth().padding(horizontal = 16.dp, vertical = 8.dp).then(com.chethan616.clearpdf.ui.glass.washPanel()), contentAlignment = Alignment.Center) {val page = pages.getOrNull(current.coerceAtMost(pages.lastIndex))if (page != null) {ScanPhoto(page.thumb, page.corners, Modifier.fillMaxSize())@@ -724,26 +751,44 @@ fun ScanScreen(vm: AppViewModel) {Text(stringResource(R.string.tools_scan_empty), color = c.textSecondary)}}- Row(Modifier.fillMaxWidth().horizontalScroll(rememberScrollState()).padding(8.dp), horizontalArrangement = Arrangement.spacedBy(8.dp)) {+ val ink = com.chethan616.clearpdf.ui.theme.clear.ink+ Row(+ Modifier.fillMaxWidth().horizontalScroll(rememberScrollState()).padding(horizontal = 16.dp, vertical = 8.dp),+ horizontalArrangement = Arrangement.spacedBy(10.dp), verticalAlignment = Alignment.CenterVertically,+ ) {pages.forEachIndexed { i, p ->- Image(p.thumb, stringResource(R.string.tools_page_number, i + 1), modifier = Modifier.size(56.dp, 72.dp).clip(RoundedCornerShape(4.dp)).border(2.dp, if (i == current) c.accent else Color.Transparent, RoundedCornerShape(4.dp)).clickable { current = i }, contentScale = ContentScale.Crop)+ Image(+ p.thumb, stringResource(R.string.tools_page_number, i + 1),+ modifier = Modifier.size(56.dp, 72.dp).clip(com.kyant.shapes.RoundedRectangle(12.dp))+ .border(2.5.dp, if (i == current) com.chethan616.clearpdf.ui.theme.Candy.Sky else Color.Transparent, com.kyant.shapes.RoundedRectangle(12.dp))+ .clickable { current = i },+ contentScale = ContentScale.Crop,+ )}- Box(Modifier.size(56.dp, 72.dp).clip(RoundedCornerShape(4.dp)).background(c.surfaceRaised).clickable { vm.takeScanPhoto() }.semantics { contentDescription = addPageLabel }, contentAlignment = Alignment.Center) {- Icon(LucideIcons.Plus, null, tint = c.icon)+ com.chethan616.clearpdf.ui.glass.GlassCircle(onClick = { vm.takeScanPhoto() }, size = 56.dp, label = addPageLabel) {+ com.chethan616.clearpdf.ui.glass.GlassIcon(LucideIcons.Plus, null, Modifier.size(24.dp))}}- Row(Modifier.fillMaxWidth().horizontalScroll(rememberScrollState()).padding(horizontal = 8.dp), horizontalArrangement = Arrangement.spacedBy(6.dp)) {- ScanFilter.entries.forEach { f ->- Text(- stringResource(f.label), color = if (f == filter) c.accent else c.text, fontSize = 14.sp,- modifier = Modifier.clip(CircleShape).background(if (f == filter) c.pressed else Color.Transparent).clickable { filter = f }.padding(horizontal = 14.dp, vertical = 8.dp),- )- }+ // the looks, as the desk's filter chips+ Row(+ Modifier.fillMaxWidth().chipRowFade().horizontalScroll(rememberScrollState()).padding(horizontal = 20.dp, vertical = 4.dp),+ horizontalArrangement = Arrangement.spacedBy(10.dp),+ ) {+ ScanFilter.entries.forEach { f -> com.chethan616.clearpdf.ui.home.DeskChip(stringResource(f.label), f == filter) { filter = f } }}- Row(Modifier.fillMaxWidth().padding(8.dp), horizontalArrangement = Arrangement.SpaceEvenly) {- TextButton(onClick = { vm.retakeScan(current) }, enabled = pages.isNotEmpty()) { Text(stringResource(R.string.tools_retake), color = c.accent) }- TextButton(onClick = { cropping = pages.getOrNull(current.coerceAtMost(pages.lastIndex))?.file }, enabled = pages.isNotEmpty()) { Text(stringResource(R.string.tools_crop), color = c.accent) }- TextButton(onClick = { if (pages.isNotEmpty()) { pages.removeAt(current.coerceAtMost(pages.lastIndex)); current = (current - 1).coerceAtLeast(0) } }, enabled = pages.isNotEmpty()) { Text(stringResource(R.string.common_delete), color = c.accent) }+ Row(Modifier.fillMaxWidth().padding(horizontal = 16.dp, vertical = 8.dp), horizontalArrangement = Arrangement.spacedBy(10.dp, Alignment.CenterHorizontally)) {+ GlassTextButton(onClick = { vm.retakeScan(current) }, enabled = pages.isNotEmpty()) {+ com.chethan616.clearpdf.ui.glass.GlassIcon(LucideIcons.Camera, null, Modifier.size(18.dp))+ Text(stringResource(R.string.tools_retake), color = ink)+ }+ GlassTextButton(onClick = { cropping = pages.getOrNull(current.coerceAtMost(pages.lastIndex))?.file }, enabled = pages.isNotEmpty()) {+ com.chethan616.clearpdf.ui.glass.GlassIcon(LucideIcons.Crop, null, Modifier.size(18.dp))+ Text(stringResource(R.string.tools_crop), color = ink)+ }+ GlassTextButton(onClick = { if (pages.isNotEmpty()) { pages.removeAt(current.coerceAtMost(pages.lastIndex)); current = (current - 1).coerceAtLeast(0) } }, enabled = pages.isNotEmpty()) {+ com.chethan616.clearpdf.ui.glass.GlassIcon(LucideIcons.Trash2, null, Modifier.size(18.dp), tint = com.chethan616.clearpdf.ui.theme.Candy.Tomato)+ Text(stringResource(R.string.common_delete), color = ink)+ }}}if (naming) {@@ -766,12 +811,19 @@ private fun ScanCrop(page: ScanPage, onDone: (FloatArray) -> Unit, onCancel: ()val c = pdfColorsvar corners by remember(page.file) { mutableStateOf(page.corners) }ToolScaffold(stringResource(R.string.tools_crop), onCancel, stringResource(R.string.common_done), true, { onDone(corners) }) {- Box(Modifier.weight(1f).fillMaxWidth().background(c.desk)) {+ Box(Modifier.weight(1f).fillMaxWidth().padding(horizontal = 16.dp, vertical = 8.dp).then(com.chethan616.clearpdf.ui.glass.washPanel())) {ScanPhoto(page.thumb, corners, Modifier.fillMaxSize(), onMove = { corners = it })}- Row(Modifier.fillMaxWidth().padding(8.dp), horizontalArrangement = Arrangement.SpaceEvenly) {- TextButton(onClick = { page.found?.let { corners = it } }, enabled = page.found != null) { Text(stringResource(R.string.tools_auto_detect), color = if (page.found != null) c.accent else c.textSecondary) }- TextButton(onClick = { corners = ScanPage.WHOLE }) { Text(stringResource(R.string.tools_no_crop), color = c.accent) }+ val ink = com.chethan616.clearpdf.ui.theme.clear.ink+ Row(Modifier.fillMaxWidth().padding(horizontal = 16.dp, vertical = 8.dp), horizontalArrangement = Arrangement.spacedBy(10.dp, Alignment.CenterHorizontally)) {+ GlassTextButton(onClick = { page.found?.let { corners = it } }, enabled = page.found != null) {+ com.chethan616.clearpdf.ui.glass.GlassIcon(LucideIcons.Sparkles, null, Modifier.size(18.dp))+ Text(stringResource(R.string.tools_auto_detect), color = ink)+ }+ GlassTextButton(onClick = { corners = ScanPage.WHOLE }) {+ com.chethan616.clearpdf.ui.glass.GlassIcon(LucideIcons.Maximize, null, Modifier.size(18.dp))+ Text(stringResource(R.string.tools_no_crop), color = ink)+ }}}}diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/desk/Common.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/desk/Common.ktindex 276ab2e..7cb9aba 100644--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/desk/Common.kt+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/desk/Common.kt@@ -37,6 +37,7 @@ import androidx.compose.ui.graphics.asImageBitmapimport androidx.compose.ui.graphics.vector.ImageVectorimport androidx.compose.ui.layout.ContentScaleimport androidx.compose.ui.res.stringResource+import androidx.compose.ui.text.TextStyleimport androidx.compose.ui.text.style.TextAlignimport androidx.compose.ui.text.style.TextOverflowimport androidx.compose.ui.unit.Dp@@ -65,6 +66,7 @@ import com.chethan616.clearpdf.ui.theme.glowingimport com.chethan616.clearpdf.ui.viewer.formatSizeimport com.kyant.shapes.RoundedRectangleimport kotlinx.coroutines.Dispatchers+import kotlinx.coroutines.launchimport kotlinx.coroutines.withContext/** A tool as the desk and the Tools tab show it: one candy colour everywhere it appears. */@@ -137,13 +139,18 @@ val DockClearance = 40.dp* caps [eyebrow], the [title] large and white on the sky, and [trailing] controls.*/@Composable-fun ScreenHeader(eyebrow: String?, title: String, modifier: Modifier = Modifier, onBack: (() -> Unit)? = null, trailing: @Composable () -> Unit = {}) {+fun ScreenHeader(eyebrow: String?, title: String, modifier: Modifier = Modifier, onBack: (() -> Unit)? = null, titleStyle: TextStyle = ClearType.Display, trailing: @Composable () -> Unit = {}) {val c = clearColumn(modifier.fillMaxWidth().padding(start = 16.dp, end = 16.dp)) {if (onBack != null) {Row(Modifier.fillMaxWidth().padding(bottom = 18.dp), verticalAlignment = Alignment.CenterVertically) {- GlassCircle(onClick = onBack, size = 54.dp, surface = c.capsule, label = stringResource(R.string.common_back)) {- GlassIcon(LucideIcons.ChevronLeft, null, Modifier.size(24.dp), tint = Color.White)+ // the same plain glass as every glass button (it was a dark, ringed disc). The screen+ // leaves a beat after the tap, so the glass is seen to swell and spring back first+ com.chethan616.clearpdf.ui.glass.HeaderGlassButton(+ onClick = com.chethan616.clearpdf.ui.glass.rememberBeat(onBack),+ label = stringResource(R.string.common_back),+ ) {+ GlassIcon(LucideIcons.ChevronLeft, null, Modifier.size(24.dp))}Spacer(Modifier.weight(1f))Row(horizontalArrangement = Arrangement.spacedBy(8.dp), verticalAlignment = Alignment.CenterVertically) { trailing() }@@ -155,7 +162,7 @@ fun ScreenHeader(eyebrow: String?, title: String, modifier: Modifier = Modifier,Text(eyebrow.uppercase(), style = ClearType.Eyebrow, color = c.hero.copy(alpha = 0.85f))Spacer(Modifier.height(6.dp))}- Text(title, style = ClearType.Display.copy(color = c.hero).glowing(c))+ Text(title, style = titleStyle.copy(color = c.hero).glowing(c))}if (onBack == null) Row(horizontalArrangement = Arrangement.spacedBy(8.dp), verticalAlignment = Alignment.CenterVertically) { trailing() }}diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/desk/FilesScreen.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/desk/FilesScreen.ktindex 24a1307..f9cdafb 100644--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/desk/FilesScreen.kt+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/desk/FilesScreen.kt@@ -125,11 +125,10 @@ fun FilesScreen(vm: AppViewModel, onBrowse: () -> Unit) {SelectionHeader(vm, recent = tab == 0) { confirmDelete = true }} else {ScreenHeader(pluralStringResource(R.plurals.files_count, rows.size, rows.size), stringResource(R.string.home_tab_files), onBack = { vm.homeTab = HomeTab.Home }) {- GlassCircle(- onClick = { menuOpen = true }, size = 54.dp, surface = Color.White.copy(alpha = 0.16f),+ com.chethan616.clearpdf.ui.glass.HeaderGlassButton(+ onClick = { menuOpen = true }, label = stringResource(R.string.common_more_options),modifier = Modifier.onGloballyPositioned { menuAnchor = it.boundsInWindow() },- label = stringResource(R.string.common_more_options),- ) { GlassIcon(LucideIcons.Ellipsis, null, Modifier.size(22.dp), tint = clear.hero) }+ ) { GlassIcon(LucideIcons.Ellipsis, null, Modifier.size(22.dp)) }}}}diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/desk/GlassMotionSettings.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/desk/GlassMotionSettings.ktnew file mode 100644index 0000000..4f6cd9d--- /dev/null+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/desk/GlassMotionSettings.kt@@ -0,0 +1,416 @@+package com.chethan616.clearpdf.ui.desk++import androidx.compose.animation.core.Animatable+import androidx.compose.animation.core.LinearEasing+import androidx.compose.animation.core.tween+import androidx.compose.foundation.Canvas+import androidx.compose.foundation.gestures.detectDragGestures+import androidx.compose.foundation.gestures.detectTapGestures+import androidx.compose.foundation.layout.Arrangement+import androidx.compose.foundation.layout.BoxWithConstraints+import androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.PaddingValues+import androidx.compose.foundation.layout.Row+import androidx.compose.foundation.layout.Spacer+import androidx.compose.foundation.layout.WindowInsets+import androidx.compose.foundation.layout.fillMaxSize+import androidx.compose.foundation.layout.fillMaxWidth+import androidx.compose.foundation.layout.height+import androidx.compose.foundation.layout.navigationBars+import androidx.compose.foundation.layout.padding+import androidx.compose.foundation.layout.size+import androidx.compose.foundation.layout.statusBars+import androidx.compose.foundation.layout.windowInsetsBottomHeight+import androidx.compose.foundation.layout.windowInsetsTopHeight+import androidx.compose.foundation.lazy.LazyColumn+import androidx.compose.foundation.lazy.LazyRow+import androidx.compose.foundation.lazy.itemsIndexed+import androidx.compose.material3.Text+import androidx.compose.runtime.Composable+import androidx.compose.runtime.LaunchedEffect+import androidx.compose.runtime.getValue+import androidx.compose.runtime.mutableStateOf+import androidx.compose.runtime.remember+import androidx.compose.runtime.rememberUpdatedState+import androidx.compose.runtime.setValue+import androidx.compose.ui.Alignment+import androidx.compose.ui.Modifier+import androidx.compose.ui.geometry.CornerRadius+import androidx.compose.ui.geometry.Offset+import androidx.compose.ui.geometry.Size+import androidx.compose.ui.graphics.Color+import androidx.compose.ui.graphics.Path+import androidx.compose.ui.graphics.PathEffect+import androidx.compose.ui.graphics.StrokeCap+import androidx.compose.ui.graphics.drawscope.Stroke+import androidx.compose.ui.input.pointer.pointerInput+import androidx.compose.ui.platform.LocalContext+import androidx.compose.ui.res.stringResource+import androidx.compose.ui.text.font.FontFamily+import androidx.compose.ui.unit.dp+import androidx.compose.ui.unit.sp+import com.chethan616.clearpdf.R+import com.chethan616.clearpdf.ui.home.chipRowFade+import com.chethan616.clearpdf.ui.glass.EaseCurve+import com.chethan616.clearpdf.ui.glass.GlassCard+import com.chethan616.clearpdf.ui.glass.GlassChip+import com.chethan616.clearpdf.ui.glass.GlassCircle+import com.chethan616.clearpdf.ui.glass.GlassIcon+import com.chethan616.clearpdf.ui.glass.GlassPill+import com.chethan616.clearpdf.ui.glass.GlassSettings+import com.chethan616.clearpdf.ui.glass.GlassSlider+import com.chethan616.clearpdf.ui.glass.GlassStyle+import com.chethan616.clearpdf.ui.glass.GlassTab+import com.chethan616.clearpdf.ui.glass.GlassTabs+import com.chethan616.clearpdf.ui.glass.GlassToggle+import com.chethan616.clearpdf.ui.glass.MotionSettings+import com.chethan616.clearpdf.ui.glass.MotionStyle+import com.chethan616.clearpdf.ui.LucideIcons+import com.chethan616.clearpdf.ui.theme.Candy+import com.chethan616.clearpdf.ui.theme.ClearType+import com.chethan616.clearpdf.ui.theme.clear+import com.kyant.shapes.RoundedRectangle+import java.util.Locale+import kotlin.math.cos+import kotlin.math.exp+import kotlin.math.hypot+import kotlin.math.ln+import kotlin.math.min+import kotlin.math.sin+import kotlin.math.sqrt+import kotlinx.coroutines.delay++/**+ * Settings ▸ Liquid glass & motion: a live stage of glass controls, then everything about the glass+ * (style and each of its values), the glass spring (a graph of how it moves, and its six values) and+ * the screens' curve (an editor with two handles, presets, and the pace), each graph playing on a loop.+ */+@Composable+fun GlassMotionPage(onBack: () -> Unit) {+ val context = LocalContext.current+ val g = GlassSettings.style+ val m = MotionSettings.style+ fun glass(s: GlassStyle) = GlassSettings.update(context, s)+ fun motion(s: MotionStyle) = MotionSettings.update(context, s)+ LazyColumn(Modifier.fillMaxSize(), contentPadding = PaddingValues(bottom = 32.dp)) {+ item { Spacer(Modifier.windowInsetsTopHeight(WindowInsets.statusBars)) }+ item(key = "title") {+ Spacer(Modifier.height(14.dp))+ ScreenHeader(null, stringResource(R.string.settings_glass_motion), onBack = onBack)+ }+ item(key = "stage") { PreviewStage() }++ item(key = "glass") { Section(stringResource(R.string.gm_glass_look), custom = g !in GlassStyle.Presets) }+ item(key = "glasstabs") {+ GlassTabs(+ glassPresetNames().mapIndexed { i, n -> GlassTab(n, accent = listOf(Candy.Sky, Candy.Mint, Candy.Grape, Candy.Tangerine)[i]) },+ selected = GlassStyle.Presets.indexOf(g).coerceAtLeast(0), onSelect = { glass(GlassStyle.Presets[it]) },+ modifier = Modifier.padding(horizontal = 16.dp).fillMaxWidth(), height = 48.dp,+ )+ }+ item(key = "glassvalues") {+ Panel {+ SliderRow(stringResource(R.string.gm_blur), g.blur, 0f..3f, Candy.Sky) { glass(g.copy(blur = it)) }+ SliderRow(stringResource(R.string.gm_lens_height), g.refractionHeight, 0f..2.5f, Candy.Grape) { glass(g.copy(refractionHeight = it)) }+ SliderRow(stringResource(R.string.gm_lens_amount), g.refractionAmount, 0f..2.5f, Candy.Grape) { glass(g.copy(refractionAmount = it)) }+ SliderRow(stringResource(R.string.gm_tint), g.tint, 0f..2.5f, Candy.Mint) { glass(g.copy(tint = it)) }+ SliderRow(stringResource(R.string.gm_saturation), g.saturation, 0.5f..2.5f, Candy.Bubblegum) { glass(g.copy(saturation = it)) }+ SliderRow(stringResource(R.string.gm_brightness), g.brightness, -0.3f..0.3f, Candy.Lemon) { glass(g.copy(brightness = it)) }+ SliderRow(stringResource(R.string.gm_highlight), g.highlight, 0f..2f, Candy.Tangerine) { glass(g.copy(highlight = it)) }+ ToggleRow(LucideIcons.Layers, Candy.Sky, stringResource(R.string.gm_depth), null, g.depthEffect) { glass(g.copy(depthEffect = it)) }+ ToggleRow(LucideIcons.Sparkles, Candy.Grape, stringResource(R.string.gm_chromatic), null, g.chromaticAberration) { glass(g.copy(chromaticAberration = it)) }+ }+ }++ item(key = "motion") { Section(stringResource(R.string.settings_motion), custom = m !in MotionStyle.Presets) }+ item(key = "motiontabs") {+ GlassTabs(+ motionPresetNames().mapIndexed { i, n -> GlassTab(n, accent = listOf(Candy.Mint, Candy.Sky, Candy.Bubblegum, Candy.Tomato)[i]) },+ selected = MotionStyle.Presets.indexOf(m).coerceAtLeast(0), onSelect = { motion(MotionStyle.Presets[it]) },+ modifier = Modifier.padding(horizontal = 16.dp).fillMaxWidth(), height = 48.dp,+ )+ }+ item(key = "spring") {+ GraphCard(stringResource(R.string.gm_spring), stringResource(R.string.gm_spring_body)) { SpringGraph() }+ }+ item(key = "motionvalues") {+ Panel {+ SliderRow(stringResource(R.string.gm_bounce), m.bounce, 0f..1f, Candy.Bubblegum) { motion(m.copy(bounce = it)) }+ SliderRow(stringResource(R.string.gm_speed), m.speed, 0.4f..2.5f, Candy.Sky, times) { motion(m.copy(speed = it)) }+ SliderRow(stringResource(R.string.gm_press), m.press, 0f..2.5f, Candy.Grape, times) { motion(m.copy(press = it)) }+ SliderRow(stringResource(R.string.gm_wobble), m.wobble, 0f..3f, Candy.Tomato, times) { motion(m.copy(wobble = it)) }+ SliderRow(stringResource(R.string.gm_stretch), m.stretch, 0f..1.6f, Candy.Mint, times) { motion(m.copy(stretch = it)) }+ SliderRow(stringResource(R.string.gm_bloom), m.bloom, 0f..2.5f, Candy.Tangerine, times) { motion(m.copy(bloom = it)) }+ }+ }++ item(key = "transitions") { Section(stringResource(R.string.gm_transitions), custom = MotionSettings.curve !in EaseCurve.Presets) }+ item(key = "curve") {+ GraphCard(null, stringResource(R.string.gm_curve_body)) {+ BezierEditor(MotionSettings.curve) { c, save -> MotionSettings.updateCurve(context, c, save) }+ }+ }+ item(key = "curves") {+ val names = curvePresetNames()+ LazyRow(+ Modifier.padding(vertical = 4.dp).chipRowFade(),+ contentPadding = PaddingValues(horizontal = 20.dp),+ horizontalArrangement = Arrangement.spacedBy(10.dp),+ ) {+ itemsIndexed(EaseCurve.Presets) { i, curve ->+ com.chethan616.clearpdf.ui.home.DeskChip(names[i], MotionSettings.curve == curve) { MotionSettings.updateCurve(context, curve) }+ }+ }+ }+ item(key = "duration") {+ Panel {+ SliderRow(stringResource(R.string.gm_duration), MotionSettings.duration, 0.5f..2f, Candy.Sky, times) { MotionSettings.updateDuration(context, it) }+ }+ }+ item(key = "reset") {+ Row(Modifier.fillMaxWidth().padding(16.dp), horizontalArrangement = Arrangement.Center) {+ GlassPill(onClick = {+ glass(GlassStyle.Default)+ motion(MotionStyle.Default)+ MotionSettings.updateCurve(context, EaseCurve.Drawer)+ MotionSettings.updateDuration(context, 1f)+ }) { Text(stringResource(R.string.gm_reset), style = ClearType.BodyStrong, color = clear.ink) }+ }+ }+ item { Spacer(Modifier.windowInsetsBottomHeight(WindowInsets.navigationBars)) }+ }+}++private val times: (Float) -> String = { String.format(Locale.ROOT, "×%.2f", it) }++@Composable+internal fun glassPresetNames() = listOf(+ stringResource(R.string.settings_glass_clear), stringResource(R.string.settings_glass_frosted),+ stringResource(R.string.settings_glass_crystal), stringResource(R.string.settings_glass_lite),+)++@Composable+internal fun motionPresetNames() = listOf(+ stringResource(R.string.settings_motion_calm), stringResource(R.string.settings_motion_normal),+ stringResource(R.string.settings_motion_bouncy), stringResource(R.string.settings_motion_jelly),+)++@Composable+private fun curvePresetNames() = listOf(+ stringResource(R.string.gm_curve_drawer), stringResource(R.string.gm_curve_standard), stringResource(R.string.gm_curve_emphasized),+ stringResource(R.string.gm_curve_ease), stringResource(R.string.gm_curve_linear),+)++/** Glass controls to try the settings on: they press, swell, jiggle and bloom as set. */+@Composable+private fun PreviewStage() {+ val c = clear+ GlassCard(Modifier.padding(horizontal = 16.dp, vertical = 12.dp).fillMaxWidth(), shape = RoundedRectangle(30.dp)) {+ Column(Modifier.padding(18.dp)) {+ Row(horizontalArrangement = Arrangement.spacedBy(10.dp), verticalAlignment = Alignment.CenterVertically) {+ GlassPill(onClick = {}, tint = Candy.Sky, onLongClick = {}) { Text(stringResource(R.string.gm_press_me), style = ClearType.BodyStrong, color = Color.White) }+ GlassCircle(onClick = {}, size = 48.dp, onLongClick = {}) { GlassIcon(LucideIcons.Sparkles, null, Modifier.size(22.dp)) }+ GlassChip(onClick = {}, height = 44.dp, bloom = true) { Text(stringResource(R.string.gm_chip), style = ClearType.Body, color = c.ink) }+ }+ Spacer(Modifier.height(14.dp))+ Row(verticalAlignment = Alignment.CenterVertically) {+ Text(stringResource(R.string.gm_preview_body), style = ClearType.Caption, color = c.inkSoft, modifier = Modifier.weight(1f))+ Spacer(Modifier.size(12.dp))+ var on by remember { mutableStateOf(true) }+ GlassToggle(on, { on = it })+ }+ }+ }+}++/** A setting's name and value above its glass slider. */+@Composable+private fun SliderRow(+ label: String,+ value: Float,+ range: ClosedFloatingPointRange<Float>,+ accent: Color,+ format: (Float) -> String = { String.format(Locale.ROOT, "%.2f", it) },+ onChange: (Float) -> Unit,+) {+ val c = clear+ Column(Modifier.fillMaxWidth().padding(horizontal = 18.dp, vertical = 8.dp)) {+ Row(verticalAlignment = Alignment.CenterVertically) {+ Text(label, style = ClearType.BodyStrong, color = c.ink, modifier = Modifier.weight(1f))+ Text(format(value), style = ClearType.Label.copy(fontFamily = FontFamily.Monospace), color = c.inkSoft)+ }+ Spacer(Modifier.height(6.dp))+ GlassSlider(value, onChange, range = range, accent = accent)+ }+}++/** A graph on a frosted card: a title, a line on how to use it, the graph. */+@Composable+private fun GraphCard(title: String?, body: String, graph: @Composable () -> Unit) {+ val c = clear+ GlassCard(Modifier.padding(horizontal = 16.dp, vertical = 10.dp).fillMaxWidth(), shape = RoundedRectangle(28.dp), wash = c.frost, blur = 12.dp) {+ Column(Modifier.padding(18.dp)) {+ if (title != null) Text(title, style = ClearType.Title, color = c.ink)+ Text(body, style = ClearType.Caption, color = c.inkSoft, modifier = Modifier.padding(top = 2.dp, bottom = 12.dp))+ graph()+ }+ }+}++/** A loop from 0 to 1 over [millis], paused while [playing] is false, resting a beat at the end. */+@Composable+private fun rememberLoop(playing: Boolean, millis: Int): Animatable<Float, *> {+ val t = remember { Animatable(0f) }+ LaunchedEffect(playing, millis) {+ while (playing) {+ if (t.value >= 1f) t.snapTo(0f)+ t.animateTo(1f, tween(((1f - t.value) * millis).toInt().coerceAtLeast(1), easing = LinearEasing))+ delay(500)+ }+ }+ return t+}++/**+ * The glass spring (the one glass morphs on: menus, dialogs, the + glyph) as a graph of where it is+ * over time: it rises, swings past rest and settles. The pink dot plays it; tap to pause.+ */+@Composable+private fun SpringGraph() {+ val c = clear+ val accent = Candy.Bubblegum+ val zeta = MotionSettings.damping(0.58f)+ val k = MotionSettings.stiffness(420f)+ val w0 = sqrt(k)+ val wd = w0 * sqrt(1f - zeta * zeta)+ val settle = (ln(100f) / (zeta * w0)).coerceIn(0.3f, 3f)+ fun x(t: Float): Float = 1f - exp(-zeta * w0 * t) * (cos(wd * t) + zeta * w0 / wd * sin(wd * t))+ val hi = remember(zeta, w0) { (0..160).maxOf { x(settle * it / 160f) }.coerceAtLeast(1f) + 0.08f }+ val lo = -0.08f+ var playing by remember { mutableStateOf(true) }+ val loop = rememberLoop(playing, (settle * 1000).toInt())+ Canvas(Modifier.fillMaxWidth().height(170.dp).pointerInput(Unit) { detectTapGestures { playing = !playing } }) {+ val pad = 10.dp.toPx()+ val w = size.width - 2 * pad+ val h = size.height - 2 * pad+ fun px(t: Float) = pad + t / settle * w+ fun py(v: Float) = pad + (hi - v) / (hi - lo) * h+ val grid = c.inkFaint.copy(alpha = 0.5f)+ drawLine(grid, Offset(pad, py(1f)), Offset(pad + w, py(1f)), 1.5.dp.toPx(), pathEffect = PathEffect.dashPathEffect(floatArrayOf(6.dp.toPx(), 5.dp.toPx())))+ drawLine(grid, Offset(pad, py(0f)), Offset(pad + w, py(0f)), 1.dp.toPx())+ val full = Path()+ val done = Path()+ val p = loop.value+ for (i in 0..160) {+ val t = settle * i / 160f+ val o = Offset(px(t), py(x(t)))+ if (i == 0) full.moveTo(o.x, o.y) else full.lineTo(o.x, o.y)+ if (i / 160f <= p) { if (i == 0) done.moveTo(o.x, o.y) else done.lineTo(o.x, o.y) }+ }+ drawPath(full, c.ink.copy(alpha = 0.8f), style = Stroke(2.5.dp.toPx(), cap = StrokeCap.Round))+ drawPath(done, accent, style = Stroke(3.5.dp.toPx(), cap = StrokeCap.Round))+ val t = settle * p+ drawCircle(accent, 9.dp.toPx(), Offset(px(t), py(x(t))))+ }+ Text(+ stringResource(+ R.string.gm_spring_stats,+ String.format(Locale.ROOT, "%.2f", zeta), String.format(Locale.ROOT, "%.0f", k), String.format(Locale.ROOT, "%.1f", settle),+ ),+ style = ClearType.Caption.copy(fontFamily = FontFamily.Monospace), color = c.inkSoft, modifier = Modifier.padding(top = 8.dp),+ )+}++/**+ * The screens' curve, drawn as a cubic-bezier: a box from (0, 0) to (1, 1), the curve through it, the+ * two handles on dotted arms (drag them; the curve may swing past the box up and down), a pink dot+ * running along it at the curve's own pace, and the four numbers that name it. Tap to pause.+ */+@Composable+private fun BezierEditor(curve: EaseCurve, onChange: (EaseCurve, Boolean) -> Unit) {+ val c = clear+ val accent = Candy.Bubblegum+ val latest by rememberUpdatedState(curve)+ val change by rememberUpdatedState(onChange)+ var playing by remember { mutableStateOf(true) }+ val loop = rememberLoop(playing, (900 * MotionSettings.duration).toInt())+ BoxWithConstraints(Modifier.fillMaxWidth(), contentAlignment = Alignment.Center) {+ val side = min(maxWidth.value, 320f).dp+ Canvas(+ Modifier.size(side)+ .pointerInput(Unit) { detectTapGestures { playing = !playing } }+ .pointerInput(Unit) {+ var which = 0+ val pad = 22.dp.toPx()+ val span = { size.width - 2 * pad }+ fun toPx(x: Float, y: Float) = Offset(pad + x * span(), size.height - pad - (y + 0.25f) / 1.5f * span())+ detectDragGestures(+ onDragStart = { at ->+ val a = latest.let { toPx(it.x1, it.y1) }+ val b = latest.let { toPx(it.x2, it.y2) }+ val da = hypot(at.x - a.x, at.y - a.y)+ val db = hypot(at.x - b.x, at.y - b.y)+ val reach = 56.dp.toPx()+ which = when {+ da <= db && da < reach -> 1+ db < da && db < reach -> 2+ else -> 0+ }+ },+ onDragEnd = { if (which != 0) change(latest, true); which = 0 },+ onDragCancel = { if (which != 0) change(latest, true); which = 0 },+ onDrag = { ch, _ ->+ if (which == 0) return@detectDragGestures+ ch.consume()+ val x = ((ch.position.x - pad) / span()).coerceIn(0f, 1f)+ val y = (((size.height - pad - ch.position.y) / span()) * 1.5f - 0.25f).coerceIn(-0.25f, 1.25f)+ val r = { v: Float -> Math.round(v * 100f) / 100f }+ change(if (which == 1) latest.copy(x1 = r(x), y1 = r(y)) else latest.copy(x2 = r(x), y2 = r(y)), false)+ },+ )+ },+ ) {+ val pad = 22.dp.toPx()+ val span = size.width - 2 * pad+ fun at(x: Float, y: Float) = Offset(pad + x * span, size.height - pad - (y + 0.25f) / 1.5f * span)+ val box0 = at(0f, 1f)+ val box1 = at(1f, 0f)+ drawRect(c.ink.copy(alpha = 0.55f), box0, Size(box1.x - box0.x, box1.y - box0.y), style = Stroke(1.5.dp.toPx()))+ val p0 = at(0f, 0f)+ val p3 = at(1f, 1f)+ val h1 = at(curve.x1, curve.y1)+ val h2 = at(curve.x2, curve.y2)+ val dots = PathEffect.dashPathEffect(floatArrayOf(4.dp.toPx(), 4.dp.toPx()))+ drawLine(c.inkSoft, p0, h1, 1.5.dp.toPx(), pathEffect = dots)+ drawLine(c.inkSoft, p3, h2, 1.5.dp.toPx(), pathEffect = dots)+ val path = Path().apply { moveTo(p0.x, p0.y); cubicTo(h1.x, h1.y, h2.x, h2.y, p3.x, p3.y) }+ drawPath(path, c.ink, style = Stroke(3.dp.toPx(), cap = StrokeCap.Round))+ // the part the dot has run, in pink+ val easing = curve.easing+ val p = loop.value+ val done = Path()+ val steps = 80+ for (i in 0..steps) {+ val x = p * i / steps+ val o = at(x, easing.transform(x))+ if (i == 0) done.moveTo(o.x, o.y) else done.lineTo(o.x, o.y)+ }+ drawPath(done, accent, style = Stroke(3.5.dp.toPx(), cap = StrokeCap.Round))+ drawCircle(accent, 10.dp.toPx(), at(p, easing.transform(p)))+ // the handles: hollow squares, as the motion specs draw them+ for (hnd in listOf(h1, h2)) {+ val s = 16.dp.toPx()+ drawRoundRect(c.ink, Offset(hnd.x - s / 2, hnd.y - s / 2), Size(s, s), CornerRadius(3.dp.toPx()))+ drawRoundRect(if (c.dark) Color(0xFF1C2433) else Color.White, Offset(hnd.x - s / 4, hnd.y - s / 4), Size(s / 2, s / 2), CornerRadius(1.dp.toPx()))+ }+ }+ }+ Row(Modifier.fillMaxWidth().padding(top = 10.dp), horizontalArrangement = Arrangement.SpaceEvenly) {+ for (v in listOf(curve.x1, curve.y1, curve.x2, curve.y2)) {+ Text(+ String.format(Locale.ROOT, "%.2f", v).trimEnd('0').trimEnd('.').ifEmpty { "0" },+ style = ClearType.Body.copy(fontFamily = FontFamily.Monospace, fontSize = 17.sp), color = c.inkSoft,+ )+ }+ }+}diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/desk/SettingsScreen.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/desk/SettingsScreen.ktindex 9cae3f2..a71668b 100644--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/desk/SettingsScreen.kt+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/desk/SettingsScreen.kt@@ -45,6 +45,8 @@ import androidx.compose.ui.unit.dpimport com.chethan616.clearpdf.Rimport com.chethan616.clearpdf.ui.AppViewModelimport com.chethan616.clearpdf.ui.LucideIcons+import androidx.compose.animation.AnimatedContent+import androidx.compose.animation.togetherWithimport com.chethan616.clearpdf.ui.ThemeChoiceimport com.chethan616.clearpdf.ui.glass.GlassCardimport com.chethan616.clearpdf.ui.glass.GlassCircle@@ -74,14 +76,28 @@ const val CLEARPDF_REPO = "https://github.com/Chethan616/ClearPDF"fun SettingsScreen(vm: AppViewModel) {var page by remember { mutableStateOf("root") }BackHandler { if (page == "root") vm.settingsOpen = false else page = "root" }- when (page) {- "licences" -> LicencesPage { page = "root" }- else -> SettingsRoot(vm) { page = "licences" }+ AnimatedContent(+ page,+ transitionSpec = {+ val deeper = targetState != "root"+ val dir = if (deeper) 1 else -1+ (androidx.compose.animation.slideInHorizontally(com.chethan616.clearpdf.ui.glass.Fluid.push()) { dir * it / 4 } ++ androidx.compose.animation.fadeIn(com.chethan616.clearpdf.ui.glass.Fluid.quick())) togetherWith+ (androidx.compose.animation.slideOutHorizontally(com.chethan616.clearpdf.ui.glass.Fluid.push()) { -dir * it / 10 } ++ androidx.compose.animation.fadeOut(com.chethan616.clearpdf.ui.glass.Fluid.fade()))+ },+ label = "settings page",+ ) { p ->+ when (p) {+ "licences" -> LicencesPage { page = "root" }+ "glass" -> GlassMotionPage { page = "root" }+ else -> SettingsRoot(vm, openLicences = { page = "licences" }, openGlass = { page = "glass" })+ }}}@Composable-private fun SettingsRoot(vm: AppViewModel, openLicences: () -> Unit) {+private fun SettingsRoot(vm: AppViewModel, openLicences: () -> Unit, openGlass: () -> Unit) {val c = clearval context = LocalContext.currentval uri = LocalUriHandler.current@@ -110,36 +126,21 @@ private fun SettingsRoot(vm: AppViewModel, openLicences: () -> Unit) {)}}- item(key = "glass") {- Choice(stringResource(R.string.settings_glass)) {- val presets = GlassStyle.Presets- GlassTabs(- listOf(- GlassTab(stringResource(R.string.settings_glass_clear), accent = Candy.Sky),- GlassTab(stringResource(R.string.settings_glass_frosted), accent = Candy.Mint),- GlassTab(stringResource(R.string.settings_glass_crystal), accent = Candy.Grape),- GlassTab(stringResource(R.string.settings_glass_lite), accent = Candy.Tangerine),- ),- selected = presets.indexOf(GlassSettings.style).coerceAtLeast(0), onSelect = { GlassSettings.update(context, presets[it]) },- modifier = Modifier.fillMaxWidth(), height = 48.dp,- )- }- }- item(key = "motion") {- Choice(stringResource(R.string.settings_motion)) {- val presets = MotionStyle.Presets- GlassTabs(- listOf(- GlassTab(stringResource(R.string.settings_motion_calm), accent = Candy.Mint),- GlassTab(stringResource(R.string.settings_motion_normal), accent = Candy.Sky),- GlassTab(stringResource(R.string.settings_motion_bouncy), accent = Candy.Bubblegum),- GlassTab(stringResource(R.string.settings_motion_jelly), accent = Candy.Tomato),- ),- selected = presets.indexOf(MotionSettings.style).coerceAtLeast(0), onSelect = { MotionSettings.update(context, presets[it]) },- modifier = Modifier.fillMaxWidth(), height = 48.dp,+ item(key = "glassmotion") {+ // everything about the glass and how it moves lives on a page of its own+ val custom = stringResource(R.string.settings_custom)+ val glassName = GlassStyle.Presets.indexOf(GlassSettings.style).let { if (it < 0) custom else glassPresetNames()[it] }+ val motionName = MotionStyle.Presets.indexOf(MotionSettings.style).let { if (it < 0) custom else motionPresetNames()[it] }+ Panel {+ GlassRow(+ stringResource(R.string.settings_glass_motion), openGlass, icon = LucideIcons.Sparkles, accent = Candy.Grape,+ value = "$glassName · $motionName",+ trailing = { Icon(LucideIcons.ChevronRight, null, tint = c.inkFaint, modifier = Modifier.padding(start = 4.dp).size(18.dp)) },)}}++ item(key = "general") { Section(stringResource(R.string.settings_general)) }item(key = "feel") {Panel {ToggleRow(LucideIcons.Sparkles, Candy.Bubblegum, stringResource(R.string.settings_haptics), null, GlassSettings.haptics) { GlassSettings.updateHaptics(context, it) }@@ -180,14 +181,13 @@ private fun SettingsRoot(vm: AppViewModel, openLicences: () -> Unit) {}}item(key = "credits") {- GlassCard(Modifier.padding(horizontal = 16.dp, vertical = 14.dp).fillMaxWidth(), shape = RoundedRectangle(28.dp)) {- Column(Modifier.padding(20.dp)) {- Text(stringResource(R.string.settings_credits_title), style = ClearType.Title, color = c.ink)- Spacer(Modifier.height(6.dp))- Text(stringResource(R.string.settings_credits_body), style = ClearType.Body, color = c.inkSoft)- Spacer(Modifier.height(12.dp))- Text(stringResource(R.string.home_legal_notice), style = ClearType.Caption, color = c.inkFaint)- }+ // a footnote, as iOS ends its settings: no card of its own+ Column(Modifier.padding(start = 26.dp, end = 26.dp, top = 18.dp)) {+ Text(stringResource(R.string.settings_credits_title), style = ClearType.BodyStrong, color = c.inkSoft)+ Spacer(Modifier.height(4.dp))+ Text(stringResource(R.string.settings_credits_body), style = ClearType.Caption, color = c.inkSoft)+ Spacer(Modifier.height(10.dp))+ Text(stringResource(R.string.home_legal_notice), style = ClearType.Caption, color = c.inkFaint)}}item { Spacer(Modifier.windowInsetsBottomHeight(WindowInsets.navigationBars)) }@@ -232,9 +232,13 @@ private fun AppCard(vm: AppViewModel) {}}+/** A group's name, small and quiet over its panel (as iOS's grouped settings), "Custom" when tuned by hand. */@Composable-private fun Section(title: String) {- Text(title, style = ClearType.Headline, color = clear.ink, modifier = Modifier.padding(start = 22.dp, end = 22.dp, top = 22.dp, bottom = 10.dp))+internal fun Section(title: String, custom: Boolean = false) {+ Row(Modifier.fillMaxWidth().padding(start = 26.dp, end = 26.dp, top = 26.dp, bottom = 8.dp), verticalAlignment = Alignment.CenterVertically) {+ Text(title.uppercase(), style = ClearType.Eyebrow, color = clear.inkSoft, modifier = Modifier.weight(1f))+ if (custom) Text(stringResource(R.string.settings_custom), style = ClearType.Label, color = Candy.Bubblegum)+ }}/** A setting chosen by a segmented capsule: its name above, the glass capsule below. */@@ -247,7 +251,7 @@ private fun Choice(label: String, content: @Composable () -> Unit) {}@Composable-private fun Panel(content: @Composable ColumnScope.() -> Unit) {+internal fun Panel(content: @Composable ColumnScope.() -> Unit) {WashPanel(Modifier.padding(horizontal = 16.dp, vertical = 4.dp).fillMaxWidth()) {Spacer(Modifier.height(6.dp))content()@@ -257,7 +261,7 @@ private fun Panel(content: @Composable ColumnScope.() -> Unit) {/** A switch row: a candy blob, the setting's name and what it does, and a glass toggle. */@Composable-private fun ToggleRow(icon: ImageVector, accent: Color, label: String, body: String?, checked: Boolean, onChange: (Boolean) -> Unit) {+internal fun ToggleRow(icon: ImageVector, accent: Color, label: String, body: String?, checked: Boolean, onChange: (Boolean) -> Unit) {val c = clearRow(Modifier.fillMaxWidth().pressable({ onChange(!checked) }).padding(horizontal = 18.dp, vertical = 10.dp),@@ -285,7 +289,7 @@ private fun LicencesPage(onBack: () -> Unit) {val c = clearval context = LocalContext.currentval texts = remember {- listOf("LICENSE-lucide.txt", "OFL-PlusJakartaSans.txt", "OFL-Doto.txt", "OFL-DMSerifDisplay.txt", "OFL-DancingScript.txt", "LICENSE-foxit.txt", "LICENSE-adobe-cmaps.txt").mapNotNull { name ->+ listOf("LICENSE-lucide.txt", "OFL-PlusJakartaSans.txt", "OFL-Doto.txt", "OFL-DMSerifDisplay.txt", "OFL-BricolageGrotesque.txt", "OFL-Fraunces.txt", "OFL-DancingScript.txt", "LICENSE-foxit.txt", "LICENSE-adobe-cmaps.txt").mapNotNull { name ->runCatching { context.assets.open("licences/$name").bufferedReader().readText() }.getOrNull()?.takeIf { it.isNotBlank() }}}@@ -300,6 +304,8 @@ private fun LicencesPage(onBack: () -> Unit) {Credit("Plus Jakarta Sans", "SIL Open Font License 1.1, The Plus Jakarta Sans Project Authors"),Credit("Doto", "SIL Open Font License 1.1, The Doto Project Authors"),Credit("DM Serif Display", "SIL Open Font License 1.1, Colophon Foundry"),+ Credit("Bricolage Grotesque", "SIL Open Font License 1.1, The Bricolage Grotesque Project Authors"),+ Credit("Fraunces", "SIL Open Font License 1.1, The Fraunces Project Authors"),Credit("bot-avatars (the mascots)", "MIT, Jakub Antalik"),Credit(stringResource(R.string.root_licence_dancing_script), "SIL Open Font License 1.1, The Dancing Script Project Authors"),Credit(stringResource(R.string.root_licence_foxit), "BSD-3-Clause, Foxit Software Inc. and the PDFium Authors"),diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/desk/ToolsScreen.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/desk/ToolsScreen.ktindex 9305835..c62522a 100644--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/desk/ToolsScreen.kt+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/desk/ToolsScreen.kt@@ -1,9 +1,8 @@package com.chethan616.clearpdf.ui.desk-import androidx.compose.animation.animateColorAsState-import androidx.compose.foundation.backgroundimport androidx.compose.foundation.layout.Arrangementimport androidx.compose.foundation.layout.Box+import androidx.compose.foundation.layout.BoxWithConstraintsimport androidx.compose.foundation.layout.Columnimport androidx.compose.foundation.layout.PaddingValuesimport androidx.compose.foundation.layout.Row@@ -12,8 +11,8 @@ import androidx.compose.foundation.layout.WindowInsetsimport androidx.compose.foundation.layout.fillMaxSizeimport androidx.compose.foundation.layout.fillMaxWidthimport androidx.compose.foundation.layout.height-import androidx.compose.foundation.layout.heightInimport androidx.compose.foundation.layout.navigationBars+import androidx.compose.foundation.layout.offsetimport androidx.compose.foundation.layout.paddingimport androidx.compose.foundation.layout.sizeimport androidx.compose.foundation.layout.statusBars@@ -21,34 +20,40 @@ import androidx.compose.foundation.layout.windowInsetsBottomHeightimport androidx.compose.foundation.layout.windowInsetsTopHeightimport androidx.compose.foundation.lazy.LazyColumnimport androidx.compose.foundation.lazy.LazyRow+import com.chethan616.clearpdf.ui.home.chipRowFadeimport androidx.compose.foundation.lazy.items-import androidx.compose.foundation.shape.CircleShapeimport androidx.compose.material3.Iconimport androidx.compose.material3.Textimport androidx.compose.runtime.Composableimport androidx.compose.runtime.getValue+import androidx.compose.runtime.keyimport androidx.compose.runtime.mutableStateOf+import androidx.compose.runtime.rememberimport androidx.compose.runtime.saveable.rememberSaveableimport androidx.compose.runtime.setValueimport androidx.compose.ui.Alignmentimport androidx.compose.ui.Modifier-import androidx.compose.ui.draw.clip-import androidx.compose.ui.graphics.Brush-import androidx.compose.ui.graphics.Color-import androidx.compose.ui.graphics.graphicsLayer+import androidx.compose.ui.draw.rotate+import androidx.compose.ui.geometry.Offset+import androidx.compose.ui.platform.LocalDensityimport androidx.compose.ui.res.stringResource+import androidx.compose.ui.semantics.contentDescription+import androidx.compose.ui.semantics.semantics+import androidx.compose.ui.text.rememberTextMeasurerimport androidx.compose.ui.text.style.TextOverflow+import androidx.compose.ui.unit.Dp+import androidx.compose.ui.unit.TextUnitimport androidx.compose.ui.unit.dp+import androidx.compose.ui.unit.spimport com.chethan616.clearpdf.Rimport com.chethan616.clearpdf.ui.AppViewModel-import com.chethan616.clearpdf.ui.glass.GlassMotionimport com.chethan616.clearpdf.ui.glass.pressable-import com.chethan616.clearpdf.ui.glass.wash-import com.chethan616.clearpdf.ui.theme.Candy+import com.chethan616.clearpdf.ui.home.HomeTab+import com.chethan616.clearpdf.ui.home.cardPaint+import com.chethan616.clearpdf.ui.home.riseInimport com.chethan616.clearpdf.ui.theme.ClearType+import com.chethan616.clearpdf.ui.theme.Toneimport com.chethan616.clearpdf.ui.theme.clear-import com.kyant.shapes.Capsule-import com.kyant.shapes.RoundedRectangleprivate val Categories = listOf("All" to R.string.home_category_all,@@ -58,77 +63,106 @@ private val Categories = listOf("Convert" to R.string.home_category_convert,)+/** Tile heights, tallest first: the two columns read this at opposite phases so the bento never lines up. */+private val Rhythm = listOf(196.dp, 144.dp, 168.dp, 144.dp, 196.dp, 144.dp)++private val TileGap = 12.dp+private val TilePadding = 16.dp++/** The tile is tall enough to also say what the tool does. */+private val RoomForAbout = 160.dp++/** One tone per tool, chosen so neighbours in the bento never share a colour. */+private fun toneOf(t: ToolDef): Tone = when (t.key) {+ "edit" -> Tone.Blush+ "sign" -> Tone.Lavender+ "scan" -> Tone.Peach+ "combine" -> Tone.Sky+ "comment" -> Tone.Butter+ "read" -> Tone.Sage+ "organize" -> Tone.Lavender+ "compress" -> Tone.Peach+ "export" -> Tone.Orchid+ "crop" -> Tone.Sky+ "protect" -> Tone.Sage+ "create" -> Tone.Butter+ else -> Tone.Paper+}+/**- * Tools: a big title, candy category chips, the featured tool as a wide hero tile, then every tool- * as a card with its candy blob, name and one line about it.+ * Tools: the desk's own language. A soft serif title, the category chips, then every tool as a pastel+ * tile in a two-column bento of uneven heights: its name set big in serif like "Files" and "Pdf", its+ * glyph turned and cropped at the corner, and (on the tall tiles) a line on what it does.*/@Composablefun ToolsScreen(vm: AppViewModel) {- val c = clearvar cat by rememberSaveable { mutableStateOf("All") }val tools = ToolCatalog.All.filter { cat == "All" || cat in it.categories }- val featured = if (cat == "All") ToolCatalog.Edit else null- val grid = tools.filter { it !== featured }LazyColumn(Modifier.fillMaxSize(), contentPadding = PaddingValues(bottom = DockClearance)) {item { Spacer(Modifier.windowInsetsTopHeight(WindowInsets.statusBars)) }item(key = "header") {Spacer(Modifier.height(16.dp))- ScreenHeader(stringResource(R.string.tools_subtitle), stringResource(R.string.home_tab_tools), onBack = { vm.homeTab = com.chethan616.clearpdf.ui.home.HomeTab.Home })+ ScreenHeader(null, stringResource(R.string.home_tab_tools), titleStyle = ClearType.ToolsTitle, onBack = { vm.homeTab = HomeTab.Home })}item(key = "chips") {- LazyRow(contentPadding = PaddingValues(horizontal = 16.dp, vertical = 16.dp), horizontalArrangement = Arrangement.spacedBy(8.dp)) {+ LazyRow(Modifier.chipRowFade(),contentPadding = PaddingValues(horizontal = 20.dp, vertical = 16.dp), horizontalArrangement = Arrangement.spacedBy(8.dp)) {items(Categories, key = { it.first }) { (k, label) -> com.chethan616.clearpdf.ui.home.DeskChip(stringResource(label), k == cat) { cat = k } }}}- if (featured != null) item(key = "featured") { FeaturedTile(featured) { featured.go(vm) } }- items(grid.chunked(2), key = { row -> row.joinToString { it.key } }) { pair ->- Row(Modifier.fillMaxWidth().padding(horizontal = 16.dp, vertical = 6.dp), horizontalArrangement = Arrangement.spacedBy(12.dp)) {- pair.forEach { t -> ToolCard(t, Modifier.weight(1f)) { t.go(vm) } }- if (pair.size == 1) Spacer(Modifier.weight(1f))+ item(key = "bento") {+ val measurer = rememberTextMeasurer()+ val density = LocalDensity.current+ val names = ToolCatalog.All.map { stringResource(it.label) }+ BoxWithConstraints(Modifier.fillMaxWidth().padding(horizontal = 16.dp)) {+ val room = (maxWidth - TileGap) / 2 - TilePadding * 2+ // one size for every tile (whatever the filter): the largest at which the longest word of any name fits+ val wordSize = remember(names, room, density.density, density.fontScale) {+ val roomPx = with(density) { room.toPx() }+ var s = ClearType.ToolWord.fontSize.value+ while (s > 18f && names.any { n ->+ n.split(' ').any { w -> measurer.measure(w, ClearType.ToolWord.copy(fontSize = s.sp), maxLines = 1, softWrap = false).size.width > roomPx }+ }+ ) s -= 1f+ s.sp+ }+ Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.spacedBy(TileGap)) {+ for (col in 0..1) {+ Column(Modifier.weight(1f), verticalArrangement = Arrangement.spacedBy(TileGap)) {+ tools.forEachIndexed { i, t ->+ if (i % 2 != col) return@forEachIndexed+ key(t.key) { ToolTile(t, Rhythm[(i / 2 + col * 3) % Rhythm.size], wordSize, i) { t.go(vm) } }+ }+ }+ }+ }}}item { Spacer(Modifier.windowInsetsBottomHeight(WindowInsets.navigationBars)) }}}-/** The featured tool: a wide candy tile with a bubble of light and a big headline. */@Composable-private fun FeaturedTile(t: ToolDef, onClick: () -> Unit) {- val shape = RoundedRectangle(32.dp)+private fun ToolTile(t: ToolDef, height: Dp, wordSize: TextUnit, index: Int, onClick: () -> Unit) {+ val tone = clear.tone(toneOf(t))+ val label = stringResource(t.label)+ val about = stringResource(t.about)Box(- Modifier.padding(horizontal = 16.dp, vertical = 6.dp).fillMaxWidth().height(168.dp)- .pressable(onClick, pressedScale = 0.95f).clip(shape)- .background(Brush.linearGradient(listOf(t.accent, Candy.Grape)))- .padding(22.dp),+ Modifier.fillMaxWidth().height(height).riseIn(index)+ .semantics { contentDescription = "$label. $about" }+ .pressable(onClick, pressedScale = 0.95f)+ .cardPaint(tone, Offset(0.15f, 1f)),) {- Box(Modifier.align(Alignment.TopEnd).size(150.dp).graphicsLayer { translationX = 50.dp.toPx(); translationY = (-60).dp.toPx() }.clip(CircleShape).background(Color.White.copy(alpha = 0.16f)))- Box(Modifier.align(Alignment.BottomEnd).size(70.dp).graphicsLayer { translationX = 10.dp.toPx(); translationY = 24.dp.toPx() }.clip(CircleShape).background(Color.White.copy(alpha = 0.12f)))- Column {- Text(stringResource(R.string.tools_featured).uppercase(), style = ClearType.Eyebrow, color = Color.White.copy(alpha = 0.85f))- Spacer(Modifier.height(8.dp))- Text(stringResource(t.label), style = ClearType.Display, color = Color.White)- }- Row(Modifier.align(Alignment.BottomStart), verticalAlignment = Alignment.CenterVertically) {- Text(stringResource(t.about), style = ClearType.Label, color = Color.White.copy(alpha = 0.9f), maxLines = 2, overflow = TextOverflow.Ellipsis, modifier = Modifier.weight(1f, fill = false).padding(end = 64.dp))- }- Box(Modifier.align(Alignment.BottomEnd).size(52.dp).clip(CircleShape).background(Color.White), contentAlignment = Alignment.Center) {- Icon(t.icon, null, tint = t.accent, modifier = Modifier.size(26.dp))+ Icon(+ t.icon, null,+ tint = tone.accent.copy(alpha = if (clear.dark) 0.34f else 0.26f),+ modifier = Modifier.align(Alignment.TopEnd).offset(x = 16.dp, y = (-4).dp).size(88.dp).rotate(-12f),+ )+ Column(Modifier.align(Alignment.BottomStart).padding(horizontal = TilePadding, vertical = 14.dp)) {+ Text(label, style = ClearType.ToolWord.copy(fontSize = wordSize), color = tone.accent, maxLines = 2)+ if (height >= RoomForAbout) {+ Spacer(Modifier.height(4.dp))+ Text(about, style = ClearType.Caption, color = tone.ink.copy(alpha = 0.66f), maxLines = 3, overflow = TextOverflow.Ellipsis)+ }}}}--/** A tool's card: a candy blob with its glyph, its name in display type, and one line about it. */-@Composable-private fun ToolCard(t: ToolDef, modifier: Modifier, onClick: () -> Unit) {- val c = clear- Column(modifier.heightIn(min = 168.dp).pressable(onClick).wash(RoundedRectangle(28.dp)).padding(16.dp)) {- Box(- Modifier.size(52.dp).clip(RoundedRectangle(17.dp)).background(Brush.linearGradient(listOf(t.accent.copy(alpha = 0.85f), t.accent))),- contentAlignment = Alignment.Center,- ) { Icon(t.icon, null, tint = Color.White, modifier = Modifier.size(26.dp)) }- Spacer(Modifier.height(14.dp))- Text(stringResource(t.label), style = ClearType.Tile, color = c.ink, maxLines = 2)- Spacer(Modifier.height(4.dp))- Text(stringResource(t.about), style = ClearType.Caption, color = c.inkSoft, maxLines = 3, overflow = TextOverflow.Ellipsis)- }-}diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Backdrops.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Backdrops.ktindex 8ea27ed..86cee71 100644--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Backdrops.kt+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Backdrops.kt@@ -20,10 +20,18 @@ import androidx.compose.runtime.rememberUpdatedStateimport androidx.compose.runtime.setValueimport androidx.compose.runtime.staticCompositionLocalOfimport androidx.compose.ui.Modifier-import androidx.compose.ui.draw.drawBehind+import androidx.compose.ui.draw.drawWithCache+import androidx.compose.ui.geometry.Size+import androidx.compose.ui.graphics.Canvas+import androidx.compose.ui.graphics.FilterQuality+import androidx.compose.ui.graphics.ImageBitmap+import androidx.compose.ui.graphics.drawscope.CanvasDrawScopeimport androidx.compose.ui.geometry.Offsetimport androidx.compose.ui.graphics.Brushimport androidx.compose.ui.graphics.Color+import androidx.compose.ui.graphics.CompositingStrategy+import androidx.compose.ui.graphics.graphicsLayer+import androidx.compose.ui.input.pointer.pointerInputimport androidx.compose.ui.layout.onGloballyPositionedimport androidx.compose.ui.layout.positionInWindowimport androidx.compose.ui.unit.IntSize@@ -83,8 +91,10 @@ private val OffsetPairConverter = TwoWayConverter<Pair<Offset, Offset>, Animatio/*** The wallpaper: the theme's sky (a soft vertical gradient) with blooms of light pooled on it, as- * Apple's wallpapers do. Static while idle; a new [mood] glides the blooms to new places on one- * spring, so each screen has its own light.+ * Apple's wallpapers do. It is painted into one small bitmap (an eighth of the screen each way:+ * soft light needs no more) that is drawn scaled up, so a frame costs one image instead of six+ * full-screen gradients. The bitmap is kept and repainted in place only while a new [mood] glides+ * the blooms to new places (no garbage per frame), and the glide is slow and soft, as a wallpaper's.*/@Composablefun Aurora(mood: AuroraMood, modifier: Modifier = Modifier) {@@ -93,25 +103,36 @@ fun Aurora(mood: AuroraMood, modifier: Modifier = Modifier) {LaunchedEffect(mood) {mood.blobs.forEachIndexed { i, p ->val target = p to Offset(mood.radius, 0f)- if (anims[i].targetValue != target) launch { anims[i].animateTo(target, GlassMotion.rise()) }+ if (anims[i].targetValue != target) launch { anims[i].animateTo(target, androidx.compose.animation.core.tween(900, easing = Fluid.Ease)) }}}+ val bitmap = remember { arrayOfNulls<ImageBitmap>(1) }Box(- modifier.fillMaxSize().drawBehind {- drawRect(Brush.verticalGradient(colors.wall))- val r = size.maxDimension- colors.blooms.forEachIndexed { i, (c, strength) ->- val (p, rad) = anims.getOrNull(i)?.value ?: return@forEachIndexed- if (!(r * rad.x > 1f)) return@forEachIndexed- val center = Offset(p.x * size.width, p.y * size.height)- drawCircle(- Brush.radialGradient(- listOf(c.copy(alpha = strength), c.copy(alpha = strength * 0.55f), c.copy(alpha = strength * 0.18f), Color.Transparent),- center, r * rad.x,- ),- radius = r * rad.x, center = center,- )+ modifier.fillMaxSize().drawWithCache {+ val w = (size.width / 8f).toInt().coerceAtLeast(1)+ val h = (size.height / 8f).toInt().coerceAtLeast(1)+ // the wall's gradient is opaque, so repainting over the last frame needs no clear+ val image = bitmap[0]?.takeIf { it.width == w && it.height == h } ?: ImageBitmap(w, h).also { bitmap[0] = it }+ val small = Size(w.toFloat(), h.toFloat())+ // reading the blooms here makes the cache follow them+ val blooms = anims.map { it.value }+ CanvasDrawScope().draw(this, layoutDirection, Canvas(image), small) {+ drawRect(Brush.verticalGradient(colors.wall))+ val r = small.maxDimension+ colors.blooms.forEachIndexed { i, (c, strength) ->+ val (p, rad) = blooms.getOrNull(i) ?: return@forEachIndexed+ if (!(r * rad.x > 1f)) return@forEachIndexed+ val center = Offset(p.x * small.width, p.y * small.height)+ drawCircle(+ Brush.radialGradient(+ listOf(c.copy(alpha = strength), c.copy(alpha = strength * 0.55f), c.copy(alpha = strength * 0.18f), Color.Transparent),+ center, r * rad.x,+ ),+ radius = r * rad.x, center = center,+ )+ }}+ onDrawBehind { drawImage(image, dstSize = IntSize(size.width.toInt(), size.height.toInt()), filterQuality = FilterQuality.Low) }},)}@@ -128,12 +149,24 @@ class GlassOverlayHost {var size by mutableStateOf(IntSize.Zero)internal set+ /**+ * Chrome that animates over a still desk (the + fan, the recorder) holds the screens still while+ * it is out: they are kept as one texture instead of being redrawn under it on every frame.+ */+ var stillHolds by mutableStateOf(0)+internal fun register(entry: OverlayEntry) {entries.removeAll { it.key === entry.key }entries.add(entry)}+ /** The caller is gone: an overlay that animates out stays (as it was) until it says it's done. */internal fun unregister(key: Any) {+ val e = entries.firstOrNull { it.key === key } ?: return+ if (e.animatesOut) e.leaving = true else entries.remove(e)+ }++ internal fun remove(key: Any) {entries.removeAll { it.key === key }}@@ -141,7 +174,23 @@ class GlassOverlayHost {fun windowToLocal(point: Offset): Offset = point - originInWindow}-internal class OverlayEntry(val key: Any, val content: @Composable BoxScope.() -> Unit)+internal class OverlayEntry(val key: Any, val animatesOut: Boolean, val content: @Composable BoxScope.() -> Unit) {+ var leaving by mutableStateOf(false)+}++/**+ * An overlay's place in the portal: [leaving] turns true when whoever showed it goes away; an+ * overlay that animates out plays its exit then calls [done].+ */+@Stable+class OverlayPresence internal constructor(private val host: GlassOverlayHost, private val entry: OverlayEntry) {+ val leaving: Boolean get() = entry.leaving++ fun done() = host.remove(entry.key)+}++/** The presence of the overlay being composed (null outside the portal). */+val LocalOverlayPresence = staticCompositionLocalOf<OverlayPresence?> { null }val LocalGlassOverlayHost = staticCompositionLocalOf<GlassOverlayHost?> { null }@@ -153,22 +202,55 @@ fun GlassOverlayLayer(host: GlassOverlayHost, modifier: Modifier = Modifier) {host.size = it.size},) {- host.entries.forEach { entry -> key(entry.key) { entry.content(this) } }+ host.entries.forEach { entry ->+ key(entry.key) {+ val presence = remember(entry) { OverlayPresence(host, entry) }+ CompositionLocalProvider(LocalOverlayPresence provides presence) { entry.content(this) }+ // on its way out an overlay takes no more touches (nothing is chosen twice)+ if (entry.leaving) Box(Modifier.matchParentSize().pointerInput(Unit) { awaitPointerEventScope { while (true) awaitPointerEvent().changes.forEach { it.consume() } } })+ }+ }}}-/** Shows [content] in the overlay for as long as the caller is composed. Draw nothing while idle. */+/**+ * Shows [content] in the overlay for as long as the caller is composed. With [animatesOut] it stays+ * a moment longer, until it has played its exit (see [rememberOverlayAppear]). Draws nothing while idle.+ */@Composable-fun GlassOverlay(content: @Composable BoxScope.() -> Unit) {+fun GlassOverlay(animatesOut: Boolean = false, content: @Composable BoxScope.() -> Unit) {val host = LocalGlassOverlayHost.current ?: returnval latest by rememberUpdatedState(content)val key = remember { Any() }DisposableEffect(host, key) {- host.register(OverlayEntry(key) { latest() })+ host.register(OverlayEntry(key, animatesOut) { latest() })onDispose { host.unregister(key) }}}+/**+ * An overlay's 0 → 1 entrance on [enter], and 1 → 0 on [exit] once its caller is gone, after which+ * it leaves the portal. Read the value in draw (graphicsLayer).+ */+@Composable+fun rememberOverlayAppear(+ enter: androidx.compose.animation.core.AnimationSpec<Float> = Fluid.rise(),+ exit: androidx.compose.animation.core.AnimationSpec<Float> = Fluid.dismiss(),+): Animatable<Float, androidx.compose.animation.core.AnimationVector1D> {+ val presence = LocalOverlayPresence.current+ val a = remember { Animatable(0f) }+ val leaving = presence?.leaving == true+ LaunchedEffect(leaving) {+ if (!leaving) {+ a.animateTo(1f, enter)+ } else {+ a.animateTo(0f, exit)+ presence?.done()+ }+ }+ return a+}+/*** The app's glass stack, bottom to top: the [wallpaper]; the [screens]; the [chrome] that floats over* them (the dock); then the overlay portal over all three. Provide [LocalGlassOverlayHost] above it@@ -183,16 +265,35 @@ fun GlassStage(val provided = LocalGlassOverlayHost.currentval host = provided ?: remember { GlassOverlayHost() }val wall = rememberLayerBackdrop()+ val screensLayer = rememberLayerBackdrop()+ val chromeLayer = rememberLayerBackdrop()+ val underChrome = rememberCombinedBackdrop(wall, screensLayer)+ val underOverlay = rememberCombinedBackdrop(underChrome, chromeLayer)CompositionLocalProvider(LocalGlassOverlayHost provides host) {Box(Modifier.fillMaxSize()) {- Box(Modifier.fillMaxSize().layerBackdrop(wall), content = wallpaper)- CompositionLocalProvider(LocalBackdrop provides wall) {- GlassLayer(Modifier.fillMaxSize(), content = screens) {- GlassLayer(Modifier.fillMaxSize(), content = chrome) {- GlassOverlayLayer(host)- }+ // While something floats over it, the scene is still: kept as one texture, a sheet or dialog+ // moving above it composites that texture instead of redrawing (and re-blurring) every+ // glass control it passes over on every frame+ Box(+ Modifier.fillMaxSize().graphicsLayer {+ compositingStrategy = if (host.entries.isEmpty() && host.stillHolds == 0) CompositingStrategy.Auto else CompositingStrategy.Offscreen+ },+ ) {+ Box(Modifier.fillMaxSize().layerBackdrop(wall), content = wallpaper)+ CompositionLocalProvider(LocalBackdrop provides wall) {+ Box(Modifier.fillMaxSize().layerBackdrop(screensLayer), content = screens)+ }+ }+ Box(+ Modifier.fillMaxSize().graphicsLayer {+ compositingStrategy = if (host.entries.isEmpty()) CompositingStrategy.Auto else CompositingStrategy.Offscreen+ },+ ) {+ CompositionLocalProvider(LocalBackdrop provides underChrome) {+ Box(Modifier.fillMaxSize().layerBackdrop(chromeLayer), content = chrome)}}+ CompositionLocalProvider(LocalBackdrop provides underOverlay) { GlassOverlayLayer(host) }}}}diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Buttons.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Buttons.ktindex 47d5aaa..1da9947 100644--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Buttons.kt+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Buttons.kt@@ -6,6 +6,7 @@ import androidx.compose.foundation.interaction.MutableInteractionSourceimport androidx.compose.foundation.interaction.PressInteractionimport androidx.compose.foundation.layout.Arrangementimport androidx.compose.foundation.layout.Box+import androidx.compose.foundation.layout.PaddingValuesimport androidx.compose.foundation.layout.Rowimport androidx.compose.foundation.layout.RowScopeimport androidx.compose.foundation.layout.height@@ -18,8 +19,11 @@ import androidx.compose.runtime.getValueimport androidx.compose.runtime.rememberimport androidx.compose.runtime.rememberCoroutineScopeimport androidx.compose.runtime.rememberUpdatedState+import kotlinx.coroutines.delay+import kotlinx.coroutines.launchimport androidx.compose.ui.Alignmentimport androidx.compose.ui.Modifier+import androidx.compose.ui.draw.clipimport androidx.compose.ui.graphics.BlendModeimport androidx.compose.ui.graphics.Colorimport androidx.compose.ui.graphics.isSpecified@@ -53,15 +57,19 @@ private fun Modifier.glassControl(surface: Color,blur: Dp,label: String?,+ fill: (() -> Color)? = null,+ tap: Feel? = Feel.Tap,+ bloom: Boolean = true,+ tintAt: (() -> Color)? = null,): Modifier {val backdrop = LocalBackdrop.currentval scope = rememberCoroutineScope()- val haptics = LocalHapticFeedback.current+ val haptics = LocalHaptics.currentval currentHaptics by rememberUpdatedState(haptics)val hasLongClick by rememberUpdatedState(onLongClick != null)- val highlight = remember(scope) {- InteractiveHighlight(scope, longPressExpand = true, onLongPressExpand = {- if (!hasLongClick) currentHaptics.performHapticFeedback(HapticFeedbackType.LongPress)+ val highlight = remember(scope, bloom) {+ InteractiveHighlight(scope, longPressExpand = bloom, onLongPressExpand = {+ if (!hasLongClick) currentHaptics?.play(Feel.Bloom)})}val source = remember { MutableInteractionSource() }@@ -70,6 +78,7 @@ private fun Modifier.glassControl(LaunchedEffect(source) {source.interactions.collect { i ->when (i) {+ is PressInteraction.Press -> currentHaptics?.play(Feel.Press)is PressInteraction.Release -> if (armed[0]) { armed[0] = false; currentLongClick?.invoke() }is PressInteraction.Cancel -> armed[0] = false}@@ -85,27 +94,84 @@ private fun Modifier.glassControl(highlight = { glassHighlight(style) },layerBlock = { liquidPressTransform(highlight) },onDrawSurface = {- if (tint.isSpecified) {+ // tintAt is read here, while drawing, so a colour that follows a pager recomposes nothing+ val t = tintAt?.invoke() ?: tint+ if (t.isSpecified) {// a soft white base first, so the candy comes out vivid over dark and light alikedrawRect(Color.White.copy(alpha = 0.42f))- drawRect(tint, blendMode = BlendMode.Hue)- drawRect(tint.copy(alpha = 0.82f))+ drawRect(t, blendMode = BlendMode.Hue)+ drawRect(t.copy(alpha = 0.82f))}if (surface.isSpecified) drawRect(surface.glassTint(style))+ // read here, while drawing, so a colour animating in changes pixels and recomposes nothing+ val f = fill?.invoke()+ if (f != null && f.alpha > 0f) drawRect(f)},).combinedClickable(interactionSource = source,indication = null,role = Role.Button,- onClick = { if (highlight.expandProgress < 0.5f) haptics.performHapticFeedback(HapticFeedbackType.ContextClick); onClick() },- onLongClick = if (onLongClick != null) ({ armed[0] = true; haptics.performHapticFeedback(HapticFeedbackType.LongPress) }) else null,+ onClick = { if (tap != null && highlight.expandProgress < 0.5f) haptics?.play(tap); onClick() },+ onLongClick = if (onLongClick != null) ({ armed[0] = true; haptics?.play(Feel.Bloom) }) else null,).then(highlight.modifier).then(highlight.gestureModifier).then(if (label != null) Modifier.semantics { contentDescription = label } else Modifier)}+/** How long Back's glass plays before its screen goes: the press shows, then it springs back. */+const val BackBeatMillis = 300L++/**+ * [action] a beat after the tap, so a glass button's press and spring-back are seen before its screen+ * goes (Back). A second tap in the beat does nothing.+ */+@Composable+fun rememberBeat(action: () -> Unit, millis: Long = BackBeatMillis): () -> Unit {+ val scope = rememberCoroutineScope()+ val latest by rememberUpdatedState(action)+ val going = remember { booleanArrayOf(false) }+ return remember(scope, millis) {+ {+ if (!going[0]) {+ going[0] = true+ scope.launch {+ delay(millis)+ going[0] = false+ latest()+ }+ }+ }+ }+}++/**+ * A glass bar or capsule that holds buttons of its own (a toolbar, a group of bar buttons): the glass+ * of every glass control, swelling, leaning and jiggling under the finger by Settings ▸ Motion as iOS+ * 26's bars do, while the buttons inside take the taps. Its tint and blur are the glass style's+ * (Settings ▸ liquid glass), so it shows what's under it, the page in the viewer.+ */+@Composable+fun Modifier.glassBar(shape: Shape = Capsule, surface: Color = clear.glass, blur: Dp = 6.dp): Modifier {+ val backdrop = LocalBackdrop.current+ val scope = rememberCoroutineScope()+ val highlight = remember(scope) { InteractiveHighlight(scope) }+ val style = GlassSettings.style+ return this+ .drawBackdrop(+ backdrop = backdrop,+ shape = { shape },+ shadow = null,+ effects = { glassEffects(style, blur.toPx(), 12f.dp.toPx(), 24f.dp.toPx()) },+ highlight = { glassHighlight(style) },+ layerBlock = { liquidPressTransform(highlight) },+ onDrawSurface = { if (surface.isSpecified) drawRect(surface.glassTint(style)) },+ )+ .then(highlight.modifier)+ .then(highlight.gestureModifier)+}+/*** A glass capsule. With [tint] it's the vivid candy button (white ink); without, a neutral pill.*/@@ -120,13 +186,14 @@ fun GlassPill(horizontalPadding: Dp = 18.dp,onLongClick: (() -> Unit)? = null,label: String? = null,+ tintAt: (() -> Color)? = null,content: @Composable RowScope.() -> Unit,) {- val ink = if (tint.isSpecified) Color.White else clear.ink+ val ink = if (tint.isSpecified || tintAt != null) Color.White else clear.inkCompositionLocalProvider(LocalGlassInk provides ink) {Row(modifier- .glassControl(Capsule, onClick, onLongClick, tint, surface, blur, label)+ .glassControl(Capsule, onClick, onLongClick, tint, if (tintAt != null) Color.Unspecified else surface, blur, label, bloom = onLongClick != null, tintAt = tintAt).height(height).padding(horizontal = horizontalPadding),horizontalArrangement = Arrangement.spacedBy(8.dp, Alignment.CenterHorizontally),@@ -136,6 +203,67 @@ fun GlassPill(}}+/**+ * A small glass capsule that holds anything (a filter, a count, a checklist row, a fan item): the very+ * glass of [GlassPill], Back and the menu buttons, so it swells, leans and blooms the same way.+ * [fill] is an optional colour over the glass (a chosen chip's lemon, a ticked row), read while+ * drawing so it can animate for free. [tap] is the haptic on a tap; null leaves it to the caller.+ * [bloom] false keeps a long press from growing a control that has no long-press job.+ */+@Composable+fun GlassChip(+ onClick: () -> Unit,+ modifier: Modifier = Modifier,+ height: Dp = 40.dp,+ surface: Color = clear.glass,+ fill: (() -> Color)? = null,+ blur: Dp = 2.dp,+ contentPadding: PaddingValues = PaddingValues(horizontal = 16.dp),+ horizontalArrangement: Arrangement.Horizontal = Arrangement.spacedBy(8.dp, Alignment.CenterHorizontally),+ tap: Feel? = Feel.Tap,+ bloom: Boolean = false,+ onLongClick: (() -> Unit)? = null,+ label: String? = null,+ ink: Color = clear.ink,+ content: @Composable RowScope.() -> Unit,+) {+ CompositionLocalProvider(LocalGlassInk provides ink) {+ Row(+ modifier+ .glassControl(Capsule, onClick, onLongClick, Color.Unspecified, surface, blur, label, fill, tap, bloom)+ .height(height)+ .padding(contentPadding),+ horizontalArrangement = horizontalArrangement,+ verticalAlignment = Alignment.CenterVertically,+ content = content,+ )+ }+}++/**+ * The round glass button of a screen's header (Back, More, the desk's menu): 54 dp of the same+ * plain glass every glass button wears, ink in [GlassIcon]s white on the sky. Never ringed or+ * dark-filled: one glass, one lit rim.+ */+@Composable+fun HeaderGlassButton(onClick: () -> Unit, label: String, modifier: Modifier = Modifier, size: Dp = 54.dp, content: @Composable () -> Unit) {+ GlassCircle(onClick = onClick, modifier = modifier, size = size, label = label) {+ CompositionLocalProvider(LocalGlassInk provides clear.hero) { content() }+ }+}++/**+ * An icon button inside a glass bar or capsule: no glass of its own (glass on glass reads as two+ * buttons stacked), just the glyph in the bar's ink and a soft press.+ */+@Composable+fun BarGlyphButton(onClick: () -> Unit, label: String, modifier: Modifier = Modifier, size: Dp = 40.dp, enabled: Boolean = true, content: @Composable () -> Unit) {+ Box(+ modifier.size(size).clip(CircleShape).pressable(onClick, enabled = enabled, pressedScale = 0.88f).semantics { contentDescription = label },+ contentAlignment = Alignment.Center,+ ) { content() }+}+/** A round glass button, usually an icon. */@Composablefun GlassCircle(@@ -151,7 +279,7 @@ fun GlassCircle(val ink = if (tint.isSpecified) Color.White else clear.inkCompositionLocalProvider(LocalGlassInk provides ink) {Box(- modifier.size(size).glassControl(CircleShape, onClick, onLongClick, tint, surface, 2.dp, label),+ modifier.size(size).glassControl(CircleShape, onClick, onLongClick, tint, surface, 2.dp, label, bloom = onLongClick != null),contentAlignment = Alignment.Center,) { content() }}diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Controls.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Controls.ktindex 47da663..f0bc639 100644--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Controls.kt+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Controls.kt@@ -61,6 +61,7 @@ import kotlinx.coroutines.flow.collectLatest@Composableprivate fun Modifier.thumb(drag: DampedDragAnimation, track: com.kyant.backdrop.backdrops.LayerBackdrop, lensHeight: Float, lensAmount: Float, trackScale: Float): Modifier {val backdrop = LocalBackdrop.current+ val style = GlassSettings.stylereturn drawBackdrop(backdrop = rememberCombinedBackdrop(backdrop,@@ -72,12 +73,16 @@ private fun Modifier.thumb(drag: DampedDragAnimation, track: com.kyant.backdrop.shape = { Capsule },effects = {val p = drag.pressProgress- if (p > 0f) blur(8f.dp.toPx() * (1f - p))- lens(lensHeight.dp.toPx() * p, lensAmount.dp.toPx() * p, chromaticAberration = true)+ if (p > 0f) blur(8f.dp.toPx() * (1f - p) * style.blur)+ lens(+ lensHeight.dp.toPx() * p * style.refractionHeight, lensAmount.dp.toPx() * p * style.refractionAmount,+ chromaticAberration = true,+ )},highlight = {val p = drag.pressProgress- if (p <= 0f) null else Highlight.Ambient.copy(width = Highlight.Ambient.width / 1.5f, blurRadius = Highlight.Ambient.blurRadius / 1.5f, alpha = p)+ if (p <= 0f || style.highlight <= 0f) null+ else Highlight.Ambient.copy(width = Highlight.Ambient.width / 1.5f, blurRadius = Highlight.Ambient.blurRadius / 1.5f, alpha = p * style.highlight.coerceIn(0f, 1f))},shadow = null,innerShadow = {@@ -101,7 +106,7 @@ fun GlassToggle(checked: Boolean, onChange: (Boolean) -> Unit, modifier: Modifieval track = if (c.dark) Color(0xFF787880).copy(0.36f) else Color(0xFF787878).copy(0.2f)val density = LocalDensity.currentval isLtr = LocalLayoutDirection.current == LayoutDirection.Ltr- val haptics = LocalHapticFeedback.current+ val haptics = LocalHaptics.currentval dragWidth = with(density) { 20f.dp.toPx() }val scope = rememberCoroutineScope()val current by rememberUpdatedState(checked)@@ -116,7 +121,7 @@ fun GlassToggle(checked: Boolean, onChange: (Boolean) -> Unit, modifier: Modifiefraction = if (didDrag) (if (targetValue >= 0.5f) 1f else 0f) else (if (current) 0f else 1f)didDrag = falseif ((fraction == 1f) != current) {- haptics.performHapticFeedback(HapticFeedbackType.SegmentTick)+ haptics?.play(if (fraction == 1f) Feel.ToggleOn else Feel.ToggleOff)change(fraction == 1f)}},diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Haptics.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Haptics.ktindex 91b4aac..a87cc35 100644--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Haptics.kt+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Haptics.kt@@ -1,12 +1,133 @@package com.chethan616.clearpdf.ui.glass+import android.content.Context+import android.os.Buildimport android.os.SystemClock+import android.os.VibrationAttributes+import android.os.VibrationEffect+import android.os.VibrationEffect.Composition.PRIMITIVE_CLICK+import android.os.VibrationEffect.Composition.PRIMITIVE_QUICK_FALL+import android.os.VibrationEffect.Composition.PRIMITIVE_QUICK_RISE+import android.os.VibrationEffect.Composition.PRIMITIVE_SPIN+import android.os.VibrationEffect.Composition.PRIMITIVE_THUD+import android.os.VibrationEffect.Composition.PRIMITIVE_TICK+import android.os.Vibrator+import android.os.VibratorManager+import android.view.HapticFeedbackConstants+import android.view.View+import androidx.annotation.RequiresApiimport androidx.compose.runtime.Composableimport androidx.compose.runtime.CompositionLocalProvider+import androidx.compose.runtime.Stableimport androidx.compose.runtime.remember+import androidx.compose.runtime.staticCompositionLocalOfimport androidx.compose.ui.hapticfeedback.HapticFeedbackimport androidx.compose.ui.hapticfeedback.HapticFeedbackType+import androidx.compose.ui.platform.LocalContextimport androidx.compose.ui.platform.LocalHapticFeedback+import androidx.compose.ui.platform.LocalView++/**+ * What a moment feels like, in Material 3 Expressive's haptic vocabulary: crisp ticks for+ * selection, a firm click for a press, a rising swell when something opens or springs up, a fall+ * when it folds away, a spin for a playful twirl, a thud for a landing, confirm and reject.+ */+enum class Feel { Tap, Press, Tick, ToggleOn, ToggleOff, Confirm, Reject, Rise, Fall, Spin, Thud, Bloom }++/**+ * Plays [Feel]s with the vibrator's composition primitives (Android 11+, when the phone has them:+ * they are what make haptics feel rich rather than buzzy), else the view's haptic constants. Played+ * as touch feedback, so the phone's own touch-vibration strength applies. Honours Settings ▸+ * Haptic feedback, and drops a second feel within a few milliseconds of the last.+ */+@Stable+class Haptics internal constructor(context: Context, private val view: View) {+ private val vibrator: Vibrator? = if (Build.VERSION.SDK_INT >= 31) {+ context.getSystemService(VibratorManager::class.java)?.defaultVibrator+ } else {+ @Suppress("DEPRECATION")+ context.getSystemService(Vibrator::class.java)+ }++ private val rich: Boolean = Build.VERSION.SDK_INT >= 30 && supports(PRIMITIVE_CLICK, PRIMITIVE_TICK, PRIMITIVE_QUICK_RISE, PRIMITIVE_QUICK_FALL)+ private val spin: Boolean = rich && supports(PRIMITIVE_SPIN)+ private val thud: Boolean = rich && supports(PRIMITIVE_THUD)+ private var last = 0L++ private fun supports(vararg primitives: Int): Boolean {+ val v = vibrator ?: return false+ if (Build.VERSION.SDK_INT < 30 || !v.hasVibrator()) return false+ return runCatching { v.areAllPrimitivesSupported(*primitives) }.getOrDefault(false)+ }++ fun play(feel: Feel) {+ if (!GlassSettings.haptics) return+ val now = SystemClock.uptimeMillis()+ if (now - last < 35L && feel != Feel.Confirm && feel != Feel.Reject) return+ last = now+ if (rich && Build.VERSION.SDK_INT >= 30 && vibrate(compose(feel))) return+ view.performHapticFeedback(fallback(feel))+ }++ /** A run of light ticks rising in strength, one per item, [gapMs] apart: a fan of things spilling out. */+ fun cascade(count: Int, gapMs: Int = 28) {+ if (!GlassSettings.haptics || count <= 0) return+ if (rich && Build.VERSION.SDK_INT >= 30) {+ val c = VibrationEffect.startComposition()+ repeat(count) { i -> c.addPrimitive(PRIMITIVE_TICK, 0.35f + 0.4f * (i + 1) / count, if (i == 0) 0 else gapMs) }+ if (vibrate(c.compose())) return+ }+ view.performHapticFeedback(HapticFeedbackConstants.CLOCK_TICK)+ }++ private fun vibrate(effect: VibrationEffect): Boolean {+ val v = vibrator ?: return false+ return runCatching {+ if (Build.VERSION.SDK_INT >= 33) v.vibrate(effect, VibrationAttributes.createForUsage(VibrationAttributes.USAGE_TOUCH))+ else v.vibrate(effect)+ }.isSuccess+ }++ @RequiresApi(30)+ private fun compose(feel: Feel): VibrationEffect {+ val c = VibrationEffect.startComposition()+ when (feel) {+ Feel.Tap -> c.addPrimitive(PRIMITIVE_CLICK, 0.55f)+ Feel.Press -> c.addPrimitive(PRIMITIVE_TICK, 0.45f)+ Feel.Tick -> c.addPrimitive(PRIMITIVE_TICK, 0.8f)+ Feel.ToggleOn -> c.addPrimitive(PRIMITIVE_CLICK, 0.8f).addPrimitive(PRIMITIVE_TICK, 0.5f, 40)+ Feel.ToggleOff -> c.addPrimitive(PRIMITIVE_TICK, 0.7f)+ Feel.Confirm -> c.addPrimitive(PRIMITIVE_CLICK, 0.6f).addPrimitive(PRIMITIVE_CLICK, 1f, 70)+ Feel.Reject -> c.addPrimitive(PRIMITIVE_QUICK_FALL, 0.7f).addPrimitive(PRIMITIVE_CLICK, 0.6f, 30).addPrimitive(PRIMITIVE_CLICK, 0.6f, 60)+ Feel.Rise -> c.addPrimitive(PRIMITIVE_QUICK_RISE, 0.55f).addPrimitive(PRIMITIVE_CLICK, 0.7f, 10)+ Feel.Fall -> c.addPrimitive(PRIMITIVE_QUICK_FALL, 0.5f)+ Feel.Spin -> if (spin) {+ c.addPrimitive(PRIMITIVE_SPIN, 0.7f).addPrimitive(PRIMITIVE_CLICK, 0.6f, 40)+ } else {+ c.addPrimitive(PRIMITIVE_QUICK_RISE, 0.5f).addPrimitive(PRIMITIVE_QUICK_FALL, 0.5f).addPrimitive(PRIMITIVE_CLICK, 0.6f, 20)+ }+ Feel.Thud -> if (thud) c.addPrimitive(PRIMITIVE_THUD, 0.7f) else c.addPrimitive(PRIMITIVE_CLICK, 1f)+ Feel.Bloom -> c.addPrimitive(PRIMITIVE_QUICK_RISE, 0.8f).addPrimitive(PRIMITIVE_CLICK, 1f, 20)+ }+ return c.compose()+ }++ private fun fallback(feel: Feel): Int = when (feel) {+ Feel.Tap -> HapticFeedbackConstants.CONTEXT_CLICK+ Feel.Press -> HapticFeedbackConstants.VIRTUAL_KEY+ Feel.Tick -> HapticFeedbackConstants.CLOCK_TICK+ Feel.ToggleOn -> if (Build.VERSION.SDK_INT >= 34) HapticFeedbackConstants.TOGGLE_ON else HapticFeedbackConstants.CONTEXT_CLICK+ Feel.ToggleOff -> if (Build.VERSION.SDK_INT >= 34) HapticFeedbackConstants.TOGGLE_OFF else HapticFeedbackConstants.CLOCK_TICK+ Feel.Confirm -> if (Build.VERSION.SDK_INT >= 30) HapticFeedbackConstants.CONFIRM else HapticFeedbackConstants.CONTEXT_CLICK+ Feel.Reject -> if (Build.VERSION.SDK_INT >= 30) HapticFeedbackConstants.REJECT else HapticFeedbackConstants.LONG_PRESS+ Feel.Rise, Feel.Bloom -> if (Build.VERSION.SDK_INT >= 30) HapticFeedbackConstants.GESTURE_START else HapticFeedbackConstants.LONG_PRESS+ Feel.Fall -> if (Build.VERSION.SDK_INT >= 30) HapticFeedbackConstants.GESTURE_END else HapticFeedbackConstants.CLOCK_TICK+ Feel.Spin, Feel.Thud -> HapticFeedbackConstants.LONG_PRESS+ }+}++/** The app's haptics. */+val LocalHaptics = staticCompositionLocalOf<Haptics?> { null }/** One tap is one tick: anything within [windowMs] of the last haptic is dropped. Honours Settings. */class ThrottledHaptics(private val delegate: HapticFeedback, private val windowMs: Long = 90L) : HapticFeedback {@@ -24,5 +145,15 @@ class ThrottledHaptics(private val delegate: HapticFeedback, private val windowMfun ProvideGlassHaptics(content: @Composable () -> Unit) {val system = LocalHapticFeedback.currentval throttled = remember(system) { ThrottledHaptics(system) }- CompositionLocalProvider(LocalHapticFeedback provides throttled, content = content)+ val context = LocalContext.current+ val view = LocalView.current+ val haptics = remember(context, view) { Haptics(context, view) }+ CompositionLocalProvider(LocalHapticFeedback provides throttled, LocalHaptics provides haptics, content = content)+}++/** Play [feel] with the app's haptics (nothing outside [ProvideGlassHaptics]). */+@Composable+fun rememberFeel(): (Feel) -> Unit {+ val h = LocalHaptics.current+ return remember(h) { { f: Feel -> h?.play(f) } }}diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Loader.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Loader.ktindex 50aa83a..090ef94 100644--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Loader.kt+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Loader.kt@@ -23,17 +23,17 @@ import com.chethan616.clearpdf.ui.theme.clear/*** The one loader: Material 3 Expressive's morphing indicator (its shapes turn into one another)- * inside a glass circle that pops in on a spring. Every wait in the app shows this.+ * inside a glass circle that grows in. Every wait in the app shows this.*/@OptIn(ExperimentalMaterial3ExpressiveApi::class)@Composablefun GlassLoader(modifier: Modifier = Modifier, size: Dp = 64.dp, color: Color = Candy.Sky, label: String? = null) {val appear = remember { Animatable(0f) }- LaunchedEffect(Unit) { appear.animateTo(1f, GlassMotion.pop()) }+ LaunchedEffect(Unit) { appear.animateTo(1f, Fluid.quick()) }Box(modifier.graphicsLayer {- val s = 0.6f + 0.4f * appear.value+ val s = 0.8f + 0.2f * appear.valuescaleX = sscaleY = salpha = appear.value.coerceIn(0f, 1f)diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/MorphMenu.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/MorphMenu.ktnew file mode 100644index 0000000..4f35020--- /dev/null+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/MorphMenu.kt@@ -0,0 +1,191 @@+package com.chethan616.clearpdf.ui.glass++import androidx.activity.compose.BackHandler+import androidx.compose.animation.core.Animatable+import androidx.compose.animation.core.SpringSpec+import androidx.compose.animation.core.spring+import androidx.compose.foundation.clickable+import androidx.compose.foundation.interaction.MutableInteractionSource+import androidx.compose.foundation.layout.Box+import androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.Row+import androidx.compose.foundation.layout.Spacer+import androidx.compose.foundation.layout.fillMaxSize+import androidx.compose.foundation.layout.fillMaxWidth+import androidx.compose.foundation.layout.height+import androidx.compose.foundation.layout.padding+import androidx.compose.foundation.layout.size+import androidx.compose.foundation.layout.width+import androidx.compose.foundation.layout.wrapContentSize+import androidx.compose.material3.Icon+import androidx.compose.material3.Text+import androidx.compose.runtime.Composable+import androidx.compose.runtime.LaunchedEffect+import androidx.compose.runtime.getValue+import androidx.compose.runtime.mutableFloatStateOf+import androidx.compose.runtime.mutableStateOf+import androidx.compose.runtime.remember+import androidx.compose.runtime.rememberUpdatedState+import androidx.compose.runtime.setValue+import androidx.compose.ui.Alignment+import androidx.compose.ui.Modifier+import androidx.compose.ui.draw.clip+import androidx.compose.ui.geometry.Rect+import androidx.compose.ui.graphics.graphicsLayer+import androidx.compose.ui.layout.Layout+import androidx.compose.ui.layout.onSizeChanged+import androidx.compose.ui.platform.LocalDensity+import androidx.compose.ui.text.style.TextOverflow+import androidx.compose.ui.unit.Constraints+import androidx.compose.ui.unit.Dp+import androidx.compose.ui.unit.dp+import androidx.compose.ui.util.lerp+import com.chethan616.clearpdf.ui.theme.Candy+import com.chethan616.clearpdf.ui.theme.ClearType+import com.chethan616.clearpdf.ui.theme.clear+import com.kyant.backdrop.drawBackdrop+import com.kyant.shapes.RoundedRectangle+import kotlin.math.roundToInt+import kotlinx.coroutines.coroutineScope+import kotlinx.coroutines.launch++/**+ * A round glass button that morphs into its menu, as the old app's share button morphs into its+ * capsule: the glass itself grows from the circle at [anchor] (its window bounds) into the card, its+ * rim and lens following the shape the whole way, on one glass spring (Settings ▸ Motion, damped+ * enough that a resizing glass doesn't ring on); the [glyph] cross-fades into the rows on a fade that+ * never bounces, and the rows' icons pop in with it. Dismissed, it shrinks back into the circle; an+ * item chosen fades it where it is. Keep the real button hidden from the tap until [onGone].+ */+@Composable+fun GlassMorphMenu(+ open: Boolean,+ anchor: Rect,+ onDismiss: () -> Unit,+ onGone: () -> Unit,+ items: List<GlassMenuItem>,+ width: Dp = 236.dp,+ glyph: @Composable () -> Unit,+) {+ val c = clear+ GlassOverlay {+ BackHandler(enabled = open, onBack = onDismiss)+ val host = LocalGlassOverlayHost.current ?: return@GlassOverlay+ val density = LocalDensity.current+ // 0 = the button, 1 = the menu: the glass's width and height, in layout only+ val grow = remember { Animatable(0f) }+ // the glyph out and the rows in, on the same beat as the glass but never past either end+ val shown = remember { Animatable(0f) }+ val pop = remember { Animatable(0f) }+ val fade = remember { Animatable(1f) }+ var chosen by remember { mutableStateOf(false) }+ val gone by rememberUpdatedState(onGone)+ LaunchedEffect(open) {+ coroutineScope {+ when {+ open -> {+ launch { shown.animateTo(1f, ContentIn) }+ launch { pop.animateTo(1f, GlassMotion.pop()) }+ grow.animateTo(1f, morphSpring())+ }+ chosen -> fade.animateTo(0f, Fluid.fade())+ else -> {+ launch { shown.animateTo(0f, ContentOut) }+ launch { pop.animateTo(0f, ContentOut) }+ grow.animateTo(0f, morphSpring())+ }+ }+ }+ if (!open) gone()+ }+ if (open) Box(Modifier.fillMaxSize().clickable(remember { MutableInteractionSource() }, null, onClick = onDismiss))+ val local = Rect(host.windowToLocal(anchor.topLeft), host.windowToLocal(anchor.bottomRight))+ val right = local.center.x > host.size.width / 2f+ val corner = if (right) Alignment.TopEnd else Alignment.TopStart+ val button = with(density) { local.height.toDp() }+ // half the button's height: a circle at the button's size, the menu's corners at full size+ val shape = RoundedRectangle(button / 2)+ val style = GlassSettings.style+ val backdrop = LocalBackdrop.current+ var fullHeight by remember { mutableFloatStateOf(0f) }+ Layout(+ content = {+ Box(+ Modifier+ .graphicsLayer { alpha = fade.value }+ .drawBackdrop(+ backdrop = backdrop,+ shape = { shape },+ shadow = null,+ effects = { glassEffects(style, 4f.dp.toPx(), 12f.dp.toPx(), 24f.dp.toPx()) },+ highlight = { glassHighlight(style) },+ onDrawSurface = {+ // the button's glass, frosting over as it becomes a menu so the rows read+ drawRect(c.glass.glassTint(style))+ drawRect(c.frost.glassTint(style), alpha = shown.value.coerceIn(0f, 1f) * 0.9f)+ },+ )+ .clip(shape),+ ) {+ Column(+ Modifier+ .wrapContentSize(corner, unbounded = true)+ .width(width)+ .onSizeChanged { fullHeight = it.height.toFloat() }+ .graphicsLayer { alpha = ((shown.value - 0.3f) / 0.7f).coerceIn(0f, 1f) },+ ) {+ Spacer(Modifier.height(6.dp))+ items.forEach { item ->+ Row(+ Modifier.fillMaxWidth()+ .pressable({ if (open) { chosen = true; onDismiss(); item.onClick() } })+ .padding(horizontal = 18.dp, vertical = 12.dp),+ verticalAlignment = Alignment.CenterVertically,+ ) {+ Text(item.label, style = ClearType.BodyStrong, color = if (item.destructive) Candy.Tomato else c.ink, modifier = Modifier.weight(1f), maxLines = 1, overflow = TextOverflow.Ellipsis)+ if (item.icon != null) {+ Icon(+ item.icon, null,+ tint = if (item.destructive) Candy.Tomato else c.inkSoft,+ modifier = Modifier.size(20.dp).graphicsLayer {+ val s = pop.value.coerceAtLeast(0f)+ scaleX = s+ scaleY = s+ },+ )+ }+ }+ }+ Spacer(Modifier.height(6.dp))+ }+ Box(+ Modifier.align(corner).size(button).graphicsLayer { alpha = (1f - shown.value * 2.2f).coerceIn(0f, 1f) },+ contentAlignment = Alignment.Center,+ ) { glyph() }+ }+ },+ modifier = Modifier.fillMaxSize(),+ ) { measurables, constraints ->+ val fullW = width.toPx()+ val fullH = if (fullHeight > 0f) fullHeight else local.height+ val g = grow.value+ // past full size by what the spring throws; never smaller than most of the button+ val w = lerp(local.width, fullW, g).coerceAtLeast(local.width * 0.8f)+ val h = lerp(local.height, fullH, g).coerceAtLeast(local.height * 0.8f)+ val card = measurables.first().measure(Constraints.fixed(w.roundToInt(), h.roundToInt()))+ layout(constraints.maxWidth, constraints.maxHeight) {+ val x = if (right) local.right - w else local.left+ // grows down from the button, or up when there is no room below+ val y = if (local.top + fullH < constraints.maxHeight) local.top else local.bottom - h+ card.place(x.roundToInt(), y.roundToInt())+ }+ }+ }+}++/** The glass growing or shrinking: the motion setting's spring, with a floor on damping (a resizing glass re-blurs every frame). */+private fun morphSpring(): SpringSpec<Float> =+ spring(maxOf(MotionSettings.damping(0.75f), 0.62f), MotionSettings.stiffness(480f), visibilityThreshold = 0.002f)++private val ContentIn = spring<Float>(dampingRatio = 1f, stiffness = 380f)+private val ContentOut = spring<Float>(dampingRatio = 1f, stiffness = 900f)diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Motion.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Motion.ktindex 2b3a198..6df802a 100644--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Motion.kt+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Motion.kt@@ -1,13 +1,23 @@package com.chethan616.clearpdf.ui.glassimport android.content.Context+import androidx.compose.animation.core.CubicBezierEasing+import androidx.compose.animation.core.Easingimport androidx.compose.animation.core.Springimport androidx.compose.animation.core.SpringSpec+import androidx.compose.animation.core.TweenSpecimport androidx.compose.animation.core.spring+import androidx.compose.animation.core.tweenimport androidx.compose.runtime.Immutableimport androidx.compose.runtime.getValueimport androidx.compose.runtime.mutableStateOfimport androidx.compose.runtime.setValue+import kotlin.math.PI+import kotlin.math.cos+import kotlin.math.exp+import kotlin.math.ln+import kotlin.math.roundToInt+import kotlin.math.sin/*** How springy the glass moves: multipliers on the designed physics, so [Normal] is the design exactly.@@ -34,14 +44,66 @@ data class MotionStyle(}}+/** A cubic-bezier easing curve from (0, 0) to (1, 1) through two handles, as CSS and Figma write it. */+@Immutable+data class EaseCurve(val x1: Float, val y1: Float, val x2: Float, val y2: Float) {+ val easing: Easing get() = CubicBezierEasing(x1, y1, x2, y2)++ companion object {+ /** UIKit's drawer curve: fast out, a long gentle landing (the app's own). */+ val Drawer = EaseCurve(0.32f, 0.72f, 0f, 1f)+ val Standard = EaseCurve(0.4f, 0f, 0.2f, 1f)+ val Emphasized = EaseCurve(0.05f, 0.7f, 0.1f, 1f)+ val EaseInOut = EaseCurve(0.42f, 0f, 0.58f, 1f)+ val Linear = EaseCurve(0f, 0f, 1f, 1f)+ val Presets = listOf(Drawer, Standard, Emphasized, EaseInOut, Linear)+ }+}+object MotionSettings {private const val PREFS = "glass"var style: MotionStyle by mutableStateOf(MotionStyle.Default)private set+ /** The curve screens, sheets and fades travel on (Settings ▸ Liquid glass & motion). */+ var curve: EaseCurve by mutableStateOf(EaseCurve.Drawer)+ private set++ /** Multiplies every tween's time: 1 is the design. */+ var duration: Float by mutableStateOf(1f)+ private set++ private var cachedCurve: EaseCurve? = null+ private var cachedEasing: Easing = EaseCurve.Drawer.easing++ val easing: Easing+ get() {+ val c = curve+ if (c != cachedCurve) {+ cachedCurve = c+ cachedEasing = c.easing+ }+ return cachedEasing+ }++ fun updateCurve(context: Context, c: EaseCurve, save: Boolean = true) {+ curve = c+ if (save) context.getSharedPreferences(PREFS, Context.MODE_PRIVATE).edit()+ .putString("motion_curve", "${c.x1},${c.y1},${c.x2},${c.y2}").apply()+ }++ fun updateDuration(context: Context, d: Float) {+ duration = d+ context.getSharedPreferences(PREFS, Context.MODE_PRIVATE).edit().putFloat("motion_duration", d).apply()+ }+fun load(context: Context) {val p = context.getSharedPreferences(PREFS, Context.MODE_PRIVATE)+ p.getString("motion_curve", null)?.split(',')?.mapNotNull { it.toFloatOrNull() }?.takeIf { it.size == 4 }?.let {+ curve = EaseCurve(it[0], it[1], it[2], it[3])+ }+ duration = p.getFloat("motion_duration", 1f)val d = MotionStyle.Defaultstyle = MotionStyle(bounce = p.getFloat("motion_bounce", d.bounce),@@ -72,42 +134,85 @@ object MotionSettings {}/**- * The shared springs. Bounce belongs on draw-time properties (scale, translation, rotation), never on- * layout or alpha: a bouncing size re-runs the glass blur every overshoot frame, a bouncing alpha flickers.+ * Motion for everything that is not a liquid glass control: screens, sheets, dialogs, menus, cards,+ * chips, toasts. Apple's way by default: a quick start and a long, soft landing, never past the+ * target. Its curve and pace are the user's (Settings ▸ Liquid glass & motion ▸ Screen transitions).*/-object GlassMotion {- /** Springs open: capsules, chevrons, thumbs. ~8 % overshoot. */- fun <T> morph(): SpringSpec<T> = spring(MotionSettings.damping(0.58f), MotionSettings.stiffness(420f))+object Fluid {+ /** The curve for pushes and sheets: UIKit's "drawer" curve unless the user drew another. */+ val Ease: Easing get() = MotionSettings.easing- /** Small things landing: icons, beads, toasts. */- fun <T> pop(): SpringSpec<T> = spring(MotionSettings.damping(0.45f), MotionSettings.stiffness(500f))+ /** For small things fading or sliding a short way. */+ val Soft: Easing = CubicBezierEasing(0.25f, 0.1f, 0.25f, 1f)- /** Alpha and layout. Never bounces. */- fun <T> settle(): SpringSpec<T> = spring(dampingRatio = 1f, stiffness = Spring.StiffnessMedium)+ private fun ms(designed: Int): Int = (designed * MotionSettings.duration.coerceIn(0.3f, 3f)).roundToInt()++ /** A screen pushed in. */+ fun <T> push(): TweenSpec<T> = tween(ms(420), easing = Ease)++ /** A screen popped (Back): a touch quicker than the push. */+ fun <T> pop(): TweenSpec<T> = tween(ms(360), easing = Ease)- /** Finger down: lands in ~80 ms, barely overshoots. */- fun <T> pressIn(): SpringSpec<T> = spring(MotionSettings.damping(0.72f), MotionSettings.stiffness(900f))+ /** A sheet, a dialog, a document rising. */+ fun <T> rise(): TweenSpec<T> = tween(ms(400), easing = Ease)- /** Finger up: one small swing past rest. */- fun <T> pressOut(): SpringSpec<T> = spring(MotionSettings.damping(0.46f), MotionSettings.stiffness(420f))+ /** Anything going away. */+ fun <T> dismiss(): TweenSpec<T> = tween(ms(260), easing = Ease)- /** Menus unfolding from their anchor: width first ... */+ /** A sheet leaving: it eases away, then gathers speed off the edge, rather than sinking slowly out of sight. */+ fun <T> sheetLeave(): TweenSpec<T> = tween(ms(240), easing = Leave)++ private val Leave: Easing = CubicBezierEasing(0.3f, 0f, 0.8f, 0.5f)++ /** Small changes: a title swapping, a chip lighting, an icon turning. */+ fun <T> quick(): TweenSpec<T> = tween(ms(260), easing = Ease)++ /** Fades. */+ fun <T> fade(): TweenSpec<T> = tween(ms(200), easing = Soft)++ /** Values that follow something (an interrupted drag, a moving target): no overshoot. */+ fun <T> follow(): SpringSpec<T> = spring(dampingRatio = 1f, stiffness = 520f)++ /** A finger on a flat surface (cards, rows): it sinks fast ... */+ fun <T> pressIn(): SpringSpec<T> = spring(dampingRatio = 1f, stiffness = 1800f)++ /** ... and comes back softly, never past rest. */+ fun <T> pressOut(): SpringSpec<T> = spring(dampingRatio = 1f, stiffness = 420f)++ /** How far a flat pressable sinks. */+ const val PressedScale = 0.97f+}++/**+ * The liquid glass's motion: springs tuned by Settings ▸ Motion (menus, dialogs, toasts, the + fan,+ * the recorder pill, the press feel in `Press.kt`). Overshoot belongs on draw-time properties+ * (scale, translation, rotation), never on alpha (it flickers); layout values may swing only if+ * clamped. Sheets keep one well-damped spring of their own whatever the setting (`Overlays.kt`).+ */+object GlassMotion {+ /** Alpha and colour. Never bounces. */+ fun <T> settle(): SpringSpec<T> = spring(dampingRatio = 1f, stiffness = Spring.StiffnessMedium)++ /** A menu unfolding: its width leads and settles with a soft overshoot (the one every entrance is judged against). */fun <T> unfold(): SpringSpec<T> = spring(MotionSettings.damping(0.68f), MotionSettings.stiffness(420f))- /** ... then the height a beat behind, like a drop of gel. */+ /** The menu's height, a beat behind its width. */fun <T> unfoldLag(): SpringSpec<T> = spring(MotionSettings.damping(0.6f), MotionSettings.stiffness(340f))- /** Folding away: fast and critically damped. Dismissals never bounce. */- fun <T> fold(): SpringSpec<T> = spring(dampingRatio = 1f, stiffness = MotionSettings.stiffness(900f))+ /** Springs open: capsules, chevrons, thumbs, dialogs, toasts. */+ fun <T> morph(): SpringSpec<T> = spring(MotionSettings.damping(0.58f), MotionSettings.stiffness(420f))- /** Entrances of whole blocks: a soft rise with a little overshoot. */- fun <T> rise(): SpringSpec<T> = spring(MotionSettings.damping(0.62f), MotionSettings.stiffness(220f))+ /** A small thing popping into place: fan chips, the + glyph. */+ fun <T> pop(): SpringSpec<T> = spring(MotionSettings.damping(0.45f), MotionSettings.stiffness(500f))++ /** The recorder pill growing: slow and soft, with a floor on damping so Jelly cannot ring on. */+ fun <T> shape(): SpringSpec<T> = spring(maxOf(MotionSettings.damping(0.6f), ShapeMinDamping), MotionSettings.stiffness(105f))- val PressedScale: Float get() = 1f - 0.06f * MotionSettings.style.press.coerceIn(0f, 2.5f)+ /** The recorder pill shrinking back. */+ fun <T> shapeBack(): SpringSpec<T> = spring(maxOf(MotionSettings.damping(0.62f), ShapeMinDamping), MotionSettings.stiffness(125f))++ private const val ShapeMinDamping = 0.46f/** A tap shorter than this still plays the whole press. */const val MinPressMillis = 90L-- /** A tapped back button waits this long so its press is seen first. */- const val BackTapDelayMillis = 280L}diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Overlays.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Overlays.ktindex a39d281..21e83b1 100644--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Overlays.kt+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Overlays.kt@@ -6,6 +6,12 @@ import androidx.compose.animation.core.AnimationVector1Dimport androidx.compose.foundation.backgroundimport androidx.compose.foundation.interaction.MutableInteractionSourceimport androidx.compose.foundation.clickable+import androidx.compose.foundation.gestures.Orientation+import androidx.compose.foundation.gestures.draggable+import androidx.compose.foundation.gestures.rememberDraggableState+import androidx.compose.animation.core.spring+import androidx.compose.runtime.rememberCoroutineScope+import androidx.compose.ui.layout.onSizeChangedimport androidx.compose.foundation.layout.Arrangementimport androidx.compose.foundation.layout.Boximport androidx.compose.foundation.layout.BoxScope@@ -13,6 +19,7 @@ import androidx.compose.foundation.layout.Columnimport androidx.compose.foundation.layout.ColumnScopeimport androidx.compose.foundation.layout.Rowimport androidx.compose.foundation.layout.Spacer+import androidx.compose.foundation.layout.WindowInsetsimport androidx.compose.foundation.layout.fillMaxSizeimport androidx.compose.foundation.layout.fillMaxWidthimport androidx.compose.foundation.layout.height@@ -22,6 +29,7 @@ import androidx.compose.foundation.layout.navigationBarsPaddingimport androidx.compose.foundation.layout.paddingimport androidx.compose.foundation.layout.sizeimport androidx.compose.foundation.layout.statusBarsPadding+import androidx.compose.foundation.layout.systemBarsimport androidx.compose.foundation.layout.widthimport androidx.compose.foundation.layout.widthInimport androidx.compose.foundation.rememberScrollState@@ -52,9 +60,12 @@ import androidx.compose.ui.graphics.graphicsLayerimport androidx.compose.ui.graphics.vector.ImageVectorimport androidx.compose.ui.layout.Layoutimport androidx.compose.ui.platform.LocalDensity+import androidx.compose.ui.platform.LocalViewimport androidx.compose.ui.text.input.PasswordVisualTransformationimport androidx.compose.ui.text.input.VisualTransformation+import androidx.compose.ui.text.style.TextAlignimport androidx.compose.ui.text.style.TextOverflow+import androidx.compose.ui.unit.spimport androidx.compose.ui.unit.Constraintsimport androidx.compose.ui.unit.IntOffsetimport androidx.compose.ui.unit.dp@@ -64,17 +75,11 @@ import com.chethan616.clearpdf.ui.theme.ClearTypeimport com.chethan616.clearpdf.ui.theme.clearimport com.kyant.shapes.Capsuleimport com.kyant.shapes.RoundedRectangle+import com.kyant.backdrop.floatingLayerimport kotlin.math.roundToInt+import kotlin.math.tanhimport kotlinx.coroutines.launch-/** A 0 → 1 entrance on [spec], read in draw. */-@Composable-private fun rememberAppear(): Animatable<Float, AnimationVector1D> {- val a = remember { Animatable(0f) }- LaunchedEffect(Unit) { a.animateTo(1f, GlassMotion.morph()) }- return a-}-/** The dim behind a dialog or sheet; a tap on it dismisses. */@Composableprivate fun BoxScope.Scrim(appear: Animatable<Float, AnimationVector1D>, onDismiss: () -> Unit) {@@ -88,8 +93,10 @@ private fun BoxScope.Scrim(appear: Animatable<Float, AnimationVector1D>, onDismi}/**- * A dialog: a frosted card that springs up from 82 %, an optional candy [icon] blob, a big title,- * then [content] and the buttons. [destructive] paints the confirm button tomato.+ * A dialog: a frosted card that springs in from 90 % (a glass spring) and fades quickly away, an+ * optional candy [icon] blob, a big title, then [content] and the buttons. [destructive] paints the+ * confirm button tomato. [centered] sets it out as an alert: everything centred, the buttons side+ * by side across the card.*/@Composablefun GlassDialog(@@ -104,13 +111,16 @@ fun GlassDialog(icon: ImageVector? = null,accent: Color = Candy.Sky,dismissible: Boolean = true,+ centered: Boolean = false,content: @Composable ColumnScope.() -> Unit = {},) {val c = clearval tint = if (destructive) Candy.Tomato else accent- GlassOverlay {- BackHandler(enabled = dismissible, onBack = onDismiss)- val appear = rememberAppear()+ GlassOverlay(animatesOut = true) {+ val leaving = LocalOverlayPresence.current?.leaving == true+ BackHandler(enabled = dismissible && !leaving, onBack = onDismiss)+ // pops in on a glass spring (a little past full size, then settles); leaves quickly, no bounce+ val appear = rememberOverlayAppear(enter = GlassMotion.morph(), exit = Fluid.dismiss())Box(Modifier.fillMaxSize().imePadding(), contentAlignment = Alignment.Center) {Scrim(appear) { if (dismissible) onDismiss() }GlassCard(@@ -118,19 +128,21 @@ fun GlassDialog(.padding(24.dp).widthIn(max = 380.dp).fillMaxWidth()- .graphicsLayer {- val s = lerp(0.82f, 1f, appear.value)+ .floatingLayer {+ val s = lerp(0.9f, 1f, appear.value)scaleX = sscaleY = salpha = appear.value.coerceIn(0f, 1f)- compositingStrategy = CompositingStrategy.ModulateAlpha}.clickable(remember { MutableInteractionSource() }, null) {},shape = RoundedRectangle(34.dp),wash = c.frost,blur = 16.dp,) {- Column(Modifier.padding(start = 22.dp, end = 22.dp, top = 22.dp, bottom = 18.dp)) {+ Column(+ Modifier.padding(start = 22.dp, end = 22.dp, top = 22.dp, bottom = 18.dp),+ horizontalAlignment = if (centered) Alignment.CenterHorizontally else Alignment.Start,+ ) {if (icon != null) {Box(Modifier.size(46.dp).clip(CircleShape).background(tint), contentAlignment = Alignment.Center) {Icon(icon, null, tint = Color.White, modifier = Modifier.size(24.dp))@@ -138,16 +150,23 @@ fun GlassDialog(Spacer(Modifier.height(14.dp))}if (title != null) {- Text(title, style = ClearType.Headline, color = c.ink)+ Text(+ title, style = if (centered) ClearType.Title.copy(fontSize = 19.sp, lineHeight = 24.sp) else ClearType.Headline, color = c.ink,+ textAlign = if (centered) TextAlign.Center else TextAlign.Start,+ )Spacer(Modifier.height(10.dp))}Column(Modifier.heightIn(max = 420.dp).verticalScroll(rememberScrollState())) { content() }if (confirm != null || dismiss != null) {Spacer(Modifier.height(20.dp))- Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.spacedBy(10.dp, Alignment.End)) {+ Row(+ Modifier.fillMaxWidth(),+ horizontalArrangement = Arrangement.spacedBy(10.dp, if (centered) Alignment.CenterHorizontally else Alignment.End),+ ) {+ val each = if (centered) Modifier.weight(1f) else Modifierif (dismiss != null) {- GlassPill(onClick = { (onDismissButton ?: onDismiss)() }, height = 46.dp) {- Text(dismiss, style = ClearType.BodyStrong, color = c.ink)+ GlassPill(onClick = { (onDismissButton ?: onDismiss)() }, height = 46.dp, modifier = each) {+ Text(dismiss, style = ClearType.BodyStrong, color = c.ink, maxLines = 1)}}if (confirm != null) {@@ -155,7 +174,8 @@ fun GlassDialog(onClick = { if (confirmEnabled) onConfirm() },tint = if (confirmEnabled) tint else c.inkFaint,height = 46.dp,- ) { Text(confirm, style = ClearType.BodyStrong, color = Color.White) }+ modifier = each,+ ) { Text(confirm, style = ClearType.BodyStrong, color = Color.White, maxLines = 1) }}}}@@ -166,8 +186,13 @@ fun GlassDialog(}/**- * A sheet: a floating frosted card along the bottom, inset from the edges, that rises on a spring.- * [title] in the headline face, an optional [subtitle], then [content].+ * A sheet: a floating frosted card along the bottom, inset from the edges. It rises on the glass+ * spring (Settings ▸ Motion sets how far it swings) and the title and rows fade in a beat behind, then+ * it slides away on an accelerating curve. [title] in the headline face, an optional [subtitle], then+ * [content].+ *+ * Cost while it moves: the card slides as a finished texture ([floatingLayer]); nothing behind it is+ * re-sampled or re-blurred until it has settled.*/@Composablefun GlassSheet(@@ -178,10 +203,15 @@ fun GlassSheet(content: @Composable ColumnScope.() -> Unit,) {val c = clear- GlassOverlay {- BackHandler(onBack = onDismiss)- val appear = rememberAppear()+ GlassOverlay(animatesOut = true) {+ val leaving = LocalOverlayPresence.current?.leaving == true+ BackHandler(enabled = !leaving, onBack = onDismiss)+ val appear = rememberOverlayAppear(enter = SheetEnter, exit = SheetExit)val density = LocalDensity.current+ val scope = rememberCoroutineScope()+ // the finger's pull on the sheet, in px: down follows 1:1, up rubber-bands+ val drag = remember { Animatable(0f) }+ var height by remember { mutableStateOf(0f) }val overlayHeight = LocalGlassOverlayHost.current?.size?.height ?: 0Box(Modifier.fillMaxSize().imePadding(), contentAlignment = Alignment.BottomCenter) {Scrim(appear, onDismiss)@@ -193,17 +223,38 @@ fun GlassSheet(.widthIn(max = 560.dp).fillMaxWidth().heightIn(max = maxH)- .graphicsLayer {- val p = appear.value- translationY = (1f - p) * 96.dp.toPx()- val s = lerp(0.94f, 1f, p)- scaleX = s- scaleY = s- transformOrigin = TransformOrigin(0.5f, 1f)- alpha = p.coerceIn(0f, 1f)- compositingStrategy = CompositingStrategy.ModulateAlpha+ .onSizeChanged { height = it.height.toFloat() }+ .floatingLayer {+ val travel = size.height + 48.dp.toPx()+ translationY = (1f - appear.value) * travel + drag.value+ val up = (-drag.value).coerceAtLeast(0f)+ if (up > 0f && size.height > 0f) {+ scaleY = 1f + up / size.height * 0.5f+ transformOrigin = TransformOrigin(0.5f, 1f)+ }}- .clickable(remember { MutableInteractionSource() }, null) {},+ .clickable(remember { MutableInteractionSource() }, null) {}+ .draggable(+ rememberDraggableState { delta ->+ val cur = drag.value+ val next = if (cur + delta < 0f) cur + delta * 0.25f else cur + delta+ scope.launch { drag.snapTo(next.coerceAtLeast(-with(density) { 40.dp.toPx() })) }+ },+ Orientation.Vertical,+ enabled = !leaving,+ onDragStopped = { velocity ->+ if (drag.value > height * 0.3f || velocity > 1200f) {+ // carry on from where the finger let go+ val travel = height + with(density) { 48.dp.toPx() }+ val from = 1f - (drag.value / travel).coerceIn(0f, 1f)+ drag.snapTo(0f)+ appear.snapTo(from)+ onDismiss()+ } else {+ drag.animateTo(0f, spring(MotionSettings.damping(0.7f), MotionSettings.stiffness(500f)), velocity)+ }+ },+ ),shape = RoundedRectangle(32.dp),wash = c.frost,blur = 16.dp,@@ -225,6 +276,11 @@ fun GlassSheet(}}+// the old app's sheet, a shade bouncier: it rises ~3 % past rest and settles once, whatever the motion+// setting (scaled by Jelly it shivered)+private val SheetEnter = spring<Float>(dampingRatio = 0.74f, stiffness = 380f, visibilityThreshold = 0.001f)+private val SheetExit = spring<Float>(dampingRatio = 1f, stiffness = 600f, visibilityThreshold = 0.001f)+/** A row of a sheet or menu: a candy icon blob, a label, an optional value. */@Composablefun GlassRow(@@ -265,14 +321,19 @@ data class GlassMenuItem(val label: String, val icon: ImageVector? = null, val d@Composablefun GlassMenu(anchor: Rect, onDismiss: () -> Unit, items: List<GlassMenuItem>) {val c = clear- GlassOverlay {- BackHandler(onBack = onDismiss)+ GlassOverlay(animatesOut = true) {+ val leaving = LocalOverlayPresence.current?.leaving == true+ BackHandler(enabled = !leaving, onBack = onDismiss)val host = LocalGlassOverlayHost.current ?: return@GlassOverlay- val w = remember { Animatable(0f) }- val h = remember { Animatable(0f) }- LaunchedEffect(Unit) {- launch { w.animateTo(1f, GlassMotion.unfold()) }- launch { h.animateTo(1f, GlassMotion.unfoldLag()) }+ val bars = WindowInsets.systemBars+ val view = LocalView.current+ // unfolds out of its button like a drop of gel: width first, the height a beat behind, each on+ // a glass spring (Settings ▸ Motion) that swells a little past rest and settles;+ // folding back into the button is quick and never bounces+ val appear = rememberOverlayAppear(enter = GlassMotion.unfold(), exit = Fluid.dismiss())+ val lag = remember { Animatable(0f) }+ LaunchedEffect(leaving) {+ if (!leaving) lag.animateTo(1f, GlassMotion.unfoldLag()) else lag.animateTo(0f, Fluid.dismiss())}Box(Modifier.fillMaxSize().clickable(remember { MutableInteractionSource() }, null, onClick = onDismiss))val local = Rect(host.windowToLocal(anchor.topLeft), host.windowToLocal(anchor.bottomRight))@@ -284,12 +345,12 @@ fun GlassMenu(anchor: Rect, onDismiss: () -> Unit, items: List<GlassMenuItem>) {GlassCard(Modifier.width(236.dp)- .graphicsLayer {- scaleX = lerp(0.4f, 1f, w.value)- scaleY = lerp(0.2f, 1f, h.value)+ .floatingLayer {+ val p = appear.value+ scaleX = lerp(0.5f, 1f, p).coerceAtLeast(0.2f)+ scaleY = lerp(0.35f, 1f, lag.value).coerceAtLeast(0.2f)transformOrigin = TransformOrigin(if (fromRight) 1f else 0f, if (fromBelow) 0f else 1f)- alpha = (h.value * 1.6f).coerceIn(0f, 1f)- compositingStrategy = CompositingStrategy.ModulateAlpha+ alpha = (p * 1.6f).coerceIn(0f, 1f)},shape = RoundedRectangle(24.dp),wash = c.frost,@@ -308,17 +369,27 @@ fun GlassMenu(anchor: Rect, onDismiss: () -> Unit, items: List<GlassMenuItem>) {Spacer(Modifier.height(6.dp))}},- modifier = Modifier.fillMaxSize().statusBarsPadding().navigationBarsPadding(),+ modifier = Modifier.fillMaxSize(),) { measurables, constraints ->val p = measurables.first().measure(Constraints(maxWidth = constraints.maxWidth, maxHeight = constraints.maxHeight))+ // the system bars are in the way only where this portal reaches under them: the app's does,+ // a card's (Quick Preview) doesn't. Positions stay in the portal's own space, unshifted.+ val origin = host.originInWindow+ val root = view.rootView+ val barTop = (bars.getTop(this) - origin.y).coerceAtLeast(0f)+ val barBottom = (bars.getBottom(this) - (root.height - origin.y - constraints.maxHeight)).coerceAtLeast(0f)+ val barLeft = (bars.getLeft(this, layoutDirection) - origin.x).coerceAtLeast(0f)+ val barRight = (bars.getRight(this, layoutDirection) - (root.width - origin.x - constraints.maxWidth)).coerceAtLeast(0f)layout(constraints.maxWidth, constraints.maxHeight) {val right = local.center.x > constraints.maxWidth / 2ffromRight = rightval x = if (right) (local.right - p.width) else local.left- val below = local.bottom + 6f + p.height < constraints.maxHeight - margin+ val below = local.bottom + 6f + p.height < constraints.maxHeight - barBottom - marginfromBelow = belowval y = if (below) local.bottom + 6f else local.top - 6f - p.height- p.place(IntOffset(x.coerceIn(margin, constraints.maxWidth - p.width - margin).roundToInt(), y.coerceAtLeast(margin).roundToInt()))+ val minX = barLeft + margin+ val maxX = (constraints.maxWidth - barRight - p.width - margin).coerceAtLeast(minX)+ p.place(IntOffset(x.coerceIn(minX, maxX).roundToInt(), y.coerceAtLeast(barTop + margin).roundToInt()))}}}@@ -363,18 +434,18 @@ fun GlassTextField()}-/** A toast: a glass capsule that pops in above the dock, with an optional candy action. */+/** A toast: a glass capsule that rises in above the dock, with an optional candy action. */@Composablefun GlassToast(text: String, action: String?, onAction: () -> Unit, modifier: Modifier = Modifier) {val c = clear- val appear = rememberAppear()+ val appear = remember { Animatable(0f) }+ LaunchedEffect(Unit) { appear.animateTo(1f, GlassMotion.morph()) }Row(modifier- .graphicsLayer {+ .floatingLayer {val p = appear.valuetranslationY = (1f - p) * 24.dp.toPx()alpha = p.coerceIn(0f, 1f)- compositingStrategy = CompositingStrategy.ModulateAlpha}.widthIn(max = 520.dp).glass(Capsule, c.frost, blur = 12.dp)diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Pages.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Pages.ktnew file mode 100644index 0000000..b8f7036--- /dev/null+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Pages.kt@@ -0,0 +1,85 @@+package com.chethan616.clearpdf.ui.glass++import androidx.compose.animation.core.animateFloatAsState+import androidx.compose.foundation.background+import androidx.compose.foundation.border+import androidx.compose.foundation.layout.Box+import androidx.compose.foundation.layout.fillMaxSize+import androidx.compose.foundation.layout.size+import androidx.compose.foundation.shape.CircleShape+import androidx.compose.runtime.Composable+import androidx.compose.runtime.getValue+import androidx.compose.ui.Alignment+import androidx.compose.ui.Modifier+import androidx.compose.ui.draw.clip+import androidx.compose.ui.graphics.Color+import androidx.compose.ui.graphics.graphicsLayer+import androidx.compose.ui.semantics.Role+import androidx.compose.ui.unit.dp+import com.chethan616.clearpdf.ui.theme.Candy+import com.chethan616.clearpdf.ui.theme.clear++/**+ * A screen of its own (a tool, the pages, a signature) standing on the app's wallpaper, as a glass+ * layer: the glass Back, pills and panels on it refract it and follow Settings ▸ Liquid glass & motion.+ */+@Composable+fun AuroraScreen(mood: AuroraMood = AuroraMoods.Tools, content: @Composable () -> Unit) {+ GlassHost(Modifier.fillMaxSize(), paint = { Aurora(mood) }) { content() }+}++/**+ * A worded action (Cancel, Save, Sign, Trust): a glass pill, candy when [primary], faint while it+ * can't be used. It presses and springs as Settings ▸ Liquid glass & motion says.+ */+@Composable+fun GlassTextAction(label: String, onClick: () -> Unit, modifier: Modifier = Modifier, enabled: Boolean = true, primary: Boolean = false, accent: Color = Candy.Sky) {+ val c = clear+ GlassPill(+ onClick = { if (enabled) onClick() },+ modifier = modifier,+ tint = if (primary && enabled) accent else Color.Unspecified,+ height = 42.dp,+ horizontalPadding = 16.dp,+ label = label,+ ) {+ androidx.compose.material3.Text(+ label, style = com.chethan616.clearpdf.ui.theme.ClearType.BodyStrong, maxLines = 1,+ color = when {+ primary && enabled -> Color.White+ enabled -> c.ink+ else -> c.inkFaint+ },+ )+ }+}++/** A round choice: a ring that springs into a candy disc with a white dot when chosen. */+@Composable+fun GlassRadio(selected: Boolean, onClick: () -> Unit, modifier: Modifier = Modifier, accent: Color = Candy.Sky) {+ val c = clear+ val on by animateFloatAsState(if (selected) 1f else 0f, GlassMotion.morph(), label = "radio")+ Box(modifier.size(36.dp).pressable(onClick, pressedScale = 0.85f, role = Role.RadioButton), contentAlignment = Alignment.Center) {+ Box(Modifier.size(24.dp).border(2.dp, c.ink.copy(alpha = 0.4f * (1f - on.coerceIn(0f, 1f))), CircleShape))+ Box(+ Modifier.size(24.dp).graphicsLayer { scaleX = on.coerceAtLeast(0f); scaleY = on.coerceAtLeast(0f) }.clip(CircleShape).background(accent),+ contentAlignment = Alignment.Center,+ ) { Box(Modifier.size(9.dp).clip(CircleShape).background(Color.White)) }+ }+}++/** A round tick for picking things (pages, files): a faint ring, springing into a mint disc with a check. */+@Composable+fun GlassTick(selected: Boolean, modifier: Modifier = Modifier, accent: Color = Candy.Mint) {+ val c = clear+ val on by animateFloatAsState(if (selected) 1f else 0f, GlassMotion.morph(), label = "tick")+ Box(modifier.size(24.dp), contentAlignment = Alignment.Center) {+ Box(Modifier.size(22.dp).clip(CircleShape).background(Color.White.copy(alpha = 0.55f)).border(2.dp, c.ink.copy(alpha = 0.35f), CircleShape))+ Box(+ Modifier.size(22.dp).graphicsLayer { scaleX = on.coerceAtLeast(0f); scaleY = on.coerceAtLeast(0f) }.clip(CircleShape).background(accent),+ contentAlignment = Alignment.Center,+ ) {+ androidx.compose.material3.Icon(com.chethan616.clearpdf.ui.LucideIcons.Check, null, tint = Color.White, modifier = Modifier.size(14.dp))+ }+ }+}diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Press.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Press.ktindex 41154fd..93edff7 100644--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Press.kt+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Press.kt@@ -171,7 +171,11 @@ class InteractiveHighlight(@RequiresApi(Build.VERSION_CODES.TIRAMISU)private object PressGlow {- fun create(): Shader = RuntimeShader(+ // one compiled shader for every button: each press sets its uniforms and draws in the same UI-thread+ // step, and a paint snapshots them, so sharing costs nothing and saves a compile at each button's first press+ private var shared: Shader? = null++ fun create(): Shader = shared ?: RuntimeShader("""uniform float2 size;layout(color) uniform half4 color;@@ -183,7 +187,7 @@ half4 main(float2 coord) {float intensity = smoothstep(radius, radius * 0.5, dist);return color * intensity;}""",- )+ ).also { shared = it }fun update(shader: Shader, size: Size, color: Int, radius: Float, position: Offset) {(shader as RuntimeShader).apply {@@ -280,8 +284,9 @@ fun GraphicsLayerScope.liquidPressTransform(h: InteractiveHighlight) {}/**- * The press jelly of flat pressables (rows, tiles, chips): dips on press, springs back past rest once,- * and holds a quick tap long enough to be seen. Read [scale] inside graphicsLayer.+ * The press of flat pressables (rows, tiles, cards, chips): sinks under the finger and comes back+ * softly, never past rest (the jelly belongs to the glass buttons alone), and holds a quick tap long+ * enough to be seen. Read [scale] inside graphicsLayer.*/@Stableclass JellyPress internal constructor(private val scope: CoroutineScope, private val pressedScale: Float) {@@ -290,13 +295,13 @@ class JellyPress internal constructor(private val scope: CoroutineScope, privateprivate var releaseJob: Job? = nullval scale: Float get() = anim.value- /** 0 at rest, 1 fully pressed (past 1 on the overshoot). */- val progress: Float get() = ((1f - anim.value) / (1f - pressedScale)).fastCoerceIn(-0.5f, 1.5f)+ /** 0 at rest, 1 fully pressed. */+ val progress: Float get() = ((1f - anim.value) / (1f - pressedScale)).fastCoerceIn(0f, 1f)fun press() {releaseJob?.cancel()downAt = SystemClock.uptimeMillis()- scope.launch { anim.animateTo(pressedScale, GlassMotion.pressIn()) }+ scope.launch { anim.animateTo(pressedScale, Fluid.pressIn()) }}fun release() {@@ -304,13 +309,22 @@ class JellyPress internal constructor(private val scope: CoroutineScope, privatereleaseJob = scope.launch {val held = SystemClock.uptimeMillis() - downAtif (held < GlassMotion.MinPressMillis) delay(GlassMotion.MinPressMillis - held)- anim.animateTo(1f, GlassMotion.pressOut())+ anim.animateTo(1f, Fluid.pressOut())}}++ /**+ * Back to rest at once: a long press opens a sheet over this, and springing back under the sheet+ * would redraw the whole still scene on every frame of it.+ */+ fun rest() {+ releaseJob?.cancel()+ scope.launch { anim.snapTo(1f) }+ }}@Composable-fun rememberJellyPress(interaction: InteractionSource, pressedScale: Float = GlassMotion.PressedScale): JellyPress {+fun rememberJellyPress(interaction: InteractionSource, pressedScale: Float = Fluid.PressedScale): JellyPress {val scope = rememberCoroutineScope()val jelly = remember(scope, pressedScale) { JellyPress(scope, pressedScale) }LaunchedEffect(interaction, jelly) {@@ -336,7 +350,7 @@ class LiquidStretchState internal constructor(private val maxScale: Float,private val settleDelayMs: Long,) {- private val spec = spring<Float>(dampingRatio = 0.35f, stiffness = 180f, visibilityThreshold = 0.0005f)+ private val spec get() = spring<Float>(MotionSettings.damping(0.35f), MotionSettings.stiffness(180f), 0.0005f)private val sx = Animatable(1f, 0.0005f)private val sy = Animatable(1f, 0.0005f)private var lastX = Float.NaN@@ -366,8 +380,9 @@ class LiquidStretchState internal constructor(fun onVelocity(vx: Float, vy: Float) {val ax = abs(vx)val ay = abs(vy)- val (tx, ty) = if (ax >= ay) (1f + ax * stretchFactor) to (1f - ax * stretchFactor * 0.5f)- else (1f - ay * stretchFactor * 0.5f) to (1f + ay * stretchFactor)+ val k = stretchFactor * MotionSettings.style.stretch+ val (tx, ty) = if (ax >= ay) (1f + ax * k) to (1f - ax * k * 0.5f)+ else (1f - ay * k * 0.5f) to (1f + ay * k)animateTo(tx.coerceIn(minScale, maxScale), ty.coerceIn(minScale, maxScale))settleJob?.cancel()settleJob = scope.launch {diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Surfaces.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Surfaces.ktindex 31272de..976d621 100644--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Surfaces.kt+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Surfaces.kt@@ -8,6 +8,7 @@ import androidx.compose.ui.draw.clipimport androidx.compose.ui.graphics.Brushimport androidx.compose.foundation.interaction.MutableInteractionSourceimport androidx.compose.foundation.layout.Box+import androidx.compose.foundation.layout.BoxScopeimport androidx.compose.foundation.layout.Columnimport androidx.compose.foundation.layout.ColumnScopeimport androidx.compose.material3.Icon@@ -77,6 +78,26 @@ fun GlassCard(}}+/**+ * A painted surface (a desk card) that glass can sit on: [paint] is drawn as a sibling layer under+ * [content], so a [GlassChip] inside refracts the card's own colour instead of the wallpaper behind it.+ * (A glass control can't refract the layer it is drawn in, hence two layers.)+ */+@Composable+fun GlassHost(+ modifier: Modifier = Modifier,+ paint: @Composable BoxScope.() -> Unit,+ content: @Composable BoxScope.() -> Unit,+) {+ val below = LocalBackdrop.current+ val layer = rememberLayerBackdrop()+ val combined = rememberCombinedBackdrop(below, layer)+ Box(modifier) {+ Box(Modifier.matchParentSize().layerBackdrop(layer), content = paint)+ CompositionLocalProvider(LocalBackdrop provides combined) { content() }+ }+}+/*** The wash panel scrolling lists use: the glass's tint and its lit rim without the backdrop pass.* Over the aurora's soft gradients a blur changes almost nothing, but re-sampling every panel on@@ -92,6 +113,10 @@ fun Modifier.wash(shape: Shape = RoundedRectangle(28.dp), tint: Color = clear.gl.border(1.dp, Brush.verticalGradient(listOf(rimTop, rimBottom)), shape)}+/** The [wash] of a panel (a file card, a group of rows), with its 20 dp continuous corners. */+@Composable+fun washPanel(): Modifier = Modifier.wash(RoundedRectangle(20.dp))+/** A [wash] panel holding rows. */@Composablefun WashPanel(modifier: Modifier = Modifier, shape: Shape = RoundedRectangle(28.dp), content: @Composable ColumnScope.() -> Unit) {@@ -105,21 +130,22 @@ fun GlassPanel(modifier: Modifier = Modifier, shape: Shape = RoundedRectangle(28}/**- * A flat pressable (a row, a tile, a card): dips on press with the jelly spring, springs back past- * rest once, one haptic per tap. No ripple.+ * A flat pressable (a row, a tile, a card): sinks under the finger and eases back (no bounce: that+ * is the glass buttons'), one haptic per tap. No ripple.*/@OptIn(ExperimentalFoundationApi::class)@Composablefun Modifier.pressable(onClick: () -> Unit,onLongClick: (() -> Unit)? = null,- pressedScale: Float = GlassMotion.PressedScale,+ pressedScale: Float = Fluid.PressedScale,role: Role = Role.Button,enabled: Boolean = true,+ feel: Feel = Feel.Tap,): Modifier {val source = remember { MutableInteractionSource() }val jelly = rememberJellyPress(source, pressedScale)- val haptics = LocalHapticFeedback.current+ val haptics = LocalHaptics.currentreturn graphicsLayer {scaleX = jelly.scalescaleY = jelly.scale@@ -128,8 +154,8 @@ fun Modifier.pressable(indication = null,enabled = enabled,role = role,- onClick = { haptics.performHapticFeedback(HapticFeedbackType.ContextClick); onClick() },- onLongClick = onLongClick?.let { l -> { haptics.performHapticFeedback(HapticFeedbackType.LongPress); l() } },+ onClick = { haptics?.play(feel); onClick() },+ onLongClick = onLongClick?.let { l -> { haptics?.play(Feel.Bloom); jelly.rest(); l() } },)}diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Tabs.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Tabs.ktindex bd8768a..dcd419f 100644--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Tabs.kt+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Tabs.kt@@ -92,7 +92,7 @@ fun GlassTabs() {val c = clearval backdrop = LocalBackdrop.current- val haptics = LocalHapticFeedback.current+ val haptics = LocalHaptics.currentval count = tabs.sizeval container = c.glassval inner = (height - 8.dp).coerceAtLeast(0.dp)@@ -136,7 +136,7 @@ fun GlassTabs(snapshotFlow { current }.collectLatest { i ->if (drag.targetValue.fastRoundToInt() != i) drag.animateToValue(i.toFloat())if (i != selectedNow) {- haptics.performHapticFeedback(HapticFeedbackType.SegmentTick)+ haptics?.play(Feel.Tick)select(i)}}@@ -206,11 +206,12 @@ fun GlassTabs(shadow = null,effects = {val p = drag.pressProgress+ val style = GlassSettings.stylevibrancy()- blur(8f.dp.toPx())- lens(24f.dp.toPx() * p, 24f.dp.toPx() * p)+ blur(8f.dp.toPx() * style.blur)+ lens(24f.dp.toPx() * p * style.refractionHeight, 24f.dp.toPx() * p * style.refractionAmount)},- highlight = { Highlight.Default.copy(alpha = drag.pressProgress) },+ highlight = { Highlight.Default.copy(alpha = drag.pressProgress * GlassSettings.style.highlight.coerceIn(0f, 1f)) },onDrawSurface = { drawRect(container) },).height(inner)@@ -233,9 +234,10 @@ fun GlassTabs(shape = { Capsule },effects = {val p = drag.pressProgress- lens(10f.dp.toPx() * p, 14f.dp.toPx() * p, chromaticAberration = true)+ val style = GlassSettings.style+ lens(10f.dp.toPx() * p * style.refractionHeight, 14f.dp.toPx() * p * style.refractionAmount, chromaticAberration = true)},- highlight = { Highlight.Default.copy(alpha = drag.pressProgress) },+ highlight = { Highlight.Default.copy(alpha = drag.pressProgress * GlassSettings.style.highlight.coerceIn(0f, 1f)) },shadow = null,innerShadow = {val p = drag.pressProgressdiff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/home/Cards.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/home/Cards.ktindex 9d09be7..1695533 100644--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/home/Cards.kt+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/home/Cards.kt@@ -13,6 +13,7 @@ import androidx.compose.foundation.layout.Boximport androidx.compose.foundation.layout.BoxScopeimport androidx.compose.foundation.layout.BoxWithConstraintsimport androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.PaddingValuesimport androidx.compose.foundation.layout.Rowimport androidx.compose.foundation.layout.Spacerimport androidx.compose.foundation.layout.fillMaxSize@@ -34,6 +35,8 @@ import androidx.compose.runtime.rememberimport androidx.compose.runtime.setValueimport androidx.compose.ui.Alignmentimport androidx.compose.ui.Modifier+import androidx.compose.ui.draw.BlurredEdgeTreatment+import androidx.compose.ui.draw.blurimport androidx.compose.ui.draw.clipimport androidx.compose.ui.draw.drawBehindimport androidx.compose.ui.draw.rotate@@ -65,6 +68,8 @@ import com.chethan616.clearpdf.notes.Noteimport com.chethan616.clearpdf.ui.AppViewModelimport com.chethan616.clearpdf.ui.LucideIconsimport com.chethan616.clearpdf.ui.desk.PaperThumb+import com.chethan616.clearpdf.ui.glass.GlassChip+import com.chethan616.clearpdf.ui.glass.GlassHostimport com.chethan616.clearpdf.ui.glass.GlassMotionimport com.chethan616.clearpdf.ui.glass.pressableimport com.chethan616.clearpdf.ui.theme.CardTone@@ -100,19 +105,21 @@ fun Modifier.cardPaint(tone: CardTone, glow: Offset = Offset(0.85f, 0.05f)): Mod.border(1.dp, Brush.verticalGradient(listOf(Color.White.copy(alpha = if (dark) 0.18f else 0.6f), Color.White.copy(alpha = 0.05f))), CardShape)}-/** Cards rise into place one after another when the desk first shows. */+/**+ * Cards rise into place one after another when the desk first shows ([active]), on the eased curve+ * (no overshoot); cards that come into view later, while scrolling, are simply there (nothing+ * animates under a moving finger).+ */@Composable-fun Modifier.riseIn(index: Int): Modifier {- val p = remember { Animatable(0f) }+fun Modifier.riseIn(index: Int, active: Boolean = true): Modifier {+ val p = remember { Animatable(if (active) 0f else 1f) }LaunchedEffect(Unit) {- kotlinx.coroutines.delay(40L * index.coerceAtMost(8))- p.animateTo(1f, GlassMotion.rise())+ if (p.value >= 1f) return@LaunchedEffect+ kotlinx.coroutines.delay(35L * index.coerceAtMost(8))+ p.animateTo(1f, androidx.compose.animation.core.tween(520, easing = com.chethan616.clearpdf.ui.glass.Fluid.Ease))}return graphicsLayer {- translationY = (1f - p.value) * 46.dp.toPx()- val s = 0.94f + 0.06f * p.value- scaleX = s- scaleY = s+ translationY = (1f - p.value) * 28.dp.toPx()alpha = p.value.coerceIn(0f, 1f)compositingStrategy = CompositingStrategy.ModulateAlpha}@@ -129,25 +136,29 @@ fun ListCard(note: Note, onOpen: () -> Unit, onLong: () -> Unit, onToggle: (Checval tone = clear.tone(Tone.Sage)val shown = note.items.filter { it.text.isNotBlank() }.take(4)val more = note.items.count { it.text.isNotBlank() } - shown.size- Column(- modifier.pressable(onOpen, onLong, pressedScale = 0.96f).cardPaint(tone, Offset(0.15f, 0.0f)).padding(start = 12.dp, end = 12.dp, top = 20.dp, bottom = 14.dp),+ // the card's paint is its own layer so the glass pills on it refract the card, not the wallpaper+ GlassHost(+ modifier.pressable(onOpen, onLong, pressedScale = 0.96f),+ paint = { Box(Modifier.fillMaxSize().cardPaint(tone, Offset(0.15f, 0.0f))) },) {- WordFitText(- note.title.ifBlank { stringResource(R.string.notes_untitled_list) },- ClearType.DotTitle.copy(color = tone.ink.copy(alpha = 0.92f), textAlign = TextAlign.Center),- maxLines = 3,- modifier = Modifier.fillMaxWidth().padding(horizontal = 2.dp),- )- Spacer(Modifier.height(18.dp))- Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {- shown.forEach { item -> CheckPill(item, tone) { onToggle(item) } }- }- if (more > 0) {- Spacer(Modifier.height(8.dp))- Text(pluralStringResource(R.plurals.notes_more_items, more, more), style = ClearType.Caption, color = tone.ink.copy(alpha = 0.6f), modifier = Modifier.padding(start = 10.dp))- }- if (shown.isEmpty()) {- Text(stringResource(R.string.notes_list_empty), style = ClearType.Label, color = tone.ink.copy(alpha = 0.6f), textAlign = TextAlign.Center, modifier = Modifier.fillMaxWidth())+ Column(Modifier.padding(start = 12.dp, end = 12.dp, top = 20.dp, bottom = 14.dp)) {+ WordFitText(+ note.title.ifBlank { stringResource(R.string.notes_untitled_list) },+ ClearType.DotTitle.copy(color = tone.ink.copy(alpha = 0.92f), textAlign = TextAlign.Center),+ maxLines = 3,+ modifier = Modifier.fillMaxWidth().padding(horizontal = 2.dp),+ )+ Spacer(Modifier.height(18.dp))+ Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {+ shown.forEach { item -> CheckPill(item, tone) { onToggle(item) } }+ }+ if (more > 0) {+ Spacer(Modifier.height(8.dp))+ Text(pluralStringResource(R.plurals.notes_more_items, more, more), style = ClearType.Caption, color = tone.ink.copy(alpha = 0.6f), modifier = Modifier.padding(start = 10.dp))+ }+ if (shown.isEmpty()) {+ Text(stringResource(R.string.notes_list_empty), style = ClearType.Label, color = tone.ink.copy(alpha = 0.6f), textAlign = TextAlign.Center, modifier = Modifier.fillMaxWidth())+ }}}}@@ -173,28 +184,37 @@ fun WordFitText(text: String, style: androidx.compose.ui.text.TextStyle, modifie}}-/** A list item on a card: a glass capsule with a round tick; ticked, it darkens and the tick fills. */+/**+ * A list item on a card: a liquid glass capsule (the very glass of the Back and menu buttons, so it+ * swells, leans and jiggles by Settings) with a round tick; ticked, it darkens and the tick fills.+ * Needs a [GlassHost] around it (the card) to refract the card's colour.+ */@Composablefun CheckPill(item: CheckItem, tone: CardTone, onToggle: () -> Unit) {- val haptics = LocalHapticFeedback.current+ val haptics = com.chethan616.clearpdf.ui.glass.LocalHaptics.current+ val dark = clear.darkval done = item.done- val fill by animateColorAsState(if (done) tone.ink.copy(alpha = 0.58f) else Color.White.copy(alpha = 0.30f), GlassMotion.settle(), label = "pill")- val ink by animateColorAsState(if (done) Color.White else tone.ink, GlassMotion.settle(), label = "pill ink")- val tick by animateFloatAsState(if (done) 1f else 0f, GlassMotion.pop(), label = "tick")- Row(- Modifier.fillMaxWidth().height(40.dp)- .pressable({ haptics.performHapticFeedback(HapticFeedbackType.ToggleOn); onToggle() }, pressedScale = 0.94f)- .clip(Capsule).background(fill)- .border(1.dp, Color.White.copy(alpha = if (done) 0.12f else 0.55f), Capsule)- .padding(start = 8.dp, end = 12.dp),- verticalAlignment = Alignment.CenterVertically,+ // ticked: a deeper wash over the glass (the tone's ink on light cards, shade on dark ones)+ val doneWash = if (dark) Color.Black.copy(alpha = 0.34f) else tone.ink.copy(alpha = 0.58f)+ val wash by animateColorAsState(if (done) doneWash else Color.Transparent, com.chethan616.clearpdf.ui.glass.Fluid.quick(), label = "pill")+ val ink by animateColorAsState(if (done) Color.White else tone.ink, com.chethan616.clearpdf.ui.glass.Fluid.quick(), label = "pill ink")+ val tick by animateFloatAsState(if (done) 1f else 0f, com.chethan616.clearpdf.ui.glass.Fluid.quick(), label = "tick")+ GlassChip(+ onClick = { haptics?.play(if (done) com.chethan616.clearpdf.ui.glass.Feel.ToggleOff else com.chethan616.clearpdf.ui.glass.Feel.ToggleOn); onToggle() },+ modifier = Modifier.fillMaxWidth(),+ height = 40.dp,+ fill = { wash },+ contentPadding = PaddingValues(start = 8.dp, end = 12.dp),+ horizontalArrangement = Arrangement.Start,+ tap = null,+ ink = ink,) {Box(Modifier.size(24.dp), contentAlignment = Alignment.Center) {Box(Modifier.size(24.dp).border(1.6.dp, ink.copy(alpha = 0.75f * (1f - tick)), CircleShape))Box(Modifier.size(24.dp).graphicsLayer { scaleX = tick; scaleY = tick }.clip(CircleShape).background(Color.White),contentAlignment = Alignment.Center,- ) { Icon(LucideIcons.Check, null, tint = tone.ink, modifier = Modifier.size(14.dp)) }+ ) { Icon(LucideIcons.Check, null, tint = if (dark) tone.bottom else tone.ink, modifier = Modifier.size(14.dp)) }}Spacer(Modifier.width(10.dp))Text(item.text, style = ClearType.Body.copy(fontSize = 14.5.sp), color = ink, maxLines = 1, overflow = TextOverflow.Ellipsis)@@ -226,6 +246,18 @@ fun NoteCard(note: Note, onOpen: () -> Unit, onLong: () -> Unit, modifier: Modif}}+/** "Thought of the day": a note's frosted paper with only its title, in the note blue, and today's date in the corner. */+@Composable+fun ThoughtCard(onOpen: () -> Unit, modifier: Modifier = Modifier) {+ val tone = clear.tone(Tone.Paper)+ Column(modifier.heightIn(min = 188.dp).pressable(onOpen, pressedScale = 0.96f).cardPaint(tone, Offset(0.1f, 0.0f)).padding(18.dp)) {+ WordFitText(stringResource(R.string.thought_title), ClearType.CardTitle.copy(color = tone.accent), maxLines = 4)+ Spacer(Modifier.weight(1f))+ Spacer(Modifier.height(12.dp))+ Text(shortDate(System.currentTimeMillis()), style = ClearType.Caption.copy(fontSize = 10.5.sp), color = tone.ink.copy(alpha = 0.55f), modifier = Modifier.align(Alignment.End))+ }+}+/** A note's picture, decoded small off the main thread. */@Composablefun NoteImage(name: String, modifier: Modifier, maxPx: Int = 720) {@@ -254,38 +286,123 @@ val LocalHomeVm = androidx.compose.runtime.staticCompositionLocalOf<AppViewModel// ---- Voice note -----------------------------------------------------------------------------------/** A voice memo: lavender, a play button, its waveform in white (the played part brighter). */+/**+ * A voice memo, as the mock draws it: a short periwinkle card, a small white play mark at its top+ * left, and in the middle a narrow, dense waveform of white bars swelling to its centre, glowing+ * softly. Its name (once it has one) and length sit small along the top. While it plays, the bars+ * already heard are bright and the rest wait, dimmed. [progress] is read only while drawing, so a+ * playing memo redraws its bars and nothing else.+ */@Composable-fun VoiceCard(note: Note, playing: Boolean, progress: Float, onPlay: () -> Unit, onLong: () -> Unit, modifier: Modifier = Modifier) {- val tone = clear.tone(Tone.Lavender)+fun VoiceCard(note: Note, playing: Boolean, progress: () -> Float, onPlay: () -> Unit, onLong: () -> Unit, modifier: Modifier = Modifier) {+ val tone = VoiceToneBox(- modifier.height(96.dp).pressable(onPlay, onLong, pressedScale = 0.95f).cardPaint(tone, Offset(0.5f, 0.0f)).padding(horizontal = 16.dp, vertical = 12.dp),+ modifier.height(92.dp).pressable(onPlay, onLong, pressedScale = 0.96f).voicePaint(tone),) {- Icon(if (playing) LucideIcons.Pause else LucideIcons.Play, null, tint = Color.White, modifier = Modifier.size(20.dp).align(Alignment.TopStart))- Waveform(note.wave, progress, Modifier.align(Alignment.Center).padding(horizontal = 18.dp).fillMaxWidth().height(52.dp))- Text(- if (note.title.isNotBlank()) note.title else com.chethan616.clearpdf.ui.viewer.clock(note.durationMs),- style = ClearType.Caption.copy(fontSize = 10.5.sp), color = Color.White.copy(alpha = 0.85f), maxLines = 1,- modifier = Modifier.align(Alignment.BottomEnd),- )+ Row(+ Modifier.align(Alignment.TopStart).fillMaxWidth().padding(start = 16.dp, end = 14.dp, top = 13.dp),+ verticalAlignment = Alignment.CenterVertically,+ ) {+ PlayMark(playing, Modifier.size(13.dp))+ Spacer(Modifier.width(8.dp))+ Text(+ note.title, style = ClearType.Label.copy(fontSize = 12.sp, lineHeight = 14.sp), color = Color.White.copy(alpha = 0.95f),+ maxLines = 1, overflow = TextOverflow.Ellipsis, modifier = Modifier.weight(1f),+ )+ if (note.durationMs > 0) {+ Text(com.chethan616.clearpdf.ui.viewer.clock(note.durationMs), style = ClearType.Caption.copy(fontSize = 10.5.sp, fontFeatureSettings = "tnum"), color = Color.White.copy(alpha = 0.78f))+ }+ }+ val bars = remember(note.wave) { voiceBars(note.wave) }+ val p = { if (playing) progress() else -1f }+ // the mock's waveform: under half the card's width, centred a little below the middle+ Box(Modifier.align(Alignment.Center).padding(top = 14.dp).fillMaxWidth(0.46f).height(46.dp)) {+ // the glow: the same bars, blurred, behind the crisp ones (a still layer: it's cached)+ Waveform(bars, p, Modifier.matchParentSize().blur(9.dp, BlurredEdgeTreatment.Unbounded).graphicsLayer { alpha = 0.9f })+ Waveform(bars, p, Modifier.matchParentSize())+ }+ }+}++/** The voice card's own periwinkle (the mock's: bluer on the left, lighter to the right). */+private val VoiceTone = CardTone(Color(0xFFA3AAF0), Color(0xFFC2C5F7), Color.White, Color.White)++@Composable+private fun Modifier.voicePaint(tone: CardTone): Modifier {+ val dark = clear.dark+ return clip(CardShape)+ .drawBehind {+ // at night the periwinkle becomes a vivid violet: darkening it only muddied it+ val top = if (dark) Color(0xFF6258E6) else tone.top+ val bottom = if (dark) Color(0xFF8B74F2) else tone.bottom+ drawRect(Brush.linearGradient(listOf(top, bottom), Offset.Zero, Offset(size.width, size.height * 0.6f)))+ drawCircle(+ Brush.radialGradient(listOf(Color.White.copy(alpha = if (dark) 0.08f else 0.22f), Color.Transparent), Offset(size.width * 0.5f, size.height * 0.62f), size.minDimension * 0.9f),+ radius = size.minDimension * 0.9f, center = Offset(size.width * 0.5f, size.height * 0.62f),+ )+ }+ .border(1.dp, Brush.verticalGradient(listOf(Color.White.copy(alpha = if (dark) 0.18f else 0.55f), Color.White.copy(alpha = 0.06f))), CardShape)+}++/** A rounded play triangle (or two pause bars), in white. */+@Composable+private fun PlayMark(playing: Boolean, modifier: Modifier) {+ Canvas(modifier) {+ if (playing) {+ val w = size.width * 0.3f+ drawRoundRect(Color.White, Offset(size.width * 0.1f, 0f), Size(w, size.height), CornerRadius(w / 2f))+ drawRoundRect(Color.White, Offset(size.width * 0.6f, 0f), Size(w, size.height), CornerRadius(w / 2f))+ } else {+ val path = Path().apply {+ moveTo(size.width * 0.12f, size.height * 0.05f)+ lineTo(size.width * 0.95f, size.height * 0.5f)+ lineTo(size.width * 0.12f, size.height * 0.95f)+ close()+ }+ drawPath(path, Color.White)+ drawPath(path, Color.White, style = androidx.compose.ui.graphics.drawscope.Stroke(width = size.width * 0.16f, join = androidx.compose.ui.graphics.StrokeJoin.Round))+ }}}-/** Mirrored rounded bars, as the mock's waveform: [levels] 0..1, the first [progress] of them lit. */+/**+ * Fifteen bars shaped like the mock's: a full bell swelling to the middle, with the little unevenness+ * of a real voice, nudged by the recording's own loudness (never so much it stops reading as a bell).+ */+fun voiceBars(levels: List<Float>, count: Int = 15): List<Float> {+ val texture = floatArrayOf(0.94f, 1f, 0.9f, 1f, 0.96f, 1f, 0.92f)+ val bell = List(count) { i ->+ val x = (i + 0.5f) / count+ (0.26f + 0.74f * kotlin.math.sin(Math.PI.toFloat() * x).let { kotlin.math.sqrt(it) }) * texture[i % texture.size]+ }+ if (levels.isEmpty()) return bell+ return List(count) { i ->+ val from = i * levels.size / count+ val to = ((i + 1) * levels.size / count).coerceAtLeast(from + 1).coerceAtMost(levels.size)+ val v = levels.subList(from.coerceAtMost(levels.size - 1), to).average().toFloat()+ (bell[i] * (0.78f + 0.22f * v.coerceIn(0f, 1f))).coerceIn(0.2f, 1f)+ }+}++/** Mirrored rounded bars: [levels] 0..1; with [progress] in 0..1 the bars past it are dimmed. */@Composable-fun Waveform(levels: List<Float>, progress: Float, modifier: Modifier, color: Color = Color.White) {+fun Waveform(levels: List<Float>, progress: Float, modifier: Modifier, color: Color = Color.White) = Waveform(levels, { progress }, modifier, color)++/** [Waveform] whose progress is read only while drawing. */+@Composable+fun Waveform(levels: List<Float>, progress: () -> Float, modifier: Modifier, color: Color = Color.White) {Canvas(modifier) {- val bars = levels.ifEmpty { List(24) { 0.3f } }- val gap = 3.dp.toPx()+ val bars = levels.ifEmpty { List(15) { 0.4f } }+ val progress = progress()+ // dense, as the mock's: the gaps a third of a bar+ val gap = size.width / bars.size * 0.26fval w = ((size.width - gap * (bars.size - 1)) / bars.size).coerceAtLeast(1.5f)- // the middle bars swell a little more, like the mock'sbars.forEachIndexed { i, v ->- val bell = 0.55f + 0.45f * kotlin.math.sin(Math.PI.toFloat() * (i + 0.5f) / bars.size)- val h = (size.height * v * bell).coerceAtLeast(w)+ val h = (size.height * v).coerceAtLeast(w)val x = i * (w + gap)- val lit = (i + 0.5f) / bars.size <= progress+ val lit = progress < 0f || (i + 0.5f) / bars.size <= progressdrawRoundRect(- color.copy(alpha = if (progress <= 0f || lit) 1f else 0.5f),+ color.copy(alpha = if (lit) 1f else 0.45f),topLeft = Offset(x, (size.height - h) / 2f), size = Size(w, h), cornerRadius = CornerRadius(w / 2f, w / 2f),)}@@ -362,10 +479,16 @@ fun StackCard(.clip(CardShape).background(Brush.verticalGradient(listOf(t.top, t.bottom))),)}- Box(Modifier.fillMaxSize().clip(CardShape).background(Color.White)) {- picture()- // a shade over the top so the title reads on a white page or a bright photo- Box(Modifier.fillMaxWidth().height(86.dp).background(Brush.verticalGradient(listOf(Color.Black.copy(alpha = 0.38f), Color.Transparent))))+ // the picture and its shade are the layer the chips' glass refracts+ GlassHost(+ Modifier.fillMaxSize().clip(CardShape),+ paint = {+ Box(Modifier.fillMaxSize().background(Color.White))+ picture()+ // a shade over the top so the title reads on a white page or a bright photo+ Box(Modifier.fillMaxWidth().height(86.dp).background(Brush.verticalGradient(listOf(Color.Black.copy(alpha = 0.38f), Color.Transparent))))+ },+ ) {Column(Modifier.padding(start = 16.dp, top = 14.dp, end = 16.dp)) {Text(title, style = ClearType.Title.copy(fontSize = 17.sp), color = Color.White, maxLines = 1, overflow = TextOverflow.Ellipsis)if (subtitle != null) Text(subtitle, style = ClearType.Caption.copy(fontSize = 10.5.sp), color = Color.White.copy(alpha = 0.85f), maxLines = 1)@@ -376,21 +499,14 @@ fun StackCard(}}-/** A frosted chip on a picture: "+5", or an icon and a word. */+/**+ * A liquid glass chip on a picture or card: "+5", or an icon and a word. The same glass as the Back+ * and menu buttons (follows Settings ▸ liquid glass and motion), with white ink for the photo behind.+ */@Composable-fun PhotoChip(text: String, icon: ImageVector? = null, modifier: Modifier = Modifier, onClick: (() -> Unit)? = null) {- Row(- modifier- .then(if (onClick != null) Modifier.pressable(onClick, pressedScale = 0.9f) else Modifier)- .height(34.dp).clip(Capsule).background(Color.Black.copy(alpha = 0.22f))- .border(1.dp, Color.White.copy(alpha = 0.55f), Capsule)- .padding(horizontal = 12.dp),- verticalAlignment = Alignment.CenterVertically,- ) {- if (icon != null) {- Icon(icon, null, tint = Color.White, modifier = Modifier.size(15.dp))- Spacer(Modifier.width(6.dp))- }+fun PhotoChip(text: String, onClick: () -> Unit, modifier: Modifier = Modifier, icon: ImageVector? = null) {+ GlassChip(onClick = onClick, modifier = modifier, height = 34.dp, contentPadding = PaddingValues(horizontal = 12.dp), horizontalArrangement = Arrangement.spacedBy(6.dp), ink = Color.White) {+ if (icon != null) Icon(icon, null, tint = Color.White, modifier = Modifier.size(15.dp))Text(text, style = ClearType.Label, color = Color.White, maxLines = 1)}}@@ -414,27 +530,33 @@ fun RecentCard(vm: AppViewModel, rows: List<FileRow>, onAll: () -> Unit, modifieBox(modifier.height(226.dp).pressable(top.open, { vm.fileSheet = top to true }, pressedScale = 0.95f)) {// a blush card peeking out behind, turnedBox(Modifier.fillMaxSize().padding(vertical = 8.dp).graphicsLayer { rotationZ = 5f; translationX = 8.dp.toPx() }.clip(CardShape).background(Brush.verticalGradient(listOf(clear.tone(Tone.Blush).top, clear.tone(Tone.Blush).bottom))))- Box(Modifier.fillMaxSize().cardPaint(tone, Offset(0.9f, 0.0f))) {- Column(Modifier.padding(start = 16.dp, top = 14.dp, end = 16.dp)) {- Text(stringResource(R.string.desk_recent), style = ClearType.Title.copy(fontSize = 17.sp), color = tone.ink, maxLines = 1)- Text(whenLabel(top.date), style = ClearType.Caption.copy(fontSize = 10.5.sp), color = tone.ink.copy(alpha = 0.6f), maxLines = 1)- }- // up to three first pages, fanned; the newest on top- val shown = rows.take(3)- Box(Modifier.align(Alignment.Center).padding(top = 18.dp).size(140.dp, 132.dp)) {- shown.indices.reversed().forEach { i ->- val r = shown[i]- val tilt = listOf(-4f, 7f, -12f)[i]- val dx = listOf(0, 26, -22)[i]- PaperThumb(- vm, r.thumbPath, 84.dp, 110.dp, tilt = tilt, corner = 7.dp,- modifier = Modifier.align(Alignment.Center).offset(x = dx.dp, y = (i * 4).dp),- )+ // the card and the pages fanned on it are the layer the chips' glass refracts+ GlassHost(+ Modifier.fillMaxSize(),+ paint = {+ Box(Modifier.fillMaxSize().cardPaint(tone, Offset(0.9f, 0.0f)))+ Column(Modifier.padding(start = 16.dp, top = 14.dp, end = 16.dp)) {+ Text(stringResource(R.string.desk_recent), style = ClearType.Title.copy(fontSize = 17.sp), color = tone.ink, maxLines = 1)+ Text(whenLabel(top.date), style = ClearType.Caption.copy(fontSize = 10.5.sp), color = tone.ink.copy(alpha = 0.6f), maxLines = 1)}- }+ // up to three first pages, fanned; the newest on top+ val shown = rows.take(3)+ Box(Modifier.align(Alignment.Center).padding(top = 18.dp).size(140.dp, 132.dp)) {+ shown.indices.reversed().forEach { i ->+ val r = shown[i]+ val tilt = listOf(-4f, 7f, -12f)[i]+ val dx = listOf(0, 26, -22)[i]+ PaperThumb(+ vm, r.thumbPath, 84.dp, 110.dp, tilt = tilt, corner = 7.dp,+ modifier = Modifier.align(Alignment.Center).offset(x = dx.dp, y = (i * 4).dp),+ )+ }+ }+ },+ ) {Row(Modifier.align(Alignment.BottomStart).padding(12.dp), horizontalArrangement = Arrangement.spacedBy(8.dp)) {- if (rows.size > 1) PhotoChip("+${rows.size - 1}", onClick = onAll)- PhotoChip(stringResource(R.string.desk_chip_pdfs), LucideIcons.FileText, onClick = onAll)+ if (rows.size > 1) PhotoChip("+${rows.size - 1}", onAll)+ PhotoChip(stringResource(R.string.desk_chip_pdfs), onAll, icon = LucideIcons.FileText)}}}diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/home/CreateDock.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/home/CreateDock.ktindex 9dc6ffe..25a9103 100644--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/home/CreateDock.kt+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/home/CreateDock.kt@@ -1,8 +1,6 @@package com.chethan616.clearpdf.ui.homeimport androidx.activity.compose.BackHandler-import androidx.compose.animation.AnimatedContent-import androidx.compose.animation.animateContentSizeimport androidx.compose.animation.core.Animatableimport androidx.compose.animation.core.RepeatModeimport androidx.compose.animation.core.animateFloat@@ -10,11 +8,6 @@ import androidx.compose.animation.core.animateFloatAsStateimport androidx.compose.animation.core.infiniteRepeatableimport androidx.compose.animation.core.rememberInfiniteTransitionimport androidx.compose.animation.core.tween-import androidx.compose.animation.fadeIn-import androidx.compose.animation.fadeOut-import androidx.compose.animation.scaleIn-import androidx.compose.animation.scaleOut-import androidx.compose.animation.togetherWithimport androidx.compose.foundation.Canvasimport androidx.compose.foundation.backgroundimport androidx.compose.foundation.clickable@@ -23,6 +16,7 @@ import androidx.compose.foundation.layout.Arrangementimport androidx.compose.foundation.layout.Boximport androidx.compose.foundation.layout.BoxScopeimport androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.PaddingValuesimport androidx.compose.foundation.layout.Rowimport androidx.compose.foundation.layout.Spacerimport androidx.compose.foundation.layout.fillMaxSize@@ -37,9 +31,8 @@ import androidx.compose.material3.Textimport androidx.compose.runtime.Composableimport androidx.compose.runtime.DisposableEffectimport androidx.compose.runtime.LaunchedEffect-import androidx.lifecycle.Lifecycle-import androidx.lifecycle.compose.LifecycleEventEffectimport androidx.compose.runtime.Stable+import androidx.compose.runtime.derivedStateOfimport androidx.compose.runtime.getValueimport androidx.compose.runtime.mutableStateOfimport androidx.compose.runtime.remember@@ -47,19 +40,25 @@ import androidx.compose.runtime.setValueimport androidx.compose.ui.Alignmentimport androidx.compose.ui.Modifierimport androidx.compose.ui.draw.clip+import androidx.compose.ui.draw.drawBehindimport androidx.compose.ui.geometry.CornerRadiusimport androidx.compose.ui.geometry.Offsetimport androidx.compose.ui.geometry.Sizeimport androidx.compose.ui.graphics.Colorimport androidx.compose.ui.graphics.CompositingStrategy+import androidx.compose.ui.graphics.TransformOriginimport androidx.compose.ui.graphics.graphicsLayer+import com.kyant.backdrop.floatingLayerimport androidx.compose.ui.graphics.vector.ImageVector-import androidx.compose.ui.hapticfeedback.HapticFeedbackType-import androidx.compose.ui.platform.LocalHapticFeedback+import androidx.compose.ui.layout.Layoutimport androidx.compose.ui.res.stringResourceimport androidx.compose.ui.semantics.contentDescriptionimport androidx.compose.ui.semantics.semanticsimport androidx.compose.ui.unit.dp+import androidx.compose.ui.unit.sp+import androidx.compose.ui.util.lerp+import androidx.lifecycle.Lifecycle+import androidx.lifecycle.compose.LifecycleEventEffectimport com.chethan616.clearpdf.Rimport com.chethan616.clearpdf.notes.Noteimport com.chethan616.clearpdf.notes.NoteKind@@ -69,9 +68,14 @@ import com.chethan616.clearpdf.ui.AppViewModelimport com.chethan616.clearpdf.ui.FilePickKindimport com.chethan616.clearpdf.ui.LucideIconsimport com.chethan616.clearpdf.ui.desk.ToolCatalog+import com.chethan616.clearpdf.ui.glass.Feel+import com.chethan616.clearpdf.ui.glass.Fluid+import com.chethan616.clearpdf.ui.glass.GlassChipimport com.chethan616.clearpdf.ui.glass.GlassCircleimport com.chethan616.clearpdf.ui.glass.GlassIconimport com.chethan616.clearpdf.ui.glass.GlassMotion+import com.chethan616.clearpdf.ui.glass.LocalHaptics+import com.chethan616.clearpdf.ui.glass.MotionSettingsimport com.chethan616.clearpdf.ui.glass.glassimport com.chethan616.clearpdf.ui.glass.pressableimport com.chethan616.clearpdf.ui.theme.Candy@@ -81,29 +85,54 @@ import com.chethan616.clearpdf.ui.viewer.VoiceRecorderimport com.chethan616.clearpdf.ui.viewer.clockimport com.kyant.shapes.Capsuleimport java.io.File+import kotlin.math.roundToIntimport kotlinx.coroutines.CoroutineScopeimport kotlinx.coroutines.delayimport kotlinx.coroutines.launch-/** The create capsule's state: the fan of ways to make something, and a voice memo being recorded. */+/** The ink of the + and the microphone: near black, as the mock's +. */+private val DockInk = Color(0xFF1C2433)++/**+ * The create capsule's state: the fan of ways to make something, a voice memo being recorded, and+ * the memo being named.+ */@Stableclass DeskState(private val scope: CoroutineScope) {+ /** The app's haptics, set by the dock. */+ internal var haptics: com.chethan616.clearpdf.ui.glass.Haptics? = null+var fanOpen by mutableStateOf(false)var recorder by mutableStateOf<VoiceRecorder?>(null)private setprivate var file: File? = null+ /** The voice memo whose name is being typed (its id), or null. */+ var naming by mutableStateOf<String?>(null)++ /**+ * Turns the capsule into the recorder at once (the tap answers in the same frame) while the+ * microphone opens off the main thread, which can take a moment on some phones.+ */fun startRecording(vm: AppViewModel) {fanOpen = false+ if (recorder != null) returnvm.withMic {val f = vm.notes.newMedia("wav")val r = VoiceRecorder(f, scope)- if (r.start()) {- file = f- recorder = r- } else {- f.delete()- vm.tell(text(R.string.msg_voice_no_mic))+ file = f+ recorder = r+ haptics?.play(Feel.Rise)+ scope.launch {+ if (!r.startAsync()) {+ if (recorder === r) {+ recorder = null+ file = null+ haptics?.play(Feel.Reject)+ vm.tell(text(R.string.msg_voice_no_mic))+ }+ f.delete()+ }}}}@@ -111,23 +140,25 @@ class DeskState(private val scope: CoroutineScope) {fun finish(vm: AppViewModel, keep: Boolean) {val r = recorder ?: returnval f = file+ recorder = null+ file = nullscope.launch {r.stop()- recorder = null- file = nullif (f == null) return@launchif (!keep || r.elapsedMs < 600) {f.delete()+ haptics?.play(Feel.Reject)if (keep) vm.tell(text(R.string.voice_too_short))return@launch}- vm.notes.add(- Note(- java.util.UUID.randomUUID().toString(), NoteKind.Voice,- audio = f.name, durationMs = r.elapsedMs, wave = waveOf(r.levels.toList()),- ),+ haptics?.play(Feel.Confirm)+ val note = Note(+ java.util.UUID.randomUUID().toString(), NoteKind.Voice,+ audio = f.name, durationMs = r.elapsedMs, wave = waveOf(r.levels.toList()),)- vm.tell(text(R.string.voice_saved))+ vm.notes.add(note)+ // saved straight away; a name is offered, never asked for+ vm.tell(text(R.string.voice_saved), text(R.string.voice_name_it)) { naming = note.id }}}}@@ -135,49 +166,173 @@ class DeskState(private val scope: CoroutineScope) {/*** The floating capsule at the desk's foot, as the mock has it: a white + and a glass microphone on* dark glass. The + fans out the ways to make something; the microphone turns the capsule into a- * recorder (live waveform, time, stop).+ * recorder (time, live waveform, stop). The capsule is liquid glass (the Back button's) and changes+ * shape on a glass spring ([GlassMotion], tuned by Settings ▸ Motion): it swells past the recorder's+ * size and rebounds when it shrinks back. Its size is animated in the layout pass only, so nothing+ * recomposes while it moves.*/@Composable-fun BoxScope.CreateDock(vm: AppViewModel, desk: DeskState, onBrowse: () -> Unit) {+fun BoxScope.CreateDock(+ vm: AppViewModel,+ desk: DeskState,+ onBrowse: () -> Unit,+ intoNote: Boolean = false,+ fromNote: Boolean = false,+ onNoteMorphed: () -> Unit = {},+) {val c = clear- BackHandler(enabled = desk.fanOpen) { desk.fanOpen = false }- BackHandler(enabled = desk.recorder != null) { desk.finish(vm, keep = false) }+ desk.haptics = LocalHaptics.current+ BackHandler(enabled = desk.fanOpen && !intoNote) { desk.fanOpen = false }+ BackHandler(enabled = desk.recorder != null && !intoNote) { desk.finish(vm, keep = false) }+ // a note opened from the desk: the capsule grows into the note's toolbar (0 = dock, 1 = toolbar) on+ // the glass spring and hands over the moment it is that size; back on the desk, the toolbar shrinks+ // back into the dock the same way+ val into = remember { Animatable(if (fromNote) 1f else 0f) }+ val done by androidx.compose.runtime.rememberUpdatedState(onNoteMorphed)+ LaunchedEffect(intoNote, fromNote) {+ when {+ intoNote -> {+ val reached = kotlinx.coroutines.CompletableDeferred<Unit>()+ launch {+ into.animateTo(1f, GlassMotion.unfold()) { if (value >= 0.96f) reached.complete(Unit) }+ reached.complete(Unit)+ }+ kotlinx.coroutines.withTimeoutOrNull(600L) { reached.await() }+ done()+ }+ fromNote -> {+ into.animateTo(0f, GlassMotion.unfold())+ done()+ }+ else -> into.snapTo(0f)+ }+ }// leaving the desk or the app ends a recording, kept: the microphone never runs unseenDisposableEffect(Unit) { onDispose { desk.fanOpen = false; desk.finish(vm, keep = true) } }LifecycleEventEffect(Lifecycle.Event.ON_STOP) { desk.finish(vm, keep = true) }- val scrim by animateFloatAsState(if (desk.fanOpen) 1f else 0f, GlassMotion.settle(), label = "fan scrim")- if (scrim > 0.01f) {+ // The scrim is read in draw and through derived flags, so the fan opening recomposes this dock+ // once, not on every frame of the fade (which rebuilt every chip's glass sixty times a second).+ val scrim = remember { Animatable(0f) }+ LaunchedEffect(desk.fanOpen) { scrim.animateTo(if (desk.fanOpen) 1f else 0f, Fluid.quick()) }+ val scrimShown by remember { derivedStateOf { scrim.value > 0.01f } }+ val fanShown by remember { derivedStateOf { desk.fanOpen || scrim.value > 0.01f } }+ if (scrimShown) {Box(Modifier.fillMaxSize()- .graphicsLayer { alpha = scrim }+ .graphicsLayer {+ alpha = scrim.value+ // one flat rectangle: no need for the offscreen pass a fractional alpha would ask for+ compositingStrategy = CompositingStrategy.ModulateAlpha+ }.background(Color.Black.copy(alpha = if (c.dark) 0.45f else 0.24f)).clickable(remember { MutableInteractionSource() }, null) { desk.fanOpen = false },)}- if (desk.fanOpen) Fan(vm, desk, onBrowse)+ // composed while the scrim is still fading, so the items can fold back into the ++ if (fanShown) Fan(vm, desk, desk.fanOpen, onBrowse)- Box(- Modifier.align(Alignment.BottomCenter).navigationBarsPadding().padding(bottom = 18.dp)- .glass(Capsule, c.capsule, blur = 10.dp)- .animateContentSize(GlassMotion.morph())- .padding(6.dp),- ) {- AnimatedContent(- desk.recorder,- transitionSpec = { (fadeIn(GlassMotion.settle()) + scaleIn(GlassMotion.pop(), 0.8f)) togetherWith (fadeOut(GlassMotion.fold()) + scaleOut(GlassMotion.fold(), 0.8f)) },- label = "dock",- ) { rec ->- if (rec == null) {- Row(horizontalArrangement = Arrangement.spacedBy(8.dp), verticalAlignment = Alignment.CenterVertically) {- PlusButton(desk.fanOpen) { desk.fanOpen = !desk.fanOpen }- GlassCircle(- onClick = { desk.startRecording(vm) }, size = 54.dp, surface = Color.White.copy(alpha = 0.16f),- label = stringResource(R.string.create_voice),- ) { GlassIcon(LucideIcons.Mic, null, Modifier.size(22.dp), tint = Color.White) }+ // the recorder stays drawn while the capsule shrinks back+ val rec = desk.recorder+ var lingering by remember { mutableStateOf<VoiceRecorder?>(null) }+ val shown = rec ?: lingering+ // the desk under the fan or the recorder is still: kept as one texture while they move over it+ val host = com.chethan616.clearpdf.ui.glass.LocalGlassOverlayHost.current+ val still = fanShown || shown != null+ if (host != null && still) DisposableEffect(host) { host.stillHolds++; onDispose { host.stillHolds-- } }+ // 0 = the + and mic capsule, 1 = the recorder. A slow, soft glass spring (Settings ▸ Motion, with a+ // floor on its damping so Jelly can't ring on): it swells past the recorder's size on the way out+ // and pinches at the rebound on the way back; only draw/layout read it.+ val morph = remember { Animatable(0f) }+ LaunchedEffect(rec) {+ if (rec != null) {+ lingering = rec+ morph.animateTo(1f, GlassMotion.shape())+ } else {+ morph.animateTo(0f, GlassMotion.shapeBack())+ lingering = null+ }+ }++ Layout(+ content = {+ Row(+ Modifier.graphicsLayer {+ alpha = (1f - morph.value * 2.2f).coerceIn(0f, 1f) * (1f - into.value * 3f).coerceIn(0f, 1f)+ compositingStrategy = CompositingStrategy.ModulateAlpha+ },+ horizontalArrangement = Arrangement.spacedBy(8.dp),+ verticalAlignment = Alignment.CenterVertically,+ ) {+ PlusButton(desk.fanOpen) {+ desk.fanOpen = !desk.fanOpen+ desk.haptics?.play(if (desk.fanOpen) Feel.Rise else Feel.Fall)}- } else {- Recording(rec, onCancel = { desk.finish(vm, keep = false) }, onStop = { desk.finish(vm, keep = true) })+ GlassCircle(+ onClick = { if (desk.recorder == null) desk.startRecording(vm) }, size = 54.dp, surface = Color.White.copy(alpha = 0.30f),+ label = stringResource(R.string.create_voice),+ ) { GlassIcon(LucideIcons.Mic, null, Modifier.size(22.dp), tint = DockInk) }}+ shown?.let { r ->+ Box(+ Modifier.graphicsLayer {+ alpha = ((morph.value - 0.3f) / 0.7f).coerceIn(0f, 1f)+ compositingStrategy = CompositingStrategy.ModulateAlpha+ },+ ) { Recording(r, onCancel = { desk.finish(vm, keep = false) }, onStop = { desk.finish(vm, keep = true) }) }+ }+ },+ modifier = Modifier.align(Alignment.BottomCenter).navigationBarsPadding().padding(bottom = 18.dp)+ // the jelly of the swell: a squash mid-flight and a pinch at the rebound, anchored at the foot+ .graphicsLayer {+ val m = morph.value+ val k = MotionSettings.style.stretch.coerceIn(0f, 1.6f)+ val mid = 4f * m.coerceIn(0f, 1f) * (1f - m.coerceIn(0f, 1f))+ val swell = (m - 1f).coerceAtLeast(0f)+ val pinch = (-m).coerceAtLeast(0f)+ // small and bounded: the width's own swell is limited by the screen (see the measure+ // block), so the jelly is carried by a gentle squash, never an extreme one+ scaleX = (1f + swell * 0.06f * k - pinch * 0.2f * k).coerceIn(0.92f, 1.03f)+ scaleY = (1f - mid * 0.03f * k - swell * 0.22f * k + pinch * 0.15f * k).coerceIn(0.93f, 1.06f)+ transformOrigin = TransformOrigin(0.5f, 1f)+ // the note's toolbar sits 4 dp lower than the dock+ translationY = into.value.coerceIn(0f, 1f) * 4.dp.toPx()+ }+ // the very glass of the Back and menu buttons; the recorder darkens it so its white reads+ .glass(Capsule, c.glass, blur = 3.dp, lensHeight = 14.dp, lensAmount = 26.dp)+ .graphicsLayer { clip = true; shape = Capsule }+ .drawBehind { drawRect(c.capsule, alpha = (lerp(0.5f, 1.9f, morph.value.coerceIn(0f, 1f)) + 0.5f * into.value.coerceIn(0f, 1f)).coerceAtMost(1f)) }+ .padding(6.dp),+ ) { measurables, constraints ->+ val loose = constraints.copy(minWidth = 0, minHeight = 0)+ val idle = measurables[0].measure(loose)+ val recording = measurables.getOrNull(1)?.measure(loose)+ // past 1 the capsule swells beyond the recorder, but only by what the screen has room for (a+ // swing wider than that was cut off at the screen's edge and read as a stall), eased in so it+ // never hits a wall; past 0 it pinches in a little (the rest of the rebound is the squeeze+ // above), and it can never collapse to nothing+ val raw = morph.value+ val m = when {+ raw < 0f -> raw * 0.25f+ raw > 1f && recording != null -> {+ val room = (constraints.maxWidth - recording.width).coerceAtLeast(0).toFloat()+ val cap = (room / (recording.width - idle.width).coerceAtLeast(1)).coerceIn(0f, 0.12f)+ if (cap <= 0.001f) 1f else 1f + cap * kotlin.math.tanh((raw - 1f) / cap)+ }+ else -> raw+ }+ var w = if (recording == null) idle.width else lerp(idle.width.toFloat(), recording.width.toFloat(), m).roundToInt().coerceAtLeast(1)+ var h = if (recording == null) idle.height else lerp(idle.height.toFloat(), recording.height.toFloat(), m).roundToInt().coerceAtLeast(1)+ // becoming the note's toolbar: its glass, less the 6 dp this capsule pads on every side+ val bar = vm.noteBarSize+ val n = into.value+ if (n != 0f && bar.width > 0) {+ val pad = 12.dp.roundToPx()+ w = lerp(w.toFloat(), (bar.width - pad).toFloat(), n).roundToInt().coerceAtLeast(1)+ h = lerp(h.toFloat(), (bar.height - pad).toFloat(), n).roundToInt().coerceAtLeast(1)+ }+ layout(w, h) {+ idle.place((w - idle.width) / 2, (h - idle.height) / 2)+ recording?.place((w - recording.width) / 2, (h - recording.height) / 2)}}}@@ -185,16 +340,16 @@ fun BoxScope.CreateDock(vm: AppViewModel, desk: DeskState, onBrowse: () -> Unit)/** The white + (it turns to an × while the fan is open). */@Composableprivate fun PlusButton(open: Boolean, onClick: () -> Unit) {- val turn by animateFloatAsState(if (open) 45f else 0f, GlassMotion.morph(), label = "plus")+ val turn by animateFloatAsState(if (open) 45f else 0f, if (open) GlassMotion.morph() else Fluid.dismiss(), label = "plus")val label = stringResource(R.string.dock_create)Box(Modifier.size(58.dp)- .pressable(onClick, pressedScale = 0.86f)- .graphicsLayer { shadowElevation = 8.dp.toPx(); shape = CircleShape; clip = true }+ .pressable(onClick, pressedScale = 0.9f, feel = Feel.Press)+ .graphicsLayer { shadowElevation = 4.dp.toPx(); shape = CircleShape; clip = true }.background(Color.White).semantics { contentDescription = label },contentAlignment = Alignment.Center,- ) { PlusGlyph(Color(0xFF1C2433), Modifier.size(22.dp).graphicsLayer { rotationZ = turn }) }+ ) { PlusGlyph(DockInk, Modifier.size(22.dp).graphicsLayer { rotationZ = turn }) }}/** A way to make something, in the fan. */@@ -202,8 +357,10 @@ private class FanItem(val icon: ImageVector, val label: String, val accent: Colo/** The fan: the ways to make something, rising from the + one after another. */@Composable-private fun BoxScope.Fan(vm: AppViewModel, desk: DeskState, onBrowse: () -> Unit) {+private fun BoxScope.Fan(vm: AppViewModel, desk: DeskState, open: Boolean, onBrowse: () -> Unit) {val c = clear+ // glass bodies: the Back button's glass, with enough body that the label reads over the desk+ val body = c.frost.copy(alpha = c.frost.alpha * if (c.dark) 0.40f else 0.32f)fun go(f: () -> Unit): () -> Unit = {desk.fanOpen = falsef()@@ -216,65 +373,95 @@ private fun BoxScope.Fan(vm: AppViewModel, desk: DeskState, onBrowse: () -> UnitFanItem(LucideIcons.Images, stringResource(R.string.desk_photos_to_pdf), Candy.Tangerine, go { vm.pickPhotosToPdf() }),FanItem(LucideIcons.Combine, stringResource(R.string.common_tool_combine), Candy.Bubblegum, go { vm.pickFiles(FilePickKind.Combine) }),)+ val haptics = LocalHaptics.current+ LaunchedEffect(open) { if (open) { delay(60); haptics?.cascade(items.size) } }Column(Modifier.align(Alignment.BottomCenter).navigationBarsPadding().padding(bottom = 96.dp),verticalArrangement = Arrangement.spacedBy(10.dp),horizontalAlignment = Alignment.CenterHorizontally,) {- items.forEachIndexed { i, it ->- // the nearest (last) first, as if they spill out of the +- val p = remember { Animatable(0f) }- LaunchedEffect(Unit) {- delay(28L * (items.size - 1 - i))- p.animateTo(1f, GlassMotion.pop())- }- Row(- Modifier- .graphicsLayer {- translationY = (1f - p.value) * (40 + 14 * (items.size - i)).dp.toPx()- val s = 0.5f + 0.5f * p.value- scaleX = s- scaleY = s- alpha = p.value.coerceIn(0f, 1f)- compositingStrategy = CompositingStrategy.ModulateAlpha- }- .pressable(it.go, pressedScale = 0.92f)- .glass(Capsule, c.frost, blur = 14.dp)- .height(54.dp)- .padding(start = 8.dp, end = 22.dp),- verticalAlignment = Alignment.CenterVertically,- ) {- Box(Modifier.size(38.dp).clip(CircleShape).background(it.accent), contentAlignment = Alignment.Center) {- Icon(it.icon, null, tint = Color.White, modifier = Modifier.size(19.dp))- }- Spacer(Modifier.width(12.dp))- Text(it.label, style = ClearType.BodyStrong, color = c.ink)- }+ items.forEachIndexed { i, item -> FanChip(item, i, items.size, open, body) }+ }+}++/**+ * One item of the fan. The nearest (last) comes first, as if they spill out of the +; each is+ * composed only when its turn comes, so the tap builds one chip's glass, not six at once (the column+ * grows upward from the +, so nothing shifts). They spring out on the menu's glass spring (the position+ * and size may go past rest, the fade never does) and slide straight back in. Each slides as a finished+ * texture ([floatingLayer]): its glass is drawn once, where it comes to rest, not on every frame.+ */+@Composable+private fun FanChip(item: FanItem, index: Int, count: Int, open: Boolean, body: Color) {+ val c = clear+ val p = remember { Animatable(0f) }+ val a = remember { Animatable(0f) }+ var live by remember { mutableStateOf(false) }+ LaunchedEffect(open) {+ if (open) {+ delay(26L * (count - 1 - index))+ live = true+ launch { a.animateTo(1f, Fluid.fade()) }+ p.animateTo(1f, GlassMotion.unfold())+ } else {+ launch { a.animateTo(0f, Fluid.fade()) }+ p.animateTo(0f, Fluid.dismiss())}}+ if (!live) return+ GlassChip(+ onClick = { if (open) item.go() },+ modifier = Modifier.floatingLayer {+ translationY = (1f - p.value) * (28 + 10 * (count - index)).dp.toPx()+ val s = 0.86f + 0.14f * p.value+ scaleX = s+ scaleY = s+ alpha = a.value.coerceIn(0f, 1f)+ },+ height = 54.dp,+ fill = { body },+ contentPadding = PaddingValues(start = 8.dp, end = 22.dp),+ horizontalArrangement = Arrangement.Start,+ blur = 6.dp,+ tap = Feel.Tap,+ label = item.label,+ ) {+ Box(Modifier.size(38.dp).clip(CircleShape).background(item.accent), contentAlignment = Alignment.Center) {+ Icon(item.icon, null, tint = Color.White, modifier = Modifier.size(19.dp))+ }+ Spacer(Modifier.width(12.dp))+ Text(item.label, style = ClearType.BodyStrong, color = c.ink)+ }}/** The capsule as a recorder: cancel, a pulsing dot with the time, the live waveform, stop. */@Composableprivate fun Recording(rec: VoiceRecorder, onCancel: () -> Unit, onStop: () -> Unit) {- val haptics = LocalHapticFeedback.current- LaunchedEffect(Unit) { haptics.performHapticFeedback(HapticFeedbackType.LongPress) }- val pulse by rememberInfiniteTransition(label = "rec").animateFloat(0.35f, 1f, infiniteRepeatable(tween(700), RepeatMode.Reverse), label = "dot")+ val pulse = rememberInfiniteTransition(label = "rec").animateFloat(0.35f, 1f, infiniteRepeatable(tween(700), RepeatMode.Reverse), label = "dot")Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(10.dp)) {- GlassCircle(onClick = onCancel, size = 50.dp, surface = Color.White.copy(alpha = 0.14f), label = stringResource(R.string.common_cancel)) {- GlassIcon(LucideIcons.X, null, Modifier.size(20.dp), tint = Color.White)+ // the + turns to an x in the dock's near-black; the recorder's x wears the same ink, on a light+ // glass so it reads against the dark capsule+ GlassCircle(onClick = onCancel, size = 50.dp, surface = Color.White.copy(alpha = 0.82f), label = stringResource(R.string.common_cancel)) {+ GlassIcon(LucideIcons.X, null, Modifier.size(20.dp), tint = DockInk)}- Box(Modifier.size(10.dp).graphicsLayer { alpha = pulse }.clip(CircleShape).background(Candy.Tomato))- Text(clock(rec.elapsedMs), style = ClearType.Number.copy(fontSize = androidx.compose.ui.unit.TextUnit(17f, androidx.compose.ui.unit.TextUnitType.Sp)), color = Color.White)+ // the pulse is read in draw: it never recomposes the row+ Box(Modifier.size(10.dp).graphicsLayer { alpha = pulse.value }.clip(CircleShape).background(Candy.Tomato))+ Elapsed(rec)LiveWave(rec.levels, Modifier.width(112.dp).height(34.dp))Box(- Modifier.size(54.dp).pressable(onStop, pressedScale = 0.86f).clip(CircleShape).background(Color.White),+ Modifier.size(54.dp).pressable(onStop, pressedScale = 0.9f, feel = Feel.Confirm).clip(CircleShape).background(Color.White),contentAlignment = Alignment.Center,) { Box(Modifier.size(18.dp).clip(com.kyant.shapes.RoundedRectangle(5.dp)).background(Candy.Tomato)) }}}-/** The last moments' loudness, newest on the right. */+/** The time recorded, on its own so only it recomposes as the time runs. */+@Composable+private fun Elapsed(rec: VoiceRecorder) {+ Text(clock(rec.elapsedMs), style = ClearType.Number.copy(fontSize = 17.sp), color = Color.White)+}++/** The last moments' loudness, newest on the right (read in draw: no recomposition per sample). */@Composableprivate fun LiveWave(levels: List<Float>, modifier: Modifier) {Canvas(modifier) {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 68c809b..e8c6f7a 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@@ -2,7 +2,6 @@ package com.chethan616.clearpdf.ui.homeimport androidx.annotation.StringResimport androidx.compose.animation.AnimatedContent-import androidx.compose.animation.animateColorAsStateimport androidx.compose.animation.core.Animatableimport androidx.compose.animation.core.animateFloatAsStateimport androidx.compose.animation.fadeIn@@ -12,7 +11,6 @@ import androidx.compose.animation.slideOutVerticallyimport androidx.compose.animation.togetherWithimport androidx.compose.foundation.Imageimport androidx.compose.foundation.background-import androidx.compose.foundation.borderimport androidx.compose.foundation.layout.Arrangementimport androidx.compose.foundation.layout.Boximport androidx.compose.foundation.layout.Column@@ -36,7 +34,10 @@ import androidx.compose.foundation.lazy.staggeredgrid.StaggeredGridItemSpanimport androidx.compose.foundation.lazy.staggeredgrid.itemsIndexedimport androidx.compose.foundation.lazy.staggeredgrid.rememberLazyStaggeredGridStateimport androidx.compose.foundation.text.BasicText-import androidx.compose.foundation.text.TextAutoSize+import androidx.compose.foundation.layout.BoxWithConstraints+import androidx.compose.ui.platform.LocalDensity+import androidx.compose.ui.text.TextStyle+import androidx.compose.ui.text.rememberTextMeasurerimport androidx.compose.material3.Iconimport androidx.compose.material3.Textimport androidx.compose.runtime.Composable@@ -52,6 +53,8 @@ import androidx.compose.runtime.setValueimport androidx.compose.ui.Alignmentimport androidx.compose.ui.Modifierimport androidx.compose.ui.draw.clip+import androidx.compose.ui.draw.drawWithContent+import androidx.compose.ui.layout.layoutimport androidx.compose.ui.geometry.Rectimport androidx.compose.ui.graphics.Colorimport androidx.compose.ui.graphics.ColorFilter@@ -69,6 +72,8 @@ import com.chethan616.clearpdf.notes.NoteKindimport com.chethan616.clearpdf.ui.AppViewModelimport com.chethan616.clearpdf.ui.LucideIconsimport com.chethan616.clearpdf.ui.glass.GlassCircle+import com.chethan616.clearpdf.ui.glass.HeaderGlassButton+import androidx.compose.ui.focus.focusRequesterimport com.chethan616.clearpdf.ui.glass.GlassMenuimport com.chethan616.clearpdf.ui.glass.GlassMenuItemimport com.chethan616.clearpdf.ui.glass.GlassMotion@@ -84,7 +89,6 @@ import com.chethan616.clearpdf.ui.theme.Toneimport com.chethan616.clearpdf.ui.theme.clearimport com.chethan616.clearpdf.ui.theme.glowingimport com.chethan616.clearpdf.ui.viewer.VoicePlayer-import com.kyant.shapes.Capsuleimport kotlinx.coroutines.launch/** What the desk shows: everything, or one kind. */@@ -109,6 +113,10 @@ sealed interface DeskItem {override val key get() = "p-" + note.id}+ data object Thought : DeskItem {+ override val key get() = "thought"+ }+data object Files : DeskItem {override val key get() = "files"}@@ -126,18 +134,22 @@ sealed interface DeskItem {}}-/** The desk's cards for [filter]: notes newest first, with the collections set in among them. */-fun deskItems(filter: DeskFilter, notes: List<Note>, recents: List<FileRow>): List<DeskItem> {- val sorted = notes.sortedWith(compareByDescending<Note> { it.pinned }.thenByDescending { it.updated })+/**+ * The desk's cards for [filter]: notes newest first, with the collections set in among them, and+ * [day]'s "Thought of the day" second (its note, once written on, is that card, not a second one).+ */+fun deskItems(filter: DeskFilter, notes: List<Note>, recents: List<FileRow>, day: Long): List<DeskItem> {+ val sorted = notes.filter { it.thought != day }.sortedWith(compareByDescending<Note> { it.pinned }.thenByDescending { it.updated })return when (filter) {DeskFilter.All -> {val out = sorted.map<Note, DeskItem> { DeskItem.Of(it) }.toMutableList()if (recents.isNotEmpty()) out.add(minOf(1, out.size), DeskItem.Recent(recents))out.add(minOf(3, out.size), DeskItem.Files)out.add(minOf(6, out.size), DeskItem.Pdfs(recents.size))+ out.add(minOf(1, out.size), DeskItem.Thought)out}- DeskFilter.Notes -> sorted.filter { it.kind == NoteKind.Text }.map { DeskItem.Of(it) }+ DeskFilter.Notes -> sorted.filter { it.kind == NoteKind.Text }.map<Note, DeskItem> { DeskItem.Of(it) }.toMutableList().apply { add(minOf(1, size), DeskItem.Thought) }DeskFilter.Todo -> sorted.filter { it.kind == NoteKind.List }.map { DeskItem.Of(it) }DeskFilter.Audio -> sorted.filter { it.kind == NoteKind.Voice }.map { DeskItem.Of(it) }DeskFilter.Images -> sorted.filter { it.images.isNotEmpty() }.map { DeskItem.Picture(it) }@@ -163,9 +175,16 @@ fun HomeScreen(vm: AppViewModel, desk: DeskState) {var actionsFor by remember { mutableStateOf<Note?>(null) }val notes = vm.notes.allval recents = vm.recentRows()- val items = remember(filter, notes, vm.recentList) { deskItems(filter, notes, recents) }+ val items = remember(filter, notes, vm.recentList) { deskItems(filter, notes, recents, com.chethan616.clearpdf.notes.today()) }val grid = rememberLazyStaggeredGridState()LaunchedEffect(filter) { grid.animateScrollToItem(0) }+ // the cards rise in when the desk (or a chip) first shows them, never while scrolling+ var intro by remember { mutableStateOf(true) }+ LaunchedEffect(filter) {+ intro = true+ kotlinx.coroutines.delay(700)+ intro = false+ }fun play(n: Note) {val f = n.audio?.let(vm.notes::file) ?: return@@ -197,13 +216,14 @@ fun HomeScreen(vm: AppViewModel, desk: DeskState) {FilterChips(filter) { filter = it }}itemsIndexed(items, key = { _, it -> it.key }) { i, item ->- val m = Modifier.fillMaxWidth().riseIn(i)+ val m = Modifier.fillMaxWidth().riseIn(i, active = intro)when (item) {is DeskItem.Of -> when (item.note.kind) {NoteKind.List -> ListCard(item.note, { vm.openNote = item.note.id }, { actionsFor = item.note }, { vm.notes.toggle(item.note.id, it.id) }, m)NoteKind.Voice -> VoiceCard(item.note, playing == item.note.id && player.playing,- if (playing == item.note.id && player.durationMs > 0) player.positionMs / player.durationMs.toFloat() else 0f,+ // read while drawing: the position ticking never recomposes the desk+ { if (playing == item.note.id && player.durationMs > 0) player.positionMs / player.durationMs.toFloat() else 0f },{ play(item.note) }, { actionsFor = item.note }, m,)NoteKind.Text -> NoteCard(item.note, { vm.openNote = item.note.id }, { actionsFor = item.note }, m)@@ -214,10 +234,11 @@ fun HomeScreen(vm: AppViewModel, desk: DeskState) {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 },chips = {- if (n.images.size > 1) PhotoChip("+${n.images.size - 1}", modifier = Modifier.align(Alignment.BottomEnd).padding(12.dp))+ if (n.images.size > 1) PhotoChip("+${n.images.size - 1}", { vm.openNote = n.id }, Modifier.align(Alignment.BottomEnd).padding(12.dp))},) { NoteImage(n.images.first(), Modifier.matchParentSize(), maxPx = 900) }}+ DeskItem.Thought -> ThoughtCard({ vm.openThought() }, m)DeskItem.Files -> CollectionCard(stringResource(R.string.desk_word_files), clear.tone(Tone.Butter), { vm.filesShowLocal = true; vm.homeTab = HomeTab.Files }, m)is DeskItem.Pdfs -> CollectionCard(stringResource(R.string.desk_word_pdf), clear.tone(Tone.Orchid), { vm.homeTab = HomeTab.Files }, m, height = 136.dp)is DeskItem.Recent -> RecentCard(vm, item.rows, { vm.homeTab = HomeTab.Files }, m)@@ -233,94 +254,153 @@ fun HomeScreen(vm: AppViewModel, desk: DeskState) {}}- actionsFor?.let { n -> NoteActions(vm, n) { actionsFor = null } }+ actionsFor?.let { n -> NoteActions(vm, n, onRename = { desk.naming = n.id }) { actionsFor = null } }+ desk.naming?.let { id -> vm.notes.get(id)?.let { n -> NameSheet(vm, n) { desk.naming = null } } }}-/** The mark on the left (it spins when tapped), the four-dot menu on the right. */+/** The mark on the left, the four-dot menu on the right. */@Composableprivate fun DeskHeader(vm: AppViewModel) {val c = clear- val spin = remember { Animatable(0f) }- val scope = rememberCoroutineScope()var menu by remember { mutableStateOf(false) }+ var morphing by remember { mutableStateOf(false) }var anchor by remember { mutableStateOf(Rect.Zero) }Row(Modifier.fillMaxWidth().padding(start = 6.dp, top = 14.dp, end = 4.dp), verticalAlignment = Alignment.CenterVertically) {Image(painterResource(R.drawable.artefact_mark), stringResource(R.string.app_name),colorFilter = ColorFilter.tint(c.hero),- modifier = Modifier.height(50.dp).width(56.dp)- .graphicsLayer { rotationZ = spin.value; val s = 1f + 0.12f * kotlin.math.sin(Math.toRadians(spin.value.toDouble() / 2).toFloat()); scaleX = s; scaleY = s }- .pressable({ scope.launch { spin.snapTo(0f); spin.animateTo(360f, GlassMotion.morph()) } }, pressedScale = 0.85f),+ modifier = Modifier.height(50.dp).width(56.dp),)Spacer(Modifier.weight(1f))- GlassCircle(- onClick = { menu = true }, size = 54.dp, surface = Color.White.copy(alpha = if (c.dark) 0.08f else 0.18f),- modifier = Modifier.onGloballyPositioned { anchor = it.boundsInWindow() }.border(1.dp, c.rim, androidx.compose.foundation.shape.CircleShape),+ // one glass button, as every other: its own lit rim, no second ring drawn around it+ // the button becomes the menu: hidden while its glass is out in the overlay+ HeaderGlassButton(+ onClick = { menu = true; morphing = true },label = stringResource(R.string.common_more_options),+ modifier = Modifier.onGloballyPositioned { anchor = it.boundsInWindow() }.graphicsLayer { alpha = if (morphing) 0f else 1f },) { FourDots(c.hero) }}- if (menu) {- GlassMenu(- anchor, { menu = false },- listOf(+ if (morphing) {+ com.chethan616.clearpdf.ui.glass.GlassMorphMenu(+ open = menu,+ anchor = anchor,+ onDismiss = { menu = false },+ onGone = { morphing = false },+ items = listOf(GlassMenuItem(stringResource(R.string.home_tab_files), LucideIcons.FolderOpen) { vm.homeTab = HomeTab.Files },GlassMenuItem(stringResource(R.string.home_tab_tools), LucideIcons.LayoutGrid) { vm.homeTab = HomeTab.Tools },GlassMenuItem(stringResource(R.string.home_settings), LucideIcons.Settings) { vm.settingsOpen = true },),- )+ ) { FourDots(c.hero) }}}-/** The big white title; a new chip slides a new one up in its place. */+private fun deskFace(f: DeskFilter): TextStyle = when (f) {+ DeskFilter.All -> ClearType.DeskAll+ DeskFilter.Notes -> ClearType.DeskNotes+ DeskFilter.Todo -> ClearType.DeskTodo+ DeskFilter.Pdfs -> ClearType.DeskPdfs+ DeskFilter.Images -> ClearType.DeskImages+ DeskFilter.Audio -> ClearType.DeskAudio+}++/**+ * The big white title; a new chip slides a new one up in its place. Every title is set at the same+ * size and in a box of the same height, so nothing below it moves when the chip changes. The size is+ * the largest (up to [ClearType.DeskTitleSize]) at which the widest of all six titles fits the width.+ */@Composableprivate fun DeskTitle(filter: DeskFilter) {val c = clear- AnimatedContent(- filter,- transitionSpec = {- (slideInVertically(GlassMotion.morph()) { it / 2 } + fadeIn(GlassMotion.settle())) togetherWith- (slideOutVertically(GlassMotion.fold()) { -it / 3 } + fadeOut(GlassMotion.fold()))- },- label = "desk title",- modifier = Modifier.padding(start = 6.dp, top = 22.dp, bottom = 4.dp),- ) { f ->- BasicText(- stringResource(f.title),- style = ClearType.Display.copy(color = c.hero).glowing(c),- maxLines = 1,- autoSize = TextAutoSize.StepBased(minFontSize = 26.sp, maxFontSize = 44.sp, stepSize = 1.sp),- modifier = Modifier.fillMaxWidth(),- )+ val measurer = rememberTextMeasurer()+ val density = LocalDensity.current+ val titles = DeskFilter.entries.map { it to stringResource(it.title) }+ BoxWithConstraints(Modifier.fillMaxWidth().padding(start = 6.dp, top = 20.dp)) {+ val widthPx = constraints.maxWidth+ val size = remember(titles, widthPx, density.density, density.fontScale) {+ var s = ClearType.DeskTitleSize.value+ while (s > 24f && titles.any { (f, text) ->+ measurer.measure(text, deskFace(f).copy(fontSize = s.sp), maxLines = 1, softWrap = false).size.width > widthPx+ }+ ) s -= 1f+ s.sp+ }+ // a little more than the line: AnimatedContent clips, and an italic g's tail runs below it+ val height = with(density) { ClearType.DeskTitleLine.toDp() } + 10.dp+ AnimatedContent(+ filter,+ transitionSpec = {+ (slideInVertically(com.chethan616.clearpdf.ui.glass.Fluid.push()) { it / 3 } + fadeIn(com.chethan616.clearpdf.ui.glass.Fluid.quick())) togetherWith+ (slideOutVertically(com.chethan616.clearpdf.ui.glass.Fluid.quick()) { -it / 4 } + fadeOut(com.chethan616.clearpdf.ui.glass.Fluid.fade()))+ },+ label = "desk title",+ modifier = Modifier.fillMaxWidth().height(height),+ ) { f ->+ BasicText(+ stringResource(f.title),+ style = deskFace(f).copy(color = c.hero, fontSize = size).glowing(c),+ maxLines = 1,+ softWrap = false,+ modifier = Modifier.fillMaxWidth(),+ )+ }}}-/** The chips: glass capsules with a white rim; the chosen one is filled lemon. */+/**+ * The chips: glass capsules with a white rim; the chosen one is filled lemon. The row runs to the+ * screen's edges and fades out at both, so a chip scrolled past slips away instead of being cut.+ */@Composableprivate fun FilterChips(selected: DeskFilter, onSelect: (DeskFilter) -> Unit) {LazyRow(- Modifier.fillMaxWidth().padding(top = 16.dp, bottom = 10.dp).graphicsLayer { translationX = 0f },- contentPadding = PaddingValues(horizontal = 4.dp),+ Modifier+ // out to the screen's edges, past the grid's 16 dp margins+ .layout { m, c ->+ val extra = 16.dp.roundToPx()+ val p = m.measure(c.copy(minWidth = c.maxWidth + extra * 2, maxWidth = c.maxWidth + extra * 2))+ layout(c.maxWidth, p.height) { p.place(-extra, 0) }+ }+ .padding(top = 16.dp, bottom = 10.dp)+ .chipRowFade(),+ contentPadding = PaddingValues(horizontal = 20.dp),horizontalArrangement = Arrangement.spacedBy(10.dp),) {items(DeskFilter.entries, key = { it.name }) { f -> DeskChip(stringResource(f.chip), f == selected) { onSelect(f) } }}}+/** A long, eased fade at both edges of a chip row (fade.png): chips dissolve into the sky there. */+fun Modifier.chipRowFade(): Modifier = graphicsLayer { compositingStrategy = androidx.compose.ui.graphics.CompositingStrategy.Offscreen }+ .drawWithContent {+ drawContent()+ val f = 44.dp.toPx() / size.width+ drawRect(+ androidx.compose.ui.graphics.Brush.horizontalGradient(+ 0f to Color.Transparent, f * 0.35f to Color.Black.copy(alpha = 0.35f), f to Color.Black,+ 1f - f to Color.Black, 1f - f * 0.35f to Color.Black.copy(alpha = 0.35f), 1f to Color.Transparent,+ ),+ blendMode = androidx.compose.ui.graphics.BlendMode.DstIn,+ )+ }++/**+ * A filter chip: real liquid glass (the Back and menu buttons' glass, by Settings ▸ liquid glass and+ * motion); the chosen one is washed lemon, the colour animating while drawing.+ */@Composablefun DeskChip(label: String, chosen: Boolean, onClick: () -> Unit) {val c = clear- val fill by animateColorAsState(if (chosen) Candy.Chip else Color.White.copy(alpha = if (c.dark) 0.06f else 0.16f), GlassMotion.settle(), label = "chip")- val lift by animateFloatAsState(if (chosen) 1f else 0f, GlassMotion.pop(), label = "chip lift")- Box(- Modifier- .graphicsLayer { val s = 1f + 0.04f * lift; scaleX = s; scaleY = s }- .pressable(onClick, pressedScale = 0.9f)- .height(46.dp).clip(Capsule).background(fill)- .border(1.2.dp, if (chosen) Color.Transparent else c.rim, Capsule)- .padding(horizontal = 22.dp),- contentAlignment = Alignment.Center,+ val lit by animateFloatAsState(if (chosen) 1f else 0f, com.chethan616.clearpdf.ui.glass.Fluid.quick(), label = "chip")+ com.chethan616.clearpdf.ui.glass.GlassChip(+ onClick = onClick,+ height = 46.dp,+ fill = { Candy.Chip.copy(alpha = 0.94f * lit) },+ contentPadding = PaddingValues(horizontal = 22.dp),+ tap = com.chethan616.clearpdf.ui.glass.Feel.Tick,+ ink = if (chosen) Color(0xFF1C2433) else c.ink,) {- Text(label, style = ClearType.Body.copy(fontSize = 16.sp), color = if (chosen) Color(0xFF1C2433) else if (c.dark) c.ink else Color(0xFF1C2433))+ Text(label, style = ClearType.Body.copy(fontSize = 16.sp), color = if (chosen) Color(0xFF1C2433) else c.ink)}}@@ -348,13 +428,92 @@ private fun DeskEmpty(vm: AppViewModel, filter: DeskFilter, desk: DeskState) {}}-/** A long press on a note: pin it, or delete it. */+/** A long press on a note: name it (a voice memo), pin it, open it, or delete it. */@Composable-private fun NoteActions(vm: AppViewModel, n: Note, onDismiss: () -> Unit) {- GlassSheet(onDismiss, n.title.ifBlank { stringResource(R.string.notes_untitled_note) }, shortDate(n.updated)) {+private fun NoteActions(vm: AppViewModel, n: Note, onRename: () -> Unit, onDismiss: () -> Unit) {+ val voice = n.kind == NoteKind.Voice+ val title = n.title.ifBlank { stringResource(if (voice) R.string.voice_note else R.string.notes_untitled_note) }+ val subtitle = if (voice && n.durationMs > 0) shortDate(n.updated) + " · " + com.chethan616.clearpdf.ui.viewer.clock(n.durationMs) else shortDate(n.updated)+ GlassSheet(onDismiss, title, subtitle) {+ if (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 (n.kind != NoteKind.Voice) GlassRow(stringResource(R.string.notes_open), { vm.openNote = n.id; onDismiss() }, icon = LucideIcons.SquarePen, accent = Candy.Sky)- GlassRow(stringResource(R.string.common_delete), { vm.notes.delete(n.id); onDismiss() }, icon = LucideIcons.Trash2, destructive = true)+ if (!voice) GlassRow(stringResource(R.string.notes_open), { vm.openNote = n.id; onDismiss() }, icon = LucideIcons.SquarePen, accent = Candy.Sky)+ 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)+ }+}++/**+ * Naming a voice memo: one field, already focused with the keyboard up and any name there+ * selected, so typing replaces it; Done or Save keeps it, an empty name clears it.+ */+@Composable+private fun NameSheet(vm: AppViewModel, n: Note, onDismiss: () -> Unit) {+ var name by remember(n.id) { mutableStateOf(androidx.compose.ui.text.input.TextFieldValue(n.title, androidx.compose.ui.text.TextRange(0, n.title.length))) }+ val focus = remember { androidx.compose.ui.focus.FocusRequester() }+ val feel = com.chethan616.clearpdf.ui.glass.rememberFeel()+ fun save() {+ val t = name.text.trim()+ if (t != n.title) vm.notes.put(n.copy(title = t))+ feel(com.chethan616.clearpdf.ui.glass.Feel.Confirm)+ onDismiss()+ }+ LaunchedEffect(Unit) {+ // once the sheet has risen far enough for the keyboard not to fight it+ kotlinx.coroutines.delay(120)+ runCatching { focus.requestFocus() }+ }+ GlassSheet(onDismiss, stringResource(R.string.voice_name_title), if (n.durationMs > 0) shortDate(n.created) + " · " + com.chethan616.clearpdf.ui.viewer.clock(n.durationMs) else null) {+ val c = clear+ // the keyboard goes down with the sheet, not after it+ val leaving = com.chethan616.clearpdf.ui.glass.LocalOverlayPresence.current?.leaving == true+ val focusManager = androidx.compose.ui.platform.LocalFocusManager.current+ LaunchedEffect(leaving) { if (leaving) focusManager.clearFocus(force = true) }+ Column(Modifier.padding(horizontal = 18.dp)) {+ androidx.compose.foundation.text.BasicTextField(+ value = name,+ onValueChange = { name = it },+ singleLine = true,+ textStyle = ClearType.Body.copy(color = c.ink, fontSize = 17.sp),+ cursorBrush = androidx.compose.ui.graphics.SolidColor(Candy.Grape),+ keyboardOptions = androidx.compose.foundation.text.KeyboardOptions(+ capitalization = androidx.compose.ui.text.input.KeyboardCapitalization.Sentences,+ imeAction = androidx.compose.ui.text.input.ImeAction.Done,+ ),+ keyboardActions = androidx.compose.foundation.text.KeyboardActions(onDone = { save() }),+ modifier = Modifier.fillMaxWidth().focusRequester(focus),+ decorationBox = { inner ->+ Row(+ Modifier.fillMaxWidth().height(54.dp).clip(com.kyant.shapes.RoundedRectangle(18.dp))+ .background(if (c.dark) Color.White.copy(alpha = 0.07f) else Color.White.copy(alpha = 0.7f))+ .padding(start = 14.dp, end = 8.dp),+ verticalAlignment = Alignment.CenterVertically,+ ) {+ Icon(LucideIcons.Mic, null, tint = Candy.Grape, modifier = Modifier.size(19.dp))+ Spacer(Modifier.width(10.dp))+ Box(Modifier.weight(1f)) {+ if (name.text.isEmpty()) Text(stringResource(R.string.voice_name_hint), style = ClearType.Body.copy(fontSize = 17.sp), color = c.inkFaint)+ inner()+ }+ if (name.text.isNotEmpty()) {+ Box(+ Modifier.size(30.dp).clip(androidx.compose.foundation.shape.CircleShape).pressable({ name = androidx.compose.ui.text.input.TextFieldValue("") }, pressedScale = 0.9f),+ contentAlignment = Alignment.Center,+ ) { Icon(LucideIcons.CircleX, stringResource(R.string.common_clear), tint = c.inkFaint, modifier = Modifier.size(18.dp)) }+ }+ }+ },+ )+ Spacer(Modifier.height(16.dp))+ Row(horizontalArrangement = Arrangement.spacedBy(10.dp)) {+ GlassPill(onClick = onDismiss, modifier = Modifier.weight(1f), height = 50.dp) {+ Text(stringResource(R.string.common_cancel), style = ClearType.BodyStrong, color = c.ink, maxLines = 1)+ }+ GlassPill(onClick = { save() }, tint = Candy.Grape, modifier = Modifier.weight(1f), height = 50.dp) {+ Text(stringResource(R.string.common_save), style = ClearType.BodyStrong, color = Color.White, maxLines = 1)+ }+ }+ }}}diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/mascot/Mascot.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/mascot/Mascot.ktindex 3a6157e..3ccae8b 100644--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/mascot/Mascot.kt+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/mascot/Mascot.kt@@ -27,6 +27,7 @@ import androidx.compose.ui.geometry.Sizeimport androidx.compose.ui.graphics.Brushimport androidx.compose.ui.graphics.Colorimport androidx.compose.ui.graphics.Path+import androidx.compose.ui.graphics.graphicsLayerimport androidx.compose.ui.graphics.drawscope.DrawScopeimport androidx.compose.ui.graphics.drawscope.Strokeimport androidx.compose.ui.graphics.drawscope.rotate@@ -92,7 +93,10 @@ fun Mascot(still: Boolean = false,/** Changing this makes the bot hop (a reaction, e.g. to a key press); 0 does nothing. */hopSignal: Int = 0,+ /** Off screen (a pager's far page): stops redrawing with the breath, so it costs no frames. */+ paused: Boolean = false,) {+ val clock = remember { floatArrayOf(0f, 0.4f, 0.5f) }val shape = BOT_SHAPES[type] ?: BOT_SHAPES.getValue("flower")val body = remember(type) { PathParser().parsePathString(shape.path).toPath() }val parts = remember(type) { shape.parts?.let { PathParser().parsePathString(it).toPath() } }@@ -102,6 +106,7 @@ fun Mascot(val bodyColor = lerp(base, Color(0xFF8C9199), grey)val ink = inkFor(base)val hopFeedback = LocalMascotHop.current+ val haptics = com.chethan616.clearpdf.ui.glass.LocalHaptics.currentval scope = rememberCoroutineScope()val seed = remember(type) { Random(type.hashCode()) }@@ -253,7 +258,11 @@ fun Mascot(Modifier.pointerInput(type) {detectTapGestures {hopFeedback()- scope.launch { jump(18f) }+ haptics?.play(com.chethan616.clearpdf.ui.glass.Feel.Rise)+ scope.launch {+ jump(18f)+ haptics?.play(com.chethan616.clearpdf.ui.glass.Feel.Thud)+ }}}} else Modifier@@ -261,12 +270,20 @@ fun Mascot(Canvas(modifier.size(size)+ // its own layer: the breathing and blinking redraw only this, not the card or page around it+ .graphicsLayer {}.then(tapModifier).semantics { contentDescription = label ?: "Artefact mascot, ${moodLabel(mood)}" },) {val unit = this.size.minDimension / 100f- val breath = breathPhase?.value ?: 0f- val beat = beatPhase?.value ?: 0.4f+ // paused (off screen) it reads no clock, so it is never redrawn, and keeps its last pose+ if (!paused) {+ clock[0] = breathPhase?.value ?: 0f+ clock[1] = beatPhase?.value ?: 0.4f+ clock[2] = nudgePhase?.value ?: 0.5f+ }+ val breath = clock[0]+ val beat = clock[1]val phase = breath * 2f * PI.toFloat()val breathe = if (slow) 1f + 0.025f * sin(phase) else 1f + 0.012f * sin(phase)val bob = if (mood == MascotMood.Idle) 1.2f * sin(phase) else 0f@@ -312,7 +329,7 @@ fun Mascot(face = lerpFace(faceFrom.value, faceTo.value, faceMix.value),shape = shape, ink = ink, lookX = lookX.value, lookY = lookY.value,eyeOpen = eyeOpen.value, large = large,- breath = sin(phase), nudge = nudgePhase?.value ?: 0.5f,+ breath = sin(phase), nudge = clock[2],)}}diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/notes/NoteEditor.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/notes/NoteEditor.ktindex 04c0c9a..4d8e989 100644--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/notes/NoteEditor.kt+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/notes/NoteEditor.kt@@ -119,6 +119,9 @@ fun NoteEditor(vm: AppViewModel, id: String) {var menu by remember { mutableStateOf(false) }var anchor by remember { mutableStateOf(Rect.Zero) }val isList = note.kind == NoteKind.List+ // a thought of the day not yet written on: its words show, with a line inviting you to go on+ val seed = remember(id) { note.title to note.body }+ val reading = note.thought != 0L && title.text == seed.first && body.text == seed.second && note.images.isEmpty()fun commit() {val n = vm.notes.get(id) ?: return@@ -136,15 +139,14 @@ fun NoteEditor(vm: AppViewModel, id: String) {Column {Spacer(Modifier.windowInsetsTopHeight(WindowInsets.statusBars))Row(Modifier.fillMaxWidth().padding(top = 14.dp), verticalAlignment = Alignment.CenterVertically) {- GlassCircle(onClick = { vm.closeNote() }, size = 56.dp, surface = c.capsule, label = stringResource(R.string.common_back)) {- GlassIcon(LucideIcons.ChevronLeft, null, Modifier.size(24.dp), tint = Color.White)+ com.chethan616.clearpdf.ui.glass.HeaderGlassButton(onClick = { vm.closeNote() }, label = stringResource(R.string.common_back)) {+ GlassIcon(LucideIcons.ChevronLeft, null, Modifier.size(24.dp))}Spacer(Modifier.weight(1f))- GlassCircle(- onClick = { menu = true }, size = 56.dp, surface = Color.White.copy(alpha = 0.16f),- modifier = Modifier.onGloballyPositioned { anchor = it.boundsInWindow() }.border(1.dp, c.rim, CircleShape),- label = stringResource(R.string.common_more_options),- ) { GlassIcon(LucideIcons.Ellipsis, null, Modifier.size(24.dp), tint = c.hero) }+ com.chethan616.clearpdf.ui.glass.HeaderGlassButton(+ onClick = { menu = true }, label = stringResource(R.string.common_more_options),+ modifier = Modifier.onGloballyPositioned { anchor = it.boundsInWindow() },+ ) { GlassIcon(LucideIcons.Ellipsis, null, Modifier.size(24.dp)) }}}}@@ -217,9 +219,21 @@ fun NoteEditor(vm: AppViewModel, id: String) {keyboardOptions = KeyboardOptions(capitalization = KeyboardCapitalization.Sentences),modifier = Modifier.fillMaxWidth().heightIn(min = 220.dp).focusRequester(bodyFocus),decorationBox = { inner ->- Box {- if (body.text.isEmpty()) Text(stringResource(R.string.notes_body_hint), style = ClearType.Body.copy(fontSize = 18.sp, lineHeight = 30.sp), color = c.ink.copy(alpha = 0.38f))- inner()+ Column {+ Box {+ if (body.text.isEmpty()) Text(stringResource(R.string.notes_body_hint), style = ClearType.Body.copy(fontSize = 18.sp, lineHeight = 30.sp), color = c.ink.copy(alpha = 0.38f))+ inner()+ }+ if (reading) {+ Text(+ stringResource(R.string.notes_body_hint), style = ClearType.Body.copy(fontSize = 18.sp, lineHeight = 30.sp), color = c.ink.copy(alpha = 0.38f),+ modifier = Modifier.padding(top = 30.dp).pressable({+ val text = body.text + "\n\n"+ body = TextFieldValue(text, TextRange(text.length))+ runCatching { bodyFocus.requestFocus() }+ }, pressedScale = 0.98f),+ )+ }}},)@@ -245,9 +259,14 @@ fun NoteEditor(vm: AppViewModel, id: String) {}// the toolbar, above the keyboard+ // opened from the desk, this is the dock's capsule grown into place: unseen until it has+ val iconsIn by androidx.compose.animation.core.animateFloatAsState(if (vm.noteBarHidden) 0f else 1f, com.chethan616.clearpdf.ui.glass.Fluid.fade(), label = "bar")Row(Modifier.align(Alignment.BottomCenter).navigationBarsPadding().imePadding().padding(bottom = 14.dp)- .glass(Capsule, c.capsule, blur = 10.dp).padding(6.dp),+ .onGloballyPositioned { vm.noteBarSize = it.size }+ .graphicsLayer { alpha = if (vm.noteBarHidden) 0f else 1f }+ .glass(Capsule, c.capsule, blur = 10.dp).padding(6.dp)+ .graphicsLayer { alpha = iconsIn },horizontalArrangement = Arrangement.spacedBy(8.dp),verticalAlignment = Alignment.CenterVertically,) {@@ -282,7 +301,7 @@ private fun ItemRow(item: CheckItem, focus: Boolean, onChange: (String) -> Unit,val fr = remember { FocusRequester() }LaunchedEffect(focus) { if (focus) runCatching { fr.requestFocus() } }var value by remember(item.id) { mutableStateOf(TextFieldValue(item.text, TextRange(item.text.length))) }- val tick by animateFloatAsState(if (item.done) 1f else 0f, GlassMotion.pop(), label = "tick")+ val tick by animateFloatAsState(if (item.done) 1f else 0f, com.chethan616.clearpdf.ui.glass.Fluid.quick(), label = "tick")val ink by animateColorAsState(if (item.done) c.ink.copy(alpha = 0.45f) else c.ink, GlassMotion.settle(), label = "ink")Row(Modifier.fillMaxWidth().padding(vertical = 5.dp), verticalAlignment = Alignment.CenterVertically) {Box(Modifier.size(30.dp).pressable(onToggle, pressedScale = 0.8f).semantics { contentDescription = item.text }, contentAlignment = Alignment.Center) {diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/onboarding/Onboarding.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/onboarding/Onboarding.ktindex 046e239..35e59cf 100644--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/onboarding/Onboarding.kt+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/onboarding/Onboarding.kt@@ -10,6 +10,7 @@ import androidx.compose.foundation.layout.Arrangementimport androidx.compose.foundation.layout.Boximport androidx.compose.foundation.layout.BoxScopeimport androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.PaddingValuesimport androidx.compose.foundation.layout.Rowimport androidx.compose.foundation.layout.Spacerimport androidx.compose.foundation.layout.WindowInsets@@ -21,6 +22,7 @@ import androidx.compose.foundation.layout.offsetimport androidx.compose.foundation.layout.paddingimport androidx.compose.foundation.layout.sizeimport androidx.compose.foundation.layout.statusBars+import androidx.compose.foundation.layout.statusBarsPaddingimport androidx.compose.foundation.layout.widthimport androidx.compose.foundation.layout.windowInsetsTopHeightimport androidx.compose.foundation.pager.HorizontalPager@@ -31,6 +33,8 @@ import androidx.compose.material3.Iconimport androidx.compose.material3.Textimport androidx.compose.runtime.Composableimport androidx.compose.runtime.LaunchedEffect+import androidx.compose.runtime.State+import androidx.compose.runtime.derivedStateOfimport androidx.compose.runtime.getValueimport androidx.compose.runtime.rememberimport androidx.compose.runtime.rememberCoroutineScope@@ -40,6 +44,7 @@ import androidx.compose.ui.draw.clipimport androidx.compose.ui.geometry.Offsetimport androidx.compose.ui.graphics.Brushimport androidx.compose.ui.graphics.Color+import androidx.compose.ui.graphics.CompositingStrategyimport androidx.compose.ui.graphics.graphicsLayerimport androidx.compose.ui.graphics.vector.ImageVectorimport androidx.compose.ui.res.painterResource@@ -56,10 +61,12 @@ import com.chethan616.clearpdf.Rimport com.chethan616.clearpdf.notes.checkItemimport com.chethan616.clearpdf.ui.AppViewModelimport com.chethan616.clearpdf.ui.LucideIcons-import com.chethan616.clearpdf.ui.glass.GlassMotion+import com.chethan616.clearpdf.ui.glass.Fluid+import androidx.compose.ui.draw.drawBehind+import com.chethan616.clearpdf.ui.glass.Feel+import com.chethan616.clearpdf.ui.glass.GlassChip+import com.chethan616.clearpdf.ui.glass.GlassHostimport com.chethan616.clearpdf.ui.glass.GlassPill-import com.chethan616.clearpdf.ui.glass.glass-import com.chethan616.clearpdf.ui.glass.pressableimport com.chethan616.clearpdf.ui.home.CardShapeimport com.chethan616.clearpdf.ui.home.CheckPillimport com.chethan616.clearpdf.ui.home.CollectionCard@@ -72,17 +79,30 @@ import com.chethan616.clearpdf.ui.theme.ClearTypeimport com.chethan616.clearpdf.ui.theme.Toneimport com.chethan616.clearpdf.ui.theme.clearimport com.chethan616.clearpdf.ui.theme.glowing+import com.kyant.backdrop.throttleBackdropsimport com.kyant.shapes.Capsuleimport com.kyant.shapes.RoundedRectangleimport java.text.SimpleDateFormatimport java.util.Dateimport java.util.Localeimport kotlin.math.absoluteValue+import kotlinx.coroutines.flow.firstimport kotlinx.coroutines.launch/** How many welcome pages there are. */const val WelcomePages = 4+/** The strip under the status bar kept for Skip. */+private val SkipBand = 44.dp++/** The Continue button's colour on each page; between two pages it blends with the swipe. */+private val PageAccents = listOf(Candy.Grape, Candy.Bubblegum, Candy.Tangerine, Candy.Mint)++private fun accentAt(position: Float): Color {+ val i = position.toInt().coerceIn(0, PageAccents.size - 2)+ return androidx.compose.ui.graphics.lerp(PageAccents[i], PageAccents[i + 1], (position - i).coerceIn(0f, 1f))+}+/*** The welcome: four pages on the sky, each with its own playful stack of cards (the mock's tilted* cards), a big white title, and a glass pager with a jelly dot. Skip or Get started lands on the desk.@@ -91,36 +111,60 @@ const val WelcomePages = 4fun Onboarding(vm: AppViewModel, pager: PagerState = rememberPagerState { WelcomePages }) {val c = clearval scope = rememberCoroutineScope()+ val haptics = com.chethan616.clearpdf.ui.glass.LocalHaptics.current+ LaunchedEffect(pager) {+ var first = true+ androidx.compose.runtime.snapshotFlow { pager.currentPage }.collect {+ if (!first) haptics?.play(com.chethan616.clearpdf.ui.glass.Feel.Tick)+ first = false+ }+ }Box(Modifier.fillMaxSize()) {- HorizontalPager(pager, Modifier.fillMaxSize()) { page ->- val offset = (pager.currentPage - page) + pager.currentPageOffsetFraction+ HorizontalPager(pager, Modifier.fillMaxSize(), beyondViewportPageCount = 1) { page ->+ // how far this page is from the middle, read only while drawing: a swipe moves the+ // pages and their cards without recomposing a thing+ val offset = remember(pager, page) { { (pager.currentPage - page) + pager.currentPageOffsetFraction } }+ // a page that is out of sight and not about to be: its mascot stops redrawing+ val idle = remember(pager, page) { derivedStateOf { !pager.isScrollInProgress && pager.currentPage != page } }Column(Modifier.fillMaxSize().graphicsLayer {- // the page behind drifts slower than the finger: depth- translationX = offset * size.width * 0.35f- alpha = 1f - offset.absoluteValue.coerceIn(0f, 1f) * 0.6f+ // pages slide exactly with the finger (no drift of their own: that pulled the+ // neighbours into view at rest); depth comes from the cards' own sway+ alpha = 1f - offset().absoluteValue.coerceIn(0f, 1f) * 0.6f+ compositingStrategy = androidx.compose.ui.graphics.CompositingStrategy.ModulateAlpha},) {Spacer(Modifier.windowInsetsTopHeight(WindowInsets.statusBars))+ // the band Skip lives in: nothing of a page is ever laid under it+ Spacer(Modifier.height(SkipBand))Box(Modifier.fillMaxWidth().weight(1f)) {when (page) {- 0 -> Hello(offset)+ 0 -> Hello(offset, idle)1 -> OneDesk(offset)2 -> PdfTools(offset)- else -> Promise(offset)+ else -> Promise(offset, idle)}}Spacer(Modifier.height(150.dp))}}- // skip, top right- if (pager.currentPage < WelcomePages - 1) {- Text(- stringResource(R.string.welcome_skip), style = ClearType.BodyStrong, color = c.hero,- modifier = Modifier.align(Alignment.TopEnd).padding(top = 52.dp, end = 22.dp)- .pressable({ vm.finishOnboarding() }).padding(horizontal = 12.dp, vertical = 8.dp),- )+ // skip, top right, in its own band, a glass chip like Back and More; it fades out as the last+ // page arrives (read while drawing)+ GlassChip(+ onClick = { if (pager.currentPage < WelcomePages - 1) vm.finishOnboarding() },+ modifier = Modifier.align(Alignment.TopEnd).statusBarsPadding().padding(top = 4.dp, end = 14.dp)+ .graphicsLayer {+ val at = pager.currentPage + pager.currentPageOffsetFraction+ alpha = (1f - (at - (WelcomePages - 2)).coerceIn(0f, 1f))+ compositingStrategy = CompositingStrategy.ModulateAlpha+ },+ height = 36.dp,+ ink = c.hero,+ tap = Feel.Fall,+ contentPadding = PaddingValues(horizontal = 18.dp),+ ) {+ Text(stringResource(R.string.welcome_skip), style = ClearType.BodyStrong, color = c.hero)}// the dots and the button@@ -131,9 +175,11 @@ fun Onboarding(vm: AppViewModel, pager: PagerState = rememberPagerState { WelcomDots(pager)Spacer(Modifier.height(22.dp))val last = pager.currentPage == WelcomePages - 1+ // the button takes each page's colour and blends into the next with the swipe (read while drawing)+ val accent = remember(pager) { { accentAt(pager.currentPage + pager.currentPageOffsetFraction) } }GlassPill(- onClick = { if (last) vm.finishOnboarding() else scope.launch { pager.animateScrollToPage(pager.currentPage + 1, animationSpec = GlassMotion.morph()) } },- tint = if (last) Candy.Sky else Color(0xFF1C2433),+ onClick = { if (last) { haptics?.play(Feel.Confirm); vm.finishOnboarding() } else scope.launch { pager.animateScrollToPage(pager.currentPage + 1, animationSpec = Fluid.push()) } },+ tintAt = accent,height = 58.dp,modifier = Modifier.fillMaxWidth(),) {@@ -144,29 +190,49 @@ fun Onboarding(vm: AppViewModel, pager: PagerState = rememberPagerState { Welcom}}-/** The page dots on a glass capsule; the current one stretches into a pill. */+/**+ * The page dots on a frosted capsule; the current one is a pill. Drawn straight from the pager's+ * position, so the pill stretches and slides with the finger (as iOS's page control) and nothing+ * is laid out or recomposed while it moves.+ */@Composableprivate fun Dots(pager: PagerState) {val c = clear- Row(- Modifier.glass(Capsule, Color.White.copy(alpha = 0.18f), blur = 8.dp).padding(horizontal = 12.dp, vertical = 9.dp),- horizontalArrangement = Arrangement.spacedBy(7.dp),- verticalAlignment = Alignment.CenterVertically,- ) {- repeat(WelcomePages) { i ->- val on = pager.currentPage == i- val w by animateDpAsState(if (on) 26.dp else 8.dp, GlassMotion.morph(), label = "dot")- val col by animateColorAsState(if (on) c.hero else c.hero.copy(alpha = 0.45f), GlassMotion.settle(), label = "dot colour")- Box(Modifier.size(w, 8.dp).clip(Capsule).background(col))- }- }+ val dot = 8.dp+ val pill = 26.dp+ val gap = 7.dp+ Box(+ // its own layer, so a swipe redraws just the dots, not everything they sit in+ Modifier.graphicsLayer {}.frost(Capsule).padding(horizontal = 12.dp, vertical = 9.dp)+ .size(width = pill + (dot + gap) * (WelcomePages - 1), height = dot)+ .drawBehind {+ val d = dot.toPx()+ val p = pill.toPx()+ val g = gap.toPx()+ val at = (pager.currentPage + pager.currentPageOffsetFraction).coerceIn(0f, (WelcomePages - 1).toFloat())+ var x = 0f+ for (i in 0 until WelcomePages) {+ // how much of the pill this dot holds: 1 when it's the page, easing off as the next takes over+ val share = (1f - kotlin.math.abs(at - i)).coerceIn(0f, 1f)+ val w = d + (p - d) * share+ drawRoundRect(+ c.hero.copy(alpha = 0.45f + 0.55f * share),+ topLeft = Offset(x, 0f), size = androidx.compose.ui.geometry.Size(w, d),+ cornerRadius = androidx.compose.ui.geometry.CornerRadius(d / 2f),+ )+ x += w + g+ }+ },+ )}/** A title block: white, glowing; [accent] words come out in a pastel gradient. */@Composableprivate fun Title(eyebrow: String, title: String, accent: String, body: String, top: Dp = 0.dp) {val c = clear- Column(Modifier.fillMaxWidth().padding(start = 26.dp, end = 26.dp, top = top)) {+ // painted once into a texture: the glow is a 22 px blur, too dear to redo on every frame of a swipe+ // (the layer spans the full width, so the glow isn't cut at the text)+ Column(Modifier.fillMaxWidth().graphicsLayer { compositingStrategy = CompositingStrategy.Offscreen }.padding(start = 26.dp, end = 26.dp, top = top)) {Text(eyebrow.uppercase(), style = ClearType.Eyebrow, color = c.hero.copy(alpha = 0.85f))Spacer(Modifier.height(8.dp))Text(@@ -182,48 +248,90 @@ private fun Title(eyebrow: String, title: String, accent: String, body: String,}}-/** A card flying in: from [from], turned [tilt], landing on a spring a little after [delayMs]. */+/**+ * A card flying in: from [from], turned [tilt], gliding into place on the eased curve a little after+ * [delayMs], and swaying with the swipe ([swayWith], read only while drawing). [cache] is for cards+ * dear to redraw (live glass, shadows): they sit in a texture while they move. Every layer is a render+ * pass on the phone's GPU, so the cheap cards are left to draw directly.+ */@Composable-private fun Modifier.flyIn(tilt: Float, from: Offset, delayMs: Long, swayWith: Float): Modifier {+private fun Modifier.flyIn(tilt: Float, from: Offset, delayMs: Long, swayWith: () -> Float, cache: Boolean = false): Modifier {val p = remember { Animatable(0f) }LaunchedEffect(Unit) {+ // wait until the page is mostly on screen: the cards of the pages beside it stay put, so+ // each page's entrance plays when you arrive, not while it is still out of sight+ androidx.compose.runtime.snapshotFlow { kotlin.math.abs(swayWith()) < 0.6f }.first { it }kotlinx.coroutines.delay(delayMs)- p.animateTo(1f, GlassMotion.rise())+ p.animateTo(1f, androidx.compose.animation.core.tween(620, easing = Fluid.Ease))}+ // true from the first frame of the glide to the last, and while a swipe holds the card between pages:+ // the glass inside it re-records its backdrop ten times a second then, not on every frame+ val moving = remember(swayWith) { derivedStateOf { p.isRunning || kotlin.math.abs(swayWith()).let { it > 0.001f && it < 1f } } }return graphicsLayer {val v = p.value- translationX = lerp(from.x, 0f, v) * density + swayWith * size.width * 0.18f+ // zero at rest and on the page beside it, peaking mid-swipe: the cards lean into the swipe+ // and settle back, never leaving a neighbour's cards bleeding in at rest+ val o = swayWith()+ val a = kotlin.math.abs(o)+ val sway = if (a < 1f) 2f * o * (1f - a) else 0f+ translationX = lerp(from.x, 0f, v) * density + sway * size.width * 0.18ftranslationY = lerp(from.y, 0f, v) * density- rotationZ = lerp(tilt * 3f, tilt, v) + swayWith * 6f+ rotationZ = lerp(tilt * 2f, tilt, v) + sway * 6falpha = v.coerceIn(0f, 1f)- }+ // no offscreen pass for the fade: it multiplies into each draw instead+ compositingStrategy = CompositingStrategy.ModulateAlpha+ }.then(+ if (!cache) Modifier else Modifier.graphicsLayer {+ // while the card is flying or swaying, its paint (gradients, clips, glowing text) sits in a+ // texture the outer layer only moves; at rest it is drawn live, so tilted text stays sharp+ val o = kotlin.math.abs(swayWith())+ compositingStrategy = if (p.isRunning || (o > 0.001f && o < 1f)) CompositingStrategy.Offscreen else CompositingStrategy.Auto+ },+ ).throttleBackdrops { moving.value }}+/** A mascot that stops redrawing while its page is out of sight ([idle] is read here, so only this recomposes). */+@Composable+private fun PagedMascot(type: String, mood: MascotMood, size: Dp, idle: State<Boolean>, modifier: Modifier = Modifier) {+ Mascot(type, mood, size, modifier, paused = idle.value)+}++/** Today, as the welcome's cards write it: made once, not on every frame. */+@Composable+private fun rememberDate(pattern: String): String = remember(pattern) { SimpleDateFormat(pattern, Locale.getDefault()).format(Date()) }+// ---- page 1: hello ----------------------------------------------------------------------------------@Composable-private fun Hello(sway: Float) {+private fun Hello(sway: () -> Float, idle: State<Boolean>) {val c = clearColumn(Modifier.fillMaxSize(), horizontalAlignment = Alignment.CenterHorizontally) {- Image(painterResource(R.drawable.artefact_logo), null, Modifier.padding(top = 28.dp).size(72.dp).flyIn(0f, Offset(0f, -40f), 0, sway))+ Image(painterResource(R.drawable.artefact_logo), null, Modifier.padding(top = 4.dp).size(72.dp).flyIn(0f, Offset(0f, -40f), 0, sway))Spacer(Modifier.height(8.dp))- Text(stringResource(R.string.welcome_hello_eyebrow).uppercase(), style = ClearType.Eyebrow, color = c.hero.copy(alpha = 0.9f))- Text(stringResource(R.string.welcome_hello_title), style = ClearType.Hero.copy(fontSize = 58.sp, lineHeight = 60.sp, color = c.hero).glowing(c), textAlign = TextAlign.Center)- Text(- stringResource(R.string.app_name),- style = ClearType.Hero.copy(- fontSize = 58.sp, lineHeight = 60.sp,- brush = Brush.linearGradient(listOf(Color.White, Color(0xFFFFCFEA), Color(0xFFCFE0FF))),- ).glowing(c),- )+ // the big glowing titles painted once into a texture (the glow is a 22 px blur); the layer is+ // taller than its text, so the glow under the last line isn't cut+ Column(+ Modifier.fillMaxWidth().graphicsLayer { compositingStrategy = CompositingStrategy.Offscreen }.padding(bottom = 14.dp),+ horizontalAlignment = Alignment.CenterHorizontally,+ ) {+ Text(stringResource(R.string.welcome_hello_eyebrow).uppercase(), style = ClearType.Eyebrow, color = c.hero.copy(alpha = 0.9f))+ Text(stringResource(R.string.welcome_hello_title), style = ClearType.Hero.copy(fontSize = 58.sp, lineHeight = 60.sp, color = c.hero).glowing(c), textAlign = TextAlign.Center)+ Text(+ stringResource(R.string.app_name),+ style = ClearType.Hero.copy(+ fontSize = 58.sp, lineHeight = 60.sp,+ brush = Brush.linearGradient(listOf(Color.White, Color(0xFFFFCFEA), Color(0xFFCFE0FF))),+ ).glowing(c),+ )+ }// the mock's three tilted cards: a note, a picture with a mascot, today's date- Box(Modifier.fillMaxWidth().weight(1f).padding(top = 22.dp)) {+ Box(Modifier.fillMaxWidth().weight(1f).padding(top = 8.dp)) {NotePaper(Modifier.align(Alignment.TopStart).padding(start = 20.dp).width(186.dp).flyIn(-7f, Offset(-200f, 60f), 120, sway))Box(Modifier.align(Alignment.TopEnd).padding(end = 20.dp, top = 46.dp).size(148.dp, 184.dp).flyIn(6f, Offset(220f, 40f), 220, sway).clip(CardShape).background(Brush.linearGradient(listOf(Color(0xFF8EC5FC), Color(0xFFE0C3FC), Color(0xFFF9C6D3)))),) {- Mascot("flower", MascotMood.Happy, 92.dp, Modifier.align(Alignment.Center))+ PagedMascot("flower", MascotMood.Happy, 92.dp, idle, Modifier.align(Alignment.Center))Text(stringResource(R.string.welcome_card_highlights), style = ClearType.Title.copy(fontSize = 15.sp), color = Color.White, modifier = Modifier.padding(14.dp))}DateCard(Modifier.align(Alignment.TopStart).padding(start = 44.dp, top = 168.dp).width(176.dp).flyIn(-2f, Offset(0f, 200f), 320, sway))@@ -236,7 +344,7 @@ private fun NotePaper(modifier: Modifier) {val tone = clear.tone(Tone.Paper)Column(modifier.cardPaint(tone).padding(16.dp)) {Text(stringResource(R.string.seed_note_title), style = ClearType.Title.copy(fontSize = 15.sp), color = tone.accent)- Text(SimpleDateFormat("d MMM yyyy", Locale.getDefault()).format(Date()), style = ClearType.Caption.copy(fontSize = 10.sp), color = tone.ink.copy(alpha = 0.5f))+ Text(rememberDate("d MMM yyyy"), style = ClearType.Caption.copy(fontSize = 10.sp), color = tone.ink.copy(alpha = 0.5f))Spacer(Modifier.height(10.dp))Text(stringResource(R.string.welcome_note_body), style = ClearType.Caption.copy(fontSize = 12.sp, lineHeight = 16.sp), color = tone.ink.copy(alpha = 0.75f), maxLines = 4)}@@ -245,10 +353,9 @@ private fun NotePaper(modifier: Modifier) {@Composableprivate fun DateCard(modifier: Modifier) {val tone = clear.tone(Tone.Paper)- val now = Date()Column(modifier.cardPaint(tone).padding(18.dp)) {- Text(SimpleDateFormat("EEEE", Locale.getDefault()).format(now), style = ClearType.Headline.copy(fontSize = 26.sp), color = tone.ink)- Text(SimpleDateFormat("MMM d", Locale.getDefault()).format(now), style = ClearType.Headline.copy(fontSize = 26.sp, fontWeight = androidx.compose.ui.text.font.FontWeight.Normal), color = tone.ink.copy(alpha = 0.5f))+ Text(rememberDate("EEEE"), style = ClearType.Headline.copy(fontSize = 26.sp), color = tone.ink)+ Text(rememberDate("MMM d"), style = ClearType.Headline.copy(fontSize = 26.sp, fontWeight = androidx.compose.ui.text.font.FontWeight.Normal), color = tone.ink.copy(alpha = 0.5f))Spacer(Modifier.height(26.dp))Text(stringResource(R.string.welcome_card_overview), style = ClearType.Caption, color = tone.ink.copy(alpha = 0.5f))}@@ -257,10 +364,10 @@ private fun DateCard(modifier: Modifier) {// ---- page 2: one desk --------------------------------------------------------------------------------@Composable-private fun OneDesk(sway: Float) {+private fun OneDesk(sway: () -> Float) {val c = clearColumn(Modifier.fillMaxSize()) {- Title(stringResource(R.string.welcome_desk_eyebrow), stringResource(R.string.welcome_desk_title), stringResource(R.string.welcome_desk_accent), stringResource(R.string.welcome_desk_body), top = 24.dp)+ Title(stringResource(R.string.welcome_desk_eyebrow), stringResource(R.string.welcome_desk_title), stringResource(R.string.welcome_desk_accent), stringResource(R.string.welcome_desk_body), top = 4.dp)Box(Modifier.fillMaxWidth().weight(1f)) {Row(Modifier.align(Alignment.BottomCenter).fillMaxWidth().padding(horizontal = 20.dp, vertical = 8.dp),@@ -268,23 +375,30 @@ private fun OneDesk(sway: Float) {) {Column(Modifier.weight(1f), verticalArrangement = Arrangement.spacedBy(12.dp)) {val tone = c.tone(Tone.Sage)- Column(Modifier.fillMaxWidth().flyIn(-3f, Offset(-120f, 120f), 80, sway).cardPaint(tone).padding(12.dp)) {- Text(stringResource(R.string.seed_list_title), style = ClearType.DotTitle.copy(fontSize = 22.sp, lineHeight = 24.sp), color = tone.ink, textAlign = TextAlign.Center, modifier = Modifier.fillMaxWidth())- Spacer(Modifier.height(10.dp))- Column(verticalArrangement = Arrangement.spacedBy(6.dp)) {- CheckPill(checkItem(stringResource(R.string.seed_list_1), true), tone) {}- CheckPill(checkItem(stringResource(R.string.seed_list_2)), tone) {}+ // the pills are glass, so the card is painted on a sibling layer for them to refract+ GlassHost(+ Modifier.fillMaxWidth().flyIn(-3f, Offset(-120f, 120f), 80, sway, cache = true),+ paint = { Box(Modifier.fillMaxSize().cardPaint(tone)) },+ ) {+ Column(Modifier.fillMaxWidth().padding(12.dp)) {+ Text(stringResource(R.string.seed_list_title), style = ClearType.DotTitle.copy(fontSize = 22.sp, lineHeight = 24.sp), color = tone.ink, textAlign = TextAlign.Center, modifier = Modifier.fillMaxWidth())+ Spacer(Modifier.height(10.dp))+ Column(verticalArrangement = Arrangement.spacedBy(6.dp)) {+ CheckPill(checkItem(stringResource(R.string.seed_list_1), true), tone) {}+ CheckPill(checkItem(stringResource(R.string.seed_list_2)), tone) {}+ }}}- CollectionCard(stringResource(R.string.desk_word_files), c.tone(Tone.Butter), {}, Modifier.fillMaxWidth().flyIn(2f, Offset(-80f, 200f), 180, sway), height = 104.dp)+ CollectionCard(stringResource(R.string.desk_word_files), c.tone(Tone.Butter), {}, Modifier.fillMaxWidth().flyIn(2f, Offset(-80f, 200f), 180, sway, cache = true), height = 104.dp)}Column(Modifier.weight(1f).padding(top = 30.dp), verticalArrangement = Arrangement.spacedBy(12.dp)) {- val lav = c.tone(Tone.Lavender)- Box(Modifier.fillMaxWidth().height(76.dp).flyIn(4f, Offset(120f, 100f), 140, sway).cardPaint(lav).padding(14.dp)) {- Icon(LucideIcons.Play, null, tint = Color.White, modifier = Modifier.size(16.dp))- Waveform(List(22) { i -> 0.25f + 0.75f * ((i * 37 % 11) / 10f) }, 0f, Modifier.align(Alignment.Center).fillMaxWidth().height(40.dp).padding(horizontal = 14.dp))- }- CollectionCard(stringResource(R.string.desk_word_pdf), c.tone(Tone.Orchid), {}, Modifier.fillMaxWidth().flyIn(-4f, Offset(140f, 220f), 240, sway), height = 104.dp)+ // the desk's own voice card, as the mock draws it+ com.chethan616.clearpdf.ui.home.VoiceCard(+ remember { com.chethan616.clearpdf.notes.Note("welcome-voice", com.chethan616.clearpdf.notes.NoteKind.Voice) },+ playing = false, progress = { 0f }, onPlay = {}, onLong = {},+ modifier = Modifier.fillMaxWidth().flyIn(4f, Offset(120f, 100f), 140, sway, cache = true),+ )+ CollectionCard(stringResource(R.string.desk_word_pdf), c.tone(Tone.Orchid), {}, Modifier.fillMaxWidth().flyIn(-4f, Offset(140f, 220f), 240, sway, cache = true), height = 104.dp)}}}@@ -294,14 +408,15 @@ private fun OneDesk(sway: Float) {// ---- page 3: PDF tools -------------------------------------------------------------------------------@Composable-private fun PdfTools(sway: Float) {+private fun PdfTools(sway: () -> Float) {Column(Modifier.fillMaxSize()) {- Title(stringResource(R.string.welcome_tools_eyebrow), stringResource(R.string.welcome_tools_title), stringResource(R.string.welcome_tools_accent), stringResource(R.string.welcome_tools_body), top = 24.dp)+ Title(stringResource(R.string.welcome_tools_eyebrow), stringResource(R.string.welcome_tools_title), stringResource(R.string.welcome_tools_accent), stringResource(R.string.welcome_tools_body), top = 4.dp)Box(Modifier.fillMaxWidth().weight(1f)) {Box(Modifier.align(Alignment.BottomCenter).fillMaxWidth().height(340.dp)) {// a page with a signature being written on it+ // the margin round it is where the shadow falls, so the texture it moves as holds the shadow wholeColumn(- Modifier.align(Alignment.Center).width(210.dp).height(280.dp).flyIn(-4f, Offset(0f, 220f), 60, sway)+ Modifier.align(Alignment.Center).flyIn(-4f, Offset(0f, 220f), 60, sway, cache = true).padding(28.dp).width(210.dp).height(280.dp).graphicsLayer { shadowElevation = 18.dp.toPx(); shape = RoundedRectangle(16.dp); clip = true }.background(Color.White).padding(22.dp),verticalArrangement = Arrangement.spacedBy(8.dp),@@ -323,10 +438,22 @@ private fun PdfTools(sway: Float) {}}-/** A tool as a glass bubble with its candy glyph. */+/**+ * A frosted fill with a lit rim: the look of glass without its blur pass, for decorations that+ * move with the pager (a real backdrop would re-blur on every frame of a swipe).+ */+@Composable+private fun Modifier.frost(shape: androidx.compose.ui.graphics.Shape): Modifier {+ val c = clear+ return clip(shape)+ .background(if (c.dark) Color.White.copy(alpha = 0.10f) else Color.White.copy(alpha = 0.55f))+ .border(1.dp, Brush.verticalGradient(listOf(Color.White.copy(alpha = if (c.dark) 0.25f else 0.85f), Color.White.copy(alpha = 0.1f))), shape)+}++/** A tool as a frosted bubble with its candy glyph. */@Composableprivate fun ToolBubble(icon: ImageVector, accent: Color, modifier: Modifier) {- Box(modifier.size(70.dp).glass(CircleShape, clear.frost, blur = 12.dp), contentAlignment = Alignment.Center) {+ Box(modifier.size(70.dp).frost(CircleShape), contentAlignment = Alignment.Center) {Box(Modifier.size(46.dp).clip(CircleShape).background(accent), contentAlignment = Alignment.Center) {Icon(icon, null, tint = Color.White, modifier = Modifier.size(24.dp))}@@ -336,21 +463,18 @@ private fun ToolBubble(icon: ImageVector, accent: Color, modifier: Modifier) {// ---- page 4: the promise -----------------------------------------------------------------------------@Composable-private fun Promise(sway: Float) {+private fun Promise(sway: () -> Float, idle: State<Boolean>) {val c = clearColumn(Modifier.fillMaxSize()) {- Title(stringResource(R.string.welcome_promise_eyebrow), stringResource(R.string.welcome_promise_title), stringResource(R.string.welcome_promise_accent), stringResource(R.string.welcome_promise_body), top = 24.dp)+ Title(stringResource(R.string.welcome_promise_eyebrow), stringResource(R.string.welcome_promise_title), stringResource(R.string.welcome_promise_accent), stringResource(R.string.welcome_promise_body), top = 4.dp)Box(Modifier.fillMaxWidth().weight(1f)) {Column(Modifier.align(Alignment.BottomCenter).fillMaxWidth().padding(horizontal = 24.dp),horizontalAlignment = Alignment.CenterHorizontally,verticalArrangement = Arrangement.spacedBy(10.dp),) {- Row(horizontalArrangement = Arrangement.spacedBy((-14).dp), verticalAlignment = Alignment.Bottom) {- Mascot("blob", MascotMood.Happy, 78.dp, Modifier.flyIn(0f, Offset(-80f, 120f), 60, sway))- Mascot("star", MascotMood.Happy, 100.dp, Modifier.offset(y = (-10).dp).flyIn(0f, Offset(0f, 160f), 140, sway))- Mascot("cloud", MascotMood.Happy, 84.dp, Modifier.flyIn(0f, Offset(80f, 120f), 220, sway))- }+ // the star alone: the lumpy cloud bot is gone from the welcome+ PagedMascot("star", MascotMood.Happy, 108.dp, idle, Modifier.flyIn(0f, Offset(0f, 160f), 100, sway))Spacer(Modifier.height(4.dp))listOf(Triple(LucideIcons.ShieldCheck, R.string.welcome_promise_1, Candy.Mint),@@ -358,7 +482,7 @@ private fun Promise(sway: Float) {Triple(LucideIcons.Sparkles, R.string.welcome_promise_3, Candy.Bubblegum),).forEachIndexed { i, (icon, label, accent) ->Row(- Modifier.fillMaxWidth().flyIn(0f, Offset(0f, 80f), 260L + 70 * i, sway).glass(RoundedRectangle(22.dp), c.frost, blur = 12.dp).padding(horizontal = 14.dp, vertical = 12.dp),+ Modifier.fillMaxWidth().flyIn(0f, Offset(0f, 80f), 260L + 70 * i, sway).frost(RoundedRectangle(22.dp)).padding(horizontal = 14.dp, vertical = 12.dp),verticalAlignment = Alignment.CenterVertically,) {Box(Modifier.size(34.dp).clip(CircleShape).background(accent), contentAlignment = Alignment.Center) { Icon(icon, null, tint = Color.White, modifier = Modifier.size(18.dp)) }diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/theme/ClearTheme.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/theme/ClearTheme.ktindex a56fc6b..6da7b80 100644--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/theme/ClearTheme.kt+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/theme/ClearTheme.kt@@ -8,7 +8,6 @@ import androidx.compose.runtime.staticCompositionLocalOfimport androidx.compose.ui.geometry.Offsetimport androidx.compose.ui.graphics.Colorimport androidx.compose.ui.graphics.Shadow-import androidx.compose.ui.graphics.lerpimport androidx.compose.ui.text.TextStyleimport androidx.compose.ui.text.font.Fontimport androidx.compose.ui.text.font.FontFamily@@ -84,7 +83,7 @@ data class ClearColors(}private val InkLight = Color(0xFF172033)-private val InkDark = Color(0xFFF1F5F9)+private val InkDark = Color(0xFFEEF1FF)private val LightTones = mapOf(Tone.Sage to CardTone(Color(0xFF8ED0C1), Color(0xFFB2DFD6), Color(0xFF12302B), Color(0xFF1B6E60)),@@ -97,14 +96,20 @@ private val LightTones = mapOf(Tone.Peach to CardTone(Color(0xFFF8C6A3), Color(0xFFFBDCC5), Color(0xFF4A2512), Color(0xFFD9541C)),)-/** At night the cards keep their pastel, a little deeper, so the home screen keeps its colour. */-private val DarkTones = LightTones.mapValues { (t, c) ->- if (t == Tone.Paper) {- CardTone(Color(0xFFFFFFFF).copy(alpha = 0.16f), Color(0xFFFFFFFF).copy(alpha = 0.10f), InkDark, Color(0xFF8DBCF5))- } else {- CardTone(lerp(c.top, Color.Black, 0.22f), lerp(c.bottom, Color.Black, 0.26f), c.ink, c.accent)- }-}+/**+ * At night the cards become jewels: saturated, deep, lit from above, with pale ink on them. (The+ * pastels merely darkened turned muddy against the midnight wallpaper.)+ */+private val DarkTones = mapOf(+ Tone.Sage to CardTone(Color(0xFF22877A), Color(0xFF15605A), Color(0xFFEAFBF6), Color(0xFF7CE3CF)),+ Tone.Paper to CardTone(Color(0xFFCBD5FF).copy(alpha = 0.16f), Color(0xFFCBD5FF).copy(alpha = 0.09f), InkDark, Color(0xFF9DB8FF)),+ Tone.Lavender to CardTone(Color(0xFF5B4FD6), Color(0xFF3F34A6), Color.White, Color(0xFFD9D4FF)),+ Tone.Butter to CardTone(Color(0xFFB38A1F), Color(0xFF7C5C12), Color(0xFFFFF6DA), Color(0xFFFFD66B)),+ Tone.Orchid to CardTone(Color(0xFF9A3FB5), Color(0xFF66257F), Color(0xFFFBE9FF), Color(0xFFF0A6FF)),+ Tone.Blush to CardTone(Color(0xFFC7415F), Color(0xFF8F2644), Color(0xFFFFE9EE), Color(0xFFFF9DB5)),+ Tone.Sky to CardTone(Color(0xFF2D79D6), Color(0xFF1A4FA0), Color(0xFFE8F3FF), Color(0xFF9CCBFF)),+ Tone.Peach to CardTone(Color(0xFFD2723B), Color(0xFF9C4A22), Color(0xFFFFF0E4), Color(0xFFFFBE91)),+)val LightClear = ClearColors(dark = false,@@ -132,25 +137,26 @@ val LightClear = ClearColors(val DarkClear = ClearColors(dark = true,- wall = listOf(Color(0xFF0E1A20), Color(0xFF13262C), Color(0xFF0F1A22)),+ // Midnight Aurora: deep indigo with cobalt, violet and a breath of magenta pooled in it+ wall = listOf(Color(0xFF0A0B1E), Color(0xFF14123A), Color(0xFF0B1030)),blooms = listOf(- Color(0xFF2C6C64) to 0.55f,- Color(0xFF2B4072) to 0.50f,- Color(0xFF4C2F66) to 0.36f,- Color(0xFF3D6D5D) to 0.34f,- Color(0xFF9FC6FF) to 0.06f,+ Color(0xFF1E6FD9) to 0.46f,+ Color(0xFF7C3AED) to 0.52f,+ Color(0xFFD62C86) to 0.26f,+ Color(0xFF3B4FD8) to 0.42f,+ Color(0xFFA5B4FF) to 0.07f,),hero = Color.White,- heroGlow = Color.Black.copy(alpha = 0.30f),+ heroGlow = Color(0xFF05061A).copy(alpha = 0.45f),ink = InkDark,- inkSoft = InkDark.copy(alpha = 0.66f),- inkFaint = InkDark.copy(alpha = 0.42f),+ inkSoft = InkDark.copy(alpha = 0.68f),+ inkFaint = InkDark.copy(alpha = 0.44f),line = InkDark.copy(alpha = 0.10f),- glass = Color(0xFF1E2C33).copy(alpha = 0.42f),- rim = Color.White.copy(alpha = 0.22f),- frost = Color(0xFF16232A).copy(alpha = 0.86f),- desk = Color(0xFF0D1418),- capsule = Color(0xFF060B10).copy(alpha = 0.40f),+ glass = Color(0xFFC9D2FF).copy(alpha = 0.11f),+ rim = Color.White.copy(alpha = 0.26f),+ frost = Color(0xFF1A1B3C).copy(alpha = 0.90f),+ desk = Color(0xFF090A18),+ capsule = Color(0xFF0B0C22).copy(alpha = 0.46f),tones = DarkTones,)@@ -190,6 +196,27 @@ val Serif: FontFamily = FontFamily(Font(R.font.dm_serif_italic, FontWeight.Normal, FontStyle.Italic),)+/** Fraunces (OFL): a soft serif. [soft] rounds its terminals (0..100); [wonk] 1 leans some letters (quirky), 0 keeps them upright. */+private fun fraunces(weight: Int, soft: Float, size: TextUnit, wonk: Float = 0f) = FontFamily(+ Font(+ R.font.fraunces, FontWeight(weight),+ variationSettings = FontVariation.Settings(+ FontVariation.weight(weight), FontVariation.opticalSizing(size),+ FontVariation.Setting("SOFT", soft), FontVariation.Setting("WONK", wonk),+ ),+ ),+)++/** Bricolage Grotesque (OFL): a grotesque with a width axis, from a tall condensed 75 to the normal 100. */+private fun bricolage(weight: Int, width: Float, size: TextUnit) = FontFamily(+ Font(+ R.font.bricolage, FontWeight(weight),+ variationSettings = FontVariation.Settings(+ FontVariation.weight(weight), FontVariation.width(width), FontVariation.opticalSizing(size),+ ),+ ),+)+private val Trim = LineHeightStyle(LineHeightStyle.Alignment.Center, LineHeightStyle.Trim.Both)private fun display(family: FontFamily, size: TextUnit, line: TextUnit, tracking: TextUnit) =@@ -214,6 +241,25 @@ object ClearType {/** A list card's title. */val DotTitle = display(Doto, 30.sp, 32.sp, 0.sp)+ // The desk's big title, one face per shelf, each in the voice of what it holds: a clean bold+ // grotesque for everything, an upright soft serif for notes, dots for lists, an editorial serif+ // for PDFs, a thin italic for pictures, a light wide grotesque for voices.+ // All six share one size and one line height, so switching chips never moves anything below the+ // title; the desk shrinks that one size (for every title alike) only if a translation is too wide.+ val DeskTitleSize = 44.sp+ val DeskTitleLine = 50.sp+ val DeskAll = display(bricolage(700, 100f, 96.sp), DeskTitleSize, DeskTitleLine, (-1.4).sp)+ val DeskNotes = display(fraunces(600, 50f, 72.sp), DeskTitleSize, DeskTitleLine, (-0.8).sp)+ val DeskTodo = display(Doto, DeskTitleSize, DeskTitleLine, 0.sp)+ val DeskPdfs = display(Serif, DeskTitleSize, DeskTitleLine, (-0.8).sp)+ val DeskImages = display(jakarta(300, italic = true), DeskTitleSize, DeskTitleLine, (-1.4).sp).copy(fontStyle = FontStyle.Italic)+ val DeskAudio = display(bricolage(300, 100f, 72.sp), DeskTitleSize, DeskTitleLine, (-1.0).sp)++ /** The Tools screen's title: Fraunces at its softest and quirkiest, a face no other screen uses. */+ val ToolsTitle = display(fraunces(700, 100f, 72.sp, wonk = 1f), DeskTitleSize, DeskTitleLine, (-0.8).sp)+ /** A tool tile's name, set like the desk's "Files" and "Pdf" words. */+ val ToolWord = display(Serif, 31.sp, 33.sp, (-0.6).sp)+val Eyebrow = TextStyle(fontFamily = Jakarta, fontWeight = FontWeight.SemiBold, fontSize = 11.5.sp, lineHeight = 14.sp, letterSpacing = 1.4.sp)val Body = TextStyle(fontFamily = Jakarta, fontWeight = FontWeight.Normal, fontSize = 15.sp, lineHeight = 22.sp)val BodyStrong = Body.copy(fontWeight = FontWeight.SemiBold)diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/CommentList.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/CommentList.ktindex 4f55cf8..54ae673 100644--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/CommentList.kt+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/CommentList.kt@@ -139,23 +139,20 @@ fun CommentListScreen(vm: AppViewModel, doc: OpenDocument) {val parents = all.filter { it.replyTo == null && it.state == null && it.subtype in LISTED }// each thread: its comment, then the replies to it in orderval threads = parents.map { p -> listOf(p) + all.filter { it.replyTo != null && it.replyTo == p.name && it.state == null } }- Column(- Modifier.fillMaxSize().background(Color.Black).safeTopPadding()- .background(c.navBand).navigationBarsPadding().background(c.surface),+ com.chethan616.clearpdf.ui.glass.AuroraScreen { Column(+ Modifier.fillMaxSize().safeTopPadding().navigationBarsPadding(),) {Row(- Modifier.fillMaxWidth().height(TopBarHeight).drawBehind {- val line = 1.dp.toPx()- drawRect(c.divider, Offset(0f, size.height - line), Size(size.width, line))- }.padding(bottom = 1.dp),+ Modifier.fillMaxWidth().height(TopBarHeight).padding(horizontal = 12.dp),verticalAlignment = Alignment.CenterVertically,) {- Box(Modifier.width(56.dp), contentAlignment = Alignment.Center) {- BarIcon(LucideIcons.ArrowLeft, stringResource(R.string.common_back), ::close, iconSize = 27.dp)+ com.chethan616.clearpdf.ui.glass.GlassCircle(com.chethan616.clearpdf.ui.glass.rememberBeat(::close), size = 48.dp, label = stringResource(R.string.common_back)) {+ com.chethan616.clearpdf.ui.glass.GlassIcon(LucideIcons.ChevronLeft, null, Modifier.size(23.dp))}+ Spacer(Modifier.width(14.dp))Text(if (list == null) stringResource(R.string.comments_title) else threadsTitle(threads.size, stringResource(R.string.comments_none)) { plural(R.plurals.comments_threads, it, it) },- color = c.label, fontSize = 17.sp, fontWeight = FontWeight.SemiBold,+ style = com.chethan616.clearpdf.ui.theme.ClearType.Title, color = com.chethan616.clearpdf.ui.theme.clear.ink,)}if (list != null && threads.isEmpty()) {@@ -218,7 +215,7 @@ fun CommentListScreen(vm: AppViewModel, doc: OpenDocument) {}}}- }+ } }menuFor?.let { cm ->PdfSheet(onDismiss = { menuFor = null }, dim = true) {val text = cm.contents?.takeIf { it.isNotBlank() }diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/CommentPanel.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/CommentPanel.ktindex 5fd0d49..498dfc0 100644--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/CommentPanel.kt+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/CommentPanel.kt@@ -156,10 +156,10 @@ fun CommentPanel(vm: AppViewModel, doc: OpenDocument, c: CommentInfo) {value = text, onValueChange = { text = it }, modifier = Modifier.fillMaxWidth().heightIn(min = 80.dp),colors = OutlinedTextFieldDefaults.colors(focusedBorderColor = colors.toolAccent, cursorColor = colors.toolAccent),)- Row {+ Row(Modifier.padding(top = 8.dp), horizontalArrangement = androidx.compose.foundation.layout.Arrangement.spacedBy(8.dp)) {Spacer(Modifier.weight(1f))- TextButton(onClick = { editing = null }) { Text(stringResource(R.string.common_cancel), color = colors.toolAccent) }- TextButton(onClick = { editing = null; vm.editCommentText(doc, cm, text) }) { Text(stringResource(R.string.common_save), color = colors.toolAccent, fontWeight = FontWeight.SemiBold) }+ com.chethan616.clearpdf.ui.glass.GlassTextAction(stringResource(R.string.common_cancel), { editing = null })+ com.chethan616.clearpdf.ui.glass.GlassTextAction(stringResource(R.string.common_save), { editing = null; vm.editCommentText(doc, cm, text) }, primary = true)}}} else {diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/DigitalSign.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/DigitalSign.ktindex 67b7cf8..e3506f2 100644--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/DigitalSign.kt+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/DigitalSign.kt@@ -265,7 +265,7 @@ fun CertPlaceLayer(vm: AppViewModel, doc: OpenDocument) {verticalAlignment = Alignment.CenterVertically,) {Text(stringResource(R.string.sign_place_hint), color = c.text, fontSize = 14.sp, modifier = Modifier.weight(1f, fill = false))- TextButton(onClick = { vm.certPlacing = null }) { Text(stringResource(R.string.common_cancel), color = c.accent) }+ com.chethan616.clearpdf.ui.glass.GlassTextAction(stringResource(R.string.common_cancel), { vm.certPlacing = null })}}}@@ -302,13 +302,12 @@ fun CertSignScreen(vm: AppViewModel, target: CertTarget) {fun sign() {if (chosen != null && canSign) vm.signWithId(target, chosen, password, if (look == CertLook.Drawn && !hasDrawn) CertLook.Name else look, reason, location)}- Column(Modifier.fillMaxSize().background(c.surface).pointerInput(Unit) { detectTapGestures() }.safeTopPadding().navigationBarsPadding().imePadding()) {+ com.chethan616.clearpdf.ui.glass.AuroraScreen { Column(Modifier.fillMaxSize().pointerInput(Unit) { detectTapGestures() }.safeTopPadding().navigationBarsPadding().imePadding()) {Row(Modifier.fillMaxWidth().height(56.dp).padding(horizontal = 8.dp), verticalAlignment = Alignment.CenterVertically) {- TextButton(onClick = { vm.certSign = null }) { Text(stringResource(R.string.common_cancel), color = c.accent) }+ com.chethan616.clearpdf.ui.glass.GlassTextAction(stringResource(R.string.common_cancel), { vm.certSign = null })Text(stringResource(R.string.common_tool_sign_digital_id), color = c.text, fontWeight = FontWeight.SemiBold, fontSize = 17.sp, modifier = Modifier.weight(1f), textAlign = TextAlign.Center, maxLines = 1, overflow = TextOverflow.Ellipsis)- TextButton(onClick = ::sign, enabled = canSign) { Text(stringResource(R.string.common_sign), color = if (canSign) c.accent else c.textSecondary, fontWeight = FontWeight.SemiBold) }+ com.chethan616.clearpdf.ui.glass.GlassTextAction(stringResource(R.string.common_sign), ::sign, enabled = canSign, primary = true)}- SheetDivider(inset = 0.dp)Column(Modifier.weight(1f).verticalScroll(rememberScrollState()).padding(vertical = 8.dp)) {Section(stringResource(R.string.sign_section_id))if (ids.isEmpty()) {@@ -362,7 +361,7 @@ fun CertSignScreen(vm: AppViewModel, target: CertTarget) {color = c.textSecondary, fontSize = 13.sp, modifier = Modifier.padding(horizontal = 20.dp, vertical = 12.dp),)}- }+ } }}/**@@ -423,7 +422,9 @@ private fun IdRow(vm: AppViewModel, id: DigitalId, selected: Boolean, onClick: (val until = idProblem(id) ?: stringResource(R.string.sign_id_valid_until, shortDate(id.validTo * 1000))Text("$by · $until", color = if (idProblem(id) != null) c.red else c.textSecondary, fontSize = 13.sp, maxLines = 2, overflow = TextOverflow.Ellipsis)}- BarIcon(LucideIcons.Trash2, stringResource(R.string.sign_remove_id_description, id.name), { confirm = true }, size = 40.dp)+ com.chethan616.clearpdf.ui.glass.GlassCircle({ confirm = true }, size = 40.dp, label = stringResource(R.string.sign_remove_id_description, id.name)) {+ com.chethan616.clearpdf.ui.glass.GlassIcon(LucideIcons.Trash2, null, Modifier.size(18.dp), tint = com.chethan616.clearpdf.ui.theme.Candy.Tomato)+ }}if (confirm) {PdfDialog(@@ -469,15 +470,12 @@ fun CreateIdScreen(vm: AppViewModel) {else -> null}val ok = name.isNotBlank() && password.length >= 8 && again == password- Column(Modifier.fillMaxSize().background(c.surface).pointerInput(Unit) { detectTapGestures() }.safeTopPadding().navigationBarsPadding().imePadding()) {+ com.chethan616.clearpdf.ui.glass.AuroraScreen { Column(Modifier.fillMaxSize().pointerInput(Unit) { detectTapGestures() }.safeTopPadding().navigationBarsPadding().imePadding()) {Row(Modifier.fillMaxWidth().height(56.dp).padding(horizontal = 8.dp), verticalAlignment = Alignment.CenterVertically) {- TextButton(onClick = { vm.idCreate = false }) { Text(stringResource(R.string.common_cancel), color = c.accent) }+ com.chethan616.clearpdf.ui.glass.GlassTextAction(stringResource(R.string.common_cancel), { vm.idCreate = false })Text(stringResource(R.string.sign_create_id), color = c.text, fontWeight = FontWeight.SemiBold, fontSize = 17.sp, modifier = Modifier.weight(1f), textAlign = TextAlign.Center)- TextButton(onClick = { vm.createDigitalId(name, email, organization, password) }, enabled = ok) {- Text(stringResource(R.string.common_create), color = if (ok) c.accent else c.textSecondary, fontWeight = FontWeight.SemiBold)- }+ com.chethan616.clearpdf.ui.glass.GlassTextAction(stringResource(R.string.common_create), { vm.createDigitalId(name, email, organization, password) }, enabled = ok, primary = true)}- SheetDivider(inset = 0.dp)Column(Modifier.weight(1f).verticalScroll(rememberScrollState()).padding(vertical = 8.dp)) {Text(stringResource(R.string.sign_create_about),@@ -503,7 +501,7 @@ fun CreateIdScreen(vm: AppViewModel) {color = c.textSecondary, fontSize = 13.sp, modifier = Modifier.padding(horizontal = 20.dp, vertical = 12.dp),)}- }+ } }}/** Tapping an empty signature field: draw a signature there, or sign it with a digital ID. */@@ -611,23 +609,23 @@ private fun SignatureDetails(vm: AppViewModel, doc: OpenDocument, s: SignatureEn} else {Text(stringResource(R.string.sign_field_unsigned), color = c.textSecondary, fontSize = 13.sp, modifier = Modifier.padding(top = 6.dp))}- Row(Modifier.padding(top = 4.dp), horizontalArrangement = Arrangement.spacedBy(4.dp)) {+ Row(Modifier.padding(top = 10.dp), horizontalArrangement = Arrangement.spacedBy(8.dp)) {if (s.page != null && s.rect != null) {- TextButton(onClick = { doc.controller.sheet = ViewerSheet.None; vm.showSignature(doc, s) }) { Text(stringResource(R.string.sign_go_to), color = c.accent) }+ com.chethan616.clearpdf.ui.glass.GlassTextAction(stringResource(R.string.sign_go_to), { doc.controller.sheet = ViewerSheet.None; vm.showSignature(doc, s) })}val sha = s.cert?.sha256if (s.signed && sha != null) {if (vm.trustedCerts.contains(sha)) {- TextButton(onClick = { vm.untrustSigner(doc, s) }) { Text(stringResource(R.string.sign_stop_trusting), color = c.accent) }+ com.chethan616.clearpdf.ui.glass.GlassTextAction(stringResource(R.string.sign_stop_trusting), { vm.untrustSigner(doc, s) })} else if (s.status == "unknown") {- TextButton(onClick = { vm.trustSigner(doc, s) }) { Text(stringResource(R.string.sign_trust), color = c.accent) }+ com.chethan616.clearpdf.ui.glass.GlassTextAction(stringResource(R.string.sign_trust), { vm.trustSigner(doc, s) }, primary = true)}}if (!s.signed) {- TextButton(onClick = {+ com.chethan616.clearpdf.ui.glass.GlassTextAction(stringResource(R.string.common_sign), {doc.controller.sheet = ViewerSheet.Nonedoc.widgets.firstOrNull { it.field == s.field }?.let { vm.signFieldWithId(doc, it) }- }) { Text(stringResource(R.string.common_sign), color = c.accent) }+ }, primary = true)}}}diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/Edit.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/Edit.ktindex 484c3fc..7a21364 100644--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/Edit.kt+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/Edit.kt@@ -267,11 +267,18 @@ private fun SizePanel(para: Paragraph, onSize: (Float) -> Unit) {Text(stringResource(R.string.edit_text_size_pt, size.roundToInt()), color = c.label, fontSize = 15.sp, textAlign = TextAlign.Center, modifier = Modifier.fillMaxWidth())Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.padding(horizontal = 8.dp)) {Text("A", color = c.textSecondary, fontSize = 13.sp, modifier = Modifier.padding(horizontal = 10.dp))- Slider(- value = size, onValueChange = { size = ((it / 2f).roundToInt() * 2f).coerceIn(6f, 66f) }, onValueChangeFinished = { onSize(size) },- valueRange = 6f..66f, steps = 29,- colors = SliderDefaults.colors(thumbColor = Color.White, activeTrackColor = c.textSecondary, inactiveTrackColor = c.textSecondary, activeTickColor = c.textSecondary, inactiveTickColor = c.textSecondary),- modifier = Modifier.weight(1f),+ // the glass slider; the size is set on the text once the thumb rests a moment+ var applied by remember { mutableStateOf(size) }+ LaunchedEffect(size) {+ if (size != applied) {+ kotlinx.coroutines.delay(300)+ applied = size+ onSize(size)+ }+ }+ com.chethan616.clearpdf.ui.glass.GlassSlider(+ size, { size = ((it / 2f).roundToInt() * 2f).coerceIn(6f, 66f) },+ modifier = Modifier.weight(1f), range = 6f..66f,)Text("A", color = c.textSecondary, fontSize = 22.sp, modifier = Modifier.padding(horizontal = 10.dp))}diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/FillSign.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/FillSign.ktindex a1754c8..5745b6d 100644--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/FillSign.kt+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/FillSign.kt@@ -234,12 +234,13 @@ fun SignaturePadScreen(vm: AppViewModel, pad: SignaturePad, onPickImage: () -> Uval ink = Color(vm.toolPrefs.fillColor)val imported = vm.importedSignatureval drawFirst = stringResource(if (pad.initials) R.string.fill_draw_initials_first else R.string.fill_draw_signature_first)- Column(Modifier.fillMaxSize().background(c.surface).safeTopPadding().navigationBarsPadding()) {+ com.chethan616.clearpdf.ui.glass.AuroraScreen { Column(Modifier.fillMaxSize().safeTopPadding().navigationBarsPadding()) {Row(Modifier.fillMaxWidth().height(56.dp).padding(horizontal = 8.dp), verticalAlignment = Alignment.CenterVertically) {- TextButton(onClick = { vm.signaturePad = null; vm.importedSignature = null }) { Text(stringResource(R.string.common_cancel), color = c.accent) }+ com.chethan616.clearpdf.ui.glass.GlassTextAction(stringResource(R.string.common_cancel), { vm.signaturePad = null; vm.importedSignature = null })Text(stringResource(if (pad.initials) R.string.fill_create_initials else R.string.fill_create_signature), color = c.text, fontWeight = FontWeight.SemiBold, fontSize = 17.sp, modifier = Modifier.weight(1f), textAlign = androidx.compose.ui.text.style.TextAlign.Center)- TextButton(- onClick = {+ com.chethan616.clearpdf.ui.glass.GlassTextAction(+ stringResource(R.string.common_done),+ {val bmp = imported ?: renderStrokes(strokes, size, ink)if (bmp == null) {vm.tell(drawFirst)@@ -247,7 +248,8 @@ fun SignaturePadScreen(vm: AppViewModel, pad: SignaturePad, onPickImage: () -> Uvm.finishSignature(pad, bmp, save)}},- ) { Text(stringResource(R.string.common_done), color = c.accent, fontWeight = FontWeight.SemiBold) }+ primary = true,+ )}Row(Modifier.fillMaxWidth().padding(horizontal = 16.dp), horizontalArrangement = Arrangement.spacedBy(8.dp)) {TabChip(stringResource(R.string.fill_tab_draw), imported == null) { vm.importedSignature = null }@@ -287,10 +289,10 @@ fun SignaturePadScreen(vm: AppViewModel, pad: SignaturePad, onPickImage: () -> U}Row(Modifier.fillMaxWidth().padding(horizontal = 20.dp, vertical = 8.dp), verticalAlignment = Alignment.CenterVertically) {Text(stringResource(R.string.fill_save_to_device), color = c.text, fontSize = 15.sp, modifier = Modifier.weight(1f))- Switch(checked = save, onCheckedChange = { save = it }, colors = SwitchDefaults.colors(checkedTrackColor = c.accent))+ com.chethan616.clearpdf.ui.glass.GlassToggle(save, { save = it })}Spacer(Modifier.height(8.dp))- }+ } }SheetDivider(inset = 0.dp)}diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/Forms.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/Forms.ktindex 85b1c27..66e0acd 100644--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/Forms.kt+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/Forms.kt@@ -85,10 +85,7 @@ fun BoxScope.FieldEditor(vm: AppViewModel, edit: FieldEdit) {}.height(48.dp).padding(start = 12.dp),verticalAlignment = Alignment.CenterVertically,) {- androidx.compose.material3.RadioButton(- selected = w.value == value, onClick = { vm.fieldEdit = null; vm.fillField(doc, w.field, value) },- colors = androidx.compose.material3.RadioButtonDefaults.colors(selectedColor = Color(0xFF1473E6), unselectedColor = c.icon),- )+ com.chethan616.clearpdf.ui.glass.GlassRadio(w.value == value, { vm.fieldEdit = null; vm.fillField(doc, w.field, value) })Spacer(Modifier.width(12.dp))Text(label.ifBlank { value }, color = c.text, fontSize = 17.sp)}diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/PagesScreen.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/PagesScreen.ktindex 0277aec..9cf78e8 100644--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/PagesScreen.kt+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/PagesScreen.kt@@ -47,6 +47,9 @@ import androidx.compose.ui.graphics.Colorimport androidx.compose.ui.graphics.ImageBitmapimport androidx.compose.ui.graphics.asImageBitmapimport androidx.compose.ui.graphics.graphicsLayer+import androidx.compose.foundation.layout.fillMaxHeight+import com.chethan616.clearpdf.ui.glass.glassBar+import com.chethan616.clearpdf.ui.glass.pressableimport androidx.compose.ui.graphics.vector.ImageVectorimport androidx.compose.ui.input.pointer.pointerInputimport androidx.compose.ui.layout.ContentScale@@ -112,29 +115,27 @@ fun PagesScreen(vm: AppViewModel, doc: OpenDocument, onClose: () -> Unit) {LaunchedEffect(organizing) { if (organizing && selected.isEmpty()) selected[doc.viewer.currentPage] = true }val picked = selected.filterValues { it }.keys.sorted()val canDrag = doc.info.allowsAssembly && doc.pageCount > 1- // black where the camera is (the status bar stays hidden) and the viewer's band behind the- // navigation buttons, as the reference's Pages has- Column(- Modifier.fillMaxSize().background(Color.Black).safeTopPadding()- .background(c.navBand).navigationBarsPadding().background(c.surface),- ) {+ // Artefact's own pages: the app's wallpaper, a glass Back, frosted page cards and a glass bar+ com.chethan616.clearpdf.ui.glass.AuroraScreen {+ Column(Modifier.fillMaxSize().safeTopPadding().navigationBarsPadding()) {Row(- Modifier.fillMaxWidth().height(TopBarHeight).drawBehind {- val line = 1.dp.toPx()- drawRect(c.divider, androidx.compose.ui.geometry.Offset(0f, size.height - line), androidx.compose.ui.geometry.Size(size.width, line))- }.padding(bottom = 1.dp),+ Modifier.fillMaxWidth().height(TopBarHeight).padding(horizontal = 12.dp),verticalAlignment = Alignment.CenterVertically,) {- Box(Modifier.width(56.dp), contentAlignment = Alignment.Center) {- if (organizing) {- BarIcon(LucideIcons.Check, stringResource(if (picked.isEmpty()) R.string.common_done else R.string.common_back), ::back, tint = c.toolAccent)- } else {- BarIcon(LucideIcons.ArrowLeft, stringResource(R.string.common_back), ::back, iconSize = 27.dp)+ val goBack = com.chethan616.clearpdf.ui.glass.rememberBeat(::back)+ if (organizing) {+ com.chethan616.clearpdf.ui.glass.GlassCircle(goBack, size = 48.dp, tint = com.chethan616.clearpdf.ui.theme.Candy.Sky, label = stringResource(if (picked.isEmpty()) R.string.common_done else R.string.common_back)) {+ com.chethan616.clearpdf.ui.glass.GlassIcon(LucideIcons.Check, null, Modifier.size(22.dp))+ }+ } else {+ com.chethan616.clearpdf.ui.glass.GlassCircle(goBack, size = 48.dp, label = stringResource(R.string.common_back)) {+ com.chethan616.clearpdf.ui.glass.GlassIcon(LucideIcons.ChevronLeft, null, Modifier.size(23.dp))}}+ Spacer(Modifier.width(14.dp))Text(if (organizing && picked.isNotEmpty()) pluralStringResource(R.plurals.pages_selected_count, picked.size, picked.size) else if (organizing) stringResource(R.string.pages_select) else stringResource(R.string.pages_title),- color = c.label, fontSize = 17.sp, fontWeight = FontWeight.SemiBold, modifier = Modifier.weight(1f),+ style = com.chethan616.clearpdf.ui.theme.ClearType.Title, color = com.chethan616.clearpdf.ui.theme.clear.ink, maxLines = 1, modifier = Modifier.weight(1f),)if (organizing && exporting == null) {UndoMenuButton(doc.info.undo != null, doc.info.redo != null, { vm.undo(doc) }, { vm.redo(doc) }, doc.info.undo, doc.info.redo)@@ -222,8 +223,8 @@ fun PagesScreen(vm: AppViewModel, doc: OpenDocument, onClose: () -> Unit) {horizontalAlignment = Alignment.CenterHorizontally,) {Box(- Modifier.size(cardW, 162.dp).clip(RoundedCornerShape(5.dp)).background(c.pageCard)- .border(if (highlighted) 2.dp else 1.dp, if (highlighted) c.toolAccent else c.pageCard, RoundedCornerShape(5.dp)),+ Modifier.size(cardW, 162.dp).then(com.chethan616.clearpdf.ui.glass.washPanel())+ .then(if (highlighted) Modifier.border(2.dp, com.chethan616.clearpdf.ui.theme.Candy.Sky, com.kyant.shapes.RoundedRectangle(20.dp)) else Modifier),contentAlignment = Alignment.Center,) {val ratio = (p.width / p.height.coerceAtLeast(1f)).coerceIn(0.2f, 5f)@@ -232,29 +233,20 @@ fun PagesScreen(vm: AppViewModel, doc: OpenDocument, onClose: () -> Unit) {Box(Modifier.size(w, w / ratio).background(Color.White)) {thumbs[i]?.let { Image(it, null, modifier = Modifier.fillMaxSize(), contentScale = ContentScale.Fit) }}- if (organizing) {- Box(- Modifier.align(Alignment.TopStart).padding(8.dp).size(18.dp).clip(RoundedCornerShape(2.dp))- .background(if (isSel) c.toolAccent else Color.Transparent)- .border(2.dp, if (isSel) c.toolAccent else c.textSecondary, RoundedCornerShape(2.dp)),- contentAlignment = Alignment.Center,- ) {- if (isSel) Icon(LucideIcons.Check, null, tint = Color.White, modifier = Modifier.size(12.dp))- }- }+ if (organizing) com.chethan616.clearpdf.ui.glass.GlassTick(isSel, Modifier.align(Alignment.TopStart).padding(8.dp))}Spacer(Modifier.height(8.dp))- Text("${i + 1}", color = c.icon, fontSize = 14.sp, fontWeight = FontWeight.SemiBold, lineHeight = 17.sp)+ Text("${i + 1}", style = com.chethan616.clearpdf.ui.theme.ClearType.Label, color = com.chethan616.clearpdf.ui.theme.clear.inkSoft)Spacer(Modifier.height(12.dp))}}}}val enabled = picked.isNotEmpty()+ // the actions on one floating glass capsule, as the viewer's toolbarRow(- // at least the bar's height, taller when a large font setting enlarges the labels (sp, as the reference's)- Modifier.fillMaxWidth().heightIn(min = BottomBarHeight).barTopLine().background(c.surface),- horizontalArrangement = Arrangement.spacedBy(if (organizing) 0.dp else 20.dp, Alignment.CenterHorizontally),+ Modifier.padding(horizontal = 16.dp, vertical = 10.dp).fillMaxWidth().height(60.dp)+ .glassBar().padding(horizontal = 6.dp),verticalAlignment = Alignment.CenterVertically,) {if (exporting != null) {@@ -282,6 +274,7 @@ fun PagesScreen(vm: AppViewModel, doc: OpenDocument, onClose: () -> Unit) {}}}+ }if (insertMenu) {// where the new pages go, as the reference asks: around the selection, or at either endvar after by remember { mutableStateOf(true) }@@ -305,10 +298,8 @@ fun PagesScreen(vm: AppViewModel, doc: OpenDocument, onClose: () -> Unit) {Modifier.fillMaxWidth().clickable(role = Role.RadioButton) { after = option }.padding(horizontal = 12.dp, vertical = 2.dp),verticalAlignment = Alignment.CenterVertically,) {- androidx.compose.material3.RadioButton(- selected = after == option, onClick = { after = option },- colors = androidx.compose.material3.RadioButtonDefaults.colors(selectedColor = c.toolAccent, unselectedColor = c.icon),- )+ com.chethan616.clearpdf.ui.glass.GlassRadio(after == option, { after = option })+ Spacer(Modifier.width(8.dp))Text(label, color = c.text, fontSize = 16.sp)}}@@ -321,18 +312,13 @@ fun PagesScreen(vm: AppViewModel, doc: OpenDocument, onClose: () -> Unit) {}}+/** An action of the pages' glass bar: its glyph in the glass's ink (it names itself to TalkBack), faint while it can't be used. */@Composable-private fun OrganizeItem(icon: ImageVector, label: String, enabled: Boolean, onClick: () -> Unit) {- val c = pdfColors- val tint = if (enabled) c.icon else c.icon.copy(alpha = 0.35f)- // the reference's items: a 40 dp icon box over an 11 sp label, 56 dp wide (wider for long labels)- Column(- Modifier.widthIn(min = 56.dp).heightIn(min = BottomBarHeight).clickable(enabled = enabled, role = Role.Button, onClick = onClick)- .semantics { contentDescription = label }.padding(horizontal = 4.dp),- horizontalAlignment = Alignment.CenterHorizontally,- verticalArrangement = Arrangement.Center,+private fun androidx.compose.foundation.layout.RowScope.OrganizeItem(icon: ImageVector, label: String, enabled: Boolean, onClick: () -> Unit) {+ Box(+ Modifier.weight(1f).fillMaxHeight().pressable(onClick, enabled = enabled, pressedScale = 0.86f).semantics { contentDescription = label },+ contentAlignment = Alignment.Center,) {- Box(Modifier.size(40.dp), contentAlignment = Alignment.Center) { Icon(icon, null, tint = tint, modifier = Modifier.size(24.dp)) }- Text(label, color = if (enabled) c.label else c.label.copy(alpha = 0.35f), fontSize = 10.5.sp, maxLines = 1)+ com.chethan616.clearpdf.ui.glass.GlassIcon(icon, null, Modifier.size(24.dp).graphicsLayer { alpha = if (enabled) 1f else 0.35f })}}diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/QuickTools.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/QuickTools.ktindex 9030ef3..45736b9 100644--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/QuickTools.kt+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/QuickTools.kt@@ -241,11 +241,16 @@ fun CustomizeToolbar(vm: AppViewModel, onDone: () -> Unit) {Column {Row(Modifier.fillMaxWidth().padding(start = 20.dp, end = 8.dp), verticalAlignment = Alignment.CenterVertically) {Text(stringResource(R.string.toolbar_customize), color = c.text, fontSize = 17.sp, fontWeight = FontWeight.SemiBold, modifier = Modifier.weight(1f))- BarIcon(LucideIcons.X, stringResource(R.string.common_cancel), onDone)- BarIcon(LucideIcons.Check, stringResource(R.string.toolbar_save), {+ com.chethan616.clearpdf.ui.glass.GlassCircle(onDone, size = 42.dp, label = stringResource(R.string.common_cancel)) {+ com.chethan616.clearpdf.ui.glass.GlassIcon(LucideIcons.X, null, Modifier.size(19.dp))+ }+ Spacer(Modifier.width(8.dp))+ com.chethan616.clearpdf.ui.glass.GlassCircle({prefs.save(bar.toList(), grid.toList())onDone()- }, tint = c.accent)+ }, size = 42.dp, tint = com.chethan616.clearpdf.ui.theme.Candy.Sky, label = stringResource(R.string.toolbar_save)) {+ com.chethan616.clearpdf.ui.glass.GlassIcon(LucideIcons.Check, null, Modifier.size(19.dp))+ }}Text(pluralStringResource(R.plurals.toolbar_customize_hint, slots, slots),diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/Tools.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/Tools.ktindex 7fc4897..b8a3e78 100644--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/Tools.kt+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/Tools.kt@@ -459,13 +459,10 @@ fun PropertyPicker(vm: AppViewModel, tool: StyledTool, picker: Picker, markup: TText(stringResource(R.string.toolbar_text_size), color = c.text, fontSize = 17.sp, fontWeight = androidx.compose.ui.text.font.FontWeight.SemiBold, modifier = Modifier.padding(start = 20.dp, bottom = 4.dp))Row(Modifier.fillMaxWidth().padding(horizontal = 20.dp, vertical = 8.dp), verticalAlignment = Alignment.CenterVertically) {Text(stringResource(R.string.toolbar_text_size_pt, prefs.textSize.toInt()), color = c.text, fontSize = 15.sp, modifier = Modifier.width(56.dp))- Slider(- value = prefs.textSize,- onValueChange = { v -> prefs.updateTextSize((Math.round(v / 2f) * 2f).coerceIn(6f, 22f)) },- valueRange = 6f..22f,- steps = TextSizes.size - 2,- colors = SliderDefaults.colors(thumbColor = c.accent, activeTrackColor = c.accent),- modifier = Modifier.weight(1f),+ com.chethan616.clearpdf.ui.glass.GlassSlider(+ prefs.textSize,+ { v -> prefs.updateTextSize((Math.round(v / 2f) * 2f).coerceIn(6f, 22f)) },+ modifier = Modifier.weight(1f), range = 6f..22f,)}Spacer(Modifier.height(8.dp))diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ViewerBars.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ViewerBars.ktindex d0da7b4..3485d2e 100644--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ViewerBars.kt+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ViewerBars.kt@@ -48,6 +48,7 @@ import androidx.compose.ui.graphics.drawscope.Strokeimport androidx.compose.ui.graphics.graphicsLayerimport androidx.compose.ui.graphics.vector.ImageVectorimport androidx.compose.ui.layout.boundsInWindow+import androidx.compose.ui.layout.layoutimport androidx.compose.ui.layout.onGloballyPositionedimport androidx.compose.ui.layout.onPlacedimport androidx.compose.ui.layout.positionInParent@@ -64,12 +65,14 @@ import androidx.compose.ui.unit.spimport com.chethan616.clearpdf.Rimport com.chethan616.clearpdf.ui.LucideIconsimport com.chethan616.clearpdf.ui.glass.GlassCircle+import com.chethan616.clearpdf.ui.glass.BarGlyphButtonimport com.chethan616.clearpdf.ui.glass.GlassIconimport com.chethan616.clearpdf.ui.glass.GlassMenuimport com.chethan616.clearpdf.ui.glass.GlassMenuItemimport com.chethan616.clearpdf.ui.glass.GlassMotionimport com.chethan616.clearpdf.ui.glass.GlassPillimport com.chethan616.clearpdf.ui.glass.glass+import com.chethan616.clearpdf.ui.glass.glassBarimport com.chethan616.clearpdf.ui.glass.pressableimport com.chethan616.clearpdf.ui.iconAccentimport com.chethan616.clearpdf.ui.theme.Candy@@ -77,6 +80,7 @@ import com.chethan616.clearpdf.ui.theme.ClearTypeimport com.chethan616.clearpdf.ui.theme.clearimport com.kyant.shapes.Capsuleimport kotlinx.coroutines.flow.first+import com.kyant.backdrop.floatingLayer/** The room the floating top row takes: a 48 dp capsule and its margins. */val TopBarHeight = 64.dp@@ -91,9 +95,11 @@ val QuickHandleHeight = 0.dpval QuickBarHeight = BottomBarHeight/**- * The viewer's floating top row: a round back button, a wide glass capsule with the document's- * name, the page it's on and Find, then Share and More. With a tool out: a candy Done, the tool's- * name, and Undo / Redo.+ * The viewer's floating top row, iOS 26 style: a round glass Back (the same plain glass as every+ * glass button), a wide glass capsule with the document's name, the page it's on and Find, then+ * Share and More together in one glass capsule (a group, as iOS groups its bar buttons: one glass+ * instead of a cluster of stacked ones). With a tool out: a candy Done, the tool's name, and Undo /+ * Redo grouped the same way. All of it refracts the pages under it.*/@Composablefun ViewerTopBar(@@ -121,49 +127,92 @@ fun ViewerTopBar(horizontalArrangement = Arrangement.spacedBy(8.dp),) {if (toolActive && doneIsCheck) {- GlassCircle(onClick = onBack, tint = Candy.Sky, label = stringResource(R.string.common_done)) { GlassIcon(LucideIcons.Check, null, Modifier.size(22.dp)) }+ GlassCircle(onClick = onBack, size = 48.dp, tint = Candy.Sky, label = stringResource(R.string.common_done)) { GlassIcon(LucideIcons.Check, null, Modifier.size(22.dp)) }} else {- GlassCircle(onClick = onBack, surface = c.capsule, label = stringResource(R.string.common_back)) { GlassIcon(LucideIcons.ChevronLeft, null, Modifier.size(23.dp), tint = Color.White) }+ GlassCircle(onClick = com.chethan616.clearpdf.ui.glass.rememberBeat(onBack), size = 48.dp, label = stringResource(R.string.common_back)) { GlassIcon(LucideIcons.ChevronLeft, null, Modifier.size(23.dp)) }}GlassPill(onClick = onTitle, modifier = Modifier.weight(1f), height = 48.dp, horizontalPadding = 16.dp) {if (toolTitle != null) Box(Modifier.size(9.dp).clip(CircleShape).background(Candy.Sky))Column(Modifier.weight(1f)) {- Text(toolTitle ?: title, style = ClearType.Title.copy(fontSize = 16.sp, lineHeight = 19.sp), color = c.ink, maxLines = 1, overflow = TextOverflow.Ellipsis)+ Text(toolTitle ?: title, style = ClearType.Title.copy(fontSize = 15.5.sp, lineHeight = 19.sp), color = c.ink, maxLines = 1, overflow = TextOverflow.Ellipsis)if (subtitle != null && toolTitle == null) Text(subtitle, style = ClearType.Caption, color = c.inkSoft, maxLines = 1)}if (onSearch != null && !toolActive) {- Box(Modifier.size(36.dp).pressable(onSearch).semantics { contentDescription = "" }, contentAlignment = Alignment.Center) {- Icon(LucideIcons.Search, stringResource(R.string.viewer_find_in_document), tint = c.ink, modifier = Modifier.size(20.dp))+ BarGlyphButton(onSearch, stringResource(R.string.viewer_find_in_document), size = 36.dp) {+ Icon(LucideIcons.Search, null, tint = c.ink, modifier = Modifier.size(19.dp))}}}if (toolActive) {if (canUndo || canRedo) {- GlassCircle(onClick = { if (canUndo) onUndo() }, label = stringResource(R.string.common_undo)) {- GlassIcon(LucideIcons.Undo2, null, Modifier.size(20.dp), tint = if (canUndo) Color.Unspecified else c.inkFaint)- }- GlassCircle(onClick = { if (canRedo) onRedo() }, label = stringResource(R.string.common_redo)) {- GlassIcon(LucideIcons.Redo2, null, Modifier.size(20.dp), tint = if (canRedo) Color.Unspecified else c.inkFaint)+ BarGroup {+ BarGlyphButton({ if (canUndo) onUndo() }, stringResource(R.string.common_undo), enabled = canUndo) {+ Icon(LucideIcons.Undo2, null, tint = if (canUndo) c.ink else c.inkFaint, modifier = Modifier.size(20.dp))+ }+ BarGlyphButton({ if (canRedo) onRedo() }, stringResource(R.string.common_redo), enabled = canRedo) {+ Icon(LucideIcons.Redo2, null, tint = if (canRedo) c.ink else c.inkFaint, modifier = Modifier.size(20.dp))+ }}}} else {- if (canUndo) UndoMenuButton(canUndo, canRedo, onUndo, onRedo, undoLabel, redoLabel)- GlassCircle(onClick = onShare, label = stringResource(R.string.common_share)) { GlassIcon(LucideIcons.Share2, null, Modifier.size(20.dp)) }- GlassCircle(onClick = onMore, label = stringResource(R.string.common_more_options)) { GlassIcon(LucideIcons.Ellipsis, null, Modifier.size(21.dp)) }+ BarGroup {+ if (canUndo) UndoMenuButton(canUndo, canRedo, onUndo, onRedo, undoLabel, redoLabel)+ BarGlyphButton(onShare, stringResource(R.string.common_share)) { Icon(LucideIcons.Share2, null, tint = c.ink, modifier = Modifier.size(19.dp)) }+ BarGlyphButton(onMore, stringResource(R.string.common_more_options)) { Icon(LucideIcons.Ellipsis, null, tint = c.ink, modifier = Modifier.size(21.dp)) }+ }}}}-/** Undo as a glass circle: a tap opens a menu naming what Undo and Redo would do. */+/**+ * The viewer's bars coming and going: they spring in from their edge on the glass spring (Settings ▸+ * Motion), swelling a touch past rest, and ease away. They move as finished textures, so the glass is+ * not re-blurred on every frame of the slide.+ */+@Composable+fun GlassBars(visible: Boolean, fromTop: Boolean, content: @Composable () -> Unit) {+ val p = remember { androidx.compose.animation.core.Animatable(if (visible) 1f else 0f) }+ LaunchedEffect(visible) {+ p.animateTo(if (visible) 1f else 0f, if (visible) com.chethan616.clearpdf.ui.glass.GlassMotion.unfold() else com.chethan616.clearpdf.ui.glass.Fluid.dismiss())+ }+ val shown by remember { androidx.compose.runtime.derivedStateOf { visible || p.value > 0.002f } }+ if (!shown) return+ Box(+ Modifier.floatingLayer {+ val v = p.value+ val away = (1f - v).coerceAtLeast(0f)+ // past rest only a little, and only toward the middle of the screen+ val over = (v - 1f).coerceAtLeast(0f) * 10.dp.toPx()+ translationY = (if (fromTop) -1f else 1f) * (away * size.height * 0.8f - over)+ val s = 0.94f + 0.06f * v.coerceIn(0f, 1f)+ scaleX = s+ scaleY = s+ transformOrigin = androidx.compose.ui.graphics.TransformOrigin(0.5f, if (fromTop) 0f else 1f)+ alpha = v.coerceIn(0f, 1f)+ },+ ) { content() }+}++/** Bar buttons grouped on one glass capsule, as iOS groups them. */+@Composable+private fun BarGroup(content: @Composable androidx.compose.foundation.layout.RowScope.() -> Unit) {+ Row(+ Modifier.height(48.dp).glassBar().padding(horizontal = 4.dp),+ verticalAlignment = Alignment.CenterVertically,+ content = content,+ )+}++/** Undo in a bar group: a tap opens a menu naming what Undo and Redo would do. */@Composablefun UndoMenuButton(canUndo: Boolean, canRedo: Boolean, onUndo: () -> Unit, onRedo: () -> Unit, undoLabel: String? = null, redoLabel: String? = null) {var open by remember { mutableStateOf(false) }var anchor by remember { mutableStateOf(Rect.Zero) }- GlassCircle(- onClick = { if (canUndo || canRedo) open = true },+ BarGlyphButton(+ { if (canUndo || canRedo) open = true },+ stringResource(R.string.viewer_undo_or_redo),modifier = Modifier.onGloballyPositioned { anchor = it.boundsInWindow() },- label = stringResource(R.string.viewer_undo_or_redo),- ) { GlassIcon(LucideIcons.Undo2, null, Modifier.size(20.dp)) }+ ) { Icon(LucideIcons.Undo2, null, tint = clear.ink, modifier = Modifier.size(20.dp)) }if (open) {val items = buildList {if (canUndo) add(GlassMenuItem(undoLabel?.let { stringResource(R.string.viewer_undo_named, it) } ?: stringResource(R.string.common_undo), LucideIcons.Undo2, onClick = onUndo))@@ -194,14 +243,25 @@ fun SearchBar(val keyboard = LocalSoftwareKeyboardController.currentval findLabel = stringResource(R.string.viewer_find_in_document)LaunchedEffect(Unit) { focus.requestFocus() }+ // the field grows out of the title pill on the glass spring (Settings ▸ Motion), its words a beat behind+ val grow = remember { androidx.compose.animation.core.Animatable(0f) }+ LaunchedEffect(Unit) { grow.animateTo(1f, GlassMotion.morph()) }Row(Modifier.fillMaxWidth().height(TopBarHeight).padding(horizontal = 12.dp),verticalAlignment = Alignment.CenterVertically,horizontalArrangement = Arrangement.spacedBy(8.dp),) {- GlassCircle(onClick = onClose, label = stringResource(R.string.viewer_collapse)) { GlassIcon(LucideIcons.ArrowLeft, null, Modifier.size(21.dp)) }+ GlassCircle(onClick = onClose, size = 48.dp, label = stringResource(R.string.viewer_collapse)) { GlassIcon(LucideIcons.ChevronLeft, null, Modifier.size(23.dp)) }Row(- Modifier.weight(1f).height(48.dp).glass(Capsule, blur = 6.dp).padding(start = 16.dp, end = 4.dp),+ Modifier.weight(1f).height(48.dp)+ .layout { m, cs ->+ val full = cs.maxWidth+ val w = (full * (0.55f + 0.45f * grow.value)).toInt().coerceIn(1, full)+ val p = m.measure(cs.copy(minWidth = w, maxWidth = w))+ layout(full, p.height) { p.place(0, 0) }+ }+ .glassBar().padding(start = 16.dp, end = 4.dp)+ .graphicsLayer { alpha = ((grow.value - 0.25f) / 0.5f).coerceIn(0f, 1f) },verticalAlignment = Alignment.CenterVertically,) {Icon(LucideIcons.Search, null, tint = c.inkSoft, modifier = Modifier.size(18.dp))@@ -261,17 +321,19 @@ fun QuickToolbar() {val slots = dockSlots(LocalConfiguration.current.screenWidthDp)val shown = tools.take(slots)- val turn by androidx.compose.animation.core.animateFloatAsState(if (moreToolsOpen) 45f else 0f, GlassMotion.morph(), label = "more")+ val turn by androidx.compose.animation.core.animateFloatAsState(if (moreToolsOpen) 45f else 0f, com.chethan616.clearpdf.ui.glass.Fluid.quick(), label = "more")Row(Modifier.fillMaxWidth().height(BottomBarHeight).padding(horizontal = 12.dp, vertical = 8.dp),verticalAlignment = Alignment.CenterVertically,horizontalArrangement = Arrangement.spacedBy(10.dp),) {- Row(Modifier.weight(1f).fillMaxHeight().glass(Capsule, blur = 6.dp).padding(horizontal = 6.dp), verticalAlignment = Alignment.CenterVertically) {- for (t in shown) DockItem(t.icon, stringResource(t.label), iconAccent(t.icon)) { onTool(t) }+ // iOS 26's toolbar: one glass capsule of plain glyphs in the glass's ink (no rainbow, no captions:+ // each glyph names itself to TalkBack), More tools in a glass bubble of its own beside it+ Row(Modifier.weight(1f).fillMaxHeight().glassBar().padding(horizontal = 6.dp), verticalAlignment = Alignment.CenterVertically) {+ for (t in shown) DockItem(t.icon, stringResource(t.label)) { onTool(t) }}- GlassCircle(onClick = onMoreTools, size = 60.dp, tint = Candy.Grape, label = stringResource(R.string.common_tool_more_tools)) {- GlassIcon(LucideIcons.LayoutGrid, null, Modifier.size(24.dp).androidxRotate(turn))+ GlassCircle(onClick = onMoreTools, size = 60.dp, label = stringResource(R.string.common_tool_more_tools)) {+ GlassIcon(LucideIcons.LayoutGrid, null, Modifier.size(23.dp).androidxRotate(turn))}}}@@ -279,17 +341,11 @@ fun QuickToolbar(private fun Modifier.androidxRotate(degrees: Float) = this.graphicsLayer { rotationZ = degrees }@Composable-private fun androidx.compose.foundation.layout.RowScope.DockItem(icon: ImageVector, label: String, accent: Color, onClick: () -> Unit) {- val c = clear- Column(- Modifier.weight(1f).fillMaxHeight().pressable(onClick, pressedScale = 0.88f).semantics { contentDescription = label },- horizontalAlignment = Alignment.CenterHorizontally,- verticalArrangement = Arrangement.Center,- ) {- Icon(icon, null, tint = accent, modifier = Modifier.size(22.dp))- Spacer(Modifier.height(3.dp))- Text(label, style = ClearType.Caption.copy(fontSize = 10.5.sp, lineHeight = 12.sp), color = c.ink, maxLines = 1, overflow = TextOverflow.Ellipsis)- }+private fun androidx.compose.foundation.layout.RowScope.DockItem(icon: ImageVector, label: String, onClick: () -> Unit) {+ Box(+ Modifier.weight(1f).fillMaxHeight().pressable(onClick, pressedScale = 0.86f).semantics { contentDescription = label },+ contentAlignment = Alignment.Center,+ ) { GlassIcon(icon, null, Modifier.size(24.dp)) }}/** No line along bars any more: glass floats. Kept so the tools' own bars can call it. */@@ -304,7 +360,7 @@ fun SubToolbar(content: @Composable () -> Unit) {val scroll = rememberScrollState()BoxWithConstraints(Modifier.fillMaxWidth().height(BottomBarHeight).padding(horizontal = 12.dp, vertical = 8.dp), contentAlignment = Alignment.Center) {Row(- Modifier.widthIn(max = maxWidth).fillMaxHeight().glass(Capsule, blur = 6.dp).horizontalScroll(scroll).padding(horizontal = 8.dp),+ Modifier.widthIn(max = maxWidth).fillMaxHeight().glassBar().horizontalScroll(scroll).padding(horizontal = 8.dp),horizontalArrangement = Arrangement.Center,verticalAlignment = Alignment.CenterVertically,) { CompositionLocalProvider(LocalSubToolbarScroll provides scroll) { content() } }diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ViewerScreen.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ViewerScreen.ktindex 6d14496..25d8f9f 100644--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ViewerScreen.kt+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ViewerScreen.kt@@ -28,7 +28,10 @@ import androidx.compose.foundation.layout.windowInsetsPaddingimport androidx.compose.foundation.layout.WindowInsetsSidesimport androidx.compose.foundation.layout.onlyimport androidx.compose.runtime.Composable+import androidx.compose.runtime.CompositionLocalProviderimport androidx.compose.runtime.DisposableEffect+import com.chethan616.clearpdf.ui.glass.LocalBackdrop+import com.kyant.backdrop.backdrops.layerBackdropimport androidx.compose.runtime.LaunchedEffectimport androidx.compose.runtime.getValueimport androidx.compose.runtime.mutableStateOf@@ -118,7 +121,7 @@ fun ViewerScreen(vm: AppViewModel, doc: OpenDocument) {// of a camera at the sideval cutoutSides = if (statusBar) Modifier.windowInsetsPadding(WindowInsets.displayCutout.only(WindowInsetsSides.Horizontal)) else Modifier// the bars on their own colour there- val barSides = if (statusBar) Modifier.background(c.surface).then(cutoutSides) else Modifier+ val barSides = cutoutSides// The page area starts under the top bar and leaves room for the bottom bar. The room is the same// whether the bars show or not (they hide as the reader scrolls: the pages must not jump), and@@ -132,8 +135,10 @@ fun ViewerScreen(vm: AppViewModel, doc: OpenDocument) {// keyed on the document too: one opened over another (Create, Combine) has a fresh page viewLaunchedEffect(doc, statusPx, navPx, ctl.searching, ctl.tool, vm.readingMode, bottomPx) {val bottomShown = !ctl.searching && !vm.readingMode+ // the first page starts at the top of the screen, under the camera; the glass row floats over+ // it as over the rest (no empty band above it)doc.viewer.setPadding(- top = statusPx + topPx,+ top = 0f,bottom = if (bottomShown) bottomPx + navPx else navPx,)}@@ -192,9 +197,14 @@ fun ViewerScreen(vm: AppViewModel, doc: OpenDocument) {}}+ // The pages are recorded as the viewer's own backdrop: every glass control over them (the top+ // row, the dock, a tool's bar) refracts the document, never the desk's wallpaper beneath it.+ val pagesBackdrop = com.kyant.backdrop.backdrops.rememberLayerBackdrop()// a magnifier over the text while a selection handle is dragged, as the reference shows one+ // no fill of its own: the page canvas paints the desk (every full-screen fill under the pages+ // costs bandwidth on every frame of a scroll)Box(- Modifier.fillMaxSize().background(c.desk).magnifier(+ Modifier.fillMaxSize().magnifier(sourceCenter = { selection.magnifierAt ?: Offset.Unspecified },magnifierCenter = { selection.magnifierAt?.let { it - Offset(0f, with(density) { 56.dp.toPx() }) } ?: Offset.Unspecified },zoom = 1.25f,@@ -203,6 +213,8 @@ fun ViewerScreen(vm: AppViewModel, doc: OpenDocument) {),) {val gesturesForTool = ctl.tool == ViewerTool.None || ctl.tool == ViewerTool.Edit+ // (Reading Mode's text has no ground of its own: the desk goes in under it, inside the backdrop)+ Box(Modifier.fillMaxSize().layerBackdrop(pagesBackdrop).then(if (vm.readingMode) Modifier.background(c.desk) else Modifier)) {if (vm.readingMode) ReadingModeContent(vm, doc,// the text stays put when the bars hide, as the pages do@@ -266,7 +278,9 @@ fun ViewerScreen(vm: AppViewModel, doc: OpenDocument) {drawLinkFlash(doc)},)+ }+ CompositionLocalProvider(LocalBackdrop provides pagesBackdrop) {// The active tool takes the touches over the pages.ToolLayer(vm, doc)if (ctl.tool == ViewerTool.Edit) EditOverlay(vm, doc)@@ -296,7 +310,7 @@ fun ViewerScreen(vm: AppViewModel, doc: OpenDocument) {Scrubber(doc = doc,visible = indicatorVisible && !ctl.searching,- top = with(density) { (doc.viewer.padTop).toDp() },+ top = with(density) { (statusPx + topPx).toDp() },bottom = with(density) { (doc.viewer.padBottom).toDp() },onDrag = { ctl.lastMoved = SystemClock.uptimeMillis() },onTap = { ctl.goToPage = true },@@ -326,7 +340,7 @@ fun ViewerScreen(vm: AppViewModel, doc: OpenDocument) {}androidx.compose.animation.AnimatedVisibility(nameChip && ctl.tool == ViewerTool.None,- modifier = Modifier.align(Alignment.TopCenter).padding(top = with(density) { doc.viewer.padTop.toDp() } + 22.dp),+ modifier = Modifier.align(Alignment.TopCenter).padding(top = with(density) { (statusPx + topPx).toDp() } + 10.dp),enter = androidx.compose.animation.fadeIn(), exit = androidx.compose.animation.fadeOut(),) {Row(@@ -343,15 +357,9 @@ fun ViewerScreen(vm: AppViewModel, doc: OpenDocument) {// The bars.Column(Modifier.fillMaxWidth().align(Alignment.TopCenter)) {- Box(- Modifier.fillMaxWidth().height(with(density) { statusPx.toDp() })- .background(if (!statusBar) c.desk else if (ctl.barsVisible) c.surface else Color.Transparent),- )- AnimatedVisibility(- ctl.barsVisible,- enter = slideInVertically(tween(PdfMotion.BARS_MS)) { -it } + fadeIn(tween(PdfMotion.BARS_MS)),- exit = slideOutVertically(tween(PdfMotion.BARS_MS)) { -it } + fadeOut(tween(PdfMotion.BARS_MS)),- ) {+ // the pages run up under the camera and the glass row: no band of their own up there+ Spacer(Modifier.fillMaxWidth().height(with(density) { statusPx.toDp() }))+ GlassBars(ctl.barsVisible, fromTop = true) {Box(barSides) {if (ctl.searching) {var query by remember { mutableStateOf(search.query) }@@ -410,11 +418,7 @@ fun ViewerScreen(vm: AppViewModel, doc: OpenDocument) {// while typing on the page, the bar (with its formatting) rides above the keyboardif (vm.readAloud == null && vm.fieldActions == null) Column(Modifier.fillMaxWidth().align(Alignment.BottomCenter).then(if (vm.editing != null) Modifier.imePadding() else Modifier)) {vm.success?.let { SuccessBannerView(it, onClose = { vm.success = null }) }- AnimatedVisibility(- ctl.barsVisible && !ctl.searching && !vm.readingMode,- enter = slideInVertically(tween(PdfMotion.BARS_MS)) { it } + fadeIn(tween(PdfMotion.BARS_MS)),- exit = slideOutVertically(tween(PdfMotion.BARS_MS)) { it } + fadeOut(tween(PdfMotion.BARS_MS)),- ) {+ GlassBars(ctl.barsVisible && !ctl.searching && !vm.readingMode, fromTop = false) {Column(barSides) {if (ctl.tool == ViewerTool.None) {QuickToolbar(@@ -428,8 +432,8 @@ fun ViewerScreen(vm: AppViewModel, doc: OpenDocument) {}}}- // the navigation bar's band stays solid while the bars show (also while searching)- if (ctl.barsVisible) Box(Modifier.fillMaxWidth().windowInsetsBottomHeight(WindowInsets.navigationBars).background(c.navBand))+ // the pages run under the gesture bar too: no solid band there, the glass floats+ if (ctl.barsVisible) Spacer(Modifier.fillMaxWidth().windowInsetsBottomHeight(WindowInsets.navigationBars))}// The active tool's sheets, over everything.@@ -479,6 +483,7 @@ fun ViewerScreen(vm: AppViewModel, doc: OpenDocument) {vm.readAloud?.let { ReadAloudBar(vm, doc, it) }if (ctl.goToPage) GoToPageDialog(doc, onDismiss = { ctl.goToPage = false })if (ctl.pagesOpen) PagesScreen(vm, doc, onClose = { ctl.pagesOpen = false })+ }}}diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ViewerSheets.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ViewerSheets.ktindex 36e97de..61636f6 100644--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ViewerSheets.kt+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ViewerSheets.kt@@ -64,6 +64,17 @@ import com.chethan616.clearpdf.ui.SheetDividerimport com.chethan616.clearpdf.ui.SheetRowimport com.chethan616.clearpdf.ui.SheetTitleimport com.chethan616.clearpdf.ui.pdfColors+import com.chethan616.clearpdf.ui.SheetCircleButton+import com.chethan616.clearpdf.ui.SheetSection+import com.chethan616.clearpdf.ui.glass.pressable+import com.chethan616.clearpdf.ui.theme.Candy+import com.chethan616.clearpdf.ui.theme.ClearType+import com.chethan616.clearpdf.ui.theme.clear+import com.kyant.shapes.Capsule+import com.kyant.shapes.RoundedRectangle+import androidx.compose.ui.graphics.graphicsLayer+import androidx.compose.ui.layout.boundsInWindow+import androidx.compose.ui.layout.onGloballyPositionedimport java.text.DateFormatimport java.util.Date@@ -93,56 +104,98 @@ fun MoreSheet(vm: AppViewModel, doc: OpenDocument) {).toDp()} + TopBarHeightPdfSheet(onDismiss = ::close, maxHeightFraction = fraction, topReserve = top) {- Row(Modifier.fillMaxWidth().padding(start = 16.dp, end = 8.dp, top = 4.dp, bottom = 14.dp), verticalAlignment = Alignment.CenterVertically) {+ // the document: a small paper, its name and what it is, then Star and Print+ Row(Modifier.fillMaxWidth().padding(start = 16.dp, end = 14.dp, bottom = 14.dp), verticalAlignment = Alignment.CenterVertically) {+ DocGlyph()+ Spacer(Modifier.width(12.dp))Column(Modifier.weight(1f)) {- Text(doc.title, color = c.text, fontSize = 17.sp, fontWeight = FontWeight.SemiBold, maxLines = 1, overflow = TextOverflow.Ellipsis)- Spacer(Modifier.height(4.dp))- Row(verticalAlignment = Alignment.CenterVertically) {- Icon(LucideIcons.Smartphone, stringResource(R.string.sheet_stored_on_device), tint = c.icon, modifier = Modifier.size(16.dp))- Spacer(Modifier.width(6.dp))- Text(- "PDF • ${modifiedLabel(doc.file.lastModified(), stringResource(R.string.common_yesterday))}" + if (!doc.writable) " • " + stringResource(R.string.sheet_read_only) else "",- color = c.text, fontSize = 13.sp,- )- }+ Text(doc.title, style = ClearType.Title.copy(fontSize = 17.sp), color = clear.ink, maxLines = 1, overflow = TextOverflow.Ellipsis)+ Spacer(Modifier.height(2.dp))+ Text(+ "PDF · ${modifiedLabel(doc.file.lastModified(), stringResource(R.string.common_yesterday))}" + if (!doc.writable) " · " + stringResource(R.string.sheet_read_only) else "",+ style = ClearType.Caption.copy(fontSize = 12.sp), color = clear.inkSoft, maxLines = 1, overflow = TextOverflow.Ellipsis,+ )}- BarIcon(LucideIcons.Printer, stringResource(R.string.sheet_print), { close(); vm.print(doc) }, size = 40.dp)- BarIcon(LucideIcons.Star, stringResource(if (starred) R.string.sheet_remove_star else R.string.sheet_add_star), { vm.toggleStar(doc) },- tint = if (starred) Color(0xFFF5B800) else c.icon, size = 40.dp)- }- SheetDivider()- Column(Modifier.verticalScroll(scroll).padding(top = 5.dp)) {- SheetRow(LucideIcons.Glasses, stringResource(R.string.sheet_view_settings), { ctl.sheet = ViewerSheet.ViewSettings }, chevron = true)- SheetRow(LucideIcons.LayoutGrid, stringResource(R.string.sheet_pages), { close(); ctl.pagesOpen = true }, chevron = true)- if (doc.info.attachments > 0u) SheetRow(LucideIcons.Paperclip, stringResource(R.string.sheet_attachments), { ctl.sheet = ViewerSheet.Attachments }, chevron = true)- SheetRow(LucideIcons.Bookmark, stringResource(R.string.sheet_bookmarks_contents), { ctl.sheet = ViewerSheet.Bookmarks }, chevron = true)- SheetRow(LucideIcons.MessagesSquare, stringResource(R.string.sheet_comment_list), { ctl.sheet = ViewerSheet.Comments }, chevron = true)- SheetRow(LucideIcons.ShieldCheck, stringResource(R.string.sign_signatures), { ctl.sheet = ViewerSheet.Signatures }, chevron = true)- SheetRow(- if (bookmarked) LucideIcons.BookmarkMinus else LucideIcons.BookmarkPlus,- stringResource(if (bookmarked) R.string.sheet_remove_bookmark else R.string.sheet_add_bookmark),- { close(); vm.toggleBookmark(doc) },+ Spacer(Modifier.width(8.dp))+ SheetCircleButton(+ LucideIcons.Star, stringResource(if (starred) R.string.sheet_remove_star else R.string.sheet_add_star), { vm.toggleStar(doc) },+ tint = if (starred) Candy.Lemon else Color.Unspecified,)- SheetRow(LucideIcons.Volume2, stringResource(R.string.common_tool_read_aloud), { close(); vm.startReadAloud(doc) })- SheetRow(LucideIcons.FilePenLine, stringResource(R.string.common_tool_edit_pdf), { close(); vm.enterTool(doc, ViewerTool.Edit) })- GroupDivider()- SheetRow(LucideIcons.FileOutput, stringResource(R.string.sheet_export_as), { close(); vm.openExport(doc) })- SheetRow(LucideIcons.FileArchive, stringResource(R.string.common_tool_compress), { close(); vm.openCompress(doc) })- SheetRow(LucideIcons.Combine, stringResource(R.string.common_tool_combine), { close(); vm.openCombine(doc) })- SheetRow(LucideIcons.FileLock2, stringResource(R.string.common_tool_set_password), { close(); vm.openProtect(doc) })- SheetRow(LucideIcons.FilePlus2, stringResource(R.string.common_tool_create_pdf), { close(); vm.openCreate() })- if (doc.info.undo != null || doc.info.redo != null) {- GroupDivider()- doc.info.undo?.let { SheetRow(LucideIcons.Undo2, stringResource(R.string.sheet_undo_action, it), { close(); vm.undo(doc) }) }- doc.info.redo?.let { SheetRow(LucideIcons.Redo2, stringResource(R.string.sheet_redo_action, it), { close(); vm.redo(doc) }) }+ Spacer(Modifier.width(8.dp))+ SheetCircleButton(LucideIcons.X, stringResource(R.string.ui_close_sheet), ::close)+ }+ Column(Modifier.verticalScroll(scroll)) {+ // the four things done most, as big tiles+ Row(Modifier.fillMaxWidth().padding(horizontal = 12.dp, vertical = 2.dp), horizontalArrangement = Arrangement.spacedBy(8.dp)) {+ ActionTile(+ if (bookmarked) LucideIcons.BookmarkMinus else LucideIcons.BookmarkPlus,+ stringResource(if (bookmarked) R.string.sheet_remove_bookmark else R.string.sheet_add_bookmark), Candy.Tangerine,+ ) { close(); vm.toggleBookmark(doc) }+ ActionTile(LucideIcons.Volume2, stringResource(R.string.common_tool_read_aloud), Candy.Sky) { close(); vm.startReadAloud(doc) }+ ActionTile(LucideIcons.FilePenLine, stringResource(R.string.common_tool_edit_pdf), Candy.Bubblegum) { close(); vm.enterTool(doc, ViewerTool.Edit) }+ ActionTile(LucideIcons.Printer, stringResource(R.string.sheet_print), Candy.Grape) { close(); vm.print(doc) }}- GroupDivider()- SheetRow(LucideIcons.Copy, stringResource(R.string.common_save_copy), { close(); vm.saveCopyAs(doc) })Spacer(Modifier.height(8.dp))+ SheetSection {+ SheetRow(LucideIcons.Glasses, stringResource(R.string.sheet_view_settings), { ctl.sheet = ViewerSheet.ViewSettings }, chevron = true, tint = Candy.Sky)+ SheetRow(LucideIcons.LayoutGrid, stringResource(R.string.sheet_pages), { close(); ctl.pagesOpen = true }, chevron = true, tint = Candy.Mint)+ SheetRow(LucideIcons.Bookmark, stringResource(R.string.sheet_bookmarks_contents), { ctl.sheet = ViewerSheet.Bookmarks }, chevron = true, tint = Candy.Tangerine)+ if (doc.info.attachments > 0u) SheetRow(LucideIcons.Paperclip, stringResource(R.string.sheet_attachments), { ctl.sheet = ViewerSheet.Attachments }, chevron = true, tint = Candy.Grape)+ SheetRow(LucideIcons.MessagesSquare, stringResource(R.string.sheet_comment_list), { ctl.sheet = ViewerSheet.Comments }, chevron = true, tint = Candy.Bubblegum)+ SheetRow(LucideIcons.ShieldCheck, stringResource(R.string.sign_signatures), { ctl.sheet = ViewerSheet.Signatures }, chevron = true, tint = Candy.Lime)+ }+ SheetSection {+ SheetRow(LucideIcons.FileOutput, stringResource(R.string.sheet_export_as), { close(); vm.openExport(doc) }, tint = Candy.Tangerine)+ SheetRow(LucideIcons.FileArchive, stringResource(R.string.common_tool_compress), { close(); vm.openCompress(doc) }, tint = Candy.Mint)+ SheetRow(LucideIcons.Combine, stringResource(R.string.common_tool_combine), { close(); vm.openCombine(doc) }, tint = Candy.Grape)+ SheetRow(LucideIcons.FileLock2, stringResource(R.string.common_tool_set_password), { close(); vm.openProtect(doc) }, tint = Candy.Sky)+ SheetRow(LucideIcons.FilePlus2, stringResource(R.string.common_tool_create_pdf), { close(); vm.openCreate() }, tint = Candy.Bubblegum)+ SheetRow(LucideIcons.Copy, stringResource(R.string.common_save_copy), { close(); vm.saveCopyAs(doc) }, tint = Candy.Lime)+ }+ if (doc.info.undo != null || doc.info.redo != null) {+ SheetSection {+ doc.info.undo?.let { SheetRow(LucideIcons.Undo2, stringResource(R.string.sheet_undo_action, it), { close(); vm.undo(doc) }, tint = Candy.Grape) }+ doc.info.redo?.let { SheetRow(LucideIcons.Redo2, stringResource(R.string.sheet_redo_action, it), { close(); vm.redo(doc) }, tint = Candy.Grape) }+ }+ }+ Spacer(Modifier.height(6.dp))+ }+ }+}++/** A PDF as a little paper in a sheet's header: grey lines and the red PDF corner. */+@Composable+private fun DocGlyph() {+ Box(+ Modifier.size(38.dp, 46.dp).graphicsLayer { shadowElevation = 3.dp.toPx(); shape = RoundedRectangle(7.dp); clip = true }.background(Color.White)+ .padding(horizontal = 7.dp, vertical = 8.dp),+ ) {+ Column(verticalArrangement = Arrangement.spacedBy(3.dp)) {+ repeat(4) { k -> Box(Modifier.fillMaxWidth(if (k == 3) 0.6f else 1f).height(2.5.dp).clip(Capsule).background(Color(0xFF17141F).copy(alpha = 0.14f))) }+ }+ Box(Modifier.align(Alignment.BottomEnd).clip(RoundedRectangle(3.dp)).background(Candy.Tomato).padding(horizontal = 3.dp, vertical = 1.dp)) {+ Text("PDF", color = Color.White, fontSize = 7.sp, style = ClearType.Eyebrow.copy(letterSpacing = 0.3.sp, fontSize = 7.sp, lineHeight = 8.sp))}}}+/** One of More's big tiles: a candy glyph over its name, on a white cell. */+@Composable+private fun androidx.compose.foundation.layout.RowScope.ActionTile(icon: ImageVector, label: String, accent: Color, onClick: () -> Unit) {+ val c = clear+ Column(+ Modifier.weight(1f).height(78.dp).clip(RoundedRectangle(20.dp))+ .background(if (c.dark) Color.White.copy(alpha = 0.075f) else Color.White.copy(alpha = 0.66f))+ .pressable(onClick, pressedScale = 0.95f).padding(horizontal = 4.dp).semantics { contentDescription = label },+ horizontalAlignment = Alignment.CenterHorizontally,+ verticalArrangement = Arrangement.Center,+ ) {+ Icon(icon, null, tint = accent, modifier = Modifier.size(23.dp))+ Spacer(Modifier.height(6.dp))+ Text(label, style = ClearType.Caption.copy(fontSize = 11.sp, lineHeight = 13.sp), color = c.ink, maxLines = 2, textAlign = TextAlign.Center, overflow = TextOverflow.Ellipsis)+ }+}+/** When the file was modified: the time today, [yesterday] ("Yesterday"), else the date. */internal fun modifiedLabel(t: Long, yesterday: String, now: Long = System.currentTimeMillis()): String {fun day(ms: Long) = java.util.Calendar.getInstance().apply { timeInMillis = ms }.let { it.get(java.util.Calendar.YEAR) * 400 + it.get(java.util.Calendar.DAY_OF_YEAR) }@@ -162,23 +215,49 @@ fun ViewSettingsSheet(vm: AppViewModel, doc: OpenDocument) {val ctl = doc.controllerPdfSheet(onDismiss = { ctl.sheet = ViewerSheet.None }) {SheetBackHeader(stringResource(R.string.sheet_view_settings), onBack = { ctl.sheet = ViewerSheet.More })- SheetRow(LucideIcons.GalleryVerticalEnd, stringResource(R.string.sheet_continuous), {- vm.setPageMode(doc, PageMode.Continuous)- ctl.sheet = ViewerSheet.None- }, checked = doc.viewer.mode == PageMode.Continuous && !vm.readingMode)- SheetRow(LucideIcons.File, stringResource(R.string.sheet_single_page), {- vm.setPageMode(doc, PageMode.SinglePage)- ctl.sheet = ViewerSheet.None- }, checked = doc.viewer.mode == PageMode.SinglePage && !vm.readingMode)- SheetRow(LucideIcons.BookOpenText, stringResource(R.string.sheet_reading_mode), {- ctl.sheet = ViewerSheet.None- vm.openReadingMode(doc)- }, checked = vm.readingMode)- GroupDivider()- SheetRow(LucideIcons.Moon, stringResource(R.string.sheet_night_mode), { vm.setNightMode(doc, !ctl.nightMode); ctl.sheet = ViewerSheet.None }) {- PdfSwitch(ctl.nightMode, { vm.setNightMode(doc, it); ctl.sheet = ViewerSheet.None })+ // how the pages run, as three cards to choose from (the chosen one lit in blue)+ Row(Modifier.fillMaxWidth().padding(horizontal = 12.dp, vertical = 4.dp), horizontalArrangement = Arrangement.spacedBy(8.dp)) {+ LayoutChoice(LucideIcons.GalleryVerticalEnd, stringResource(R.string.sheet_continuous), doc.viewer.mode == PageMode.Continuous && !vm.readingMode) {+ vm.setPageMode(doc, PageMode.Continuous)+ ctl.sheet = ViewerSheet.None+ }+ LayoutChoice(LucideIcons.File, stringResource(R.string.sheet_single_page), doc.viewer.mode == PageMode.SinglePage && !vm.readingMode) {+ vm.setPageMode(doc, PageMode.SinglePage)+ ctl.sheet = ViewerSheet.None+ }+ LayoutChoice(LucideIcons.BookOpenText, stringResource(R.string.sheet_reading_mode), vm.readingMode) {+ ctl.sheet = ViewerSheet.None+ vm.openReadingMode(doc)+ }+ }+ Spacer(Modifier.height(6.dp))+ SheetSection {+ SheetRow(LucideIcons.Moon, stringResource(R.string.sheet_night_mode), { vm.setNightMode(doc, !ctl.nightMode); ctl.sheet = ViewerSheet.None }, tint = Candy.Grape) {+ PdfSwitch(ctl.nightMode, { vm.setNightMode(doc, it); ctl.sheet = ViewerSheet.None })+ }}- Spacer(Modifier.height(24.dp))+ Spacer(Modifier.height(14.dp))+ }+}++/** A way for the pages to run: a card with its glyph and name; the chosen one is lit in blue. */+@Composable+private fun androidx.compose.foundation.layout.RowScope.LayoutChoice(icon: ImageVector, label: String, chosen: Boolean, onClick: () -> Unit) {+ val c = clear+ val fill by androidx.compose.animation.animateColorAsState(+ if (chosen) Candy.Sky.copy(alpha = if (c.dark) 0.30f else 0.16f) else if (c.dark) Color.White.copy(alpha = 0.075f) else Color.White.copy(alpha = 0.66f),+ com.chethan616.clearpdf.ui.glass.Fluid.quick(), label = "layout choice",+ )+ Column(+ Modifier.weight(1f).height(96.dp).clip(RoundedRectangle(22.dp)).background(fill)+ .border(1.5.dp, if (chosen) Candy.Sky else Color.Transparent, RoundedRectangle(22.dp))+ .pressable(onClick, pressedScale = 0.95f).padding(8.dp).semantics { contentDescription = label },+ horizontalAlignment = Alignment.CenterHorizontally,+ verticalArrangement = Arrangement.Center,+ ) {+ Icon(icon, null, tint = if (chosen) Candy.Sky else c.inkSoft, modifier = Modifier.size(26.dp))+ Spacer(Modifier.height(8.dp))+ Text(label, style = ClearType.Label.copy(fontSize = 12.5.sp), color = if (chosen) Candy.Sky else c.ink, maxLines = 2, textAlign = TextAlign.Center, overflow = TextOverflow.Ellipsis)}}@@ -196,19 +275,17 @@ fun BookmarksSheet(vm: AppViewModel, doc: OpenDocument) {var renaming by remember { mutableStateOf<Int?>(null) }PdfSheet(onDismiss = { ctl.sheet = ViewerSheet.None }, maxHeightFraction = 0.69f, fill = true) {SheetBackHeader(stringResource(R.string.sheet_bookmarks_contents), onBack = { ctl.sheet = ViewerSheet.More })- Row(Modifier.fillMaxWidth().padding(horizontal = 16.dp)) {- listOf(stringResource(R.string.sheet_tab_contents), stringResource(R.string.sheet_tab_bookmarks)).forEachIndexed { i, label ->- Column(- Modifier.weight(1f).clickable(role = Role.Tab) { tab = i }.padding(top = 8.dp),- horizontalAlignment = Alignment.CenterHorizontally,- ) {- Text(label, color = if (tab == i) c.text else c.textSecondary, fontSize = 15.sp, fontWeight = if (tab == i) FontWeight.SemiBold else FontWeight.Normal)- Spacer(Modifier.height(8.dp))- Box(Modifier.fillMaxWidth().height(2.dp).background(if (tab == i) c.accent else Color.Transparent))- }- }- }- SheetDivider(inset = 0.dp)+ // Contents | Bookmarks: the glass segmented control+ com.chethan616.clearpdf.ui.glass.GlassTabs(+ listOf(+ com.chethan616.clearpdf.ui.glass.GlassTab(stringResource(R.string.sheet_tab_contents), accent = Candy.Sky),+ com.chethan616.clearpdf.ui.glass.GlassTab(stringResource(R.string.sheet_tab_bookmarks), accent = Candy.Tangerine),+ ),+ selected = tab, onSelect = { tab = it },+ modifier = Modifier.fillMaxWidth().padding(horizontal = 14.dp),+ height = 46.dp,+ )+ Spacer(Modifier.height(8.dp))if (tab == 0) {val all = outlinewhen {@@ -227,30 +304,34 @@ fun BookmarksSheet(vm: AppViewModel, doc: OpenDocument) {i++}}- LazyColumn(Modifier.weight(1f)) {+ LazyColumn(Modifier.weight(1f).padding(horizontal = 12.dp).clip(RoundedRectangle(22.dp)).background(cellFill())) {if (parent >= 0) {item {- Row(Modifier.fillMaxWidth().clickable { parent = parentOf(all, parent) }.padding(horizontal = 12.dp, vertical = 12.dp), verticalAlignment = Alignment.CenterVertically) {- Icon(LucideIcons.ArrowLeft, stringResource(R.string.sheet_up_level), tint = c.icon, modifier = Modifier.size(22.dp))- Spacer(Modifier.width(16.dp))- Text(all[parent].title, color = c.text, fontWeight = FontWeight.SemiBold, fontSize = 16.sp, maxLines = 2, overflow = TextOverflow.Ellipsis)+ Row(+ Modifier.fillMaxWidth().pressable({ parent = parentOf(all, parent) }, pressedScale = 0.985f).padding(horizontal = 12.dp, vertical = 12.dp),+ verticalAlignment = Alignment.CenterVertically,+ ) {+ SheetCircleButton(LucideIcons.ChevronLeft, stringResource(R.string.sheet_up_level), { parent = parentOf(all, parent) }, size = 32.dp)+ Spacer(Modifier.width(12.dp))+ Text(all[parent].title, style = ClearType.BodyStrong.copy(fontSize = 16.sp), color = clear.ink, maxLines = 2, overflow = TextOverflow.Ellipsis)}}}items(entries) { i ->val e = all[i]Row(- Modifier.fillMaxWidth().clickable {+ Modifier.fillMaxWidth().pressable({e.page?.let { p ->ctl.rememberJump(doc.viewer.currentPage)doc.viewer.goToPage(p.toInt())ctl.sheet = ViewerSheet.None}- }.padding(start = 20.dp, end = 4.dp).heightIn(min = 48.dp),+ }, pressedScale = 0.985f).padding(start = 18.dp, end = 10.dp).heightIn(min = 50.dp),verticalAlignment = Alignment.CenterVertically,) {- Text(e.title, color = c.text, fontSize = 16.sp, modifier = Modifier.weight(1f).padding(vertical = 10.dp), maxLines = 3, overflow = TextOverflow.Ellipsis)- if (e.children > 0u) BarIcon(LucideIcons.ChevronRight, stringResource(R.string.sheet_expand_entry, e.title), { parent = i })+ Text(e.title, style = ClearType.Body.copy(fontSize = 16.sp), color = clear.ink, modifier = Modifier.weight(1f).padding(vertical = 10.dp), maxLines = 3, overflow = TextOverflow.Ellipsis)+ e.page?.let { Text((it.toInt() + 1).toString(), style = ClearType.Label, color = clear.inkFaint, modifier = Modifier.padding(horizontal = 6.dp)) }+ if (e.children > 0u) SheetCircleButton(LucideIcons.ChevronRight, stringResource(R.string.sheet_expand_entry, e.title), { parent = i }, size = 32.dp)}}}@@ -260,15 +341,18 @@ fun BookmarksSheet(vm: AppViewModel, doc: OpenDocument) {val list = vm.bookmarks.list(doc)if (list.isEmpty()) {Column(Modifier.fillMaxWidth().padding(32.dp), horizontalAlignment = Alignment.CenterHorizontally) {- Icon(LucideIcons.Bookmark, null, tint = c.textSecondary, modifier = Modifier.size(40.dp))- Spacer(Modifier.height(12.dp))- Text(stringResource(R.string.sheet_bookmarks_empty), color = c.text, fontSize = 15.sp)+ Box(Modifier.size(56.dp).clip(RoundedRectangle(18.dp)).background(Candy.Tangerine), contentAlignment = Alignment.Center) {+ Icon(LucideIcons.Bookmark, null, tint = Color.White, modifier = Modifier.size(26.dp))+ }+ Spacer(Modifier.height(14.dp))+ Text(stringResource(R.string.sheet_bookmarks_empty), style = ClearType.Body, color = clear.inkSoft, textAlign = TextAlign.Center)Spacer(Modifier.height(16.dp))- Text(stringResource(R.string.sheet_add_a_bookmark), color = c.accent, fontSize = 15.sp, fontWeight = FontWeight.SemiBold,- modifier = Modifier.clickable { vm.toggleBookmark(doc) }.padding(8.dp))+ com.chethan616.clearpdf.ui.glass.GlassPill(onClick = { vm.toggleBookmark(doc) }, tint = Candy.Tangerine, height = 44.dp) {+ Text(stringResource(R.string.sheet_add_a_bookmark), style = ClearType.BodyStrong, color = Color.White)+ }}} else {- LazyColumn(Modifier.weight(1f)) {+ LazyColumn(Modifier.weight(1f).padding(horizontal = 12.dp).clip(RoundedRectangle(22.dp)).background(cellFill())) {items(list.size) { i ->val b = list[i]UserBookmarkRow(@@ -304,70 +388,64 @@ private fun parentOf(all: List<OutlineEntry>, i: Int): Int {return k}+/** The white cell rows sit in on a sheet. */+@Composable+private fun cellFill(): Color = if (clear.dark) Color.White.copy(alpha = 0.075f) else Color.White.copy(alpha = 0.66f)+@Composable-@OptIn(androidx.compose.foundation.ExperimentalFoundationApi::class)private fun UserBookmarkRow(name: String, page: Int, renaming: Boolean, onOpen: () -> Unit, onRename: () -> Unit, onRenamed: (String) -> Unit, onDelete: () -> Unit, onDeleteAll: () -> Unit) {- val c = pdfColorsvar menu by remember { mutableStateOf(false) }+ var anchor by remember { mutableStateOf(androidx.compose.ui.geometry.Rect.Zero) }var text by remember(renaming) { mutableStateOf(name) }// a long press opens Rename / Delete / Delete all, as the reference's list doesRow(- Modifier.fillMaxWidth().combinedClickable(enabled = !renaming, onClick = onOpen, onLongClick = { menu = true })- .padding(start = 20.dp, end = 4.dp).heightIn(min = 52.dp),+ Modifier.fillMaxWidth().onGloballyPositioned { anchor = it.boundsInWindow() }+ .pressable(onOpen, onLongClick = { menu = true }, enabled = !renaming, pressedScale = 0.985f)+ .padding(start = 14.dp, end = 14.dp).heightIn(min = 54.dp),verticalAlignment = Alignment.CenterVertically,) {- Icon(LucideIcons.Bookmark, null, tint = c.icon, modifier = Modifier.size(20.dp))- Spacer(Modifier.width(16.dp))+ Box(Modifier.size(30.dp).clip(RoundedRectangle(9.dp)).background(Candy.Tangerine), contentAlignment = Alignment.Center) {+ Icon(LucideIcons.Bookmark, null, tint = Color.White, modifier = Modifier.size(16.dp))+ }+ Spacer(Modifier.width(14.dp))if (renaming) {- androidx.compose.material3.OutlinedTextField(- value = text, onValueChange = { text = it }, singleLine = true, modifier = Modifier.weight(1f),+ com.chethan616.clearpdf.ui.PdfField(+ text, { text = it }, stringResource(R.string.common_rename), modifier = Modifier.weight(1f),keyboardOptions = androidx.compose.foundation.text.KeyboardOptions(imeAction = androidx.compose.ui.text.input.ImeAction.Done),keyboardActions = androidx.compose.foundation.text.KeyboardActions(onDone = { onRenamed(text) }),)} else {- Column(Modifier.weight(1f)) {- Text(name, color = c.text, fontSize = 16.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)- Text(stringResource(R.string.sheet_page, page + 1), color = c.textSecondary, fontSize = 13.sp)- }- }- Box {- androidx.compose.material3.DropdownMenu(expanded = menu, onDismissRequest = { menu = false }, containerColor = c.menu) {- androidx.compose.material3.DropdownMenuItem(text = { Text(stringResource(R.string.common_rename), color = c.text) }, onClick = { menu = false; onRename() })- androidx.compose.material3.DropdownMenuItem(text = { Text(stringResource(R.string.common_delete), color = c.text) }, onClick = { menu = false; onDelete() })- androidx.compose.material3.DropdownMenuItem(text = { Text(stringResource(R.string.sheet_delete_all), color = c.text) }, onClick = { menu = false; onDeleteAll() })+ Column(Modifier.weight(1f).padding(vertical = 8.dp)) {+ Text(name, style = ClearType.Body.copy(fontSize = 16.sp), color = clear.ink, maxLines = 1, overflow = TextOverflow.Ellipsis)+ Text(stringResource(R.string.sheet_page, page + 1), style = ClearType.Caption.copy(fontSize = 12.sp), color = clear.inkSoft)}}}+ if (menu) {+ com.chethan616.clearpdf.ui.glass.GlassMenu(+ anchor, { menu = false },+ listOf(+ com.chethan616.clearpdf.ui.glass.GlassMenuItem(stringResource(R.string.common_rename), LucideIcons.PenLine, onClick = onRename),+ com.chethan616.clearpdf.ui.glass.GlassMenuItem(stringResource(R.string.common_delete), LucideIcons.Trash2, destructive = true, onClick = onDelete),+ com.chethan616.clearpdf.ui.glass.GlassMenuItem(stringResource(R.string.sheet_delete_all), LucideIcons.BookmarkMinus, destructive = true, onClick = onDeleteAll),+ ),+ )+ }}/** Attachments: the embedded files; a PDF opens in the viewer, anything else in another app. */@Composablefun AttachmentsSheet(vm: AppViewModel, doc: OpenDocument) {- val c = pdfColorsval ctl = doc.controllervar list by remember { mutableStateOf<List<AttachmentInfo>>(emptyList()) }LaunchedEffect(doc.info.generation) { list = vm.attachments(doc) }// the document's own files, as the reference lists them (a comment's file is opened from the comment)val files = list.filter { !it.onPage }PdfSheet(onDismiss = { ctl.sheet = ViewerSheet.None }, maxHeightFraction = 0.7f) {- // the reference sets this title up level with the handle and its back arrow below it- Box(Modifier.fillMaxWidth().height(44.dp)) {- Text(- stringResource(R.string.sheet_attachments), color = c.text, fontSize = 17.sp, fontWeight = FontWeight.SemiBold,- modifier = Modifier.align(Alignment.TopStart).offset(x = 92.dp, y = (-12).dp),- )- BarIcon(LucideIcons.ChevronLeft, stringResource(R.string.common_back), { ctl.sheet = ViewerSheet.More }, modifier = Modifier.align(Alignment.TopStart).offset(x = 3.dp, y = (-5).dp))- }- LazyColumn {+ SheetBackHeader(stringResource(R.string.sheet_attachments), onBack = { ctl.sheet = ViewerSheet.More })+ LazyColumn(Modifier.padding(horizontal = 12.dp).clip(RoundedRectangle(22.dp)).background(cellFill())) {items(files) { a ->- Row(- Modifier.fillMaxWidth().clickable { ctl.sheet = ViewerSheet.None; vm.openAttachment(doc, a.name) }.padding(start = 24.dp, end = 20.dp, top = 16.dp, bottom = 16.dp),- verticalAlignment = Alignment.CenterVertically,- ) {- Icon(LucideIcons.FileText, null, tint = c.icon, modifier = Modifier.size(24.dp))- Spacer(Modifier.width(14.dp))- Text(a.name, color = c.text, fontSize = 16.sp, maxLines = 2, overflow = TextOverflow.Ellipsis, modifier = Modifier.weight(1f))- }+ SheetRow(LucideIcons.FileText, a.name, { ctl.sheet = ViewerSheet.None; vm.openAttachment(doc, a.name) }, tint = Candy.Grape, chevron = true)}}Spacer(Modifier.height(8.dp))@@ -408,19 +486,25 @@ fun pdfDateMillis(s: String?): Long? {return cal.timeInMillis}-/** A tool tile of More tools: a tinted 56 dp rounded square with the tool's icon, its name under it. */+/**+ * A tool tile of More tools, as an app icon on a home screen: the tool's glyph white on a rounded+ * square of its own colour (lighter at the top), its name under it.+ */@Composableprivate fun ToolTile(icon: ImageVector, label: String, tint: Color, modifier: Modifier = Modifier, onClick: () -> Unit) {- val c = pdfColorsColumn(- modifier.clickable(role = Role.Button, onClick = onClick).padding(vertical = 6.dp).semantics { contentDescription = label },+ modifier.pressable(onClick, pressedScale = 0.92f).padding(vertical = 6.dp).semantics { contentDescription = label },horizontalAlignment = Alignment.CenterHorizontally,) {- Box(Modifier.size(56.dp).clip(RoundedCornerShape(6.dp)).background(tileBackground(tint, c.dark)), contentAlignment = Alignment.Center) {- Icon(icon, null, tint = tint, modifier = Modifier.size(30.dp))+ Box(+ Modifier.size(54.dp).clip(RoundedRectangle(16.dp))+ .background(androidx.compose.ui.graphics.Brush.verticalGradient(listOf(androidx.compose.ui.graphics.lerp(tint, Color.White, 0.18f), tint))),+ contentAlignment = Alignment.Center,+ ) {+ Icon(icon, null, tint = Color.White, modifier = Modifier.size(27.dp))}- Spacer(Modifier.height(11.dp))- Text(label, color = c.text, fontSize = 11.sp, textAlign = TextAlign.Center, maxLines = 2, lineHeight = 14.sp, modifier = Modifier.padding(horizontal = 2.dp))+ Spacer(Modifier.height(8.dp))+ Text(label, style = ClearType.Caption.copy(fontSize = 11.sp, lineHeight = 13.sp), color = clear.ink, textAlign = TextAlign.Center, maxLines = 2, modifier = Modifier.padding(horizontal = 2.dp))}}@@ -460,11 +544,12 @@ fun MoreToolsSheet(vm: AppViewModel, doc: OpenDocument) {val slots = toolbarSlots(androidx.compose.ui.platform.LocalConfiguration.current.screenWidthDp)val prefs = vm.quickToolbarval tools = prefs.bar.drop(slots) + prefs.grid- // six to a row in 85 dp columns, as the reference lays them out- androidx.compose.foundation.layout.BoxWithConstraints(Modifier.fillMaxWidth().padding(top = 5.dp)) {- val cell = minOf(85.dp, (maxWidth - 2.dp) / 6)- Column(Modifier.padding(start = 1.dp)) {- tools.chunked(6).forEach { row ->+ // a grid of app-icon tiles: four to a row on a phone, more on wider screens+ androidx.compose.foundation.layout.BoxWithConstraints(Modifier.fillMaxWidth().padding(horizontal = 10.dp, vertical = 2.dp)) {+ val perRow = if (maxWidth >= 560.dp) 6 else if (maxWidth >= 400.dp) 5 else 4+ val cell = maxWidth / perRow+ Column {+ tools.chunked(perRow).forEach { row ->Row(verticalAlignment = Alignment.Top) {row.forEach { t ->ToolTile(t.icon, stringResource(t.title), t.hue, Modifier.width(cell)) {@@ -473,19 +558,17 @@ fun MoreToolsSheet(vm: AppViewModel, doc: OpenDocument) {}}}- Spacer(Modifier.height(17.dp))+ Spacer(Modifier.height(10.dp))}}}- // Customize toolbar: an outlined pill across the sheet- Box(- Modifier.padding(horizontal = 36.dp).fillMaxWidth().height(41.dp).clip(RoundedCornerShape(20.5.dp))- .border(2.dp, pdfColors.divider, RoundedCornerShape(20.5.dp))- .clickable(role = Role.Button) { customizing = true },- contentAlignment = Alignment.Center,+ // Customize toolbar: a plain glass capsule across the sheet+ com.chethan616.clearpdf.ui.glass.GlassPill(+ onClick = { customizing = true }, modifier = Modifier.padding(horizontal = 16.dp).fillMaxWidth(), height = 48.dp,) {- Text(stringResource(R.string.sheet_customize_toolbar), color = pdfColors.text, fontSize = 15.sp, fontWeight = FontWeight.SemiBold)+ Icon(LucideIcons.SlidersHorizontal, null, tint = clear.ink, modifier = Modifier.size(18.dp))+ Text(stringResource(R.string.sheet_customize_toolbar), style = ClearType.BodyStrong, color = clear.ink)}- Spacer(Modifier.height(16.dp))+ Spacer(Modifier.height(12.dp))}}diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/VoiceRecorder.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/VoiceRecorder.ktindex 4d7d443..769fdba 100644--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/VoiceRecorder.kt+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/VoiceRecorder.kt@@ -39,21 +39,23 @@ class VoiceRecorder(private val file: File, private val scope: CoroutineScope) {private setval levels = mutableStateListOf<Float>()private var job: Job? = null+ @Volatile private var stopped = false- /** Start recording; false when the microphone can't be opened (permission, busy). */+ private class Mic(val rec: AudioRecord, val ns: NoiseSuppressor?)++ /** Opens and starts the microphone (slow on some phones: call it off the main thread when you can). */@SuppressLint("MissingPermission") // the caller asks for RECORD_AUDIO first- fun start(): Boolean {- val rate = 16_000- val minBuf = AudioRecord.getMinBufferSize(rate, AudioFormat.CHANNEL_IN_MONO, AudioFormat.ENCODING_PCM_16BIT)- if (minBuf <= 0) return false+ private fun openMic(): Mic? {+ val minBuf = AudioRecord.getMinBufferSize(RATE, AudioFormat.CHANNEL_IN_MONO, AudioFormat.ENCODING_PCM_16BIT)+ if (minBuf <= 0) return nullval rec = try {- AudioRecord(MediaRecorder.AudioSource.MIC, rate, AudioFormat.CHANNEL_IN_MONO, AudioFormat.ENCODING_PCM_16BIT, maxOf(minBuf, rate / 10 * 2))+ AudioRecord(MediaRecorder.AudioSource.MIC, RATE, AudioFormat.CHANNEL_IN_MONO, AudioFormat.ENCODING_PCM_16BIT, maxOf(minBuf, RATE / 10 * 2))} catch (e: Exception) {- return false+ return null}if (rec.state != AudioRecord.STATE_INITIALIZED) {rec.release()- return false+ return null}val ns = if (NoiseSuppressor.isAvailable()) runCatching { NoiseSuppressor.create(rec.audioSessionId)?.apply { enabled = true } }.getOrNull() else nulltry {@@ -61,8 +63,42 @@ class VoiceRecorder(private val file: File, private val scope: CoroutineScope) {} catch (e: Exception) {ns?.release()rec.release()+ return null+ }+ return Mic(rec, ns)+ }++ /** Start recording; false when the microphone can't be opened (permission, busy). */+ fun start(): Boolean {+ stopped = false+ val mic = openMic() ?: return false+ run(mic)+ return true+ }++ /**+ * [start], with the microphone opened on a background thread so the screen never waits for it.+ * False when it can't be opened, or when [stop] came first (the microphone is then let go at once).+ */+ suspend fun startAsync(): Boolean {+ stopped = false+ val mic = withContext(Dispatchers.IO) { openMic() } ?: return false+ if (stopped) {+ withContext(Dispatchers.IO) {+ runCatching { mic.rec.stop() }+ mic.ns?.release()+ mic.rec.release()+ }return false}+ run(mic)+ return true+ }++ private fun run(mic: Mic) {+ val rate = RATE+ val rec = mic.rec+ val ns = mic.nslevels.clear()elapsedMs = 0Lrecording = true@@ -101,17 +137,19 @@ class VoiceRecorder(private val file: File, private val scope: CoroutineScope) {rec.release()}}- return true}/** Stop recording and wait until the file is complete. */suspend fun stop() {+ stopped = truerecording = falsejob?.join()job = null}companion object {+ private const val RATE = 16_000+/** A RIFF/WAVE header for [dataBytes] of 16-bit mono PCM at [rate], at the file's start. */fun writeWavHeader(out: RandomAccessFile, dataBytes: Long, rate: Int) {val len = dataBytes.coerceAtMost(0xFFFF_FFFFL - 36)diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/VoiceSheet.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/VoiceSheet.ktindex af254cf..4c5ca40 100644--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/VoiceSheet.kt+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/VoiceSheet.kt@@ -114,13 +114,14 @@ fun VoiceSheet(vm: AppViewModel, prompt: VoicePrompt) {PdfSheet(onDismiss = ::close, dim = true) {Row(Modifier.fillMaxWidth().padding(start = 20.dp, end = 8.dp), verticalAlignment = Alignment.CenterVertically) {Text(stringResource(R.string.voice_record_comment), color = c.text, fontSize = 17.sp, fontWeight = FontWeight.SemiBold, modifier = Modifier.weight(1f))- TextButton(- onClick = {+ com.chethan616.clearpdf.ui.glass.GlassTextAction(+ stringResource(R.string.common_post),+ {player.release()vm.postVoice(prompt, file)},- enabled = recorded,- ) { Text(stringResource(R.string.common_post), color = if (recorded) c.accent else c.textSecondary, fontWeight = FontWeight.SemiBold) }+ enabled = recorded, primary = true,+ )}Text(when {diff --git a/android/app/src/main/res/anim/preview_open_enter.xml b/android/app/src/main/res/anim/preview_open_enter.xmlnew file mode 100644index 0000000..0e16b63--- /dev/null+++ b/android/app/src/main/res/anim/preview_open_enter.xml@@ -0,0 +1,13 @@+<?xml version="1.0" encoding="utf-8"?>+<!-- The full viewer, coming in over Quick Preview's card: it rises from where the card is while it fades in -->+<set xmlns:android="http://schemas.android.com/apk/res/android"+ android:interpolator="@interpolator/ui_curve">+ <translate+ android:fromYDelta="9%p"+ android:toYDelta="0"+ android:duration="420" />+ <alpha+ android:fromAlpha="0"+ android:toAlpha="1"+ android:duration="300" />+</set>diff --git a/android/app/src/main/res/anim/preview_open_exit.xml b/android/app/src/main/res/anim/preview_open_exit.xmlnew file mode 100644index 0000000..829193d--- /dev/null+++ b/android/app/src/main/res/anim/preview_open_exit.xml@@ -0,0 +1,8 @@+<?xml version="1.0" encoding="utf-8"?>+<!-- Quick Preview's card stays exactly where it is until the viewer has covered it -->+<set xmlns:android="http://schemas.android.com/apk/res/android">+ <alpha+ android:fromAlpha="1"+ android:toAlpha="1"+ android:duration="420" />+</set>diff --git a/android/app/src/main/res/font/bricolage.ttf b/android/app/src/main/res/font/bricolage.ttfnew file mode 100644index 0000000..9a4ca27Binary files /dev/null and b/android/app/src/main/res/font/bricolage.ttf differdiff --git a/android/app/src/main/res/font/fraunces.ttf b/android/app/src/main/res/font/fraunces.ttfnew file mode 100644index 0000000..8210f94Binary files /dev/null and b/android/app/src/main/res/font/fraunces.ttf differdiff --git a/android/app/src/main/res/interpolator/ui_curve.xml b/android/app/src/main/res/interpolator/ui_curve.xmlnew file mode 100644index 0000000..e817851--- /dev/null+++ b/android/app/src/main/res/interpolator/ui_curve.xml@@ -0,0 +1,7 @@+<?xml version="1.0" encoding="utf-8"?>+<!-- UIKit's sheet curve, cubic-bezier(0.32, 0.72, 0, 1): fast off the mark, long soft landing -->+<pathInterpolator xmlns:android="http://schemas.android.com/apk/res/android"+ android:controlX1="0.32"+ android:controlY1="0.72"+ android:controlX2="0"+ android:controlY2="1" />diff --git a/android/app/src/main/res/values-ar/strings.xml b/android/app/src/main/res/values-ar/strings.xmlindex 34da813..1a1de45 100644--- a/android/app/src/main/res/values-ar/strings.xml+++ b/android/app/src/main/res/values-ar/strings.xml@@ -790,7 +790,7 @@<string name="settings_glass_frosted">مُصنفَر</string><string name="settings_glass_crystal">كريستال</string><string name="settings_glass_lite">خفيف</string>- <string name="settings_motion">الحركة</string>+ <string name="settings_motion">حركة الأزرار</string><string name="settings_motion_calm">هادئة</string><string name="settings_motion_normal">عادية</string><string name="settings_motion_bouncy">نطّاطة</string>@@ -847,6 +847,11 @@<string name="notes_pin">تثبيت في الأعلى</string><string name="notes_unpin">إلغاء التثبيت</string><string name="notes_open">فتح</string>+ <string name="notes_rename">إعادة التسمية</string>+ <string name="voice_note">ملاحظة صوتية</string>+ <string name="voice_name_title">سمِّ هذه الملاحظة الصوتية</string>+ <string name="voice_name_hint">الاسم</string>+ <string name="voice_name_it">تسميتها</string><string name="notes_title_hint">العنوان</string><string name="notes_list_title_hint">اسم القائمة</string><string name="notes_body_hint">انقر هنا للمتابعة…</string>@@ -907,4 +912,69 @@</plurals><string name="settings_quick_preview">معاينة سريعة</string><string name="settings_quick_preview_body">تظهر الملفات التي تفتحها تطبيقات أخرى أولًا في بطاقة عائمة فوقها</string>+ <string name="thought_title">فكرة اليوم</string>+ <string-array name="thought_quotes">+ <item>احتضن اللحظة ودع روحك تحلّق.</item>+ <item>الخطوات الصغيرة تأخذك إلى مكان ما.</item>+ <item>ابدأ من حيث أنت.</item>+ <item>ارفق بنفسك اليوم.</item>+ <item>الفضول شكل من أشكال الشجاعة.</item>+ <item>أنجز أمرًا كنت تؤجله.</item>+ <item>في الهدوء تنمو الأفكار.</item>+ <item>من حقك أن تغيّر رأيك.</item>+ <item>اللطف لا يكلّف شيئًا ويصل بعيدًا.</item>+ <item>اترك ما لا تستطيع حمله.</item>+ <item>اليوم صفحة بيضاء.</item>+ <item>التركيز شكل من أشكال الحرية.</item>+ <item>افسح مكانًا للفرح.</item>+ <item>وتيرتك هي الوتيرة الصحيحة.</item>+ <item>الأخطاء دليل على أنك تحاول.</item>+ <item>استمع أكثر مما تتكلم.</item>+ <item>الامتنان يحوّل الكفاف إلى وفرة.</item>+ <item>دوّنه قبل أن يفلت.</item>+ <item>الشجاعة أن تشعر بالخوف وتمضي رغم ذلك.</item>+ <item>لا شيء ينمو دون قليل من الصبر.</item>+ <item>اختر التقدّم لا الكمال.</item>+ <item>أجمل إطلالة تأتي بعد الصعود.</item>+ <item>ارفع نظرك عن الشاشة لحظة.</item>+ <item>لقد تجاوزت أيامًا صعبة من قبل.</item>+ <item>شارك ما تعرفه.</item>+ <item>اصرف وقتك على ما يبقى.</item>+ <item>ابدأ قبل أن تشعر بالاستعداد.</item>+ <item>فليكن اليوم بسيطًا.</item>+ <item>كن الهدوء في الغرفة.</item>+ <item>اصنع شيئًا، مهما كان صغيرًا.</item>+ </string-array>+ <string-array name="thought_reflections">+ <item>كل يوم بداية جديدة. استقبله **بالأمل والشجاعة**، ودع كل لحظة تلهمك لتنمو وتتألق **أكثر** من قبل.</item>+ <item>لا تحتاج اليوم إلى السلّم كله. خُذ **خطوة صغيرة**، ثم أخرى، وثق بأن **التقدّم** يتراكم.</item>+ <item>نادرًا ما تأتي الظروف المثالية. ابدأ بما لديك، **الآن**، ودع الباقي **يجد طريقه** إليك.</item>+ <item>الراحة ليست مكافأة على الإنجاز، بل جزء من العمل. **تنفّس ببطء**، واشرب بعض الماء، ودع اليوم يكون **كافيًا**.</item>+ <item>اطرح السؤال الذي كنت تؤجله. **الدهشة** تفتح أبوابًا أكثر مما تفعل اليقينيات.</item>+ <item>هذه المهمة الصغيرة أثقل في رأسك منها في يديك. أنهِها و**اشعر بالخفة** التي تأتي بعدها.</item>+ <item>ابتعد عن الضجيج بضع دقائق. غالبًا ما تأتيك **أفضل أفكارك** حين تكفّ عن ملاحقتها.</item>+ <item>النمو يعني **تجاوز** الخطط القديمة. اختر من جديد، **دون اعتذار**، وواصل السير.</item>+ <item>كلمة طيبة قد تكون **أجمل ما في أسبوع** شخص ما. قدّمها بسخاء وشاهدها **تعود إليك**.</item>+ <item>ليس كل همّ يستحق مكانًا في يومك. ضع ما ليس لك و**تمسّك** بما **يهمّ**.</item>+ <item>الأمس كُتب أما الغد فلا. املأ هذه الصفحة بـ**شيء يهمّك**، ولو كان سطرًا واحدًا.</item>+ <item>اختر **أمرًا واحدًا** وامنحه كامل انتباهك. العالم سينتظر، وأنت **ستتقنه أكثر**.</item>+ <item>الفرح لا يحتاج إلى سبب ولا مناسبة. لاحظ **الأشياء الجميلة الصغيرة**: ضوءًا دافئًا، ضحكة، أغنية جميلة، و**ابقَ معها لحظة**.</item>+ <item>المقارنة تسرق الفرح من طريقك. استمر **بالسرعة التي تستطيع المحافظة عليها** وستصل.</item>+ <item>كل عثرة تعلّم ما لا يعلّمه طريق أملس. **تعلّم منها**، واشكرها، و**حاول من جديد**.</item>+ <item>الفهم يبدأ بـ**الانتباه**. اسأل، وانتظر، واسمع الجواب حقًا.</item>+ <item>سمِّ ثلاثة أشياء **أنت ممتنّ لها** الآن. لاحظ كيف يبدو اليوم **مختلفًا** بعد ذلك.</item>+ <item>الفكرة على الورق فكرة يمكنك **العودة إليها**. التقطها الآن و**شكّلها لاحقًا**.</item>+ <item>الخوف ليس إشارة توقف، بل **علامة على أن الأمر مهم**. خُذ الخطوة التالية **ومعك الخوف**.</item>+ <item>البذور لا تستعجل، وأنت كذلك. **واصل رعاية** ما يهمك و**ثق بالموسم**.</item>+ <item>المنجز غير الكامل خير من الكامل غير المنجز. **سلّم المسوّدة** ثم حسّنها.</item>+ <item>المقطع الصعب **يبني القوة** لما هو آتٍ. أبقِ عينيك على **الأفق**.</item>+ <item>الغرفة والنافذة والسماء: **كلها ما زالت هنا**. امنح عينيك وذهنك **استراحة قصيرة وحقيقية**.</item>+ <item>تذكّر الأيام التي عبرتها. أنت **أقدر** مما يقوله قلق اليوم، و**غدًا** فرصة أخرى.</item>+ <item>خبرتك **اختصار** للطريق على غيرك. علّم أو اشرح أو **قلها بصوت عالٍ** فحسب؛ فهي تفيدك أنت أيضًا.</item>+ <item>الانتباه هو **أثمن ما تملك**. امنحه **لأشخاص وأعمال** سيظل لها معنى في العام القادم.</item>+ <item>الاستعداد غالبًا **شعور يلي الفعل**، لا يسبقه. **ابدأ** ودع الثقة تلحق بك.</item>+ <item>ليس كل شيء بحاجة إلى تحسين. أنجز **القليل بإتقان**، واترك مساحة حوله، وسمِّه **يومًا جيدًا**.</item>+ <item>لا تستطيع التحكم في كل موجة، لكنك تستطيع **اختيار كيف تواجهها**. النفَس الهادئ **معدٍ**.</item>+ <item>جملة، رسمة، رفّ مرتّب. **الإبداع** يذكّرك بأنك تستطيع **تغيير العالم من حولك**، ولو قليلًا.</item>+ </string-array></resources>diff --git a/android/app/src/main/res/values-de/strings.xml b/android/app/src/main/res/values-de/strings.xmlindex 7db2684..c2058f9 100644--- a/android/app/src/main/res/values-de/strings.xml+++ b/android/app/src/main/res/values-de/strings.xml@@ -1152,7 +1152,7 @@<string name="settings_glass_frosted">Milchig</string><string name="settings_glass_crystal">Kristall</string><string name="settings_glass_lite">Leicht</string>- <string name="settings_motion">Bewegung</string>+ <string name="settings_motion">Bewegung der Tasten</string><string name="settings_motion_calm">Ruhig</string><string name="settings_motion_normal">Normal</string><string name="settings_motion_bouncy">Federnd</string>@@ -1205,6 +1205,11 @@<string name="notes_pin">Oben anheften</string><string name="notes_unpin">Lösen</string><string name="notes_open">Öffnen</string>+ <string name="notes_rename">Umbenennen</string>+ <string name="voice_note">Sprachnotiz</string>+ <string name="voice_name_title">Sprachnotiz benennen</string>+ <string name="voice_name_hint">Name</string>+ <string name="voice_name_it">Benennen</string><string name="notes_title_hint">Titel</string><string name="notes_list_title_hint">Name der Liste</string><string name="notes_body_hint">Hier tippen, um weiterzuschreiben…</string>@@ -1261,4 +1266,69 @@</plurals><string name="settings_quick_preview">Schnellansicht</string><string name="settings_quick_preview_body">Dateien, die andere Apps öffnen, erscheinen zuerst in einer schwebenden Karte darüber</string>+ <string name="thought_title">Gedanke des Tages</string>+ <string-array name="thought_quotes">+ <item>Genieße den Augenblick und lass deinen Geist fliegen.</item>+ <item>Kleine Schritte führen auch irgendwohin.</item>+ <item>Fang dort an, wo du gerade bist.</item>+ <item>Sei heute freundlich zu dir.</item>+ <item>Neugier ist eine Form von Mut.</item>+ <item>Erledige eine Sache, die du aufgeschoben hast.</item>+ <item>In der Stille wachsen Ideen.</item>+ <item>Du darfst deine Meinung ändern.</item>+ <item>Freundlichkeit kostet nichts und reicht weit.</item>+ <item>Lass los, was du nicht tragen kannst.</item>+ <item>Heute ist ein leeres Blatt.</item>+ <item>Fokus ist eine Form von Freiheit.</item>+ <item>Schaffe Platz für Freude.</item>+ <item>Dein Tempo ist das richtige Tempo.</item>+ <item>Fehler beweisen, dass du es versuchst.</item>+ <item>Hör mehr zu, als du sprichst.</item>+ <item>Dankbarkeit macht aus genug reichlich.</item>+ <item>Schreib es auf, bevor es entwischt.</item>+ <item>Mut heißt, es zu fühlen und trotzdem zu gehen.</item>+ <item>Ohne etwas Geduld wächst nichts.</item>+ <item>Wähle Fortschritt statt Perfektion.</item>+ <item>Die schönste Aussicht kommt nach dem Aufstieg.</item>+ <item>Schau kurz vom Bildschirm auf.</item>+ <item>Du hast schon schwere Tage gemeistert.</item>+ <item>Teile, was du weißt.</item>+ <item>Verbringe Zeit mit dem, was bleibt.</item>+ <item>Fang an, bevor du dich bereit fühlst.</item>+ <item>Lass den Tag einfach sein.</item>+ <item>Sei die Ruhe im Raum.</item>+ <item>Erschaffe etwas, und sei es noch so klein.</item>+ </string-array>+ <string-array name="thought_reflections">+ <item>Jeder Tag ist ein Neuanfang. Begegne ihm mit **Hoffnung und Mut** und lass dich von jedem Moment inspirieren, zu wachsen und **heller** zu strahlen als zuvor.</item>+ <item>Du brauchst heute nicht die ganze Treppe. Geh **einen kleinen Schritt**, dann den nächsten, und vertraue darauf, dass sich **Fortschritt** summiert.</item>+ <item>Perfekte Bedingungen kommen selten. Beginne mit dem, was du hast, **jetzt gleich**, und lass den Rest **zu dir finden**.</item>+ <item>Ruhe ist keine Belohnung fürs Fertigwerden, sie gehört zur Arbeit. **Atme langsam**, trink etwas Wasser und lass den Tag **genug** sein.</item>+ <item>Stell die Frage, die du zurückgehalten hast. **Staunen** öffnet mehr Türen, als Gewissheit es je tut.</item>+ <item>Die kleine Aufgabe wiegt im Kopf mehr als in den Händen. Bring sie hinter dich und **spür die Leichtigkeit**, die danach kommt.</item>+ <item>Geh ein paar Minuten weg vom Lärm. Deine **besten Gedanken** kommen oft dann, wenn du aufhörst, ihnen nachzujagen.</item>+ <item>Wachsen heißt, alten Plänen **zu entwachsen**. Entscheide dich neu, **ohne dich zu entschuldigen**, und geh weiter.</item>+ <item>Ein nettes Wort kann für jemanden **das Schönste der Woche** sein. Schenke es großzügig und sieh zu, wie es **zu dir zurückkommt**.</item>+ <item>Nicht jede Sorge verdient einen Platz in deinem Tag. Leg ab, was nicht deins ist, und **halte fest**, was **zählt**.</item>+ <item>Gestern ist geschrieben, morgen noch nicht. Füll dieses Blatt mit **etwas, das dir wichtig ist**, und sei es nur eine Zeile.</item>+ <item>Wähle **eine Sache** und gib ihr deine ganze Aufmerksamkeit. Die Welt wartet, und du **machst es besser**.</item>+ <item>Freude braucht keinen Grund und keinen Anlass. Bemerke die **kleinen guten Dinge**: warmes Licht, ein Lachen, ein gutes Lied, und **bleib einen Moment dabei**.</item>+ <item>Vergleichen nimmt dem eigenen Weg die Freude. Geh in dem **Tempo, das du durchhalten kannst**, und du wirst **ankommen**.</item>+ <item>Jeder Stolperer lehrt etwas, das ein glatter Weg nicht kann. **Lerne daraus**, danke ihm und **versuch es noch einmal**.</item>+ <item>Verstehen beginnt mit **Aufmerksamkeit**. Frag, warte und hör die Antwort wirklich.</item>+ <item>Nenne drei Dinge, **für die du dankbar bist**. Spür, wie sich der Tag danach **anders** anfühlt.</item>+ <item>Ein Gedanke auf Papier ist einer, zu dem du **zurückkehren kannst**. Halte ihn jetzt fest und **forme ihn später**.</item>+ <item>Angst ist kein Stoppschild, nur ein **Zeichen, dass es wichtig ist**. Mach den nächsten Schritt **mit ihr an deiner Seite**.</item>+ <item>Samen haben es nicht eilig, und du musst es auch nicht. **Pflege weiter**, was dir wichtig ist, und **vertraue der Jahreszeit**.</item>+ <item>Fertig und unperfekt schlägt perfekt und unvollendet. **Schick den Entwurf los** und mach ihn dann besser.</item>+ <item>Das harte Stück **baut die Kraft auf** für das, was kommt. Behalte **den Horizont** im Blick.</item>+ <item>Der Raum, das Fenster, der Himmel: **alles ist noch da**. Gönn Augen und Kopf eine **kurze, echte Pause**.</item>+ <item>Denk an die, die du überstanden hast. Du bist **fähiger**, als die Sorge von heute sagt, und **morgen** ist eine neue Chance.</item>+ <item>Deine Erfahrung ist für jemand anderen eine **Abkürzung**. Bring es bei, erkläre es oder **sag es einfach laut**; es hilft auch dir.</item>+ <item>Aufmerksamkeit ist das **Wertvollste**, was du hast. Schenke sie **Menschen und Arbeit**, die auch nächstes Jahr noch zählen.</item>+ <item>Bereitschaft ist meist ein **Gefühl, das dem Tun folgt**, nicht vorausgeht. **Beginne**, und lass die Zuversicht nachkommen.</item>+ <item>Nicht alles muss optimiert werden. Mach **wenige Dinge gut**, lass Raum drumherum und nenn das einen **guten Tag**.</item>+ <item>Du kannst nicht jede Welle kontrollieren, aber du kannst **wählen, wie du ihr begegnest**. Ein ruhiger Atem ist **ansteckend**.</item>+ <item>Ein Satz, eine Skizze, ein aufgeräumtes Regal. **Erschaffen** erinnert dich daran, dass du **die Welt um dich** verändern kannst, auch nur ein wenig.</item>+ </string-array></resources>diff --git a/android/app/src/main/res/values-es/strings.xml b/android/app/src/main/res/values-es/strings.xmlindex cd47f58..fbfa622 100644--- a/android/app/src/main/res/values-es/strings.xml+++ b/android/app/src/main/res/values-es/strings.xml@@ -1160,7 +1160,7 @@<string name="settings_glass_frosted">Esmerilado</string><string name="settings_glass_crystal">Cristalino</string><string name="settings_glass_lite">Ligero</string>- <string name="settings_motion">Movimiento</string>+ <string name="settings_motion">Movimiento de los botones</string><string name="settings_motion_calm">Tranquilo</string><string name="settings_motion_normal">Normal</string><string name="settings_motion_bouncy">Rebote</string>@@ -1213,6 +1213,11 @@<string name="notes_pin">Fijar arriba</string><string name="notes_unpin">No fijar</string><string name="notes_open">Abrir</string>+ <string name="notes_rename">Cambiar nombre</string>+ <string name="voice_note">Nota de voz</string>+ <string name="voice_name_title">Ponle nombre a la nota de voz</string>+ <string name="voice_name_hint">Nombre</string>+ <string name="voice_name_it">Ponerle nombre</string><string name="notes_title_hint">Título</string><string name="notes_list_title_hint">Nombre de la lista</string><string name="notes_body_hint">Toca aquí para seguir…</string>@@ -1269,4 +1274,69 @@</plurals><string name="settings_quick_preview">Vista rápida</string><string name="settings_quick_preview_body">Los archivos que abren otras apps se muestran primero en una tarjeta flotante sobre ellas</string>+ <string name="thought_title">Pensamiento del día</string>+ <string-array name="thought_quotes">+ <item>Abraza el momento y deja que tu espíritu vuele.</item>+ <item>Los pasos pequeños también llevan a algún sitio.</item>+ <item>Empieza donde estás.</item>+ <item>Sé amable contigo hoy.</item>+ <item>La curiosidad es una forma de valentía.</item>+ <item>Haz esa cosa que vienes posponiendo.</item>+ <item>En el silencio crecen las ideas.</item>+ <item>Tienes derecho a cambiar de opinión.</item>+ <item>La amabilidad no cuesta nada y llega lejos.</item>+ <item>Suelta lo que no puedes cargar.</item>+ <item>Hoy es una página en blanco.</item>+ <item>Concentrarse es una forma de libertad.</item>+ <item>Haz espacio para la alegría.</item>+ <item>Tu ritmo es el ritmo correcto.</item>+ <item>Los errores prueban que lo intentas.</item>+ <item>Escucha más de lo que hablas.</item>+ <item>La gratitud convierte lo suficiente en abundante.</item>+ <item>Anótalo antes de que se te escape.</item>+ <item>Valentía es sentirlo y seguir adelante.</item>+ <item>Nada crece sin un poco de paciencia.</item>+ <item>Elige el progreso antes que la perfección.</item>+ <item>La mejor vista llega después de la subida.</item>+ <item>Levanta la vista de la pantalla un momento.</item>+ <item>Ya has superado días difíciles.</item>+ <item>Comparte lo que sabes.</item>+ <item>Dedica tiempo a lo que perdura.</item>+ <item>Empieza antes de tenerlo todo claro.</item>+ <item>Que hoy sea sencillo.</item>+ <item>Sé la calma de la sala.</item>+ <item>Crea algo, por pequeño que sea.</item>+ </string-array>+ <string-array name="thought_reflections">+ <item>Cada día es un nuevo comienzo. Recíbelo con **esperanza y valor**, y deja que cada momento te inspire a crecer y brillar **más** que antes.</item>+ <item>Hoy no necesitas toda la escalera. Da **un pequeño paso**, luego otro, y confía en que el **progreso** se acumula.</item>+ <item>Las condiciones perfectas rara vez llegan. Empieza con lo que tienes, **ahora mismo**, y deja que lo demás **te encuentre**.</item>+ <item>Descansar no es un premio por terminar, es parte del trabajo. **Respira despacio**, bebe un poco de agua y deja que hoy sea **suficiente**.</item>+ <item>Haz la pregunta que te has guardado. **Asombrarse** abre más puertas que la certeza.</item>+ <item>Esa tarea pequeña pesa más en tu cabeza que en tus manos. Termínala y **siente la ligereza** que viene después.</item>+ <item>Aléjate del ruido unos minutos. Tus **mejores ideas** suelen llegar cuando dejas de perseguirlas.</item>+ <item>Crecer es **dejar atrás** los planes viejos. Elige de nuevo, **sin pedir perdón**, y sigue caminando.</item>+ <item>Una palabra amable puede ser **lo mejor de la semana** de alguien. Ofrécela sin miedo y verás cómo **te regresa**.</item>+ <item>No toda preocupación merece un lugar en tu día. Deja lo que no es tuyo y **quédate** con lo que **importa**.</item>+ <item>Ayer está escrito y mañana no. Llena esta página con **algo que te importe**, aunque sea una sola línea.</item>+ <item>Elige **una sola cosa** y dale toda tu atención. El mundo esperará y lo **harás mejor**.</item>+ <item>La alegría no necesita motivo ni ocasión. Fíjate en las **pequeñas cosas buenas**: una luz cálida, una risa, una buena canción, y **quédate un momento** con ellas.</item>+ <item>Compararte le quita la alegría a tu propio camino. Sigue al **ritmo que puedas sostener** y **llegarás**.</item>+ <item>Cada tropiezo enseña lo que un camino liso no puede. **Aprende de él**, agradécelo y **vuelve a intentarlo**.</item>+ <item>Entender empieza con la **atención**. Pregunta, espera y escucha de verdad la respuesta.</item>+ <item>Nombra tres cosas por las que **das gracias** ahora mismo. Fíjate en cómo se siente el día **de otra manera** después.</item>+ <item>Un pensamiento en papel es uno al que puedes **volver**. Captúralo ahora y **dale forma después**.</item>+ <item>El miedo no es una señal de alto, solo **una señal de que esto importa**. Da el siguiente paso **con él a tu lado**.</item>+ <item>Las semillas no tienen prisa, y tú tampoco. **Sigue cuidando** lo que te importa y **confía en la estación**.</item>+ <item>Terminado e imperfecto vale más que perfecto e inacabado. **Entrega el borrador** y luego mejóralo.</item>+ <item>El tramo difícil **forja la fuerza** para lo que viene. Mantén los ojos en **el horizonte**.</item>+ <item>La habitación, la ventana, el cielo: **siguen ahí**. Dale a tus ojos y a tu mente un **descanso breve y real**.</item>+ <item>Recuerda los que atravesaste. Eres **más capaz** de lo que dice la preocupación de hoy, y **mañana** es otra oportunidad.</item>+ <item>Tu experiencia es un **atajo** para otra persona. Enseña, explica o simplemente **dilo en voz alta**; también te ayuda a ti.</item>+ <item>La atención es lo **más valioso** que tienes. Dásela a las **personas y al trabajo** que seguirán importando el año que viene.</item>+ <item>La seguridad suele ser un **sentimiento que sigue a la acción**, no uno que la precede. **Empieza** y deja que la confianza te alcance.</item>+ <item>No todo tiene que optimizarse. Haz **pocas cosas bien**, deja espacio alrededor y llámalo un **buen día**.</item>+ <item>No puedes controlar cada ola, pero sí **elegir cómo recibirla**. Una respiración serena es **contagiosa**.</item>+ <item>Una frase, un boceto, una estantería ordenada. **Crear** te recuerda que puedes **cambiar el mundo a tu alrededor**, aunque sea un poco.</item>+ </string-array></resources>diff --git a/android/app/src/main/res/values-fr/strings.xml b/android/app/src/main/res/values-fr/strings.xmlindex 8054381..f5f6384 100644--- a/android/app/src/main/res/values-fr/strings.xml+++ b/android/app/src/main/res/values-fr/strings.xml@@ -1032,7 +1032,7 @@<string name="settings_glass_frosted">Dépoli</string><string name="settings_glass_crystal">Cristal</string><string name="settings_glass_lite">Léger</string>- <string name="settings_motion">Mouvement</string>+ <string name="settings_motion">Mouvement des boutons</string><string name="settings_motion_calm">Calme</string><string name="settings_motion_normal">Normal</string><string name="settings_motion_bouncy">Rebondissant</string>@@ -1085,6 +1085,11 @@<string name="notes_pin">Épingler en haut</string><string name="notes_unpin">Désépingler</string><string name="notes_open">Ouvrir</string>+ <string name="notes_rename">Renommer</string>+ <string name="voice_note">Note vocale</string>+ <string name="voice_name_title">Nommer la note vocale</string>+ <string name="voice_name_hint">Nom</string>+ <string name="voice_name_it">Nommer</string><string name="notes_title_hint">Titre</string><string name="notes_list_title_hint">Nom de la liste</string><string name="notes_body_hint">Touchez ici pour continuer…</string>@@ -1141,4 +1146,69 @@</plurals><string name="settings_quick_preview">Aperçu rapide</string><string name="settings_quick_preview_body">Les fichiers ouverts par d\'autres apps s\'affichent d\'abord dans une carte flottante au-dessus</string>+ <string name="thought_title">Pensée du jour</string>+ <string-array name="thought_quotes">+ <item>Savourez l\'instant et laissez votre esprit s\'envoler.</item>+ <item>Les petits pas mènent aussi quelque part.</item>+ <item>Commencez là où vous êtes.</item>+ <item>Prenez soin de vous aujourd\'hui.</item>+ <item>La curiosité est une forme de courage.</item>+ <item>Faites enfin cette chose remise à plus tard.</item>+ <item>C\'est dans le calme que naissent les idées.</item>+ <item>Vous avez le droit de changer d\'avis.</item>+ <item>La gentillesse ne coûte rien et va loin.</item>+ <item>Lâchez ce que vous ne pouvez pas porter.</item>+ <item>Aujourd\'hui est une page blanche.</item>+ <item>La concentration est une forme de liberté.</item>+ <item>Faites de la place à la joie.</item>+ <item>Votre rythme est le bon rythme.</item>+ <item>Les erreurs prouvent que vous essayez.</item>+ <item>Écoutez plus que vous ne parlez.</item>+ <item>La gratitude transforme le suffisant en abondance.</item>+ <item>Notez-le avant qu\'il ne s\'efface.</item>+ <item>Le courage, c\'est ressentir la peur et avancer quand même.</item>+ <item>Rien ne pousse sans un peu de patience.</item>+ <item>Choisissez le progrès plutôt que la perfection.</item>+ <item>La plus belle vue vient après la montée.</item>+ <item>Levez les yeux de l\'écran un instant.</item>+ <item>Vous avez déjà traversé des jours difficiles.</item>+ <item>Partagez ce que vous savez.</item>+ <item>Consacrez du temps à ce qui dure.</item>+ <item>Commencez avant que tout soit clair.</item>+ <item>Que la journée soit simple.</item>+ <item>Soyez le calme de la pièce.</item>+ <item>Créez quelque chose, même de minuscule.</item>+ </string-array>+ <string-array name="thought_reflections">+ <item>Chaque jour est un nouveau départ. Accueillez-le avec **espoir et courage**, et laissez chaque instant vous inspirer à grandir et à briller **plus fort** qu\'avant.</item>+ <item>Vous n\'avez pas besoin de tout l\'escalier aujourd\'hui. Faites **un petit pas**, puis un autre, et faites confiance au **progrès** qui s\'accumule.</item>+ <item>Les conditions parfaites arrivent rarement. Partez de ce que vous avez, **dès maintenant**, et laissez le reste **venir à vous**.</item>+ <item>Se reposer n\'est pas une récompense, cela fait partie du travail. **Respirez lentement**, buvez un peu d\'eau et laissez cette journée être **suffisante**.</item>+ <item>Posez la question que vous retenez. **S\'émerveiller** ouvre plus de portes que les certitudes.</item>+ <item>Cette petite tâche pèse plus lourd dans votre tête que dans vos mains. Terminez-la et **ressentez la légèreté** qui suit.</item>+ <item>Éloignez-vous du bruit quelques minutes. Vos **meilleures idées** arrivent souvent quand vous cessez de les poursuivre.</item>+ <item>Grandir, c\'est **dépasser** d\'anciens projets. Choisissez à nouveau, **sans vous excuser**, et continuez d\'avancer.</item>+ <item>Un mot gentil peut être **le meilleur moment de la semaine** de quelqu\'un. Offrez-le sans compter et voyez-le **vous revenir**.</item>+ <item>Toute inquiétude ne mérite pas une place dans votre journée. Posez ce qui n\'est pas à vous et **gardez** ce qui **compte**.</item>+ <item>Hier est écrit, demain ne l\'est pas. Remplissez cette page de **quelque chose qui vous tient à cœur**, même d\'une seule ligne.</item>+ <item>Choisissez **une seule chose** et donnez-lui toute votre attention. Le monde attendra, et vous le **ferez mieux**.</item>+ <item>La joie n\'a besoin ni de raison ni d\'occasion. Remarquez les **petites bonnes choses** : une lumière chaude, un rire, une bonne chanson, et **restez-y un instant**.</item>+ <item>Se comparer vole la joie de son propre chemin. Avancez **au rythme que vous pouvez tenir** et vous **y arriverez**.</item>+ <item>Chaque faux pas enseigne ce qu\'un chemin lisse ne peut pas. **Apprenez-en**, remerciez-le et **réessayez**.</item>+ <item>Comprendre commence par l\'**attention**. Demandez, attendez et écoutez vraiment la réponse.</item>+ <item>Nommez trois choses pour lesquelles vous dites **merci** maintenant. Voyez comme la journée semble **différente** ensuite.</item>+ <item>Une pensée sur le papier est une pensée à laquelle vous pouvez **revenir**. Saisissez-la maintenant et **façonnez-la plus tard**.</item>+ <item>La peur n\'est pas un panneau stop, seulement **le signe que cela compte**. Faites le prochain pas **avec elle à vos côtés**.</item>+ <item>Les graines ne se pressent pas, et vous non plus. **Continuez de prendre soin** de ce qui vous tient à cœur et **faites confiance à la saison**.</item>+ <item>Fait et imparfait vaut mieux que parfait et inachevé. **Livrez le brouillon**, puis améliorez-le.</item>+ <item>Le passage difficile **forge la force** pour ce qui vient. Gardez les yeux sur **l\'horizon**.</item>+ <item>La pièce, la fenêtre, le ciel : **tout est toujours là**. Offrez à vos yeux et à votre esprit **une vraie courte pause**.</item>+ <item>Souvenez-vous de ceux que vous avez surmontés. Vous avez **plus de ressources** que ne le dit l\'inquiétude du jour, et **demain** est une autre chance.</item>+ <item>Votre expérience est un **raccourci** pour quelqu\'un d\'autre. Enseignez, expliquez ou **dites-le simplement à voix haute** ; cela vous aide aussi.</item>+ <item>L\'attention est ce que vous avez de **plus précieux**. Donnez-la aux **personnes et au travail** qui compteront encore l\'an prochain.</item>+ <item>La confiance est souvent un **sentiment qui suit l\'action**, non un sentiment qui la précède. **Lancez-vous** et laissez l\'assurance vous rattraper.</item>+ <item>Tout n\'a pas besoin d\'être optimisé. Faites **peu de choses, mais bien**, laissez de l\'air autour et appelez cela une **bonne journée**.</item>+ <item>Vous ne contrôlez pas chaque vague, mais vous pouvez **choisir comment l\'accueillir**. Une respiration posée est **contagieuse**.</item>+ <item>Une phrase, un croquis, une étagère rangée. **Créer** vous rappelle que vous pouvez **changer le monde autour de vous**, même un peu.</item>+ </string-array></resources>diff --git a/android/app/src/main/res/values-it/strings.xml b/android/app/src/main/res/values-it/strings.xmlindex 61ca1c6..a0a1550 100644--- a/android/app/src/main/res/values-it/strings.xml+++ b/android/app/src/main/res/values-it/strings.xml@@ -1142,7 +1142,7 @@<string name="settings_glass_frosted">Satinato</string><string name="settings_glass_crystal">Cristallo</string><string name="settings_glass_lite">Leggero</string>- <string name="settings_motion">Movimento</string>+ <string name="settings_motion">Movimento dei pulsanti</string><string name="settings_motion_calm">Calmo</string><string name="settings_motion_normal">Normale</string><string name="settings_motion_bouncy">Rimbalzante</string>@@ -1195,6 +1195,11 @@<string name="notes_pin">Fissa in alto</string><string name="notes_unpin">Sblocca</string><string name="notes_open">Apri</string>+ <string name="notes_rename">Rinomina</string>+ <string name="voice_note">Nota vocale</string>+ <string name="voice_name_title">Dai un nome alla nota vocale</string>+ <string name="voice_name_hint">Nome</string>+ <string name="voice_name_it">Dai un nome</string><string name="notes_title_hint">Titolo</string><string name="notes_list_title_hint">Nome della lista</string><string name="notes_body_hint">Tocca qui per continuare…</string>@@ -1251,4 +1256,69 @@</plurals><string name="settings_quick_preview">Anteprima rapida</string><string name="settings_quick_preview_body">I file aperti da altre app compaiono prima in una scheda fluttuante sopra di esse</string>+ <string name="thought_title">Pensiero del giorno</string>+ <string-array name="thought_quotes">+ <item>Abbraccia il momento e lascia che il tuo spirito voli.</item>+ <item>Anche i piccoli passi portano da qualche parte.</item>+ <item>Parti da dove sei.</item>+ <item>Abbi cura di te oggi.</item>+ <item>La curiosità è una forma di coraggio.</item>+ <item>Fai quella cosa che rimandi da tempo.</item>+ <item>Le idee crescono nel silenzio.</item>+ <item>Puoi cambiare idea.</item>+ <item>La gentilezza non costa nulla e arriva lontano.</item>+ <item>Lascia andare ciò che non puoi portare.</item>+ <item>Oggi è una pagina bianca.</item>+ <item>La concentrazione è una forma di libertà.</item>+ <item>Fai spazio alla gioia.</item>+ <item>Il tuo ritmo è il ritmo giusto.</item>+ <item>Gli errori dimostrano che ci stai provando.</item>+ <item>Ascolta più di quanto parli.</item>+ <item>La gratitudine trasforma il sufficiente in abbondanza.</item>+ <item>Scrivilo prima che sfugga.</item>+ <item>Coraggio è sentire la paura e andare avanti lo stesso.</item>+ <item>Niente cresce senza un po\' di pazienza.</item>+ <item>Scegli il progresso al posto della perfezione.</item>+ <item>La vista più bella arriva dopo la salita.</item>+ <item>Alza lo sguardo dallo schermo per un momento.</item>+ <item>Hai già affrontato giorni difficili.</item>+ <item>Condividi ciò che sai.</item>+ <item>Dedica tempo a ciò che dura.</item>+ <item>Comincia prima che sia tutto chiaro.</item>+ <item>Che oggi sia semplice.</item>+ <item>Sii la calma nella stanza.</item>+ <item>Crea qualcosa, per quanto piccolo.</item>+ </string-array>+ <string-array name="thought_reflections">+ <item>Ogni giorno è un nuovo inizio. Accoglilo con **speranza e coraggio**, e lascia che ogni momento ti ispiri a crescere e a brillare **più** di prima.</item>+ <item>Oggi non ti serve tutta la scala. Fai **un piccolo passo**, poi un altro, e fidati che il **progresso** si accumula.</item>+ <item>Le condizioni perfette arrivano di rado. Comincia con ciò che hai, **proprio ora**, e lascia che il resto **ti trovi**.</item>+ <item>Riposare non è un premio per aver finito, fa parte del lavoro. **Respira piano**, bevi un po\' d\'acqua e lascia che oggi sia **abbastanza**.</item>+ <item>Fai la domanda che hai trattenuto. **Lo stupore** apre più porte di quanto faccia la certezza.</item>+ <item>Quel piccolo compito pesa più nella testa che nelle mani. Portalo a termine e **senti la leggerezza** che segue.</item>+ <item>Allontanati dal rumore per qualche minuto. I tuoi **pensieri migliori** arrivano spesso quando smetti di inseguirli.</item>+ <item>Crescere significa **lasciarsi alle spalle** i vecchi piani. Scegli di nuovo, **senza scusarti**, e continua a camminare.</item>+ <item>Una parola gentile può essere **la parte migliore della settimana** di qualcuno. Offrila liberamente e guarda come **ti torna indietro**.</item>+ <item>Non ogni preoccupazione merita un posto nella tua giornata. Posa ciò che non è tuo e **tieni stretto** ciò che **conta**.</item>+ <item>Ieri è scritto e domani no. Riempi questa pagina con **qualcosa che conti per te**, anche solo una riga.</item>+ <item>Scegli **una cosa** e dalle tutta la tua attenzione. Il mondo aspetterà e **la farai meglio**.</item>+ <item>La gioia non ha bisogno di un motivo né di un\'occasione. Nota le **piccole cose belle**: una luce calda, una risata, una bella canzone, e **fermati un momento** con loro.</item>+ <item>Il confronto ruba la gioia al tuo cammino. Vai **alla velocità che puoi mantenere** e **arriverai**.</item>+ <item>Ogni inciampo insegna ciò che una strada liscia non può. **Impara**, ringrazia e **riprova**.</item>+ <item>Capire comincia dall\'**attenzione**. Chiedi, aspetta e ascolta davvero la risposta.</item>+ <item>Nomina tre cose per cui **dici grazie** adesso. Nota come la giornata ti sembra **diversa** dopo.</item>+ <item>Un pensiero sulla carta è un pensiero a cui puoi **tornare**. Fissalo ora e **dagli forma dopo**.</item>+ <item>La paura non è un segnale di stop, solo **un segno che questo conta**. Fai il prossimo passo **con lei accanto**.</item>+ <item>I semi non hanno fretta, e nemmeno tu. **Continua a prenderti cura** di ciò che ti sta a cuore e **fidati della stagione**.</item>+ <item>Fatto e imperfetto vale più di perfetto e incompiuto. **Consegna la bozza**, poi migliorala.</item>+ <item>Il tratto duro **costruisce la forza** per ciò che viene. Tieni gli occhi sull\'**orizzonte**.</item>+ <item>La stanza, la finestra, il cielo: **sono ancora lì**. Concedi a occhi e mente una **pausa breve e vera**.</item>+ <item>Ricorda quelli che hai superato. Sei **più capace** di quanto dica la preoccupazione di oggi, e **domani** è un\'altra occasione.</item>+ <item>La tua esperienza è una **scorciatoia** per qualcun altro. Insegna, spiega o **dillo semplicemente a voce alta**: aiuta anche te.</item>+ <item>L\'attenzione è la cosa **più preziosa** che hai. Dalla a **persone e lavori** che conteranno ancora l\'anno prossimo.</item>+ <item>La sicurezza è spesso un **sentimento che segue l\'azione**, non uno che la precede. **Inizia** e lascia che la fiducia ti raggiunga.</item>+ <item>Non tutto va ottimizzato. Fai **poche cose bene**, lascia spazio intorno e chiamala una **buona giornata**.</item>+ <item>Non puoi controllare ogni onda, ma puoi **scegliere come affrontarla**. Un respiro tranquillo è **contagioso**.</item>+ <item>Una frase, uno schizzo, uno scaffale in ordine. **Creare** ti ricorda che puoi **cambiare il mondo intorno a te**, anche solo un poco.</item>+ </string-array></resources>diff --git a/android/app/src/main/res/values-pt-rBR/strings.xml b/android/app/src/main/res/values-pt-rBR/strings.xmlindex 2d39c6b..ec49fda 100644--- a/android/app/src/main/res/values-pt-rBR/strings.xml+++ b/android/app/src/main/res/values-pt-rBR/strings.xml@@ -737,7 +737,7 @@<string name="settings_glass_frosted">Fosco</string><string name="settings_glass_crystal">Cristal</string><string name="settings_glass_lite">Leve</string>- <string name="settings_motion">Movimento</string>+ <string name="settings_motion">Movimento dos botões</string><string name="settings_motion_calm">Calmo</string><string name="settings_motion_normal">Normal</string><string name="settings_motion_bouncy">Saltitante</string>@@ -790,6 +790,11 @@<string name="notes_pin">Fixar no topo</string><string name="notes_unpin">Desafixar</string><string name="notes_open">Abrir</string>+ <string name="notes_rename">Renomear</string>+ <string name="voice_note">Nota de voz</string>+ <string name="voice_name_title">Dê um nome à nota de voz</string>+ <string name="voice_name_hint">Nome</string>+ <string name="voice_name_it">Dar nome</string><string name="notes_title_hint">Título</string><string name="notes_list_title_hint">Nome da lista</string><string name="notes_body_hint">Toque aqui para continuar…</string>@@ -846,4 +851,69 @@</plurals><string name="settings_quick_preview">Visualização rápida</string><string name="settings_quick_preview_body">Arquivos que outros apps abrem aparecem primeiro em um cartão flutuante por cima deles</string>+ <string name="thought_title">Pensamento do dia</string>+ <string-array name="thought_quotes">+ <item>Abrace o momento e deixe o seu espírito voar.</item>+ <item>Pequenos passos também levam a algum lugar.</item>+ <item>Comece de onde você está.</item>+ <item>Seja gentil consigo hoje.</item>+ <item>A curiosidade é uma forma de coragem.</item>+ <item>Faça aquilo que você vem adiando.</item>+ <item>É no silêncio que as ideias crescem.</item>+ <item>Você pode mudar de ideia.</item>+ <item>A gentileza não custa nada e chega longe.</item>+ <item>Solte o que você não consegue carregar.</item>+ <item>Hoje é uma página em branco.</item>+ <item>Foco é uma forma de liberdade.</item>+ <item>Abra espaço para a alegria.</item>+ <item>O seu ritmo é o ritmo certo.</item>+ <item>Os erros provam que você está tentando.</item>+ <item>Ouça mais do que fala.</item>+ <item>A gratidão transforma o bastante em abundância.</item>+ <item>Anote antes que escape.</item>+ <item>Coragem é sentir o medo e seguir mesmo assim.</item>+ <item>Nada cresce sem um pouco de paciência.</item>+ <item>Escolha o progresso em vez da perfeição.</item>+ <item>A melhor vista vem depois da subida.</item>+ <item>Levante os olhos da tela por um momento.</item>+ <item>Você já passou por dias difíceis.</item>+ <item>Compartilhe o que você sabe.</item>+ <item>Dedique tempo ao que dura.</item>+ <item>Comece antes de ter tudo claro.</item>+ <item>Que hoje seja simples.</item>+ <item>Seja a calma da sala.</item>+ <item>Crie algo, por menor que seja.</item>+ </string-array>+ <string-array name="thought_reflections">+ <item>Cada dia é um novo começo. Receba-o com **esperança e coragem**, e deixe cada momento inspirar você a crescer e brilhar **mais** do que antes.</item>+ <item>Hoje você não precisa da escada inteira. Dê **um pequeno passo**, depois outro, e confie que o **progresso** se acumula.</item>+ <item>Condições perfeitas raramente chegam. Comece com o que tem, **agora mesmo**, e deixe o resto **encontrar o caminho** até você.</item>+ <item>Descansar não é uma recompensa por terminar, faz parte do trabalho. **Respire devagar**, beba um pouco de água e deixe que hoje seja **suficiente**.</item>+ <item>Faça a pergunta que você vem guardando. **O espanto** abre mais portas do que a certeza.</item>+ <item>Essa pequena tarefa pesa mais na cabeça do que nas mãos. Termine-a e **sinta a leveza** que vem depois.</item>+ <item>Afaste-se do barulho por alguns minutos. Os seus **melhores pensamentos** costumam chegar quando você para de persegui-los.</item>+ <item>Crescer é **superar** planos antigos. Escolha de novo, **sem pedir desculpas**, e continue andando.</item>+ <item>Uma palavra gentil pode ser **a melhor parte da semana** de alguém. Ofereça sem medo e veja como ela **volta para você**.</item>+ <item>Nem toda preocupação merece um lugar no seu dia. Largue o que não é seu e **segure** o que **importa**.</item>+ <item>Ontem já está escrito e amanhã ainda não. Preencha esta página com **algo que importe para você**, mesmo que seja uma linha.</item>+ <item>Escolha **uma coisa** e dê a ela toda a sua atenção. O mundo espera, e você **fará melhor**.</item>+ <item>A alegria não precisa de motivo nem de ocasião. Perceba as **pequenas coisas boas**: uma luz quente, uma risada, uma boa música, e **fique um instante** com elas.</item>+ <item>Comparar-se rouba a alegria do seu próprio caminho. Siga **no ritmo que consegue manter** e você **chegará lá**.</item>+ <item>Cada tropeço ensina o que um caminho liso não ensina. **Aprenda com ele**, agradeça e **tente de novo**.</item>+ <item>Entender começa pela **atenção**. Pergunte, espere e ouça de verdade a resposta.</item>+ <item>Nomeie três coisas pelas quais você **agradece** agora. Perceba como o dia parece **diferente** depois.</item>+ <item>Um pensamento no papel é um pensamento ao qual você pode **voltar**. Registre agora e **dê forma depois**.</item>+ <item>O medo não é uma placa de pare, só um **sinal de que isso importa**. Dê o próximo passo **com ele ao seu lado**.</item>+ <item>As sementes não têm pressa, e você também não precisa ter. **Continue cuidando** do que importa para você e **confie na estação**.</item>+ <item>Feito e imperfeito vale mais do que perfeito e inacabado. **Entregue o rascunho** e depois melhore-o.</item>+ <item>O trecho difícil **constrói a força** para o que vem pela frente. Mantenha os olhos no **horizonte**.</item>+ <item>O quarto, a janela, o céu: **tudo continua lá**. Dê aos olhos e à mente uma **pausa curta e de verdade**.</item>+ <item>Lembre-se daqueles que atravessou. Você é **mais capaz** do que a preocupação de hoje diz, e **amanhã** é outra chance.</item>+ <item>A sua experiência é um **atalho** para outra pessoa. Ensine, explique ou simplesmente **diga em voz alta**; isso também ajuda você.</item>+ <item>A atenção é o que você tem de **mais valioso**. Dê-a a **pessoas e trabalhos** que ainda vão importar no ano que vem.</item>+ <item>A segurança costuma ser um **sentimento que vem depois da ação**, não antes. **Comece** e deixe a confiança alcançar você.</item>+ <item>Nem tudo precisa ser otimizado. Faça **poucas coisas bem**, deixe espaço ao redor e chame isso de um **bom dia**.</item>+ <item>Você não controla cada onda, mas pode **escolher como recebê-la**. Uma respiração tranquila é **contagiante**.</item>+ <item>Uma frase, um desenho, uma prateleira arrumada. **Criar** lembra que você pode **mudar o mundo ao seu redor**, mesmo que um pouco.</item>+ </string-array></resources>diff --git a/android/app/src/main/res/values-pt/strings.xml b/android/app/src/main/res/values-pt/strings.xmlindex 432c9c4..a5e2695 100644--- a/android/app/src/main/res/values-pt/strings.xml+++ b/android/app/src/main/res/values-pt/strings.xml@@ -737,7 +737,7 @@<string name="settings_glass_frosted">Fosco</string><string name="settings_glass_crystal">Cristal</string><string name="settings_glass_lite">Leve</string>- <string name="settings_motion">Movimento</string>+ <string name="settings_motion">Movimento dos botões</string><string name="settings_motion_calm">Calmo</string><string name="settings_motion_normal">Normal</string><string name="settings_motion_bouncy">Saltitante</string>@@ -790,6 +790,11 @@<string name="notes_pin">Fixar no topo</string><string name="notes_unpin">Desafixar</string><string name="notes_open">Abrir</string>+ <string name="notes_rename">Mudar o nome</string>+ <string name="voice_note">Nota de voz</string>+ <string name="voice_name_title">Dar um nome à nota de voz</string>+ <string name="voice_name_hint">Nome</string>+ <string name="voice_name_it">Dar nome</string><string name="notes_title_hint">Título</string><string name="notes_list_title_hint">Nome da lista</string><string name="notes_body_hint">Toque aqui para continuar…</string>@@ -846,4 +851,69 @@</plurals><string name="settings_quick_preview">Pré-visualização rápida</string><string name="settings_quick_preview_body">Os ficheiros que outras apps abrem aparecem primeiro num cartão flutuante por cima delas</string>+ <string name="thought_title">Pensamento do dia</string>+ <string-array name="thought_quotes">+ <item>Abrace o momento e deixe o seu espírito voar.</item>+ <item>Pequenos passos também levam a algum lugar.</item>+ <item>Comece de onde você está.</item>+ <item>Seja gentil consigo hoje.</item>+ <item>A curiosidade é uma forma de coragem.</item>+ <item>Faça aquilo que você vem adiando.</item>+ <item>É no silêncio que as ideias crescem.</item>+ <item>Você pode mudar de ideia.</item>+ <item>A gentileza não custa nada e chega longe.</item>+ <item>Solte o que você não consegue carregar.</item>+ <item>Hoje é uma página em branco.</item>+ <item>Foco é uma forma de liberdade.</item>+ <item>Abra espaço para a alegria.</item>+ <item>O seu ritmo é o ritmo certo.</item>+ <item>Os erros provam que você está tentando.</item>+ <item>Ouça mais do que fala.</item>+ <item>A gratidão transforma o bastante em abundância.</item>+ <item>Anote antes que escape.</item>+ <item>Coragem é sentir o medo e seguir mesmo assim.</item>+ <item>Nada cresce sem um pouco de paciência.</item>+ <item>Escolha o progresso em vez da perfeição.</item>+ <item>A melhor vista vem depois da subida.</item>+ <item>Levante os olhos do ecrã por um momento.</item>+ <item>Você já passou por dias difíceis.</item>+ <item>Partilhe o que você sabe.</item>+ <item>Dedique tempo ao que dura.</item>+ <item>Comece antes de ter tudo claro.</item>+ <item>Que hoje seja simples.</item>+ <item>Seja a calma da sala.</item>+ <item>Crie algo, por menor que seja.</item>+ </string-array>+ <string-array name="thought_reflections">+ <item>Cada dia é um novo começo. Receba-o com **esperança e coragem**, e deixe cada momento inspirar você a crescer e brilhar **mais** do que antes.</item>+ <item>Hoje você não precisa da escada inteira. Dê **um pequeno passo**, depois outro, e confie que o **progresso** se acumula.</item>+ <item>Condições perfeitas raramente chegam. Comece com o que tem, **agora mesmo**, e deixe o resto **encontrar o caminho** até você.</item>+ <item>Descansar não é uma recompensa por terminar, faz parte do trabalho. **Respire devagar**, beba um pouco de água e deixe que hoje seja **suficiente**.</item>+ <item>Faça a pergunta que você vem guardando. **O espanto** abre mais portas do que a certeza.</item>+ <item>Essa pequena tarefa pesa mais na cabeça do que nas mãos. Termine-a e **sinta a leveza** que vem depois.</item>+ <item>Afaste-se do barulho por alguns minutos. Os seus **melhores pensamentos** costumam chegar quando você para de persegui-los.</item>+ <item>Crescer é **superar** planos antigos. Escolha de novo, **sem pedir desculpas**, e continue andando.</item>+ <item>Uma palavra gentil pode ser **a melhor parte da semana** de alguém. Ofereça sem medo e veja como ela **volta para você**.</item>+ <item>Nem toda preocupação merece um lugar no seu dia. Largue o que não é seu e **segure** o que **importa**.</item>+ <item>Ontem já está escrito e amanhã ainda não. Preencha esta página com **algo que importe para você**, mesmo que seja uma linha.</item>+ <item>Escolha **uma coisa** e dê a ela toda a sua atenção. O mundo espera, e você **fará melhor**.</item>+ <item>A alegria não precisa de motivo nem de ocasião. Perceba as **pequenas coisas boas**: uma luz quente, uma risada, uma boa música, e **fique um instante** com elas.</item>+ <item>Comparar-se rouba a alegria do seu próprio caminho. Siga **no ritmo que consegue manter** e você **chegará lá**.</item>+ <item>Cada tropeço ensina o que um caminho liso não ensina. **Aprenda com ele**, agradeça e **tente de novo**.</item>+ <item>Entender começa pela **atenção**. Pergunte, espere e ouça de verdade a resposta.</item>+ <item>Nomeie três coisas pelas quais você **agradece** agora. Perceba como o dia parece **diferente** depois.</item>+ <item>Um pensamento no papel é um pensamento ao qual você pode **voltar**. Registre agora e **dê forma depois**.</item>+ <item>O medo não é uma placa de pare, só um **sinal de que isso importa**. Dê o próximo passo **com ele ao seu lado**.</item>+ <item>As sementes não têm pressa, e você também não precisa ter. **Continue cuidando** do que importa para você e **confie na estação**.</item>+ <item>Feito e imperfeito vale mais do que perfeito e inacabado. **Entregue o rascunho** e depois melhore-o.</item>+ <item>O trecho difícil **constrói a força** para o que vem pela frente. Mantenha os olhos no **horizonte**.</item>+ <item>O quarto, a janela, o céu: **tudo continua lá**. Dê aos olhos e à mente uma **pausa curta e de verdade**.</item>+ <item>Lembre-se daqueles que atravessou. Você é **mais capaz** do que a preocupação de hoje diz, e **amanhã** é outra chance.</item>+ <item>A sua experiência é um **atalho** para outra pessoa. Ensine, explique ou simplesmente **diga em voz alta**; isso também ajuda você.</item>+ <item>A atenção é o que você tem de **mais valioso**. Dê-a a **pessoas e trabalhos** que ainda vão importar no ano que vem.</item>+ <item>A segurança costuma ser um **sentimento que vem depois da ação**, não antes. **Comece** e deixe a confiança alcançar você.</item>+ <item>Nem tudo precisa ser otimizado. Faça **poucas coisas bem**, deixe espaço ao redor e chame isso de um **bom dia**.</item>+ <item>Você não controla cada onda, mas pode **escolher como recebê-la**. Uma respiração tranquila é **contagiante**.</item>+ <item>Uma frase, um desenho, uma prateleira arrumada. **Criar** lembra que você pode **mudar o mundo ao seu redor**, mesmo que um pouco.</item>+ </string-array></resources>diff --git a/android/app/src/main/res/values-ru/strings.xml b/android/app/src/main/res/values-ru/strings.xmlindex 41ab058..30185fe 100644--- a/android/app/src/main/res/values-ru/strings.xml+++ b/android/app/src/main/res/values-ru/strings.xml@@ -761,7 +761,7 @@<string name="settings_glass_frosted">Матовое</string><string name="settings_glass_crystal">Кристалл</string><string name="settings_glass_lite">Лёгкое</string>- <string name="settings_motion">Анимация</string>+ <string name="settings_motion">Анимация кнопок</string><string name="settings_motion_calm">Спокойная</string><string name="settings_motion_normal">Обычная</string><string name="settings_motion_bouncy">Пружинистая</string>@@ -816,6 +816,11 @@<string name="notes_pin">Закрепить сверху</string><string name="notes_unpin">Открепить</string><string name="notes_open">Открыть</string>+ <string name="notes_rename">Переименовать</string>+ <string name="voice_note">Голосовая заметка</string>+ <string name="voice_name_title">Назовите голосовую заметку</string>+ <string name="voice_name_hint">Название</string>+ <string name="voice_name_it">Назвать</string><string name="notes_title_hint">Заголовок</string><string name="notes_list_title_hint">Название списка</string><string name="notes_body_hint">Нажмите, чтобы продолжить…</string>@@ -874,4 +879,69 @@</plurals><string name="settings_quick_preview">Быстрый просмотр</string><string name="settings_quick_preview_body">Файлы, которые открывают другие приложения, сначала показываются в плавающей карточке поверх них</string>+ <string name="thought_title">Мысль дня</string>+ <string-array name="thought_quotes">+ <item>Цените момент и пусть ваш дух парит.</item>+ <item>Маленькие шаги тоже куда-то ведут.</item>+ <item>Начните с того места, где вы есть.</item>+ <item>Будьте добры к себе сегодня.</item>+ <item>Любопытство — это форма смелости.</item>+ <item>Сделайте то, что давно откладывали.</item>+ <item>В тишине рождаются идеи.</item>+ <item>Вы вправе передумать.</item>+ <item>Доброта ничего не стоит и уходит далеко.</item>+ <item>Отпустите то, что не можете нести.</item>+ <item>Сегодня — чистая страница.</item>+ <item>Сосредоточенность — это форма свободы.</item>+ <item>Оставьте место для радости.</item>+ <item>Ваш темп — правильный темп.</item>+ <item>Ошибки доказывают, что вы пробуете.</item>+ <item>Слушайте больше, чем говорите.</item>+ <item>Благодарность превращает достаточное в изобилие.</item>+ <item>Запишите, пока мысль не ускользнула.</item>+ <item>Смелость — это бояться и всё равно идти.</item>+ <item>Ничто не растёт без капли терпения.</item>+ <item>Выбирайте прогресс, а не идеал.</item>+ <item>Лучший вид открывается после подъёма.</item>+ <item>Оторвитесь от экрана на минуту.</item>+ <item>Вы уже переживали трудные дни.</item>+ <item>Делитесь тем, что знаете.</item>+ <item>Тратьте время на то, что остаётся.</item>+ <item>Начинайте, не дожидаясь уверенности.</item>+ <item>Пусть сегодня будет просто.</item>+ <item>Будьте спокойствием в комнате.</item>+ <item>Создайте что-нибудь, пусть совсем маленькое.</item>+ </string-array>+ <string-array name="thought_reflections">+ <item>Каждый день — это новое начало. Встречайте его с **надеждой и смелостью**, и пусть каждый миг вдохновляет вас расти и сиять **ярче**, чем прежде.</item>+ <item>Сегодня вам не нужна вся лестница. Сделайте **один маленький шаг**, потом ещё один, и верьте, что **прогресс** копится.</item>+ <item>Идеальные условия бывают редко. Начните с того, что есть, **прямо сейчас**, а остальное **найдёт дорогу** к вам.</item>+ <item>Отдых — не награда за завершённое, а часть работы. **Дышите медленно**, выпейте воды и пусть сегодня будет **достаточно**.</item>+ <item>Задайте вопрос, который вы сдерживали. **Удивление** открывает больше дверей, чем уверенность.</item>+ <item>Эта маленькая задача тяжелее в голове, чем в руках. Закончите её и **почувствуйте лёгкость**, которая придёт следом.</item>+ <item>Отойдите от шума на несколько минут. **Лучшие мысли** часто приходят, когда вы перестаёте за ними гнаться.</item>+ <item>Расти — значит **перерастать** старые планы. Выберите заново, **не извиняясь**, и идите дальше.</item>+ <item>Доброе слово может стать **лучшим событием недели** для кого-то. Дарите его щедро и смотрите, как оно **возвращается к вам**.</item>+ <item>Не каждая тревога заслуживает места в вашем дне. Оставьте то, что не ваше, и **держитесь** за то, что **важно**.</item>+ <item>Вчерашний день уже написан, завтрашний ещё нет. Заполните эту страницу **тем, что вам дорого**, пусть даже одной строкой.</item>+ <item>Выберите **одно дело** и отдайте ему всё внимание. Мир подождёт, а вы **сделаете лучше**.</item>+ <item>Радости не нужны ни повод, ни случай. Замечайте **маленькие хорошие вещи**: тёплый свет, смех, хорошую песню, и **побудьте с ними** минуту.</item>+ <item>Сравнение отнимает радость у вашей собственной дороги. Идите **в том темпе, который можете выдержать**, и вы **дойдёте**.</item>+ <item>Каждый промах учит тому, чему не научит гладкая дорога. **Извлеките урок**, поблагодарите и **попробуйте снова**.</item>+ <item>Понимание начинается с **внимания**. Спросите, подождите и по-настоящему услышьте ответ.</item>+ <item>Назовите три вещи, **за которые вы благодарны** прямо сейчас. Заметьте, каким **другим** станет день после этого.</item>+ <item>Мысль на бумаге — это мысль, к которой можно **вернуться**. Зафиксируйте её сейчас и **придайте форму позже**.</item>+ <item>Страх — не знак «стоп», а лишь **сигнал, что это важно**. Сделайте следующий шаг **вместе с ним**.</item>+ <item>Семена не торопятся, и вам не нужно. **Продолжайте заботиться** о том, что вам дорого, и **доверьтесь времени года**.</item>+ <item>Сделанное, но неидеальное лучше идеального, но незаконченного. **Отправьте черновик**, а потом улучшите его.</item>+ <item>Трудный отрезок **закаляет силы** для того, что впереди. Не отрывайте взгляд от **горизонта**.</item>+ <item>Комната, окно, небо: **всё это по-прежнему здесь**. Дайте глазам и мыслям **короткий настоящий отдых**.</item>+ <item>Вспомните те, что вы прошли. Вы **способнее**, чем говорит сегодняшняя тревога, а **завтра** — ещё один шанс.</item>+ <item>Ваш опыт — чей-то **короткий путь**. Учите, объясняйте или просто **скажите вслух**: это помогает и вам.</item>+ <item>Внимание — **самое ценное**, что у вас есть. Отдавайте его **людям и делам**, которые будут важны и в следующем году.</item>+ <item>Уверенность чаще **приходит после действия**, а не до него. **Начните**, и пусть она вас догонит.</item>+ <item>Не всё нужно оптимизировать. Сделайте **немногое хорошо**, оставьте вокруг свободное место и назовите это **хорошим днём**.</item>+ <item>Вы не можете управлять каждой волной, но можете **выбрать, как её встретить**. Ровное дыхание **заразительно**.</item>+ <item>Фразу, набросок, прибранную полку. **Творчество** напоминает, что вы можете **менять мир вокруг себя**, хотя бы чуть-чуть.</item>+ </string-array></resources>diff --git a/android/app/src/main/res/values/strings.xml b/android/app/src/main/res/values/strings.xmlindex 7b15f75..f52ef26 100644--- a/android/app/src/main/res/values/strings.xml+++ b/android/app/src/main/res/values/strings.xml@@ -1163,11 +1163,45 @@<string name="settings_glass_frosted">Frosted</string><string name="settings_glass_crystal">Crystal</string><string name="settings_glass_lite">Lite</string>- <string name="settings_motion">Motion</string>+ <string name="settings_motion">Button motion</string><string name="settings_motion_calm">Calm</string><string name="settings_motion_normal">Normal</string><string name="settings_motion_bouncy">Bouncy</string><string name="settings_motion_jelly">Jelly</string>+ <string name="settings_custom">Custom</string>+ <string name="settings_general">General</string>+ <string name="settings_glass_motion">Liquid glass & motion</string>+ <string name="gm_preview_body">These buttons move the way you set them below. Press and hold them.</string>+ <string name="gm_press_me">Press me</string>+ <string name="gm_chip">Chip</string>+ <string name="gm_glass_look">Glass</string>+ <string name="gm_blur">Frost</string>+ <string name="gm_lens_height">Lens depth</string>+ <string name="gm_lens_amount">Lens strength</string>+ <string name="gm_tint">Tint</string>+ <string name="gm_saturation">Colour</string>+ <string name="gm_brightness">Brightness</string>+ <string name="gm_highlight">Rim light</string>+ <string name="gm_depth">Depth</string>+ <string name="gm_chromatic">Prism edge</string>+ <string name="gm_spring">Glass spring</string>+ <string name="gm_spring_body">How glass swells, springs past and settles. Tap the graph to pause it.</string>+ <string name="gm_spring_stats">Damping %1$s · stiffness %2$s · settles in %3$s s</string>+ <string name="gm_bounce">Bounce</string>+ <string name="gm_speed">Speed</string>+ <string name="gm_press">Press</string>+ <string name="gm_wobble">Wobble</string>+ <string name="gm_stretch">Stretch</string>+ <string name="gm_bloom">Bloom</string>+ <string name="gm_transitions">Screen transitions</string>+ <string name="gm_curve_body">Drag the two handles to draw the curve screens, sheets and fades travel on. Tap the graph to pause it.</string>+ <string name="gm_duration">Duration</string>+ <string name="gm_curve_drawer">Drawer</string>+ <string name="gm_curve_standard">Standard</string>+ <string name="gm_curve_emphasized">Emphasized</string>+ <string name="gm_curve_ease">Ease in-out</string>+ <string name="gm_curve_linear">Linear</string>+ <string name="gm_reset">Reset to defaults</string><string name="settings_haptics">Haptic feedback</string><string name="settings_reading">Reading</string><string name="settings_forms">Forms</string>@@ -1225,6 +1259,11 @@<string name="notes_pin">Pin to the top</string><string name="notes_unpin">Unpin</string><string name="notes_open">Open</string>+ <string name="notes_rename">Rename</string>+ <string name="voice_note">Voice note</string>+ <string name="voice_name_title">Name this voice note</string>+ <string name="voice_name_hint">Name</string>+ <string name="voice_name_it">Name it</string><string name="notes_title_hint">Title</string><string name="notes_list_title_hint">List name</string><string name="notes_body_hint">Tap here to continue…</string>@@ -1287,4 +1326,69 @@</plurals><string name="settings_quick_preview">Quick Preview</string><string name="settings_quick_preview_body">Files other apps open show in a floating card over them first</string>+ <string name="thought_title">Thought of the day</string>+ <string-array name="thought_quotes">+ <item>Embrace the moment and let your spirit soar.</item>+ <item>Small steps still take you somewhere.</item>+ <item>Begin where you are.</item>+ <item>Be gentle with yourself today.</item>+ <item>Curiosity is a kind of courage.</item>+ <item>Do one thing you\'ve been putting off.</item>+ <item>Quiet is where ideas grow.</item>+ <item>You are allowed to change your mind.</item>+ <item>Kindness costs nothing and travels far.</item>+ <item>Let go of what you can\'t carry.</item>+ <item>Today is a blank page.</item>+ <item>Focus is a form of freedom.</item>+ <item>Make room for joy.</item>+ <item>Your pace is the right pace.</item>+ <item>Mistakes are proof you\'re trying.</item>+ <item>Listen more than you speak.</item>+ <item>Gratitude turns enough into plenty.</item>+ <item>Write it down before it slips away.</item>+ <item>Courage is feeling it and going anyway.</item>+ <item>Nothing grows without a little patience.</item>+ <item>Choose progress over perfect.</item>+ <item>The best view comes after the climb.</item>+ <item>Look up from the screen for a moment.</item>+ <item>You\'ve handled hard days before.</item>+ <item>Share what you know.</item>+ <item>Spend time on what lasts.</item>+ <item>Start before you feel ready.</item>+ <item>Let today be simple.</item>+ <item>Be the calm in the room.</item>+ <item>Make something, however small.</item>+ </string-array>+ <string-array name="thought_reflections">+ <item>Every day is a fresh start—embrace it with **hope and courage**. Let each moment inspire you to grow and shine **brighter** than before.</item>+ <item>You don\'t need the whole staircase today. Take **one small step**, then another, and trust that **progress** adds up.</item>+ <item>Perfect conditions rarely arrive. Start with what you have, **right now**, and let the rest **find its way** to you.</item>+ <item>Rest isn\'t a reward for finishing, it\'s part of the work. **Breathe slowly**, drink some water, and let today be **enough**.</item>+ <item>Ask the question you\'ve been holding back. **Wonder** opens more doors than certainty ever will.</item>+ <item>That small task weighs more in your head than in your hands. Finish it, and **feel the lightness** that follows.</item>+ <item>Step away from the noise for a few minutes. Your **best thoughts** often arrive when you stop chasing them.</item>+ <item>Growing means **outgrowing** old plans. Choose again, **without apology**, and keep walking.</item>+ <item>A kind word today may be the **best part of someone\'s week**. Offer it freely and watch it **come back around**.</item>+ <item>Not every worry deserves a place in your day. Put down what isn\'t yours and **hold on** to what **matters**.</item>+ <item>Yesterday is written and tomorrow isn\'t. Fill this page with **something you\'ll be proud of**, even if it\'s just a line.</item>+ <item>Choose **one thing** and give it your full attention. The world will wait, and you\'ll **do it better**.</item>+ <item>Joy doesn\'t need a reason or an occasion. Notice the **small good things**—warm light, a laugh, a good song—and **stay with them** a moment.</item>+ <item>Comparison steals the joy from your own road. Keep going at **the speed you can sustain**, and you\'ll **get there**.</item>+ <item>Each stumble teaches something a smooth path can\'t. **Learn it**, thank it, and **try again**.</item>+ <item>Understanding begins with **attention**. Ask, wait, and really hear the answer.</item>+ <item>Name three things you\'re **thankful for** right now. Notice how the day feels **different** afterwards.</item>+ <item>A thought on paper is a thought you can **return to**. Capture it now and **shape it later**.</item>+ <item>Fear is not a stop sign, only a **signal that this matters**. Take the next step **with it beside you**.</item>+ <item>Seeds don\'t hurry, and neither must you. **Keep tending** what you care about and **trust the season**.</item>+ <item>Done and imperfect beats perfect and unfinished. **Ship the draft**, then make it better.</item>+ <item>The hard stretch is **building the strength** for what\'s ahead. Keep your eyes on **the horizon**.</item>+ <item>The room, the window, the sky: **they\'re all still there**. Give your eyes and your mind a **short, real break**.</item>+ <item>Remember the ones you got through. You are **more capable** than today\'s worry says, and **tomorrow** is another chance.</item>+ <item>Your experience is someone else\'s **shortcut**. Teach, explain, or simply **say it out loud**; it helps you too.</item>+ <item>Attention is the **most valuable thing** you have. Give it to **people and work** that will still matter next year.</item>+ <item>Readiness is usually a **feeling that follows action**, not one that comes before it. **Begin**, and let confidence catch up.</item>+ <item>Not everything needs to be optimised. Do **a few things well**, leave space around them, and call that a **good day**.</item>+ <item>You can\'t control every wave, but you can **choose how you meet it**. A steady breath is **contagious**.</item>+ <item>A sentence, a sketch, a tidy shelf. **Creating** reminds you that you can **change the world around you**, even a little.</item>+ </string-array></resources>diff --git a/android/backdrop/src/main/java/com/kyant/backdrop/BackdropEffectScope.kt b/android/backdrop/src/main/java/com/kyant/backdrop/BackdropEffectScope.ktindex 4adad36..6d3820e 100644--- a/android/backdrop/src/main/java/com/kyant/backdrop/BackdropEffectScope.kt+++ b/android/backdrop/src/main/java/com/kyant/backdrop/BackdropEffectScope.kt@@ -79,6 +79,5 @@ internal abstract class BackdropEffectScopeImpl : BackdropEffectScope, RuntimeShlayoutDirection = LayoutDirection.Ltrpadding = 0frenderEffect = null- runtimeShaderCache.clear()}}diff --git a/android/backdrop/src/main/java/com/kyant/backdrop/BackdropThrottle.kt b/android/backdrop/src/main/java/com/kyant/backdrop/BackdropThrottle.ktnew file mode 100644index 0000000..6401430--- /dev/null+++ b/android/backdrop/src/main/java/com/kyant/backdrop/BackdropThrottle.kt@@ -0,0 +1,51 @@+package com.kyant.backdrop++import androidx.compose.ui.Modifier+import androidx.compose.ui.node.ModifierNodeElement+import androidx.compose.ui.node.TraversableNode+import androidx.compose.ui.node.findNearestAncestor+import androidx.compose.ui.platform.InspectorInfo++/**+ * Marks everything below as "in flight" while [moving] is true. Glass nodes under it keep drawing+ * but only re-record their backdrop about ten times a second instead of on every position change+ * of every frame, and once more when the motion stops, so a page of flying glass cards stays cheap.+ */+fun Modifier.throttleBackdrops(moving: () -> Boolean): Modifier =+ this then ThrottleBackdropsElement(moving)++private const val ThrottleKey = "com.kyant.backdrop.ThrottleBackdrops"++private class ThrottleBackdropsElement(+ val moving: () -> Boolean+) : ModifierNodeElement<ThrottleBackdropsNode>() {++ override fun create(): ThrottleBackdropsNode = ThrottleBackdropsNode(moving)++ override fun update(node: ThrottleBackdropsNode) {+ node.moving = moving+ }++ override fun InspectorInfo.inspectableProperties() {+ name = "throttleBackdrops"+ properties["moving"] = moving+ }++ override fun equals(other: Any?): Boolean {+ if (this === other) return true+ if (other !is ThrottleBackdropsElement) return false+ return moving == other.moving+ }++ override fun hashCode(): Int = moving.hashCode()+}++internal class ThrottleBackdropsNode(+ var moving: () -> Boolean+) : Modifier.Node(), TraversableNode {++ override val traverseKey: Any get() = ThrottleKey+}++internal fun Modifier.Node.findBackdropThrottle(): ThrottleBackdropsNode? =+ findNearestAncestor(ThrottleKey) as? ThrottleBackdropsNodediff --git a/android/backdrop/src/main/java/com/kyant/backdrop/DrawBackdropModifier.kt b/android/backdrop/src/main/java/com/kyant/backdrop/DrawBackdropModifier.ktindex ed83d3c..06a4b01 100644--- a/android/backdrop/src/main/java/com/kyant/backdrop/DrawBackdropModifier.kt+++ b/android/backdrop/src/main/java/com/kyant/backdrop/DrawBackdropModifier.kt@@ -7,6 +7,7 @@package com.kyant.backdropimport android.os.Build+import android.os.SystemClockimport androidx.compose.runtime.getValueimport androidx.compose.runtime.mutableFloatStateOfimport androidx.compose.runtime.mutableStateOf@@ -43,6 +44,11 @@ import com.kyant.backdrop.shadow.InnerShadowimport com.kyant.backdrop.shadow.InnerShadowElementimport com.kyant.backdrop.shadow.Shadowimport com.kyant.backdrop.shadow.ShadowElement+import kotlinx.coroutines.Job+import kotlinx.coroutines.delay+import kotlinx.coroutines.launch++private const val ThrottleIntervalMs = 100Lprivate val DefaultHighlight = { Highlight.Default }private val DefaultShadow = { Shadow.Default }@@ -340,10 +346,46 @@ private class DrawBackdropNode(}}+ private var throttle: ThrottleBackdropsNode? = null+ private var throttleLooked = false+ private var lastCoordinatesWrite = 0L+ private var pendingCoordinates: LayoutCoordinates? = null+ private var settleJob: Job? = null++ private fun publishCoordinates(coordinates: LayoutCoordinates) {+ if (!throttleLooked) {+ throttle = findBackdropThrottle()+ throttleLooked = true+ }+ val now = SystemClock.uptimeMillis()+ val gate = throttle+ if (gate == null || layoutCoordinates == null || !gate.moving() ||+ now - lastCoordinatesWrite >= ThrottleIntervalMs+ ) {+ layoutCoordinates = coordinates+ lastCoordinatesWrite = now+ pendingCoordinates = null+ return+ }+ pendingCoordinates = coordinates+ if (settleJob == null) {+ settleJob = coroutineScope.launch {+ delay((lastCoordinatesWrite + ThrottleIntervalMs - now).coerceAtLeast(1L))+ settleJob = null+ val latest = pendingCoordinates+ pendingCoordinates = null+ if (latest != null && latest.isAttached) {+ layoutCoordinates = latest+ lastCoordinatesWrite = SystemClock.uptimeMillis()+ }+ }+ }+ }+override fun onGloballyPositioned(coordinates: LayoutCoordinates) {if (coordinates.isAttached) {if (backdrop.isCoordinatesDependent) {- layoutCoordinates = coordinates+ publishCoordinates(coordinates)} else {if (layoutCoordinates != null) {layoutCoordinates = null@@ -388,6 +430,10 @@ private class DrawBackdropNode(}effectScope.reset()+ settleJob = null+ pendingCoordinates = null+ throttle = null+ throttleLooked = falselayoutCoordinates = nullexportedBackdrop?.layerCoordinates = null}diff --git a/android/backdrop/src/main/java/com/kyant/backdrop/FloatingLayer.kt b/android/backdrop/src/main/java/com/kyant/backdrop/FloatingLayer.ktnew file mode 100644index 0000000..5f2fe41--- /dev/null+++ b/android/backdrop/src/main/java/com/kyant/backdrop/FloatingLayer.kt@@ -0,0 +1,123 @@+package com.kyant.backdrop++import androidx.compose.ui.Modifier+import androidx.compose.ui.geometry.Offset+import androidx.compose.ui.geometry.Size+import androidx.compose.ui.graphics.GraphicsLayerScope+import androidx.compose.ui.graphics.Outline+import androidx.compose.ui.node.requireLayoutDirection+import androidx.compose.ui.graphics.drawscope.ContentDrawScope+import androidx.compose.ui.graphics.layer.CompositingStrategy+import androidx.compose.ui.graphics.layer.GraphicsLayer+import androidx.compose.ui.graphics.layer.drawLayer+import androidx.compose.ui.node.DrawModifierNode+import androidx.compose.ui.node.ModifierNodeElement+import androidx.compose.ui.node.ObserverModifierNode+import androidx.compose.ui.node.observeReads+import androidx.compose.ui.node.requireDensity+import androidx.compose.ui.node.requireGraphicsContext+import androidx.compose.ui.node.requireView+import androidx.compose.ui.platform.InspectorInfo+import androidx.compose.ui.unit.toIntSize++/**+ * Moves, scales and fades the content like `graphicsLayer`, but only at draw time: the content is laid+ * out where it comes to rest, so the glass inside keeps its position. The content is recorded once+ * into an offscreen texture; while [block]'s values animate only the texture's transform changes, so+ * the glass inside is not re-blurred on any frame of the motion. Touches land where the content rests.+ * A [GraphicsLayerScope.shape] with [GraphicsLayerScope.clip] clips the texture, animated as cheaply.+ */+fun Modifier.floatingLayer(block: GraphicsLayerScope.() -> Unit): Modifier =+ this then FloatingLayerElement(block)++private class FloatingLayerElement(+ val block: GraphicsLayerScope.() -> Unit+) : ModifierNodeElement<FloatingLayerNode>() {++ override fun create(): FloatingLayerNode = FloatingLayerNode(block)++ override fun update(node: FloatingLayerNode) {+ node.block = block+ node.applyTransform()+ }++ override fun InspectorInfo.inspectableProperties() {+ name = "floatingLayer"+ properties["block"] = block+ }++ override fun equals(other: Any?): Boolean = other is FloatingLayerElement && other.block == block++ override fun hashCode(): Int = block.hashCode()+}++private class FloatingLayerNode(+ var block: GraphicsLayerScope.() -> Unit+) : DrawModifierNode, ObserverModifierNode, Modifier.Node() {++ private var layer: GraphicsLayer? = null+ private val scope = InverseLayerScope()+ private var size = Size.Unspecified++ override fun onAttach() {+ layer = requireGraphicsContext().createGraphicsLayer().apply { compositingStrategy = CompositingStrategy.Offscreen }+ }++ override fun onDetach() {+ layer?.let { requireGraphicsContext().releaseGraphicsLayer(it) }+ layer = null+ }++ override fun onObservedReadsChanged() {+ applyTransform()+ // the texture's properties changed, not its content: a new frame, without re-recording anything+ requireView().invalidate()+ }++ fun applyTransform() {+ val layer = layer ?: return+ if (!isAttached || size == Size.Unspecified) return+ val d = requireDensity()+ observeReads {+ scope.reset()+ scope.size = size+ scope.density = d.density+ scope.fontScale = d.fontScale+ scope.block()+ }+ layer.alpha = scope.alpha+ layer.scaleX = scope.scaleX+ layer.scaleY = scope.scaleY+ layer.translationX = scope.translationX+ layer.translationY = scope.translationY+ layer.rotationZ = scope.rotationZ+ val origin = scope.transformOrigin+ layer.pivotOffset = Offset(origin.pivotFractionX * size.width, origin.pivotFractionY * size.height)+ // an animated clip is only an outline on the texture: nothing inside is redrawn for it+ if (scope.clip) {+ when (val o = scope.shape.createOutline(size, requireLayoutDirection(), d)) {+ is Outline.Rectangle -> layer.setRectOutline(o.rect.topLeft, o.rect.size)+ is Outline.Rounded -> {+ val r = o.roundRect+ layer.setRoundRectOutline(Offset(r.left, r.top), Size(r.width, r.height), r.topLeftCornerRadius.x)+ }+ is Outline.Generic -> layer.setPathOutline(o.path)+ }+ }+ layer.clip = scope.clip+ }++ override fun ContentDrawScope.draw() {+ val layer = layer+ if (layer == null) {+ drawContent()+ return+ }+ if (this.size != [email protected]) {+ [email protected] = this.size+ applyTransform()+ }+ layer.record(this.size.toIntSize()) { [email protected]() }+ drawLayer(layer)+ }+}diff --git a/android/backdrop/src/main/java/com/kyant/backdrop/RuntimeShaderCache.kt b/android/backdrop/src/main/java/com/kyant/backdrop/RuntimeShaderCache.ktindex 70c4a4e..f27d9ec 100644--- a/android/backdrop/src/main/java/com/kyant/backdrop/RuntimeShaderCache.kt+++ b/android/backdrop/src/main/java/com/kyant/backdrop/RuntimeShaderCache.kt@@ -1,35 +1,60 @@-/*- * Adapted from AndroidLiquidGlass by kyant0.- * Source: https://github.com/Kyant0/AndroidLiquidGlass- * Licensed under the Apache License, Version 2.0.- */--package com.kyant.backdrop--import android.graphics.RuntimeShader-import android.os.Build-import androidx.annotation.RequiresApi-import org.intellij.lang.annotations.Language--sealed interface RuntimeShaderCache {-- @RequiresApi(Build.VERSION_CODES.TIRAMISU)- fun obtainRuntimeShader(- key: String,- @Language("AGSL") string: String- ): RuntimeShader-}--internal class RuntimeShaderCacheImpl : RuntimeShaderCache {-- private val runtimeShaders = mutableMapOf<String, RuntimeShader>()-- @RequiresApi(Build.VERSION_CODES.TIRAMISU)- override fun obtainRuntimeShader(key: String, string: String): RuntimeShader {- return runtimeShaders.getOrPut(key) { RuntimeShader(string) }- }-- fun clear() {- runtimeShaders.clear()- }-}+/*+ * Adapted from AndroidLiquidGlass by kyant0.+ * Source: https://github.com/Kyant0/AndroidLiquidGlass+ * Licensed under the Apache License, Version 2.0.+ */++package com.kyant.backdrop++import android.graphics.RuntimeShader+import android.os.Build+import androidx.annotation.RequiresApi+import org.intellij.lang.annotations.Language++sealed interface RuntimeShaderCache {++ @RequiresApi(Build.VERSION_CODES.TIRAMISU)+ fun obtainRuntimeShader(+ key: String,+ @Language("AGSL") string: String+ ): RuntimeShader+}++/**+ * Every glass node asks for the same few shaders, and a [RuntimeShader] compiles its AGSL on the+ * calling (UI) thread, so they are built once for the whole process instead of once per node: a+ * fan of chips, or a page of cards, used to compile two shaders each, the prismatic lens being the+ * dearest. Sharing is safe because an effect or paint snapshots the uniforms the moment it is made,+ * and every node sets its uniforms and makes its effect in one go on the UI thread.+ */+private val sharedRuntimeShaders = HashMap<String, RuntimeShader>()++internal class RuntimeShaderCacheImpl : RuntimeShaderCache {++ @RequiresApi(Build.VERSION_CODES.TIRAMISU)+ override fun obtainRuntimeShader(key: String, string: String): RuntimeShader {+ return sharedRuntimeShaders.getOrPut(key) { RuntimeShader(string) }+ }+}++/**+ * Compiles the glass shaders ahead of the first glass that needs them. Call [next] from an idle+ * handler until it returns false: one shader per call, so no single call holds the UI thread long.+ */+object GlassShaderWarmup {+ private var step = 0++ @Suppress("NewApi")+ fun next(): Boolean {+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) return false+ val cache = RuntimeShaderCacheImpl()+ when (step++) {+ 0 -> cache.obtainRuntimeShader("Refraction", RoundedRectRefractionShaderString)+ 1 -> cache.obtainRuntimeShader("RefractionWithDispersion", RoundedRectRefractionWithDispersionShaderString)+ 2 -> cache.obtainRuntimeShader("Default", DefaultHighlightShaderString)+ 3 -> cache.obtainRuntimeShader("Ambient", AmbientHighlightShaderString)+ else -> return false+ }+ return step < 4+ }+}diff --git a/android/backdrop/src/main/java/com/kyant/backdrop/Shaders.kt b/android/backdrop/src/main/java/com/kyant/backdrop/Shaders.ktindex 45d7d0f..4e790ed 100644--- a/android/backdrop/src/main/java/com/kyant/backdrop/Shaders.kt+++ b/android/backdrop/src/main/java/com/kyant/backdrop/Shaders.kt@@ -125,7 +125,21 @@ half4 main(float2 coord) {float2 refractedCoord = coord + d * grad;float dispersionIntensity = chromaticAberration * ((centeredCoord.x * centeredCoord.y) / (halfSize.x * halfSize.y));float2 dispersedCoord = d * grad * dispersionIntensity;-++ // Most of the rim bends the colours by less than a pixel or two, where seven taps and one tap+ // per channel look the same: take the cheap path there and the full spectrum only where the+ // fringes are wide enough to be seen. The taps sit at the centroids of the seven-tap weights.+ float spread = dot(dispersedCoord, dispersedCoord);+ if (spread < 0.25) {+ return content.eval(refractedCoord);+ }+ if (spread < 4.0) {+ half4 r = content.eval(refractedCoord + dispersedCoord * 0.4286);+ half4 g = content.eval(refractedCoord + dispersedCoord * 0.0952);+ half4 b = content.eval(refractedCoord - dispersedCoord * 0.6667);+ return half4(r.r, g.g, b.b, (r.a + g.a + b.a) / 3.0);+ }+half4 color = half4(0.0);half4 red = content.eval(refractedCoord + dispersedCoord);diff --git a/android/backdrop/src/main/java/com/kyant/backdrop/highlight/HighlightModifier.kt b/android/backdrop/src/main/java/com/kyant/backdrop/highlight/HighlightModifier.ktindex 0112446..45f1242 100644--- a/android/backdrop/src/main/java/com/kyant/backdrop/highlight/HighlightModifier.kt+++ b/android/backdrop/src/main/java/com/kyant/backdrop/highlight/HighlightModifier.kt@@ -13,6 +13,7 @@ import androidx.compose.ui.graphics.Outlineimport androidx.compose.ui.graphics.Paintimport androidx.compose.ui.graphics.PaintingStyleimport androidx.compose.ui.graphics.Path+import androidx.compose.ui.graphics.Shapeimport androidx.compose.ui.graphics.drawOutlineimport androidx.compose.ui.graphics.drawscope.ContentDrawScopeimport androidx.compose.ui.graphics.drawscope.DrawScope@@ -26,6 +27,7 @@ import androidx.compose.ui.node.requireGraphicsContextimport androidx.compose.ui.platform.InspectorInfoimport androidx.compose.ui.unit.Densityimport androidx.compose.ui.unit.IntSize+import androidx.compose.ui.unit.LayoutDirectionimport androidx.compose.ui.util.fastCoerceAtMostimport com.kyant.backdrop.RuntimeShaderCacheImplimport com.kyant.backdrop.ShapeProvider@@ -89,6 +91,16 @@ internal class HighlightNode(private var prevStyle: HighlightStyle? = null+ // what the layer was last recorded for: the rim only changes with these, not with the node's+ // position, so a glass node that moves (a fan chip, a swaying card) doesn't re-record its rim+ private var recordedSize = IntSize.Zero+ private var recordedDensity = 0f+ private var recordedWidth = Float.NaN+ private var recordedBlur = Float.NaN+ private var recordedStyle: HighlightStyle? = null+ private var recordedShape: Shape? = null+ private var recordedLayoutDirection: LayoutDirection? = null+override fun ContentDrawScope.draw() {val highlight = highlight()if (highlight == null || highlight.width.value <= 0f) {@@ -117,18 +129,37 @@ internal class HighlightNode(null}- configurePaint(highlight)+ val shape = shapeProvider.shape+ val widthPx = highlight.width.toPx()+ val blurPx = highlight.blurRadius.toPx()+ val unchanged = safeSize == recordedSize &&+ density.density == recordedDensity &&+ widthPx == recordedWidth &&+ blurPx == recordedBlur &&+ highlight.style == recordedStyle &&+ shape == recordedShape &&+ layoutDirection == recordedLayoutDirectionhighlightLayer.alpha = highlight.alphahighlightLayer.blendMode = highlight.style.blendMode- highlightLayer.record(safeSize) {- translate(1f, 1f) {- val canvas = drawContext.canvas- canvas.save()- canvas.clipOutline(outline, clipPath)- canvas.drawOutline(outline, paint)- canvas.restore()+ if (!unchanged) {+ configurePaint(highlight)+ highlightLayer.record(safeSize) {+ translate(1f, 1f) {+ val canvas = drawContext.canvas+ canvas.save()+ canvas.clipOutline(outline, clipPath)+ canvas.drawOutline(outline, paint)+ canvas.restore()+ }}+ recordedSize = safeSize+ recordedDensity = density.density+ recordedWidth = widthPx+ recordedBlur = blurPx+ recordedStyle = highlight.style+ recordedShape = shape+ recordedLayoutDirection = layoutDirection}translate(-1f, -1f) {@@ -149,8 +180,8 @@ internal class HighlightNode(highlightLayer = null}clipPath = null- runtimeShaderCache.clear()prevStyle = null+ recordedStyle = null}private fun DrawScope.configurePaint(highlight: Highlight) {diff --git a/docs/quick-preview.md b/docs/quick-preview.mdindex 1dc1f97..45f8b4a 100644--- a/docs/quick-preview.md+++ b/docs/quick-preview.md@@ -42,12 +42,19 @@ the full viewer would put it, so:**Lifecycle.** The engine document is closed (`doc_close`, discarding nothing since previews neverchange the file) when the activity finishes; page images are dropped on memory pressure.-**Transitions.** Opening: the card rises from the bottom on a spring as the dim and blur fade in.-Closing: it folds down without bounce, then the activity finishes with no system animation.-Expand: the card grows to fill the screen (margins and corners to zero), then the full viewer-fades in over it and the preview finishes.--**Gestures.** Drag the header down past 110 dp to close, up past 88 dp to expand.+**Transitions.** Opening: the card rises from the bottom on the sheet curve (no bounce: only glass+controls bounce) as the dim and blur fade in. Closing: it folds down, then the activity finishes+with no system animation. Open: straight into the app, with no stop at a full-screen preview. The+card holds still while the viewer rises over it (`preview_open_enter` / `preview_open_exit`, the+UIKit curve in `res/interpolator/ui_curve.xml`), and the preview finishes without an override that+would replace that animation.++**The card is minimal.** A plain header (grabber, name and size, a quiet More and Close), the+pages, and one tinted glass "Open" pill. Share, Save to Downloads and Open with live in More. The+More menu's glass sits inside the card's glass layer, so it refracts the pages (an overlay only+refracts the backdrop at the place its layer is composed).++**Gestures.** Drag the header down past 110 dp to close, up past 88 dp to open.**Settings.** Settings ▸ Reading ▸ Quick Preview turns it off: files then go straight to the fullviewer.