Skip to content

Open-source Android PDF and document toolkit with PDF tools, Office viewing, XLSX editing, scanning, and image editing. Built with Kotlin and Jetpack Compose.

Artefact: a new desk, notes, voice memos, welcome pages and Quick Preview

chethan6168dfcd968575b
diff --git a/apps/pdfcraft-android/android/app/build.gradle.kts b/apps/pdfcraft-android/android/app/build.gradle.kts
index 474939d..e513ef6 100644
--- a/apps/pdfcraft-android/android/app/build.gradle.kts
+++ b/apps/pdfcraft-android/android/app/build.gradle.kts
@@ -319,20 +319,10 @@ androidComponents {
library.set(cargoBuild.flatMap { it.outputDir.file("${rustAbis.first()}/libpdfcraft_android.so") })
}
val assetsDir = File(cargoWorkspaceDir, "assets")
- val res = tasks.register<PdfcraftAssets>("pdfcraftResources$name") {
- val map = mapOf(
- "fonts/Inter-Regular.ttf" to "font/inter_regular.ttf",
- "fonts/Inter-Medium.ttf" to "font/inter_medium.ttf",
- "fonts/Inter-SemiBold.ttf" to "font/inter_semibold.ttf",
- )
- files.from(map.keys.map { File(assetsDir, it) })
- targets.set(map.mapKeys { (k, _) -> k.substringAfterLast('/') })
- }
val licences = tasks.register<PdfcraftAssets>("pdfcraftLicences$name") {
// the Licences screen shows each (the Adobe CMaps' notice, from a crates.io crate, is a
// plain asset: app/src/main/assets/licences)
val map = mapOf(
- File(assetsDir, "fonts/OFL-Inter.txt") to "licences/OFL-Inter.txt",
File(assetsDir, "icons/LICENSE-lucide.txt") to "licences/LICENSE-lucide.txt",
File(assetsDir, "fonts/OFL-DancingScript.txt") to "licences/OFL-DancingScript.txt",
File(cargoWorkspaceDir, "vendor/hayro-interpret/assets/LICENSE_FOXIT") to "licences/LICENSE-foxit.txt",
@@ -351,7 +341,6 @@ androidComponents {
variant.sources.assets?.addGeneratedSourceDirectory(models, OcrModels::outputDir)
variant.sources.jniLibs?.addGeneratedSourceDirectory(cargoBuild, CargoNdkBuild::outputDir)
variant.sources.java?.addGeneratedSourceDirectory(bindgen, UniffiBindgen::outputDir)
- variant.sources.res?.addGeneratedSourceDirectory(res, PdfcraftAssets::outputDir)
variant.sources.assets?.addGeneratedSourceDirectory(licences, PdfcraftAssets::outputDir)
}
}
diff --git a/apps/pdfcraft-android/android/app/src/main/AndroidManifest.xml b/apps/pdfcraft-android/android/app/src/main/AndroidManifest.xml
index 037a56e..92a07e4 100644
--- a/apps/pdfcraft-android/android/app/src/main/AndroidManifest.xml
+++ b/apps/pdfcraft-android/android/app/src/main/AndroidManifest.xml
@@ -12,7 +12,7 @@
granting it makes Android refuse IMAGE_CAPTURE. -->
<uses-feature android:name="android.hardware.camera.any" android:required="false" />
- <!-- Read aloud keeps reading with ClearPDF in the background (a media notification) -->
+ <!-- Read aloud keeps reading with Artefact in the background (a media notification) -->
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK" />
@@ -25,7 +25,7 @@
android:requestLegacyExternalStorage="true"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
- android:theme="@style/Theme.ClearPDF">
+ android:theme="@style/Theme.Artefact">
<activity
android:name=".MainActivity"
@@ -37,8 +37,32 @@
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
- <!-- PDFs other apps open with ClearPDF -->
+ <!-- PDFs shared to Artefact open in the full app. (PDFs other apps *open* with Artefact
+ go to Quick Preview below; its Expand comes here with an explicit intent.) -->
<intent-filter android:label="@string/open_with">
+ <action android:name="android.intent.action.SEND" />
+ <action android:name="android.intent.action.SEND_MULTIPLE" />
+ <category android:name="android.intent.category.DEFAULT" />
+ <data android:mimeType="application/pdf" />
+ </intent-filter>
+ </activity>
+
+ <!--
+ Quick Preview: "Open with Artefact" from a chat, a mail or a file manager shows the file in
+ a floating card over that app. Translucent and in the caller's task (standard launch mode),
+ so the caller stays drawn behind it and Back or Close lands exactly where the user was.
+ More document types join the filter as the engine learns them.
+ -->
+ <activity
+ android:name=".preview.QuickPreviewActivity"
+ android:configChanges="orientation|screenSize|screenLayout|smallestScreenSize|keyboardHidden|uiMode|density"
+ android:excludeFromRecents="true"
+ android:exported="true"
+ android:label="@string/app_name"
+ android:launchMode="standard"
+ android:theme="@style/Theme.Artefact.Preview"
+ android:windowSoftInputMode="adjustResize">
+ <intent-filter android:label="@string/app_name">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
@@ -46,13 +70,6 @@
<data android:scheme="file" />
<data android:mimeType="application/pdf" />
</intent-filter>
- <!-- PDFs shared to ClearPDF -->
- <intent-filter android:label="@string/open_with">
- <action android:name="android.intent.action.SEND" />
- <action android:name="android.intent.action.SEND_MULTIPLE" />
- <category android:name="android.intent.category.DEFAULT" />
- <data android:mimeType="application/pdf" />
- </intent-filter>
</activity>
<service
@@ -60,7 +77,7 @@
android:exported="false"
android:foregroundServiceType="mediaPlayback" />
- <!-- Files of ClearPDF's handed to other apps (share, print, open in) -->
+ <!-- Files of Artefact's handed to other apps (share, print, open in) -->
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.files"
diff --git a/apps/pdfcraft-android/android/app/src/main/assets/licences/OFL-DMSerifDisplay.txt b/apps/pdfcraft-android/android/app/src/main/assets/licences/OFL-DMSerifDisplay.txt
new file mode 100644
index 0000000..be384f0
--- /dev/null
+++ b/apps/pdfcraft-android/android/app/src/main/assets/licences/OFL-DMSerifDisplay.txt
@@ -0,0 +1,93 @@
+Copyright 2014-2018 Adobe (http://www.adobe.com/), with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of Adobe in the United States and/or other countries. Copyright 2019 Google LLC.
+
+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/apps/pdfcraft-android/android/app/src/main/assets/licences/OFL-BricolageGrotesque.txt b/apps/pdfcraft-android/android/app/src/main/assets/licences/OFL-Doto.txt
similarity index 97%
rename from apps/pdfcraft-android/android/app/src/main/assets/licences/OFL-BricolageGrotesque.txt
rename to apps/pdfcraft-android/android/app/src/main/assets/licences/OFL-Doto.txt
index a397658..e0b8ec1 100644
--- a/apps/pdfcraft-android/android/app/src/main/assets/licences/OFL-BricolageGrotesque.txt
+++ b/apps/pdfcraft-android/android/app/src/main/assets/licences/OFL-Doto.txt
@@ -1,8 +1,8 @@
-Copyright 2022 The Bricolage Grotesque Project Authors (https://github.com/ateliertriay/bricolage)
+Copyright 2024 The Doto Project Authors (https://github.com/oliverlalan/Doto)
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
+https://openfontlicense.org
-----------------------------------------------------------
diff --git a/apps/pdfcraft-android/android/app/src/main/assets/licences/OFL-PlusJakartaSans.txt b/apps/pdfcraft-android/android/app/src/main/assets/licences/OFL-PlusJakartaSans.txt
new file mode 100644
index 0000000..ea69b0c
--- /dev/null
+++ b/apps/pdfcraft-android/android/app/src/main/assets/licences/OFL-PlusJakartaSans.txt
@@ -0,0 +1,93 @@
+Copyright 2020 The Plus Jakarta Sans Project Authors (https://github.com/tokotype/PlusJakartaSans)
+
+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/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/MainActivity.kt b/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/MainActivity.kt
index 4f1982e..bd9d15a 100644
--- a/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/MainActivity.kt
+++ b/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/MainActivity.kt
@@ -34,6 +34,11 @@ import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
class MainActivity : ComponentActivity() {
+ companion object {
+ /** Set by Quick Preview's Expand: the document came from another app through the preview. */
+ const val EXTRA_FROM_PREVIEW = "com.chethan616.clearpdf.FROM_PREVIEW"
+ }
+
private val vm: AppViewModel by viewModels()
/** Browse: any PDF a document provider offers, opened with write access when it allows. */
@@ -50,6 +55,8 @@ class MainActivity : ComponentActivity() {
private val pickPhotos = registerForActivityResult(ActivityResultContracts.PickMultipleVisualMedia()) { uris -> vm.onPhotosPicked(uris) }
private val pickFolder = registerForActivityResult(ActivityResultContracts.OpenDocumentTree()) { uri -> uri?.let(vm::addLocalFolder) }
private val micPermission = registerForActivityResult(ActivityResultContracts.RequestPermission()) { granted -> vm.onMicPermission(granted) }
+ private val pickNotePhoto = registerForActivityResult(ActivityResultContracts.PickVisualMedia()) { uri -> vm.onNotePhoto(uri) }
+ private val takeNotePhoto = registerForActivityResult(ActivityResultContracts.TakePicture()) { ok -> vm.onNoteCamera(ok) }
override fun onCreate(savedInstanceState: Bundle?) {
// transparent system bars with no contrast scrim: every screen paints the bands behind the
@@ -101,6 +108,13 @@ class MainActivity : ComponentActivity() {
}
lifecycleScope.launch { for (d in vm.imagePicks) launchSafely { pickImage.launch(PickVisualMediaRequest(ActivityResultContracts.PickVisualMedia.ImageOnly)) } }
lifecycleScope.launch { for (u in vm.photoPicks) launchSafely { pickPhotos.launch(PickVisualMediaRequest(ActivityResultContracts.PickVisualMedia.ImageOnly)) } }
+ lifecycleScope.launch { for (u in vm.notePhotoPicks) launchSafely { pickNotePhoto.launch(PickVisualMediaRequest(ActivityResultContracts.PickVisualMedia.ImageOnly)) } }
+ lifecycleScope.launch {
+ for (f in vm.noteCameraShots) {
+ val uri = FileProvider.getUriForFile(this@MainActivity, "$packageName.files", f)
+ launchSafely { takeNotePhoto.launch(uri) }
+ }
+ }
// the folder picker opens at Documents, where PDFs usually are (Download itself can't be chosen)
val documents = android.provider.DocumentsContract.buildDocumentUri("com.android.externalstorage.documents", "primary:Documents")
lifecycleScope.launch { for (u in vm.accessRequests) launchSafely { pickFolder.launch(documents) } }
diff --git a/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/ReadAloudService.kt b/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/ReadAloudService.kt
index 8ae5e71..9ad4372 100644
--- a/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/ReadAloudService.kt
+++ b/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/ReadAloudService.kt
@@ -37,7 +37,7 @@ class ReadAloudService : Service() {
super.onCreate()
val nm = getSystemService(NotificationManager::class.java)
nm?.createNotificationChannel(NotificationChannel(CHANNEL, getString(R.string.common_tool_read_aloud), NotificationManager.IMPORTANCE_LOW).apply { setShowBadge(false) })
- session = MediaSession(this, "ClearPDF read aloud").apply {
+ session = MediaSession(this, "Artefact read aloud").apply {
setCallback(object : MediaSession.Callback() {
override fun onPlay() { controls?.play() }
override fun onPause() { controls?.pause() }
diff --git a/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/engine/DocumentFiles.kt b/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/engine/DocumentFiles.kt
index c0f5057..7663cf3 100644
--- a/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/engine/DocumentFiles.kt
+++ b/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/engine/DocumentFiles.kt
@@ -212,7 +212,7 @@ class DocumentFiles(private val context: Context) {
val values = android.content.ContentValues().apply {
put(android.provider.MediaStore.MediaColumns.DISPLAY_NAME, name)
put(android.provider.MediaStore.MediaColumns.MIME_TYPE, mime)
- put(android.provider.MediaStore.MediaColumns.RELATIVE_PATH, android.os.Environment.DIRECTORY_PICTURES + "/ClearPDF")
+ put(android.provider.MediaStore.MediaColumns.RELATIVE_PATH, android.os.Environment.DIRECTORY_PICTURES + "/Artefact")
}
val uri = resolver.insert(android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values) ?: error(context.getString(R.string.files_error_save_image))
resolver.openOutputStream(uri).use { out ->
diff --git a/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/notes/Notes.kt b/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/notes/Notes.kt
new file mode 100644
index 0000000..7dc7962
--- /dev/null
+++ b/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/notes/Notes.kt
@@ -0,0 +1,206 @@
+package com.chethan616.clearpdf.notes
+
+import android.content.Context
+import android.net.Uri
+import androidx.compose.runtime.Immutable
+import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.setValue
+import java.io.File
+import java.util.UUID
+import kotlinx.coroutines.CoroutineScope
+import kotlinx.coroutines.Dispatchers
+import kotlinx.coroutines.Job
+import kotlinx.coroutines.delay
+import kotlinx.coroutines.launch
+import kotlinx.coroutines.withContext
+import org.json.JSONArray
+import org.json.JSONObject
+
+/** What a note is: words, a checklist, or a voice memo. */
+enum class NoteKind { Text, List, Voice }
+
+@Immutable
+data class CheckItem(val id: String, val text: String, val done: Boolean)
+
+/**
+ * A note on the desk. Text notes have a [title] and a [body] (light Markdown: `**bold**`, `# `),
+ * lists their [items], voice notes their [audio] with a [wave] to draw. Any of them can hold
+ * [images]. Media files live in the notes folder under their own names.
+ */
+@Immutable
+data class Note(
+ val id: String,
+ val kind: NoteKind,
+ val title: String = "",
+ val body: String = "",
+ val items: List<CheckItem> = emptyList(),
+ val images: List<String> = emptyList(),
+ val audio: String? = null,
+ val durationMs: Long = 0,
+ val wave: List<Float> = emptyList(),
+ val created: Long = System.currentTimeMillis(),
+ val updated: Long = created,
+ val pinned: Boolean = false,
+) {
+ val isEmpty: Boolean get() = title.isBlank() && body.isBlank() && items.none { it.text.isNotBlank() } && images.isEmpty() && audio == null
+}
+
+/**
+ * The notes, kept in memory as Compose state and written to `files/notes/notes.json` (a moment
+ * after each change, atomically). Media sits beside it in `files/notes/media`.
+ */
+class Notes(private val context: Context, private val scope: CoroutineScope) {
+ private val dir = File(context.filesDir, "notes").apply { mkdirs() }
+ private val media = File(dir, "media").apply { mkdirs() }
+ private val store = File(dir, "notes.json")
+
+ var all by mutableStateOf<List<Note>>(emptyList())
+ private set
+ var loaded by mutableStateOf(false)
+ private set
+
+ private var saveJob: Job? = null
+
+ init {
+ scope.launch {
+ val list = withContext(Dispatchers.IO) { runCatching { read() }.getOrDefault(emptyList()) }
+ all = list
+ loaded = true
+ }
+ }
+
+ /** True when the notes were never written (a fresh install): the welcome notes go in. */
+ val isFresh: Boolean get() = !store.exists()
+
+ fun get(id: String): Note? = all.firstOrNull { it.id == id }
+
+ fun file(name: String): File = File(media, name)
+
+ /** 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)
+ all = listOf(n) + all
+ save()
+ return n
+ }
+
+ fun put(note: Note) {
+ all = all.map { if (it.id == note.id) note.copy(updated = System.currentTimeMillis()) else it }
+ save()
+ }
+
+ fun add(note: Note) {
+ all = listOf(note) + all.filter { it.id != note.id }
+ save()
+ }
+
+ fun toggle(noteId: String, itemId: String) {
+ val n = get(noteId) ?: return
+ put(n.copy(items = n.items.map { if (it.id == itemId) it.copy(done = !it.done) else it }))
+ }
+
+ fun delete(id: String) {
+ val n = get(id) ?: return
+ all = all.filter { it.id != id }
+ save()
+ scope.launch(Dispatchers.IO) {
+ n.images.forEach { file(it).delete() }
+ n.audio?.let { file(it).delete() }
+ }
+ }
+
+ /** Drops notes left empty (a new note closed without a word in it). */
+ fun prune(id: String) {
+ if (get(id)?.isEmpty == true) delete(id)
+ }
+
+ /** Copy a picked picture into the notes folder; its file name, or null when it couldn't be read. */
+ suspend fun importImage(uri: Uri): String? = withContext(Dispatchers.IO) {
+ runCatching {
+ val out = newMedia("jpg")
+ context.contentResolver.openInputStream(uri)!!.use { input -> out.outputStream().use { input.copyTo(it) } }
+ out.name
+ }.getOrNull()
+ }
+
+ private fun save() {
+ saveJob?.cancel()
+ val snapshot = all
+ saveJob = scope.launch(Dispatchers.IO) {
+ delay(250)
+ runCatching { write(snapshot) }
+ }
+ }
+
+ private fun write(list: List<Note>) {
+ val arr = JSONArray()
+ list.forEach { arr.put(it.toJson()) }
+ val tmp = File(dir, "notes.json.tmp")
+ tmp.writeText(arr.toString())
+ if (!tmp.renameTo(store)) {
+ store.delete()
+ tmp.renameTo(store)
+ }
+ }
+
+ private fun read(): List<Note> {
+ if (!store.exists()) return emptyList()
+ val arr = JSONArray(store.readText())
+ return (0 until arr.length()).mapNotNull { i -> runCatching { arr.getJSONObject(i).toNote() }.getOrNull() }
+ }
+}
+
+private fun Note.toJson() = JSONObject().apply {
+ put("id", id)
+ put("kind", kind.name)
+ put("title", title)
+ put("body", body)
+ put("items", JSONArray().apply { items.forEach { put(JSONObject().put("id", it.id).put("text", it.text).put("done", it.done)) } })
+ put("images", JSONArray(images))
+ audio?.let { put("audio", it) }
+ put("duration", durationMs)
+ put("wave", JSONArray().apply { wave.forEach { put(it.toDouble()) } })
+ put("created", created)
+ put("updated", updated)
+ put("pinned", pinned)
+}
+
+private fun JSONObject.toNote(): Note {
+ val items = optJSONArray("items")?.let { a ->
+ (0 until a.length()).map { i -> a.getJSONObject(i).let { CheckItem(it.optString("id", UUID.randomUUID().toString()), it.optString("text"), it.optBoolean("done")) } }
+ }.orEmpty()
+ val images = optJSONArray("images")?.let { a -> (0 until a.length()).map { a.getString(it) } }.orEmpty()
+ val wave = optJSONArray("wave")?.let { a -> (0 until a.length()).map { a.getDouble(it).toFloat() } }.orEmpty()
+ return Note(
+ id = getString("id"),
+ kind = runCatching { NoteKind.valueOf(optString("kind")) }.getOrDefault(NoteKind.Text),
+ title = optString("title"),
+ body = optString("body"),
+ items = items,
+ images = images,
+ audio = optString("audio").takeIf { it.isNotEmpty() },
+ durationMs = optLong("duration"),
+ wave = wave,
+ created = optLong("created", System.currentTimeMillis()),
+ updated = optLong("updated", System.currentTimeMillis()),
+ pinned = optBoolean("pinned"),
+ )
+}
+
+/** A new checklist item. */
+fun checkItem(text: String, done: Boolean = false) = CheckItem(UUID.randomUUID().toString(), text, done)
+
+/** [levels] (one per 50 ms) squeezed to [bars] for a card's waveform, each 0.12..1. */
+fun waveOf(levels: List<Float>, bars: Int = 48): List<Float> {
+ if (levels.isEmpty()) return List(bars) { 0.2f }
+ val peak = levels.max().coerceAtLeast(0.02f)
+ return List(bars) { i ->
+ val from = i * levels.size / bars
+ val to = ((i + 1) * levels.size / bars).coerceAtLeast(from + 1).coerceAtMost(levels.size)
+ val v = levels.subList(from.coerceAtMost(levels.size - 1), to).max() / peak
+ (0.12f + 0.88f * v).coerceIn(0.12f, 1f)
+ }
+}
diff --git a/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/preview/QuickPreview.kt b/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/preview/QuickPreview.kt
new file mode 100644
index 0000000..309ccd8
--- /dev/null
+++ b/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/preview/QuickPreview.kt
@@ -0,0 +1,395 @@
+package com.chethan616.clearpdf.preview
+
+import androidx.activity.compose.BackHandler
+import androidx.compose.animation.AnimatedContent
+import androidx.compose.animation.core.Animatable
+import androidx.compose.animation.fadeIn
+import androidx.compose.animation.fadeOut
+import androidx.compose.animation.togetherWith
+import androidx.compose.foundation.background
+import androidx.compose.foundation.clickable
+import androidx.compose.foundation.gestures.detectVerticalDragGestures
+import androidx.compose.foundation.interaction.MutableInteractionSource
+import androidx.compose.foundation.layout.Arrangement
+import androidx.compose.foundation.layout.Box
+import androidx.compose.foundation.layout.BoxWithConstraints
+import androidx.compose.foundation.layout.Column
+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.width
+import androidx.compose.foundation.text.KeyboardActions
+import androidx.compose.foundation.text.KeyboardOptions
+import androidx.compose.material3.Icon
+import androidx.compose.material3.Text
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.CompositionLocalProvider
+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.rememberCoroutineScope
+import androidx.compose.runtime.setValue
+import androidx.compose.runtime.snapshotFlow
+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.Color
+import androidx.compose.ui.graphics.graphicsLayer
+import androidx.compose.ui.input.pointer.pointerInput
+import androidx.compose.ui.layout.boundsInWindow
+import androidx.compose.ui.layout.onGloballyPositioned
+import androidx.compose.ui.platform.LocalDensity
+import androidx.compose.ui.res.stringResource
+import androidx.compose.ui.text.input.ImeAction
+import androidx.compose.ui.text.input.KeyboardType
+import androidx.compose.ui.text.style.TextAlign
+import androidx.compose.ui.text.style.TextOverflow
+import androidx.compose.ui.unit.dp
+import androidx.compose.ui.util.lerp
+import com.chethan616.clearpdf.R
+import com.chethan616.clearpdf.ui.LucideIcons
+import com.chethan616.clearpdf.ui.PdfField
+import com.chethan616.clearpdf.ui.PdfcraftTheme
+import com.chethan616.clearpdf.ui.ThemeChoice
+import com.chethan616.clearpdf.ui.glass.GlassCircle
+import com.chethan616.clearpdf.ui.glass.GlassIcon
+import com.chethan616.clearpdf.ui.glass.GlassLayer
+import com.chethan616.clearpdf.ui.glass.GlassLoader
+import com.chethan616.clearpdf.ui.glass.GlassMenu
+import com.chethan616.clearpdf.ui.glass.GlassMenuItem
+import com.chethan616.clearpdf.ui.glass.GlassMotion
+import com.chethan616.clearpdf.ui.glass.GlassOverlayHost
+import com.chethan616.clearpdf.ui.glass.GlassOverlayLayer
+import com.chethan616.clearpdf.ui.glass.GlassPill
+import com.chethan616.clearpdf.ui.glass.GlassToast
+import com.chethan616.clearpdf.ui.glass.LocalGlassOverlayHost
+import com.chethan616.clearpdf.ui.glass.ProvideGlassHaptics
+import com.chethan616.clearpdf.ui.glass.glass
+import com.chethan616.clearpdf.ui.mascot.Mascot
+import com.chethan616.clearpdf.ui.mascot.MascotMood
+import com.chethan616.clearpdf.ui.theme.Candy
+import com.chethan616.clearpdf.ui.theme.ClearTheme
+import com.chethan616.clearpdf.ui.theme.ClearType
+import com.chethan616.clearpdf.ui.theme.clear
+import com.chethan616.clearpdf.ui.viewer.CanvasLook
+import com.chethan616.clearpdf.ui.viewer.PageCanvas
+import com.chethan616.clearpdf.ui.viewer.formatSize
+import com.kyant.shapes.Capsule
+import com.kyant.shapes.RoundedRectangle
+import kotlinx.coroutines.delay
+import kotlinx.coroutines.launch
+
+/** How much of the screen's height the card takes: the caller stays visible above it. */
+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.
+ */
+@Composable
+internal fun QuickPreviewScreen(
+ activity: QuickPreviewActivity,
+ state: PreviewState,
+ onClose: () -> Unit,
+ onExpand: () -> Unit,
+ onShare: () -> Unit,
+ onOpenWith: () -> Unit,
+ onSaveCopy: ((String) -> Unit) -> Unit,
+ onPassword: (String) -> Unit,
+ setBlur: (Int) -> Unit,
+) {
+ val overlays = remember { GlassOverlayHost() }
+ ClearTheme(ThemeChoice.System) {
+ PdfcraftTheme(ThemeChoice.System) {
+ ProvideGlassHaptics {
+ CompositionLocalProvider(LocalGlassOverlayHost provides overlays) {
+ Box(Modifier.fillMaxSize()) {
+ Preview(state, onClose, onExpand, onShare, onOpenWith, onSaveCopy, onPassword, setBlur)
+ GlassOverlayLayer(overlays)
+ }
+ }
+ }
+ }
+ }
+}
+
+@Composable
+private fun Preview(
+ state: PreviewState,
+ onClose: () -> Unit,
+ onExpand: () -> Unit,
+ onShare: () -> Unit,
+ onOpenWith: () -> Unit,
+ onSaveCopy: ((String) -> Unit) -> Unit,
+ onPassword: (String) -> Unit,
+ setBlur: (Int) -> Unit,
+) {
+ val c = clear
+ val scope = rememberCoroutineScope()
+ val density = LocalDensity.current
+ val 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) }
+
+ LaunchedEffect(Unit) { appear.animateTo(1f, GlassMotion.morph()) }
+ // the blur behind follows the card in and out
+ LaunchedEffect(Unit) {
+ snapshotFlow { (appear.value.coerceIn(0f, 1f) * (1f - grow.value) * 36f).toInt() }.collect { setBlur(it) }
+ }
+ LaunchedEffect(toast) {
+ if (toast != null) {
+ delay(2600)
+ toast = null
+ }
+ }
+
+ fun close() {
+ if (leaving) return
+ leaving = true
+ scope.launch {
+ appear.animateTo(0f, GlassMotion.fold())
+ onClose()
+ }
+ }
+
+ fun expand() {
+ if (leaving) return
+ leaving = true
+ scope.launch {
+ grow.animateTo(1f, GlassMotion.morph())
+ 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 close
+ Box(
+ Modifier.fillMaxSize()
+ .graphicsLayer { alpha = appear.value.coerceIn(0f, 1f) * (1f - grow.value * 0.3f) }
+ .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
+ Box(
+ Modifier
+ .align(Alignment.BottomCenter)
+ .graphicsLayer {
+ val g = grow.value
+ 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) - g * navPx * 0f
+ val pull = (-drag).coerceAtLeast(0f) / fullH
+ scaleX = lerp(0.94f, 1f, p.coerceIn(0f, 1.2f)) + pull * 0.06f
+ scaleY = scaleX
+ }
+ .padding(
+ start = with(density) { lerp(margin, 0f, grow.value).toDp() },
+ end = with(density) { lerp(margin, 0f, grow.value).toDp() },
+ bottom = with(density) { lerp(margin + navPx, 0f, grow.value).toDp() },
+ )
+ .fillMaxWidth()
+ .height(with(density) { lerp(cardH, fullH, grow.value).toDp() })
+ .clip(RoundedRectangle(lerp(34f, 0f, grow.value).dp))
+ .background(if (c.dark) Color(0xFF111A1F) else Color(0xFFE6ECF4))
+ .clickable(remember { MutableInteractionSource() }, null) {},
+ ) {
+ val headerH = 112.dp
+ GlassLayer(
+ Modifier.fillMaxSize(),
+ content = {
+ AnimatedContent(
+ state, contentKey = { it::class }, label = "preview",
+ transitionSpec = { fadeIn(GlassMotion.settle()) togetherWith fadeOut(GlassMotion.fold()) },
+ ) { s ->
+ when (s) {
+ is PreviewState.Ready -> Pages(s, headerH)
+ 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() }
+ }
+ }
+ },
+ ) {
+ Header(
+ state, Modifier.align(Alignment.TopCenter).padding(top = with(density) { lerp(0f, statusPx, grow.value).toDp() }),
+ onDrag = { d -> drag += d },
+ 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 } }
+ }
+ },
+ onClose = ::close, onExpand = ::expand, 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)) }
+ toast?.let { t -> GlassToast(t, null, {}, Modifier.align(Alignment.BottomCenter).padding(start = 16.dp, end = 16.dp, bottom = 84.dp)) }
+ }
+ }
+ }
+}
+
+/** The pages, scrolling under the glass 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
+ val density = LocalDensity.current
+ LaunchedEffect(s) {
+ with(density) { s.view.setPadding(headerTop.toPx(), 86.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)),
+ 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. */
+@Composable
+private fun Header(
+ state: PreviewState,
+ modifier: Modifier,
+ onDrag: (Float) -> Unit,
+ onDragEnd: () -> Unit,
+ onClose: () -> Unit,
+ onExpand: () -> Unit,
+ onShare: () -> Unit,
+ onOpenWith: () -> Unit,
+ onSaveCopy: () -> Unit,
+) {
+ val c = clear
+ var menu by remember { mutableStateOf(false) }
+ var anchor by remember { mutableStateOf(Rect.Zero) }
+ val ready = state as? PreviewState.Ready
+ Column(
+ modifier.fillMaxWidth().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)))
+ }
+ Row(
+ Modifier.padding(horizontal = 10.dp).fillMaxWidth().glass(Capsule, c.frost, blur = 14.dp).padding(6.dp),
+ verticalAlignment = Alignment.CenterVertically,
+ horizontalArrangement = Arrangement.spacedBy(6.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)) {
+ Text(
+ ready?.name?.removeSuffix(".pdf")?.removeSuffix(".PDF") ?: stringResource(R.string.preview_title),
+ style = ClearType.BodyStrong, color = c.ink, maxLines = 1, overflow = TextOverflow.Ellipsis,
+ )
+ if (ready != null) {
+ Text(
+ listOf("PDF", androidx.compose.ui.res.pluralStringResource(R.plurals.preview_pages, ready.info.pages.size, ready.info.pages.size), formatSize(ready.size)).joinToString(" · "),
+ style = ClearType.Caption, color = c.inkSoft, maxLines = 1,
+ )
+ }
+ }
+ 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)) }
+ }
+ }
+ }
+ if (menu) {
+ GlassMenu(
+ anchor, { menu = false },
+ listOf(
+ GlassMenuItem(stringResource(R.string.preview_open_in_app), LucideIcons.Maximize2, onClick = onExpand),
+ GlassMenuItem(stringResource(R.string.preview_save_downloads), LucideIcons.FileDown, onClick = onSaveCopy),
+ GlassMenuItem(stringResource(R.string.home_open_with), LucideIcons.ExternalLink, onClick = onOpenWith),
+ ),
+ )
+ }
+}
+
+/** The card's foot, on glass: Share, the page it's on ("3 / 12"), and Open (Expand) in the app's blue. */
+@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)
+ }
+ }
+}
+
+/** A locked document: its password, asked for right in the card. */
+@Composable
+private fun PasswordCard(s: PreviewState.Password, onPassword: (String) -> Unit) {
+ val c = clear
+ var pw by remember { mutableStateOf("") }
+ Column(Modifier.fillMaxSize().padding(28.dp), horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.Center) {
+ Mascot("ghost", if (s.wrong) MascotMood.Sad else MascotMood.NeedsYou, 96.dp)
+ Spacer(Modifier.height(16.dp))
+ Text(stringResource(R.string.root_enter_password), style = ClearType.Headline, color = c.ink, textAlign = TextAlign.Center)
+ Spacer(Modifier.height(6.dp))
+ Text(stringResource(if (s.wrong) R.string.common_wrong_password else R.string.preview_locked_body), style = ClearType.Body, color = if (s.wrong) Candy.Tomato else c.inkSoft, textAlign = TextAlign.Center)
+ Spacer(Modifier.height(18.dp))
+ PdfField(
+ pw, { pw = it }, stringResource(R.string.common_password), password = true, error = s.wrong && pw.isEmpty(),
+ keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Password, imeAction = ImeAction.Done),
+ keyboardActions = KeyboardActions(onDone = { if (pw.isNotEmpty()) onPassword(pw) }),
+ )
+ Spacer(Modifier.height(14.dp))
+ GlassPill(onClick = { if (pw.isNotEmpty()) onPassword(pw) }, tint = Candy.Sky, modifier = Modifier.fillMaxWidth()) {
+ Icon(LucideIcons.LockOpen, null, tint = Color.White, modifier = Modifier.size(18.dp))
+ Text(stringResource(R.string.preview_unlock), style = ClearType.BodyStrong, color = Color.White)
+ }
+ }
+}
+
+/** Something went wrong: a sad mascot, the reason, and Close. */
+@Composable
+private fun FailedCard(message: String, onClose: () -> Unit) {
+ val c = clear
+ Column(Modifier.fillMaxSize().padding(28.dp), horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.Center) {
+ Mascot("puddle", MascotMood.Sad, 100.dp)
+ Spacer(Modifier.height(16.dp))
+ Text(stringResource(R.string.preview_failed_title), style = ClearType.Headline, color = c.ink, textAlign = TextAlign.Center)
+ Spacer(Modifier.height(6.dp))
+ Text(message, style = ClearType.Body, color = c.inkSoft, textAlign = TextAlign.Center)
+ Spacer(Modifier.height(18.dp))
+ GlassPill(onClick = onClose) { Text(stringResource(R.string.preview_close), style = ClearType.BodyStrong, color = c.ink) }
+ }
+}
+
diff --git a/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/preview/QuickPreviewActivity.kt b/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/preview/QuickPreviewActivity.kt
new file mode 100644
index 0000000..8880443
--- /dev/null
+++ b/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/preview/QuickPreviewActivity.kt
@@ -0,0 +1,243 @@
+package com.chethan616.clearpdf.preview
+
+import android.app.Activity
+import android.content.ActivityNotFoundException
+import android.content.Intent
+import android.net.Uri
+import android.os.Build
+import android.os.Bundle
+import android.view.WindowManager
+import androidx.activity.ComponentActivity
+import androidx.activity.SystemBarStyle
+import androidx.activity.compose.setContent
+import androidx.activity.enableEdgeToEdge
+import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.setValue
+import androidx.core.content.IntentCompat
+import androidx.lifecycle.lifecycleScope
+import com.chethan616.clearpdf.MainActivity
+import com.chethan616.clearpdf.PdfcraftApplication
+import com.chethan616.clearpdf.R
+import com.chethan616.clearpdf.core.DocumentInfo
+import com.chethan616.clearpdf.core.MobileException
+import com.chethan616.clearpdf.engine.DocumentFiles
+import com.chethan616.clearpdf.engine.Engine
+import com.chethan616.clearpdf.engine.userMessage
+import com.chethan616.clearpdf.ui.glass.GlassSettings
+import com.chethan616.clearpdf.ui.viewer.PageImages
+import com.chethan616.clearpdf.ui.viewer.PageSize
+import com.chethan616.clearpdf.ui.viewer.ViewerState
+import java.io.File
+import kotlinx.coroutines.CoroutineScope
+import kotlinx.coroutines.Dispatchers
+import kotlinx.coroutines.SupervisorJob
+import kotlinx.coroutines.launch
+import kotlinx.coroutines.withContext
+
+/**
+ * Quick Preview: a document another app hands to Artefact ("Open with", a chat's attachment)
+ * opens in a floating card over that app instead of the full viewer.
+ *
+ * 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
+ * reveals the caller again. Nothing here draws over other apps: no overlay permission, no PiP.
+ */
+class QuickPreviewActivity : ComponentActivity() {
+ private val app get() = application as PdfcraftApplication
+ private val files by lazy { DocumentFiles(this) }
+
+ /** What the card shows: loading, a password to ask for, the document, or what went wrong. */
+ internal var state by mutableStateOf<PreviewState>(PreviewState.Loading)
+ private set
+
+ private var uri: Uri? = null
+ private var mime: String? = null
+ private var engine: Engine? = null
+ private var copy: File? = null
+
+ /** Engine work that must outlive the activity (closing the document). */
+ private val cleanup = CoroutineScope(SupervisorJob() + Dispatchers.IO)
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ enableEdgeToEdge(
+ statusBarStyle = SystemBarStyle.auto(android.graphics.Color.TRANSPARENT, android.graphics.Color.TRANSPARENT),
+ navigationBarStyle = SystemBarStyle.auto(android.graphics.Color.TRANSPARENT, android.graphics.Color.TRANSPARENT),
+ )
+ window.isNavigationBarContrastEnforced = false
+ super.onCreate(savedInstanceState)
+ GlassSettings.load(this)
+ uri = sourceOf(intent)
+ mime = intent?.type ?: uri?.let { contentResolver.getType(it) }
+ if (uri == null) {
+ finish()
+ return
+ }
+ // the user turned Quick Preview off: straight to the full viewer
+ if (!getSharedPreferences("app", MODE_PRIVATE).getBoolean("quickPreview", true)) {
+ expand()
+ return
+ }
+ setContent {
+ QuickPreviewScreen(
+ activity = this,
+ state = state,
+ onClose = ::closeNow,
+ onExpand = ::expand,
+ onShare = ::share,
+ onOpenWith = ::openWith,
+ onSaveCopy = ::saveCopy,
+ onPassword = ::unlock,
+ setBlur = ::setBlur,
+ )
+ }
+ load(null)
+ }
+
+ /** The document's address from a View or a Send intent. */
+ private fun sourceOf(i: Intent?): Uri? = when (i?.action) {
+ Intent.ACTION_VIEW -> i.data
+ Intent.ACTION_SEND -> IntentCompat.getParcelableExtra(i, Intent.EXTRA_STREAM, Uri::class.java)
+ else -> null
+ }
+
+ /**
+ * Copy the file in (the caller's grant lasts only as long as this visit), then open it. The
+ * copy is the full viewer's working copy too, so Expand opens instantly and keeps working even
+ * after the caller's grant is gone.
+ */
+ private fun load(password: String?) {
+ val u = uri ?: return
+ lifecycleScope.launch {
+ state = if (password == null) PreviewState.Loading else state
+ val eng = app.engine.await().getOrNull() ?: run {
+ state = PreviewState.Failed(getString(R.string.msg_engine_not_started))
+ return@launch
+ }
+ engine = eng
+ try {
+ val (file, name, size) = withContext(Dispatchers.IO) {
+ val f = copy ?: files.workingCopy(u).also { copy = it }
+ Triple(f, files.displayName(u), files.size(u) ?: f.length())
+ }
+ val info: DocumentInfo = eng.command { open(file.absolutePath, password) }
+ val images = PageImages(eng, info.id, lifecycleScope, 48 * 1024 * 1024)
+ val view = ViewerState(info.pages.map { PageSize(it.width, it.height) })
+ (state as? PreviewState.Ready)?.close(eng)
+ state = PreviewState.Ready(info, images, view, name, size)
+ } catch (e: MobileException.NeedsPassword) {
+ state = PreviewState.Password(wrong = false)
+ } catch (e: MobileException.WrongPassword) {
+ state = PreviewState.Password(wrong = true)
+ } catch (e: SecurityException) {
+ state = PreviewState.Failed(getString(R.string.msg_file_access_lost))
+ } catch (e: Exception) {
+ state = PreviewState.Failed(e.userMessage)
+ }
+ }
+ }
+
+ private fun unlock(password: String) = load(password)
+
+ /** Hand the document to the full viewer, then step aside. */
+ private fun expand() {
+ val u = uri ?: return finish()
+ val open = Intent(this, MainActivity::class.java)
+ .setAction(Intent.ACTION_VIEW)
+ .setDataAndType(u, mime ?: "application/pdf")
+ .putExtra(MainActivity.EXTRA_FROM_PREVIEW, true)
+ .addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION or Intent.FLAG_ACTIVITY_NEW_TASK)
+ try {
+ startActivity(open)
+ } catch (e: SecurityException) {
+ // the caller's grant can't be passed on: the full viewer opens the copy made here
+ copy?.let { startActivity(open.setData(Uri.fromFile(it))) }
+ }
+ finishQuietly()
+ }
+
+ private fun share() {
+ val f = copy ?: return
+ val shared = runCatching { files.shareable(f, (state as? PreviewState.Ready)?.name ?: f.name) }.getOrNull() ?: return
+ val send = Intent(Intent.ACTION_SEND).setType("application/pdf").putExtra(Intent.EXTRA_STREAM, shared).addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
+ launch(Intent.createChooser(send, null))
+ }
+
+ private fun openWith() {
+ val f = copy ?: return
+ val shared = runCatching { files.shareable(f, (state as? PreviewState.Ready)?.name ?: f.name) }.getOrNull() ?: return
+ launch(Intent.createChooser(Intent(Intent.ACTION_VIEW).setDataAndType(shared, "application/pdf").addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION), null))
+ }
+
+ private fun saveCopy(done: (String) -> Unit) {
+ val f = copy ?: return
+ val name = (state as? PreviewState.Ready)?.name ?: f.name
+ lifecycleScope.launch {
+ val ok = runCatching { withContext(Dispatchers.IO) { files.saveToDownloads(f, name) } }.isSuccess
+ done(getString(if (ok) R.string.preview_saved_downloads else R.string.files_error_write))
+ }
+ }
+
+ private fun launch(i: Intent) {
+ try {
+ startActivity(i)
+ } catch (e: ActivityNotFoundException) {
+ // nothing to share with: nothing to do
+ }
+ }
+
+ /** The card has animated away: finish with no window animation of the system's. */
+ private fun closeNow() = finishQuietly()
+
+ private fun finishQuietly() {
+ finish()
+ if (Build.VERSION.SDK_INT >= 34) overrideActivityTransition(Activity.OVERRIDE_TRANSITION_CLOSE, 0, 0)
+ else @Suppress("DEPRECATION") overridePendingTransition(0, 0)
+ }
+
+ /**
+ * Blur what's behind the window (the caller), Android 12 and later where the phone allows it:
+ * [radius] in pixels, 0 for none. The card animates it in and out with itself.
+ */
+ private fun setBlur(radius: Int) {
+ if (Build.VERSION.SDK_INT < 31) return
+ val wm = getSystemService(WindowManager::class.java) ?: return
+ if (!wm.isCrossWindowBlurEnabled) return
+ val lp = window.attributes
+ if (radius > 0) window.addFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND) else window.clearFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND)
+ if (lp.blurBehindRadius != radius) {
+ lp.blurBehindRadius = radius
+ window.attributes = lp
+ }
+ }
+
+ override fun onDestroy() {
+ super.onDestroy()
+ val eng = engine
+ val s = state
+ if (isFinishing && eng != null && s is PreviewState.Ready) cleanup.launch { s.close(eng) }
+ }
+
+ override fun onTrimMemory(level: Int) {
+ super.onTrimMemory(level)
+ (state as? PreviewState.Ready)?.images?.trim(emptySet())
+ }
+}
+
+/** What Quick Preview is showing. */
+internal sealed interface PreviewState {
+ data object Loading : PreviewState
+
+ class Password(val wrong: Boolean) : PreviewState
+
+ class Failed(val message: String) : PreviewState
+
+ class Ready(val info: DocumentInfo, val images: PageImages, val view: ViewerState, val name: String, val size: Long) : PreviewState {
+ suspend fun close(eng: Engine) {
+ images.close()
+ runCatching { eng.tool("doc_close", mapOf("doc" to info.id, "discard_changes" to true)) }
+ }
+ }
+}
diff --git a/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/ui/AppViewModel.kt b/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/ui/AppViewModel.kt
index c3185b1..5727093 100644
--- a/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/ui/AppViewModel.kt
+++ b/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/ui/AppViewModel.kt
@@ -1013,7 +1013,13 @@ class AppViewModel(app: Application, private val saved: SavedStateHandle) : Andr
fun onMicPermission(granted: Boolean) {
val p = pendingVoice
pendingVoice = null
- if (granted && p != null) voicePrompt = p else if (!granted) tell(text(R.string.msg_voice_no_mic))
+ val m = pendingMic
+ pendingMic = null
+ when {
+ !granted -> tell(text(R.string.msg_voice_no_mic))
+ p != null -> voicePrompt = p
+ m != null -> m()
+ }
}
fun dismissMicRationale(openSettings: Boolean) {
@@ -1905,7 +1911,7 @@ class AppViewModel(app: Application, private val saved: SavedStateHandle) : Andr
*/
private fun scriptOutput(doc: OpenDocument, r: JSONObject) {
// a script that failed: kept out of sight, as the reference keeps it, but in the log
- r.optString("error").takeIf { it.isNotEmpty() && it != "null" }?.let { android.util.Log.w("ClearPDF", "form script: $it") }
+ r.optString("error").takeIf { it.isNotEmpty() && it != "null" }?.let { android.util.Log.w("Artefact", "form script: $it") }
r.optJSONArray("alerts")?.let { a -> for (i in 0 until a.length()) showScriptAlert(a.optString(i)) }
val requests = r.optJSONArray("requests") ?: return
for (i in 0 until requests.length()) {
@@ -2361,6 +2367,115 @@ class AppViewModel(app: Application, private val saved: SavedStateHandle) : Andr
}
}
+ // ---- Notes, lists and voice memos ----------------------------------------------------------
+
+ val notes = com.chethan616.clearpdf.notes.Notes(app, viewModelScope)
+
+ /** The note open in the editor. */
+ var openNote by mutableStateOf<String?>(null)
+
+ /** 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
+
+ fun updateQuickPreview(on: Boolean) {
+ quickPreview = on
+ appPrefs.edit().putBoolean("quickPreview", on).apply()
+ }
+
+ /** The welcome pages were seen (first run shows them). */
+ var onboarded by mutableStateOf(appPrefs.getBoolean("onboarded", false))
+ private set
+
+ fun finishOnboarding() {
+ onboarded = true
+ appPrefs.edit().putBoolean("onboarded", true).apply()
+ seedNotes()
+ }
+
+ fun showWelcomeAgain() {
+ settingsOpen = false
+ onboarded = false
+ }
+
+ /** A fresh desk gets a welcome note and a small list, so it shows what it's for. */
+ fun seedNotes() {
+ viewModelScope.launch {
+ snapshotFlow { notes.loaded }.first { it }
+ if (!notes.isFresh || notes.all.isNotEmpty()) return@launch
+ // the list last, so it's the newest: it leads the desk, as in the design
+ notes.create(com.chethan616.clearpdf.notes.NoteKind.Text, text(R.string.seed_note_title), text(R.string.seed_note_body))
+ delay(5)
+ notes.create(
+ com.chethan616.clearpdf.notes.NoteKind.List, text(R.string.seed_list_title),
+ items = listOf(
+ com.chethan616.clearpdf.notes.checkItem(text(R.string.seed_list_1), done = true),
+ com.chethan616.clearpdf.notes.checkItem(text(R.string.seed_list_2)),
+ com.chethan616.clearpdf.notes.checkItem(text(R.string.seed_list_3)),
+ ),
+ )
+ }
+ }
+
+ /** A new note (or list) straight into the editor. */
+ fun newNote(kind: com.chethan616.clearpdf.notes.NoteKind) {
+ val items = if (kind == com.chethan616.clearpdf.notes.NoteKind.List) listOf(com.chethan616.clearpdf.notes.checkItem("")) else emptyList()
+ openNote = notes.create(kind, items = items).id
+ }
+
+ fun closeNote() {
+ openNote?.let(notes::prune)
+ openNote = null
+ }
+
+ /** Run [action] once the microphone is allowed (asking for it first if need be). */
+ fun withMic(action: () -> Unit) {
+ val app = getApplication<Application>()
+ if (androidx.core.content.ContextCompat.checkSelfPermission(app, android.Manifest.permission.RECORD_AUDIO) == android.content.pm.PackageManager.PERMISSION_GRANTED) {
+ action()
+ } else {
+ pendingMic = action
+ micRequests.trySend(Unit)
+ }
+ }
+
+ internal var pendingMic: (() -> Unit)? = null
+
+ /** A picture for the open note: from the photo picker, or the camera. */
+ val notePhotoPicks = Channel<Unit>(Channel.CONFLATED)
+ val noteCameraShots = Channel<File>(Channel.CONFLATED)
+ private var noteShot: File? = null
+
+ fun pickNotePhoto() {
+ notePhotoPicks.trySend(Unit)
+ }
+
+ fun takeNotePhoto() {
+ val f = notes.newMedia("jpg")
+ noteShot = f
+ noteCameraShots.trySend(f)
+ }
+
+ fun onNotePhoto(uri: Uri?) {
+ val id = openNote ?: return
+ uri ?: return
+ viewModelScope.launch {
+ val name = notes.importImage(uri) ?: return@launch tell(text(R.string.common_file_unreadable))
+ notes.get(id)?.let { notes.put(it.copy(images = it.images + name)) }
+ }
+ }
+
+ fun onNoteCamera(ok: Boolean) {
+ val f = noteShot ?: return
+ noteShot = null
+ val id = openNote
+ if (!ok || id == null || !f.isFile || f.length() == 0L) {
+ f.delete()
+ return
+ }
+ notes.get(id)?.let { notes.put(it.copy(images = it.images + f.name)) }
+ }
+
// ---- Home, Files, Search -----------------------------------------------------------------
var homeTab by mutableStateOf(com.chethan616.clearpdf.ui.home.HomeTab.Home)
diff --git a/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/ui/ClearApp.kt b/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/ui/ClearApp.kt
index a9b7f0d..3f500d9 100644
--- a/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/ui/ClearApp.kt
+++ b/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/ui/ClearApp.kt
@@ -1,6 +1,17 @@
package com.chethan616.clearpdf.ui
import androidx.activity.compose.BackHandler
+import androidx.compose.animation.AnimatedContent
+import androidx.compose.animation.AnimatedVisibility
+import androidx.compose.animation.ContentTransform
+import androidx.compose.animation.fadeIn
+import androidx.compose.animation.fadeOut
+import androidx.compose.animation.scaleIn
+import androidx.compose.animation.scaleOut
+import androidx.compose.animation.slideInHorizontally
+import androidx.compose.animation.slideOutHorizontally
+import androidx.compose.animation.togetherWith
+import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.animation.core.Animatable
import androidx.compose.animation.core.animateFloatAsState
import androidx.compose.foundation.background
@@ -25,7 +36,6 @@ import androidx.compose.foundation.layout.width
import androidx.compose.foundation.layout.windowInsetsPadding
import androidx.compose.foundation.text.KeyboardActions
import androidx.compose.foundation.text.KeyboardOptions
-import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.material3.Icon
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
@@ -58,7 +68,6 @@ import androidx.compose.ui.text.withStyle
import androidx.compose.ui.unit.dp
import androidx.core.view.WindowCompat
import com.chethan616.clearpdf.R
-import com.chethan616.clearpdf.ui.desk.DeskScreen
import com.chethan616.clearpdf.ui.desk.FileActionsSheet
import com.chethan616.clearpdf.ui.desk.FilesScreen
import com.chethan616.clearpdf.ui.desk.SettingsScreen
@@ -75,13 +84,20 @@ import com.chethan616.clearpdf.ui.glass.GlassOverlayHost
import com.chethan616.clearpdf.ui.glass.LocalGlassOverlayHost
import com.chethan616.clearpdf.ui.glass.GlassSheet
import com.chethan616.clearpdf.ui.glass.GlassStage
+import com.chethan616.clearpdf.ui.glass.GlassLoader
import com.chethan616.clearpdf.ui.glass.GlassTab
import com.chethan616.clearpdf.ui.glass.GlassTabs
import com.chethan616.clearpdf.ui.glass.GlassTextField
import com.chethan616.clearpdf.ui.glass.GlassToast
import com.chethan616.clearpdf.ui.glass.ProvideGlassHaptics
import com.chethan616.clearpdf.ui.glass.pressable
+import com.chethan616.clearpdf.ui.home.CreateDock
+import com.chethan616.clearpdf.ui.home.DeskState
+import com.chethan616.clearpdf.ui.home.HomeScreen
import com.chethan616.clearpdf.ui.home.HomeTab
+import com.chethan616.clearpdf.ui.home.LocalHomeVm
+import com.chethan616.clearpdf.ui.notes.NoteEditor
+import com.chethan616.clearpdf.ui.onboarding.Onboarding
import com.chethan616.clearpdf.ui.theme.Candy
import com.chethan616.clearpdf.ui.theme.ClearTheme
import com.chethan616.clearpdf.ui.theme.ClearType
@@ -102,7 +118,7 @@ fun ClearApp(vm: AppViewModel, onBrowse: () -> Unit, onPickSignatureImage: () ->
ClearTheme(vm.theme) {
PdfcraftTheme(vm.theme) {
ProvideGlassHaptics {
- CompositionLocalProvider(LocalGlassOverlayHost provides overlays) { Shell(vm, onBrowse, onPickSignatureImage) }
+ CompositionLocalProvider(LocalGlassOverlayHost provides overlays, LocalHomeVm provides vm) { Shell(vm, onBrowse, onPickSignatureImage) }
}
}
}
@@ -113,7 +129,7 @@ private fun Shell(vm: AppViewModel, onBrowse: () -> Unit, onPickSignatureImage:
val c = clear
val doc = vm.document
var toast by remember { mutableStateOf<Message?>(null) }
- var creating by remember { mutableStateOf(false) }
+ val scope = rememberCoroutineScope()
LaunchedEffect(vm) {
for (m in vm.messages) {
toast = m
@@ -134,12 +150,20 @@ private fun Shell(vm: AppViewModel, onBrowse: () -> Unit, onPickSignatureImage:
}
}
BackHandler(enabled = doc != null && vm.toolScreen == null) { vm.closeDocument() }
- BackHandler(enabled = doc == null && !vm.settingsOpen && vm.homeTab != HomeTab.Home && vm.toolScreen == null) { vm.homeTab = HomeTab.Home }
+ BackHandler(enabled = doc == null && vm.onboarded && !vm.settingsOpen && vm.openNote == null && vm.homeTab != HomeTab.Home && vm.toolScreen == null) { vm.homeTab = HomeTab.Home }
- val onTabs = doc == null && !vm.settingsOpen
- val dockVisible = onTabs && vm.toolScreen == null && vm.signaturePad == null && vm.certSign == null && !vm.idCreate && vm.selectedFiles.isEmpty()
+ val route = when {
+ !vm.onboarded -> "welcome"
+ vm.settingsOpen -> "settings"
+ vm.openNote != null -> "note:" + vm.openNote
+ else -> vm.homeTab.name
+ }
+ val onDesk = doc == null && route == HomeTab.Home.name && vm.toolScreen == null && vm.signaturePad == null && vm.certSign == null && !vm.idCreate
+ val desk = remember { DeskState(scope) }
val mood = when {
+ route == "welcome" -> AuroraMoods.Welcome
vm.settingsOpen -> AuroraMoods.Settings
+ vm.openNote != null -> AuroraMoods.Note
vm.homeTab == HomeTab.Files -> AuroraMoods.Files
vm.homeTab == HomeTab.Tools -> AuroraMoods.Tools
else -> AuroraMoods.Desk
@@ -149,15 +173,14 @@ private fun Shell(vm: AppViewModel, onBrowse: () -> Unit, onPickSignatureImage:
wallpaper = { Aurora(mood) },
screens = {
Box(Modifier.fillMaxSize().windowInsetsPadding(WindowInsets.safeDrawing.only(WindowInsetsSides.Horizontal))) {
- when {
- doc != null -> Viewer(vm, doc)
- vm.settingsOpen -> Entrance("settings", fromSide = true) { SettingsScreen(vm) }
- else -> Entrance(vm.homeTab) {
- when (vm.homeTab) {
- HomeTab.Home -> DeskScreen(vm, onBrowse)
- HomeTab.Files -> FilesScreen(vm, onBrowse)
- HomeTab.Tools -> ToolsScreen(vm)
- }
+ AnimatedContent(route, transitionSpec = { push(depth(initialState), depth(targetState)) }, label = "route") { r ->
+ when {
+ r == "welcome" -> Onboarding(vm)
+ r == "settings" -> SettingsScreen(vm)
+ r.startsWith("note:") -> NoteEditor(vm, r.removePrefix("note:"))
+ r == HomeTab.Files.name -> FilesScreen(vm, onBrowse)
+ r == HomeTab.Tools.name -> ToolsScreen(vm)
+ else -> HomeScreen(vm, desk)
}
}
vm.toolScreen?.let { ToolScreenHost(vm, it) }
@@ -165,19 +188,28 @@ private fun Shell(vm: AppViewModel, onBrowse: () -> Unit, 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 (dockVisible) Dock(vm, creating) { creating = !creating }
+ if (onDesk) CreateDock(vm, desk, onBrowse)
toast?.let { m ->
Box(
Modifier.align(Alignment.BottomCenter).navigationBarsPadding()
- .padding(start = 16.dp, end = 16.dp, bottom = if (dockVisible) 96.dp else 20.dp),
+ .padding(start = 16.dp, end = 16.dp, bottom = if (onDesk) 100.dp else 20.dp),
) { key(m) { GlassToast(m.text, m.actionLabel, { m.action?.invoke(); toast = null }) } }
}
},
)
- if (creating) CreateSheet(vm, onBrowse) { creating = false }
if (doc == null) vm.fileSheet?.let { (r, recent) -> FileActionsSheet(vm, r, recent) { vm.fileSheet = null } }
if (vm.opening) Spinner()
Dialogs(vm)
@@ -196,100 +228,28 @@ private fun Viewer(vm: AppViewModel, doc: OpenDocument) {
}
}
-/**
- * A screen arriving: it rises a little and fades in on a soft spring ([fromSide]: slides in from
- * the end, for pushed pages). Only the arriving screen is composed.
- */
-@Composable
-private fun Entrance(key: Any, fromSide: Boolean = false, content: @Composable () -> Unit) {
- key(key) {
- val p = remember { Animatable(0f) }
- LaunchedEffect(Unit) { p.animateTo(1f, GlassMotion.rise()) }
- Box(
- Modifier.fillMaxSize().graphicsLayer {
- val v = p.value
- if (fromSide) translationX = (1f - v) * 48.dp.toPx() else translationY = (1f - v) * 22.dp.toPx()
- alpha = v.coerceIn(0f, 1f)
- compositingStrategy = CompositingStrategy.ModulateAlpha
- },
- ) { content() }
- }
-}
-
-/** The floating dock: Desk, Files and Tools on a glass capsule, and the candy + that creates. */
+/** The wait while a document opens: the expressive loader in its glass circle. */
@Composable
-private fun BoxScope.Dock(vm: AppViewModel, creating: Boolean, onCreate: () -> Unit) {
- val turn by animateFloatAsState(if (creating) 45f else 0f, GlassMotion.morph(), label = "plus")
- Row(
- Modifier.align(Alignment.BottomCenter).navigationBarsPadding().padding(bottom = 14.dp),
- horizontalArrangement = Arrangement.spacedBy(10.dp), verticalAlignment = Alignment.CenterVertically,
- ) {
- val tabs = listOf(HomeTab.Home, HomeTab.Files, HomeTab.Tools)
- GlassTabs(
- tabs = listOf(
- GlassTab(stringResource(R.string.dock_desk), LucideIcons.House, Candy.Tomato),
- GlassTab(stringResource(R.string.dock_files), LucideIcons.Folder, Candy.Sky),
- GlassTab(stringResource(R.string.dock_tools), LucideIcons.LayoutGrid, Candy.Grape),
- ),
- selected = tabs.indexOf(vm.homeTab).coerceAtLeast(0),
- onSelect = { vm.homeTab = tabs[it] },
- modifier = Modifier.width(252.dp),
- height = 64.dp,
- )
- GlassCircle(onClick = onCreate, size = 64.dp, tint = Candy.Tomato, label = stringResource(R.string.dock_create)) {
- GlassIcon(LucideIcons.Plus, null, Modifier.size(30.dp).graphicsLayer { rotationZ = turn })
- }
- }
-}
-
-/** "Start something": the ways in, as a grid of candy tiles. */
-@Composable
-private fun CreateSheet(vm: AppViewModel, onBrowse: () -> Unit, onDismiss: () -> Unit) {
- fun go(f: () -> Unit) {
- onDismiss()
- f()
- }
- GlassSheet(onDismiss, stringResource(R.string.create_title), stringResource(R.string.create_subtitle)) {
- val items = listOf(
- Triple(LucideIcons.FolderOpen, stringResource(R.string.home_open_file), Candy.Sky) to onBrowse,
- Triple(ToolCatalog.Scan.icon, stringResource(ToolCatalog.Scan.label), ToolCatalog.Scan.accent) to { ToolCatalog.Scan.go(vm) },
- Triple(ToolCatalog.Photos.icon, stringResource(ToolCatalog.Photos.label), ToolCatalog.Photos.accent) to { ToolCatalog.Photos.go(vm) },
- Triple(ToolCatalog.Combine.icon, stringResource(ToolCatalog.Combine.label), Candy.Grape) to { ToolCatalog.Combine.go(vm) },
- Triple(ToolCatalog.Create.icon, stringResource(ToolCatalog.Create.label), Candy.Tangerine) to { ToolCatalog.Create.go(vm) },
- Triple(ToolCatalog.Edit.icon, stringResource(ToolCatalog.Edit.label), ToolCatalog.Edit.accent) to { ToolCatalog.Edit.go(vm) },
- )
- Column(Modifier.padding(horizontal = 14.dp, vertical = 4.dp), verticalArrangement = Arrangement.spacedBy(10.dp)) {
- items.chunked(3).forEach { row ->
- Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.spacedBy(10.dp)) {
- row.forEach { (spec, action) ->
- val (icon, label, accent) = spec
- CreateTile(icon, label, accent, Modifier.weight(1f)) { go(action) }
- }
- }
- }
- }
+private fun Spinner() {
+ GlassOverlay {
+ Box(Modifier.fillMaxSize(), contentAlignment = Alignment.Center) { GlassLoader(size = 76.dp) }
}
}
-@Composable
-private fun CreateTile(icon: ImageVector, label: String, accent: Color, modifier: Modifier, onClick: () -> Unit) {
- Column(
- modifier.height(112.dp).pressable(onClick, pressedScale = 0.92f).clip(RoundedRectangle(24.dp)).background(accent).padding(14.dp),
- verticalArrangement = Arrangement.SpaceBetween,
- ) {
- Icon(icon, null, tint = Color.White, modifier = Modifier.size(28.dp))
- Text(label, style = ClearType.Label, color = Color.White, maxLines = 2)
- }
+/** How deep a route is: deeper ones push in from the end, going back slides the other way. */
+private fun depth(route: String): Int = when {
+ route == "welcome" || route == HomeTab.Home.name -> 0
+ route.startsWith("note:") -> 2
+ route == "settings" -> 2
+ else -> 1
}
-/** A candy spinner over everything while a document opens. */
-@Composable
-private fun Spinner() {
- GlassOverlay {
- Box(Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
- CircularProgressIndicator(Modifier.size(44.dp), color = Candy.Tomato, strokeWidth = 4.dp)
- }
- }
+/** 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))
}
/** Everything the view model can ask: passwords, read-only files, links, form alerts, waits. */
@@ -345,8 +305,8 @@ private fun Dialogs(vm: AppViewModel) {
vm.busy?.let { message ->
GlassDialog(onDismiss = {}, title = null, dismissible = false) {
Row(verticalAlignment = Alignment.CenterVertically) {
- CircularProgressIndicator(Modifier.size(30.dp), color = Candy.Tomato, strokeWidth = 3.5.dp)
- Spacer(Modifier.width(18.dp))
+ GlassLoader(size = 48.dp)
+ Spacer(Modifier.width(16.dp))
Text(message, style = ClearType.BodyStrong, color = c.ink, textAlign = TextAlign.Start)
}
}
diff --git a/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/ui/Theme.kt b/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/ui/Theme.kt
index 552a007..0774012 100644
--- a/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/ui/Theme.kt
+++ b/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/ui/Theme.kt
@@ -12,18 +12,12 @@ import androidx.compose.runtime.Immutable
import androidx.compose.runtime.staticCompositionLocalOf
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.TextStyle
-import androidx.compose.ui.text.font.Font
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.sp
-import com.chethan616.clearpdf.R
-/** Inter (OFL, assets/fonts), PdfCraft's UI face, copied in by the build. */
-val Inter = FontFamily(
- Font(R.font.inter_regular, FontWeight.Normal),
- Font(R.font.inter_medium, FontWeight.Medium),
- Font(R.font.inter_semibold, FontWeight.SemiBold),
-)
+/** The app's reading face: Plus Jakarta Sans, the same as the glass screens (the old name stays for the viewer's code). */
+val Inter: FontFamily get() = com.chethan616.clearpdf.ui.theme.Jakarta
/** The colours the screens use beyond Material's roles (measured from the reference app's screens). */
@Immutable
@@ -80,71 +74,7 @@ data class PdfColors(
val switchOn: Color,
)
-val LightPdfColors = PdfColors(
- dark = false,
- surface = Color(0xFFFFFFFF),
- surfaceRaised = Color(0xFFF4F4F4),
- pressed = Color(0xFFE9E9E9),
- desk = Color(0xFFE1E1E1),
- pageEdge = Color(0x1F000000),
- text = Color(0xFF202020),
- textSecondary = Color(0xFF5E5E5E),
- textTertiary = Color(0xFF6D6D6D),
- icon = Color(0xFF222222),
- divider = Color(0xFFD5D5D5),
- handle = Color(0xFF909090),
- accent = Color(0xFF147AF3),
- onAccent = Color(0xFFFFFFFF),
- button = Color(0xFF0265DC),
- red = Color(0xFFD7373F),
- scrim = Color(0x66000000),
- toast = Color(0xFF474747),
- onToast = Color(0xFFFFFFFF),
- label = Color(0xFF000000),
- toolAccent = Color(0xFF0265DC),
- navBand = Color(0xFFFFFFFF),
- menu = Color(0xFFFFFFFF),
- pageCard = Color(0xFFE6E6E6),
- home = Color(0xFFFFFFFF),
- navigatorText = Color(0xFF2C2C2C),
- replyBorder = Color(0xFF464646),
- switchOff = Color(0xFFE9E9E9),
- switchOn = Color(0xFF3B63FB),
-)
-
-val DarkPdfColors = PdfColors(
- dark = true,
- surface = Color(0xFF1D1D1D),
- surfaceRaised = Color(0xFF2A2A2A),
- pressed = Color(0xFF303030),
- desk = Color(0xFF000000),
- pageEdge = Color(0x00000000),
- text = Color(0xFFFFFFFF),
- textSecondary = Color(0xFFB2B2B2),
- textTertiary = Color(0xFFB0B0B0),
- icon = Color(0xFFEBEBEB),
- divider = Color(0xFF4B4B4B),
- handle = Color(0xFF8D8D8D),
- accent = Color(0xFF5EAAF7),
- onAccent = Color(0xFF000000),
- button = Color(0xFF0265DC),
- red = Color(0xFFF2545B),
- scrim = Color(0x99000000),
- toast = Color(0xFF474747),
- onToast = Color(0xFFFFFFFF),
- label = Color(0xFFFFFFFF),
- toolAccent = Color(0xFF5EAAF7),
- navBand = Color(0xFF080808),
- menu = Color(0xFF080808),
- pageCard = Color(0xFF303030),
- home = Color(0xFF000000),
- navigatorText = Color(0xFFEFEFEF),
- replyBorder = Color(0xFFD1D1D1),
- switchOff = Color(0xFF505050),
- switchOn = Color(0xFF4B75FF),
-)
-
-val LocalPdfColors = staticCompositionLocalOf { LightPdfColors }
+val LocalPdfColors = staticCompositionLocalOf<PdfColors> { error("no PdfcraftTheme") }
/** The colours in effect. */
val pdfColors: PdfColors @Composable get() = LocalPdfColors.current
@@ -153,19 +83,19 @@ val pdfColors: PdfColors @Composable get() = LocalPdfColors.current
enum class ThemeChoice { System, Light, Dark }
/**
- * The viewer's and tool screens' roles in ClearPDF's palette: warm paper surfaces, the theme's ink,
- * candy accents. (Inside [com.chethan616.clearpdf.ui.theme.ClearTheme], so it follows the same theme.)
+ * The viewer's and tool screens' roles in Artefact's palette: cool grouped surfaces (Apple's),
+ * the theme's ink, the system accents. (Inside [com.chethan616.clearpdf.ui.theme.ClearTheme], so it follows the same theme.)
*/
private fun pdfColorsFrom(cc: com.chethan616.clearpdf.ui.theme.ClearColors): PdfColors {
val candy = com.chethan616.clearpdf.ui.theme.Candy
val dark = cc.dark
- val surface = if (dark) Color(0xFF17151E) else Color(0xFFFBF8F4)
- val raised = if (dark) Color(0xFF221F2B) else Color(0xFFF1ECE5)
+ val surface = if (dark) Color(0xFF121B20) else Color(0xFFF5F7FB)
+ val raised = if (dark) Color(0xFF1B262C) else Color(0xFFE9EDF4)
return PdfColors(
dark = dark,
surface = surface,
surfaceRaised = raised,
- pressed = if (dark) Color(0xFF2C2836) else Color(0xFFE8E2DA),
+ pressed = if (dark) Color(0xFF24323A) else Color(0xFFDDE3EC),
desk = cc.desk,
pageEdge = if (dark) Color.Transparent else Color(0x1F000000),
text = cc.ink,
@@ -179,7 +109,7 @@ private fun pdfColorsFrom(cc: com.chethan616.clearpdf.ui.theme.ClearColors): Pdf
button = candy.Sky,
red = candy.Tomato,
scrim = if (dark) Color(0x99000000) else Color(0x55000000),
- toast = if (dark) Color(0xFF2C2836) else Color(0xFF2A2634),
+ toast = if (dark) Color(0xFF24323A) else Color(0xFF26324A),
onToast = Color.White,
label = cc.ink,
toolAccent = candy.Sky,
@@ -190,7 +120,7 @@ private fun pdfColorsFrom(cc: com.chethan616.clearpdf.ui.theme.ClearColors): Pdf
navigatorText = cc.ink,
replyBorder = cc.inkSoft,
switchOff = raised,
- switchOn = candy.Mint,
+ switchOn = candy.Lime,
)
}
diff --git a/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/ui/desk/Common.kt b/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/ui/desk/Common.kt
index 3ed233a..276ab2e 100644
--- a/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/ui/desk/Common.kt
+++ b/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/ui/desk/Common.kt
@@ -61,6 +61,7 @@ import com.chethan616.clearpdf.ui.home.whenLabel
import com.chethan616.clearpdf.ui.theme.Candy
import com.chethan616.clearpdf.ui.theme.ClearType
import com.chethan616.clearpdf.ui.theme.clear
+import com.chethan616.clearpdf.ui.theme.glowing
import com.chethan616.clearpdf.ui.viewer.formatSize
import com.kyant.shapes.RoundedRectangle
import kotlinx.coroutines.Dispatchers
@@ -128,19 +129,36 @@ fun PaperThumb(vm: AppViewModel, path: String?, width: Dp, height: Dp, modifier:
}
}
-/** The big title every tab opens with: a small caps [eyebrow], the [title] in display type, and [trailing] controls. */
+/** Room left under a pushed screen's last row. */
+val DockClearance = 40.dp
+
+/**
+ * The big title a pushed screen opens with: a round glass Back above it (when [onBack]), a small
+ * caps [eyebrow], the [title] large and white on the sky, and [trailing] controls.
+ */
@Composable
-fun ScreenHeader(eyebrow: String?, title: String, modifier: Modifier = Modifier, trailing: @Composable () -> Unit = {}) {
+fun ScreenHeader(eyebrow: String?, title: String, modifier: Modifier = Modifier, onBack: (() -> Unit)? = null, trailing: @Composable () -> Unit = {}) {
val c = clear
- Row(modifier.fillMaxWidth().padding(start = 22.dp, end = 16.dp), verticalAlignment = Alignment.Bottom) {
- Column(Modifier.weight(1f)) {
- if (eyebrow != null) {
- Text(eyebrow.uppercase(), style = ClearType.Eyebrow, color = c.inkSoft)
- Spacer(Modifier.height(6.dp))
+ Column(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)
+ }
+ Spacer(Modifier.weight(1f))
+ Row(horizontalArrangement = Arrangement.spacedBy(8.dp), verticalAlignment = Alignment.CenterVertically) { trailing() }
+ }
+ }
+ Row(Modifier.fillMaxWidth().padding(start = 6.dp), verticalAlignment = Alignment.Bottom) {
+ Column(Modifier.weight(1f)) {
+ if (eyebrow != null) {
+ 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 = ClearType.Display, color = c.ink)
+ if (onBack == null) Row(horizontalArrangement = Arrangement.spacedBy(8.dp), verticalAlignment = Alignment.CenterVertically) { trailing() }
}
- Row(horizontalArrangement = Arrangement.spacedBy(8.dp), verticalAlignment = Alignment.CenterVertically) { trailing() }
}
}
diff --git a/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/ui/desk/DeskScreen.kt b/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/ui/desk/DeskScreen.kt
deleted file mode 100644
index 7723086..0000000
--- a/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/ui/desk/DeskScreen.kt
+++ /dev/null
@@ -1,269 +0,0 @@
-package com.chethan616.clearpdf.ui.desk
-
-import androidx.compose.animation.core.Animatable
-import androidx.compose.foundation.background
-import androidx.compose.foundation.layout.Arrangement
-import androidx.compose.foundation.layout.Box
-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.aspectRatio
-import androidx.compose.foundation.layout.fillMaxHeight
-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.width
-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.foundation.shape.CircleShape
-import androidx.compose.material3.Icon
-import androidx.compose.material3.Text
-import androidx.compose.runtime.Composable
-import androidx.compose.runtime.LaunchedEffect
-import androidx.compose.runtime.remember
-import androidx.compose.ui.Alignment
-import 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.CompositingStrategy
-import androidx.compose.ui.graphics.graphicsLayer
-import androidx.compose.ui.graphics.vector.ImageVector
-import androidx.compose.ui.res.stringResource
-import androidx.compose.ui.text.SpanStyle
-import androidx.compose.ui.text.buildAnnotatedString
-import androidx.compose.ui.text.style.TextOverflow
-import androidx.compose.ui.text.withStyle
-import androidx.compose.ui.unit.dp
-import com.chethan616.clearpdf.R
-import com.chethan616.clearpdf.engine.RecentFile
-import com.chethan616.clearpdf.ui.AppViewModel
-import com.chethan616.clearpdf.ui.LucideIcons
-import com.chethan616.clearpdf.ui.glass.GlassCard
-import com.chethan616.clearpdf.ui.glass.GlassIcon
-import com.chethan616.clearpdf.ui.glass.GlassMotion
-import com.chethan616.clearpdf.ui.glass.GlassPill
-import com.chethan616.clearpdf.ui.glass.pressable
-import com.chethan616.clearpdf.ui.home.FileRow
-import com.chethan616.clearpdf.ui.home.HomeTab
-import com.chethan616.clearpdf.ui.home.displayName
-import com.chethan616.clearpdf.ui.home.whenLabel
-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 java.text.SimpleDateFormat
-import java.util.Calendar
-import java.util.Date
-import java.util.Locale
-
-/** How much room the floating dock takes at the bottom of every tab. */
-val DockClearance = 112.dp
-
-/**
- * The desk: a big greeting, the document you were reading, a bento of candy tools, and a shelf of
- * recent papers dropped at playful angles.
- */
-@Composable
-fun DeskScreen(vm: AppViewModel, onBrowse: () -> Unit) {
- val recents = vm.recentRows()
- val last = vm.recentList.firstOrNull()
- LazyColumn(Modifier.fillMaxSize(), contentPadding = PaddingValues(bottom = DockClearance)) {
- item { Spacer(Modifier.windowInsetsTopHeight(WindowInsets.statusBars)) }
- item(key = "top") {
- Row(Modifier.fillMaxWidth().padding(start = 22.dp, end = 16.dp, top = 10.dp), verticalAlignment = Alignment.CenterVertically) {
- Text(dateLine().uppercase(), style = ClearType.Eyebrow, color = clear.inkSoft, modifier = Modifier.weight(1f))
- SettingsButton(vm)
- }
- }
- item(key = "hero") { Greeting(hasDocument = last != null) }
- if (last != null && recents.isNotEmpty()) {
- item(key = "continue") { ContinueCard(vm, last, recents.first()) }
- }
- item(key = "make") {
- SectionTitle(stringResource(R.string.desk_make_something), action = stringResource(R.string.desk_all_tools)) { vm.homeTab = HomeTab.Tools }
- Bento(vm)
- }
- item(key = "shelf") {
- SectionTitle(stringResource(R.string.desk_on_your_desk), action = if (recents.isNotEmpty()) stringResource(R.string.desk_see_all) else null) { vm.homeTab = HomeTab.Files }
- if (recents.isEmpty()) {
- EmptyHero(
- stringResource(R.string.desk_empty_title), stringResource(R.string.desk_empty_body),
- stringResource(R.string.home_open_file), Candy.Tomato, onBrowse,
- )
- } else {
- Shelf(vm, recents.drop(if (last != null) 1 else 0).take(12).ifEmpty { recents.take(1) })
- }
- }
- item { Spacer(Modifier.windowInsetsBottomHeight(WindowInsets.navigationBars)) }
- }
-}
-
-private fun dateLine(): String = SimpleDateFormat("EEEE · d MMMM", Locale.getDefault()).format(Date())
-
-/** The hero: "Good evening," in ink, the tagline in a candy gradient, rising in on a soft spring. */
-@Composable
-private fun Greeting(hasDocument: Boolean) {
- val c = clear
- val hour = remember { Calendar.getInstance().get(Calendar.HOUR_OF_DAY) }
- val hello = stringResource(
- when (hour) {
- in 5..11 -> R.string.desk_greeting_morning
- in 12..16 -> R.string.desk_greeting_afternoon
- in 17..22 -> R.string.desk_greeting_evening
- else -> R.string.desk_greeting_night
- },
- )
- val tagline = stringResource(if (hasDocument) R.string.desk_tagline_reading else R.string.desk_tagline_empty)
- val rise = remember { Animatable(0f) }
- LaunchedEffect(Unit) { rise.animateTo(1f, GlassMotion.rise()) }
- val gradient = Brush.linearGradient(listOf(Candy.Tomato, Candy.Bubblegum, Candy.Grape))
- Column(
- Modifier.fillMaxWidth().padding(start = 22.dp, end = 22.dp, top = 18.dp, bottom = 10.dp)
- .graphicsLayer {
- translationY = (1f - rise.value) * 28.dp.toPx()
- alpha = rise.value.coerceIn(0f, 1f)
- compositingStrategy = CompositingStrategy.ModulateAlpha
- },
- ) {
- Text(hello, style = ClearType.Hero, color = c.ink)
- Text(
- buildAnnotatedString { withStyle(SpanStyle(brush = gradient)) { append(tagline) } },
- style = ClearType.Hero,
- )
- }
-}
-
-@Composable
-private fun SectionTitle(title: String, action: String?, onAction: () -> Unit) {
- val c = clear
- Row(Modifier.fillMaxWidth().padding(start = 22.dp, end = 14.dp, top = 26.dp, bottom = 12.dp), verticalAlignment = Alignment.CenterVertically) {
- Text(title, style = ClearType.Headline, color = c.ink, modifier = Modifier.weight(1f))
- if (action != null) {
- GlassPill(onClick = onAction, height = 36.dp, horizontalPadding = 14.dp) {
- Text(action, style = ClearType.Label, color = c.ink)
- GlassIcon(LucideIcons.ChevronRight, null, Modifier.size(16.dp))
- }
- }
- }
-}
-
-/**
- * The document you were reading: its tilted first page, its name, where you are in it, and a
- * chunky candy progress bar.
- */
-@Composable
-private fun ContinueCard(vm: AppViewModel, last: RecentFile, row: FileRow) {
- val c = clear
- val pages = last.pages.coerceAtLeast(1)
- val page = (last.lastPage + 1).coerceIn(1, pages)
- val progress = page / pages.toFloat()
- GlassCard(
- Modifier.padding(horizontal = 16.dp, vertical = 8.dp).fillMaxWidth().pressable(row.open),
- shape = RoundedRectangle(32.dp),
- ) {
- Row(Modifier.padding(18.dp), verticalAlignment = Alignment.CenterVertically) {
- Box(Modifier.size(104.dp, 132.dp), contentAlignment = Alignment.Center) {
- Box(Modifier.size(92.dp, 120.dp).graphicsLayer { rotationZ = 6f; translationX = 8.dp.toPx() }.clip(RoundedRectangle(8.dp)).background(Candy.Lemon.copy(alpha = 0.7f)))
- PaperThumb(vm, row.thumbPath, 92.dp, 120.dp, tilt = -4f)
- }
- Spacer(Modifier.width(16.dp))
- Column(Modifier.weight(1f)) {
- Text(stringResource(R.string.desk_continue).uppercase(), style = ClearType.Eyebrow, color = Candy.Tomato)
- Spacer(Modifier.height(6.dp))
- Text(displayName(row.name), style = ClearType.Title, color = c.ink, maxLines = 3, overflow = TextOverflow.Ellipsis)
- Spacer(Modifier.height(10.dp))
- Text(stringResource(R.string.desk_page_of, page, pages), style = ClearType.Label, color = c.inkSoft)
- Spacer(Modifier.height(8.dp))
- Box(Modifier.fillMaxWidth().height(10.dp).clip(Capsule).background(c.ink.copy(alpha = 0.08f))) {
- Box(
- Modifier.fillMaxWidth(progress.coerceIn(0.06f, 1f)).fillMaxHeight().clip(Capsule)
- .background(Brush.horizontalGradient(listOf(Candy.Tangerine, Candy.Tomato))),
- )
- }
- }
- }
- }
-}
-
-/** A candy tile of the bento: a big glyph up top, the tool's name at the bottom, a lighter corner. */
-@Composable
-private fun CandyTile(icon: ImageVector, label: String, accent: Color, modifier: Modifier, big: Boolean = false, onClick: () -> Unit) {
- val shape = RoundedRectangle(if (big) 30.dp else 26.dp)
- Box(
- modifier.pressable(onClick, pressedScale = 0.93f).clip(shape)
- .background(Brush.linearGradient(listOf(lighten(accent, 0.22f), accent, darken(accent, 0.08f))))
- .padding(if (big) 18.dp else 14.dp),
- ) {
- // a soft bubble of light in the corner, the playful bit
- Box(Modifier.align(Alignment.TopEnd).size(if (big) 90.dp else 56.dp).graphicsLayer { translationX = 26.dp.toPx(); translationY = (-26).dp.toPx() }.clip(CircleShape).background(Color.White.copy(alpha = 0.18f)))
- Icon(icon, null, tint = Color.White, modifier = Modifier.size(if (big) 34.dp else 26.dp))
- Text(label, style = if (big) ClearType.Headline else ClearType.Tile, color = Color.White, modifier = Modifier.align(Alignment.BottomStart), maxLines = 2)
- }
-}
-
-private fun lighten(c: Color, f: Float) = Color(c.red + (1f - c.red) * f, c.green + (1f - c.green) * f, c.blue + (1f - c.blue) * f, c.alpha)
-private fun darken(c: Color, f: Float) = Color(c.red * (1f - f), c.green * (1f - f), c.blue * (1f - f), c.alpha)
-
-/**
- * The bento: Scan as a tall hero tile, Combine and Fill & Sign beside it, then a row of three.
- */
-@Composable
-private fun Bento(vm: AppViewModel) {
- val gap = 12.dp
- Column(Modifier.padding(horizontal = 16.dp), verticalArrangement = Arrangement.spacedBy(gap)) {
- Row(Modifier.fillMaxWidth().height(232.dp), horizontalArrangement = Arrangement.spacedBy(gap)) {
- val scan = ToolCatalog.Scan
- CandyTile(scan.icon, stringResource(scan.label), scan.accent, Modifier.weight(1.08f).fillMaxHeight(), big = true) { scan.go(vm) }
- Column(Modifier.weight(1f).fillMaxHeight(), verticalArrangement = Arrangement.spacedBy(gap)) {
- for (t in listOf(ToolCatalog.Combine, ToolCatalog.FillSign)) {
- CandyTile(t.icon, stringResource(t.label), t.accent, Modifier.weight(1f).fillMaxWidth()) { t.go(vm) }
- }
- }
- }
- Row(Modifier.fillMaxWidth().height(112.dp), horizontalArrangement = Arrangement.spacedBy(gap)) {
- for (t in listOf(ToolCatalog.Photos, ToolCatalog.Edit, ToolCatalog.Compress)) {
- CandyTile(t.icon, stringResource(t.label), t.accent, Modifier.weight(1f).fillMaxHeight()) { t.go(vm) }
- }
- }
- }
-}
-
-private val Tilts = floatArrayOf(-4f, 3f, -2f, 4.5f, -3.5f, 2f)
-
-/** Recent papers on a shelf, each dropped at its own angle; a press straightens it. */
-@Composable
-private fun Shelf(vm: AppViewModel, rows: List<FileRow>) {
- LazyRow(contentPadding = PaddingValues(horizontal = 20.dp), horizontalArrangement = Arrangement.spacedBy(18.dp)) {
- itemsIndexed(rows, key = { _, r -> r.key }) { i, r -> ShelfPaper(vm, r, Tilts[i % Tilts.size]) }
- }
-}
-
-@Composable
-private fun ShelfPaper(vm: AppViewModel, r: FileRow, tilt: Float) {
- val c = clear
- Column(Modifier.width(124.dp).pressable(r.open, onLongClick = { vm.fileSheet = r to true }, pressedScale = 1.04f).padding(vertical = 10.dp)) {
- Box(Modifier.fillMaxWidth().aspectRatio(0.78f), contentAlignment = Alignment.Center) {
- PaperThumb(vm, r.thumbPath, 112.dp, 144.dp, tilt = tilt)
- if (r.starred) {
- Box(
- Modifier.align(Alignment.TopEnd).size(26.dp).clip(CircleShape).background(Candy.Lemon),
- contentAlignment = Alignment.Center,
- ) { Icon(LucideIcons.Star, null, tint = Color.White, modifier = Modifier.size(14.dp)) }
- }
- }
- Spacer(Modifier.height(12.dp))
- Text(displayName(r.name), style = ClearType.Label, color = c.ink, maxLines = 2, overflow = TextOverflow.Ellipsis)
- Text(whenLabel(r.date), style = ClearType.Caption, color = c.inkSoft, maxLines = 1)
- }
-}
diff --git a/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/ui/desk/FilesScreen.kt b/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/ui/desk/FilesScreen.kt
index 0390b3e..24a1307 100644
--- a/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/ui/desk/FilesScreen.kt
+++ b/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/ui/desk/FilesScreen.kt
@@ -61,6 +61,7 @@ import com.chethan616.clearpdf.ui.glass.WashPanel
import com.chethan616.clearpdf.ui.glass.glass
import com.chethan616.clearpdf.ui.glass.pressable
import com.chethan616.clearpdf.ui.home.FileRow
+import com.chethan616.clearpdf.ui.home.HomeTab
import com.chethan616.clearpdf.ui.home.dayBucket
import com.chethan616.clearpdf.ui.theme.Candy
import com.chethan616.clearpdf.ui.theme.ClearType
@@ -123,13 +124,12 @@ fun FilesScreen(vm: AppViewModel, onBrowse: () -> Unit) {
if (vm.selectedFiles.isNotEmpty()) {
SelectionHeader(vm, recent = tab == 0) { confirmDelete = true }
} else {
- ScreenHeader(pluralStringResource(R.plurals.files_count, rows.size, rows.size), stringResource(R.string.home_tab_files)) {
+ 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 },
+ onClick = { menuOpen = true }, size = 54.dp, surface = Color.White.copy(alpha = 0.16f),
modifier = Modifier.onGloballyPositioned { menuAnchor = it.boundsInWindow() },
label = stringResource(R.string.common_more_options),
- ) { GlassIcon(LucideIcons.Ellipsis, null, Modifier.size(21.dp)) }
- SettingsButton(vm)
+ ) { GlassIcon(LucideIcons.Ellipsis, null, Modifier.size(22.dp), tint = clear.hero) }
}
}
}
diff --git a/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/ui/desk/SettingsScreen.kt b/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/ui/desk/SettingsScreen.kt
index dce7add..9cae3f2 100644
--- a/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/ui/desk/SettingsScreen.kt
+++ b/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/ui/desk/SettingsScreen.kt
@@ -66,7 +66,7 @@ import com.chethan616.clearpdf.ui.theme.ClearType
import com.chethan616.clearpdf.ui.theme.clear
import com.kyant.shapes.RoundedRectangle
-/** ClearPDF's repository: help, issues and source. */
+/** Artefact's repository: help, issues and source. */
const val CLEARPDF_REPO = "https://github.com/Chethan616/ClearPDF"
/** Settings, and its Licences page. */
@@ -89,14 +89,9 @@ private fun SettingsRoot(vm: AppViewModel, openLicences: () -> Unit) {
var authorDialog by remember { mutableStateOf(false) }
LazyColumn(Modifier.fillMaxSize(), contentPadding = PaddingValues(bottom = 32.dp)) {
item { Spacer(Modifier.windowInsetsTopHeight(WindowInsets.statusBars)) }
- item(key = "back") {
- Row(Modifier.padding(start = 14.dp, top = 10.dp)) {
- GlassCircle(onClick = { vm.settingsOpen = false }, label = stringResource(R.string.common_back)) { GlassIcon(LucideIcons.ArrowLeft, null, Modifier.size(21.dp)) }
- }
- }
item(key = "title") {
Spacer(Modifier.height(14.dp))
- ScreenHeader(null, stringResource(R.string.home_settings))
+ ScreenHeader(null, stringResource(R.string.home_settings), onBack = { vm.settingsOpen = false })
}
item(key = "hero") { AppCard(vm) }
@@ -148,12 +143,14 @@ private fun SettingsRoot(vm: AppViewModel, openLicences: () -> Unit) {
item(key = "feel") {
Panel {
ToggleRow(LucideIcons.Sparkles, Candy.Bubblegum, stringResource(R.string.settings_haptics), null, GlassSettings.haptics) { GlassSettings.updateHaptics(context, it) }
+ GlassRow(stringResource(R.string.settings_show_welcome), { vm.showWelcomeAgain() }, icon = LucideIcons.Compass, accent = Candy.Sky)
}
}
item(key = "reading") { Section(stringResource(R.string.settings_reading)) }
item(key = "readingpanel") {
Panel {
+ ToggleRow(LucideIcons.PanelsTopLeft, Candy.Sky, stringResource(R.string.settings_quick_preview), stringResource(R.string.settings_quick_preview_body), vm.quickPreview) { vm.updateQuickPreview(it) }
ToggleRow(LucideIcons.Sun, Candy.Lemon, stringResource(R.string.home_keep_screen_on), stringResource(R.string.home_keep_screen_on_body), vm.keepScreenOn) { vm.updateKeepScreenOn(it) }
ToggleRow(LucideIcons.Smartphone, Candy.Sky, stringResource(R.string.home_status_bar_in_documents), stringResource(R.string.home_status_bar_in_documents_body), vm.statusBarInDocuments) { vm.updateStatusBarInDocuments(it) }
ToggleRow(LucideIcons.Hash, Candy.Mint, stringResource(R.string.home_search_count), stringResource(R.string.home_search_count_body), vm.searchCount) { vm.updateSearchCount(it) }
@@ -224,7 +221,7 @@ private fun AppCard(vm: AppViewModel) {
shape = RoundedRectangle(30.dp),
) {
Row(Modifier.padding(18.dp), verticalAlignment = Alignment.CenterVertically) {
- Image(painterResource(R.mipmap.ic_launcher), null, Modifier.size(64.dp).clip(RoundedRectangle(18.dp)))
+ Image(painterResource(R.drawable.artefact_logo), null, Modifier.size(64.dp))
Spacer(Modifier.width(16.dp))
Column {
Text(stringResource(R.string.app_name), style = ClearType.Headline, color = c.ink)
@@ -282,13 +279,13 @@ private fun ToggleRow(icon: ImageVector, accent: Color, label: String, body: Str
/** One entry of the Licences page: what it is, and its licence and authors. */
private class Credit(val name: String, val terms: String)
-/** The open-source licences of everything ClearPDF is built from, then their full texts. */
+/** The open-source licences of everything Artefact is built from, then their full texts. */
@Composable
private fun LicencesPage(onBack: () -> Unit) {
val c = clear
val context = LocalContext.current
val texts = remember {
- listOf("LICENSE-lucide.txt", "OFL-Inter.txt", "OFL-BricolageGrotesque.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-DancingScript.txt", "LICENSE-foxit.txt", "LICENSE-adobe-cmaps.txt").mapNotNull { name ->
runCatching { context.assets.open("licences/$name").bufferedReader().readText() }.getOrNull()?.takeIf { it.isNotBlank() }
}
}
@@ -300,8 +297,10 @@ private fun LicencesPage(onBack: () -> Unit) {
Credit("JNA", "Apache-2.0"),
Credit("AndroidX, Jetpack Compose, Kotlin coroutines", "Apache-2.0"),
Credit(stringResource(R.string.root_licence_lucide), "ISC, Lucide Contributors"),
- Credit("Bricolage Grotesque", "SIL Open Font License 1.1, The Bricolage Grotesque Project Authors"),
- Credit(stringResource(R.string.root_licence_inter), "SIL Open Font License 1.1, The Inter Project Authors"),
+ 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("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"),
Credit(stringResource(R.string.root_licence_cmaps), "BSD-3-Clause, Adobe"),
@@ -311,11 +310,8 @@ private fun LicencesPage(onBack: () -> Unit) {
LazyColumn(Modifier.fillMaxSize(), contentPadding = PaddingValues(bottom = 32.dp)) {
item { Spacer(Modifier.windowInsetsTopHeight(WindowInsets.statusBars)) }
item {
- Row(Modifier.padding(start = 14.dp, top = 10.dp)) {
- GlassCircle(onClick = onBack, label = stringResource(R.string.common_back)) { GlassIcon(LucideIcons.ArrowLeft, null, Modifier.size(21.dp)) }
- }
Spacer(Modifier.height(14.dp))
- ScreenHeader(null, stringResource(R.string.home_licences))
+ ScreenHeader(null, stringResource(R.string.home_licences), onBack = onBack)
Spacer(Modifier.height(16.dp))
}
item {
diff --git a/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/ui/desk/ToolsScreen.kt b/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/ui/desk/ToolsScreen.kt
index 6a6b1c4..74a20f7 100644
--- a/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/ui/desk/ToolsScreen.kt
+++ b/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/ui/desk/ToolsScreen.kt
@@ -73,7 +73,7 @@ fun ToolsScreen(vm: AppViewModel) {
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)) { SettingsButton(vm) }
+ ScreenHeader(stringResource(R.string.tools_subtitle), stringResource(R.string.home_tab_tools), onBack = { vm.homeTab = com.chethan616.clearpdf.ui.home.HomeTab.Home })
}
item(key = "chips") {
LazyRow(contentPadding = PaddingValues(horizontal = 16.dp, vertical = 16.dp), horizontalArrangement = Arrangement.spacedBy(8.dp)) {
diff --git a/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Backdrops.kt b/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Backdrops.kt
index 32d2a32..8ea27ed 100644
--- a/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Backdrops.kt
+++ b/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Backdrops.kt
@@ -63,14 +63,17 @@ fun GlassLayer(
}
}
-/** A mood of the aurora: where its blobs sit, as fractions of the screen, and how big they are. */
-data class AuroraMood(val blobs: List<Offset>, val radius: Float = 0.75f)
+/** A mood of the wallpaper: where its blooms of light sit, as fractions of the screen, and how big they are. */
+data class AuroraMood(val blobs: List<Offset>, val radius: Float = 0.62f)
object AuroraMoods {
- val Desk = AuroraMood(listOf(Offset(0.05f, 0.08f), Offset(0.95f, 0.02f), Offset(0.0f, 0.62f), Offset(1.0f, 0.78f), Offset(0.5f, 1.05f)))
- val Files = AuroraMood(listOf(Offset(0.9f, 0.1f), Offset(0.1f, 0.0f), Offset(1.0f, 0.55f), Offset(0.0f, 0.9f), Offset(0.45f, 0.4f)), 0.7f)
- val Tools = AuroraMood(listOf(Offset(0.5f, -0.05f), Offset(0.0f, 0.3f), Offset(0.95f, 0.45f), Offset(0.15f, 1.0f), Offset(0.9f, 1.0f)))
- val Settings = AuroraMood(listOf(Offset(0.0f, 0.0f), Offset(1.0f, 0.15f), Offset(0.2f, 0.75f), Offset(0.85f, 1.0f), Offset(0.6f, 0.45f)), 0.65f)
+ // the blooms, in ClearColors.blooms' order: aqua, lilac, pink, periwinkle, haze
+ val Desk = AuroraMood(listOf(Offset(0.0f, 0.58f), Offset(0.98f, 0.44f), Offset(1.0f, 0.1f), Offset(0.5f, 1.08f), Offset(0.2f, -0.05f)))
+ val Files = AuroraMood(listOf(Offset(0.1f, 0.3f), Offset(0.9f, 0.7f), Offset(0.85f, 0.0f), Offset(0.2f, 1.05f), Offset(0.6f, -0.1f)), 0.58f)
+ val Tools = AuroraMood(listOf(Offset(0.9f, 0.25f), Offset(0.1f, 0.65f), Offset(0.0f, 0.05f), Offset(0.8f, 1.05f), Offset(0.45f, -0.08f)))
+ val Settings = AuroraMood(listOf(Offset(0.15f, 0.15f), Offset(0.95f, 0.85f), Offset(1.0f, 0.3f), Offset(0.1f, 1.0f), Offset(0.6f, 0.0f)), 0.55f)
+ val Note = AuroraMood(listOf(Offset(0.05f, 0.85f), Offset(0.6f, 0.35f), Offset(0.95f, 0.2f), Offset(0.4f, 1.1f), Offset(0.1f, 0.0f)), 0.68f)
+ val Welcome = AuroraMood(listOf(Offset(0.0f, 0.35f), Offset(0.9f, 0.6f), Offset(0.95f, 0.15f), Offset(0.3f, 1.05f), Offset(0.5f, 0.0f)), 0.7f)
}
private val OffsetPairConverter = TwoWayConverter<Pair<Offset, Offset>, AnimationVector4D>(
@@ -79,8 +82,9 @@ private val OffsetPairConverter = TwoWayConverter<Pair<Offset, Offset>, Animatio
)
/**
- * The wallpaper: the canvas colour under soft candy blobs. Static while idle (no infinite animation);
- * a new [mood] glides the blobs to new places on one spring, so each tab has its own light.
+ * 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.
*/
@Composable
fun Aurora(mood: AuroraMood, modifier: Modifier = Modifier) {
@@ -94,14 +98,17 @@ fun Aurora(mood: AuroraMood, modifier: Modifier = Modifier) {
}
Box(
modifier.fillMaxSize().drawBehind {
- drawRect(colors.canvas)
+ drawRect(Brush.verticalGradient(colors.wall))
val r = size.maxDimension
- colors.aurora.forEachIndexed { i, (c, strength) ->
+ 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.4f), Color.Transparent), center, r * rad.x),
+ 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,
)
}
diff --git a/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Loader.kt b/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Loader.kt
new file mode 100644
index 0000000..50aa83a
--- /dev/null
+++ b/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Loader.kt
@@ -0,0 +1,48 @@
+package com.chethan616.clearpdf.ui.glass
+
+import androidx.compose.animation.core.Animatable
+import androidx.compose.foundation.layout.Box
+import androidx.compose.foundation.layout.size
+import androidx.compose.foundation.shape.CircleShape
+import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi
+import androidx.compose.material3.LoadingIndicator
+import androidx.compose.material3.LoadingIndicatorDefaults
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.LaunchedEffect
+import androidx.compose.runtime.remember
+import androidx.compose.ui.Alignment
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.graphics.graphicsLayer
+import androidx.compose.ui.semantics.contentDescription
+import androidx.compose.ui.semantics.semantics
+import androidx.compose.ui.unit.Dp
+import androidx.compose.ui.unit.dp
+import com.chethan616.clearpdf.ui.theme.Candy
+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.
+ */
+@OptIn(ExperimentalMaterial3ExpressiveApi::class)
+@Composable
+fun 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()) }
+ Box(
+ modifier
+ .graphicsLayer {
+ val s = 0.6f + 0.4f * appear.value
+ scaleX = s
+ scaleY = s
+ alpha = appear.value.coerceIn(0f, 1f)
+ }
+ .size(size)
+ .glass(CircleShape, clear.frost, blur = 12.dp)
+ .then(if (label != null) Modifier.semantics { contentDescription = label } else Modifier),
+ contentAlignment = Alignment.Center,
+ ) {
+ LoadingIndicator(Modifier.size(size * 0.78f), color = color, polygons = LoadingIndicatorDefaults.IndeterminateIndicatorPolygons)
+ }
+}
diff --git a/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/ui/home/Cards.kt b/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/ui/home/Cards.kt
new file mode 100644
index 0000000..891176e
--- /dev/null
+++ b/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/ui/home/Cards.kt
@@ -0,0 +1,457 @@
+package com.chethan616.clearpdf.ui.home
+
+import android.graphics.BitmapFactory
+import androidx.compose.animation.animateColorAsState
+import androidx.compose.animation.core.Animatable
+import androidx.compose.animation.core.animateFloatAsState
+import androidx.compose.foundation.Canvas
+import androidx.compose.foundation.Image
+import androidx.compose.foundation.background
+import androidx.compose.foundation.border
+import androidx.compose.foundation.layout.Arrangement
+import androidx.compose.foundation.layout.Box
+import androidx.compose.foundation.layout.BoxScope
+import androidx.compose.foundation.layout.BoxWithConstraints
+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.heightIn
+import androidx.compose.foundation.layout.offset
+import androidx.compose.foundation.layout.padding
+import androidx.compose.foundation.layout.size
+import androidx.compose.foundation.layout.width
+import androidx.compose.foundation.shape.CircleShape
+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.mutableStateOf
+import androidx.compose.runtime.remember
+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.draw.drawBehind
+import androidx.compose.ui.draw.rotate
+import androidx.compose.ui.geometry.CornerRadius
+import androidx.compose.ui.geometry.Offset
+import androidx.compose.ui.geometry.Size
+import androidx.compose.ui.graphics.Brush
+import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.graphics.CompositingStrategy
+import androidx.compose.ui.graphics.ImageBitmap
+import androidx.compose.ui.graphics.Path
+import androidx.compose.ui.graphics.StrokeCap
+import androidx.compose.ui.graphics.asImageBitmap
+import androidx.compose.ui.graphics.graphicsLayer
+import androidx.compose.ui.graphics.vector.ImageVector
+import androidx.compose.ui.hapticfeedback.HapticFeedbackType
+import androidx.compose.ui.layout.ContentScale
+import androidx.compose.ui.platform.LocalHapticFeedback
+import androidx.compose.ui.res.pluralStringResource
+import androidx.compose.ui.res.stringResource
+import androidx.compose.ui.text.style.TextAlign
+import androidx.compose.ui.text.style.TextOverflow
+import androidx.compose.ui.unit.Dp
+import androidx.compose.ui.unit.dp
+import androidx.compose.ui.unit.sp
+import com.chethan616.clearpdf.R
+import com.chethan616.clearpdf.notes.CheckItem
+import com.chethan616.clearpdf.notes.Note
+import com.chethan616.clearpdf.ui.AppViewModel
+import com.chethan616.clearpdf.ui.LucideIcons
+import com.chethan616.clearpdf.ui.desk.PaperThumb
+import com.chethan616.clearpdf.ui.glass.GlassMotion
+import com.chethan616.clearpdf.ui.glass.pressable
+import com.chethan616.clearpdf.ui.theme.CardTone
+import com.chethan616.clearpdf.ui.theme.ClearType
+import com.chethan616.clearpdf.ui.theme.Tone
+import com.chethan616.clearpdf.ui.theme.clear
+import com.kyant.shapes.Capsule
+import com.kyant.shapes.RoundedRectangle
+import java.io.File
+import java.text.DateFormat
+import java.util.Date
+import kotlinx.coroutines.Dispatchers
+import kotlinx.coroutines.withContext
+
+/** The corner every desk card shares: big and continuous, like the mock's. */
+val CardShape = RoundedRectangle(30.dp)
+
+/** A desk card's paint: its tone's gradient, a soft light in one corner, a lit rim. */
+@Composable
+fun Modifier.cardPaint(tone: CardTone, glow: Offset = Offset(0.85f, 0.05f)): Modifier {
+ val dark = clear.dark
+ return clip(CardShape)
+ .drawBehind {
+ drawRect(Brush.verticalGradient(listOf(tone.top, tone.bottom)))
+ drawCircle(
+ Brush.radialGradient(
+ listOf(Color.White.copy(alpha = if (dark) 0.10f else 0.32f), Color.Transparent),
+ Offset(glow.x * size.width, glow.y * size.height), size.maxDimension * 0.75f,
+ ),
+ radius = size.maxDimension * 0.75f, center = Offset(glow.x * size.width, glow.y * size.height),
+ )
+ }
+ .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. */
+@Composable
+fun Modifier.riseIn(index: Int): Modifier {
+ val p = remember { Animatable(0f) }
+ LaunchedEffect(Unit) {
+ kotlinx.coroutines.delay(40L * index.coerceAtMost(8))
+ p.animateTo(1f, GlassMotion.rise())
+ }
+ return graphicsLayer {
+ translationY = (1f - p.value) * 46.dp.toPx()
+ val s = 0.94f + 0.06f * p.value
+ scaleX = s
+ scaleY = s
+ alpha = p.value.coerceIn(0f, 1f)
+ compositingStrategy = CompositingStrategy.ModulateAlpha
+ }
+}
+
+/** "1 Jun 2026". */
+fun shortDate(t: Long): String = DateFormat.getDateInstance(DateFormat.MEDIUM).format(Date(t))
+
+// ---- To-do list ----------------------------------------------------------------------------------
+
+/** A list: its name in dot-matrix type, then its first items as glass pills you can tick right here. */
+@Composable
+fun ListCard(note: Note, onOpen: () -> Unit, onLong: () -> Unit, onToggle: (CheckItem) -> Unit, modifier: Modifier = Modifier) {
+ val 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),
+ ) {
+ 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())
+ }
+ }
+}
+
+/**
+ * [text] at [style]'s size, or smaller when its longest word wouldn't fit the width: a word is
+ * never split across lines (lines break between words only).
+ */
+@Composable
+fun WordFitText(text: String, style: androidx.compose.ui.text.TextStyle, modifier: Modifier = Modifier, maxLines: Int = 2, minScale: Float = 0.5f) {
+ val measurer = androidx.compose.ui.text.rememberTextMeasurer()
+ BoxWithConstraints(modifier) {
+ val room = constraints.maxWidth
+ val scale = remember(text, style, room) {
+ val widest = text.split(' ', '\n').filter { it.isNotBlank() }
+ .maxOfOrNull { measurer.measure(it, style, softWrap = false, maxLines = 1).size.width } ?: 0
+ if (widest <= room || widest == 0) 1f else (room.toFloat() / widest * 0.98f).coerceAtLeast(minScale)
+ }
+ Text(
+ text, style = style.copy(fontSize = style.fontSize * scale, lineHeight = style.lineHeight * scale),
+ maxLines = maxLines, overflow = TextOverflow.Ellipsis, modifier = Modifier.fillMaxWidth(),
+ )
+ }
+}
+
+/** A list item on a card: a glass capsule with a round tick; ticked, it darkens and the tick fills. */
+@Composable
+fun CheckPill(item: CheckItem, tone: CardTone, onToggle: () -> Unit) {
+ val haptics = LocalHapticFeedback.current
+ val 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,
+ ) {
+ 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)) }
+ }
+ Spacer(Modifier.width(10.dp))
+ Text(item.text, style = ClearType.Body.copy(fontSize = 14.5.sp), color = ink, maxLines = 1, overflow = TextOverflow.Ellipsis)
+ }
+}
+
+// ---- Text note -----------------------------------------------------------------------------------
+
+/** A note: frosted white paper, its title big and bold in the note's blue, the date in the corner. */
+@Composable
+fun NoteCard(note: Note, onOpen: () -> Unit, onLong: () -> Unit, modifier: Modifier = Modifier) {
+ val tone = clear.tone(Tone.Paper)
+ val title = note.title.ifBlank { note.body.lineSequence().firstOrNull { it.isNotBlank() }?.trim()?.removePrefix("# ").orEmpty() }
+ val body = if (note.title.isBlank()) "" else note.body.lineSequence().filter { it.isNotBlank() }.joinToString(" ") { it.trim().removePrefix("# ").replace("**", "") }
+ Column(
+ modifier.heightIn(min = 156.dp).pressable(onOpen, onLong, pressedScale = 0.96f).cardPaint(tone, Offset(0.1f, 0.0f)).padding(18.dp),
+ ) {
+ WordFitText(title.ifBlank { stringResource(R.string.notes_untitled_note) }, ClearType.CardTitle.copy(color = tone.accent), maxLines = 4)
+ if (body.isNotBlank() && title.length < 40) {
+ Spacer(Modifier.height(8.dp))
+ Text(body, style = ClearType.Label, color = tone.ink.copy(alpha = 0.62f), maxLines = 3, overflow = TextOverflow.Ellipsis)
+ }
+ note.images.firstOrNull()?.let { name ->
+ Spacer(Modifier.height(12.dp))
+ NoteImage(name, Modifier.fillMaxWidth().height(86.dp).clip(RoundedRectangle(16.dp)))
+ }
+ Spacer(Modifier.height(12.dp).weight(1f, fill = false))
+ Text(shortDate(note.updated), 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. */
+@Composable
+fun NoteImage(name: String, modifier: Modifier, maxPx: Int = 720) {
+ val vm = LocalHomeVm.current
+ var img by remember(name) { mutableStateOf<ImageBitmap?>(null) }
+ LaunchedEffect(name) { img = withContext(Dispatchers.IO) { decodeScaled(vm?.notes?.file(name), maxPx) } }
+ Box(modifier.background(Color.White.copy(alpha = 0.2f))) {
+ img?.let { Image(it, null, Modifier.fillMaxSize(), contentScale = ContentScale.Crop) }
+ }
+}
+
+/** A picture at no more than [maxPx] on its long side. */
+fun decodeScaled(file: File?, maxPx: Int): ImageBitmap? {
+ if (file == null || !file.isFile) return null
+ return runCatching {
+ val o = BitmapFactory.Options().apply { inJustDecodeBounds = true }
+ BitmapFactory.decodeFile(file.absolutePath, o)
+ var s = 1
+ while (maxOf(o.outWidth, o.outHeight) / (s * 2) >= maxPx) s *= 2
+ BitmapFactory.decodeFile(file.absolutePath, BitmapFactory.Options().apply { inSampleSize = s })?.asImageBitmap()
+ }.getOrNull()
+}
+
+/** The view model, for cards deep in the grid that load pictures. */
+val LocalHomeVm = androidx.compose.runtime.staticCompositionLocalOf<AppViewModel?> { null }
+
+// ---- Voice note ----------------------------------------------------------------------------------
+
+/** A voice memo: lavender, a play button, its waveform in white (the played part brighter). */
+@Composable
+fun VoiceCard(note: Note, playing: Boolean, progress: Float, onPlay: () -> Unit, onLong: () -> Unit, modifier: Modifier = Modifier) {
+ val tone = clear.tone(Tone.Lavender)
+ Box(
+ modifier.height(96.dp).pressable(onPlay, onLong, pressedScale = 0.95f).cardPaint(tone, Offset(0.5f, 0.0f)).padding(horizontal = 16.dp, vertical = 12.dp),
+ ) {
+ 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),
+ )
+ }
+}
+
+/** Mirrored rounded bars, as the mock's waveform: [levels] 0..1, the first [progress] of them lit. */
+@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 w = ((size.width - gap * (bars.size - 1)) / bars.size).coerceAtLeast(1.5f)
+ // the middle bars swell a little more, like the mock's
+ bars.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 x = i * (w + gap)
+ val lit = (i + 0.5f) / bars.size <= progress
+ drawRoundRect(
+ color.copy(alpha = if (progress <= 0f || lit) 1f else 0.5f),
+ topLeft = Offset(x, (size.height - h) / 2f), size = Size(w, h), cornerRadius = CornerRadius(w / 2f, w / 2f),
+ )
+ }
+ }
+}
+
+// ---- Collections ---------------------------------------------------------------------------------
+
+/** A collection ("Files", "Pdf"): its word set big in serif, and two papers fanned in the corner. */
+@Composable
+fun CollectionCard(word: String, tone: CardTone, onOpen: () -> Unit, modifier: Modifier = Modifier, height: Dp = 150.dp, count: Int? = null) {
+ Box(modifier.height(height).pressable(onOpen, pressedScale = 0.95f).cardPaint(tone, Offset(0.2f, 1.0f))) {
+ Papers(Modifier.align(Alignment.TopEnd).padding(top = 14.dp, end = 14.dp))
+ Text(
+ word, style = ClearType.SerifWord, color = tone.accent, maxLines = 1,
+ modifier = Modifier.align(Alignment.BottomStart).padding(start = 16.dp, bottom = 10.dp),
+ )
+ if (count != null && count > 0) {
+ Text(
+ count.toString(), style = ClearType.Label, color = tone.ink.copy(alpha = 0.6f),
+ modifier = Modifier.align(Alignment.TopStart).padding(16.dp),
+ )
+ }
+ }
+}
+
+/** Two sheets of paper with grey lines, one turned each way. */
+@Composable
+private fun Papers(modifier: Modifier) {
+ Box(modifier.size(84.dp, 64.dp)) {
+ Paper(Modifier.align(Alignment.CenterStart).rotate(-10f))
+ Paper(Modifier.align(Alignment.CenterEnd).offset(y = 4.dp).rotate(7f))
+ }
+}
+
+@Composable
+private fun Paper(modifier: Modifier) {
+ Column(
+ modifier.size(46.dp, 56.dp)
+ .graphicsLayer { shadowElevation = 6.dp.toPx(); shape = RoundedRectangle(8.dp); clip = true }
+ .background(Color.White).padding(horizontal = 8.dp, vertical = 9.dp),
+ verticalArrangement = Arrangement.spacedBy(4.dp),
+ ) {
+ repeat(5) { k -> Box(Modifier.fillMaxWidth(if (k == 4) 0.6f else 1f).height(2.5.dp).clip(Capsule).background(Color(0xFF17141F).copy(alpha = 0.16f))) }
+ }
+}
+
+// ---- Stacks of papers or pictures ------------------------------------------------------------------
+
+/**
+ * A stack: the newest document's first page (or a picture) filling the card, two tinted cards
+ * peeking out behind it at angles, a title over the top, and glass chips along the bottom.
+ */
+@Composable
+fun StackCard(
+ title: String,
+ subtitle: String?,
+ behind: List<CardTone>,
+ onOpen: () -> Unit,
+ modifier: Modifier = Modifier,
+ height: Dp = 214.dp,
+ onLong: (() -> Unit)? = null,
+ chips: @Composable BoxScope.() -> Unit = {},
+ picture: @Composable BoxScope.() -> Unit,
+) {
+ Box(modifier.height(height).pressable(onOpen, onLong, pressedScale = 0.95f)) {
+ behind.forEachIndexed { i, t ->
+ Box(
+ Modifier.fillMaxSize().padding(vertical = 6.dp)
+ .graphicsLayer {
+ rotationZ = if (i == 0) 5f else -4f
+ translationX = (if (i == 0) 10 else -6).dp.toPx()
+ }
+ .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))))
+ 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)
+ }
+ chips()
+ Box(Modifier.matchParentSize().border(1.dp, Color.White.copy(alpha = 0.35f), CardShape))
+ }
+ }
+}
+
+/** A frosted chip on a picture: "+5", or an icon and a word. */
+@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))
+ }
+ Text(text, style = ClearType.Label, color = Color.White, maxLines = 1)
+ }
+}
+
+/** A document's first page filling a card. */
+@Composable
+fun BoxScope.PageFill(vm: AppViewModel, path: String?) {
+ BoxWithConstraints(Modifier.matchParentSize()) {
+ PaperThumb(vm, path, maxWidth, maxHeight, corner = 0.dp)
+ }
+}
+
+// ---- A single document ---------------------------------------------------------------------------
+
+/** One PDF on the desk: its first page tilted on a tinted card, its name under it. */
+@Composable
+fun DocCard(vm: AppViewModel, r: FileRow, tone: CardTone, tilt: Float, onLong: () -> Unit, modifier: Modifier = Modifier) {
+ Column(modifier.pressable(r.open, onLong, pressedScale = 0.95f).cardPaint(tone, Offset(0.8f, 0.0f)).padding(14.dp)) {
+ Box(Modifier.fillMaxWidth().height(150.dp), contentAlignment = Alignment.Center) {
+ PaperThumb(vm, r.thumbPath, 104.dp, 136.dp, tilt = tilt, corner = 8.dp, modifier = Modifier.graphicsLayer { shadowElevation = 10.dp.toPx(); shape = RoundedRectangle(8.dp) })
+ if (r.starred) {
+ Box(Modifier.align(Alignment.TopEnd).size(26.dp).clip(CircleShape).background(Color.White), contentAlignment = Alignment.Center) {
+ Icon(LucideIcons.Star, null, tint = com.chethan616.clearpdf.ui.theme.Candy.Lemon, modifier = Modifier.size(14.dp))
+ }
+ }
+ }
+ Spacer(Modifier.height(10.dp))
+ Text(displayName(r.name), style = ClearType.BodyStrong.copy(fontSize = 14.sp, lineHeight = 18.sp), color = tone.ink, maxLines = 2, overflow = TextOverflow.Ellipsis)
+ Text(whenLabel(r.date), style = ClearType.Caption, color = tone.ink.copy(alpha = 0.6f), maxLines = 1)
+ }
+}
+
+// ---- Bits ----------------------------------------------------------------------------------------
+
+/** The mock's menu glyph: four dots in a square. */
+@Composable
+fun FourDots(color: Color, modifier: Modifier = Modifier) {
+ Canvas(modifier.size(20.dp)) {
+ val r = 2.4.dp.toPx()
+ val d = 5.2.dp.toPx()
+ val c = Offset(size.width / 2f, size.height / 2f)
+ for (dx in listOf(-d, d)) for (dy in listOf(-d, d)) drawCircle(color, r, c + Offset(dx, dy))
+ }
+}
+
+/** A plus drawn with round ends (the create button's). */
+@Composable
+fun PlusGlyph(color: Color, modifier: Modifier = Modifier, stroke: Dp = 2.6.dp) {
+ Canvas(modifier) {
+ val s = stroke.toPx()
+ val c = Offset(size.width / 2f, size.height / 2f)
+ val h = size.minDimension / 2f
+ drawLine(color, Offset(c.x - h, c.y), Offset(c.x + h, c.y), s, StrokeCap.Round)
+ drawLine(color, Offset(c.x, c.y - h), Offset(c.x, c.y + h), s, StrokeCap.Round)
+ }
+}
+
+/** A tick drawn as a path (for places that animate it). */
+fun tickPath(size: Size): Path = Path().apply {
+ moveTo(size.width * 0.22f, size.height * 0.52f)
+ lineTo(size.width * 0.42f, size.height * 0.72f)
+ lineTo(size.width * 0.78f, size.height * 0.3f)
+}
+
diff --git a/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/ui/home/CreateDock.kt b/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/ui/home/CreateDock.kt
new file mode 100644
index 0000000..bf84981
--- /dev/null
+++ b/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/ui/home/CreateDock.kt
@@ -0,0 +1,286 @@
+package com.chethan616.clearpdf.ui.home
+
+import androidx.activity.compose.BackHandler
+import androidx.compose.animation.AnimatedContent
+import androidx.compose.animation.animateContentSize
+import androidx.compose.animation.core.Animatable
+import androidx.compose.animation.core.RepeatMode
+import androidx.compose.animation.core.animateFloat
+import androidx.compose.animation.core.animateFloatAsState
+import androidx.compose.animation.core.infiniteRepeatable
+import androidx.compose.animation.core.rememberInfiniteTransition
+import 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.togetherWith
+import androidx.compose.foundation.Canvas
+import androidx.compose.foundation.background
+import androidx.compose.foundation.clickable
+import androidx.compose.foundation.interaction.MutableInteractionSource
+import androidx.compose.foundation.layout.Arrangement
+import androidx.compose.foundation.layout.Box
+import androidx.compose.foundation.layout.BoxScope
+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.height
+import androidx.compose.foundation.layout.navigationBarsPadding
+import androidx.compose.foundation.layout.padding
+import androidx.compose.foundation.layout.size
+import androidx.compose.foundation.layout.width
+import androidx.compose.foundation.shape.CircleShape
+import androidx.compose.material3.Icon
+import androidx.compose.material3.Text
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.LaunchedEffect
+import androidx.compose.runtime.Stable
+import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.remember
+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.CornerRadius
+import androidx.compose.ui.geometry.Offset
+import androidx.compose.ui.geometry.Size
+import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.graphics.CompositingStrategy
+import androidx.compose.ui.graphics.graphicsLayer
+import androidx.compose.ui.graphics.vector.ImageVector
+import androidx.compose.ui.hapticfeedback.HapticFeedbackType
+import androidx.compose.ui.platform.LocalHapticFeedback
+import androidx.compose.ui.res.stringResource
+import androidx.compose.ui.semantics.contentDescription
+import androidx.compose.ui.semantics.semantics
+import androidx.compose.ui.unit.dp
+import com.chethan616.clearpdf.R
+import com.chethan616.clearpdf.notes.Note
+import com.chethan616.clearpdf.notes.NoteKind
+import com.chethan616.clearpdf.notes.waveOf
+import com.chethan616.clearpdf.text
+import com.chethan616.clearpdf.ui.AppViewModel
+import com.chethan616.clearpdf.ui.FilePickKind
+import com.chethan616.clearpdf.ui.LucideIcons
+import com.chethan616.clearpdf.ui.desk.ToolCatalog
+import com.chethan616.clearpdf.ui.glass.GlassCircle
+import com.chethan616.clearpdf.ui.glass.GlassIcon
+import com.chethan616.clearpdf.ui.glass.GlassMotion
+import com.chethan616.clearpdf.ui.glass.glass
+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.chethan616.clearpdf.ui.viewer.VoiceRecorder
+import com.chethan616.clearpdf.ui.viewer.clock
+import com.kyant.shapes.Capsule
+import java.io.File
+import kotlinx.coroutines.CoroutineScope
+import kotlinx.coroutines.delay
+import kotlinx.coroutines.launch
+
+/** The create capsule's state: the fan of ways to make something, and a voice memo being recorded. */
+@Stable
+class DeskState(private val scope: CoroutineScope) {
+ var fanOpen by mutableStateOf(false)
+ var recorder by mutableStateOf<VoiceRecorder?>(null)
+ private set
+ private var file: File? = null
+
+ fun startRecording(vm: AppViewModel) {
+ fanOpen = false
+ vm.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))
+ }
+ }
+ }
+
+ fun finish(vm: AppViewModel, keep: Boolean) {
+ val r = recorder ?: return
+ val f = file
+ scope.launch {
+ r.stop()
+ recorder = null
+ file = null
+ if (f == null) return@launch
+ if (!keep || r.elapsedMs < 600) {
+ f.delete()
+ 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()),
+ ),
+ )
+ vm.tell(text(R.string.voice_saved))
+ }
+ }
+}
+
+/**
+ * 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).
+ */
+@Composable
+fun BoxScope.CreateDock(vm: AppViewModel, desk: DeskState, onBrowse: () -> Unit) {
+ val c = clear
+ BackHandler(enabled = desk.fanOpen) { desk.fanOpen = false }
+ BackHandler(enabled = desk.recorder != null) { desk.finish(vm, keep = false) }
+ val scrim by animateFloatAsState(if (desk.fanOpen) 1f else 0f, GlassMotion.settle(), label = "fan scrim")
+ if (scrim > 0.01f) {
+ Box(
+ Modifier.fillMaxSize()
+ .graphicsLayer { alpha = scrim }
+ .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)
+
+ 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) }
+ }
+ } else {
+ Recording(rec, onCancel = { desk.finish(vm, keep = false) }, onStop = { desk.finish(vm, keep = true) })
+ }
+ }
+ }
+}
+
+/** The white + (it turns to an × while the fan is open). */
+@Composable
+private fun PlusButton(open: Boolean, onClick: () -> Unit) {
+ val turn by animateFloatAsState(if (open) 45f else 0f, GlassMotion.morph(), 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 }
+ .background(Color.White)
+ .semantics { contentDescription = label },
+ contentAlignment = Alignment.Center,
+ ) { PlusGlyph(Color(0xFF1C2433), Modifier.size(22.dp).graphicsLayer { rotationZ = turn }) }
+}
+
+/** A way to make something, in the fan. */
+private class FanItem(val icon: ImageVector, val label: String, val accent: Color, val go: () -> Unit)
+
+/** The fan: the ways to make something, rising from the + one after another. */
+@Composable
+private fun BoxScope.Fan(vm: AppViewModel, desk: DeskState, onBrowse: () -> Unit) {
+ val c = clear
+ fun go(f: () -> Unit): () -> Unit = {
+ desk.fanOpen = false
+ f()
+ }
+ val items = listOf(
+ FanItem(LucideIcons.SquarePen, stringResource(R.string.create_note), Candy.Sky, go { vm.newNote(NoteKind.Text) }),
+ FanItem(LucideIcons.ListChecks, stringResource(R.string.create_list), Candy.Mint, go { vm.newNote(NoteKind.List) }),
+ FanItem(ToolCatalog.Scan.icon, stringResource(ToolCatalog.Scan.label), Candy.Tomato, go { ToolCatalog.Scan.go(vm) }),
+ FanItem(LucideIcons.FolderOpen, stringResource(R.string.home_open_file), Candy.Grape, go(onBrowse)),
+ FanItem(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) }),
+ )
+ 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)
+ }
+ }
+ }
+}
+
+/** The capsule as a recorder: cancel, a pulsing dot with the time, the live waveform, stop. */
+@Composable
+private 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")
+ 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)
+ }
+ 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)
+ 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),
+ 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. */
+@Composable
+private fun LiveWave(levels: List<Float>, modifier: Modifier) {
+ Canvas(modifier) {
+ val n = 22
+ val gap = 3.dp.toPx()
+ val w = (size.width - gap * (n - 1)) / n
+ val recent = levels.takeLast(n)
+ val peak = (recent.maxOrNull() ?: 0f).coerceAtLeast(0.08f)
+ for (i in 0 until n) {
+ val v = recent.getOrNull(recent.size - n + i) ?: 0f
+ val h = (size.height * (0.12f + 0.88f * (v / peak))).coerceAtLeast(w)
+ drawRoundRect(Color.White, Offset(i * (w + gap), (size.height - h) / 2f), Size(w, h), CornerRadius(w / 2f))
+ }
+ }
+}
diff --git a/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/ui/home/HomeScreen.kt b/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/ui/home/HomeScreen.kt
new file mode 100644
index 0000000..7503a89
--- /dev/null
+++ b/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/ui/home/HomeScreen.kt
@@ -0,0 +1,372 @@
+package com.chethan616.clearpdf.ui.home
+
+import androidx.annotation.StringRes
+import androidx.compose.animation.AnimatedContent
+import androidx.compose.animation.animateColorAsState
+import androidx.compose.animation.core.Animatable
+import androidx.compose.animation.core.animateFloatAsState
+import androidx.compose.animation.fadeIn
+import androidx.compose.animation.fadeOut
+import androidx.compose.animation.slideInVertically
+import androidx.compose.animation.slideOutVertically
+import androidx.compose.animation.togetherWith
+import androidx.compose.foundation.Image
+import androidx.compose.foundation.background
+import androidx.compose.foundation.border
+import androidx.compose.foundation.layout.Arrangement
+import androidx.compose.foundation.layout.Box
+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.padding
+import androidx.compose.foundation.layout.size
+import androidx.compose.foundation.layout.statusBars
+import androidx.compose.foundation.layout.width
+import androidx.compose.foundation.layout.windowInsetsTopHeight
+import androidx.compose.foundation.lazy.LazyRow
+import androidx.compose.foundation.lazy.items
+import androidx.compose.foundation.lazy.staggeredgrid.LazyVerticalStaggeredGrid
+import androidx.compose.foundation.lazy.staggeredgrid.StaggeredGridCells
+import androidx.compose.foundation.lazy.staggeredgrid.StaggeredGridItemSpan
+import androidx.compose.foundation.lazy.staggeredgrid.itemsIndexed
+import androidx.compose.foundation.lazy.staggeredgrid.rememberLazyStaggeredGridState
+import androidx.compose.foundation.text.BasicText
+import androidx.compose.foundation.text.TextAutoSize
+import androidx.compose.material3.Icon
+import androidx.compose.material3.Text
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.CompositionLocalProvider
+import androidx.compose.runtime.DisposableEffect
+import androidx.compose.runtime.LaunchedEffect
+import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.remember
+import androidx.compose.runtime.rememberCoroutineScope
+import androidx.compose.runtime.saveable.rememberSaveable
+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.Color
+import androidx.compose.ui.graphics.ColorFilter
+import androidx.compose.ui.graphics.graphicsLayer
+import androidx.compose.ui.layout.boundsInWindow
+import androidx.compose.ui.layout.onGloballyPositioned
+import androidx.compose.ui.res.painterResource
+import androidx.compose.ui.res.stringResource
+import androidx.compose.ui.text.style.TextAlign
+import androidx.compose.ui.unit.dp
+import androidx.compose.ui.unit.sp
+import com.chethan616.clearpdf.R
+import com.chethan616.clearpdf.notes.Note
+import com.chethan616.clearpdf.notes.NoteKind
+import com.chethan616.clearpdf.ui.AppViewModel
+import com.chethan616.clearpdf.ui.LucideIcons
+import com.chethan616.clearpdf.ui.glass.GlassCircle
+import com.chethan616.clearpdf.ui.glass.GlassMenu
+import com.chethan616.clearpdf.ui.glass.GlassMenuItem
+import com.chethan616.clearpdf.ui.glass.GlassMotion
+import com.chethan616.clearpdf.ui.glass.GlassPill
+import com.chethan616.clearpdf.ui.glass.GlassRow
+import com.chethan616.clearpdf.ui.glass.GlassSheet
+import com.chethan616.clearpdf.ui.glass.pressable
+import com.chethan616.clearpdf.ui.mascot.Mascot
+import com.chethan616.clearpdf.ui.mascot.MascotMood
+import com.chethan616.clearpdf.ui.theme.Candy
+import com.chethan616.clearpdf.ui.theme.ClearType
+import com.chethan616.clearpdf.ui.theme.Tone
+import com.chethan616.clearpdf.ui.theme.clear
+import com.chethan616.clearpdf.ui.theme.glowing
+import com.chethan616.clearpdf.ui.viewer.VoicePlayer
+import com.kyant.shapes.Capsule
+import kotlinx.coroutines.launch
+
+/** What the desk shows: everything, or one kind. */
+enum class DeskFilter(@StringRes val chip: Int, @StringRes val title: Int) {
+ All(R.string.desk_filter_all, R.string.desk_title_all),
+ Notes(R.string.desk_filter_notes, R.string.desk_title_notes),
+ Todo(R.string.desk_filter_todo, R.string.desk_title_todo),
+ Pdfs(R.string.desk_filter_pdfs, R.string.desk_title_pdfs),
+ Images(R.string.desk_filter_images, R.string.desk_title_images),
+ Audio(R.string.desk_filter_audio, R.string.desk_title_audio),
+}
+
+/** One card on the desk. */
+sealed interface DeskItem {
+ val key: String
+
+ data class Of(val note: Note) : DeskItem {
+ override val key get() = "n-" + note.id
+ }
+
+ data class Picture(val note: Note) : DeskItem {
+ override val key get() = "p-" + note.id
+ }
+
+ data object Files : DeskItem {
+ override val key get() = "files"
+ }
+
+ data class Pdfs(val count: Int) : DeskItem {
+ override val key get() = "pdfs"
+ }
+
+ data class Recent(val rows: List<FileRow>) : DeskItem {
+ override val key get() = "recent"
+ }
+
+ data class Doc(val row: FileRow) : DeskItem {
+ override val key get() = "d-" + row.key
+ }
+}
+
+/** 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 })
+ 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
+ }
+ DeskFilter.Notes -> sorted.filter { it.kind == NoteKind.Text }.map { DeskItem.Of(it) }
+ 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) }
+ DeskFilter.Pdfs -> if (recents.isEmpty()) emptyList() else listOf(DeskItem.Files, DeskItem.Pdfs(recents.size)) + recents.map { DeskItem.Doc(it) }
+ }
+}
+
+/** How much room the floating create capsule takes at the bottom. */
+val DeskDockClearance = 128.dp
+
+/**
+ * The desk (the home screen): the Artefact mark and a menu, a big title that changes with the
+ * chosen chip, the chips, then every note, list, voice memo and document as a bento of pastel
+ * cards. The create capsule floats over it (see [CreateDock]).
+ */
+@Composable
+fun HomeScreen(vm: AppViewModel, desk: DeskState) {
+ var filter by rememberSaveable { mutableStateOf(DeskFilter.All) }
+ val scope = rememberCoroutineScope()
+ val player = remember { VoicePlayer(scope) }
+ var playing by remember { mutableStateOf<String?>(null) }
+ DisposableEffect(Unit) { onDispose { player.release() } }
+ var actionsFor by remember { mutableStateOf<Note?>(null) }
+ val notes = vm.notes.all
+ val recents = vm.recentRows()
+ val items = remember(filter, notes, vm.recentList) { deskItems(filter, notes, recents) }
+ val grid = rememberLazyStaggeredGridState()
+ LaunchedEffect(filter) { grid.animateScrollToItem(0) }
+
+ fun play(n: Note) {
+ val f = n.audio?.let(vm.notes::file) ?: return
+ if (playing == n.id) {
+ player.toggle()
+ } else if (player.load(f)) {
+ playing = n.id
+ player.toggle()
+ }
+ }
+
+ CompositionLocalProvider(LocalHomeVm provides vm) {
+ LazyVerticalStaggeredGrid(
+ columns = StaggeredGridCells.Fixed(2),
+ state = grid,
+ modifier = Modifier.fillMaxSize(),
+ contentPadding = PaddingValues(start = 16.dp, end = 16.dp, bottom = DeskDockClearance + 40.dp),
+ verticalItemSpacing = 12.dp,
+ horizontalArrangement = Arrangement.spacedBy(12.dp),
+ ) {
+ item(key = "top", span = StaggeredGridItemSpan.FullLine) {
+ Column {
+ Spacer(Modifier.windowInsetsTopHeight(WindowInsets.statusBars))
+ DeskHeader(vm)
+ }
+ }
+ item(key = "title", span = StaggeredGridItemSpan.FullLine) { DeskTitle(filter) }
+ item(key = "chips", span = StaggeredGridItemSpan.FullLine) {
+ FilterChips(filter) { filter = it }
+ }
+ itemsIndexed(items, key = { _, it -> it.key }) { i, item ->
+ val m = Modifier.fillMaxWidth().riseIn(i)
+ 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,
+ { play(item.note) }, { actionsFor = item.note }, m,
+ )
+ NoteKind.Text -> NoteCard(item.note, { vm.openNote = item.note.id }, { actionsFor = item.note }, m)
+ }
+ is DeskItem.Picture -> {
+ val n = item.note
+ StackCard(
+ n.title.ifBlank { stringResource(R.string.desk_filter_images) }, shortDate(n.updated),
+ listOf(clear.tone(Tone.Blush), clear.tone(Tone.Peach)), { vm.openNote = n.id }, m, onLong = { actionsFor = n },
+ chips = {
+ if (n.images.size > 1) PhotoChip("+${n.images.size - 1}", modifier = Modifier.align(Alignment.BottomEnd).padding(12.dp))
+ },
+ ) { NoteImage(n.images.first(), Modifier.matchParentSize(), maxPx = 900) }
+ }
+ 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 -> {
+ val top = item.rows.first()
+ StackCard(
+ stringResource(R.string.desk_recent), whenLabel(top.date), listOf(clear.tone(Tone.Blush), clear.tone(Tone.Sky)), top.open, m,
+ onLong = { vm.fileSheet = top to true },
+ chips = {
+ Row(Modifier.align(Alignment.BottomStart).padding(12.dp), horizontalArrangement = Arrangement.spacedBy(8.dp)) {
+ if (item.rows.size > 1) PhotoChip("+${item.rows.size - 1}") { vm.homeTab = HomeTab.Files }
+ PhotoChip(stringResource(R.string.desk_chip_pdfs), LucideIcons.FileText) { vm.homeTab = HomeTab.Files }
+ }
+ },
+ ) { PageFill(vm, top.thumbPath) }
+ }
+ is DeskItem.Doc -> DocCard(
+ vm, item.row, clear.tone(listOf(Tone.Sky, Tone.Peach, Tone.Sage, Tone.Butter)[i % 4]), listOf(-3f, 4f, -2f, 3f)[i % 4],
+ { vm.fileSheet = item.row to true }, m,
+ )
+ }
+ }
+ if (items.isEmpty()) {
+ item(key = "empty-$filter", span = StaggeredGridItemSpan.FullLine) { DeskEmpty(vm, filter, desk) }
+ }
+ }
+ }
+
+ actionsFor?.let { n -> NoteActions(vm, n) { actionsFor = null } }
+}
+
+/** The mark on the left (it spins when tapped), the four-dot menu on the right. */
+@Composable
+private fun DeskHeader(vm: AppViewModel) {
+ val c = clear
+ val spin = remember { Animatable(0f) }
+ val scope = rememberCoroutineScope()
+ var menu 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),
+ )
+ 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),
+ label = stringResource(R.string.common_more_options),
+ ) { FourDots(c.hero) }
+ }
+ if (menu) {
+ GlassMenu(
+ anchor, { menu = false },
+ 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 },
+ ),
+ )
+ }
+}
+
+/** The big white title; a new chip slides a new one up in its place. */
+@Composable
+private 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(),
+ )
+ }
+}
+
+/** The chips: glass capsules with a white rim; the chosen one is filled lemon. */
+@Composable
+private 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),
+ horizontalArrangement = Arrangement.spacedBy(10.dp),
+ ) {
+ items(DeskFilter.entries, key = { it.name }) { f -> DeskChip(stringResource(f.chip), f == selected) { onSelect(f) } }
+ }
+}
+
+@Composable
+fun 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,
+ ) {
+ Text(label, style = ClearType.Body.copy(fontSize = 16.sp), color = if (chosen) Color(0xFF1C2433) else if (c.dark) c.ink else Color(0xFF1C2433))
+ }
+}
+
+/** Nothing of this kind yet: a mascot, a line, and the way to make one. */
+@Composable
+private fun DeskEmpty(vm: AppViewModel, filter: DeskFilter, desk: DeskState) {
+ val c = clear
+ data class E(val bot: String, val mood: MascotMood, @StringRes val title: Int, @StringRes val body: Int, @StringRes val action: Int, val go: () -> Unit)
+ val e = when (filter) {
+ DeskFilter.Notes -> E("flower", MascotMood.NeedsYou, R.string.empty_notes_title, R.string.empty_notes_body, R.string.create_note) { vm.newNote(NoteKind.Text) }
+ DeskFilter.Todo -> E("clover", MascotMood.Idle, R.string.empty_lists_title, R.string.empty_lists_body, R.string.create_list) { vm.newNote(NoteKind.List) }
+ DeskFilter.Pdfs -> E("ghost", MascotMood.Thinking, R.string.empty_pdfs_title, R.string.empty_pdfs_body, R.string.home_open_file) { vm.pickFiles(com.chethan616.clearpdf.ui.FilePickKind.Open) }
+ DeskFilter.Images -> E("cloud", MascotMood.Sleeping, R.string.empty_images_title, R.string.empty_images_body, R.string.create_photo_note) { vm.newNote(NoteKind.Text); vm.pickNotePhoto() }
+ DeskFilter.Audio -> E("pill", MascotMood.Happy, R.string.empty_audio_title, R.string.empty_audio_body, R.string.create_voice) { desk.startRecording(vm) }
+ DeskFilter.All -> E("star", MascotMood.NeedsYou, R.string.empty_notes_title, R.string.empty_notes_body, R.string.create_note) { vm.newNote(NoteKind.Text) }
+ }
+ Column(Modifier.fillMaxWidth().padding(horizontal = 24.dp, vertical = 30.dp), horizontalAlignment = Alignment.CenterHorizontally) {
+ Mascot(e.bot, e.mood, 110.dp)
+ Spacer(Modifier.height(18.dp))
+ Text(stringResource(e.title), style = ClearType.Headline.copy(color = c.hero).glowing(c), textAlign = TextAlign.Center)
+ Spacer(Modifier.height(6.dp))
+ Text(stringResource(e.body), style = ClearType.Body, color = if (c.dark) c.inkSoft else Color(0xFF1C2433).copy(alpha = 0.7f), textAlign = TextAlign.Center)
+ Spacer(Modifier.height(18.dp))
+ GlassPill(onClick = e.go, tint = Candy.Sky) { Text(stringResource(e.action), style = ClearType.BodyStrong, color = Color.White) }
+ }
+}
+
+/** A long press on a note: pin 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)) {
+ 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)
+ }
+}
+
diff --git a/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/ui/mascot/Mascot.kt b/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/ui/mascot/Mascot.kt
new file mode 100644
index 0000000..3a6157e
--- /dev/null
+++ b/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/ui/mascot/Mascot.kt
@@ -0,0 +1,390 @@
+package com.chethan616.clearpdf.ui.mascot
+
+import androidx.compose.animation.core.Animatable
+import androidx.compose.animation.core.FastOutSlowInEasing
+import androidx.compose.animation.core.LinearEasing
+import androidx.compose.animation.core.RepeatMode
+import androidx.compose.animation.core.Spring
+import androidx.compose.animation.core.animateFloat
+import androidx.compose.animation.core.animateFloatAsState
+import androidx.compose.animation.core.infiniteRepeatable
+import androidx.compose.animation.core.rememberInfiniteTransition
+import androidx.compose.animation.core.spring
+import androidx.compose.animation.core.tween
+import androidx.compose.foundation.Canvas
+import androidx.compose.foundation.gestures.detectTapGestures
+import androidx.compose.foundation.layout.size
+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.rememberCoroutineScope
+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.Brush
+import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.graphics.Path
+import androidx.compose.ui.graphics.drawscope.DrawScope
+import androidx.compose.ui.graphics.drawscope.Stroke
+import androidx.compose.ui.graphics.drawscope.rotate
+import androidx.compose.ui.graphics.drawscope.scale
+import androidx.compose.ui.graphics.drawscope.translate
+import androidx.compose.ui.graphics.lerp
+import androidx.compose.ui.graphics.vector.PathParser
+import androidx.compose.ui.input.pointer.pointerInput
+import androidx.compose.ui.semantics.contentDescription
+import androidx.compose.ui.semantics.semantics
+import androidx.compose.ui.unit.Dp
+import androidx.compose.ui.unit.dp
+import androidx.compose.runtime.staticCompositionLocalOf
+import kotlinx.coroutines.delay
+import kotlinx.coroutines.launch
+import kotlin.math.PI
+import kotlin.math.sin
+import kotlin.random.Random
+
+/**
+ * What a mascot is feeling:
+ *
+ * - Idle awake, blinking, glancing round, the odd happy hop
+ * - Thinking one eye squinting, a swirl in the eyes, a sideways "hmm", thought dots
+ * - Working focused lids, tongue out, hopping (a long job)
+ * - NeedsYou hopeful puppy eyes, a double eyebrow-raise, eager hops
+ * - Happy ^ ^ eyes, a big open smile, a jump, sparkles (done!)
+ * - Sad worried lids and brows, a frown, a tear, a little grey (something failed)
+ * - Sleeping eyes shut, slow breaths, a sleep bubble (nothing here yet)
+ *
+ * The face is MascotFace.kt.
+ */
+enum class MascotMood { Idle, Thinking, Working, NeedsYou, Happy, Sad, Sleeping }
+
+/** What a mascot does to the phone when it hops (the app plays a haptic). */
+val LocalMascotHop = staticCompositionLocalOf<() -> Unit> { {} }
+
+private val SPARKLE = Color(0xFFFFD24A)
+private val SPARKLE_COOL = Color(0xFF7FD8FF)
+private val SWEAT = Color(0xFF7CC4F5)
+
+/**
+ * A living bot: breathes, blinks, glances around, tilts its head toward where
+ * it's looking, and wears its mood — each with its own face (lids, brows,
+ * mouth, blush; BotFace.kt), its own way of moving, and for some a little
+ * accent (thought dots, sparkles, a sweat drop). It jumps when tapped. Drawn from the bot-avatars outlines with a soft
+ * lit-plastic shading — no bitmaps, crisp at any size.
+ */
+@Composable
+fun Mascot(
+ type: String,
+ mood: MascotMood,
+ size: Dp,
+ modifier: Modifier = Modifier,
+ interactive: Boolean = true,
+ label: String? = null,
+ color: Color? = null,
+ /**
+ * A still portrait: the mood's face and accent, drawn once — for lists,
+ * where a dozen breathing, blinking bots would each redraw every frame.
+ * A tap still makes it jump.
+ */
+ still: Boolean = false,
+ /** Changing this makes the bot hop (a reaction, e.g. to a key press); 0 does nothing. */
+ hopSignal: Int = 0,
+) {
+ 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() } }
+ // A sad bot loses a little colour.
+ val grey by animateFloatAsState(if (mood == MascotMood.Sad) 0.32f else 0f, tween(900), label = "grey")
+ val base = color ?: Color(shape.color)
+ val bodyColor = lerp(base, Color(0xFF8C9199), grey)
+ val ink = inkFor(base)
+ val hopFeedback = LocalMascotHop.current
+ val scope = rememberCoroutineScope()
+ val seed = remember(type) { Random(type.hashCode()) }
+
+ val hop = remember { Animatable(0f) } // units above rest (body is 100 tall)
+ val squash = remember { Animatable(1f) } // 1 = rest; <1 squashed, >1 stretched
+ val eyeOpen = remember { Animatable(1f) }
+ val lookX = remember { Animatable(0f) }
+ val lookY = remember { Animatable(0f) }
+ val spin = remember { Animatable(0f) } // a happy twirl, degrees
+ val accent = remember { Animatable(0f) } // the accent popping in, 0…1
+
+ val slow = mood == MascotMood.Sleeping || mood == MascotMood.Sad
+ // Both phases are read only while drawing (a running bot redraws; it never
+ // recomposes), and a still one has none at all.
+ val breathPhase = if (still) null else rememberInfiniteTransition(label = "breath").animateFloat(
+ initialValue = 0f,
+ targetValue = 1f,
+ animationSpec = infiniteRepeatable(tween(if (slow) 4200 else 3000, easing = LinearEasing), RepeatMode.Restart),
+ label = "breathPhase",
+ )
+ val beatPhase = if (still) null else rememberInfiniteTransition(label = "beat").animateFloat(
+ initialValue = 0f,
+ targetValue = 1f,
+ animationSpec = infiniteRepeatable(tween(1300, easing = LinearEasing), RepeatMode.Restart),
+ label = "beatPhase",
+ )
+ // The face's own clock: the eyebrow-raise, the thinking swirl, the twinkle.
+ val nudgePhase = if (still) null else rememberInfiniteTransition(label = "nudge").animateFloat(
+ initialValue = 0f,
+ targetValue = 1f,
+ animationSpec = infiniteRepeatable(tween(2600, easing = LinearEasing), RepeatMode.Restart),
+ label = "nudgePhase",
+ )
+
+ // The face eases from mood to mood: the lids, brows and mouth move, they don't swap.
+ val faceFrom = remember { mutableStateOf(faceFor(mood)) }
+ val faceTo = remember { mutableStateOf(faceFor(mood)) }
+ val faceMix = remember { Animatable(1f) }
+ LaunchedEffect(mood) {
+ val target = faceFor(mood)
+ if (target == faceTo.value) return@LaunchedEffect
+ faceFrom.value = lerpFace(faceFrom.value, faceTo.value, faceMix.value)
+ faceTo.value = target
+ if (still) faceMix.snapTo(1f) else {
+ faceMix.snapTo(0f)
+ faceMix.animateTo(1f, tween(380, easing = FastOutSlowInEasing))
+ }
+ }
+
+ suspend fun jump(height: Float) {
+ squash.animateTo(0.86f, tween(90, easing = FastOutSlowInEasing))
+ scope.launch { squash.animateTo(1.1f, tween(160)) }
+ hop.animateTo(height, tween(220, easing = FastOutSlowInEasing))
+ scope.launch { squash.animateTo(1f, tween(180)) }
+ hop.animateTo(0f, tween(240, easing = FastOutSlowInEasing))
+ squash.animateTo(0.9f, tween(70))
+ squash.animateTo(1f, spring(dampingRatio = Spring.DampingRatioMediumBouncy, stiffness = Spring.StiffnessMedium))
+ }
+
+ LaunchedEffect(hopSignal) {
+ if (hopSignal != 0) jump(14f)
+ }
+
+ if (still) {
+ // The mood's resting pose, set once.
+ LaunchedEffect(mood) {
+ accent.snapTo(1f)
+ eyeOpen.snapTo(if (mood == MascotMood.Sleeping) 0f else 1f)
+ val (x, y) = when (mood) {
+ MascotMood.Sleeping -> 0f to 2.5f
+ MascotMood.Sad -> -1f to 2.2f
+ MascotMood.NeedsYou, MascotMood.Happy -> 0f to -0.5f
+ MascotMood.Thinking -> 2.6f to -2.4f
+ else -> 0f to 0f
+ }
+ lookX.snapTo(x)
+ lookY.snapTo(y)
+ }
+ } else {
+ // The accent pops in on every change of mood.
+ LaunchedEffect(mood) {
+ accent.snapTo(0f)
+ accent.animateTo(1f, spring(dampingRatio = Spring.DampingRatioMediumBouncy, stiffness = Spring.StiffnessMediumLow))
+ }
+
+ // Blinking — never while asleep (lids are already shut). Thinking's squint
+ // is the face's own lid, not a half-open eye.
+ LaunchedEffect(mood) {
+ when (mood) {
+ MascotMood.Sleeping -> { eyeOpen.animateTo(0f, tween(400)); return@LaunchedEffect }
+ else -> eyeOpen.animateTo(1f, tween(250))
+ }
+ val open = eyeOpen.value
+ while (true) {
+ delay(2200L + seed.nextLong(3200))
+ eyeOpen.animateTo(0.08f, tween(70))
+ eyeOpen.animateTo(open, tween(120))
+ if (seed.nextInt(5) == 0) { // the odd double blink
+ delay(120)
+ eyeOpen.animateTo(0.08f, tween(60))
+ eyeOpen.animateTo(open, tween(110))
+ }
+ }
+ }
+
+ // Where it looks.
+ LaunchedEffect(mood) {
+ val soft = spring<Float>(dampingRatio = 0.7f, stiffness = Spring.StiffnessLow)
+ when (mood) {
+ MascotMood.Sleeping -> { launch { lookX.animateTo(0f) }; lookY.animateTo(2.5f) }
+ MascotMood.Sad -> { launch { lookX.animateTo(-1f, soft) }; lookY.animateTo(2.2f, soft) }
+ // Straight at you.
+ MascotMood.NeedsYou, MascotMood.Happy -> { launch { lookX.animateTo(0f, soft) }; lookY.animateTo(-0.5f, soft) }
+ // Up and to the side, drifting a little.
+ MascotMood.Thinking -> while (true) {
+ launch { lookX.animateTo(2.4f + seed.nextFloat() * 0.8f, soft) }
+ lookY.animateTo(-2.6f + seed.nextFloat() * 0.6f, soft)
+ delay(1800L + seed.nextLong(1400))
+ }
+ else -> while (true) {
+ delay(1400L + seed.nextLong(2600))
+ val x = (seed.nextFloat() * 2 - 1) * 3.2f
+ val y = (seed.nextFloat() * 2 - 1) * 1.8f
+ launch { lookX.animateTo(x, soft) }
+ lookY.animateTo(y, soft)
+ }
+ }
+ }
+
+ // How it moves.
+ LaunchedEffect(mood) {
+ when (mood) {
+ MascotMood.Working -> while (true) { jump(12f); delay(260) }
+ MascotMood.NeedsYou -> while (true) { jump(7f); jump(5f); delay(1500) }
+ MascotMood.Happy -> {
+ launch { spin.snapTo(0f); spin.animateTo(360f, tween(620, easing = FastOutSlowInEasing)); spin.snapTo(0f) }
+ jump(22f)
+ while (true) { delay(2600); jump(10f) }
+ }
+ MascotMood.Idle -> while (true) { delay(7000L + seed.nextLong(6000)); jump(9f) }
+ MascotMood.Thinking, MascotMood.Sad, MascotMood.Sleeping -> Unit
+ }
+ }
+ }
+
+ val large = size >= 36.dp
+ val showAccent = size >= 24.dp
+ val tapModifier = if (interactive) {
+ Modifier.pointerInput(type) {
+ detectTapGestures {
+ hopFeedback()
+ scope.launch { jump(18f) }
+ }
+ }
+ } else Modifier
+
+ Canvas(
+ modifier
+ .size(size)
+ .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
+ 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
+ // Thinking sways gently side to side.
+ val sway = if (mood == MascotMood.Thinking) 3.5f * sin(phase) else 0f
+ val lift = hop.value + bob
+
+ // Contact shadow: shrinks and fades as the bot rises.
+ val shadowW = 48f * unit * (1f - (hop.value / 40f).coerceIn(0f, 0.5f))
+ drawOval(
+ color = Color.Black.copy(alpha = 0.16f * (1f - (hop.value / 30f).coerceIn(0f, 0.6f))),
+ topLeft = Offset(50f * unit - shadowW / 2, 90f * unit),
+ size = Size(shadowW, 6f * unit),
+ )
+
+ translate(top = -lift * unit) {
+ val sx = (2f - squash.value) * breathe
+ val sy = squash.value * breathe
+ scale(scaleX = sx, scaleY = sy, pivot = Offset(50f * unit, 88f * unit)) {
+ rotate(degrees = lookX.value * 1.4f + sway + spin.value, pivot = Offset(50f * unit, 60f * unit)) {
+ scale(unit, unit, pivot = Offset.Zero) {
+ parts?.let { drawPath(it, lerp(bodyColor, Color.Black, 0.18f)) }
+ drawPath(body, bodyColor)
+ // Lit plastic: a soft key light from the upper left, a darker belly.
+ drawPath(
+ body,
+ Brush.radialGradient(
+ colors = listOf(Color.White.copy(alpha = 0.42f), Color.White.copy(alpha = 0f)),
+ center = Offset(34f + lookX.value, 26f),
+ radius = 52f,
+ ),
+ )
+ drawPath(
+ body,
+ Brush.verticalGradient(
+ colors = listOf(Color.Transparent, Color.Black.copy(alpha = 0.2f)),
+ startY = 48f,
+ endY = 96f,
+ ),
+ )
+ drawPath(body, Color.White.copy(alpha = 0.18f), style = Stroke(width = 0.9f))
+ drawFace(
+ 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,
+ )
+ }
+ }
+ }
+ if (showAccent) {
+ scale(unit, unit, pivot = Offset.Zero) {
+ drawAccent(mood, ink, phase, beat, accent.value)
+ }
+ }
+ }
+ }
+}
+
+private fun moodLabel(mood: MascotMood): String = when (mood) {
+ MascotMood.Idle -> "ready"
+ MascotMood.Thinking -> "thinking"
+ MascotMood.Working -> "working"
+ MascotMood.NeedsYou -> "needs you"
+ MascotMood.Happy -> "done"
+ MascotMood.Sad -> "hit a problem"
+ MascotMood.Sleeping -> "asleep"
+}
+
+/** The accent beside the head, in the 100-unit box: pops in with the mood. */
+internal fun DrawScope.drawAccent(mood: MascotMood, ink: Color, phase: Float, beat: Float, pop: Float) {
+ if (pop <= 0.01f) return
+ when (mood) {
+ MascotMood.Thinking -> scale(pop, pivot = Offset(80f, 16f)) {
+ // A little thought cloud with three dots taking turns.
+ drawCircle(Color.White.copy(alpha = 0.92f), radius = 3f, center = Offset(66f, 28f))
+ drawRoundRect(Color.White.copy(alpha = 0.95f), topLeft = Offset(69f, 6f), size = Size(24f, 13f), cornerRadius = CornerRadius(7f, 7f))
+ for (i in 0 until 3) {
+ val t = ((beat * 3f - i) % 3f + 3f) % 3f
+ val up = if (t < 1f) sin(t * PI.toFloat()) * 2.2f else 0f
+ drawCircle(Color(0xFF55595F).copy(alpha = 0.55f + up / 5f), radius = 2f, center = Offset(75f + i * 6f, 12.5f - up))
+ }
+ }
+ MascotMood.Happy -> {
+ val stars = listOf(Triple(Offset(84f, 12f), 7f, SPARKLE), Triple(Offset(14f, 22f), 5f, SPARKLE), Triple(Offset(72f, 2f), 4f, SPARKLE_COOL))
+ stars.forEachIndexed { i, (c, r, tone) ->
+ val t = (sin((beat + i * 0.33f) * 2f * PI.toFloat()) + 1f) / 2f
+ val s = pop * (0.45f + 0.7f * t)
+ rotate(45f * t, pivot = c) { drawSparkle(c, r * s, tone.copy(alpha = 0.55f + 0.45f * t)) }
+ }
+ }
+ MascotMood.Sad -> {
+ // A sweat drop sliding down the temple.
+ val t = (beat * 0.6f) % 1f
+ val y = 18f + 12f * t
+ val a = (if (t < 0.15f) t / 0.15f else if (t > 0.8f) (1f - t) / 0.2f else 1f) * pop
+ val drop = Path().apply {
+ moveTo(86f, y - 6f)
+ cubicTo(90f, y - 1f, 91f, y + 2f, 86f, y + 4f)
+ cubicTo(81f, y + 2f, 82f, y - 1f, 86f, y - 6f)
+ close()
+ }
+ drawPath(drop, SWEAT.copy(alpha = a))
+ drawCircle(Color.White.copy(alpha = 0.7f * a), radius = 1f, center = Offset(84.6f, y))
+ }
+ else -> Unit
+ }
+}
+
+private fun DrawScope.drawSparkle(c: Offset, r: Float, color: Color) {
+ val path = Path().apply {
+ moveTo(c.x, c.y - r)
+ quadraticTo(c.x + r * 0.18f, c.y - r * 0.18f, c.x + r, c.y)
+ quadraticTo(c.x + r * 0.18f, c.y + r * 0.18f, c.x, c.y + r)
+ quadraticTo(c.x - r * 0.18f, c.y + r * 0.18f, c.x - r, c.y)
+ quadraticTo(c.x - r * 0.18f, c.y - r * 0.18f, c.x, c.y - r)
+ close()
+ }
+ drawPath(path, color)
+}
+
diff --git a/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/ui/mascot/MascotFace.kt b/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/ui/mascot/MascotFace.kt
new file mode 100644
index 0000000..ab681d1
--- /dev/null
+++ b/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/ui/mascot/MascotFace.kt
@@ -0,0 +1,384 @@
+package com.chethan616.clearpdf.ui.mascot
+
+import androidx.compose.ui.geometry.Offset
+import androidx.compose.ui.geometry.Rect
+import androidx.compose.ui.geometry.Size
+import androidx.compose.ui.graphics.Brush
+import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.graphics.Path
+import androidx.compose.ui.graphics.StrokeCap
+import androidx.compose.ui.graphics.drawscope.DrawScope
+import androidx.compose.ui.graphics.drawscope.Stroke
+import androidx.compose.ui.graphics.drawscope.clipPath
+import androidx.compose.ui.graphics.drawscope.rotate
+import androidx.compose.ui.graphics.drawscope.scale
+import androidx.compose.ui.graphics.drawscope.translate
+import androidx.compose.ui.graphics.luminance
+import kotlin.math.PI
+import kotlin.math.max
+import kotlin.math.min
+import kotlin.math.sin
+
+/*
+ * The bots' expressive face, in a 100-unit body box:
+ *
+ * eyes glossy ovals with two catchlights, shut by the blink
+ * lids a top and a bottom lid that cut the eye: smiling crescents,
+ * sleepy, focused (inner ends down), worried (inner ends up)
+ * brows short soft arcs that lift and tilt
+ * mouths smile, open grin, flat, frown, "o", tongue-out, cross-faded
+ * extras blush, a thinking swirl in the eyes, a tear, puppy-eye shine
+ * with a double eyebrow-raise (needs you), a sleep bubble that
+ * breathes (asleep)
+ *
+ * A mood is a set of numbers ([Face]); Mascot eases between them, so a
+ * change of mood reads as the face moving, not a swap. Needing you and
+ * sleeping are said by the face itself — no "!" badge, no z's.
+ */
+internal data class Face(
+ val lidTop: Float = 0f,
+ val lidBot: Float = 0f,
+ val lidTopR: Float = 0f,
+ /** > 0 lifts the lids' inner ends (worried), < 0 drops them (focused) */
+ val slant: Float = 0f,
+ val scale: Float = 1f,
+ /** ^ ^ arcs, and closed ‿ arcs */
+ val happy: Float = 0f,
+ val closed: Float = 0f,
+ val swirl: Float = 0f,
+ val brow: Float = 0f,
+ val browLift: Float = 0f,
+ val browLiftL: Float = 0f,
+ /** > 0 worried (inner ends up), < 0 focused */
+ val browTilt: Float = 0f,
+ val smile: Float = 1f,
+ val grin: Float = 0f,
+ val flat: Float = 0f,
+ val frown: Float = 0f,
+ val oh: Float = 0f,
+ val tongue: Float = 0f,
+ val mouthW: Float = 1f,
+ val mouthX: Float = 0f,
+ val mouthTilt: Float = 0f,
+ val blush: Float = 0.4f,
+ val tear: Float = 0f,
+ /** big twinkling catchlights (puppy eyes) */
+ val shine: Float = 0f,
+ /** a double eyebrow-raise every 2.6 s: "hey, over here" */
+ val browBounce: Float = 0f,
+ /** a sleep bubble at the mouth, breathing in and out */
+ val bubble: Float = 0f,
+)
+
+/** The face each mood wears. */
+internal fun faceFor(mood: MascotMood): Face = when (mood) {
+ // At rest: smiling eyes, a soft smile, a little blush.
+ MascotMood.Idle -> Face(lidBot = 0.2f, blush = 0.6f)
+ // Reasoning: one eye squinting, a swirl in the eyes, one brow up, a sideways "hmm".
+ MascotMood.Thinking -> Face(
+ lidTop = 0.04f, lidTopR = 0.32f, swirl = 1f, brow = 1f, browLiftL = 3.5f, browTilt = -0.12f,
+ smile = 0f, flat = 1f, mouthW = 0.8f, mouthX = 2.5f, mouthTilt = -0.18f,
+ )
+ // Working: lids down and angled in, focused brows, tongue out.
+ MascotMood.Working -> Face(lidTop = 0.3f, slant = -0.22f, brow = 0.95f, browTilt = -0.24f, browLift = -1f, smile = 0f, tongue = 1f, blush = 0.25f)
+ // Needs you: hopeful puppy eyes, brows gently pleading, a double eyebrow-raise now and then.
+ MascotMood.NeedsYou -> Face(scale = 1.12f, shine = 1f, brow = 0.9f, browLift = 2.4f, browTilt = 0.2f, browBounce = 1f, lidBot = 0.08f, mouthW = 0.72f, blush = 0.75f)
+ // Done: ^ ^ eyes, an open grin, full blush.
+ MascotMood.Happy -> Face(happy = 1f, smile = 0f, grin = 1f, blush = 0.9f)
+ // Failed: heavy worried lids, sad brows, a frown, a tear.
+ MascotMood.Sad -> Face(lidTop = 0.32f, slant = 0.36f, brow = 1f, browTilt = 0.38f, smile = 0f, frown = 1f, blush = 0.15f, tear = 1f)
+ // Asleep: eyes shut, a small "o", a sleep bubble.
+ MascotMood.Sleeping -> Face(closed = 1f, smile = 0f, oh = 0.75f, mouthW = 0.7f, blush = 0.3f, bubble = 1f)
+}
+
+private fun mix(a: Float, b: Float, t: Float) = a + (b - a) * t
+
+internal fun lerpFace(a: Face, b: Face, t: Float): Face = Face(
+ lidTop = mix(a.lidTop, b.lidTop, t), lidBot = mix(a.lidBot, b.lidBot, t), lidTopR = mix(a.lidTopR, b.lidTopR, t),
+ slant = mix(a.slant, b.slant, t), scale = mix(a.scale, b.scale, t),
+ happy = mix(a.happy, b.happy, t), closed = mix(a.closed, b.closed, t), swirl = mix(a.swirl, b.swirl, t),
+ brow = mix(a.brow, b.brow, t), browLift = mix(a.browLift, b.browLift, t), browLiftL = mix(a.browLiftL, b.browLiftL, t),
+ browTilt = mix(a.browTilt, b.browTilt, t),
+ smile = mix(a.smile, b.smile, t), grin = mix(a.grin, b.grin, t), flat = mix(a.flat, b.flat, t),
+ frown = mix(a.frown, b.frown, t), oh = mix(a.oh, b.oh, t), tongue = mix(a.tongue, b.tongue, t),
+ mouthW = mix(a.mouthW, b.mouthW, t), mouthX = mix(a.mouthX, b.mouthX, t), mouthTilt = mix(a.mouthTilt, b.mouthTilt, t),
+ blush = mix(a.blush, b.blush, t), tear = mix(a.tear, b.tear, t), shine = mix(a.shine, b.shine, t),
+ browBounce = mix(a.browBounce, b.browBounce, t), bubble = mix(a.bubble, b.bubble, t),
+)
+
+/**
+ * The face's ink: dark eyes with white catchlights on every bot (the look of
+ * the ghost, star, droid and cloud), light only on a near-black custom colour
+ * where dark eyes would vanish.
+ */
+internal fun inkFor(body: Color): Color = if (body.luminance() < 0.06f) Color(0xFFF8F8FA) else Color(0xFF15161A)
+
+private val BLUSH = Color(0xFFFF7096)
+private val TONGUE = Color(0xFFFF7D93)
+private val TEAR = Color(0xFF7CCBFF)
+private const val DEG = 180f / PI.toFloat()
+
+private fun c01(v: Float) = v.coerceIn(0f, 1f)
+
+/**
+ * The face, in the 100-unit body box.
+ *
+ * [breath] −1…1 (the breathing cycle, for the bubble), [nudge] 0…1 over
+ * 2.6 s (the eyebrow-raise, the swirl, the twinkle). [large] adds the mouth,
+ * brows and lid lines — below ~36 dp they'd be smudges.
+ */
+internal fun DrawScope.drawFace(
+ face: Face,
+ shape: BotShape,
+ ink: Color,
+ lookX: Float,
+ lookY: Float,
+ eyeOpen: Float,
+ large: Boolean,
+ breath: Float = 0f,
+ nudge: Float = 0.5f,
+) {
+ // The rig is drawn in face units ~1.7x the body's; S maps them.
+ val s = 0.58f * shape.faceScale
+ val cx = shape.faceX + lookX
+ val cy = shape.faceY - 3f + lookY
+ val darkInk = ink.luminance() < 0.5f
+ val hi = if (darkInk) Color.White else Color(0xFF1E1A33).copy(alpha = 0.55f)
+ val mouthFill = if (darkInk) Color(0xFF4A1A33) else ink
+
+ // "Hey, over here": two quick raises at the start of each 2.6 s cycle.
+ fun bump(p: Float) = if (p >= 0f && p < 0.077f) sin(PI.toFloat() * p / 0.077f) else 0f
+ val raise = face.browBounce * (bump(nudge) + bump(nudge - 0.123f))
+
+ // Blush, under everything.
+ if (face.blush > 0.02f) {
+ for (side in floatArrayOf(-1f, 1f)) {
+ val c = Offset(cx + side * 19f * s, cy + 9f * s)
+ drawOval(BLUSH.copy(alpha = 0.85f * c01(face.blush)), topLeft = Offset(c.x - 4.4f * s, c.y - 2.5f * s), size = Size(8.8f * s, 5f * s))
+ }
+ }
+
+ // Mouth.
+ val mouth = Offset(cx + face.mouthX * s, cy + 13.5f * s)
+ if (large) {
+ translate(mouth.x, mouth.y) {
+ rotate(face.mouthTilt * DEG, pivot = Offset.Zero) {
+ scale(s, s, pivot = Offset.Zero) { drawMouth(face, ink, mouthFill) }
+ }
+ }
+ }
+
+ // Sleep bubble: swells on the in-breath, shrinks on the out-breath.
+ if (face.bubble > 0.02f) {
+ val r = (2.4f + 5.6f * (0.5f + 0.5f * breath)) * s * c01(face.bubble)
+ val at = if (large) Offset(mouth.x + 3.4f * s + r * 0.75f, mouth.y + 1.1f * s - r * 0.2f)
+ else Offset(cx + 4.5f * s + r * 0.75f, cy + 10f * s)
+ val a = c01(face.bubble)
+ drawCircle(
+ Brush.radialGradient(
+ listOf(Color(0x40E1F5FF), Color(0x80A0D2FF)),
+ center = at + Offset(-r * 0.3f, -r * 0.3f),
+ radius = r * 1.2f,
+ ),
+ radius = r, center = at, alpha = a,
+ )
+ drawCircle(Color.White.copy(alpha = 0.85f * a), radius = r, center = at, style = Stroke(width = 0.9f * s))
+ drawOval(Color.White.copy(alpha = 0.9f * a), topLeft = at + Offset(-r * 0.62f, -r * 0.55f), size = Size(r * 0.5f, r * 0.32f))
+ }
+
+ // Eyes.
+ val arcUp = face.happy * (1f - face.closed)
+ val openA = c01(1f - max(arcUp, face.closed))
+ for (side in floatArrayOf(-1f, 1f)) {
+ val left = side < 0f
+ val k = face.scale * (1f + 0.07f * raise)
+ val rx = 6.3f * s * k
+ val ry = 8.6f * s * k
+ val c = Offset(cx + side * 12.5f * s, cy)
+ val lidTop = c01(face.lidTop + if (left) 0f else face.lidTopR)
+ val lidBot = c01(face.lidBot)
+ val lidT = lidTop + (1f - lidTop - lidBot) * (1f - c01(eyeOpen))
+ if (openA > 0.02f) drawEye(c, rx, ry, lidT, lidBot, face.slant, -side, ink, hi, face.swirl, face.shine, large, nudge, s, openA)
+ if (arcUp > 0.02f) drawArcEye(c, rx, ry, up = true, ink, s, arcUp)
+ if (face.closed > 0.02f) drawArcEye(c, rx, ry, up = false, ink, s, face.closed)
+
+ // Brow.
+ if (large && face.brow > 0.02f) {
+ val lift = face.browLift + (if (left) face.browLiftL else 0f) + 2.8f * raise
+ val b = Offset(c.x, c.y - ry - (3.6f + lift) * s)
+ rotate((if (left) -face.browTilt else face.browTilt) * DEG, pivot = b) {
+ val p = Path().apply {
+ moveTo(b.x - 4.6f * s, b.y + 1.1f * s)
+ quadraticTo(b.x, b.y - 1.8f * s, b.x + 4.6f * s, b.y + 1.1f * s)
+ }
+ drawPath(p, ink.copy(alpha = 0.62f * c01(face.brow)), style = Stroke(width = 2.5f * s, cap = StrokeCap.Round))
+ }
+ }
+ }
+
+ // A tear by the right eye, sliding down.
+ if (face.tear > 0.02f) {
+ val fall = (nudge * 2.6f / 1.6f % 1f) * 3f
+ val t = Offset(cx + 19f * s, cy + (6f + fall) * s)
+ val drop = Path().apply {
+ moveTo(t.x, t.y - 3.2f * s)
+ quadraticTo(t.x + 2.4f * s, t.y + 0.6f * s, t.x, t.y + 2.2f * s)
+ quadraticTo(t.x - 2.4f * s, t.y + 0.6f * s, t.x, t.y - 3.2f * s)
+ }
+ drawPath(drop, TEAR.copy(alpha = c01(face.tear) * (1f - fall / 4f)))
+ }
+}
+
+/** One eye: lids cut a glossy oval; collapses into a line when shut. */
+private fun DrawScope.drawEye(
+ c: Offset, rx: Float, ry: Float, lidT: Float, lidB: Float, slant: Float, inner: Float,
+ ink: Color, hi: Color, swirl: Float, shine: Float, detail: Boolean, nudge: Float, s: Float, alpha: Float,
+) {
+ val yT = -ry + 2f * ry * lidT
+ val yB = ry - 2f * ry * lidB
+ fun top(x: Float): Float {
+ val q = x / rx
+ return yT - slant * ry * 0.55f * q * inner - (if (lidT > 0.02f) 0.1f * ry * (1f - q * q) else 0f)
+ }
+ fun bot(x: Float): Float {
+ val q = x / rx
+ return yB - min(1f, lidB * 4f) * 0.5f * ry * (1f - min(1f, q * q))
+ }
+ if (yB - yT < ry * 0.14f) {
+ val m = (yT + yB) / 2f
+ val p = Path().apply {
+ moveTo(c.x - rx, c.y + m)
+ quadraticTo(c.x, c.y + m + ry * 0.3f, c.x + rx, c.y + m)
+ }
+ drawPath(p, ink.copy(alpha = alpha), style = Stroke(width = 3.4f * s, cap = StrokeCap.Round))
+ return
+ }
+ val eye = Path().apply { addOval(Rect(c.x - rx, c.y - ry, c.x + rx, c.y + ry)) }
+ val w = rx * 1.5f
+ val open = Path().apply {
+ for (i in 0..10) {
+ val x = -w + 2f * w * i / 10f
+ if (i == 0) moveTo(c.x + x, c.y + top(x)) else lineTo(c.x + x, c.y + top(x))
+ }
+ for (i in 10 downTo 0) {
+ val x = -w + 2f * w * i / 10f
+ lineTo(c.x + x, c.y + bot(x))
+ }
+ close()
+ }
+ clipPath(eye) {
+ clipPath(open) {
+ drawPath(eye, ink.copy(alpha = alpha))
+ drawPath(
+ eye,
+ Brush.radialGradient(
+ listOf(if (darkGloss(hi)) Color(0x735A6390) else Color(0x1F000000), Color.Transparent),
+ center = c + Offset(-rx * 0.35f, -ry * 0.45f),
+ radius = ry * 1.1f,
+ ),
+ alpha = alpha,
+ )
+ drawCircle(hi.copy(alpha = hi.alpha * alpha), radius = max(1.6f * s, rx * 0.36f) * (1f + 0.45f * shine), center = c + Offset(-rx * 0.3f, -ry * 0.36f))
+ if (detail || shine > 0.3f) {
+ drawCircle(hi.copy(alpha = hi.alpha * alpha * 0.85f), radius = rx * 0.17f * (1f + 0.7f * shine), center = c + Offset(rx * 0.32f, ry * 0.36f))
+ }
+ // Puppy-eye twinkle: a small four-point star that pulses.
+ if (shine > 0.05f) {
+ val k = rx * 0.24f * shine * (0.75f + 0.25f * sin(nudge * 6f * PI.toFloat()))
+ val t = c + Offset(rx * 0.16f, -ry * 0.6f)
+ val star = Path().apply {
+ moveTo(t.x, t.y - k)
+ quadraticTo(t.x, t.y, t.x + k, t.y)
+ quadraticTo(t.x, t.y, t.x, t.y + k)
+ quadraticTo(t.x, t.y, t.x - k, t.y)
+ quadraticTo(t.x, t.y, t.x, t.y - k)
+ close()
+ }
+ drawPath(star, hi.copy(alpha = hi.alpha * alpha))
+ }
+ if (swirl > 0.02f && detail) {
+ rotate(-nudge * 720f, pivot = c) {
+ val r = rx * 0.5f
+ drawArc(
+ hi.copy(alpha = hi.alpha * alpha * swirl), startAngle = 0f, sweepAngle = 261f, useCenter = false,
+ topLeft = Offset(c.x - r, c.y + ry * 0.12f - r), size = Size(2 * r, 2 * r),
+ style = Stroke(width = 1.4f * s, cap = StrokeCap.Round),
+ )
+ }
+ }
+ }
+ }
+ // Lid lines where a lid crosses the eye.
+ if (detail && (lidT > 0.05f || lidB > 0.05f)) {
+ val rim = Path().apply { addOval(Rect(c.x - rx * 1.12f, c.y - ry * 1.06f, c.x + rx * 1.12f, c.y + ry * 1.06f)) }
+ clipPath(rim) {
+ fun edge(fn: (Float) -> Float, width: Float, a: Float) {
+ val p = Path().apply {
+ for (i in 0..10) {
+ val x = -rx * 1.1f + 2.2f * rx * i / 10f
+ if (i == 0) moveTo(c.x + x, c.y + fn(x)) else lineTo(c.x + x, c.y + fn(x))
+ }
+ }
+ drawPath(p, ink.copy(alpha = alpha * a), style = Stroke(width = width * s, cap = StrokeCap.Round))
+ }
+ if (lidT > 0.05f) edge(::top, 2f, 1f)
+ if (lidB > 0.05f) edge(::bot, 1.4f, 0.55f)
+ }
+ }
+}
+
+private fun darkGloss(hi: Color) = hi == Color.White
+
+/** Arc eyes: ^ (happy) or ‿ (asleep). */
+private fun DrawScope.drawArcEye(c: Offset, rx: Float, ry: Float, up: Boolean, ink: Color, s: Float, alpha: Float) {
+ val p = Path().apply {
+ if (up) {
+ moveTo(c.x - rx * 0.95f, c.y + ry * 0.25f)
+ quadraticTo(c.x, c.y - ry * 1.05f, c.x + rx * 0.95f, c.y + ry * 0.25f)
+ } else {
+ moveTo(c.x - rx, c.y - ry * 0.05f)
+ quadraticTo(c.x, c.y + ry * 0.6f, c.x + rx, c.y - ry * 0.05f)
+ }
+ }
+ drawPath(p, ink.copy(alpha = alpha), style = Stroke(width = 4.2f * s, cap = StrokeCap.Round))
+}
+
+/** The mouths, in face units round the mouth's centre, cross-faded by weight. */
+private fun DrawScope.drawMouth(f: Face, ink: Color, mouthFill: Color) {
+ val w = f.mouthW
+ val line = Stroke(width = 3.2f, cap = StrokeCap.Round)
+ if (f.smile > 0.02f) {
+ val p = Path().apply { moveTo(-5f * w, -1f); quadraticTo(0f, 4.6f, 5f * w, -1f) }
+ drawPath(p, ink.copy(alpha = c01(f.smile)), style = line)
+ }
+ if (f.grin > 0.02f) {
+ val a = c01(f.grin)
+ val p = Path().apply {
+ moveTo(-6.2f * w, -1.8f)
+ lineTo(6.2f * w, -1.8f)
+ quadraticTo(0f, 10.5f, -6.2f * w, -1.8f)
+ close()
+ }
+ drawPath(p, mouthFill.copy(alpha = a))
+ clipPath(p) {
+ drawOval(TONGUE.copy(alpha = a), topLeft = Offset(-3.8f * w, 2.8f), size = Size(7.6f * w, 5.2f))
+ }
+ drawPath(p, ink.copy(alpha = a), style = Stroke(width = 1.6f))
+ }
+ if (f.flat > 0.02f) {
+ drawLine(ink.copy(alpha = c01(f.flat)), Offset(-3.8f * w, 0.4f), Offset(3.8f * w, 0.4f), strokeWidth = 3.2f, cap = StrokeCap.Round)
+ }
+ if (f.frown > 0.02f) {
+ val p = Path().apply { moveTo(-4.6f * w, 2.4f); quadraticTo(0f, -2.8f, 4.6f * w, 2.4f) }
+ drawPath(p, ink.copy(alpha = c01(f.frown)), style = line)
+ }
+ if (f.oh > 0.02f) {
+ drawOval(mouthFill.copy(alpha = c01(f.oh)), topLeft = Offset(-2.6f * w, -2f), size = Size(5.2f * w, 6.4f))
+ }
+ if (f.tongue > 0.02f) {
+ val a = c01(f.tongue)
+ drawOval(TONGUE.copy(alpha = a), topLeft = Offset(0.5f, -0.1f), size = Size(3.8f, 4.6f))
+ drawLine(ink.copy(alpha = a), Offset(-3.6f, 0.3f), Offset(3f, 0.3f), strokeWidth = 3f, cap = StrokeCap.Round)
+ }
+}
+
diff --git a/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/ui/mascot/MascotShapes.kt b/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/ui/mascot/MascotShapes.kt
new file mode 100644
index 0000000..c838bda
--- /dev/null
+++ b/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/ui/mascot/MascotShapes.kt
@@ -0,0 +1,164 @@
+/*
+ * Bot avatar body outlines, colours and face placement — generated from the
+ * bot-avatars package (Libraries.dev, MIT, (c) Jakub Antalik). Paths are SVG, 100-unit box.
+ */
+package com.chethan616.clearpdf.ui.mascot
+
+internal data class BotShape(
+ val path: String,
+ val parts: String?,
+ val color: Long,
+ val faceX: Float,
+ val faceY: Float,
+ val faceScale: Float,
+)
+
+internal val BOT_SHAPES: Map<String, BotShape> = mapOf(
+ "clover" to BotShape(
+ path = "M26.53 22.38A25 25 0 0 1 73.47 22.38A7 7 0 0 0 77.62 26.53A25 25 0 0 1 77.62 73.47A7 7 0 0 0 73.47 77.62A25 25 0 0 1 26.53 77.62A7 7 0 0 0 22.38 73.47A25 25 0 0 1 22.38 26.53A7 7 0 0 0 26.53 22.38Z",
+ parts = null,
+ color = 0xFF35B8FF,
+ faceX = 50f,
+ faceY = 50f,
+ faceScale = 1f,
+ ),
+ "flower" to BotShape(
+ path = "M31.2 19.82A20.5 20.5 0 0 1 68.8 19.82A5 5 0 0 0 72.9 22.8A20.5 20.5 0 0 1 84.51 58.55A5 5 0 0 0 82.95 63.37A20.5 20.5 0 0 1 52.54 85.47A5 5 0 0 0 47.46 85.47A20.5 20.5 0 0 1 17.05 63.37A5 5 0 0 0 15.49 58.55A20.5 20.5 0 0 1 27.1 22.8A5 5 0 0 0 31.2 19.82Z",
+ parts = null,
+ color = 0xFF2FCB7A,
+ faceX = 50f,
+ faceY = 51f,
+ faceScale = 0.95f,
+ ),
+ "triangle" to BotShape(
+ path = "M38.75 27.43A13 13 0 0 1 61.25 27.43L82.7 64.49A13 13 0 0 1 71.45 84L28.55 84A13 13 0 0 1 17.3 64.49L38.75 27.43Z",
+ parts = null,
+ color = 0xFFDC48FF,
+ faceX = 50f,
+ faceY = 61f,
+ faceScale = 0.9f,
+ ),
+ "square" to BotShape(
+ path = "M93 50C93 53.66 92.96 58.23 92.88 60.97C92.8 63.71 92.67 64.81 92.51 66.44C92.35 68.08 92.15 69.44 91.9 70.77C91.66 72.1 91.37 73.3 91.04 74.44C90.72 75.58 90.35 76.63 89.94 77.63C89.53 78.63 89.07 79.55 88.58 80.43C88.08 81.31 87.54 82.13 86.96 82.9C86.37 83.67 85.75 84.39 85.07 85.07C84.39 85.75 83.67 86.37 82.9 86.96C82.13 87.54 81.31 88.08 80.43 88.58C79.55 89.07 78.63 89.53 77.63 89.94C76.63 90.35 75.58 90.72 74.44 91.04C73.3 91.37 72.1 91.66 70.77 91.9C69.44 92.15 68.08 92.35 66.44 92.51C64.81 92.67 63.71 92.8 60.97 92.88C58.23 92.96 53.66 93 50 93C46.34 93 41.77 92.96 39.03 92.88C36.29 92.8 35.19 92.67 33.56 92.51C31.92 92.35 30.56 92.15 29.23 91.9C27.9 91.66 26.7 91.37 25.56 91.04C24.42 90.72 23.37 90.35 22.37 89.94C21.37 89.53 20.45 89.07 19.57 88.58C18.69 88.08 17.87 87.54 17.1 86.96C16.33 86.37 15.61 85.75 14.93 85.07C14.25 84.39 13.63 83.67 13.04 82.9C12.46 82.13 11.92 81.31 11.42 80.43C10.93 79.55 10.47 78.63 10.06 77.63C9.65 76.63 9.28 75.58 8.96 74.44C8.63 73.3 8.34 72.1 8.1 70.77C7.85 69.44 7.65 68.08 7.49 66.44C7.33 64.81 7.2 63.71 7.12 60.97C7.04 58.23 7 53.66 7 50C7 46.34 7.04 41.77 7.12 39.03C7.2 36.29 7.33 35.19 7.49 33.56C7.65 31.92 7.85 30.56 8.1 29.23C8.34 27.9 8.63 26.7 8.96 25.56C9.28 24.42 9.65 23.37 10.06 22.37C10.47 21.37 10.93 20.45 11.42 19.57C11.92 18.69 12.46 17.87 13.04 17.1C13.63 16.33 14.25 15.61 14.93 14.93C15.61 14.25 16.33 13.63 17.1 13.04C17.87 12.46 18.69 11.92 19.57 11.42C20.45 10.93 21.37 10.47 22.37 10.06C23.37 9.65 24.42 9.28 25.56 8.96C26.7 8.63 27.9 8.34 29.23 8.1C30.56 7.85 31.92 7.65 33.56 7.49C35.19 7.33 36.29 7.2 39.03 7.12C41.77 7.04 46.34 7 50 7C53.66 7 58.23 7.04 60.97 7.12C63.71 7.2 64.81 7.33 66.44 7.49C68.08 7.65 69.44 7.85 70.77 8.1C72.1 8.34 73.3 8.63 74.44 8.96C75.58 9.28 76.63 9.65 77.63 10.06C78.63 10.47 79.55 10.93 80.43 11.42C81.31 11.92 82.13 12.46 82.9 13.04C83.67 13.63 84.39 14.25 85.07 14.93C85.75 15.61 86.37 16.33 86.96 17.1C87.54 17.87 88.08 18.69 88.58 19.57C89.07 20.45 89.53 21.37 89.94 22.37C90.35 23.37 90.72 24.42 91.04 25.56C91.37 26.7 91.66 27.9 91.9 29.23C92.15 30.56 92.35 31.92 92.51 33.56C92.67 35.19 92.8 36.29 92.88 39.03C92.96 41.77 93 46.34 93 50Z",
+ parts = null,
+ color = 0xFF35B8FF,
+ faceX = 50f,
+ faceY = 50f,
+ faceScale = 1f,
+ ),
+ "blob" to BotShape(
+ path = "M93.92 50C94.18 51.9 94.24 53.9 93.99 55.79C93.73 57.68 93.18 59.61 92.39 61.36C91.6 63.1 90.48 64.78 89.27 66.27C88.07 67.76 86.58 69.08 85.14 70.29C83.7 71.49 82.1 72.5 80.62 73.5C79.14 74.49 77.64 75.34 76.24 76.24C74.84 77.15 73.51 78 72.2 78.93C70.88 79.86 69.66 80.83 68.36 81.8C67.06 82.76 65.78 83.82 64.39 84.74C63 85.67 61.55 86.63 60.01 87.35C58.47 88.08 56.82 88.73 55.15 89.1C53.48 89.47 51.71 89.64 50 89.57C48.29 89.5 46.55 89.16 44.91 88.68C43.27 88.21 41.67 87.47 40.16 86.72C38.65 85.96 37.24 85.02 35.86 84.13C34.48 83.24 33.19 82.29 31.89 81.37C30.58 80.46 29.32 79.56 28.03 78.63C26.74 77.71 25.44 76.82 24.16 75.84C22.88 74.86 21.57 73.87 20.36 72.74C19.15 71.62 17.95 70.42 16.91 69.1C15.88 67.79 14.92 66.35 14.15 64.85C13.38 63.35 12.76 61.73 12.29 60.1C11.81 58.48 11.52 56.78 11.29 55.1C11.06 53.41 10.98 51.71 10.91 50C10.83 48.29 10.83 46.59 10.83 44.84C10.84 43.1 10.85 41.34 10.93 39.53C11.02 37.72 11.09 35.86 11.34 33.99C11.59 32.12 11.88 30.16 12.43 28.31C12.99 26.46 13.69 24.56 14.66 22.88C15.64 21.21 16.86 19.58 18.27 18.27C19.69 16.96 21.4 15.84 23.17 15.03C24.93 14.22 26.95 13.71 28.89 13.43C30.83 13.15 32.9 13.21 34.82 13.36C36.74 13.5 38.66 13.92 40.43 14.28C42.2 14.65 43.87 15.16 45.46 15.54C47.06 15.93 48.52 16.31 50 16.58C51.48 16.85 52.87 17.02 54.32 17.17C55.77 17.32 57.22 17.36 58.71 17.49C60.2 17.62 61.74 17.7 63.28 17.95C64.81 18.19 66.39 18.5 67.91 18.98C69.43 19.46 70.95 20.08 72.38 20.83C73.81 21.58 75.19 22.5 76.5 23.5C77.81 24.5 79.03 25.63 80.22 26.81C81.41 27.99 82.54 29.25 83.65 30.57C84.76 31.89 85.85 33.26 86.89 34.72C87.93 36.18 88.98 37.69 89.9 39.31C90.82 40.92 91.73 42.64 92.4 44.42C93.07 46.2 93.66 48.1 93.92 50Z",
+ parts = null,
+ color = 0xFF2FCB7A,
+ faceX = 49.5f,
+ faceY = 50f,
+ faceScale = 1f,
+ ),
+ "ghost" to BotShape(
+ path = "M17 50C17 31.78 31.78 17 50 17C68.22 17 83 31.78 83 50V81.5Q72 93.5 61 81.5Q50 93.5 39 81.5Q28 93.5 17 81.5Z",
+ parts = null,
+ color = 0xFFF4F2FA,
+ faceX = 50f,
+ faceY = 48f,
+ faceScale = 0.95f,
+ ),
+ "circle" to BotShape(
+ path = "M50 8A42 42 0 1 1 50 92A42 42 0 1 1 50 8Z",
+ parts = null,
+ color = 0xFF9A62FF,
+ faceX = 50f,
+ faceY = 50f,
+ faceScale = 1f,
+ ),
+ "drop" to BotShape(
+ path = "M50 8.5C52.2 8.5 53.4 10.3 56.4 15.2C62.9 25.5 84 44.6 84 61.5C84 80.3 68.8 92 50 92C31.2 92 16 80.3 16 61.5C16 44.6 37.1 25.5 43.6 15.2C46.6 10.3 47.8 8.5 50 8.5Z",
+ parts = null,
+ color = 0xFF1ED3C6,
+ faceX = 50f,
+ faceY = 62f,
+ faceScale = 0.9f,
+ ),
+ "star" to BotShape(
+ path = "M45.77 9.7A5 5 0 0 1 54.23 9.7L65.02 26.81A4 4 0 0 0 67.42 28.55L87.02 33.53A5 5 0 0 1 89.63 41.57L76.7 57.12A4 4 0 0 0 75.78 59.94L77.11 80.12A5 5 0 0 1 70.26 85.09L51.48 77.59A4 4 0 0 0 48.52 77.59L29.74 85.09A5 5 0 0 1 22.89 80.12L24.22 59.94A4 4 0 0 0 23.3 57.12L10.37 41.57A5 5 0 0 1 12.98 33.53L32.58 28.55A4 4 0 0 0 34.98 26.81L45.77 9.7Z",
+ parts = null,
+ color = 0xFFFFD32B,
+ faceX = 50f,
+ faceY = 52f,
+ faceScale = 0.82f,
+ ),
+ "droid" to BotShape(
+ path = "M16 50C16 38.95 24.95 30 36 30H64C75.05 30 84 38.95 84 50V70C84 81.05 75.05 90 64 90H36C24.95 90 16 81.05 16 70ZM4 62A7 7 0 1 1 18 62A7 7 0 1 1 4 62ZM82 62A7 7 0 1 1 96 62A7 7 0 1 1 82 62Z",
+ parts = "M47.5 14H52.5V32H47.5ZM43 11A7 7 0 1 1 57 11A7 7 0 1 1 43 11Z",
+ color = 0xFFD5DBEA,
+ faceX = 50f,
+ faceY = 60f,
+ faceScale = 0.95f,
+ ),
+ "mech" to BotShape(
+ path = "M10 48C10 38.06 18.06 30 28 30H72C81.94 30 90 38.06 90 48V70C90 79.94 81.94 88 72 88H28C18.06 88 10 79.94 10 70ZM3 54C3 51.79 4.79 50 7 50H11V72H7C4.79 72 3 70.21 3 68ZM89 50H93C95.21 50 97 51.79 97 54V68C97 70.21 95.21 72 93 72H89Z",
+ parts = "M19.5 32L24.5 32L17 13L12 13ZM75.5 32L80.5 32L88 13L83 13ZM10 11.5A4.5 4.5 0 1 1 19 11.5A4.5 4.5 0 1 1 10 11.5ZM81 11.5A4.5 4.5 0 1 1 90 11.5A4.5 4.5 0 1 1 81 11.5Z",
+ color = 0xFF95A6C4,
+ faceX = 50f,
+ faceY = 59f,
+ faceScale = 1f,
+ ),
+ "alien" to BotShape(
+ path = "M50 10C70 10 83 27 83 46C83 65 64 92 50 92C36 92 17 65 17 46C17 27 30 10 50 10Z",
+ parts = null,
+ color = 0xFF9BE85A,
+ faceX = 50f,
+ faceY = 45f,
+ faceScale = 1.05f,
+ ),
+ "hexagon" to BotShape(
+ path = "M91.4 45.5A9 9 0 0 1 91.4 54.5L74.6 83.61A9 9 0 0 1 66.8 88.11L33.2 88.11A9 9 0 0 1 25.4 83.61L8.6 54.5A9 9 0 0 1 8.6 45.5L25.4 16.39A9 9 0 0 1 33.2 11.89L66.8 11.89A9 9 0 0 1 74.6 16.39L91.4 45.5Z",
+ parts = null,
+ color = 0xFFFF2A2A,
+ faceX = 50f,
+ faceY = 50f,
+ faceScale = 0.95f,
+ ),
+ "cat" to BotShape(
+ path = "M50 20A36 36 0 1 1 50 92A36 36 0 1 1 50 20ZM24.72 44.64A4.5 4.5 0 0 1 17.35 40.67L20.21 16.66A4.5 4.5 0 0 1 26.86 13.26L42.3 21.83A4.5 4.5 0 0 1 43.02 29.21L24.72 44.64ZM82.65 40.67A4.5 4.5 0 0 1 75.28 44.64L56.98 29.21A4.5 4.5 0 0 1 57.7 21.83L73.14 13.26A4.5 4.5 0 0 1 79.79 16.66L82.65 40.67Z",
+ parts = null,
+ color = 0xFFFF8C42,
+ faceX = 50f,
+ faceY = 58f,
+ faceScale = 1f,
+ ),
+ "cloud" to BotShape(
+ path = "M19 44A25 25 0 1 1 69 44A25 25 0 1 1 19 44ZM47 50A21 21 0 1 1 89 50A21 21 0 1 1 47 50ZM7 68A17 17 0 1 1 41 68A17 17 0 1 1 7 68ZM32 73A18 18 0 1 1 68 73A18 18 0 1 1 32 73ZM60 70A16 16 0 1 1 92 70A16 16 0 1 1 60 70Z",
+ parts = null,
+ color = 0xFFCFE6FF,
+ faceX = 50f,
+ faceY = 58f,
+ faceScale = 0.95f,
+ ),
+ "pill" to BotShape(
+ path = "M28 28H72C84.15 28 94 37.85 94 50C94 62.15 84.15 72 72 72H28C15.85 72 6 62.15 6 50C6 37.85 15.85 28 28 28Z",
+ parts = null,
+ color = 0xFF7B77F0,
+ faceX = 50f,
+ faceY = 50f,
+ faceScale = 0.9f,
+ ),
+ "pebble" to BotShape(
+ path = "M94.6 50C94.71 51.92 94.56 53.93 94.17 55.82C93.79 57.7 93.13 59.6 92.28 61.33C91.44 63.06 90.32 64.72 89.1 66.19C87.87 67.67 86.41 69.01 84.92 70.16C83.42 71.31 81.75 72.29 80.11 73.1C78.47 73.92 76.73 74.55 75.06 75.06C73.39 75.58 71.7 75.91 70.1 76.2C68.5 76.48 66.93 76.62 65.45 76.76C63.96 76.9 62.55 76.94 61.2 77.03C59.84 77.11 58.57 77.16 57.31 77.26C56.05 77.36 54.86 77.48 53.64 77.63C52.42 77.79 51.24 77.98 50 78.18C48.76 78.39 47.52 78.64 46.2 78.85C44.89 79.06 43.53 79.3 42.11 79.46C40.69 79.61 39.2 79.75 37.67 79.77C36.14 79.78 34.54 79.74 32.95 79.54C31.35 79.33 29.7 79.03 28.1 78.55C26.49 78.07 24.86 77.45 23.33 76.67C21.8 75.88 20.29 74.94 18.92 73.85C17.54 72.77 16.23 71.51 15.08 70.16C13.94 68.8 12.9 67.29 12.04 65.72C11.17 64.16 10.45 62.46 9.91 60.74C9.36 59.03 8.98 57.22 8.76 55.43C8.55 53.64 8.5 51.8 8.6 50C8.71 48.2 8.98 46.39 9.38 44.65C9.79 42.91 10.35 41.19 11.02 39.56C11.7 37.92 12.52 36.34 13.43 34.85C14.34 33.37 15.39 31.96 16.5 30.66C17.61 29.36 18.84 28.15 20.11 27.07C21.39 25.98 22.76 25 24.15 24.15C25.54 23.3 27.01 22.56 28.48 21.95C29.94 21.33 31.46 20.85 32.95 20.46C34.44 20.08 35.95 19.83 37.43 19.66C38.91 19.48 40.38 19.43 41.81 19.43C43.24 19.43 44.64 19.53 46.01 19.66C47.37 19.78 48.7 19.98 50 20.18C51.3 20.39 52.57 20.63 53.83 20.87C55.1 21.11 56.34 21.37 57.6 21.62C58.87 21.87 60.13 22.12 61.43 22.39C62.74 22.66 64.07 22.93 65.45 23.24C66.83 23.56 68.25 23.88 69.72 24.3C71.19 24.72 72.71 25.17 74.25 25.75C75.78 26.34 77.37 27 78.91 27.81C80.46 28.63 82.04 29.56 83.5 30.66C84.97 31.75 86.43 33 87.7 34.38C88.98 35.77 90.19 37.32 91.17 38.97C92.14 40.62 92.98 42.43 93.56 44.27C94.13 46.1 94.5 48.08 94.6 50Z",
+ parts = null,
+ color = 0xFF2FCB7A,
+ faceX = 50f,
+ faceY = 50f,
+ faceScale = 0.95f,
+ ),
+ "puddle" to BotShape(
+ path = "M85.34 50C85.65 51.54 85.9 53.13 86.01 54.74C86.11 56.35 86.11 58 85.95 59.63C85.8 61.26 85.51 62.93 85.07 64.52C84.62 66.12 84.03 67.72 83.3 69.23C82.58 70.74 81.7 72.21 80.72 73.57C79.74 74.94 78.62 76.23 77.43 77.43C76.24 78.62 74.93 79.72 73.58 80.73C72.23 81.74 70.79 82.65 69.33 83.48C67.86 84.31 66.34 85.04 64.79 85.71C63.24 86.37 61.65 86.95 60.04 87.46C58.42 87.96 56.77 88.4 55.1 88.75C53.43 89.09 51.72 89.37 50 89.54C48.28 89.71 46.52 89.81 44.76 89.76C43.01 89.72 41.22 89.58 39.47 89.29C37.72 89 35.95 88.58 34.26 88C32.57 87.42 30.89 86.69 29.33 85.8C27.77 84.92 26.26 83.87 24.91 82.7C23.56 81.53 22.3 80.19 21.23 78.77C20.16 77.35 19.22 75.79 18.47 74.2C17.71 72.61 17.13 70.91 16.7 69.23C16.26 67.55 16.02 65.81 15.88 64.13C15.75 62.45 15.78 60.76 15.88 59.14C15.97 57.52 16.21 55.94 16.45 54.42C16.7 52.89 17.03 51.43 17.34 50C17.65 48.57 18 47.2 18.32 45.83C18.63 44.46 18.94 43.13 19.24 41.76C19.53 40.39 19.79 39.03 20.08 37.61C20.36 36.18 20.62 34.74 20.95 33.23C21.28 31.72 21.61 30.16 22.07 28.57C22.52 26.98 23.02 25.32 23.69 23.69C24.35 22.06 25.11 20.38 26.05 18.79C26.99 17.21 28.08 15.62 29.33 14.2C30.58 12.78 32 11.41 33.54 10.26C35.08 9.12 36.8 8.11 38.57 7.35C40.34 6.6 42.27 6.04 44.17 5.73C46.08 5.43 48.08 5.37 50 5.54C51.92 5.71 53.87 6.15 55.69 6.75C57.52 7.36 59.3 8.22 60.94 9.19C62.57 10.15 64.11 11.33 65.51 12.56C66.91 13.78 68.17 15.15 69.33 16.52C70.48 17.89 71.5 19.34 72.44 20.76C73.38 22.18 74.19 23.62 74.97 25.03C75.75 26.43 76.44 27.83 77.12 29.19C77.8 30.56 78.42 31.89 79.05 33.23C79.67 34.57 80.28 35.87 80.87 37.21C81.46 38.55 82.05 39.88 82.6 41.27C83.14 42.65 83.68 44.05 84.14 45.51C84.6 46.96 85.03 48.46 85.34 50Z",
+ parts = null,
+ color = 0xFFFF2A2A,
+ faceX = 50f,
+ faceY = 50f,
+ faceScale = 0.95f,
+ ),
+)
+
+val BOT_TYPES: List<String> = listOf("clover", "flower", "triangle", "square", "blob", "ghost", "circle", "drop", "star", "droid", "mech", "alien", "hexagon", "cat", "cloud", "pill", "pebble", "puddle")
+
diff --git a/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/ui/notes/NoteEditor.kt b/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/ui/notes/NoteEditor.kt
new file mode 100644
index 0000000..04c0c9a
--- /dev/null
+++ b/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/ui/notes/NoteEditor.kt
@@ -0,0 +1,393 @@
+package com.chethan616.clearpdf.ui.notes
+
+import android.content.Intent
+import androidx.activity.compose.BackHandler
+import androidx.compose.animation.animateColorAsState
+import androidx.compose.animation.core.animateFloatAsState
+import androidx.compose.foundation.background
+import androidx.compose.foundation.border
+import androidx.compose.foundation.layout.Arrangement
+import androidx.compose.foundation.layout.Box
+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.heightIn
+import androidx.compose.foundation.layout.imePadding
+import androidx.compose.foundation.layout.navigationBarsPadding
+import androidx.compose.foundation.layout.padding
+import androidx.compose.foundation.layout.size
+import androidx.compose.foundation.layout.statusBars
+import androidx.compose.foundation.layout.width
+import androidx.compose.foundation.layout.windowInsetsTopHeight
+import androidx.compose.foundation.lazy.LazyColumn
+import androidx.compose.foundation.lazy.LazyRow
+import androidx.compose.foundation.lazy.items
+import androidx.compose.foundation.lazy.itemsIndexed
+import androidx.compose.foundation.shape.CircleShape
+import androidx.compose.foundation.text.BasicTextField
+import androidx.compose.foundation.text.KeyboardActions
+import androidx.compose.foundation.text.KeyboardOptions
+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.mutableStateOf
+import androidx.compose.runtime.remember
+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.focus.FocusRequester
+import androidx.compose.ui.focus.focusRequester
+import androidx.compose.ui.geometry.Rect
+import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.graphics.SolidColor
+import androidx.compose.ui.graphics.graphicsLayer
+import androidx.compose.ui.graphics.vector.ImageVector
+import androidx.compose.ui.input.key.Key
+import androidx.compose.ui.input.key.KeyEventType
+import androidx.compose.ui.input.key.key
+import androidx.compose.ui.input.key.onPreviewKeyEvent
+import androidx.compose.ui.input.key.type
+import androidx.compose.ui.layout.boundsInWindow
+import androidx.compose.ui.layout.onGloballyPositioned
+import androidx.compose.ui.res.stringResource
+import androidx.compose.ui.semantics.contentDescription
+import androidx.compose.ui.semantics.semantics
+import androidx.compose.ui.text.AnnotatedString
+import androidx.compose.ui.text.SpanStyle
+import androidx.compose.ui.text.TextRange
+import androidx.compose.ui.text.buildAnnotatedString
+import androidx.compose.ui.text.font.FontWeight
+import androidx.compose.ui.text.input.ImeAction
+import androidx.compose.ui.text.input.KeyboardCapitalization
+import androidx.compose.ui.text.input.OffsetMapping
+import androidx.compose.ui.text.input.TextFieldValue
+import androidx.compose.ui.text.input.TransformedText
+import androidx.compose.ui.text.input.VisualTransformation
+import androidx.compose.ui.text.style.TextDecoration
+import androidx.compose.ui.unit.dp
+import androidx.compose.ui.unit.sp
+import com.chethan616.clearpdf.R
+import com.chethan616.clearpdf.notes.CheckItem
+import com.chethan616.clearpdf.notes.Note
+import com.chethan616.clearpdf.notes.NoteKind
+import com.chethan616.clearpdf.notes.checkItem
+import com.chethan616.clearpdf.ui.AppViewModel
+import com.chethan616.clearpdf.ui.LucideIcons
+import com.chethan616.clearpdf.ui.glass.GlassCircle
+import com.chethan616.clearpdf.ui.glass.GlassIcon
+import com.chethan616.clearpdf.ui.glass.GlassMenu
+import com.chethan616.clearpdf.ui.glass.GlassMenuItem
+import com.chethan616.clearpdf.ui.glass.GlassMotion
+import com.chethan616.clearpdf.ui.glass.glass
+import com.chethan616.clearpdf.ui.glass.pressable
+import com.chethan616.clearpdf.ui.home.NoteImage
+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 java.text.DateFormat
+import java.util.Date
+
+/**
+ * A note open for writing, as the mock's editor: round glass Back and More, the title big and
+ * bold, the words under it (light Markdown: `**bold**` shows bold), the list's items with round
+ * ticks, its pictures, and a dark glass toolbar riding above the keyboard.
+ */
+@Composable
+fun NoteEditor(vm: AppViewModel, id: String) {
+ val note = vm.notes.get(id) ?: run {
+ LaunchedEffect(id) { vm.openNote = null }
+ return
+ }
+ BackHandler { vm.closeNote() }
+ val c = clear
+ var title by remember(id) { mutableStateOf(TextFieldValue(note.title)) }
+ var body by remember(id) { mutableStateOf(TextFieldValue(note.body)) }
+ var items by remember(id) { mutableStateOf(note.items) }
+ var focusItem by remember { mutableStateOf<String?>(null) }
+ val titleFocus = remember { FocusRequester() }
+ val bodyFocus = remember { FocusRequester() }
+ var menu by remember { mutableStateOf(false) }
+ var anchor by remember { mutableStateOf(Rect.Zero) }
+ val isList = note.kind == NoteKind.List
+
+ fun commit() {
+ val n = vm.notes.get(id) ?: return
+ if (n.title != title.text || n.body != body.text || n.items != items) vm.notes.put(n.copy(title = title.text, body = body.text, items = items))
+ }
+ LaunchedEffect(title.text, body.text, items) { commit() }
+ LaunchedEffect(id) { if (note.isEmpty) runCatching { titleFocus.requestFocus() } }
+
+ Box(Modifier.fillMaxSize()) {
+ LazyColumn(
+ Modifier.fillMaxSize().imePadding(),
+ contentPadding = PaddingValues(start = 24.dp, end = 24.dp, bottom = 140.dp),
+ ) {
+ item(key = "top") {
+ 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)
+ }
+ 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) }
+ }
+ }
+ }
+ item(key = "title") {
+ BasicTextField(
+ title, { title = it },
+ textStyle = ClearType.Headline.copy(fontSize = 34.sp, lineHeight = 40.sp, fontWeight = FontWeight.ExtraBold, color = c.ink),
+ cursorBrush = SolidColor(Candy.Sky),
+ keyboardOptions = KeyboardOptions(capitalization = KeyboardCapitalization.Sentences, imeAction = ImeAction.Next),
+ keyboardActions = KeyboardActions(onNext = {
+ if (isList) {
+ val first = items.firstOrNull() ?: checkItem("").also { items = items + it }
+ focusItem = first.id
+ } else {
+ runCatching { bodyFocus.requestFocus() }
+ }
+ }),
+ modifier = Modifier.fillMaxWidth().padding(top = 34.dp).focusRequester(titleFocus),
+ decorationBox = { inner ->
+ Box {
+ if (title.text.isEmpty()) Text(stringResource(if (isList) R.string.notes_list_title_hint else R.string.notes_title_hint), style = ClearType.Headline.copy(fontSize = 34.sp, lineHeight = 40.sp, fontWeight = FontWeight.ExtraBold), color = c.ink.copy(alpha = 0.32f))
+ inner()
+ }
+ },
+ )
+ }
+ item(key = "date") {
+ Text(
+ DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT).format(Date(note.updated)),
+ style = ClearType.Caption, color = c.ink.copy(alpha = 0.5f), modifier = Modifier.padding(top = 10.dp, bottom = 18.dp),
+ )
+ }
+ if (isList) {
+ itemsIndexed(items, key = { _, it -> it.id }) { i, item ->
+ ItemRow(
+ item, focus = focusItem == item.id,
+ onChange = { t -> items = items.map { if (it.id == item.id) it.copy(text = t) else it } },
+ onToggle = { items = items.map { if (it.id == item.id) it.copy(done = !it.done) else it } },
+ onNext = {
+ val n = checkItem("")
+ items = items.toMutableList().apply { add(i + 1, n) }
+ focusItem = n.id
+ },
+ onRemove = {
+ if (items.size > 1) {
+ val prev = items.getOrNull(i - 1)
+ items = items.filter { it.id != item.id }
+ focusItem = prev?.id
+ }
+ },
+ )
+ }
+ item(key = "add") {
+ Row(
+ Modifier.fillMaxWidth().padding(top = 6.dp).pressable({ val n = checkItem(""); items = items + n; focusItem = n.id }).padding(vertical = 10.dp),
+ verticalAlignment = Alignment.CenterVertically,
+ ) {
+ Icon(LucideIcons.Plus, null, tint = c.ink.copy(alpha = 0.55f), modifier = Modifier.size(24.dp))
+ Spacer(Modifier.width(12.dp))
+ Text(stringResource(R.string.notes_add_item), style = ClearType.Body.copy(fontSize = 17.sp), color = c.ink.copy(alpha = 0.55f))
+ }
+ }
+ } else {
+ item(key = "body") {
+ BasicTextField(
+ body, { body = it },
+ textStyle = ClearType.Body.copy(fontSize = 18.sp, lineHeight = 30.sp, color = c.ink.copy(alpha = 0.86f)),
+ cursorBrush = SolidColor(Candy.Sky),
+ visualTransformation = MarkdownLite(c.ink),
+ 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()
+ }
+ },
+ )
+ }
+ }
+ if (note.images.isNotEmpty()) {
+ item(key = "images") {
+ LazyRow(Modifier.padding(top = 18.dp), horizontalArrangement = Arrangement.spacedBy(12.dp)) {
+ items(note.images, key = { it }) { name ->
+ Box {
+ NoteImage(name, Modifier.size(150.dp, 120.dp).clip(RoundedRectangle(22.dp)))
+ Box(
+ Modifier.align(Alignment.TopEnd).padding(6.dp).size(28.dp)
+ .pressable({ vm.notes.get(id)?.let { n -> vm.notes.put(n.copy(images = n.images - name)) } })
+ .clip(CircleShape).background(Color.Black.copy(alpha = 0.35f)),
+ contentAlignment = Alignment.Center,
+ ) { Icon(LucideIcons.X, stringResource(R.string.notes_remove_picture), tint = Color.White, modifier = Modifier.size(15.dp)) }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ // the toolbar, above the keyboard
+ Row(
+ Modifier.align(Alignment.BottomCenter).navigationBarsPadding().imePadding().padding(bottom = 14.dp)
+ .glass(Capsule, c.capsule, blur = 10.dp).padding(6.dp),
+ horizontalArrangement = Arrangement.spacedBy(8.dp),
+ verticalAlignment = Alignment.CenterVertically,
+ ) {
+ if (isList) {
+ ToolButton(LucideIcons.Plus, stringResource(R.string.notes_add_item), primary = true) { val n = checkItem(""); items = items + n; focusItem = n.id }
+ ToolButton(LucideIcons.BrushCleaning, stringResource(R.string.notes_clear_done)) { items = items.filter { !it.done }.ifEmpty { listOf(checkItem("")) } }
+ } else {
+ ToolButton(LucideIcons.Bold, stringResource(R.string.notes_bold), primary = true) { body = toggleBold(body) }
+ ToolButton(LucideIcons.Heading, stringResource(R.string.notes_heading)) { body = toggleHeading(body) }
+ }
+ ToolButton(LucideIcons.Camera, stringResource(R.string.notes_take_photo)) { commit(); vm.takeNotePhoto() }
+ ToolButton(LucideIcons.ImagePlus, stringResource(R.string.notes_add_photo)) { commit(); vm.pickNotePhoto() }
+ }
+ }
+
+ if (menu) {
+ GlassMenu(
+ anchor, { menu = false },
+ listOf(
+ GlassMenuItem(stringResource(if (note.pinned) R.string.notes_unpin else R.string.notes_pin), LucideIcons.Pin) { vm.notes.put(note.copy(pinned = !note.pinned)) },
+ GlassMenuItem(stringResource(R.string.common_share), LucideIcons.Share2) { commit(); share(vm, vm.notes.get(id) ?: note) },
+ GlassMenuItem(stringResource(R.string.common_delete), LucideIcons.Trash2, destructive = true) { vm.openNote = null; vm.notes.delete(id) },
+ ),
+ )
+ }
+}
+
+/** A list item being written: its round tick and its words; Enter makes the next, Backspace on nothing removes it. */
+@Composable
+private fun ItemRow(item: CheckItem, focus: Boolean, onChange: (String) -> Unit, onToggle: () -> Unit, onNext: () -> Unit, onRemove: () -> Unit) {
+ val c = clear
+ 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 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) {
+ Box(Modifier.size(26.dp).border(2.dp, c.ink.copy(alpha = 0.5f * (1f - tick)), CircleShape))
+ Box(Modifier.size(26.dp).graphicsLayer { scaleX = tick; scaleY = tick }.clip(CircleShape).background(Candy.Mint), contentAlignment = Alignment.Center) {
+ Icon(LucideIcons.Check, null, tint = Color.White, modifier = Modifier.size(16.dp))
+ }
+ }
+ Spacer(Modifier.width(14.dp))
+ BasicTextField(
+ value,
+ { v ->
+ if (v.text.contains('\n')) {
+ onNext()
+ } else {
+ value = v
+ onChange(v.text)
+ }
+ },
+ textStyle = ClearType.Body.copy(fontSize = 18.sp, lineHeight = 26.sp, color = ink, textDecoration = if (item.done) TextDecoration.LineThrough else null),
+ cursorBrush = SolidColor(Candy.Mint),
+ keyboardOptions = KeyboardOptions(capitalization = KeyboardCapitalization.Sentences, imeAction = ImeAction.Next),
+ keyboardActions = KeyboardActions(onNext = { onNext() }),
+ singleLine = true,
+ modifier = Modifier.weight(1f).focusRequester(fr).onPreviewKeyEvent { e ->
+ if (e.type == KeyEventType.KeyDown && e.key == Key.Backspace && value.text.isEmpty()) {
+ onRemove()
+ true
+ } else false
+ },
+ )
+ }
+}
+
+/** A toolbar circle; the first is white, as the mock's. */
+@Composable
+private fun ToolButton(icon: ImageVector, label: String, primary: Boolean = false, onClick: () -> Unit) {
+ if (primary) {
+ Box(
+ Modifier.size(56.dp).pressable(onClick, pressedScale = 0.86f).clip(CircleShape).background(Color.White).semantics { contentDescription = label },
+ contentAlignment = Alignment.Center,
+ ) { Icon(icon, null, tint = Color(0xFF1C2433), modifier = Modifier.size(22.dp)) }
+ } else {
+ GlassCircle(onClick = onClick, size = 52.dp, surface = Color.White.copy(alpha = 0.14f), label = label) {
+ GlassIcon(icon, null, Modifier.size(21.dp), tint = Color.White)
+ }
+ }
+}
+
+/** `**word**` drawn bold (its stars faint), a `# ` line drawn large. The text itself is unchanged. */
+private class MarkdownLite(private val ink: Color) : VisualTransformation {
+ override fun filter(text: AnnotatedString): TransformedText {
+ val s = text.text
+ val out = buildAnnotatedString {
+ append(s)
+ Regex("""\*\*(.+?)\*\*""").findAll(s).forEach { m ->
+ addStyle(SpanStyle(fontWeight = FontWeight.Bold, color = ink), m.range.first + 2, m.range.last - 1)
+ addStyle(SpanStyle(color = ink.copy(alpha = 0.22f)), m.range.first, m.range.first + 2)
+ addStyle(SpanStyle(color = ink.copy(alpha = 0.22f)), m.range.last - 1, m.range.last + 1)
+ }
+ var at = 0
+ s.split('\n').forEach { line ->
+ if (line.startsWith("# ")) {
+ addStyle(SpanStyle(fontWeight = FontWeight.ExtraBold, fontSize = 24.sp, color = ink), at, at + line.length)
+ addStyle(SpanStyle(color = ink.copy(alpha = 0.22f)), at, at + 2)
+ }
+ at += line.length + 1
+ }
+ }
+ return TransformedText(out, OffsetMapping.Identity)
+ }
+}
+
+/** Wrap the selection in `**` (or unwrap it); with nothing selected, start bold at the cursor. */
+private fun toggleBold(v: TextFieldValue): TextFieldValue {
+ val s = v.text
+ val a = v.selection.min
+ val b = v.selection.max
+ if (a >= 2 && b + 2 <= s.length && s.substring(a - 2, a) == "**" && s.substring(b, b + 2) == "**") {
+ val t = s.removeRange(b, b + 2).removeRange(a - 2, a)
+ return TextFieldValue(t, TextRange(a - 2, b - 2))
+ }
+ val t = s.substring(0, a) + "**" + s.substring(a, b) + "**" + s.substring(b)
+ return TextFieldValue(t, TextRange(a + 2, b + 2))
+}
+
+/** Make the cursor's line a heading, or a heading plain again. */
+private fun toggleHeading(v: TextFieldValue): TextFieldValue {
+ val s = v.text
+ val start = s.lastIndexOf('\n', (v.selection.min - 1).coerceAtLeast(0)).let { if (it < 0 || v.selection.min == 0) 0 else it + 1 }
+ return if (s.startsWith("# ", start)) {
+ TextFieldValue(s.removeRange(start, start + 2), TextRange((v.selection.start - 2).coerceAtLeast(start), (v.selection.end - 2).coerceAtLeast(start)))
+ } else {
+ TextFieldValue(s.substring(0, start) + "# " + s.substring(start), TextRange(v.selection.start + 2, v.selection.end + 2))
+ }
+}
+
+/** A note to the share sheet as plain text. */
+private fun share(vm: AppViewModel, n: Note) {
+ val text = buildString {
+ if (n.title.isNotBlank()) appendLine(n.title).appendLine()
+ if (n.kind == NoteKind.List) n.items.filter { it.text.isNotBlank() }.forEach { appendLine((if (it.done) "☑ " else "☐ ") + it.text) }
+ else append(n.body.replace("**", ""))
+ }.trim()
+ val send = Intent(Intent.ACTION_SEND).setType("text/plain").putExtra(Intent.EXTRA_TEXT, text).putExtra(Intent.EXTRA_SUBJECT, n.title)
+ vm.intents.trySend(Intent.createChooser(send, null))
+}
+
diff --git a/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/ui/onboarding/Onboarding.kt b/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/ui/onboarding/Onboarding.kt
new file mode 100644
index 0000000..046e239
--- /dev/null
+++ b/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/ui/onboarding/Onboarding.kt
@@ -0,0 +1,372 @@
+package com.chethan616.clearpdf.ui.onboarding
+
+import androidx.compose.animation.animateColorAsState
+import androidx.compose.animation.core.Animatable
+import androidx.compose.animation.core.animateDpAsState
+import androidx.compose.foundation.Image
+import androidx.compose.foundation.background
+import androidx.compose.foundation.border
+import androidx.compose.foundation.layout.Arrangement
+import androidx.compose.foundation.layout.Box
+import androidx.compose.foundation.layout.BoxScope
+import androidx.compose.foundation.layout.Column
+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.navigationBarsPadding
+import androidx.compose.foundation.layout.offset
+import androidx.compose.foundation.layout.padding
+import androidx.compose.foundation.layout.size
+import androidx.compose.foundation.layout.statusBars
+import androidx.compose.foundation.layout.width
+import androidx.compose.foundation.layout.windowInsetsTopHeight
+import androidx.compose.foundation.pager.HorizontalPager
+import androidx.compose.foundation.pager.PagerState
+import androidx.compose.foundation.pager.rememberPagerState
+import androidx.compose.foundation.shape.CircleShape
+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.remember
+import androidx.compose.runtime.rememberCoroutineScope
+import androidx.compose.ui.Alignment
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.draw.clip
+import androidx.compose.ui.geometry.Offset
+import androidx.compose.ui.graphics.Brush
+import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.graphics.graphicsLayer
+import androidx.compose.ui.graphics.vector.ImageVector
+import androidx.compose.ui.res.painterResource
+import androidx.compose.ui.res.stringResource
+import androidx.compose.ui.text.SpanStyle
+import androidx.compose.ui.text.buildAnnotatedString
+import androidx.compose.ui.text.style.TextAlign
+import androidx.compose.ui.text.withStyle
+import androidx.compose.ui.unit.Dp
+import androidx.compose.ui.unit.dp
+import androidx.compose.ui.unit.sp
+import androidx.compose.ui.util.lerp
+import com.chethan616.clearpdf.R
+import com.chethan616.clearpdf.notes.checkItem
+import com.chethan616.clearpdf.ui.AppViewModel
+import com.chethan616.clearpdf.ui.LucideIcons
+import com.chethan616.clearpdf.ui.glass.GlassMotion
+import com.chethan616.clearpdf.ui.glass.GlassPill
+import com.chethan616.clearpdf.ui.glass.glass
+import com.chethan616.clearpdf.ui.glass.pressable
+import com.chethan616.clearpdf.ui.home.CardShape
+import com.chethan616.clearpdf.ui.home.CheckPill
+import com.chethan616.clearpdf.ui.home.CollectionCard
+import com.chethan616.clearpdf.ui.home.Waveform
+import com.chethan616.clearpdf.ui.home.cardPaint
+import com.chethan616.clearpdf.ui.mascot.Mascot
+import com.chethan616.clearpdf.ui.mascot.MascotMood
+import com.chethan616.clearpdf.ui.theme.Candy
+import com.chethan616.clearpdf.ui.theme.ClearType
+import com.chethan616.clearpdf.ui.theme.Tone
+import com.chethan616.clearpdf.ui.theme.clear
+import com.chethan616.clearpdf.ui.theme.glowing
+import com.kyant.shapes.Capsule
+import com.kyant.shapes.RoundedRectangle
+import java.text.SimpleDateFormat
+import java.util.Date
+import java.util.Locale
+import kotlin.math.absoluteValue
+import kotlinx.coroutines.launch
+
+/** How many welcome pages there are. */
+const val WelcomePages = 4
+
+/**
+ * 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.
+ */
+@Composable
+fun Onboarding(vm: AppViewModel, pager: PagerState = rememberPagerState { WelcomePages }) {
+ val c = clear
+ val scope = rememberCoroutineScope()
+ Box(Modifier.fillMaxSize()) {
+ HorizontalPager(pager, Modifier.fillMaxSize()) { page ->
+ val offset = (pager.currentPage - page) + pager.currentPageOffsetFraction
+ 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
+ },
+ ) {
+ Spacer(Modifier.windowInsetsTopHeight(WindowInsets.statusBars))
+ Box(Modifier.fillMaxWidth().weight(1f)) {
+ when (page) {
+ 0 -> Hello(offset)
+ 1 -> OneDesk(offset)
+ 2 -> PdfTools(offset)
+ else -> Promise(offset)
+ }
+ }
+ 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),
+ )
+ }
+
+ // the dots and the button
+ Column(
+ Modifier.align(Alignment.BottomCenter).navigationBarsPadding().padding(start = 24.dp, end = 24.dp, bottom = 24.dp).fillMaxWidth(),
+ horizontalAlignment = Alignment.CenterHorizontally,
+ ) {
+ Dots(pager)
+ Spacer(Modifier.height(22.dp))
+ val last = pager.currentPage == WelcomePages - 1
+ 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),
+ height = 58.dp,
+ modifier = Modifier.fillMaxWidth(),
+ ) {
+ Text(stringResource(if (last) R.string.welcome_start else R.string.welcome_next), style = ClearType.BodyStrong.copy(fontSize = 17.sp), color = Color.White)
+ Icon(LucideIcons.ChevronRight, null, tint = Color.White, modifier = Modifier.size(20.dp))
+ }
+ }
+ }
+}
+
+/** The page dots on a glass capsule; the current one stretches into a pill. */
+@Composable
+private 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))
+ }
+ }
+}
+
+/** A title block: white, glowing; [accent] words come out in a pastel gradient. */
+@Composable
+private 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)) {
+ Text(eyebrow.uppercase(), style = ClearType.Eyebrow, color = c.hero.copy(alpha = 0.85f))
+ Spacer(Modifier.height(8.dp))
+ Text(
+ buildAnnotatedString {
+ append(title)
+ append(" ")
+ withStyle(SpanStyle(brush = Brush.linearGradient(listOf(Color.White, Color(0xFFFFD6EE), Color(0xFFD7E4FF))))) { append(accent) }
+ },
+ style = ClearType.Hero.copy(fontSize = 44.sp, lineHeight = 46.sp, color = c.hero).glowing(c),
+ )
+ Spacer(Modifier.height(10.dp))
+ Text(body, style = ClearType.Body.copy(fontSize = 15.sp, lineHeight = 21.sp), color = if (c.dark) c.inkSoft else Color(0xFF1C2433).copy(alpha = 0.72f))
+ }
+}
+
+/** A card flying in: from [from], turned [tilt], landing on a spring a little after [delayMs]. */
+@Composable
+private fun Modifier.flyIn(tilt: Float, from: Offset, delayMs: Long, swayWith: Float): Modifier {
+ val p = remember { Animatable(0f) }
+ LaunchedEffect(Unit) {
+ kotlinx.coroutines.delay(delayMs)
+ p.animateTo(1f, GlassMotion.rise())
+ }
+ return graphicsLayer {
+ val v = p.value
+ translationX = lerp(from.x, 0f, v) * density + swayWith * size.width * 0.18f
+ translationY = lerp(from.y, 0f, v) * density
+ rotationZ = lerp(tilt * 3f, tilt, v) + swayWith * 6f
+ alpha = v.coerceIn(0f, 1f)
+ }
+}
+
+// ---- page 1: hello ----------------------------------------------------------------------------------
+
+@Composable
+private fun Hello(sway: Float) {
+ val c = clear
+ Column(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))
+ 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 mock's three tilted cards: a note, a picture with a mascot, today's date
+ Box(Modifier.fillMaxWidth().weight(1f).padding(top = 22.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))
+ 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))
+ }
+ }
+}
+
+@Composable
+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))
+ 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)
+ }
+}
+
+@Composable
+private 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))
+ Spacer(Modifier.height(26.dp))
+ Text(stringResource(R.string.welcome_card_overview), style = ClearType.Caption, color = tone.ink.copy(alpha = 0.5f))
+ }
+}
+
+// ---- page 2: one desk --------------------------------------------------------------------------------
+
+@Composable
+private fun OneDesk(sway: Float) {
+ val c = clear
+ Column(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)
+ Box(Modifier.fillMaxWidth().weight(1f)) {
+ Row(
+ Modifier.align(Alignment.BottomCenter).fillMaxWidth().padding(horizontal = 20.dp, vertical = 8.dp),
+ horizontalArrangement = Arrangement.spacedBy(12.dp),
+ ) {
+ 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) {}
+ }
+ }
+ CollectionCard(stringResource(R.string.desk_word_files), c.tone(Tone.Butter), {}, Modifier.fillMaxWidth().flyIn(2f, Offset(-80f, 200f), 180, sway), 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)
+ }
+ }
+ }
+ }
+}
+
+// ---- page 3: PDF tools -------------------------------------------------------------------------------
+
+@Composable
+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)
+ Box(Modifier.fillMaxWidth().weight(1f)) {
+ Box(Modifier.align(Alignment.BottomCenter).fillMaxWidth().height(340.dp)) {
+ // a page with a signature being written on it
+ Column(
+ Modifier.align(Alignment.Center).width(210.dp).height(280.dp).flyIn(-4f, Offset(0f, 220f), 60, sway)
+ .graphicsLayer { shadowElevation = 18.dp.toPx(); shape = RoundedRectangle(16.dp); clip = true }
+ .background(Color.White).padding(22.dp),
+ verticalArrangement = Arrangement.spacedBy(8.dp),
+ ) {
+ Box(Modifier.fillMaxWidth(0.6f).height(10.dp).clip(Capsule).background(Color(0xFF17141F).copy(alpha = 0.75f)))
+ Spacer(Modifier.height(4.dp))
+ repeat(7) { k -> Box(Modifier.fillMaxWidth(if (k % 3 == 2) 0.7f else 1f).height(6.dp).clip(Capsule).background(Color(0xFF17141F).copy(alpha = 0.12f))) }
+ Spacer(Modifier.weight(1f))
+ Box(Modifier.fillMaxWidth(0.75f).height(36.dp).clip(RoundedRectangle(8.dp)).background(Candy.Chip.copy(alpha = 0.6f)).border(1.dp, Candy.Lemon, RoundedRectangle(8.dp))) {
+ Text("A. Lovelace", style = ClearType.Title.copy(fontSize = 18.sp, fontStyle = androidx.compose.ui.text.font.FontStyle.Italic), color = Candy.InkBlue, modifier = Modifier.align(Alignment.Center))
+ }
+ }
+ ToolBubble(LucideIcons.Signature, Candy.Grape, Modifier.align(Alignment.TopStart).padding(start = 34.dp, top = 30.dp).flyIn(-8f, Offset(-160f, 0f), 200, sway))
+ ToolBubble(LucideIcons.Highlighter, Candy.Tangerine, Modifier.align(Alignment.TopEnd).padding(end = 30.dp, top = 10.dp).flyIn(10f, Offset(160f, -30f), 260, sway))
+ ToolBubble(LucideIcons.ScanText, Candy.Mint, Modifier.align(Alignment.BottomEnd).padding(end = 40.dp, bottom = 30.dp).flyIn(-6f, Offset(160f, 80f), 320, sway))
+ ToolBubble(LucideIcons.FilePenLine, Candy.Bubblegum, Modifier.align(Alignment.BottomStart).padding(start = 28.dp, bottom = 60.dp).flyIn(7f, Offset(-160f, 60f), 380, sway))
+ }
+ }
+ }
+}
+
+/** A tool as a glass bubble with its candy glyph. */
+@Composable
+private 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(46.dp).clip(CircleShape).background(accent), contentAlignment = Alignment.Center) {
+ Icon(icon, null, tint = Color.White, modifier = Modifier.size(24.dp))
+ }
+ }
+}
+
+// ---- page 4: the promise -----------------------------------------------------------------------------
+
+@Composable
+private fun Promise(sway: Float) {
+ val c = clear
+ Column(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)
+ 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))
+ }
+ Spacer(Modifier.height(4.dp))
+ listOf(
+ Triple(LucideIcons.ShieldCheck, R.string.welcome_promise_1, Candy.Mint),
+ Triple(LucideIcons.UserRound, R.string.welcome_promise_2, Candy.Sky),
+ 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),
+ 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)) }
+ Spacer(Modifier.width(12.dp))
+ Text(stringResource(label), style = ClearType.BodyStrong, color = c.ink)
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/ui/theme/ClearTheme.kt b/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/ui/theme/ClearTheme.kt
index 0b75564..a56fc6b 100644
--- a/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/ui/theme/ClearTheme.kt
+++ b/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/ui/theme/ClearTheme.kt
@@ -5,91 +5,153 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.Immutable
import androidx.compose.runtime.staticCompositionLocalOf
+import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.graphics.Shadow
+import androidx.compose.ui.graphics.lerp
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.Font
import androidx.compose.ui.text.font.FontFamily
+import androidx.compose.ui.text.font.FontStyle
import androidx.compose.ui.text.font.FontVariation
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.LineHeightStyle
import androidx.compose.ui.unit.TextUnit
import androidx.compose.ui.unit.sp
import com.chethan616.clearpdf.R
-import com.chethan616.clearpdf.ui.Inter
import com.chethan616.clearpdf.ui.ThemeChoice
-/** The candy accents: one per tool, the same hue in both themes. */
+/**
+ * The accents: Apple's system hues, one per tool, the same in both themes. Icons, toggles, the
+ * vivid buttons. Surfaces use the softer [CardTone]s instead.
+ */
object Candy {
- val Tomato = Color(0xFFFF5A3C)
- val Tangerine = Color(0xFFFF9A1F)
- val Lemon = Color(0xFFFFC83A)
- val Lime = Color(0xFF8CCB2E)
- val Mint = Color(0xFF17C08F)
- val Sky = Color(0xFF2E86FF)
- val Grape = Color(0xFF8A4DFF)
- val Bubblegum = Color(0xFFFF4DA6)
+ val Tomato = Color(0xFFFF5B4F)
+ val Tangerine = Color(0xFFFF9F0A)
+ val Lemon = Color(0xFFFFC21A)
+ val Lime = Color(0xFF34C759)
+ val Mint = Color(0xFF00BFB3)
+ val Sky = Color(0xFF0A84FF)
+ val Grape = Color(0xFF5E5CE6)
+ val Bubblegum = Color(0xFFFF4F8B)
+
+ /** The chosen chip's pastel lemon. */
+ val Chip = Color(0xFFEEF27E)
+ /** A note's title blue. */
+ val InkBlue = Color(0xFF2C6DB5)
val All = listOf(Tomato, Tangerine, Lemon, Lime, Mint, Sky, Grape, Bubblegum)
}
+/** A pastel card's paint: a soft vertical gradient, the ink on it and its own accent (titles, serif words). */
+@Immutable
+data class CardTone(val top: Color, val bottom: Color, val ink: Color, val accent: Color)
+
+/** The card colours, by role. */
+enum class Tone { Sage, Paper, Lavender, Butter, Orchid, Blush, Sky, Peach }
+
@Immutable
data class ClearColors(
val dark: Boolean,
- /** Behind everything, under the aurora. */
- val canvas: Color,
+ /** Behind everything: the wallpaper's gradient, top to bottom. */
+ val wall: List<Color>,
+ /** Soft light pooled on the wallpaper: colour and strength. */
+ val blooms: List<Pair<Color, Float>>,
+ /** Big titles straight on the wallpaper. */
+ val hero: Color,
+ /** The glow behind [hero] titles. */
+ val heroGlow: Color,
val ink: Color,
val inkSoft: Color,
val inkFaint: Color,
val line: Color,
- /** The wash on chrome glass (dock, bars, buttons). */
+ /** The wash on chrome glass (dock, bars, buttons, chips). */
val glass: Color,
+ /** The rim of an outlined glass chip. */
+ val rim: Color,
/** The heavier frost menus, sheets and dialogs use so their text stays legible. */
val frost: Color,
- /** The aurora's blobs: colour and strength. */
- val aurora: List<Pair<Color, Float>>,
/** Behind document pages. */
val desk: Color,
+ /** The dark glass of the floating create capsule. */
+ val capsule: Color,
+ val tones: Map<Tone, CardTone>,
+) {
+ /** The canvas colour (the wallpaper's middle), for places that need one flat colour. */
+ val canvas: Color get() = wall[wall.size / 2]
+
+ fun tone(t: Tone): CardTone = tones.getValue(t)
+}
+
+private val InkLight = Color(0xFF172033)
+private val InkDark = Color(0xFFF1F5F9)
+
+private val LightTones = mapOf(
+ Tone.Sage to CardTone(Color(0xFF8ED0C1), Color(0xFFB2DFD6), Color(0xFF12302B), Color(0xFF1B6E60)),
+ Tone.Paper to CardTone(Color(0xFFFFFFFF).copy(alpha = 0.88f), Color(0xFFF1F5FC).copy(alpha = 0.82f), InkLight, Candy.InkBlue),
+ Tone.Lavender to CardTone(Color(0xFF9FA5EA), Color(0xFFBABDF5), Color.White, Color.White),
+ Tone.Butter to CardTone(Color(0xFFEAE5BC), Color(0xFFF4F1DA), Color(0xFF3A3420), Color(0xFFB0862C)),
+ Tone.Orchid to CardTone(Color(0xFFE9C1EC), Color(0xFFD8AEE7), Color(0xFF3B1E3F), Color(0xFFC0258A)),
+ Tone.Blush to CardTone(Color(0xFFF5AFBF), Color(0xFFF7C3CF), Color(0xFF4A1824), Color(0xFFD23B5F)),
+ Tone.Sky to CardTone(Color(0xFFA8D0F5), Color(0xFFC9E3FA), Color(0xFF13304F), Color(0xFF1C6FD1)),
+ Tone.Peach to CardTone(Color(0xFFF8C6A3), Color(0xFFFBDCC5), Color(0xFF4A2512), Color(0xFFD9541C)),
)
-private val InkLight = Color(0xFF17141F)
-private val InkDark = Color(0xFFF7F3FF)
+/** 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)
+ }
+}
val LightClear = ClearColors(
dark = false,
- canvas = Color(0xFFF6F1EA),
+ wall = listOf(Color(0xFF9AB4DC), Color(0xFFB3C5E8), Color(0xFFA8BEE3)),
+ blooms = listOf(
+ Color(0xFFCDF2F3) to 0.62f,
+ Color(0xFFD9C3F4) to 0.58f,
+ Color(0xFFF7BEDD) to 0.36f,
+ Color(0xFF8AA4D7) to 0.42f,
+ Color(0xFFFFFFFF) to 0.20f,
+ ),
+ hero = Color.White,
+ heroGlow = Color(0xFF3A527E).copy(alpha = 0.22f),
ink = InkLight,
inkSoft = InkLight.copy(alpha = 0.64f),
inkFaint = InkLight.copy(alpha = 0.40f),
line = InkLight.copy(alpha = 0.08f),
- glass = Color.White.copy(alpha = 0.40f),
- frost = Color(0xFFFBF8F4).copy(alpha = 0.78f),
- aurora = listOf(
- Candy.Tangerine to 0.30f,
- Candy.Grape to 0.24f,
- Candy.Sky to 0.20f,
- Candy.Bubblegum to 0.18f,
- Candy.Lemon to 0.26f,
- ),
- desk = Color(0xFFE6E2DC),
+ glass = Color.White.copy(alpha = 0.26f),
+ rim = Color.White.copy(alpha = 0.70f),
+ frost = Color(0xFFF3F6FC).copy(alpha = 0.82f),
+ desk = Color(0xFFDCE3EE),
+ capsule = Color(0xFF26324A).copy(alpha = 0.34f),
+ tones = LightTones,
)
val DarkClear = ClearColors(
dark = true,
- canvas = Color(0xFF0E0C13),
+ wall = listOf(Color(0xFF0E1A20), Color(0xFF13262C), Color(0xFF0F1A22)),
+ 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,
+ ),
+ hero = Color.White,
+ heroGlow = Color.Black.copy(alpha = 0.30f),
ink = InkDark,
inkSoft = InkDark.copy(alpha = 0.66f),
inkFaint = InkDark.copy(alpha = 0.42f),
line = InkDark.copy(alpha = 0.10f),
- glass = Color(0xFF2A2634).copy(alpha = 0.42f),
- frost = Color(0xFF1C1924).copy(alpha = 0.82f),
- aurora = listOf(
- Candy.Tangerine to 0.30f,
- Candy.Grape to 0.42f,
- Candy.Sky to 0.30f,
- Candy.Bubblegum to 0.26f,
- Candy.Mint to 0.18f,
- ),
- desk = Color(0xFF111015),
+ 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),
+ tones = DarkTones,
)
val LocalClearColors = staticCompositionLocalOf { LightClear }
@@ -97,43 +159,71 @@ val LocalClearColors = staticCompositionLocalOf { LightClear }
/** The colours in effect. */
val clear: ClearColors @Composable get() = LocalClearColors.current
-/** Bricolage Grotesque at one point of its weight, width and optical-size axes. */
-private fun bricolage(weight: Int, width: Float, opticalSize: Float) = FontFamily(
+/** Plus Jakarta Sans (OFL) at one weight of its variable axis. */
+private fun jakarta(weight: Int, italic: Boolean = false) = FontFamily(
Font(
- R.font.bricolage,
+ if (italic) R.font.jakarta_italic else R.font.jakarta,
FontWeight(weight),
- variationSettings = FontVariation.Settings(
- FontVariation.weight(weight),
- FontVariation.width(width),
- FontVariation.Setting("opsz", opticalSize),
- ),
+ if (italic) FontStyle.Italic else FontStyle.Normal,
+ variationSettings = FontVariation.Settings(FontVariation.weight(weight)),
),
)
+/** The whole Jakarta family, every weight the text styles ask for. */
+val Jakarta: FontFamily = FontFamily(
+ listOf(300, 400, 500, 600, 700, 800).flatMap { w ->
+ listOf(
+ Font(R.font.jakarta, FontWeight(w), FontStyle.Normal, variationSettings = FontVariation.Settings(FontVariation.weight(w))),
+ Font(R.font.jakarta_italic, FontWeight(w), FontStyle.Italic, variationSettings = FontVariation.Settings(FontVariation.weight(w))),
+ )
+ },
+)
+
+/** Doto (OFL): the dot-matrix face of to-do lists. */
+val Doto: FontFamily = FontFamily(
+ Font(R.font.doto, FontWeight.Bold, variationSettings = FontVariation.Settings(FontVariation.weight(800), FontVariation.Setting("ROND", 60f))),
+)
+
+/** DM Serif Display (OFL): the editorial word on a collection's card ("Files", "Pdf"). */
+val Serif: FontFamily = FontFamily(
+ Font(R.font.dm_serif, FontWeight.Normal),
+ Font(R.font.dm_serif_italic, FontWeight.Normal, FontStyle.Italic),
+)
+
private val Trim = LineHeightStyle(LineHeightStyle.Alignment.Center, LineHeightStyle.Trim.Both)
private fun display(family: FontFamily, size: TextUnit, line: TextUnit, tracking: TextUnit) =
TextStyle(fontFamily = family, fontSize = size, lineHeight = line, letterSpacing = tracking, lineHeightStyle = Trim)
/**
- * The type scale. Bricolage Grotesque (condensed, heavy, large optical size) carries the voice: heroes,
- * titles, tile labels and numbers. Inter carries reading: body, labels and captions.
+ * The type scale, all Plus Jakarta Sans: heavy and tight for heroes and titles (Apple's display
+ * sizes, a touch rounder), plain for reading. [Serif] and [Doto] are the playful accents on cards.
*/
object ClearType {
- val Hero = display(bricolage(800, 84f, 96f), 52.sp, 54.sp, (-0.9).sp)
- val Display = display(bricolage(760, 86f, 60f), 40.sp, 42.sp, (-0.6).sp)
- val Headline = display(bricolage(720, 90f, 36f), 27.sp, 31.sp, (-0.3).sp)
- val Title = display(bricolage(660, 92f, 24f), 19.sp, 23.sp, (-0.2).sp)
- val Tile = display(bricolage(720, 86f, 20f), 18.sp, 20.sp, (-0.2).sp)
- val Number = display(bricolage(740, 80f, 48f), 22.sp, 24.sp, 0.sp).copy(fontFeatureSettings = "tnum")
-
- val Eyebrow = TextStyle(fontFamily = Inter, fontWeight = FontWeight.SemiBold, fontSize = 11.5.sp, lineHeight = 14.sp, letterSpacing = 1.4.sp)
- val Body = TextStyle(fontFamily = Inter, fontWeight = FontWeight.Normal, fontSize = 15.sp, lineHeight = 21.sp)
+ val Hero = display(jakarta(700), 54.sp, 56.sp, (-1.4).sp)
+ val Display = display(jakarta(600), 42.sp, 46.sp, (-1.0).sp)
+ val Headline = display(jakarta(700), 26.sp, 30.sp, (-0.5).sp)
+ val Title = display(jakarta(700), 18.sp, 22.sp, (-0.2).sp)
+ val Tile = display(jakarta(700), 17.sp, 20.sp, (-0.2).sp)
+ val Number = display(jakarta(700), 22.sp, 24.sp, 0.sp).copy(fontFeatureSettings = "tnum")
+
+ /** A note card's title: bold, tight, in the note's blue. */
+ val CardTitle = display(jakarta(800), 27.sp, 29.sp, (-0.6).sp)
+ /** A collection card's word ("Files"). */
+ val SerifWord = display(Serif, 52.sp, 52.sp, (-1.2).sp)
+ /** A list card's title. */
+ val DotTitle = display(Doto, 30.sp, 32.sp, 0.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)
- val Label = TextStyle(fontFamily = Inter, fontWeight = FontWeight.Medium, fontSize = 13.sp, lineHeight = 18.sp)
- val Caption = TextStyle(fontFamily = Inter, fontWeight = FontWeight.Normal, fontSize = 12.sp, lineHeight = 16.sp)
+ val Label = TextStyle(fontFamily = Jakarta, fontWeight = FontWeight.Medium, fontSize = 13.sp, lineHeight = 18.sp)
+ val Caption = TextStyle(fontFamily = Jakarta, fontWeight = FontWeight.Normal, fontSize = 11.5.sp, lineHeight = 15.sp)
}
+/** A hero title's soft glow, so white type reads on the pale sky. */
+fun TextStyle.glowing(c: ClearColors): TextStyle = copy(shadow = Shadow(c.heroGlow, Offset(0f, 2f), 22f))
+
@Composable
fun ClearTheme(choice: ThemeChoice, content: @Composable () -> Unit) {
val dark = when (choice) {
diff --git a/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/PageImages.kt b/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/PageImages.kt
index a05fd24..c0a3f5a 100644
--- a/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/PageImages.kt
+++ b/apps/pdfcraft-android/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/PageImages.kt
@@ -123,7 +123,7 @@ class PageImages(
PageImage(r.key, img.toBitmap().asImageBitmap(), r.scale, r.tile?.x?.toInt() ?: 0, r.tile?.y?.toInt() ?: 0)
}
} catch (e: Exception) {
- Log.w("ClearPDF", "render of ${r.key} failed: ${e.message}")
+ Log.w("Artefact", "render of ${r.key} failed: ${e.message}")
synchronized(lock) { failed.add(r.key) }
null
} finally {
diff --git a/apps/pdfcraft-android/android/app/src/main/res/drawable-nodpi/artefact_logo.png b/apps/pdfcraft-android/android/app/src/main/res/drawable-nodpi/artefact_logo.png
new file mode 100644
index 0000000..f7a5e56
Binary files /dev/null and b/apps/pdfcraft-android/android/app/src/main/res/drawable-nodpi/artefact_logo.png differ
diff --git a/apps/pdfcraft-android/android/app/src/main/res/drawable-nodpi/artefact_mark.png b/apps/pdfcraft-android/android/app/src/main/res/drawable-nodpi/artefact_mark.png
new file mode 100644
index 0000000..df07a9f
Binary files /dev/null and b/apps/pdfcraft-android/android/app/src/main/res/drawable-nodpi/artefact_mark.png differ
diff --git a/apps/pdfcraft-android/android/app/src/main/res/font/bricolage.ttf b/apps/pdfcraft-android/android/app/src/main/res/font/bricolage.ttf
deleted file mode 100644
index 9a4ca27..0000000
Binary files a/apps/pdfcraft-android/android/app/src/main/res/font/bricolage.ttf and /dev/null differ
diff --git a/apps/pdfcraft-android/android/app/src/main/res/font/dm_serif.ttf b/apps/pdfcraft-android/android/app/src/main/res/font/dm_serif.ttf
new file mode 100644
index 0000000..bc5ed0c
Binary files /dev/null and b/apps/pdfcraft-android/android/app/src/main/res/font/dm_serif.ttf differ
diff --git a/apps/pdfcraft-android/android/app/src/main/res/font/dm_serif_italic.ttf b/apps/pdfcraft-android/android/app/src/main/res/font/dm_serif_italic.ttf
new file mode 100644
index 0000000..5369414
Binary files /dev/null and b/apps/pdfcraft-android/android/app/src/main/res/font/dm_serif_italic.ttf differ
diff --git a/apps/pdfcraft-android/android/app/src/main/res/font/doto.ttf b/apps/pdfcraft-android/android/app/src/main/res/font/doto.ttf
new file mode 100644
index 0000000..ed8f0db
Binary files /dev/null and b/apps/pdfcraft-android/android/app/src/main/res/font/doto.ttf differ
diff --git a/apps/pdfcraft-android/android/app/src/main/res/font/jakarta.ttf b/apps/pdfcraft-android/android/app/src/main/res/font/jakarta.ttf
new file mode 100644
index 0000000..0cb13a9
Binary files /dev/null and b/apps/pdfcraft-android/android/app/src/main/res/font/jakarta.ttf differ
diff --git a/apps/pdfcraft-android/android/app/src/main/res/font/jakarta_italic.ttf b/apps/pdfcraft-android/android/app/src/main/res/font/jakarta_italic.ttf
new file mode 100644
index 0000000..82b042c
Binary files /dev/null and b/apps/pdfcraft-android/android/app/src/main/res/font/jakarta_italic.ttf differ
diff --git a/apps/pdfcraft-android/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/apps/pdfcraft-android/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
new file mode 100644
index 0000000..1451b6a
--- /dev/null
+++ b/apps/pdfcraft-android/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
+ <background android:drawable="@color/ic_launcher_background" />
+ <foreground android:drawable="@mipmap/ic_launcher_foreground" />
+ <monochrome android:drawable="@mipmap/ic_launcher_monochrome" />
+</adaptive-icon>
diff --git a/apps/pdfcraft-android/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/apps/pdfcraft-android/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
new file mode 100644
index 0000000..1451b6a
--- /dev/null
+++ b/apps/pdfcraft-android/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
+ <background android:drawable="@color/ic_launcher_background" />
+ <foreground android:drawable="@mipmap/ic_launcher_foreground" />
+ <monochrome android:drawable="@mipmap/ic_launcher_monochrome" />
+</adaptive-icon>
diff --git a/apps/pdfcraft-android/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/apps/pdfcraft-android/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
index b4a729e..62f57df 100644
Binary files a/apps/pdfcraft-android/android/app/src/main/res/mipmap-hdpi/ic_launcher.png and b/apps/pdfcraft-android/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ
diff --git a/apps/pdfcraft-android/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png b/apps/pdfcraft-android/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png
new file mode 100644
index 0000000..40ffd46
Binary files /dev/null and b/apps/pdfcraft-android/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png differ
diff --git a/apps/pdfcraft-android/android/app/src/main/res/mipmap-hdpi/ic_launcher_monochrome.png b/apps/pdfcraft-android/android/app/src/main/res/mipmap-hdpi/ic_launcher_monochrome.png
new file mode 100644
index 0000000..2a016b0
Binary files /dev/null and b/apps/pdfcraft-android/android/app/src/main/res/mipmap-hdpi/ic_launcher_monochrome.png differ
diff --git a/apps/pdfcraft-android/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/apps/pdfcraft-android/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
index b4a729e..dee4a37 100644
Binary files a/apps/pdfcraft-android/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png and b/apps/pdfcraft-android/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png differ
diff --git a/apps/pdfcraft-android/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/apps/pdfcraft-android/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
index 1f95ed0..51df43d 100644
Binary files a/apps/pdfcraft-android/android/app/src/main/res/mipmap-mdpi/ic_launcher.png and b/apps/pdfcraft-android/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ
diff --git a/apps/pdfcraft-android/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png b/apps/pdfcraft-android/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png
new file mode 100644
index 0000000..a737ed8
Binary files /dev/null and b/apps/pdfcraft-android/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png differ
diff --git a/apps/pdfcraft-android/android/app/src/main/res/mipmap-mdpi/ic_launcher_monochrome.png b/apps/pdfcraft-android/android/app/src/main/res/mipmap-mdpi/ic_launcher_monochrome.png
new file mode 100644
index 0000000..810fda7
Binary files /dev/null and b/apps/pdfcraft-android/android/app/src/main/res/mipmap-mdpi/ic_launcher_monochrome.png differ
diff --git a/apps/pdfcraft-android/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/apps/pdfcraft-android/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
index 1f95ed0..d24ca95 100644
Binary files a/apps/pdfcraft-android/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png and b/apps/pdfcraft-android/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png differ
diff --git a/apps/pdfcraft-android/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/apps/pdfcraft-android/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
index ca277c7..72ef41c 100644
Binary files a/apps/pdfcraft-android/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png and b/apps/pdfcraft-android/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ
diff --git a/apps/pdfcraft-android/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png b/apps/pdfcraft-android/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png
new file mode 100644
index 0000000..99d1a50
Binary files /dev/null and b/apps/pdfcraft-android/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png differ
diff --git a/apps/pdfcraft-android/android/app/src/main/res/mipmap-xhdpi/ic_launcher_monochrome.png b/apps/pdfcraft-android/android/app/src/main/res/mipmap-xhdpi/ic_launcher_monochrome.png
new file mode 100644
index 0000000..0ca8858
Binary files /dev/null and b/apps/pdfcraft-android/android/app/src/main/res/mipmap-xhdpi/ic_launcher_monochrome.png differ
diff --git a/apps/pdfcraft-android/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/apps/pdfcraft-android/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
index ca277c7..35b37ff 100644
Binary files a/apps/pdfcraft-android/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png and b/apps/pdfcraft-android/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ
diff --git a/apps/pdfcraft-android/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/apps/pdfcraft-android/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
index e09c629..47a9619 100644
Binary files a/apps/pdfcraft-android/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and b/apps/pdfcraft-android/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ
diff --git a/apps/pdfcraft-android/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png b/apps/pdfcraft-android/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png
new file mode 100644
index 0000000..aeb96d6
Binary files /dev/null and b/apps/pdfcraft-android/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png differ
diff --git a/apps/pdfcraft-android/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_monochrome.png b/apps/pdfcraft-android/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_monochrome.png
new file mode 100644
index 0000000..823640c
Binary files /dev/null and b/apps/pdfcraft-android/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_monochrome.png differ
diff --git a/apps/pdfcraft-android/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/apps/pdfcraft-android/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
index e09c629..4aa649d 100644
Binary files a/apps/pdfcraft-android/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png and b/apps/pdfcraft-android/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ
diff --git a/apps/pdfcraft-android/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/apps/pdfcraft-android/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
index bde64ec..288e72a 100644
Binary files a/apps/pdfcraft-android/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and b/apps/pdfcraft-android/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ
diff --git a/apps/pdfcraft-android/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png b/apps/pdfcraft-android/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png
new file mode 100644
index 0000000..baac923
Binary files /dev/null and b/apps/pdfcraft-android/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png differ
diff --git a/apps/pdfcraft-android/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_monochrome.png b/apps/pdfcraft-android/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_monochrome.png
new file mode 100644
index 0000000..45731b4
Binary files /dev/null and b/apps/pdfcraft-android/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_monochrome.png differ
diff --git a/apps/pdfcraft-android/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/apps/pdfcraft-android/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
index bde64ec..9688f5c 100644
Binary files a/apps/pdfcraft-android/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png and b/apps/pdfcraft-android/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ
diff --git a/apps/pdfcraft-android/android/app/src/main/res/values-ar/strings.xml b/apps/pdfcraft-android/android/app/src/main/res/values-ar/strings.xml
index 45139c8..2273d90 100644
--- a/apps/pdfcraft-android/android/app/src/main/res/values-ar/strings.xml
+++ b/apps/pdfcraft-android/android/app/src/main/res/values-ar/strings.xml
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
- ClearPDF's Arabic translation. The English original is values/strings.xml.
+ Artefact's Arabic translation. The English original is values/strings.xml.
Resource names and format arguments follow the upstream English catalog.
Arabic plurals include zero, one, two, few, many and other.
-->
<resources>
- <string name="open_with">فتح باستخدام ClearPDF</string>
+ <string name="open_with">فتح باستخدام Artefact</string>
<string name="common_ok">موافق</string>
<string name="common_cancel">إلغاء</string>
<string name="common_done">تم</string>
@@ -75,7 +75,7 @@
<string name="home_no_starred_body">ميّز ملفًا من قائمته لتجده هنا بسرعة.</string>
<string name="home_device_files_title">الملفات على جهازك</string>
<string name="home_device_files_body">اختر مجلدات لعرض ملفات PDF منها، مثل المستندات أو مجلد داخل التنزيلات. ستبقى الملفات التي تفتحها من أي مكان في قائمة الأخيرة.</string>
- <string name="home_device_files_body_long">اختر مجلدات لعرض ملفات PDF منها، مثل المستندات أو مجلد داخل التنزيلات. لا يسمح Android للتطبيقات بعرض مجلد التنزيلات كاملًا. لا يصل ClearPDF إلا إلى المجلدات التي تختارها، وتبقى الملفات التي تفتحها من أي مكان في قائمة الأخيرة.</string>
+ <string name="home_device_files_body_long">اختر مجلدات لعرض ملفات PDF منها، مثل المستندات أو مجلد داخل التنزيلات. لا يسمح Android للتطبيقات بعرض مجلد التنزيلات كاملًا. لا يصل Artefact إلا إلى المجلدات التي تختارها، وتبقى الملفات التي تفتحها من أي مكان في قائمة الأخيرة.</string>
<string name="home_no_pdfs_title">لا توجد ملفات PDF في مجلداتك</string>
<string name="home_no_pdfs_body">ستظهر هنا ملفات PDF الموجودة في المجلدات التي أضفتها.</string>
<string name="home_add_folder">إضافة مجلد</string>
@@ -157,16 +157,16 @@
<string name="home_sort_newest">الأحدث تعديلًا</string>
<string name="home_no_results">لا توجد نتائج</string>
<string name="home_no_results_body">تحقق من الكتابة أو جرّب اسمًا أقصر.</string>
- <string name="home_about_app">حول ClearPDF</string>
+ <string name="home_about_app">حول Artefact</string>
<string name="home_preferences">التفضيلات</string>
<string name="home_help_support">المساعدة والدعم</string>
<string name="home_help">المساعدة</string>
<string name="home_report_problem">الإبلاغ عن مشكلة أو طلب ميزة</string>
- <string name="home_leaving_title">مغادرة ClearPDF</string>
+ <string name="home_leaving_title">مغادرة Artefact</string>
<string name="home_continue">متابعة</string>
<string name="home_leaving_body">سيُفتح موقع في متصفحك.</string>
<string name="home_section_notifications">الإشعارات</string>
- <string name="home_no_notifications">لا يرسل ClearPDF إشعارات.</string>
+ <string name="home_no_notifications">لا يرسل Artefact إشعارات.</string>
<string name="home_section_suggestions">الاقتراحات التلقائية</string>
<string name="home_offer_suggestions">اقتراح كلمات استخدمتها سابقًا عند تعبئة النماذج</string>
<string name="home_clear_suggestions">مسح الاقتراحات</string>
@@ -179,7 +179,7 @@
<string name="home_keyboard_shortcuts">اختصارات لوحة المفاتيح</string>
<string name="home_keyboard_shortcuts_body">عند توصيل لوحة مفاتيح: N أو Page Down للصفحة التالية، وP أو Page Up للسابقة، والأسهم للتمرير، وCtrl+P للطباعة، وCtrl مع + أو − للتكبير والتصغير.</string>
<string name="home_section_extra">ميزات إضافية</string>
- <string name="home_extra_body">خيارات إضافية لتخصيص مظهر ClearPDF وطريقة عمله.</string>
+ <string name="home_extra_body">خيارات إضافية لتخصيص مظهر Artefact وطريقة عمله.</string>
<string name="home_status_bar_in_documents">إظهار شريط الحالة داخل المستندات</string>
<string name="home_status_bar_in_documents_body">يظهر شريط الحالة مع أشرطة الأدوات. عند الضغط لإخفائها، يستخدم المستند الشاشة كاملة، بما فيها المساحة حول الكاميرا.</string>
<string name="home_search_count">إظهار عدد نتائج البحث</string>
@@ -349,7 +349,7 @@
<string name="voice_play_audio">تشغيل الصوت</string>
<string name="voice_comment_kind">تعليق صوتي</string>
<string name="voice_mic_title">السماح باستخدام الميكروفون؟</string>
- <string name="voice_mic_rationale">يحتاج ClearPDF إلى الميكروفون لتسجيل التعليقات الصوتية. يمكنك السماح بذلك من إعدادات التطبيق.</string>
+ <string name="voice_mic_rationale">يحتاج Artefact إلى الميكروفون لتسجيل التعليقات الصوتية. يمكنك السماح بذلك من إعدادات التطبيق.</string>
<string name="voice_open_settings">فتح الإعدادات</string>
<string name="voice_not_now">ليس الآن</string>
<string name="pages_title">الصفحات</string>
@@ -403,7 +403,7 @@
<string name="sign_remove_id_description">إزالة الهوية الرقمية لـ %1$s</string>
<string name="sign_remove_id_title">إزالة الهوية الرقمية؟</string>
<string name="sign_remove">إزالة</string>
- <string name="sign_remove_id_message">ستُزال الهوية الرقمية لـ %1$s من ClearPDF. تحتفظ المستندات الموقّعة مسبقًا بتوقيعاتها.</string>
+ <string name="sign_remove_id_message">ستُزال الهوية الرقمية لـ %1$s من Artefact. تحتفظ المستندات الموقّعة مسبقًا بتوقيعاتها.</string>
<string name="sign_add">إضافة</string>
<string name="sign_id_password_prompt">أدخل كلمة المرور التي تحمي %1$s.</string>
<string name="sign_create_about">الهوية الرقمية المنشأة هنا موقّعة ذاتيًا: يكشف المستند الموقّع بها أي تغيير بعد التوقيع، لكن لا توجد جهة مستقلة تثبت هويتك. لإثبات الهوية، استخدم ملف هوية تصدره مؤسسة أو جهة تصديق.</string>
@@ -416,7 +416,7 @@
<string name="sign_password_again">أعد كتابة كلمة المرور</string>
<string name="sign_password_short">تحتاج كلمة المرور إلى 8 أحرف على الأقل.</string>
<string name="sign_password_mismatch">كلمتا المرور غير متطابقتين.</string>
- <string name="sign_password_note">لا يحتفظ ClearPDF بكلمة المرور ولا يمكنه استعادتها؛ أدخلها عند كل توقيع.</string>
+ <string name="sign_password_note">لا يحتفظ Artefact بكلمة المرور ولا يمكنه استعادتها؛ أدخلها عند كل توقيع.</string>
<string name="sign_add_your_signature">إضافة توقيعك</string>
<string name="sign_signatures">التوقيعات</string>
<string name="sign_none">لا توجد توقيعات في هذا المستند.</string>
@@ -669,10 +669,10 @@
<string name="forms_reset">إعادة ضبط</string>
<string name="forms_previous_field">الحقل السابق</string>
<string name="forms_next_field">الحقل التالي</string>
- <string name="msg_engine_not_started">تعذّر بدء ClearPDF.</string>
+ <string name="msg_engine_not_started">تعذّر بدء Artefact.</string>
<string name="msg_file_moved">نُقل هذا الملف أو حُذف.</string>
- <string name="msg_opened_own_copy">تم فتح نسخة ClearPDF. لتعديل الأصل، افتحه مجددًا من التطبيق الموجود فيه.</string>
- <string name="msg_file_access_lost">تعذّر على ClearPDF فتح هذا الملف. افتحه مجددًا من التطبيق الموجود فيه أو باستخدام «فتح ملف».</string>
+ <string name="msg_opened_own_copy">تم فتح نسخة Artefact. لتعديل الأصل، افتحه مجددًا من التطبيق الموجود فيه.</string>
+ <string name="msg_file_access_lost">تعذّر على Artefact فتح هذا الملف. افتحه مجددًا من التطبيق الموجود فيه أو باستخدام «فتح ملف».</string>
<string name="msg_undone">تم التراجع عن %1$s</string>
<string name="msg_redone">تمت إعادة %1$s</string>
<string name="msg_tool_blocked_security">هذه الأداة غير متاحة بسبب إعدادات أمان المستند.</string>
@@ -707,7 +707,7 @@
<string name="msg_sign_read_only">لا يمكن تعديل هذا المستند، لذلك لا يمكن توقيعه.</string>
<string name="msg_id_cannot_sign">لا يمكن لهذه الهوية الرقمية توقيع المستندات. %1$s</string>
<string name="msg_id_added">أُضيفت الهوية الرقمية الخاصة بـ %1$s</string>
- <string name="msg_id_unusable">لا يستطيع ClearPDF استخدام هذا الملف كهوية رقمية: %1$s</string>
+ <string name="msg_id_unusable">لا يستطيع Artefact استخدام هذا الملف كهوية رقمية: %1$s</string>
<string name="msg_busy_creating_id">جارٍ إنشاء هويتك الرقمية…</string>
<string name="msg_id_created">أُنشئت الهوية الرقمية</string>
<string name="msg_busy_signing">جارٍ التوقيع…</string>
@@ -734,7 +734,7 @@
<string name="msg_picture_unreadable">تعذّرت قراءة الصورة.</string>
<string name="msg_gif_not_supported">لا يمكن إضافة صور GIF.</string>
<string name="msg_form_cleared">تم مسح النموذج</string>
- <string name="msg_button_submit">يرسل هذا الزر النموذج عبر الإنترنت، ولا يدعم ClearPDF ذلك.</string>
+ <string name="msg_button_submit">يرسل هذا الزر النموذج عبر الإنترنت، ولا يدعم Artefact ذلك.</string>
<string name="msg_suggestions_cleared">تم مسح الاقتراحات</string>
<string name="msg_that_file_unreadable">تعذّرت قراءة ذلك الملف.</string>
<string name="msg_named_file_unreadable">تعذّرت قراءة %1$s.</string>
@@ -750,11 +750,11 @@
<string name="msg_busy_exporting_page">جارٍ تصدير الصفحة %1$d من %2$d…</string>
<plurals name="msg_images_saved">
<item quantity="zero">لم تُحفظ أي صورة</item>
- <item quantity="one">حُفظت صورة واحدة في Pictures/ClearPDF</item>
- <item quantity="two">حُفظت صورتان في Pictures/ClearPDF</item>
- <item quantity="few">حُفظت %1$d صور في Pictures/ClearPDF</item>
- <item quantity="many">حُفظت %1$d صورة في Pictures/ClearPDF</item>
- <item quantity="other">حُفظت %1$d صورة في Pictures/ClearPDF</item>
+ <item quantity="one">حُفظت صورة واحدة في Pictures/Artefact</item>
+ <item quantity="two">حُفظت صورتان في Pictures/Artefact</item>
+ <item quantity="few">حُفظت %1$d صور في Pictures/Artefact</item>
+ <item quantity="many">حُفظت %1$d صورة في Pictures/Artefact</item>
+ <item quantity="other">حُفظت %1$d صورة في Pictures/Artefact</item>
</plurals>
<string name="msg_busy_creating_pdf">جارٍ إنشاء PDF…</string>
<plurals name="msg_create_first_files">
diff --git a/apps/pdfcraft-android/android/app/src/main/res/values-de/strings.xml b/apps/pdfcraft-android/android/app/src/main/res/values-de/strings.xml
index 961effb..3da2060 100644
--- a/apps/pdfcraft-android/android/app/src/main/res/values-de/strings.xml
+++ b/apps/pdfcraft-android/android/app/src/main/res/values-de/strings.xml
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
- ClearPDF's text, in German. The English original is values/strings.xml.
+ Artefact's text, in German. The English original is values/strings.xml.
-->
<resources>
- <string name="open_with">In ClearPDF öffnen</string>
+ <string name="open_with">In Artefact öffnen</string>
<!-- Shared: buttons and words used on many screens -->
<string name="common_ok">OK</string>
@@ -90,7 +90,7 @@
<string name="home_device_files_title">Dateien auf deinem Gerät</string>
<string name="home_device_files_body">Wähle Ordner aus, deren PDFs angezeigt werden sollen, z. B. „Dokumente“ oder einen Ordner im Ordner „Download“. Dateien, die du von einem beliebigen Ort öffnest, bleiben unter „Zuletzt verwendet“.</string>
<!-- On this device, before any folder is added: the longer explanation -->
- <string name="home_device_files_body_long">Wähle Ordner aus, deren PDFs angezeigt werden sollen, z. B. „Dokumente“ oder einen Ordner im Ordner „Download“ (Android erlaubt Apps nicht, den gesamten Ordner „Download“ aufzulisten). ClearPDF sieht nur die Ordner, die du auswählst. Dateien, die du von einem beliebigen Ort öffnest, bleiben unter „Zuletzt verwendet“.</string>
+ <string name="home_device_files_body_long">Wähle Ordner aus, deren PDFs angezeigt werden sollen, z. B. „Dokumente“ oder einen Ordner im Ordner „Download“ (Android erlaubt Apps nicht, den gesamten Ordner „Download“ aufzulisten). Artefact sieht nur die Ordner, die du auswählst. Dateien, die du von einem beliebigen Ort öffnest, bleiben unter „Zuletzt verwendet“.</string>
<string name="home_no_pdfs_title">Keine PDFs in deinen Ordnern</string>
<string name="home_no_pdfs_body">PDFs in den hinzugefügten Ordnern werden hier angezeigt.</string>
<string name="home_add_folder">Ordner hinzufügen</string>
@@ -193,18 +193,18 @@
<string name="home_no_results_body">Überprüfe die Schreibweise oder versuche einen kürzeren Namen.</string>
<!-- Settings -->
- <string name="home_about_app">Über ClearPDF</string>
+ <string name="home_about_app">Über Artefact</string>
<string name="home_preferences">Einstellungen</string>
<string name="home_help_support">Hilfe und Support</string>
<string name="home_help">Hilfe</string>
<string name="home_report_problem">Problem melden oder Funktion vorschlagen</string>
- <string name="home_leaving_title">ClearPDF verlassen</string>
+ <string name="home_leaving_title">Artefact verlassen</string>
<string name="home_continue">Weiter</string>
<string name="home_leaving_body">Dadurch wird eine Webseite in deinem Browser geöffnet.</string>
<!-- Settings: Preferences -->
<string name="home_section_notifications">Benachrichtigungen</string>
- <string name="home_no_notifications">ClearPDF sendet keine Benachrichtigungen.</string>
+ <string name="home_no_notifications">Artefact sendet keine Benachrichtigungen.</string>
<string name="home_section_suggestions">Automatische Vorschläge</string>
<string name="home_offer_suggestions">Beim Ausfüllen von Formularen zuvor verwendete Wörter vorschlagen</string>
<string name="home_clear_suggestions">Vorschläge löschen</string>
@@ -219,13 +219,13 @@
<!-- N, P, Page Down, Page Up, Ctrl+P, Ctrl, + and − are keys on the keyboard -->
<string name="home_keyboard_shortcuts_body">Bei angeschlossener Tastatur: N oder Bild-ab für die nächste Seite, P oder Bild-auf für die vorherige Seite, Pfeiltasten zum Scrollen, Strg+P zum Drucken und Strg zusammen mit + oder − zum Zoomen.</string>
<string name="home_section_extra">Zusatzfunktionen</string>
- <string name="home_extra_body">Optionale Änderungen am Aussehen und Verhalten von ClearPDF.</string>
+ <string name="home_extra_body">Optionale Änderungen am Aussehen und Verhalten von Artefact.</string>
<string name="home_status_bar_in_documents">Statusleiste in Dokumenten anzeigen</string>
<string name="home_status_bar_in_documents_body">Die Statusleiste wird zusammen mit den Symbolleisten angezeigt. Wenn du sie durch Tippen ausblendest, nutzt die Seite den gesamten Bildschirm, auch den Bereich um die Kamera.</string>
<string name="home_search_count">Anzahl der Suchergebnisse anzeigen</string>
<string name="home_search_count_body">Bei der Dokumentsuche wird angezeigt, welches Ergebnis du gerade ansiehst und wie viele es insgesamt gibt, z. B. 3 von 12.</string>
- <!-- Settings: About ClearPDF -->
+ <!-- Settings: About Artefact -->
<string name="home_section_about">Über</string>
<!-- %1$s is the app's version, %2$s the engine's version -->
<string name="home_version">Version %1$s (Engine %2$s)</string>
@@ -489,7 +489,7 @@
<!-- Voice comments: the microphone was refused before -->
<string name="voice_mic_title">Mikrofon verwenden?</string>
- <string name="voice_mic_rationale">ClearPDF benötigt das Mikrofon, um Sprachkommentare aufzunehmen. Du kannst den Zugriff in den App-Einstellungen erlauben.</string>
+ <string name="voice_mic_rationale">Artefact benötigt das Mikrofon, um Sprachkommentare aufzunehmen. Du kannst den Zugriff in den App-Einstellungen erlauben.</string>
<string name="voice_open_settings">Einstellungen öffnen</string>
<string name="voice_not_now">Nicht jetzt</string>
@@ -573,7 +573,7 @@
<string name="sign_remove_id_title">Digitale ID entfernen?</string>
<string name="sign_remove">Entfernen</string>
<!-- Translator note: %1$s is the person's name on the digital ID -->
- <string name="sign_remove_id_message">Die digitale ID von %1$s wird aus ClearPDF entfernt. Dokumente, die bereits damit unterschrieben wurden, behalten ihre Unterschriften.</string>
+ <string name="sign_remove_id_message">Die digitale ID von %1$s wird aus Artefact entfernt. Dokumente, die bereits damit unterschrieben wurden, behalten ihre Unterschriften.</string>
<!-- Digital signatures: the password of a digital ID file being added -->
<string name="sign_add">Hinzufügen</string>
@@ -592,7 +592,7 @@
<string name="sign_password_again">Passwort erneut eingeben</string>
<string name="sign_password_short">Das Passwort muss mindestens 8 Zeichen lang sein.</string>
<string name="sign_password_mismatch">Die Passwörter stimmen nicht überein.</string>
- <string name="sign_password_note">ClearPDF speichert das Passwort nicht und kann es nicht wiederherstellen. Du musst es bei jeder Unterschrift erneut eingeben.</string>
+ <string name="sign_password_note">Artefact speichert das Passwort nicht und kann es nicht wiederherstellen. Du musst es bei jeder Unterschrift erneut eingeben.</string>
<!-- Digital signatures: tapping an empty signature field -->
<string name="sign_add_your_signature">Unterschrift hinzufügen</string>
@@ -965,11 +965,11 @@
<!-- Messages: notices at the bottom of the screen, progress, errors -->
<!-- ================================================================== -->
<!-- Messages: opening documents -->
- <string name="msg_engine_not_started">ClearPDF konnte nicht gestartet werden.</string>
+ <string name="msg_engine_not_started">Artefact konnte nicht gestartet werden.</string>
<string name="msg_file_moved">Diese Datei wurde verschoben oder gelöscht.</string>
- <string name="msg_opened_own_copy">Die Kopie von ClearPDF wurde geöffnet. Um das Original zu ändern, öffne es erneut in der App, in der es sich befindet.</string>
+ <string name="msg_opened_own_copy">Die Kopie von Artefact wurde geöffnet. Um das Original zu ändern, öffne es erneut in der App, in der es sich befindet.</string>
<!-- "Open file" is the name of the button on Home that picks a file. -->
- <string name="msg_file_access_lost">ClearPDF kann diese Datei nicht mehr öffnen. Öffne sie erneut in der App, in der sie sich befindet, oder über „Datei öffnen“.</string>
+ <string name="msg_file_access_lost">Artefact kann diese Datei nicht mehr öffnen. Öffne sie erneut in der App, in der sie sich befindet, oder über „Datei öffnen“.</string>
<!-- Messages: undo and redo. %1$s is the name of the edit, as the engine gives it (for example "Add comment"). -->
<string name="msg_undone">%1$s rückgängig gemacht</string>
@@ -1036,7 +1036,7 @@
<!-- %1$s is the name of the person the digital ID belongs to. -->
<string name="msg_id_added">Digitale ID von %1$s hinzugefügt</string>
<!-- %1$s is the reason the file was refused. -->
- <string name="msg_id_unusable">ClearPDF kann diese Datei nicht als digitale ID verwenden: %1$s</string>
+ <string name="msg_id_unusable">Artefact kann diese Datei nicht als digitale ID verwenden: %1$s</string>
<string name="msg_busy_creating_id">Deine digitale ID wird erstellt …</string>
<string name="msg_id_created">Digitale ID erstellt</string>
<string name="msg_busy_signing">Wird unterschrieben …</string>
@@ -1068,7 +1068,7 @@
<!-- Messages: forms -->
<string name="msg_form_cleared">Formular geleert</string>
- <string name="msg_button_submit">Diese Schaltfläche sendet das Formular online. ClearPDF führt diese Aktion nicht aus.</string>
+ <string name="msg_button_submit">Diese Schaltfläche sendet das Formular online. Artefact führt diese Aktion nicht aus.</string>
<!-- Words remembered from form fields, offered while typing. -->
<string name="msg_suggestions_cleared">Vorschläge gelöscht</string>
@@ -1089,10 +1089,10 @@
<string name="msg_busy_exporting_images">Bilder werden exportiert …</string>
<!-- %1$d is the page being exported, %2$d how many pages there are. -->
<string name="msg_busy_exporting_page">Seite %1$d von %2$d wird exportiert …</string>
- <!-- Pictures/ClearPDF is a folder on the phone: keep it as it is. -->
+ <!-- Pictures/Artefact is a folder on the phone: keep it as it is. -->
<plurals name="msg_images_saved">
- <item quantity="one">%1$d Bild wurde in Pictures/ClearPDF gespeichert</item>
- <item quantity="other">%1$d Bilder wurden in Pictures/ClearPDF gespeichert</item>
+ <item quantity="one">%1$d Bild wurde in Pictures/Artefact gespeichert</item>
+ <item quantity="other">%1$d Bilder wurden in Pictures/Artefact gespeichert</item>
</plurals>
<string name="msg_busy_creating_pdf">PDF wird erstellt …</string>
<!-- Create PDF takes at most this many files at once. -->
diff --git a/apps/pdfcraft-android/android/app/src/main/res/values-es/strings.xml b/apps/pdfcraft-android/android/app/src/main/res/values-es/strings.xml
index f85081f..ab4ccfb 100644
--- a/apps/pdfcraft-android/android/app/src/main/res/values-es/strings.xml
+++ b/apps/pdfcraft-android/android/app/src/main/res/values-es/strings.xml
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
- ClearPDF's text, in Spanish (Spain). The English original is values/strings.xml.
+ Artefact's text, in Spanish (Spain). The English original is values/strings.xml.
- To translate ClearPDF: copy this file to res/values-<language>/strings.xml (values-es for
+ To translate Artefact: copy this file to res/values-<language>/strings.xml (values-es for
Spanish, values-pt-rBR for Brazilian Portuguese, values-zh-rCN for simplified Chinese) and
translate the text between the tags. Keep each name, every placeholder (%1$s, %2$d: the
number says which value goes there, so a translation may move them), escapes such as \' and
@@ -10,7 +10,7 @@
few, many). A string left out shows in English.
-->
<resources>
- <string name="open_with">Abrir con ClearPDF</string>
+ <string name="open_with">Abrir con Artefact</string>
<!-- Shared: buttons and words used on many screens -->
<string name="common_ok">Aceptar</string>
@@ -97,7 +97,7 @@
<string name="home_device_files_title">Archivos de tu dispositivo</string>
<string name="home_device_files_body">Elige las carpetas de las que listar PDF, como Documentos o una carpeta dentro de Descargas. Los archivos que abras desde cualquier sitio se quedan en Recientes.</string>
<!-- On this device, before any folder is added: the longer explanation -->
- <string name="home_device_files_body_long">Elige las carpetas de las que listar PDF, como Documentos o una carpeta dentro de Descargas (Android no permite a las apps listar toda la carpeta Descargas). ClearPDF solo ve las carpetas que elijas, y los archivos que abras desde cualquier sitio se quedan en Recientes.</string>
+ <string name="home_device_files_body_long">Elige las carpetas de las que listar PDF, como Documentos o una carpeta dentro de Descargas (Android no permite a las apps listar toda la carpeta Descargas). Artefact solo ve las carpetas que elijas, y los archivos que abras desde cualquier sitio se quedan en Recientes.</string>
<string name="home_no_pdfs_title">No hay PDF en tus carpetas</string>
<string name="home_no_pdfs_body">Los PDF de las carpetas que añadiste aparecerán aquí.</string>
<string name="home_add_folder">Añadir carpeta</string>
@@ -200,18 +200,18 @@
<string name="home_no_results_body">Revisa la ortografía o prueba con un nombre más corto.</string>
<!-- Settings -->
- <string name="home_about_app">Acerca de ClearPDF</string>
+ <string name="home_about_app">Acerca de Artefact</string>
<string name="home_preferences">Preferencias</string>
<string name="home_help_support">Ayuda y soporte</string>
<string name="home_help">Ayuda</string>
<string name="home_report_problem">Informar de un problema o pedir una función</string>
- <string name="home_leaving_title">Sales de ClearPDF</string>
+ <string name="home_leaving_title">Sales de Artefact</string>
<string name="home_continue">Continuar</string>
<string name="home_leaving_body">Esto abre una página web en tu navegador.</string>
<!-- Settings: Preferences -->
<string name="home_section_notifications">Notificaciones</string>
- <string name="home_no_notifications">ClearPDF no envía notificaciones.</string>
+ <string name="home_no_notifications">Artefact no envía notificaciones.</string>
<string name="home_section_suggestions">Sugerencias automáticas</string>
<string name="home_offer_suggestions">Sugerir palabras que ya usaste al rellenar formularios</string>
<string name="home_clear_suggestions">Borrar sugerencias</string>
@@ -226,13 +226,13 @@
<!-- N, P, Page Down, Page Up, Ctrl+P, Ctrl, + and − are keys on the keyboard -->
<string name="home_keyboard_shortcuts_body">Con un teclado conectado: N o Av Pág para la página siguiente, P o Re Pág para la anterior, las flechas para desplazarte, Ctrl+P para imprimir y Ctrl y + o − para ampliar.</string>
<string name="home_section_extra">Funciones extra</string>
- <string name="home_extra_body">Cambios opcionales en el aspecto y el funcionamiento de ClearPDF.</string>
+ <string name="home_extra_body">Cambios opcionales en el aspecto y el funcionamiento de Artefact.</string>
<string name="home_status_bar_in_documents">Mostrar la barra de estado en los documentos</string>
<string name="home_status_bar_in_documents_body">La barra de estado se muestra con las barras de herramientas. Al tocar para ocultarlas, la página ocupa toda la pantalla, también alrededor de la cámara.</string>
<string name="home_search_count">Mostrar el número de resultados de búsqueda</string>
<string name="home_search_count_body">Buscar en un documento muestra en qué resultado estás y cuántos hay, por ejemplo 3 de 12.</string>
- <!-- Settings: About ClearPDF -->
+ <!-- Settings: About Artefact -->
<string name="home_section_about">Acerca de</string>
<!-- %1$s is the app's version, %2$s the engine's version -->
<string name="home_version">Versión %1$s (motor %2$s)</string>
@@ -496,7 +496,7 @@
<!-- Voice comments: the microphone was refused before -->
<string name="voice_mic_title">¿Usar el micrófono?</string>
- <string name="voice_mic_rationale">ClearPDF necesita el micrófono para grabar comentarios de voz. Puedes permitirlo en los ajustes de la app.</string>
+ <string name="voice_mic_rationale">Artefact necesita el micrófono para grabar comentarios de voz. Puedes permitirlo en los ajustes de la app.</string>
<string name="voice_open_settings">Abrir ajustes</string>
<string name="voice_not_now">Ahora no</string>
@@ -580,7 +580,7 @@
<string name="sign_remove_id_title">¿Quitar el ID digital?</string>
<string name="sign_remove">Quitar</string>
<!-- Translator note: %1$s is the person's name on the digital ID -->
- <string name="sign_remove_id_message">Se quita de ClearPDF el ID digital de %1$s. Los documentos ya firmados con él conservan sus firmas.</string>
+ <string name="sign_remove_id_message">Se quita de Artefact el ID digital de %1$s. Los documentos ya firmados con él conservan sus firmas.</string>
<!-- Digital signatures: the password of a digital ID file being added -->
<string name="sign_add">Añadir</string>
@@ -599,7 +599,7 @@
<string name="sign_password_again">La contraseña otra vez</string>
<string name="sign_password_short">La contraseña necesita al menos 8 caracteres.</string>
<string name="sign_password_mismatch">Las contraseñas no coinciden.</string>
- <string name="sign_password_note">ClearPDF no guarda la contraseña y no puede recuperarla: la escribes cada vez que firmas.</string>
+ <string name="sign_password_note">Artefact no guarda la contraseña y no puede recuperarla: la escribes cada vez que firmas.</string>
<!-- Digital signatures: tapping an empty signature field -->
<string name="sign_add_your_signature">Añade tu firma</string>
@@ -973,11 +973,11 @@
<!-- Messages: notices at the bottom of the screen, progress, errors -->
<!-- ================================================================== -->
<!-- Messages: opening documents -->
- <string name="msg_engine_not_started">No se pudo iniciar ClearPDF.</string>
+ <string name="msg_engine_not_started">No se pudo iniciar Artefact.</string>
<string name="msg_file_moved">Este archivo se ha movido o eliminado.</string>
- <string name="msg_opened_own_copy">Se abrió la copia de ClearPDF. Para cambiar el original, ábrelo de nuevo desde la app donde está.</string>
+ <string name="msg_opened_own_copy">Se abrió la copia de Artefact. Para cambiar el original, ábrelo de nuevo desde la app donde está.</string>
<!-- "Open file" is the name of the button on Home that picks a file. -->
- <string name="msg_file_access_lost">ClearPDF ya no puede abrir este archivo. Ábrelo de nuevo desde la app donde está o con Abrir archivo.</string>
+ <string name="msg_file_access_lost">Artefact ya no puede abrir este archivo. Ábrelo de nuevo desde la app donde está o con Abrir archivo.</string>
<!-- Messages: undo and redo. %1$s is the name of the edit, as the engine gives it (for example "Add comment"). -->
<string name="msg_undone">%1$s deshecho</string>
@@ -1044,7 +1044,7 @@
<!-- %1$s is the name of the person the digital ID belongs to. -->
<string name="msg_id_added">ID digital de %1$s añadido</string>
<!-- %1$s is the reason the file was refused. -->
- <string name="msg_id_unusable">ClearPDF no puede usar este archivo como ID digital: %1$s</string>
+ <string name="msg_id_unusable">Artefact no puede usar este archivo como ID digital: %1$s</string>
<string name="msg_busy_creating_id">Creando tu ID digital…</string>
<string name="msg_id_created">ID digital creado</string>
<string name="msg_busy_signing">Firmando…</string>
@@ -1076,7 +1076,7 @@
<!-- Messages: forms -->
<string name="msg_form_cleared">Formulario borrado</string>
- <string name="msg_button_submit">Este botón envía el formulario por internet, algo que ClearPDF no hace.</string>
+ <string name="msg_button_submit">Este botón envía el formulario por internet, algo que Artefact no hace.</string>
<!-- Words remembered from form fields, offered while typing. -->
<string name="msg_suggestions_cleared">Sugerencias borradas</string>
@@ -1097,10 +1097,10 @@
<string name="msg_busy_exporting_images">Exportando imágenes…</string>
<!-- %1$d is the page being exported, %2$d how many pages there are. -->
<string name="msg_busy_exporting_page">Exportando página %1$d de %2$d…</string>
- <!-- Pictures/ClearPDF is a folder on the phone: keep it as it is. -->
+ <!-- Pictures/Artefact is a folder on the phone: keep it as it is. -->
<plurals name="msg_images_saved">
- <item quantity="one">%1$d imagen guardada en Pictures/ClearPDF</item>
- <item quantity="other">%1$d imágenes guardadas en Pictures/ClearPDF</item>
+ <item quantity="one">%1$d imagen guardada en Pictures/Artefact</item>
+ <item quantity="other">%1$d imágenes guardadas en Pictures/Artefact</item>
</plurals>
<string name="msg_busy_creating_pdf">Creando PDF…</string>
<!-- Create PDF takes at most this many files at once. -->
diff --git a/apps/pdfcraft-android/android/app/src/main/res/values-fr/strings.xml b/apps/pdfcraft-android/android/app/src/main/res/values-fr/strings.xml
index 4ce62e9..e9f3ebe 100644
--- a/apps/pdfcraft-android/android/app/src/main/res/values-fr/strings.xml
+++ b/apps/pdfcraft-android/android/app/src/main/res/values-fr/strings.xml
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
- Textes de ClearPDF, en français (France).
+ Textes de Artefact, en français (France).
-->
<resources>
- <string name="open_with">Ouvrir dans ClearPDF</string>
+ <string name="open_with">Ouvrir dans Artefact</string>
<!-- Shared: buttons and words used on many screens -->
<string name="common_ok">OK</string>
@@ -90,7 +90,7 @@
<string name="home_device_files_title">Fichiers sur votre appareil</string>
<string name="home_device_files_body">Choisissez les dossiers où chercher des PDF, comme Documents ou un dossier dans Téléchargements. Les fichiers ouverts depuis n\'importe où restent dans Récents.</string>
<!-- On this device, before any folder is added: the longer explanation -->
- <string name="home_device_files_body_long">Choisissez les dossiers où chercher des PDF, comme Documents ou un dossier dans Téléchargements (Android ne permet pas aux applications de lister tout le dossier Téléchargements). ClearPDF ne voit que les dossiers que vous choisissez, et les fichiers ouverts depuis n\'importe où restent dans Récents.</string>
+ <string name="home_device_files_body_long">Choisissez les dossiers où chercher des PDF, comme Documents ou un dossier dans Téléchargements (Android ne permet pas aux applications de lister tout le dossier Téléchargements). Artefact ne voit que les dossiers que vous choisissez, et les fichiers ouverts depuis n\'importe où restent dans Récents.</string>
<string name="home_no_pdfs_title">Aucun PDF dans vos dossiers</string>
<string name="home_no_pdfs_body">Les PDF des dossiers ajoutés apparaîtront ici.</string>
<string name="home_add_folder">Ajouter un dossier</string>
@@ -193,18 +193,18 @@
<string name="home_no_results_body">Vérifiez l\'orthographe ou essayez un nom plus court.</string>
<!-- Settings -->
- <string name="home_about_app">À propos de ClearPDF</string>
+ <string name="home_about_app">À propos de Artefact</string>
<string name="home_preferences">Préférences</string>
<string name="home_help_support">Aide et assistance</string>
<string name="home_help">Aide</string>
<string name="home_report_problem">Signaler un problème ou demander une fonctionnalité</string>
- <string name="home_leaving_title">Quitter ClearPDF</string>
+ <string name="home_leaving_title">Quitter Artefact</string>
<string name="home_continue">Continuer</string>
<string name="home_leaving_body">Une page web va s\'ouvrir dans votre navigateur.</string>
<!-- Settings: Preferences -->
<string name="home_section_notifications">Notifications</string>
- <string name="home_no_notifications">ClearPDF n\'envoie pas de notifications.</string>
+ <string name="home_no_notifications">Artefact n\'envoie pas de notifications.</string>
<string name="home_section_suggestions">Suggestions automatiques</string>
<string name="home_offer_suggestions">Proposer les mots déjà utilisés pour remplir les formulaires</string>
<string name="home_clear_suggestions">Effacer les suggestions</string>
@@ -219,13 +219,13 @@
<!-- N, P, Page Down, Page Up, Ctrl+P, Ctrl, + and − are keys on the keyboard -->
<string name="home_keyboard_shortcuts_body">Avec un clavier connecté : N ou Page suivante pour la page suivante, P ou Page précédente pour la page précédente, les flèches pour faire défiler, Ctrl+P pour imprimer, Ctrl et + ou − pour zoomer.</string>
<string name="home_section_extra">Fonctionnalités supplémentaires</string>
- <string name="home_extra_body">Modifications facultatives de l\'apparence et du fonctionnement de ClearPDF.</string>
+ <string name="home_extra_body">Modifications facultatives de l\'apparence et du fonctionnement de Artefact.</string>
<string name="home_status_bar_in_documents">Afficher la barre d\'état dans les documents</string>
<string name="home_status_bar_in_documents_body">La barre d\'état s\'affiche avec les barres d\'outils. Quand vous touchez l\'écran pour les masquer, la page occupe tout l\'écran, y compris autour de la caméra.</string>
<string name="home_search_count">Afficher le nombre de résultats de recherche</string>
<string name="home_search_count_body">La recherche dans un document indique à quel résultat vous êtes et combien il y en a, par exemple 3 sur 12.</string>
- <!-- Settings: About ClearPDF -->
+ <!-- Settings: About Artefact -->
<string name="home_section_about">À propos</string>
<!-- %1$s is the app's version, %2$s the engine's version -->
<string name="home_version">Version %1$s (moteur %2$s)</string>
@@ -473,7 +473,7 @@
<!-- Voice comments: the microphone was refused before -->
<string name="voice_mic_title">Utiliser le microphone ?</string>
- <string name="voice_mic_rationale">ClearPDF a besoin du microphone pour enregistrer des commentaires vocaux. Vous pouvez l\'autoriser dans les réglages de l\'application.</string>
+ <string name="voice_mic_rationale">Artefact a besoin du microphone pour enregistrer des commentaires vocaux. Vous pouvez l\'autoriser dans les réglages de l\'application.</string>
<string name="voice_open_settings">Ouvrir les réglages</string>
<string name="voice_not_now">Pas maintenant</string>
@@ -537,7 +537,7 @@
<string name="sign_remove_id_description">Supprimer l\'identité numérique de %1$s</string>
<string name="sign_remove_id_title">Supprimer l\'identité numérique ?</string>
<string name="sign_remove">Supprimer</string>
- <string name="sign_remove_id_message">L\'identité numérique de %1$s est supprimée de ClearPDF. Les documents déjà signés avec elle conservent leurs signatures.</string>
+ <string name="sign_remove_id_message">L\'identité numérique de %1$s est supprimée de Artefact. Les documents déjà signés avec elle conservent leurs signatures.</string>
<!-- Digital signatures: the password of a digital ID file being added -->
<string name="sign_add">Ajouter</string>
@@ -554,7 +554,7 @@
<string name="sign_password_again">Répétez le mot de passe</string>
<string name="sign_password_short">Le mot de passe doit comporter au moins 8 caractères.</string>
<string name="sign_password_mismatch">Les mots de passe ne correspondent pas.</string>
- <string name="sign_password_note">ClearPDF ne conserve pas le mot de passe et ne peut pas le récupérer : vous le saisissez à chaque signature.</string>
+ <string name="sign_password_note">Artefact ne conserve pas le mot de passe et ne peut pas le récupérer : vous le saisissez à chaque signature.</string>
<!-- Digital signatures: tapping an empty signature field -->
<string name="sign_add_your_signature">Ajouter votre signature</string>
@@ -873,10 +873,10 @@
<!-- Messages: notices at the bottom of the screen, progress, errors -->
<!-- ================================================================== -->
<!-- Messages: opening documents -->
- <string name="msg_engine_not_started">ClearPDF n\'a pas pu démarrer.</string>
+ <string name="msg_engine_not_started">Artefact n\'a pas pu démarrer.</string>
<string name="msg_file_moved">Ce fichier a été déplacé ou supprimé.</string>
- <string name="msg_opened_own_copy">Copie de ClearPDF ouverte. Pour modifier l\'original, rouvrez-le depuis l\'application où il se trouve.</string>
- <string name="msg_file_access_lost">ClearPDF ne peut plus ouvrir ce fichier. Rouvrez-le depuis l\'application où il se trouve, ou avec Ouvrir un fichier.</string>
+ <string name="msg_opened_own_copy">Copie de Artefact ouverte. Pour modifier l\'original, rouvrez-le depuis l\'application où il se trouve.</string>
+ <string name="msg_file_access_lost">Artefact ne peut plus ouvrir ce fichier. Rouvrez-le depuis l\'application où il se trouve, ou avec Ouvrir un fichier.</string>
<!-- Messages: undo and redo. %1$s is the name of the edit, as the engine gives it (for example "Add comment"). -->
<string name="msg_undone">%1$s annulé</string>
@@ -935,7 +935,7 @@
<string name="msg_sign_read_only">Ce document ne peut pas être modifié, il ne peut donc pas être signé.</string>
<string name="msg_id_cannot_sign">Cette identité numérique ne peut pas signer de documents. %1$s</string>
<string name="msg_id_added">Identité numérique de %1$s ajoutée</string>
- <string name="msg_id_unusable">ClearPDF ne peut pas utiliser ce fichier comme identité numérique : %1$s</string>
+ <string name="msg_id_unusable">Artefact ne peut pas utiliser ce fichier comme identité numérique : %1$s</string>
<string name="msg_busy_creating_id">Création de votre identité numérique…</string>
<string name="msg_id_created">Identité numérique créée</string>
<string name="msg_busy_signing">Signature…</string>
@@ -965,7 +965,7 @@
<!-- Messages: forms -->
<string name="msg_form_cleared">Formulaire effacé</string>
- <string name="msg_button_submit">Ce bouton envoie le formulaire en ligne, ce que ClearPDF ne fait pas.</string>
+ <string name="msg_button_submit">Ce bouton envoie le formulaire en ligne, ce que Artefact ne fait pas.</string>
<string name="msg_suggestions_cleared">Suggestions effacées</string>
<!-- Messages: picked files. %1$s is a file name. -->
@@ -983,10 +983,10 @@
<string name="msg_busy_exporting_to">Export en %1$s…</string>
<string name="msg_busy_exporting_images">Export des images…</string>
<string name="msg_busy_exporting_page">Export de la page %1$d sur %2$d…</string>
- <!-- Pictures/ClearPDF is a folder on the phone: keep it as it is. -->
+ <!-- Pictures/Artefact is a folder on the phone: keep it as it is. -->
<plurals name="msg_images_saved">
- <item quantity="one">%1$d image enregistrée dans Pictures/ClearPDF</item>
- <item quantity="other">%1$d images enregistrées dans Pictures/ClearPDF</item>
+ <item quantity="one">%1$d image enregistrée dans Pictures/Artefact</item>
+ <item quantity="other">%1$d images enregistrées dans Pictures/Artefact</item>
</plurals>
<string name="msg_busy_creating_pdf">Création du PDF…</string>
<!-- Create PDF takes at most this many files at once. -->
diff --git a/apps/pdfcraft-android/android/app/src/main/res/values-it/strings.xml b/apps/pdfcraft-android/android/app/src/main/res/values-it/strings.xml
index 5f05de2..ff15bba 100644
--- a/apps/pdfcraft-android/android/app/src/main/res/values-it/strings.xml
+++ b/apps/pdfcraft-android/android/app/src/main/res/values-it/strings.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
- Traduzione italiana completa di ClearPDF.
+ Traduzione italiana completa di Artefact.
Percorso: res/values-it/strings.xml
@@ -9,7 +9,7 @@
mantenuti compatibili con le risorse Android.
-->
<resources>
- <string name="open_with">Apri in ClearPDF</string>
+ <string name="open_with">Apri in Artefact</string>
<!-- ================================================================ -->
<!-- Elementi comuni: pulsanti e termini condivisi -->
@@ -106,7 +106,7 @@
<string name="home_no_starred_body">Aggiungi un file ai preferiti dal suo menu per ritrovarlo rapidamente qui.</string>
<string name="home_device_files_title">File sul dispositivo</string>
<string name="home_device_files_body">Scegli le cartelle da cui elencare i PDF, ad esempio Documenti o una cartella all\'interno di Download. I file che apri da qualsiasi posizione rimangono in Recenti.</string>
- <string name="home_device_files_body_long">Scegli le cartelle da cui elencare i PDF, ad esempio Documenti o una cartella all\'interno di Download (Android non consente alle app di elencare l\'intera cartella Download). ClearPDF può accedere solo alle cartelle che scegli e i file che apri da qualsiasi posizione rimangono in Recenti.</string>
+ <string name="home_device_files_body_long">Scegli le cartelle da cui elencare i PDF, ad esempio Documenti o una cartella all\'interno di Download (Android non consente alle app di elencare l\'intera cartella Download). Artefact può accedere solo alle cartelle che scegli e i file che apri da qualsiasi posizione rimangono in Recenti.</string>
<string name="home_no_pdfs_title">Nessun PDF nelle tue cartelle</string>
<string name="home_no_pdfs_body">I PDF presenti nelle cartelle che hai aggiunto verranno visualizzati qui.</string>
<string name="home_add_folder">Aggiungi una cartella</string>
@@ -200,19 +200,19 @@
<!-- Impostazioni -->
- <string name="home_about_app">Informazioni su ClearPDF</string>
+ <string name="home_about_app">Informazioni su Artefact</string>
<string name="home_preferences">Preferenze</string>
<string name="home_help_support">Guida e supporto</string>
<string name="home_help">Guida</string>
<string name="home_report_problem">Segnala un problema o suggerisci una funzionalità</string>
- <string name="home_leaving_title">Uscita da ClearPDF</string>
+ <string name="home_leaving_title">Uscita da Artefact</string>
<string name="home_continue">Continua</string>
<string name="home_leaving_body">Verrà aperta una pagina web nel browser.</string>
<!-- Preferenze -->
<string name="home_section_notifications">Notifiche</string>
- <string name="home_no_notifications">ClearPDF non invia notifiche.</string>
+ <string name="home_no_notifications">Artefact non invia notifiche.</string>
<string name="home_section_suggestions">Suggerimenti automatici</string>
<string name="home_offer_suggestions">Suggerisci le parole utilizzate in precedenza durante la compilazione dei moduli</string>
<string name="home_clear_suggestions">Cancella suggerimenti</string>
@@ -225,13 +225,13 @@
<string name="home_keyboard_shortcuts">Scorciatoie da tastiera</string>
<string name="home_keyboard_shortcuts_body">Con una tastiera collegata: N o PagGiù per la pagina successiva, P o PagSu per quella precedente, i tasti freccia per scorrere, Ctrl+P per stampare, Ctrl e + o − per modificare lo zoom.</string>
<string name="home_section_extra">Funzioni extra</string>
- <string name="home_extra_body">Modifiche facoltative all\'aspetto e al funzionamento di ClearPDF.</string>
+ <string name="home_extra_body">Modifiche facoltative all\'aspetto e al funzionamento di Artefact.</string>
<string name="home_status_bar_in_documents">Mostra la barra di stato nei documenti</string>
<string name="home_status_bar_in_documents_body">La barra di stato appare insieme alle barre degli strumenti. Quando tocchi per nasconderle, la pagina usa tutto lo schermo, anche intorno alla fotocamera.</string>
<string name="home_search_count">Mostra il numero dei risultati di ricerca</string>
<string name="home_search_count_body">La ricerca in un documento mostra a quale risultato sei e quanti ce ne sono, ad esempio 3 di 12.</string>
- <!-- Informazioni su ClearPDF -->
+ <!-- Informazioni su Artefact -->
<string name="home_section_about">Informazioni</string>
<string name="home_version">Versione %1$s (motore %2$s)</string>
@@ -499,7 +499,7 @@
<!-- Autorizzazione del microfono -->
<string name="voice_mic_title">Utilizzare il microfono?</string>
- <string name="voice_mic_rationale">ClearPDF necessita dell\'accesso al microfono per registrare commenti vocali. Puoi autorizzarlo nelle impostazioni dell\'app.</string>
+ <string name="voice_mic_rationale">Artefact necessita dell\'accesso al microfono per registrare commenti vocali. Puoi autorizzarlo nelle impostazioni dell\'app.</string>
<string name="voice_open_settings">Apri impostazioni</string>
<string name="voice_not_now">Non ora</string>
@@ -570,7 +570,7 @@
<string name="sign_remove_id_description">Rimuovi l\'ID digitale di %1$s</string>
<string name="sign_remove_id_title">Rimuovere l\'ID digitale?</string>
<string name="sign_remove">Rimuovi</string>
- <string name="sign_remove_id_message">L\'ID digitale di %1$s verrà rimosso da ClearPDF. I documenti già firmati con questo ID manterranno le rispettive firme.</string>
+ <string name="sign_remove_id_message">L\'ID digitale di %1$s verrà rimosso da Artefact. I documenti già firmati con questo ID manterranno le rispettive firme.</string>
<!-- Password del file ID digitale -->
@@ -589,7 +589,7 @@
<string name="sign_password_again">Ripeti la password</string>
<string name="sign_password_short">La password deve contenere almeno 6 caratteri.</string>
<string name="sign_password_mismatch">Le password non corrispondono.</string>
- <string name="sign_password_note">ClearPDF non conserva la password e non può recuperarla: dovrai inserirla ogni volta che firmi.</string>
+ <string name="sign_password_note">Artefact non conserva la password e non può recuperarla: dovrai inserirla ogni volta che firmi.</string>
<!-- Campo firma vuoto -->
@@ -958,10 +958,10 @@
<!-- Apertura dei documenti -->
- <string name="msg_engine_not_started">Impossibile avviare ClearPDF.</string>
+ <string name="msg_engine_not_started">Impossibile avviare Artefact.</string>
<string name="msg_file_moved">Questo file è stato spostato o eliminato.</string>
- <string name="msg_opened_own_copy">È stata aperta la copia di ClearPDF. Per modificare l\'originale, aprilo nuovamente dall\'app in cui si trova.</string>
- <string name="msg_file_access_lost">ClearPDF non può più aprire questo file. Aprilo nuovamente dall\'app in cui si trova oppure utilizzando Apri file.</string>
+ <string name="msg_opened_own_copy">È stata aperta la copia di Artefact. Per modificare l\'originale, aprilo nuovamente dall\'app in cui si trova.</string>
+ <string name="msg_file_access_lost">Artefact non può più aprire questo file. Aprilo nuovamente dall\'app in cui si trova oppure utilizzando Apri file.</string>
<!-- Annulla e ripristina -->
@@ -1032,7 +1032,7 @@
<string name="msg_sign_read_only">Questo documento non può essere modificato, quindi non può essere firmato.</string>
<string name="msg_id_cannot_sign">Questo ID digitale non può firmare documenti. %1$s</string>
<string name="msg_id_added">ID digitale di %1$s aggiunto</string>
- <string name="msg_id_unusable">ClearPDF non può utilizzare questo file come ID digitale: %1$s</string>
+ <string name="msg_id_unusable">Artefact non può utilizzare questo file come ID digitale: %1$s</string>
<string name="msg_busy_creating_id">Creazione dell\'ID digitale…</string>
<string name="msg_id_created">ID digitale creato</string>
<string name="msg_busy_signing">Firma in corso…</string>
@@ -1064,7 +1064,7 @@
<!-- Moduli -->
<string name="msg_form_cleared">Modulo cancellato</string>
- <string name="msg_button_submit">Questo pulsante invia il modulo online, operazione non supportata da ClearPDF.</string>
+ <string name="msg_button_submit">Questo pulsante invia il modulo online, operazione non supportata da Artefact.</string>
<string name="msg_suggestions_cleared">Suggerimenti cancellati</string>
<!-- File selezionati -->
@@ -1085,8 +1085,8 @@
<string name="msg_busy_exporting_images">Esportazione delle immagini…</string>
<string name="msg_busy_exporting_page">Esportazione della pagina %1$d di %2$d…</string>
<plurals name="msg_images_saved">
- <item quantity="one">%1$d immagine salvata in Pictures/ClearPDF</item>
- <item quantity="other">%1$d immagini salvate in Pictures/ClearPDF</item>
+ <item quantity="one">%1$d immagine salvata in Pictures/Artefact</item>
+ <item quantity="other">%1$d immagini salvate in Pictures/Artefact</item>
</plurals>
<string name="msg_busy_creating_pdf">Creazione del PDF…</string>
<plurals name="msg_create_first_files">
diff --git a/apps/pdfcraft-android/android/app/src/main/res/values-night/themes.xml b/apps/pdfcraft-android/android/app/src/main/res/values-night/themes.xml
index 63f443b..d81a76a 100644
--- a/apps/pdfcraft-android/android/app/src/main/res/values-night/themes.xml
+++ b/apps/pdfcraft-android/android/app/src/main/res/values-night/themes.xml
@@ -1,10 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
- <color name="window_background">#FF1D1D1D</color>
+ <color name="window_background">#FF0E191E</color>
- <style name="Theme.ClearPDF" parent="android:Theme.Material.NoActionBar">
+ <style name="Theme.Artefact" parent="android:Theme.Material.NoActionBar">
<item name="android:windowBackground">@color/window_background</item>
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:navigationBarColor">@android:color/transparent</item>
+ <item name="android:windowSplashScreenBackground">@color/window_background</item>
+ <item name="android:windowSplashScreenAnimatedIcon">@mipmap/ic_launcher_foreground</item>
+ <item name="android:windowSplashScreenIconBackgroundColor">@android:color/white</item>
+ </style>
+
+ <style name="Theme.Artefact.Preview" parent="android:Theme.Material.NoActionBar">
+ <item name="android:windowIsTranslucent">true</item>
+ <item name="android:windowBackground">@android:color/transparent</item>
+ <item name="android:windowNoTitle">true</item>
+ <item name="android:backgroundDimEnabled">false</item>
+ <item name="android:windowAnimationStyle">@null</item>
+ <item name="android:statusBarColor">@android:color/transparent</item>
+ <item name="android:navigationBarColor">@android:color/transparent</item>
+ <item name="android:windowContentOverlay">@null</item>
+ <item name="android:windowDisablePreview">true</item>
</style>
</resources>
diff --git a/apps/pdfcraft-android/android/app/src/main/res/values-pt-rBR/strings.xml b/apps/pdfcraft-android/android/app/src/main/res/values-pt-rBR/strings.xml
index e403b91..138c6d9 100644
--- a/apps/pdfcraft-android/android/app/src/main/res/values-pt-rBR/strings.xml
+++ b/apps/pdfcraft-android/android/app/src/main/res/values-pt-rBR/strings.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
- <string name="open_with">Abrir no ClearPDF</string>
+ <string name="open_with">Abrir no Artefact</string>
<string name="common_ok">OK</string>
<string name="common_cancel">Cancelar</string>
<string name="common_done">Concluído</string>
@@ -70,7 +70,7 @@
<string name="home_no_starred_body">Marque um arquivo como favorito no menu para encontrá-lo aqui rapidamente.</string>
<string name="home_device_files_title">Arquivos no seu dispositivo</string>
<string name="home_device_files_body">Escolha pastas para listar PDFs, como Documentos ou uma pasta dentro de Downloads. Os arquivos abertos de qualquer lugar ficam em Recentes.</string>
- <string name="home_device_files_body_long">Escolha pastas para listar PDFs, como Documentos ou uma pasta dentro de Downloads (o Android não permite que apps listem toda a pasta Downloads). O ClearPDF só vê as pastas escolhidas, e os arquivos abertos de qualquer lugar ficam em Recentes.</string>
+ <string name="home_device_files_body_long">Escolha pastas para listar PDFs, como Documentos ou uma pasta dentro de Downloads (o Android não permite que apps listem toda a pasta Downloads). O Artefact só vê as pastas escolhidas, e os arquivos abertos de qualquer lugar ficam em Recentes.</string>
<string name="home_no_pdfs_title">Nenhum PDF nas suas pastas</string>
<string name="home_no_pdfs_body">Os PDFs nas pastas adicionadas aparecerão aqui.</string>
<string name="home_add_folder">Adicionar uma pasta</string>
@@ -140,16 +140,16 @@
<string name="home_sort_newest">Modificados mais recentemente</string>
<string name="home_no_results">Nenhum resultado</string>
<string name="home_no_results_body">Confira a ortografia ou tente um nome mais curto.</string>
- <string name="home_about_app">Sobre o ClearPDF</string>
+ <string name="home_about_app">Sobre o Artefact</string>
<string name="home_preferences">Preferências</string>
<string name="home_help_support">Ajuda e suporte</string>
<string name="home_help">Ajuda</string>
<string name="home_report_problem">Relatar um problema ou pedir um recurso</string>
- <string name="home_leaving_title">Saindo do ClearPDF</string>
+ <string name="home_leaving_title">Saindo do Artefact</string>
<string name="home_continue">Continuar</string>
<string name="home_leaving_body">Isso abrirá uma página da Web no seu navegador.</string>
<string name="home_section_notifications">Notificações</string>
- <string name="home_no_notifications">O ClearPDF não envia notificações.</string>
+ <string name="home_no_notifications">O Artefact não envia notificações.</string>
<string name="home_section_suggestions">Sugestões automáticas</string>
<string name="home_offer_suggestions">Sugerir palavras já usadas ao preencher formulários</string>
<string name="home_clear_suggestions">Limpar sugestões</string>
@@ -162,7 +162,7 @@
<string name="home_keyboard_shortcuts">Atalhos do teclado</string>
<string name="home_keyboard_shortcuts_body">Com um teclado conectado: N ou Page Down para a próxima página, P ou Page Up para a anterior, as setas para rolar, Ctrl+P para imprimir e Ctrl e + ou − para ampliar ou reduzir.</string>
<string name="home_section_extra">Recursos extras</string>
- <string name="home_extra_body">Alterações opcionais na aparência e no funcionamento do ClearPDF.</string>
+ <string name="home_extra_body">Alterações opcionais na aparência e no funcionamento do Artefact.</string>
<string name="home_status_bar_in_documents">Mostrar a barra de status nos documentos</string>
<string name="home_status_bar_in_documents_body">A barra de status aparece junto com as barras de ferramentas. Ao tocar para ocultá-las, a página ocupa a tela toda, inclusive ao redor da câmera.</string>
<string name="home_search_count">Mostrar o número de resultados da pesquisa</string>
@@ -328,7 +328,7 @@
<string name="voice_play_audio">Reproduzir áudio</string>
<string name="voice_comment_kind">Comentário de voz</string>
<string name="voice_mic_title">Usar o microfone?</string>
- <string name="voice_mic_rationale">O ClearPDF precisa do microfone para gravar comentários de voz. Você pode permitir o acesso nas configurações do app.</string>
+ <string name="voice_mic_rationale">O Artefact precisa do microfone para gravar comentários de voz. Você pode permitir o acesso nas configurações do app.</string>
<string name="voice_open_settings">Abrir configurações</string>
<string name="voice_not_now">Agora não</string>
<string name="pages_title">Páginas</string>
@@ -378,7 +378,7 @@
<string name="sign_remove_id_description">Remover a ID digital de %1$s</string>
<string name="sign_remove_id_title">Remover ID digital?</string>
<string name="sign_remove">Remover</string>
- <string name="sign_remove_id_message">A ID digital de %1$s será removida do ClearPDF. Os documentos já assinados com ela manterão as assinaturas.</string>
+ <string name="sign_remove_id_message">A ID digital de %1$s será removida do Artefact. Os documentos já assinados com ela manterão as assinaturas.</string>
<string name="sign_add">Adicionar</string>
<string name="sign_id_password_prompt">Digite a senha que protege %1$s.</string>
<string name="sign_create_about">Uma ID digital criada aqui é autoassinada: um documento assinado com ela mostra qualquer alteração feita depois da assinatura, mas ninguém mais confirma que é você. Para isso, use o arquivo de ID fornecido por uma organização ou autoridade certificadora.</string>
@@ -391,7 +391,7 @@
<string name="sign_password_again">Digite a senha novamente</string>
<string name="sign_password_short">A senha precisa ter pelo menos 8 caracteres.</string>
<string name="sign_password_mismatch">As senhas não correspondem.</string>
- <string name="sign_password_note">O ClearPDF não guarda nem recupera a senha: você precisa digitá-la sempre que assinar.</string>
+ <string name="sign_password_note">O Artefact não guarda nem recupera a senha: você precisa digitá-la sempre que assinar.</string>
<string name="sign_add_your_signature">Adicionar sua assinatura</string>
<string name="sign_signatures">Assinaturas</string>
<string name="sign_none">Este documento não tem assinaturas.</string>
@@ -632,10 +632,10 @@
<string name="forms_reset">Redefinir</string>
<string name="forms_previous_field">Campo anterior</string>
<string name="forms_next_field">Próximo campo</string>
- <string name="msg_engine_not_started">Não foi possível iniciar o ClearPDF.</string>
+ <string name="msg_engine_not_started">Não foi possível iniciar o Artefact.</string>
<string name="msg_file_moved">Este arquivo foi movido ou excluído.</string>
- <string name="msg_opened_own_copy">Cópia do ClearPDF aberta. Para alterar o original, abra-o novamente no app em que ele está.</string>
- <string name="msg_file_access_lost">O ClearPDF não consegue mais abrir este arquivo. Abra-o novamente no app em que ele está ou use Abrir arquivo.</string>
+ <string name="msg_opened_own_copy">Cópia do Artefact aberta. Para alterar o original, abra-o novamente no app em que ele está.</string>
+ <string name="msg_file_access_lost">O Artefact não consegue mais abrir este arquivo. Abra-o novamente no app em que ele está ou use Abrir arquivo.</string>
<string name="msg_undone">%1$s desfeito</string>
<string name="msg_redone">%1$s refeito</string>
<string name="msg_tool_blocked_security">Esta ferramenta não está disponível devido às configurações de segurança do documento.</string>
@@ -670,7 +670,7 @@
<string name="msg_sign_read_only">Este documento não pode ser alterado nem assinado.</string>
<string name="msg_id_cannot_sign">Esta ID digital não pode assinar documentos. %1$s</string>
<string name="msg_id_added">ID digital de %1$s adicionada</string>
- <string name="msg_id_unusable">O ClearPDF não pode usar este arquivo como ID digital: %1$s</string>
+ <string name="msg_id_unusable">O Artefact não pode usar este arquivo como ID digital: %1$s</string>
<string name="msg_busy_creating_id">Criando sua ID digital…</string>
<string name="msg_id_created">ID digital criada</string>
<string name="msg_busy_signing">Assinando…</string>
@@ -693,7 +693,7 @@
<string name="msg_picture_unreadable">Não foi possível ler a imagem.</string>
<string name="msg_gif_not_supported">Não é possível adicionar imagens GIF.</string>
<string name="msg_form_cleared">Formulário limpo</string>
- <string name="msg_button_submit">Este botão enviaria o formulário pela internet, o que o ClearPDF não faz.</string>
+ <string name="msg_button_submit">Este botão enviaria o formulário pela internet, o que o Artefact não faz.</string>
<string name="msg_suggestions_cleared">Sugestões limpas</string>
<string name="msg_that_file_unreadable">Não foi possível ler esse arquivo.</string>
<string name="msg_named_file_unreadable">Não foi possível ler %1$s.</string>
@@ -708,8 +708,8 @@
<string name="msg_busy_exporting_images">Exportando imagens…</string>
<string name="msg_busy_exporting_page">Exportando a página %1$d de %2$d…</string>
<plurals name="msg_images_saved">
- <item quantity="one">%1$d imagem salva em Pictures/ClearPDF</item>
- <item quantity="other">%1$d imagens salvas em Pictures/ClearPDF</item>
+ <item quantity="one">%1$d imagem salva em Pictures/Artefact</item>
+ <item quantity="other">%1$d imagens salvas em Pictures/Artefact</item>
</plurals>
<string name="msg_busy_creating_pdf">Criando PDF…</string>
<plurals name="msg_create_first_files">
diff --git a/apps/pdfcraft-android/android/app/src/main/res/values/strings.xml b/apps/pdfcraft-android/android/app/src/main/res/values/strings.xml
index 6b0c2ba..9d7c3e8 100644
--- a/apps/pdfcraft-android/android/app/src/main/res/values/strings.xml
+++ b/apps/pdfcraft-android/android/app/src/main/res/values/strings.xml
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
- ClearPDF's text, in US English.
+ Artefact's text, in US English.
- To translate ClearPDF: copy this file to res/values-<language>/strings.xml (values-es for
+ To translate Artefact: copy this file to res/values-<language>/strings.xml (values-es for
Spanish, values-pt-rBR for Brazilian Portuguese, values-zh-rCN for simplified Chinese) and
translate the text between the tags. Keep each name, every placeholder (%1$s, %2$d: the
number says which value goes there, so a translation may move them), escapes such as \' and
@@ -10,8 +10,8 @@
few, many). A string left out shows in English.
-->
<resources>
- <string name="app_name" translatable="false">ClearPDF</string>
- <string name="open_with">Open in ClearPDF</string>
+ <string name="app_name" translatable="false">Artefact</string>
+ <string name="open_with">Open in Artefact</string>
<!-- Shared: buttons and words used on many screens -->
<string name="common_ok">OK</string>
@@ -98,7 +98,7 @@
<string name="home_device_files_title">Files on your device</string>
<string name="home_device_files_body">Choose folders to list PDFs from, such as Documents or a folder inside Download. Files you open from anywhere stay in Recent.</string>
<!-- On this device, before any folder is added: the longer explanation -->
- <string name="home_device_files_body_long">Choose folders to list PDFs from, such as Documents or a folder inside Download (Android doesn\'t let apps list the whole Download folder). ClearPDF sees only the folders you choose, and files you open from anywhere stay in Recent.</string>
+ <string name="home_device_files_body_long">Choose folders to list PDFs from, such as Documents or a folder inside Download (Android doesn\'t let apps list the whole Download folder). Artefact sees only the folders you choose, and files you open from anywhere stay in Recent.</string>
<string name="home_no_pdfs_title">No PDFs in your folders</string>
<string name="home_no_pdfs_body">PDFs in the folders you added will appear here.</string>
<string name="home_add_folder">Add a folder</string>
@@ -201,18 +201,18 @@
<string name="home_no_results_body">Check the spelling, or try a shorter name.</string>
<!-- Settings -->
- <string name="home_about_app">About ClearPDF</string>
+ <string name="home_about_app">About Artefact</string>
<string name="home_preferences">Preferences</string>
<string name="home_help_support">Help &amp; Support</string>
<string name="home_help">Help</string>
<string name="home_report_problem">Report a problem or request a feature</string>
- <string name="home_leaving_title">Leaving ClearPDF</string>
+ <string name="home_leaving_title">Leaving Artefact</string>
<string name="home_continue">Continue</string>
<string name="home_leaving_body">This opens a web page in your browser.</string>
<!-- Settings: Preferences -->
<string name="home_section_notifications">Notifications</string>
- <string name="home_no_notifications">ClearPDF doesn\'t send notifications.</string>
+ <string name="home_no_notifications">Artefact doesn\'t send notifications.</string>
<string name="home_section_suggestions">Auto-suggestions</string>
<string name="home_offer_suggestions">Offer words you used before when filling in forms</string>
<string name="home_clear_suggestions">Clear suggestions</string>
@@ -227,13 +227,13 @@
<!-- N, P, Page Down, Page Up, Ctrl+P, Ctrl, + and − are keys on the keyboard -->
<string name="home_keyboard_shortcuts_body">With a keyboard connected: N or Page Down for the next page, P or Page Up for the previous one, the arrow keys to scroll, Ctrl+P to print, Ctrl and + or − to zoom.</string>
<string name="home_section_extra">Extra Features</string>
- <string name="home_extra_body">Optional changes to how ClearPDF looks and works.</string>
+ <string name="home_extra_body">Optional changes to how Artefact looks and works.</string>
<string name="home_status_bar_in_documents">Show the status bar in documents</string>
<string name="home_status_bar_in_documents_body">The status bar shows with the toolbars. When you tap to hide them, the page uses the whole screen, around the camera too.</string>
<string name="home_search_count">Show the number of search results</string>
<string name="home_search_count_body">Find in a document shows which result you\'re on and how many there are, such as 3 of 12.</string>
- <!-- Settings: About ClearPDF -->
+ <!-- Settings: About Artefact -->
<string name="home_section_about">About</string>
<!-- %1$s is the app's version, %2$s the engine's version -->
<string name="home_version">Version %1$s (engine %2$s)</string>
@@ -244,7 +244,7 @@
<string name="home_source_code">Source code</string>
<string name="home_engine">PdfCraft engine</string>
<!-- Keep the licence names (MIT, Apache-2.0) and the trademark notice -->
- <string name="home_legal_notice">ClearPDF is built on the Rust engine of PdfCraft by storytold, and on PdfCraft for Android by the ArtCraft Team. MIT OR Apache-2.0. ClearPDF is not affiliated with Adobe; Acrobat is a trademark of Adobe Inc.</string>
+ <string name="home_legal_notice">Artefact is built on the Rust engine of PdfCraft by storytold, and on PdfCraft for Android by the ArtCraft Team. MIT OR Apache-2.0. Artefact is not affiliated with Adobe; Acrobat is a trademark of Adobe Inc.</string>
<!-- Tool screens: Compress PDF -->
<string name="tools_compress_action">Compress</string>
@@ -498,7 +498,7 @@
<!-- Voice comments: the microphone was refused before -->
<string name="voice_mic_title">Use the microphone?</string>
- <string name="voice_mic_rationale">ClearPDF needs the microphone to record voice comments. You can allow it in the app\'s settings.</string>
+ <string name="voice_mic_rationale">Artefact needs the microphone to record voice comments. You can allow it in the app\'s settings.</string>
<string name="voice_open_settings">Open settings</string>
<string name="voice_not_now">Not now</string>
@@ -582,7 +582,7 @@
<string name="sign_remove_id_title">Remove digital ID?</string>
<string name="sign_remove">Remove</string>
<!-- Translator note: %1$s is the person's name on the digital ID -->
- <string name="sign_remove_id_message">%1$s\'s digital ID is removed from ClearPDF. Documents already signed with it keep their signatures.</string>
+ <string name="sign_remove_id_message">%1$s\'s digital ID is removed from Artefact. Documents already signed with it keep their signatures.</string>
<!-- Digital signatures: the password of a digital ID file being added -->
<string name="sign_add">Add</string>
@@ -601,7 +601,7 @@
<string name="sign_password_again">The password again</string>
<string name="sign_password_short">The password needs at least 8 characters.</string>
<string name="sign_password_mismatch">The passwords don\'t match.</string>
- <string name="sign_password_note">ClearPDF doesn\'t keep the password and can\'t recover it: you type it each time you sign.</string>
+ <string name="sign_password_note">Artefact doesn\'t keep the password and can\'t recover it: you type it each time you sign.</string>
<!-- Digital signatures: tapping an empty signature field -->
<string name="sign_add_your_signature">Add your signature</string>
@@ -976,11 +976,11 @@
<!-- Messages: notices at the bottom of the screen, progress, errors -->
<!-- ================================================================== -->
<!-- Messages: opening documents -->
- <string name="msg_engine_not_started">ClearPDF couldn\'t start.</string>
+ <string name="msg_engine_not_started">Artefact couldn\'t start.</string>
<string name="msg_file_moved">This file has been moved or deleted.</string>
- <string name="msg_opened_own_copy">Opened ClearPDF\'s copy. To change the original, open it again from the app it\'s in.</string>
+ <string name="msg_opened_own_copy">Opened Artefact\'s copy. To change the original, open it again from the app it\'s in.</string>
<!-- "Open file" is the name of the button on Home that picks a file. -->
- <string name="msg_file_access_lost">ClearPDF can\'t open this file any more. Open it again from the app it\'s in, or with Open file.</string>
+ <string name="msg_file_access_lost">Artefact can\'t open this file any more. Open it again from the app it\'s in, or with Open file.</string>
<!-- Messages: undo and redo. %1$s is the name of the edit, as the engine gives it (for example "Add comment"). -->
<string name="msg_undone">%1$s undone</string>
@@ -1047,7 +1047,7 @@
<!-- %1$s is the name of the person the digital ID belongs to. -->
<string name="msg_id_added">Added %1$s\'s digital ID</string>
<!-- %1$s is the reason the file was refused. -->
- <string name="msg_id_unusable">ClearPDF can\'t use this file as a digital ID: %1$s</string>
+ <string name="msg_id_unusable">Artefact can\'t use this file as a digital ID: %1$s</string>
<string name="msg_busy_creating_id">Creating your digital ID…</string>
<string name="msg_id_created">Digital ID created</string>
<string name="msg_busy_signing">Signing…</string>
@@ -1079,7 +1079,7 @@
<!-- Messages: forms -->
<string name="msg_form_cleared">Form cleared</string>
- <string name="msg_button_submit">This button sends the form online, which ClearPDF doesn\'t do.</string>
+ <string name="msg_button_submit">This button sends the form online, which Artefact doesn\'t do.</string>
<!-- Words remembered from form fields, offered while typing. -->
<string name="msg_suggestions_cleared">Suggestions cleared</string>
@@ -1100,10 +1100,10 @@
<string name="msg_busy_exporting_images">Exporting images…</string>
<!-- %1$d is the page being exported, %2$d how many pages there are. -->
<string name="msg_busy_exporting_page">Exporting page %1$d of %2$d…</string>
- <!-- Pictures/ClearPDF is a folder on the phone: keep it as it is. -->
+ <!-- Pictures/Artefact is a folder on the phone: keep it as it is. -->
<plurals name="msg_images_saved">
- <item quantity="one">%1$d image saved to Pictures/ClearPDF</item>
- <item quantity="other">%1$d images saved to Pictures/ClearPDF</item>
+ <item quantity="one">%1$d image saved to Pictures/Artefact</item>
+ <item quantity="other">%1$d images saved to Pictures/Artefact</item>
</plurals>
<string name="msg_busy_creating_pdf">Creating PDF…</string>
<!-- Create PDF takes at most this many files at once. -->
@@ -1175,7 +1175,7 @@
<!-- Translator note: notification button that stops reading aloud -->
<string name="service_action_stop">Stop</string>
- <!-- ClearPDF's own screens (the desk, files, tools, settings) -->
+ <!-- Artefact's own screens (the desk, files, tools, settings) -->
<string name="desk_greeting_morning">Good morning,</string>
<string name="desk_greeting_afternoon">Good afternoon,</string>
<string name="desk_greeting_evening">Good evening,</string>
@@ -1230,6 +1230,119 @@
<string name="settings_forms">Forms</string>
<string name="settings_about">About</string>
<string name="settings_credits_title">Built with friends</string>
- <string name="settings_credits_body">ClearPDF runs on PdfCraft\'s Rust engine by storytold and PdfCraft for Android by the ArtCraft Team. Its glass is Kyant0\'s backdrop library.</string>
+ <string name="settings_credits_body">Artefact runs on PdfCraft\'s Rust engine by storytold and PdfCraft for Android by the ArtCraft Team. Its glass is Kyant0\'s backdrop library.</string>
<string name="settings_version">Version %1$s</string>
+
+ <!-- The desk (home): chips, titles, cards -->
+ <string name="desk_filter_all">All</string>
+ <string name="desk_filter_notes">Notes</string>
+ <string name="desk_filter_todo">To-Do</string>
+ <string name="desk_filter_pdfs">PDFs</string>
+ <string name="desk_filter_images">Images</string>
+ <string name="desk_filter_audio">Audio</string>
+ <string name="desk_title_all">Your Artefacts</string>
+ <string name="desk_title_notes">Your Notes</string>
+ <string name="desk_title_todo">To-Do Lists</string>
+ <string name="desk_title_pdfs">Your PDFs</string>
+ <string name="desk_title_images">Your Images</string>
+ <string name="desk_title_audio">Voice Notes</string>
+ <!-- One word, set large in a serif on a card: keep it short -->
+ <string name="desk_word_files">Files</string>
+ <string name="desk_word_pdf">Pdf</string>
+ <string name="desk_recent">Recent</string>
+ <string name="desk_chip_pdfs">PDFs</string>
+
+ <!-- Empty desk pages -->
+ <string name="empty_notes_title">A clean desk</string>
+ <string name="empty_notes_body">Jot down a thought, a plan, anything at all.</string>
+ <string name="empty_lists_title">No lists yet</string>
+ <string name="empty_lists_body">Shopping, packing, today\'s jobs: tick them off right on the card.</string>
+ <string name="empty_pdfs_title">No PDFs yet</string>
+ <string name="empty_pdfs_body">Open one, scan a page with the camera, or turn photos into a PDF.</string>
+ <string name="empty_images_title">No pictures yet</string>
+ <string name="empty_images_body">Add photos to a note and they gather here.</string>
+ <string name="empty_audio_title">Say something</string>
+ <string name="empty_audio_body">Tap the microphone and talk. Your voice notes stay on this phone.</string>
+
+ <!-- Making things (the + capsule) -->
+ <string name="create_note">New note</string>
+ <string name="create_list">To-do list</string>
+ <string name="create_photo_note">Photo note</string>
+ <string name="create_voice">Record a voice note</string>
+ <string name="voice_saved">Voice note saved</string>
+ <string name="voice_too_short">Too short to keep. Hold on a little longer.</string>
+
+ <!-- Notes -->
+ <string name="notes_untitled_note">Untitled note</string>
+ <string name="notes_untitled_list">To-Do</string>
+ <string name="notes_list_empty">Nothing on it yet</string>
+ <plurals name="notes_more_items">
+ <item quantity="one">%1$d more</item>
+ <item quantity="other">%1$d more</item>
+ </plurals>
+ <string name="notes_pin">Pin to the top</string>
+ <string name="notes_unpin">Unpin</string>
+ <string name="notes_open">Open</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>
+ <string name="notes_add_item">Add an item</string>
+ <string name="notes_clear_done">Clear ticked items</string>
+ <string name="notes_bold">Bold</string>
+ <string name="notes_heading">Heading</string>
+ <string name="notes_take_photo">Take a photo</string>
+ <string name="notes_add_photo">Add a photo</string>
+ <string name="notes_remove_picture">Remove picture</string>
+
+ <!-- What a fresh desk starts with -->
+ <string name="seed_list_title">Shopping List</string>
+ <string name="seed_list_1">Vegetables</string>
+ <string name="seed_list_2">Fruits</string>
+ <string name="seed_list_3">Grocery</string>
+ <string name="seed_note_title">Thought of the day</string>
+ <string name="seed_note_body">Every day is a fresh start. Embrace it with **hope and courage**, and let each moment inspire you to grow and shine **brighter** than before.</string>
+
+ <!-- The welcome pages -->
+ <string name="welcome_skip">Skip</string>
+ <string name="welcome_next">Continue</string>
+ <string name="welcome_start">Get started</string>
+ <string name="welcome_hello_eyebrow">Welcome to</string>
+ <string name="welcome_hello_title">Hello,</string>
+ <string name="welcome_card_highlights">Highlights</string>
+ <string name="welcome_card_overview">Daily overview</string>
+ <string name="welcome_note_body">Every day is a fresh start. Embrace it with hope and courage.</string>
+ <string name="welcome_desk_eyebrow">One desk</string>
+ <string name="welcome_desk_title">Everything you make,</string>
+ <string name="welcome_desk_accent">together.</string>
+ <string name="welcome_desk_body">PDFs, notes, to-do lists, photos and voice notes live side by side, each on its own card.</string>
+ <string name="welcome_tools_eyebrow">Real PDF tools</string>
+ <string name="welcome_tools_title">Read, sign and</string>
+ <string name="welcome_tools_accent">fill in.</string>
+ <string name="welcome_tools_body">Highlight, comment, sign, edit text, fill forms, scan paper and recognise its words, all on your phone.</string>
+ <string name="welcome_promise_eyebrow">Our promise</string>
+ <string name="welcome_promise_title">Yours, and</string>
+ <string name="welcome_promise_accent">only yours.</string>
+ <string name="welcome_promise_body">Artefact is free and open source, for everyone.</string>
+ <string name="welcome_promise_1">No ads, ever</string>
+ <string name="welcome_promise_2">No account to make</string>
+ <string name="welcome_promise_3">Your files never leave your phone</string>
+ <string name="settings_show_welcome">Show the welcome again</string>
+
+ <!-- Quick Preview: a file another app opens, shown in a floating card over that app -->
+ <string name="preview_title">Quick Preview</string>
+ <string name="preview_close">Close</string>
+ <string name="preview_expand">Open in Artefact</string>
+ <string name="preview_open_in_app">Open in Artefact</string>
+ <string name="preview_open">Open</string>
+ <string name="preview_save_downloads">Save to Downloads</string>
+ <string name="preview_saved_downloads">Saved to Downloads</string>
+ <string name="preview_locked_body">This PDF is locked. Type its password to look inside.</string>
+ <string name="preview_unlock">Unlock</string>
+ <string name="preview_failed_title">This one won\'t open</string>
+ <plurals name="preview_pages">
+ <item quantity="one">%1$d page</item>
+ <item quantity="other">%1$d pages</item>
+ </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>
</resources>
diff --git a/apps/pdfcraft-android/android/app/src/main/res/values/themes.xml b/apps/pdfcraft-android/android/app/src/main/res/values/themes.xml
index 3d63a31..d2a1c65 100644
--- a/apps/pdfcraft-android/android/app/src/main/res/values/themes.xml
+++ b/apps/pdfcraft-android/android/app/src/main/res/values/themes.xml
@@ -1,13 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
- <!-- the app's surface, so nothing flashes before the first frame -->
- <color name="window_background">#FFFFFFFF</color>
- <!-- PdfCraft green, the app icon's field (assets/app-icon/README.md) -->
- <color name="ic_launcher_background">#FFB70228</color>
+ <!-- the wallpaper's sky, so nothing flashes before the first frame -->
+ <color name="window_background">#FFA9BFE2</color>
+ <!-- the adaptive icon's field: the logo was drawn on white -->
+ <color name="ic_launcher_background">#FFFFFFFF</color>
- <style name="Theme.ClearPDF" parent="android:Theme.Material.Light.NoActionBar">
+ <style name="Theme.Artefact" parent="android:Theme.Material.Light.NoActionBar">
<item name="android:windowBackground">@color/window_background</item>
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:navigationBarColor">@android:color/transparent</item>
+ <item name="android:windowSplashScreenBackground">@color/window_background</item>
+ <item name="android:windowSplashScreenAnimatedIcon">@mipmap/ic_launcher_foreground</item>
+ <item name="android:windowSplashScreenIconBackgroundColor">@android:color/white</item>
+ </style>
+
+ <!--
+ Quick Preview: a floating window over the app that opened the file. Translucent, so that app
+ stays drawn behind it; no dim of the system's (the preview draws its own scrim and animates it).
+ -->
+ <style name="Theme.Artefact.Preview" parent="android:Theme.Material.Light.NoActionBar">
+ <item name="android:windowIsTranslucent">true</item>
+ <item name="android:windowBackground">@android:color/transparent</item>
+ <item name="android:windowNoTitle">true</item>
+ <item name="android:backgroundDimEnabled">false</item>
+ <item name="android:windowAnimationStyle">@null</item>
+ <item name="android:statusBarColor">@android:color/transparent</item>
+ <item name="android:navigationBarColor">@android:color/transparent</item>
+ <item name="android:windowContentOverlay">@null</item>
+ <item name="android:windowDisablePreview">true</item>
</style>
</resources>
diff --git a/apps/pdfcraft-android/android/app/src/main/res/xml/file_paths.xml b/apps/pdfcraft-android/android/app/src/main/res/xml/file_paths.xml
index 1714801..48eb174 100644
--- a/apps/pdfcraft-android/android/app/src/main/res/xml/file_paths.xml
+++ b/apps/pdfcraft-android/android/app/src/main/res/xml/file_paths.xml
@@ -1,7 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
-<!-- Files of PdfCraft's that another app may reach through its FileProvider: a document being
- shared, printed or opened in another app, and a photo the camera app takes for Scan -->
+<!-- Files of Artefact's that another app may reach through its FileProvider: a document being
+ shared, printed or opened in another app, a photo the camera app takes for Scan, and one it
+ takes for a note (written straight into the notes' media folder) -->
<paths>
<cache-path name="share" path="share/" />
<cache-path name="camera" path="camera/" />
+ <files-path name="notes" path="notes/media/" />
</paths>
diff --git a/apps/pdfcraft-android/android/gradle/libs.versions.toml b/apps/pdfcraft-android/android/gradle/libs.versions.toml
index 6fe0723..f90af89 100644
--- a/apps/pdfcraft-android/android/gradle/libs.versions.toml
+++ b/apps/pdfcraft-android/android/gradle/libs.versions.toml
@@ -2,6 +2,8 @@
agp = "9.2.1"
kotlin = "2.3.21"
composeBom = "2026.09.00"
+# Material 3 Expressive (LoadingIndicator, MaterialShapes): the beta, ahead of the BOM's stable
+material3 = "1.5.0-beta02"
coreKtx = "1.17.0"
lifecycle = "2.9.4"
activityCompose = "1.11.0"
@@ -23,7 +25,7 @@ androidx-compose-ui = { group = "androidx.compose.ui", name = "ui" }
androidx-compose-foundation = { group = "androidx.compose.foundation", name = "foundation" }
kyant-shapes = { group = "io.github.kyant0", name = "shapes", version.ref = "kyantShapes" }
androidx-compose-ui-graphics = { group = "androidx.compose.ui", name = "ui-graphics" }
-androidx-compose-material3 = { group = "androidx.compose.material3", name = "material3" }
+androidx-compose-material3 = { group = "androidx.compose.material3", name = "material3", version.ref = "material3" }
kotlinx-coroutines-android = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-android", version.ref = "kotlinxCoroutines" }
jna = { group = "net.java.dev.jna", name = "jna", version.ref = "jna" }
junit = { group = "junit", name = "junit", version.ref = "junit" }
diff --git a/fastlane/metadata/android/en-US/images/icon.png b/fastlane/metadata/android/en-US/images/icon.png
index eb3699f..921c250 100644
Binary files a/fastlane/metadata/android/en-US/images/icon.png and b/fastlane/metadata/android/en-US/images/icon.png differ