Open-source Android PDF and document toolkit with PDF tools, Office viewing, XLSX editing, scanning, and image editing. Built with Kotlin and Jetpack Compose.
Rust androiddocument-scannerdocximage-editorjetpack-composekotlinliquid-glassofflineopen-sourcepdfpdf-compressorpdf-editorpdf-mergerpdf-readerpdf-splitterpdf-toolspdf-viewerpptxspreadsheet-editorxlsx
Improve Artefact glass viewer and reader controls
chethan616b8a318c3adf1
diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ReadAloudService.kt b/android/app/src/main/java/com/chethan616/clearpdf/ReadAloudService.ktindex 9ad4372..6037c39 100644--- a/android/app/src/main/java/com/chethan616/clearpdf/ReadAloudService.kt+++ b/android/app/src/main/java/com/chethan616/clearpdf/ReadAloudService.kt@@ -8,7 +8,9 @@ import android.app.Serviceimport android.content.Contextimport android.content.Intentimport android.content.pm.ServiceInfo+import android.graphics.BitmapFactoryimport android.graphics.drawable.Icon+import android.media.MediaMetadataimport android.media.session.MediaSessionimport android.media.session.PlaybackStateimport android.os.Build@@ -63,10 +65,16 @@ class ReadAloudService : Service() {return START_NOT_STICKY}}- val title = intent?.getStringExtra(EXTRA_TITLE) ?: lastTitle+ val title = (intent?.getStringExtra(EXTRA_TITLE) ?: lastTitle).ifBlank { getString(R.string.app_name) }val playing = intent?.getBooleanExtra(EXTRA_PLAYING, lastPlaying) ?: lastPlayinglastTitle = titlelastPlaying = playing+ session?.setMetadata(+ MediaMetadata.Builder()+ .putString(MediaMetadata.METADATA_KEY_TITLE, title)+ .putString(MediaMetadata.METADATA_KEY_ARTIST, getString(R.string.common_tool_read_aloud))+ .build(),+ )session?.setPlaybackState(PlaybackState.Builder().setActions(PlaybackState.ACTION_PLAY or PlaybackState.ACTION_PAUSE or PlaybackState.ACTION_PLAY_PAUSE or PlaybackState.ACTION_REWIND or PlaybackState.ACTION_FAST_FORWARD or PlaybackState.ACTION_STOP)@@ -95,6 +103,11 @@ class ReadAloudService : Service() {.setSmallIcon(R.drawable.ic_stat_read_aloud).setContentTitle(title).setContentText(getString(if (playing) R.string.service_notification_reading else R.string.service_notification_paused))+ .setLargeIcon(BitmapFactory.decodeResource(resources, R.mipmap.ic_launcher))+ .setCategory(Notification.CATEGORY_TRANSPORT)+ .setColor(0xFF1683FF.toInt())+ .setOnlyAlertOnce(true)+ .setShowWhen(false).setContentIntent(open).setOngoing(playing).setDeleteIntent(PendingIntent.getService(this, 1, Intent(this, ReadAloudService::class.java).setAction(ACTION_STOP), PendingIntent.FLAG_IMMUTABLE))diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/desk/SettingsScreen.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/desk/SettingsScreen.ktindex 83cbf3b..0f83826 100644--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/desk/SettingsScreen.kt+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/desk/SettingsScreen.kt@@ -1,5 +1,7 @@package com.chethan616.clearpdf.ui.desk+import android.content.Intent+import android.speech.tts.TextToSpeechimport androidx.activity.compose.BackHandlerimport androidx.compose.foundation.Imageimport androidx.compose.foundation.background@@ -25,6 +27,7 @@ import androidx.compose.foundation.lazy.LazyColumnimport androidx.compose.material3.Iconimport androidx.compose.material3.Textimport androidx.compose.runtime.Composable+import androidx.compose.runtime.DisposableEffectimport androidx.compose.runtime.getValueimport androidx.compose.runtime.mutableStateOfimport androidx.compose.runtime.remember@@ -80,6 +83,7 @@ import com.chethan616.clearpdf.ui.theme.Candyimport com.chethan616.clearpdf.ui.theme.ClearTypeimport com.chethan616.clearpdf.ui.theme.clearimport com.chethan616.clearpdf.ui.glass.RoundedRectangle+import java.util.Locale/** Artefact's repository: help, issues and source. */const val CLEARPDF_REPO = "https://github.com/Chethan616/ClearPDF"@@ -104,15 +108,24 @@ fun SettingsScreen(vm: AppViewModel) {when (p) {"licences" -> LicencesPage { page = "root" }"glass" -> GlassMotionPage { page = "root" }- else -> SettingsRoot(vm, openLicences = { page = "licences" }, openGlass = { page = "glass" })+ "read-aloud-language" -> ReadAloudLanguagePage { page = "root" }+ else -> SettingsRoot(+ vm,+ openLicences = { page = "licences" },+ openGlass = { page = "glass" },+ openReadAloudLanguage = { page = "read-aloud-language" },+ )}}}@Composable-private fun SettingsRoot(vm: AppViewModel, openLicences: () -> Unit, openGlass: () -> Unit) {+private fun SettingsRoot(vm: AppViewModel, openLicences: () -> Unit, openGlass: () -> Unit, openReadAloudLanguage: () -> Unit) {val c = clearval context = LocalContext.current+ val savedSpeechLanguage = context.getSharedPreferences("readAloud", 0).getString("lang", null)+ val speechLanguage = savedSpeechLanguage?.let { Locale.forLanguageTag(it).getDisplayName(Locale.getDefault()) }+ ?: stringResource(R.string.read_aloud_system_default, Locale.getDefault().getDisplayName(Locale.getDefault()))val uri = LocalUriHandler.currentvar leaving by remember { mutableStateOf<String?>(null) }var authorDialog by remember { mutableStateOf(false) }@@ -142,6 +155,7 @@ private fun SettingsRoot(vm: AppViewModel, openLicences: () -> Unit, openGlass:item(key = "reading") { Section(stringResource(R.string.settings_reading)) }item(key = "readingpanel") {Panel {+ SettingRow(LucideIcons.AudioLines, Candy.Grape, stringResource(R.string.settings_read_aloud_language), openReadAloudLanguage, value = speechLanguage, chevron = true, first = true)ToggleRow(LucideIcons.PanelsTopLeft, Candy.Sky, stringResource(R.string.settings_quick_preview), stringResource(R.string.settings_quick_preview_body), vm.quickPreview, first = true) { vm.updateQuickPreview(it) }ToggleRow(LucideIcons.Sun, Candy.Tangerine, 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) }@@ -190,6 +204,81 @@ private fun SettingsRoot(vm: AppViewModel, openLicences: () -> Unit, openGlass:}}+/** Choose the TTS language used by the minimized reader player. */+@Composable+private fun ReadAloudLanguagePage(onBack: () -> Unit) {+ val context = LocalContext.current+ val prefs = remember(context) { context.getSharedPreferences("readAloud", 0) }+ var selectedTag by remember { mutableStateOf(prefs.getString("lang", null).orEmpty()) }+ var languages by remember { mutableStateOf<List<Locale>>(emptyList()) }+ var loading by remember { mutableStateOf(true) }+ var unavailable by remember { mutableStateOf(false) }++ DisposableEffect(context) {+ val ttsRef = arrayOfNulls<TextToSpeech>(1)+ val tts = TextToSpeech(context.applicationContext) { status ->+ loading = false+ if (status == TextToSpeech.SUCCESS) {+ languages = ttsRef[0]?.availableLanguages.orEmpty()+ .filter { it != Locale.ROOT && it.language.isNotBlank() && it.language != "und" }+ .distinctBy(Locale::toLanguageTag)+ .sortedBy { it.getDisplayName(Locale.getDefault()).lowercase(Locale.getDefault()) }+ } else {+ unavailable = true+ }+ }+ ttsRef[0] = tts+ onDispose { runCatching { tts.shutdown() } }+ }++ LazyColumn(Modifier.fillMaxSize(), contentPadding = PaddingValues(bottom = 32.dp)) {+ item { Spacer(Modifier.windowInsetsTopHeight(WindowInsets.statusBars)) }+ item {+ Spacer(Modifier.height(14.dp))+ ScreenHeader(null, stringResource(R.string.settings_read_aloud_language), onBack = onBack)+ Text(stringResource(R.string.settings_read_aloud_language_body), style = ClearType.Body, color = clear.inkSoft, modifier = Modifier.padding(horizontal = 30.dp, vertical = 10.dp))+ }+ item { Section(stringResource(R.string.common_tool_read_aloud)) }+ item {+ Panel {+ val systemTag = Locale.getDefault().toLanguageTag()+ SettingRow(+ LucideIcons.AudioLines,+ Candy.Sky,+ stringResource(R.string.read_aloud_system_default, Locale.getDefault().getDisplayName(Locale.getDefault())),+ onClick = { prefs.edit().remove("lang").apply(); selectedTag = "" },+ value = if (selectedTag.isEmpty()) stringResource(R.string.read_aloud_language_selected) else null,+ first = true,+ )+ if (loading) {+ Text(stringResource(R.string.read_aloud_languages_loading), style = ClearType.Caption, color = clear.inkSoft, modifier = Modifier.padding(horizontal = 18.dp, vertical = 12.dp))+ } else if (languages.isEmpty() || unavailable) {+ Text(stringResource(R.string.read_aloud_no_voice), style = ClearType.Caption, color = clear.inkSoft, modifier = Modifier.padding(horizontal = 18.dp, vertical = 12.dp))+ } else {+ languages.forEach { locale ->+ val tag = locale.toLanguageTag()+ val selected = selectedTag.ifEmpty { systemTag } == tag+ SettingRow(+ if (selected) LucideIcons.Check else LucideIcons.AudioLines,+ if (selected) Candy.Sky else Candy.Grape,+ locale.getDisplayName(Locale.getDefault()),+ onClick = { prefs.edit().putString("lang", tag).apply(); selectedTag = tag },+ value = if (selected) stringResource(R.string.read_aloud_language_selected) else null,+ )+ }+ }+ SettingRow(+ LucideIcons.Settings,+ Candy.Mint,+ stringResource(R.string.read_aloud_voice_settings),+ onClick = { runCatching { context.startActivity(Intent("com.android.settings.TTS_SETTINGS").addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)) } },+ )+ }+ }+ item { Spacer(Modifier.windowInsetsBottomHeight(WindowInsets.navigationBars)) }+ }+}+/** The settings' foot: the mark, name and version (a long press copies it), the credits and notice. */@Composableprivate fun AppFooter(vm: AppViewModel) {diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Buttons.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Buttons.ktindex 6888b56..32c8f39 100644--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Buttons.kt+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Buttons.kt@@ -281,14 +281,11 @@ val BackArrow: ImageVector by lazy {@Composablefun GlassBackButton(onBack: () -> Unit, modifier: Modifier = Modifier, label: String? = null, immediate: Boolean = false) {val beat = rememberBeat(onBack)- val barSurface = if (clear.dark) Color(0xFF151828).copy(alpha = 0.65f) else Color.White.copy(alpha = 0.75f)GlassCircle(onClick = if (immediate) onBack else beat,modifier = modifier,size = HeaderButtonSize,- surface = barSurface,label = label ?: androidx.compose.ui.res.stringResource(com.chethan616.clearpdf.R.string.common_back),- ink = clear.ink,) {GlassIcon(BackArrow, null, Modifier.size(16.dp))}diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Overlays.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Overlays.ktindex 324e526..d97c4ed 100644--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Overlays.kt+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Overlays.kt@@ -41,6 +41,7 @@ import androidx.compose.foundation.verticalScrollimport androidx.compose.material3.Iconimport androidx.compose.material3.Textimport androidx.compose.runtime.Composable+import androidx.compose.runtime.CompositionLocalProviderimport androidx.compose.runtime.LaunchedEffectimport androidx.compose.runtime.getValueimport androidx.compose.runtime.mutableStateOf@@ -68,6 +69,7 @@ import androidx.compose.ui.text.style.TextOverflowimport androidx.compose.ui.unit.spimport androidx.compose.ui.unit.Constraintsimport androidx.compose.ui.unit.IntOffset+import androidx.compose.ui.unit.Dpimport androidx.compose.ui.unit.dpimport androidx.compose.ui.util.lerpimport com.chethan616.clearpdf.ui.theme.Candy@@ -321,6 +323,48 @@ private const val MenuGoneMillis = 220L@Composablefun GlassMenu(anchor: Rect, onDismiss: () -> Unit, items: List<GlassMenuItem>) {+ var closing by remember { mutableStateOf(false) }+ GlassMenuLayout(anchor, onDismiss) {+ Spacer(Modifier.height(6.dp))+ items.forEach { item ->+ Row(+ Modifier.fillMaxWidth().pressable({+ if (!closing) {+ closing = true+ onDismiss()+ android.os.Handler(android.os.Looper.getMainLooper()).postDelayed({ item.onClick() }, MenuGoneMillis)+ }+ }).padding(horizontal = 16.dp, vertical = 11.dp),+ verticalAlignment = Alignment.CenterVertically,+ ) {+ Text(item.label, style = ClearType.BodyStrong, color = if (item.destructive) Candy.Tomato else LocalGlassInk.current, modifier = Modifier.weight(1f), maxLines = 1, overflow = TextOverflow.Ellipsis)+ if (item.icon != null) Icon(item.icon, null, tint = if (item.destructive) Candy.Tomato else LocalGlassInk.current.copy(alpha = 0.65f), modifier = Modifier.size(19.dp))+ }+ }+ Spacer(Modifier.height(6.dp))+ }+}++/** Same anchored frost and rounded shape as [GlassMenu], with room for a preserved custom layout. */+@Composable+fun GlassMenuLayout(+ anchor: Rect,+ onDismiss: () -> Unit,+ width: Dp = 236.dp,+ maxHeight: Dp = 480.dp,+ content: @Composable ColumnScope.() -> Unit,+) {+ GlassMenuLayoutContent(anchor, onDismiss, width, maxHeight) { content() }+}++@Composable+private fun GlassMenuLayoutContent(+ anchor: Rect,+ onDismiss: () -> Unit,+ width: Dp,+ maxHeight: Dp,+ content: @Composable ColumnScope.() -> Unit,+) {val c = clearGlassOverlay(animatesOut = true) {val leaving = LocalOverlayPresence.current?.leaving == true@@ -345,7 +389,7 @@ fun GlassMenu(anchor: Rect, onDismiss: () -> Unit, items: List<GlassMenuItem>) {content = {GlassCard(Modifier- .width(236.dp)+ .width(width).floatingLayer {val p = appear.valuescaleX = lerp(0.5f, 1f, p).coerceAtLeast(0.2f)@@ -354,26 +398,14 @@ fun GlassMenu(anchor: Rect, onDismiss: () -> Unit, items: List<GlassMenuItem>) {alpha = (p * 1.6f).coerceIn(0f, 1f)},shape = RoundedRectangle(24.dp),+ // Keep menus fully frosted even when the global glass setting is Lite or Crystal.wash = c.frost,blur = 16.dp,+ styleOverride = GlassStyle.MaximumFrost,) {- Spacer(Modifier.height(6.dp))- items.forEach { item ->- Row(- // the menu folds away first; what was chosen happens once it has gone- Modifier.fillMaxWidth().pressable({- if (!leaving) {- onDismiss()- android.os.Handler(android.os.Looper.getMainLooper()).postDelayed({ item.onClick() }, MenuGoneMillis)- }- }).padding(horizontal = 16.dp, vertical = 11.dp),- verticalAlignment = Alignment.CenterVertically,- ) {- Text(item.label, style = ClearType.BodyStrong, color = if (item.destructive) Candy.Tomato else c.ink, modifier = Modifier.weight(1f), maxLines = 1, overflow = TextOverflow.Ellipsis)- if (item.icon != null) Icon(item.icon, null, tint = if (item.destructive) Candy.Tomato else c.inkSoft, modifier = Modifier.size(19.dp))- }+ CompositionLocalProvider(LocalGlassInk provides c.ink) {+ Column(Modifier.heightIn(max = maxHeight).verticalScroll(rememberScrollState()), content = content)}- Spacer(Modifier.height(6.dp))}},modifier = Modifier.fillMaxSize(),@@ -396,7 +428,9 @@ fun GlassMenu(anchor: Rect, onDismiss: () -> Unit, items: List<GlassMenuItem>) {val y = if (below) local.bottom + 6f else local.top - 6f - p.heightval minX = barLeft + marginval maxX = (constraints.maxWidth - barRight - p.width - margin).coerceAtLeast(minX)- p.place(IntOffset(x.coerceIn(minX, maxX).roundToInt(), y.coerceAtLeast(barTop + margin).roundToInt()))+ val minY = barTop + margin+ val maxY = (constraints.maxHeight - barBottom - p.height - margin).coerceAtLeast(minY)+ p.place(IntOffset(x.coerceIn(minX, maxX).roundToInt(), y.coerceIn(minY, maxY).roundToInt()))}}}diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Style.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Style.ktindex b34548f..8a60a37 100644--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Style.kt+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Style.kt@@ -34,6 +34,8 @@ data class GlassStyle(val Default = GlassStyle()/** Heavier frost and wash: text stays legible over busy pages. */val Frosted = GlassStyle(blur = 2.4f, tint = 1.8f, refractionAmount = 0.7f, saturation = 1.3f)+ /** Menu frost stays at the top of the app's blur range, independent of the user's glass preset. */+ val MaximumFrost = Frosted.copy(blur = 3f, refractionHeight = 0f, refractionAmount = 0f, tint = 1f)/** Clear, strongly bent glass with a prismatic rim. */val Crystal = GlassStyle(blur = 0.3f, refractionHeight = 1.5f, refractionAmount = 1.6f, depthEffect = true, chromaticAberration = true, tint = 0.6f, saturation = 1.7f)/** No blur or lens at all, for slower phones. */diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Surfaces.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Surfaces.ktindex a00e263..fed79a6 100644--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Surfaces.kt+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Surfaces.kt@@ -43,9 +43,10 @@ fun Modifier.glass(blur: Dp = 8.dp,lensHeight: Dp = 16.dp,lensAmount: Dp = 24.dp,+ styleOverride: GlassStyle? = null,): Modifier {val backdrop = LocalBackdrop.current- val style = GlassSettings.style+ val style = styleOverride ?: GlassSettings.stylereturn drawBackdrop(backdrop = backdrop,shape = { shape },@@ -66,13 +67,14 @@ fun GlassCard(shape: Shape = RoundedRectangle(28.dp),wash: Color = clear.glass,blur: Dp = 8.dp,+ styleOverride: GlassStyle? = null,content: @Composable ColumnScope.() -> Unit,) {val below = LocalBackdrop.currentval layer = rememberLayerBackdrop()val combined = rememberCombinedBackdrop(below, layer)Box(modifier) {- Box(Modifier.matchParentSize().layerBackdrop(layer).glass(shape, wash, blur))+ Box(Modifier.matchParentSize().layerBackdrop(layer).glass(shape, wash, blur, styleOverride = styleOverride))CompositionLocalProvider(LocalBackdrop provides combined) { Column(content = content) }}}diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/home/HomeScreen.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/home/HomeScreen.ktindex 511ff69..de6aeb3 100644--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/home/HomeScreen.kt+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/home/HomeScreen.kt@@ -176,6 +176,7 @@ fun HomeScreen(vm: AppViewModel, desk: DeskState) {var playing by remember { mutableStateOf<String?>(null) }DisposableEffect(Unit) { onDispose { player.release() } }var actionsFor by remember { mutableStateOf<Note?>(null) }+ var actionsAnchor by remember { mutableStateOf(Rect.Zero) }val notes = vm.notes.allval recents = vm.recentRows()val fresh = remember(filter, notes, vm.recentList) { deskItems(filter, notes, recents, com.chethan616.clearpdf.notes.today()) }@@ -227,7 +228,7 @@ fun HomeScreen(vm: AppViewModel, desk: DeskState) {FilterChips(filter) { filter = it }}itemsIndexed(items, key = { _, it -> it.key }) { i, item ->- val m = Modifier.fillMaxWidth().riseIn(i, active = intro)+ val m = Modifier.fillMaxWidth().riseIn(i, active = intro).onGloballyPositioned { actionsAnchor = it.boundsInWindow() }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)@@ -267,7 +268,7 @@ fun HomeScreen(vm: AppViewModel, desk: DeskState) {}}- actionsFor?.let { n -> NoteActions(vm, n, onRename = { desk.naming = n.id }) { actionsFor = null } }+ actionsFor?.let { n -> NoteActions(vm, n, actionsAnchor, onRename = { desk.naming = n.id }) { actionsFor = null } }desk.naming?.let { id -> vm.notes.get(id)?.let { n -> NameSheet(vm, n) { desk.naming = null } } }}@@ -443,18 +444,21 @@ private fun DeskEmpty(vm: AppViewModel, filter: DeskFilter, desk: DeskState) {/** A long press on a note: name it (a voice memo), pin it, open it, or delete it. */@Composable-private fun NoteActions(vm: AppViewModel, n: Note, onRename: () -> Unit, onDismiss: () -> Unit) {+private fun NoteActions(vm: AppViewModel, n: Note, anchor: Rect, onRename: () -> Unit, onDismiss: () -> Unit) {val voice = n.kind == NoteKind.Voice- val title = n.title.ifBlank { stringResource(if (voice) R.string.voice_note else R.string.notes_untitled_note) }- val subtitle = if (voice && n.durationMs > 0) shortDate(n.updated) + " · " + com.chethan616.clearpdf.ui.viewer.clock(n.durationMs) else shortDate(n.updated)- GlassSheet(onDismiss, title, subtitle) {- if (voice) GlassRow(stringResource(R.string.notes_rename), { onDismiss(); onRename() }, icon = LucideIcons.PenLine, accent = Candy.Grape)- GlassRow(stringResource(if (n.pinned) R.string.notes_unpin else R.string.notes_pin), { vm.notes.put(n.copy(pinned = !n.pinned)); onDismiss() }, icon = LucideIcons.Pin, accent = Candy.Tangerine)- if (!voice) GlassRow(stringResource(R.string.notes_open), { vm.openNote = n.id; onDismiss() }, icon = LucideIcons.SquarePen, accent = Candy.Sky)- n.images.firstOrNull()?.let { pic -> GlassRow(stringResource(R.string.photo_edit), { onDismiss(); vm.editingPhoto = n.id to pic }, icon = LucideIcons.SlidersHorizontal, accent = Candy.Bubblegum) }- val feel = com.chethan616.clearpdf.ui.glass.rememberFeel()- GlassRow(stringResource(R.string.common_delete), { feel(com.chethan616.clearpdf.ui.glass.Feel.Reject); vm.notes.delete(n.id); onDismiss() }, icon = LucideIcons.Trash2, destructive = true)- }+ val feel = com.chethan616.clearpdf.ui.glass.rememberFeel()+ val renameLabel = stringResource(R.string.notes_rename)+ val pinLabel = stringResource(if (n.pinned) R.string.notes_unpin else R.string.notes_pin)+ val openLabel = stringResource(R.string.notes_open)+ val photoLabel = stringResource(R.string.photo_edit)+ val deleteLabel = stringResource(R.string.common_delete)+ GlassMenu(anchor, onDismiss, buildList {+ if (voice) add(GlassMenuItem(renameLabel, LucideIcons.PenLine) { onDismiss(); onRename() })+ add(GlassMenuItem(pinLabel, LucideIcons.Pin) { vm.notes.put(n.copy(pinned = !n.pinned)); onDismiss() })+ if (!voice) add(GlassMenuItem(openLabel, LucideIcons.SquarePen) { vm.openNote = n.id; onDismiss() })+ n.images.firstOrNull()?.let { pic -> add(GlassMenuItem(photoLabel, LucideIcons.SlidersHorizontal) { onDismiss(); vm.editingPhoto = n.id to pic }) }+ add(GlassMenuItem(deleteLabel, LucideIcons.Trash2, destructive = true) { feel(com.chethan616.clearpdf.ui.glass.Feel.Reject); vm.notes.delete(n.id); onDismiss() })+ })}/**diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/notes/PhotoEditor.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/notes/PhotoEditor.ktindex 5fcfbe3..bec7329 100644--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/notes/PhotoEditor.kt+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/notes/PhotoEditor.kt@@ -37,6 +37,7 @@ import androidx.compose.runtime.DisposableEffectimport androidx.compose.runtime.LaunchedEffectimport androidx.compose.runtime.getValueimport androidx.compose.runtime.mutableStateMapOf+import androidx.compose.runtime.mutableIntStateOfimport androidx.compose.runtime.mutableStateOfimport androidx.compose.runtime.rememberimport androidx.compose.runtime.rememberCoroutineScope@@ -82,11 +83,14 @@ import com.kyant.backdrop.backdrops.layerBackdropimport com.kyant.backdrop.backdrops.rememberLayerBackdropimport kotlinx.coroutines.Dispatchersimport kotlinx.coroutines.flow.collectLatest+import kotlinx.coroutines.flow.debounce+import kotlinx.coroutines.flow.distinctUntilChangedimport kotlinx.coroutines.launchimport kotlinx.coroutines.withContextimport org.json.JSONObjectimport java.io.Fileimport kotlin.math.abs+import kotlin.math.roundToInt/** One adjustment of LightCraft's develop settings: where it lives, its name, glyph and range. */private enum class Adjust(@@ -126,6 +130,7 @@ private fun shown(a: Adjust, v: Float): String {* - Deep integration with GlassSettings & MotionSettings* - Proper BackHandler ensuring swipe-back never closes the app*/+@OptIn(kotlinx.coroutines.FlowPreview::class)@Composablefun PhotoEditScreen(vm: AppViewModel, noteId: String, name: String, onClose: () -> Unit) {val source = remember(name) { vm.notes.file(name) }@@ -187,8 +192,13 @@ fun PhotoEditScreen(vm: AppViewModel, noteId: String, name: String, onClose: ()// Re-develop as the ruler moves; a newer value cancels the render still runningLaunchedEffect(Unit) {- snapshotFlow { values.toMap() to turn }.collectLatest {- val json = settings()+ // Rendering a 1600 px photo for every pointer event starved the ruler of frames. Coalesce+ // values for two display frames; the ruler remains immediate while the preview catches up+ // fluidly and always renders the final value.+ snapshotFlow { settings() }+ .distinctUntilChanged()+ .debounce(48)+ .collectLatest { json ->shown = withContext(Dispatchers.Default) {runCatching {editor.render(source.absolutePath, json, 1600u).toBitmap().asImageBitmap()@@ -486,7 +496,25 @@ private fun Ruler(a: Adjust, value: Float, onChange: (Float) -> Unit) {val haptics = LocalHaptics.currentval range = a.max - a.minvar drag by remember(a) { mutableStateOf(value) }- LaunchedEffect(value) { drag = value }+ var dragging by remember(a) { mutableStateOf(false) }+ // A meaningful tick per adjustment type: fractions for exposure, five-point steps for tone,+ // quarter turns for geometry. It feels deliberate without vibrating continuously.+ val tickSize = remember(a) {+ when {+ range <= 8f -> 0.1f+ range <= 12f -> 0.25f+ range <= 40f -> 1f+ else -> 5f+ }+ }+ fun tickAt(v: Float) = (v / tickSize).roundToInt()+ var lastTick by remember(a) { mutableIntStateOf(tickAt(value)) }+ LaunchedEffect(value) {+ if (!dragging) {+ drag = value+ lastTick = tickAt(value)+ }+ }Canvas(Modifier@@ -494,13 +522,24 @@ private fun Ruler(a: Adjust, value: Float, onChange: (Float) -> Unit) {.height(44.dp).pointerInput(a) {val perPx = range / (size.width * 3f)- detectHorizontalDragGestures { change, dx ->+ detectHorizontalDragGestures(+ onDragStart = {+ dragging = true+ lastTick = tickAt(drag)+ haptics?.play(Feel.Rise)+ },+ onDragEnd = { dragging = false },+ onDragCancel = { dragging = false },+ ) { change, dx ->change.consume()- val before = dragvar next = (drag - dx * perPx).coerceIn(a.min, a.max)- // catch at zero+ // Catch zero precisely; it is the natural resting point for every adjustment.if (abs(next) < range * 0.012f) next = 0f- if (before != 0f && next == 0f) haptics?.play(Feel.Tick)+ val nextTick = tickAt(next)+ if (nextTick != lastTick) {+ haptics?.play(Feel.Tick)+ lastTick = nextTick+ }drag = nextonChange(next)}diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/sheets/SheetViewer.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/sheets/SheetViewer.ktindex d928dbe..670f374 100644--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/sheets/SheetViewer.kt+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/sheets/SheetViewer.kt@@ -39,6 +39,7 @@ import androidx.compose.ui.graphics.Colorimport androidx.compose.ui.graphics.drawscope.DrawScopeimport androidx.compose.ui.graphics.drawscope.clipRectimport androidx.compose.ui.graphics.drawscope.translate+import androidx.compose.ui.graphics.luminanceimport androidx.compose.ui.input.pointer.pointerInputimport androidx.compose.ui.platform.LocalDensityimport androidx.compose.ui.res.stringResource@@ -102,8 +103,13 @@ import com.chethan616.clearpdf.ui.glass.GlassTabimport com.chethan616.clearpdf.ui.glass.GlassTabsimport com.chethan616.clearpdf.ui.glass.GlassMenuItemimport com.chethan616.clearpdf.ui.glass.GlassTextField+import com.chethan616.clearpdf.ui.glass.LocalGlassInk+import com.chethan616.clearpdf.ui.glass.Capsule+import com.chethan616.clearpdf.ui.glass.glassimport com.chethan616.clearpdf.ui.glass.pressable+import com.chethan616.clearpdf.ui.glass.rememberGlassInkimport com.chethan616.clearpdf.ui.theme.Candy+import com.chethan616.clearpdf.ui.pdfColorsimport androidx.compose.ui.focus.FocusRequesterimport androidx.compose.ui.focus.focusRequesterimport androidx.compose.ui.semantics.contentDescription@@ -253,11 +259,12 @@ fun SheetGrid(onCell: ((CellSpan?) -> Unit)? = null,onDoubleTapCell: ((CellSpan) -> Unit)? = null,) {- val c = clear+ val c = pdfColors+ val sheetSurface = if (c.dark) Color(0xFF18192F) else Color.Whiteval density = LocalDensity.currentval measurer = rememberTextMeasurer(cacheSize = 256)val l = state.layout- Box(modifier.fillMaxSize().background(Color.White)) {+ Box(modifier.fillMaxSize().background(c.surface)) {if (l == null) {Box(Modifier.fillMaxSize().padding(top = with(density) { top.toDp() } + 40.dp), contentAlignment = Alignment.TopCenter) { GlassLoader(size = 64.dp) }return@Box@@ -323,7 +330,7 @@ fun SheetGrid(},) {translate(top = top) {- drawSheet(l, state.blocks, state.current, px * state.scale, state.pan, measurer, c.ink, state.hits.getOrNull(state.hit), state.selected)+ drawSheet(l, state.blocks, state.current, px * state.scale, state.pan, measurer, sheetSurface, c.text, c.dark, state.hits.getOrNull(state.hit), state.selected)}}}@@ -339,6 +346,8 @@ fun SheetGrid(fun SheetViewer(vm: AppViewModel, doc: OpenDocument) {val eng = vm.engine ?: returnval c = clear+ // The sheet is themed with the app; floating controls sample its actual pixels for contrast.+ val chrome = rememberGlassInk(c.ink)val grid = rememberSheetGrid(eng, doc.id)val scope = rememberCoroutineScope()val density = LocalDensity.current@@ -407,15 +416,15 @@ fun SheetViewer(vm: AppViewModel, doc: OpenDocument) {onDoubleTapCell = { cell -> grid.selected = cell; editing = true },)}- CompositionLocalProvider(LocalBackdrop provides backdrop) {+ CompositionLocalProvider(LocalBackdrop provides backdrop, LocalGlassInk provides chrome.color) {Column(Modifier.fillMaxWidth().align(Alignment.TopCenter)) {Spacer(Modifier.windowInsetsTopHeight(WindowInsets.statusBars))Row(Modifier.fillMaxWidth().padding(horizontal = 12.dp, vertical = 6.dp), verticalAlignment = Alignment.CenterVertically) {GlassCircle(onClick = { vm.closeDocument() }, label = stringResource(R.string.common_back)) { GlassIcon(LucideIcons.ChevronLeft, null, Modifier.size(22.dp)) }Spacer(Modifier.size(10.dp))- Column(Modifier.weight(1f).glassBar().padding(horizontal = 16.dp, vertical = 6.dp)) {- Text(doc.title, style = ClearType.BodyStrong, color = c.ink, maxLines = 1, overflow = TextOverflow.Ellipsis)- grid.sheets.getOrNull(grid.current)?.let { Text(it.name + if (doc.info.dirty) " · " + stringResource(R.string.sheet_edited) else "", style = ClearType.Caption, color = c.inkSoft, maxLines = 1) }+ Column(Modifier.weight(1f).then(chrome.modifier).glassBar().padding(horizontal = 16.dp, vertical = 6.dp)) {+ Text(doc.title, style = ClearType.BodyStrong, color = LocalGlassInk.current, maxLines = 1, overflow = TextOverflow.Ellipsis)+ grid.sheets.getOrNull(grid.current)?.let { Text(it.name + if (doc.info.dirty) " · " + stringResource(R.string.sheet_edited) else "", style = ClearType.Caption, color = LocalGlassInk.current.copy(alpha = 0.62f), maxLines = 1) }}Spacer(Modifier.size(10.dp))GlassCircle(@@ -429,7 +438,7 @@ fun SheetViewer(vm: AppViewModel, doc: OpenDocument) {label = stringResource(R.string.viewer_find_in_document),surface = if (searching) Candy.Sky.copy(alpha = 0.22f) else Color.Unspecified,) {- GlassIcon(if (searching) LucideIcons.X else LucideIcons.Search, null, Modifier.size(20.dp), tint = if (searching) Candy.Sky else c.ink)+ GlassIcon(if (searching) LucideIcons.X else LucideIcons.Search, null, Modifier.size(20.dp), tint = if (searching) Candy.Sky else LocalGlassInk.current)}Spacer(Modifier.size(10.dp))var moreRect by remember { mutableStateOf(androidx.compose.ui.geometry.Rect.Zero) }@@ -467,7 +476,7 @@ fun SheetViewer(vm: AppViewModel, doc: OpenDocument) {Icon(LucideIcons.Search,null,- tint = if (notFound) Candy.Tomato else c.inkSoft,+ tint = if (notFound) Candy.Tomato else LocalGlassInk.current.copy(alpha = 0.62f),modifier = Modifier.size(18.dp),)Spacer(Modifier.size(10.dp))@@ -475,7 +484,7 @@ fun SheetViewer(vm: AppViewModel, doc: OpenDocument) {value = query,onValueChange = { query = it },singleLine = true,- textStyle = ClearType.Body.copy(color = if (notFound) Candy.Tomato else c.ink),+ textStyle = ClearType.Body.copy(color = if (notFound) Candy.Tomato else LocalGlassInk.current),cursorBrush = SolidColor(if (notFound) Candy.Tomato else Candy.Sky),keyboardOptions = KeyboardOptions(imeAction = ImeAction.Search),keyboardActions = KeyboardActions(onSearch = {@@ -499,7 +508,7 @@ fun SheetViewer(vm: AppViewModel, doc: OpenDocument) {Text(findLabel,style = ClearType.Body,- color = c.inkFaint,+ color = LocalGlassInk.current.copy(alpha = 0.42f),maxLines = 1,)}@@ -509,7 +518,7 @@ fun SheetViewer(vm: AppViewModel, doc: OpenDocument) {)if (notFound) {Text(- "Not found",+ stringResource(R.string.sheet_not_found),style = ClearType.Label.copy(fontWeight = FontWeight.Bold, fontSize = 12.sp),color = Candy.Tomato,maxLines = 1,@@ -519,7 +528,7 @@ fun SheetViewer(vm: AppViewModel, doc: OpenDocument) {Text("${grid.hit + 1}/${grid.hits.size}",style = ClearType.Label.copy(fontWeight = FontWeight.SemiBold, fontSize = 12.sp),- color = c.inkSoft,+ color = LocalGlassInk.current.copy(alpha = 0.62f),maxLines = 1,modifier = Modifier.padding(start = 6.dp, end = 4.dp),)@@ -538,7 +547,7 @@ fun SheetViewer(vm: AppViewModel, doc: OpenDocument) {Icon(LucideIcons.X,clearLabel,- tint = if (notFound) Candy.Tomato else c.inkSoft,+ tint = if (notFound) Candy.Tomato else LocalGlassInk.current.copy(alpha = 0.62f),modifier = Modifier.size(15.dp),)}@@ -565,9 +574,14 @@ fun SheetViewer(vm: AppViewModel, doc: OpenDocument) {if (searching) Spacer(Modifier.height(8.dp))grid.selected?.let { cell ->// the formula bar: the cell's name, what it holds, and a field to change it- Row(Modifier.fillMaxWidth().padding(horizontal = 12.dp).height(48.dp).background(c.frost, com.chethan616.clearpdf.ui.glass.Capsule).padding(horizontal = 6.dp), verticalAlignment = Alignment.CenterVertically) {+ Row(+ Modifier.fillMaxWidth().padding(horizontal = 12.dp).height(48.dp)+ .glass(Capsule, wash = Color.White.copy(alpha = 0.12f), blur = 14.dp)+ .padding(horizontal = 6.dp),+ verticalAlignment = Alignment.CenterVertically,+ ) {Box(Modifier.padding(4.dp).glassBar(surface = Candy.Sky.copy(alpha = 0.22f)).padding(horizontal = 10.dp, vertical = 6.dp)) {- Text(columnName(cell.col0.toInt()) + (cell.row0.toInt() + 1), style = ClearType.Label, color = c.ink)+ Text(columnName(cell.col0.toInt()) + (cell.row0.toInt() + 1), style = ClearType.Label, color = LocalGlassInk.current)}if (editing) {val focus = remember { androidx.compose.ui.focus.FocusRequester() }@@ -580,7 +594,7 @@ fun SheetViewer(vm: AppViewModel, doc: OpenDocument) {Box(Modifier.size(40.dp).pressable({ commit() }), contentAlignment = Alignment.Center) { GlassIcon(LucideIcons.Check, stringResource(R.string.common_done), Modifier.size(20.dp), tint = Candy.Sky) }} else {Text(- input.ifEmpty { stringResource(R.string.sheet_tap_to_type) }, style = ClearType.Body, color = if (input.isEmpty()) c.inkFaint else c.ink,+ input.ifEmpty { stringResource(R.string.sheet_tap_to_type) }, style = ClearType.Body, color = if (input.isEmpty()) LocalGlassInk.current.copy(alpha = 0.42f) else LocalGlassInk.current,maxLines = 1, overflow = TextOverflow.Ellipsis,modifier = Modifier.weight(1f).padding(horizontal = 8.dp).pressable({ editing = true }),)@@ -610,9 +624,9 @@ fun SheetViewer(vm: AppViewModel, doc: OpenDocument) {) {GlassIcon(LucideIcons.Sheet, null, Modifier.size(17.dp))Spacer(Modifier.size(8.dp))- Text(grid.sheets.getOrNull(grid.current)?.name.orEmpty(), style = ClearType.Label.copy(fontSize = 14.sp), color = c.ink, maxLines = 1)+ Text(grid.sheets.getOrNull(grid.current)?.name.orEmpty(), style = ClearType.Label.copy(fontSize = 14.sp), color = LocalGlassInk.current, maxLines = 1)Spacer(Modifier.size(6.dp))- Text(stringResource(R.string.sheet_of, visible.indexOfFirst { it.index == grid.current } + 1, visible.size), style = ClearType.Caption, color = c.inkSoft)+ Text(stringResource(R.string.sheet_of, visible.indexOfFirst { it.index == grid.current } + 1, visible.size), style = ClearType.Caption, color = LocalGlassInk.current.copy(alpha = 0.62f))GlassIcon(LucideIcons.ChevronDown, null, Modifier.size(16.dp))}}@@ -703,10 +717,13 @@ private fun DrawScope.drawSheet(k: Float,pan: Offset,measurer: TextMeasurer,+ sheetSurface: Color,ink: Color,+ dark: Boolean,found: CellSpan?,selected: CellSpan?,) {+ drawRect(sheetSurface)val head = Offset(HEAD_W * k.coerceAtMost(density * 1.5f), HEAD_H * k.coerceAtMost(density * 1.5f))val fr = min(l.info.frozenRows.toInt(), l.rows)val fc = min(l.info.frozenCols.toInt(), l.cols)@@ -728,7 +745,7 @@ private fun DrawScope.drawSheet(val cell = { r: Int, c: Int -> Rect(ox + l.colX[c] * k, oy + l.rowY[r] * k, ox + l.colX[c + 1] * k, oy + l.rowY[r + 1] * k) }// grid linesif (l.info.gridlines) {- val line = Color(0xFFE1E4EA)+ val line = if (dark) Color(0xFF343650) else Color(0xFFE1E4EA)for (c in c0..c1) drawLine(line, Offset(ox + l.colX[c] * k, clip.top), Offset(ox + l.colX[c] * k, clip.bottom), 1f)for (r in r0..r1) drawLine(line, Offset(clip.left, oy + l.rowY[r] * k), Offset(clip.right, oy + l.rowY[r] * k), 1f)}@@ -784,7 +801,10 @@ private fun DrawScope.drawSheet(val maxW = (r.width - 2 * pad).toInt()if (maxW <= 0) continueval style = TextStyle(- color = rgb(v.ink),+ color = if (v.ink == 0u) {+ val cellSurface = v.fill?.let(::rgb) ?: sheetSurface+ if (cellSurface.luminance() > 0.5f) Color(0xFF15171C) else ink+ } else rgb(v.ink),fontSize = (v.size * k / density / fontScale).sp,fontWeight = if (v.bold) FontWeight.Bold else FontWeight.Normal,fontStyle = if (v.italic) FontStyle.Italic else FontStyle.Normal,@@ -822,14 +842,15 @@ private fun DrawScope.drawSheet(region(Rect(head.x + frozenW, head.y, size.width, head.y + frozenH), head, 0, fr, fc, l.cols, scrollX = true, scrollY = false)region(Rect(head.x, head.y + frozenH, head.x + frozenW, size.height), head, fr, l.rows, 0, fc, scrollX = false, scrollY = true)region(Rect(head.x, head.y, head.x + frozenW, head.y + frozenH), head, 0, fr, 0, fc, scrollX = false, scrollY = false)- if (fr > 0) drawLine(Color(0xFF9AA3B2), Offset(head.x, head.y + frozenH), Offset(size.width, head.y + frozenH), density)- if (fc > 0) drawLine(Color(0xFF9AA3B2), Offset(head.x + frozenW, head.y), Offset(head.x + frozenW, size.height), density)+ val frozenDivider = if (dark) Color(0xFF777D9A) else Color(0xFF9AA3B2)+ if (fr > 0) drawLine(frozenDivider, Offset(head.x, head.y + frozenH), Offset(size.width, head.y + frozenH), density)+ if (fc > 0) drawLine(frozenDivider, Offset(head.x + frozenW, head.y), Offset(head.x + frozenW, size.height), density)// the heading strips- val strip = Color(0xFFF2F4F8)+ val strip = if (dark) Color(0xFF20213B) else Color(0xFFF2F4F8)val label = TextStyle(color = ink.copy(alpha = 0.6f), fontSize = (11 * min(k / density, 1.5f) / fontScale).sp)drawRect(strip, Offset(0f, 0f), Size(size.width, head.y))drawRect(strip, Offset(0f, 0f), Size(head.x, size.height))- val lineC = Color(0xFFD5D9E0)+ val lineC = if (dark) Color(0xFF343650) else Color(0xFFD5D9E0)clipRect(head.x, 0f, size.width, head.y) {for (c in 0 until l.cols) {val x0 = head.x + l.colX[c] * k + (if (c >= fc) pan.x else 0f)diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ReadAloud.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ReadAloud.ktindex 529204e..f5db90c 100644--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ReadAloud.kt+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ReadAloud.kt@@ -4,6 +4,11 @@ import android.content.Contextimport android.content.Intentimport android.speech.tts.TextToSpeechimport android.speech.tts.UtteranceProgressListener+import androidx.activity.compose.BackHandler+import androidx.compose.animation.core.Animatable+import androidx.compose.animation.core.FastOutSlowInEasing+import androidx.compose.animation.core.animateFloatAsState+import androidx.compose.animation.core.tweenimport androidx.compose.foundation.Canvasimport androidx.compose.foundation.Imageimport androidx.compose.foundation.background@@ -11,10 +16,12 @@ import androidx.compose.foundation.clickableimport androidx.compose.foundation.gestures.detectTapGesturesimport androidx.compose.foundation.layout.Arrangementimport androidx.compose.foundation.layout.Box+import androidx.compose.foundation.layout.BoxWithConstraintsimport androidx.compose.foundation.layout.BoxScopeimport androidx.compose.foundation.layout.Columnimport androidx.compose.foundation.layout.Rowimport androidx.compose.foundation.layout.Spacer+import androidx.compose.foundation.layout.WindowInsetsimport androidx.compose.foundation.layout.fillMaxSizeimport androidx.compose.foundation.layout.fillMaxWidthimport androidx.compose.foundation.layout.height@@ -30,8 +37,11 @@ import androidx.compose.foundation.layout.widthInimport androidx.compose.foundation.shape.CircleShapeimport androidx.compose.foundation.shape.RoundedCornerShapeimport androidx.compose.material3.Icon+import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi+import androidx.compose.material3.LinearWavyProgressIndicatorimport androidx.compose.material3.Textimport androidx.compose.runtime.Composable+import androidx.compose.runtime.CompositionLocalProviderimport androidx.compose.runtime.LaunchedEffectimport androidx.compose.runtime.Stableimport androidx.compose.runtime.getValue@@ -39,6 +49,7 @@ import androidx.compose.runtime.mutableFloatStateOfimport androidx.compose.runtime.mutableIntStateOfimport androidx.compose.runtime.mutableStateOfimport androidx.compose.runtime.remember+import androidx.compose.runtime.rememberCoroutineScopeimport androidx.compose.runtime.setValueimport androidx.compose.ui.Alignmentimport androidx.compose.ui.Modifier@@ -46,16 +57,22 @@ import androidx.compose.ui.draw.clipimport androidx.compose.ui.draw.shadowimport androidx.compose.ui.geometry.CornerRadiusimport androidx.compose.ui.geometry.Offset+import androidx.compose.ui.geometry.Rectimport androidx.compose.ui.geometry.Sizeimport androidx.compose.ui.graphics.BlendModeimport androidx.compose.ui.graphics.Colorimport androidx.compose.ui.graphics.ImageBitmapimport androidx.compose.ui.graphics.asImageBitmapimport androidx.compose.ui.graphics.drawscope.DrawScope+import androidx.compose.ui.graphics.graphicsLayer+import androidx.compose.ui.graphics.TransformOriginimport androidx.compose.ui.graphics.vector.ImageVectorimport androidx.compose.ui.input.pointer.pointerInputimport androidx.compose.ui.layout.ContentScale+import androidx.compose.ui.layout.boundsInWindow+import androidx.compose.ui.layout.onGloballyPositionedimport androidx.compose.ui.platform.LocalContext+import androidx.compose.ui.platform.LocalDensityimport androidx.compose.ui.res.stringResourceimport androidx.compose.ui.semantics.Roleimport androidx.compose.ui.semantics.contentDescription@@ -63,9 +80,8 @@ import androidx.compose.ui.semantics.semanticsimport androidx.compose.ui.text.font.FontWeightimport androidx.compose.ui.text.style.TextOverflowimport androidx.compose.ui.unit.dp+import androidx.compose.ui.unit.IntOffsetimport androidx.compose.ui.unit.sp-import androidx.compose.ui.window.Popup-import androidx.compose.ui.window.PopupPropertiesimport com.chethan616.clearpdf.Rimport com.chethan616.clearpdf.core.ReadingBlockimport com.chethan616.clearpdf.core.TextRange@@ -76,12 +92,30 @@ import com.chethan616.clearpdf.ui.LucideIconsimport com.chethan616.clearpdf.ui.OpenDocumentimport com.chethan616.clearpdf.ui.PdfSheetimport com.chethan616.clearpdf.ui.pdfColors+import com.chethan616.clearpdf.ui.glass.GlassCard+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.GlassOverlay+import com.chethan616.clearpdf.ui.glass.GlassMotion+import com.chethan616.clearpdf.ui.glass.GlassPill+import com.chethan616.clearpdf.ui.glass.GlassStyle+import com.chethan616.clearpdf.ui.glass.InkOnLight+import com.chethan616.clearpdf.ui.glass.LocalGlassInk+import com.chethan616.clearpdf.ui.glass.LocalGlassOverlayHost+import com.chethan616.clearpdf.ui.glass.LocalScreenInk+import com.chethan616.clearpdf.ui.glass.RoundedRectangle+import com.chethan616.clearpdf.ui.glass.glass+import com.chethan616.clearpdf.ui.glass.rememberGlassInk+import com.chethan616.clearpdf.ui.theme.clearimport kotlinx.coroutines.CoroutineScopeimport kotlinx.coroutines.Dispatchersimport kotlinx.coroutines.launchimport kotlinx.coroutines.withContextimport java.util.Localeimport kotlin.math.roundToInt+import kotlin.math.sin/*** Read Aloud: the document read out by the phone's own text-to-speech voice, paragraph by@@ -140,9 +174,9 @@ class ReadAloud(private val prefsCtx = context.applicationContextprivate var blocks: List<ReadingBlock> = emptyList()- private var index = 0+ private var index by mutableIntStateOf(0)/** Where in the current paragraph the voice is (characters), and where its utterance began. */- private var offset = 0+ private var offset by mutableIntStateOf(0)private var base = 0private var ready = false@@ -442,216 +476,102 @@ fun DrawScope.drawReadAloud(doc: OpenDocument, r: ReadAloud) {mark(r.wordRects, Color(0xFFF8D904), 1.5f * density)}-/**- * The Read Aloud player, as the reference lays it out: a thin progress track along its top, then- * the round button that opens the full player, back 15 seconds, play or pause, forward 15- * seconds, and the speed.- */+/** The minimized read-aloud player: document, speed, live wave, skip, play/pause, and stop. */@Composable-fun BoxScope.ReadAloudBar(vm: com.chethan616.clearpdf.ui.AppViewModel, doc: OpenDocument, r: ReadAloud) {- val c = pdfColors+fun BoxScope.ReadAloudBar(doc: OpenDocument, r: ReadAloud) {var speeds by remember { mutableStateOf(false) }- var expanded by remember { mutableStateOf(false) }- val openPlayer = stringResource(R.string.read_aloud_open_player)- Column(Modifier.align(Alignment.BottomCenter).fillMaxWidth().background(c.surface)) {- ProgressTrack(r.progress, Modifier.fillMaxWidth().height(6.dp))- Box(Modifier.fillMaxWidth().height(0.5.dp).background(c.divider))- Row(- Modifier.fillMaxWidth().padding(start = 20.dp, end = 20.dp, top = 16.dp, bottom = 24.dp).height(56.dp),- verticalAlignment = Alignment.CenterVertically,- ) {- Box(- Modifier.size(40.dp).clip(CircleShape).background(c.pageCard).clickable(role = Role.Button) { expanded = true }- .semantics { contentDescription = openPlayer },- contentAlignment = Alignment.Center,- ) { Icon(LucideIcons.ChevronUp, null, tint = c.label, modifier = Modifier.size(24.dp)) }- Row(Modifier.weight(1f), horizontalArrangement = Arrangement.spacedBy(12.dp, Alignment.CenterHorizontally), verticalAlignment = Alignment.CenterVertically) {- SkipButton(back = true, size = 43.dp) { r.skip(false) }- PlayerButton(if (r.playing) LucideIcons.Pause else LucideIcons.Play, stringResource(if (r.playing) R.string.common_pause else if (r.finished) R.string.read_aloud_read_again else R.string.common_play), 43.dp) {- if (r.playing) r.pause() else r.play()+ var speedAnchor by remember { mutableStateOf(Rect.Zero) }+ val ink = rememberGlassInk(InkOnLight)+ Box(+ Modifier.align(Alignment.BottomCenter)+ .fillMaxWidth()+ .navigationBarsPadding()+ .padding(horizontal = 12.dp, vertical = 8.dp)+ .then(ink.modifier)+ .glass(RoundedRectangle(28.dp), wash = Color.White.copy(alpha = 0.12f), blur = 18.dp)+ .padding(horizontal = 10.dp, vertical = 9.dp),+ ) {+ CompositionLocalProvider(LocalGlassInk provides ink.color) {+ Column(Modifier.fillMaxWidth()) {+ Row(Modifier.fillMaxWidth(), verticalAlignment = Alignment.CenterVertically) {+ Column(Modifier.weight(1f)) {+ Text(doc.title, color = LocalGlassInk.current, fontSize = 14.sp, fontWeight = FontWeight.SemiBold, maxLines = 1, overflow = TextOverflow.Ellipsis)+ Text(stringResource(R.string.common_tool_read_aloud), color = LocalGlassInk.current.copy(alpha = 0.62f), fontSize = 11.sp, maxLines = 1)+ }}- SkipButton(back = false, size = 43.dp) { r.skip(true) }- }- Box {- Text(speedLabel(r.speed), color = c.label, fontSize = 15.sp, modifier = Modifier.clickable(role = Role.Button) { speeds = true }.padding(vertical = 10.dp, horizontal = 2.dp))- if (speeds) SpeedPicker(r) { speeds = false }+ Spacer(Modifier.height(7.dp))+ WavyProgressTrack(r.progress, Modifier.fillMaxWidth().height(9.dp))+ Spacer(Modifier.height(7.dp))+ Row(Modifier.fillMaxWidth(), verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(8.dp, Alignment.CenterHorizontally)) {+ Box {+ GlassPill(+ onClick = { speeds = true },+ modifier = Modifier.onGloballyPositioned { speedAnchor = it.boundsInWindow() },+ height = 42.dp,+ horizontalPadding = 10.dp,+ label = stringResource(R.string.read_aloud_speed),+ ) {+ Text(speedLabel(r.speed), color = LocalGlassInk.current, fontSize = 13.sp, fontWeight = FontWeight.SemiBold)+ }+ if (speeds) SpeedMenu(speedAnchor, r) { speeds = false }+ }+ SkipButton(back = true, size = 44.dp) { r.skip(false) }+ GlassCircle(+ onClick = { if (r.playing) r.pause() else r.play() },+ size = 52.dp,+ tint = Color(0xFF1683FF),+ label = stringResource(if (r.playing) R.string.common_pause else if (r.finished) R.string.read_aloud_read_again else R.string.common_play),+ ) { GlassIcon(if (r.playing) LucideIcons.Pause else LucideIcons.Play, null, Modifier.size(25.dp), tint = Color.White) }+ SkipButton(back = false, size = 44.dp) { r.skip(true) }+ GlassCircle(onClick = r::stop, size = 38.dp, label = stringResource(R.string.read_aloud_stop_reading)) {+ GlassIcon(LucideIcons.Square, null, Modifier.size(16.dp))+ }+ }+ r.problem?.let { Text(it, color = Color(0xFFFF625D), fontSize = 12.sp, modifier = Modifier.padding(top = 5.dp)) }}}- if (r.problem != null) Text(r.problem.orEmpty(), color = c.textSecondary, fontSize = 13.sp, modifier = Modifier.padding(start = 20.dp, end = 20.dp, bottom = 8.dp))- Box(Modifier.fillMaxWidth().windowInsetsBottomHeight(androidx.compose.foundation.layout.WindowInsets.navigationBars).background(c.navBand))}- if (expanded) ReadAloudFull(vm, doc, r) { expanded = false }}-/** The progress track: the part read in the accent blue, the rest grey, rounded ends. */+/** Material 3 Expressive's animated wave, tinted to the player rather than the app theme. */+@OptIn(ExperimentalMaterial3ExpressiveApi::class)@Composable-private fun ProgressTrack(progress: Float, modifier: Modifier) {- val c = pdfColors- val rest = if (c.dark) Color(0xFF6A6A6A) else Color(0xFFB1B1B1)- Canvas(modifier) {- val r = CornerRadius(size.height / 2f)- drawRoundRect(rest, cornerRadius = r)- drawRoundRect(c.toolAccent, size = Size(size.width * progress.coerceIn(0f, 1f), size.height), cornerRadius = r)- }+private fun WavyProgressTrack(progress: Float, modifier: Modifier, accent: Color = Color(0xFF1683FF)) {+ val animatedProgress by animateFloatAsState(progress.coerceIn(0f, 1f), animationSpec = tween(360), label = "readAloudProgress")+ LinearWavyProgressIndicator(+ progress = { animatedProgress },+ modifier = modifier,+ color = accent,+ trackColor = LocalGlassInk.current.copy(alpha = 0.18f),+ )}@Composableprivate fun PlayerButton(icon: ImageVector, description: String, size: androidx.compose.ui.unit.Dp, iconSize: androidx.compose.ui.unit.Dp = 24.dp, onClick: () -> Unit) {- Box(- Modifier.size(size).clip(CircleShape).clickable(role = Role.Button, onClick = onClick).semantics { contentDescription = description },- contentAlignment = Alignment.Center,- ) { Icon(icon, null, tint = pdfColors.label, modifier = Modifier.size(iconSize)) }+ GlassCircle(onClick = onClick, size = size, label = description) { GlassIcon(icon, null, Modifier.size(iconSize)) }}/** Back or forward 15 seconds: a turning arrow with "15" in it. */@Composable-private fun SkipButton(back: Boolean, size: androidx.compose.ui.unit.Dp, iconSize: androidx.compose.ui.unit.Dp = 26.dp, onClick: () -> Unit) {- val c = pdfColors+private fun SkipButton(+ back: Boolean,+ size: androidx.compose.ui.unit.Dp,+ iconSize: androidx.compose.ui.unit.Dp = 26.dp,+ ink: Color = Color.Unspecified,+ surface: Color = Color.Unspecified,+ onClick: () -> Unit,+) {val label = stringResource(if (back) R.string.read_aloud_back_15 else R.string.read_aloud_forward_15)- Box(- Modifier.size(size).clip(CircleShape).clickable(role = Role.Button, onClick = onClick)- .semantics { contentDescription = label },- contentAlignment = Alignment.Center,- ) {- Icon(if (back) LucideIcons.RotateCcw else LucideIcons.RotateCw, null, tint = c.label, modifier = Modifier.size(iconSize))- Text("15", color = c.label, fontSize = (iconSize.value * 0.3f).sp, fontWeight = FontWeight.SemiBold, modifier = Modifier.offset(y = 0.5.dp))+ GlassCircle(onClick = onClick, size = size, ink = ink, surface = surface, label = label) {+ Icon(if (back) LucideIcons.RotateCcw else LucideIcons.RotateCw, null, tint = LocalGlassInk.current, modifier = Modifier.size(iconSize))+ Text("15", color = LocalGlassInk.current, fontSize = (iconSize.value * 0.3f).sp, fontWeight = FontWeight.SemiBold, modifier = Modifier.offset(y = 0.5.dp))}}-/** The speeds, in a card at the lower right: tap one to use it. */+/** Playback speeds use the shared anchored menu, not another theme-bound pop-up card. */@Composable-private fun SpeedPicker(r: ReadAloud, onDismiss: () -> Unit) {- val c = pdfColors- Popup(alignment = Alignment.BottomEnd, offset = androidx.compose.ui.unit.IntOffset(0, 0), onDismissRequest = onDismiss, properties = PopupProperties(focusable = true)) {- Box(Modifier.fillMaxSize().background(c.scrim).pointerInput(Unit) { detectTapGestures { onDismiss() } }) {- Column(- Modifier.align(Alignment.BottomEnd).navigationBarsPadding().padding(end = 24.dp, bottom = 76.dp).width(200.dp)- .shadow(2.dp, RoundedCornerShape(8.dp)).background(c.surface, RoundedCornerShape(8.dp)).padding(vertical = 12.dp),- ) {- for (s in ReadAloud.SPEEDS) {- Row(- Modifier.fillMaxWidth().clickable { r.setRate(s); onDismiss() }.padding(horizontal = 16.dp, vertical = 12.dp),- verticalAlignment = Alignment.CenterVertically,- ) {- Text(speedLabel(s), color = c.label, fontSize = 16.sp, modifier = Modifier.weight(1f))- if (s == r.speed) Icon(LucideIcons.Check, null, tint = c.toolAccent, modifier = Modifier.size(20.dp))- }- }- }- }- }-}--/**- * The full player: the page being read on a card, the document's name, the progress with the time- * gone and left, large back, play and forward buttons, then Voice (the phone's text-to-speech- * settings) and the speed.- */-@Composable-private fun ReadAloudFull(vm: com.chethan616.clearpdf.ui.AppViewModel, doc: OpenDocument, r: ReadAloud, onClose: () -> Unit) {- val c = pdfColors- val context = LocalContext.current- var thumb by remember(r.page) { mutableStateOf<ImageBitmap?>(null) }- var speeds by remember { mutableStateOf(false) }- var voices by remember { mutableStateOf(false) }- val closePlayer = stringResource(R.string.read_aloud_close_player)- LaunchedEffect(r.page) {- val eng = vm.engine ?: return@LaunchedEffect- val size = doc.info.pages.getOrNull(r.page) ?: return@LaunchedEffect- val scale = 480f / maxOf(size.width, size.height).coerceAtLeast(1f)- thumb = runCatching { withContext(eng.thumbnails) { eng.session.renderPage(doc.id, r.page.toUInt(), scale, null).toBitmap().asImageBitmap() } }.getOrNull()- }- // the language sheet sits over the player, not in its column (which the player fills)- Box(Modifier.fillMaxSize()) {- PdfSheet(onDismiss = onClose, maxHeightFraction = 1f, fill = true) {- Column(Modifier.fillMaxSize().padding(horizontal = 20.dp), horizontalAlignment = Alignment.CenterHorizontally) {- Box(Modifier.fillMaxWidth()) {- Box(- Modifier.size(40.dp).clip(CircleShape).background(c.pageCard).clickable(role = Role.Button, onClick = onClose)- .semantics { contentDescription = closePlayer },- contentAlignment = Alignment.Center,- ) { Icon(LucideIcons.ChevronDown, null, tint = c.label, modifier = Modifier.size(22.dp)) }- }- Spacer(Modifier.weight(1f))- Box(Modifier.heightIn(max = 240.dp).widthIn(max = 240.dp).shadow(4.dp, RoundedCornerShape(8.dp)).background(Color.White, RoundedCornerShape(8.dp)).clip(RoundedCornerShape(8.dp))) {- thumb?.let { Image(it, null, contentScale = ContentScale.Fit, modifier = Modifier.heightIn(max = 240.dp)) }- }- Spacer(Modifier.height(24.dp))- Text(doc.title, color = c.label, fontSize = 22.sp, fontWeight = FontWeight.SemiBold, maxLines = 2, overflow = TextOverflow.Ellipsis)- Spacer(Modifier.height(24.dp))- ProgressTrack(r.progress, Modifier.fillMaxWidth().height(6.dp))- Row(Modifier.fillMaxWidth().padding(top = 6.dp)) {- val gone = (r.estimatedTotalMs * r.progress).toLong()- Text(readClock(gone), color = c.textSecondary, fontSize = 11.sp, modifier = Modifier.weight(1f))- Text("-" + readClock(r.estimatedTotalMs - gone), color = c.textSecondary, fontSize = 11.sp)- }- Spacer(Modifier.height(16.dp))- Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(24.dp)) {- SkipButton(back = true, size = 58.dp, iconSize = 32.dp) { r.skip(false) }- Box(Modifier.size(80.dp).clip(CircleShape).background(c.divider), contentAlignment = Alignment.Center) {- PlayerButton(if (r.playing) LucideIcons.Pause else LucideIcons.Play, stringResource(if (r.playing) R.string.common_pause else R.string.common_play), 80.dp, iconSize = 40.dp) {- if (r.playing) r.pause() else r.play()- }- }- SkipButton(back = false, size = 58.dp, iconSize = 32.dp) { r.skip(true) }- }- Spacer(Modifier.weight(1f))- Row(Modifier.fillMaxWidth().padding(bottom = 16.dp), horizontalArrangement = Arrangement.SpaceAround, verticalAlignment = Alignment.CenterVertically) {- Column(- Modifier.clickable { voices = true }.padding(8.dp),- horizontalAlignment = Alignment.CenterHorizontally,- ) {- Icon(LucideIcons.AudioLines, null, tint = c.icon, modifier = Modifier.size(24.dp))- Text(stringResource(R.string.read_aloud_voice), color = c.textSecondary, fontSize = 13.sp)- }- Box {- Text(speedLabel(r.speed), color = c.textSecondary, fontSize = 16.sp, modifier = Modifier.clickable { speeds = true }.padding(8.dp))- if (speeds) SpeedPicker(r) { speeds = false }- }- }- }- }- if (voices) LanguageSheet(r, onVoiceSettings = {- voices = false- runCatching { context.startActivity(Intent("com.android.settings.TTS_SETTINGS").addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)) }- }) { voices = false }- }-}--/** Choose the language to read in: the ones the phone's voice has, then its voice settings. */-@Composable-private fun LanguageSheet(r: ReadAloud, onVoiceSettings: () -> Unit, onDismiss: () -> Unit) {- val c = pdfColors- val langs = remember { r.languages() }- // opened at the language in use (a couple of rows above it showing)- val current = remember(langs, r.language) { languageIndex(langs, r.language) }- val list = androidx.compose.foundation.lazy.rememberLazyListState(initialFirstVisibleItemIndex = (current - 2).coerceAtLeast(0))- com.chethan616.clearpdf.ui.PdfSheet(onDismiss = onDismiss, dim = true) {- com.chethan616.clearpdf.ui.SheetTitle(stringResource(R.string.read_aloud_choose_language))- androidx.compose.foundation.lazy.LazyColumn(Modifier.heightIn(max = 420.dp), state = list) {- items(langs.size) { i ->- val l = langs[i]- com.chethan616.clearpdf.ui.SheetRow(null, l.getDisplayName(Locale.getDefault()), { r.chooseLanguage(l); onDismiss() }, checked = i == current)- }- }- com.chethan616.clearpdf.ui.SheetRow(LucideIcons.Settings, stringResource(R.string.read_aloud_voice_settings), onVoiceSettings)- Spacer(Modifier.height(8.dp))- }-}--/**- * Where [current] is in [langs]: the same language and country, else the same language. Voices- * often list their languages by three-letter codes ("eng", "USA"), so both are compared that way.- * -1 when it isn't there.- */-internal fun languageIndex(langs: List<Locale>, current: Locale): Int {- fun Locale.lang() = runCatching { isO3Language }.getOrDefault(language).lowercase(Locale.ROOT)- fun Locale.place() = runCatching { isO3Country }.getOrDefault(country).uppercase(Locale.ROOT)- val exact = langs.indexOfFirst { it.lang() == current.lang() && it.place() == current.place() }- return if (exact >= 0) exact else langs.indexOfFirst { it.lang() == current.lang() }-}--private fun readClock(ms: Long): String {- val s = (ms / 1000).coerceAtLeast(0)- return if (s >= 3600) "%d:%02d:%02d".format(Locale.US, s / 3600, s / 60 % 60, s % 60) else "%d:%02d".format(Locale.US, s / 60, s % 60)+private fun SpeedMenu(anchor: Rect, r: ReadAloud, onDismiss: () -> Unit) {+ GlassMenu(anchor, onDismiss, ReadAloud.SPEEDS.map { speed ->+ GlassMenuItem(speedLabel(speed), if (speed == r.speed) LucideIcons.Check else null) { r.setRate(speed) }+ })}diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ViewerBars.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ViewerBars.ktindex 1cfef16..5d81103 100644--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ViewerBars.kt+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ViewerBars.kt@@ -71,14 +71,18 @@ import com.chethan616.clearpdf.ui.glass.GlassMenuimport com.chethan616.clearpdf.ui.glass.GlassMenuItemimport com.chethan616.clearpdf.ui.glass.GlassMotionimport com.chethan616.clearpdf.ui.glass.GlassPill+import com.chethan616.clearpdf.ui.glass.LocalGlassInkimport com.chethan616.clearpdf.ui.glass.glassimport com.chethan616.clearpdf.ui.glass.glassBarimport com.chethan616.clearpdf.ui.glass.pressable+import com.chethan616.clearpdf.ui.glass.rememberGlassInkimport com.chethan616.clearpdf.ui.iconAccentimport com.chethan616.clearpdf.ui.theme.Candyimport com.chethan616.clearpdf.ui.theme.ClearTypeimport com.chethan616.clearpdf.ui.theme.clear+import com.chethan616.clearpdf.ui.pdfColorsimport com.chethan616.clearpdf.ui.glass.Capsule+import kotlinx.coroutines.delayimport kotlinx.coroutines.flow.firstimport com.kyant.backdrop.floatingLayer@@ -113,14 +117,14 @@ fun ViewerTopBar(onBack: () -> Unit,onUndo: () -> Unit,onRedo: () -> Unit,- onTitle: () -> Unit,+ onTitle: (Rect) -> Unit,onSearch: (() -> Unit)?,onShare: () -> Unit,- onMore: () -> Unit,+ onMore: (Rect) -> Unit,undoLabel: String? = null,redoLabel: String? = null,) {- val c = clear+ val c = pdfColorsRow(Modifier.fillMaxWidth().height(TopBarHeight).padding(horizontal = 12.dp),verticalAlignment = Alignment.CenterVertically,@@ -131,24 +135,26 @@ fun ViewerTopBar(} else {com.chethan616.clearpdf.ui.glass.GlassBackButton(onBack)}- val barSurface = if (clear.dark) Color(0xFF151828).copy(alpha = 0.65f) else Color.White.copy(alpha = 0.75f)+ var titleAnchor by remember { mutableStateOf(Rect.Zero) }GlassPill(- onClick = onTitle,- modifier = Modifier.weight(1f),+ onClick = { onTitle(titleAnchor) },+ modifier = Modifier.weight(1f).onGloballyPositioned { titleAnchor = it.boundsInWindow() },height = 48.dp,horizontalPadding = 16.dp,- surface = barSurface,+ surface = c.surfaceRaised.copy(alpha = if (c.dark) 0.90f else 0.84f),) {+ CompositionLocalProvider(LocalGlassInk provides c.icon) {if (toolTitle != null) Box(Modifier.size(9.dp).clip(CircleShape).background(Candy.Sky))Column(Modifier.weight(1f)) {- Text(toolTitle ?: title, style = ClearType.Title.copy(fontSize = 15.5.sp, lineHeight = 19.sp), color = com.chethan616.clearpdf.ui.glass.LocalGlassInk.current, maxLines = 1, overflow = TextOverflow.Ellipsis)- if (subtitle != null && toolTitle == null) Text(subtitle, style = ClearType.Caption, color = com.chethan616.clearpdf.ui.glass.LocalGlassInk.current.copy(alpha = 0.62f), maxLines = 1)+ Text(toolTitle ?: title, style = ClearType.Title.copy(fontSize = 15.5.sp, lineHeight = 19.sp), color = c.icon, maxLines = 1, overflow = TextOverflow.Ellipsis)+ if (subtitle != null && toolTitle == null) Text(subtitle, style = ClearType.Caption, color = c.icon.copy(alpha = 0.72f), maxLines = 1)}if (onSearch != null && !toolActive) {BarGlyphButton(onSearch, stringResource(R.string.viewer_find_in_document), size = 36.dp) {- Icon(LucideIcons.Search, null, tint = com.chethan616.clearpdf.ui.glass.LocalGlassInk.current, modifier = Modifier.size(19.dp))+ Icon(LucideIcons.Search, null, tint = c.icon, modifier = Modifier.size(19.dp))}}+ }}if (toolActive) {if (canUndo || canRedo) {@@ -164,8 +170,9 @@ fun ViewerTopBar(} else {BarGroup {if (canUndo) UndoMenuButton(canUndo, canRedo, onUndo, onRedo, undoLabel, redoLabel)- BarGlyphButton(onShare, stringResource(R.string.common_share)) { Icon(LucideIcons.Share2, null, tint = com.chethan616.clearpdf.ui.glass.LocalGlassInk.current, modifier = Modifier.size(19.dp)) }- BarGlyphButton(onMore, stringResource(R.string.common_more_options)) { Icon(LucideIcons.Ellipsis, null, tint = com.chethan616.clearpdf.ui.glass.LocalGlassInk.current, modifier = Modifier.size(21.dp)) }+ BarGlyphButton(onShare, stringResource(R.string.common_share)) { Icon(LucideIcons.Share2, null, tint = c.icon, modifier = Modifier.size(19.dp)) }+ var moreAnchor by remember { mutableStateOf(Rect.Zero) }+ BarGlyphButton({ onMore(moreAnchor) }, stringResource(R.string.common_more_options), modifier = Modifier.onGloballyPositioned { moreAnchor = it.boundsInWindow() }) { Icon(LucideIcons.Ellipsis, null, tint = c.icon, modifier = Modifier.size(21.dp)) }}}}@@ -203,12 +210,11 @@ fun GlassBars(visible: Boolean, fromTop: Boolean, content: @Composable () -> Uni/** Bar buttons grouped on one glass capsule, as iOS groups them. */@Composableprivate fun BarGroup(content: @Composable androidx.compose.foundation.layout.RowScope.() -> Unit) {- val probe = com.chethan616.clearpdf.ui.glass.rememberGlassInk(clear.ink)- val barSurface = if (clear.dark) Color(0xFF151828).copy(alpha = 0.65f) else Color.White.copy(alpha = 0.75f)+ val c = pdfColorsRow(- Modifier.then(probe.modifier).height(48.dp).glassBar(surface = barSurface).padding(horizontal = 4.dp),+ Modifier.height(48.dp).glassBar(surface = c.surfaceRaised.copy(alpha = if (c.dark) 0.90f else 0.84f)).padding(horizontal = 4.dp),verticalAlignment = Alignment.CenterVertically,- ) { CompositionLocalProvider(com.chethan616.clearpdf.ui.glass.LocalGlassInk provides probe.color) { content() } }+ ) { CompositionLocalProvider(com.chethan616.clearpdf.ui.glass.LocalGlassInk provides c.icon) { content() } }}/** Undo in a bar group: a tap opens a menu naming what Undo and Redo would do. */@@ -247,13 +253,18 @@ fun SearchBar(onNext: () -> Unit,count: String? = null,) {- val c = clear+ val c = pdfColors+ val ink = com.chethan616.clearpdf.ui.glass.InkProbe(Modifier, c.icon)val focus = remember { FocusRequester() }val keyboard = LocalSoftwareKeyboardController.currentval findLabel = stringResource(R.string.viewer_find_in_document)- LaunchedEffect(Unit) { focus.requestFocus() }+ LaunchedEffect(Unit) {+ // Let the pill morph first; opening the IME immediately resizes the whole document viewport.+ delay(180)+ focus.requestFocus()+ }// the field is the title pill stretched over Share and More (their group and its gap, 96 dp), on- // the glass spring (Settings ▸ Motion); its words come in once it has room and leave first+ // a damped glass spring; its words come in once it has room and leave firstRow(Modifier.fillMaxWidth().height(TopBarHeight).padding(horizontal = 12.dp),verticalAlignment = Alignment.CenterVertically,@@ -267,48 +278,52 @@ fun SearchBar(.layout { m, cs ->val full = cs.maxWidthval start = (full - 96.dp.roundToPx()).coerceAtLeast(full / 2)- val w = (start + (full - start) * progress()).toInt().coerceIn(1, full + 24.dp.roundToPx())- val p = m.measure(cs.copy(minWidth = w, maxWidth = w))- layout(full, p.height) { p.place(0, 0) }+ val p = progress().coerceIn(0f, 1f)+ val w = (start + (full - start) * p).toInt().coerceIn(1, full)+ val placeable = m.measure(cs.copy(minWidth = w, maxWidth = w))+ layout(full, placeable.height) { placeable.place(0, 0) }}- .glassBar().padding(start = 16.dp, end = 4.dp)- .graphicsLayer { alpha = ((progress() - 0.35f) / 0.45f).coerceIn(0f, 1f) },+ .then(ink.modifier)+ .glassBar(surface = c.surfaceRaised.copy(alpha = if (c.dark) 0.92f else 0.86f)).padding(start = 16.dp, end = 4.dp)+ .graphicsLayer { alpha = ((progress().coerceIn(0f, 1f) - 0.35f) / 0.45f).coerceIn(0f, 1f) },verticalAlignment = Alignment.CenterVertically,) {- Icon(LucideIcons.Search, null, tint = c.inkSoft, modifier = Modifier.size(18.dp))- Spacer(Modifier.width(10.dp))- BasicTextField(- value = query,- onValueChange = onQuery,- singleLine = true,- textStyle = ClearType.Body.copy(color = c.ink),- cursorBrush = SolidColor(Candy.Tomato),- keyboardOptions = KeyboardOptions(imeAction = ImeAction.Search),- keyboardActions = KeyboardActions(onSearch = {- keyboard?.hide()- onSubmit()- }),- modifier = Modifier.weight(1f).focusRequester(focus).semantics { contentDescription = findLabel },- decorationBox = { inner ->- Box(contentAlignment = Alignment.CenterStart) {- if (query.isEmpty()) Text(findLabel, style = ClearType.Body, color = c.inkFaint, maxLines = 1)- inner()- }- },- )- if (count != null) Text(count, style = ClearType.Label, color = c.inkSoft, maxLines = 1, modifier = Modifier.padding(horizontal = 4.dp))- if (query.isNotEmpty()) StepButton(LucideIcons.X, stringResource(R.string.common_clear), true, onClear)- StepButton(LucideIcons.ChevronUp, stringResource(R.string.viewer_find_previous), canStep, onPrev)- StepButton(LucideIcons.ChevronDown, stringResource(R.string.viewer_find_next), canStep, onNext)+ CompositionLocalProvider(LocalGlassInk provides ink.color) {+ Icon(LucideIcons.Search, null, tint = ink.color.copy(alpha = 0.70f), modifier = Modifier.size(18.dp))+ Spacer(Modifier.width(10.dp))+ BasicTextField(+ value = query,+ onValueChange = onQuery,+ singleLine = true,+ textStyle = ClearType.Body.copy(color = ink.color),+ cursorBrush = SolidColor(Candy.Tomato),+ keyboardOptions = KeyboardOptions(imeAction = ImeAction.Search),+ keyboardActions = KeyboardActions(onSearch = {+ keyboard?.hide()+ onSubmit()+ }),+ modifier = Modifier.weight(1f).focusRequester(focus).semantics { contentDescription = findLabel },+ decorationBox = { inner ->+ Box(contentAlignment = Alignment.CenterStart) {+ if (query.isEmpty()) Text(findLabel, style = ClearType.Body, color = ink.color.copy(alpha = 0.48f), maxLines = 1)+ inner()+ }+ },+ )+ if (count != null) Text(count, style = ClearType.Label, color = ink.color.copy(alpha = 0.68f), maxLines = 1, modifier = Modifier.padding(horizontal = 4.dp))+ if (query.isNotEmpty()) StepButton(LucideIcons.X, stringResource(R.string.common_clear), true, onClear)+ StepButton(LucideIcons.ChevronUp, stringResource(R.string.viewer_find_previous), canStep, onPrev)+ StepButton(LucideIcons.ChevronDown, stringResource(R.string.viewer_find_next), canStep, onNext)+ }}}}@Composableprivate fun StepButton(icon: ImageVector, label: String, enabled: Boolean, onClick: () -> Unit) {- val c = clearBox(Modifier.size(38.dp).pressable(onClick, enabled = enabled).semantics { contentDescription = label }, contentAlignment = Alignment.Center) {- Icon(icon, null, tint = if (enabled) c.ink else c.inkFaint, modifier = Modifier.size(19.dp))+ val ink = LocalGlassInk.current.takeIf { it != Color.Unspecified } ?: clear.ink+ Icon(icon, null, tint = ink.copy(alpha = if (enabled) 0.82f else 0.30f), modifier = Modifier.size(19.dp))}}@@ -327,12 +342,17 @@ private fun dockSlots(widthDp: Int): Int = when {fun QuickToolbar(tools: List<QuickTool>,onTool: (QuickTool) -> Unit,- onMoreTools: (() -> Unit)?,- moreToolsOpen: Boolean,+ moreTools: List<QuickTool> = emptyList(),+ onCustomize: ((Rect) -> Unit)? = null,) {val slots = dockSlots(LocalConfiguration.current.screenWidthDp)val shown = tools.take(slots)- val turn by androidx.compose.animation.core.animateFloatAsState(if (moreToolsOpen) 45f else 0f, com.chethan616.clearpdf.ui.glass.Fluid.quick(), label = "more")+ // The four-dot control is an anchored action menu, not another bottom sheet. Keep the+ // clipped-off toolbar actions in the same menu so every action remains reachable on phones.+ val overflow = remember(tools, moreTools, slots) { (tools.drop(slots) + moreTools).distinct() }+ var menuAt by remember { mutableStateOf<Rect?>(null) }+ var moreRect by remember { mutableStateOf(Rect.Zero) }+ val turn by androidx.compose.animation.core.animateFloatAsState(if (menuAt != null) 45f else 0f, com.chethan616.clearpdf.ui.glass.Fluid.quick(), label = "more")Row(Modifier.fillMaxWidth().height(BottomBarHeight).padding(horizontal = 12.dp, vertical = 8.dp),verticalAlignment = Alignment.CenterVertically,@@ -340,17 +360,29 @@ fun QuickToolbar() {// iOS 26's toolbar: one glass capsule of plain glyphs in the glass's ink (no rainbow, no captions:// each glyph names itself to TalkBack), More tools in a glass bubble of its own beside it- val probe = com.chethan616.clearpdf.ui.glass.rememberGlassInk(clear.ink)- Row(Modifier.weight(1f).then(probe.modifier).fillMaxHeight().glassBar().padding(horizontal = 6.dp), verticalAlignment = Alignment.CenterVertically) {- CompositionLocalProvider(com.chethan616.clearpdf.ui.glass.LocalGlassInk provides probe.color) {+ val c = pdfColors+ Row(Modifier.weight(1f).fillMaxHeight().glassBar(surface = c.surfaceRaised.copy(alpha = if (c.dark) 0.90f else 0.84f)).padding(horizontal = 6.dp), verticalAlignment = Alignment.CenterVertically) {+ CompositionLocalProvider(com.chethan616.clearpdf.ui.glass.LocalGlassInk provides c.icon) {for (t in shown) DockItem(t.icon, stringResource(t.label)) { onTool(t) }}}- // office documents have their own tools on the bar and no PDF More tools- if (onMoreTools != null) GlassCircle(onClick = onMoreTools, size = 60.dp, label = stringResource(R.string.common_tool_more_tools)) {+ // Office documents have their own concise toolbar. PDFs use the menu for the remaining+ // tools rather than opening the old grid sheet.+ if (overflow.isNotEmpty() || onCustomize != null) GlassCircle(+ onClick = { menuAt = moreRect },+ size = 60.dp,+ label = stringResource(R.string.common_tool_more_tools),+ modifier = Modifier.onGloballyPositioned { moreRect = it.boundsInWindow() },+ ) {GlassIcon(LucideIcons.LayoutGrid, null, Modifier.size(23.dp).androidxRotate(turn))}}+ menuAt?.let { anchor ->+ GlassMenu(anchor, { menuAt = null }, buildList {+ overflow.forEach { tool -> add(GlassMenuItem(stringResource(tool.title), tool.icon) { onTool(tool) }) }+ if (onCustomize != null) add(GlassMenuItem(stringResource(R.string.toolbar_customize), LucideIcons.SlidersHorizontal) { onCustomize(anchor) })+ })+ }}private fun Modifier.androidxRotate(degrees: Float) = this.graphicsLayer { rotationZ = degrees }@@ -374,12 +406,12 @@ fun Modifier.barTopLine(): Modifier = thisfun SubToolbar(content: @Composable () -> Unit) {val scroll = rememberScrollState()BoxWithConstraints(Modifier.fillMaxWidth().height(BottomBarHeight).padding(horizontal = 12.dp, vertical = 8.dp), contentAlignment = Alignment.Center) {- val probe = com.chethan616.clearpdf.ui.glass.rememberGlassInk(clear.ink)+ val c = pdfColorsRow(- Modifier.widthIn(max = maxWidth).then(probe.modifier).fillMaxHeight().glassBar().horizontalScroll(scroll).padding(horizontal = 8.dp),+ Modifier.widthIn(max = maxWidth).fillMaxHeight().glassBar(surface = c.surfaceRaised.copy(alpha = if (c.dark) 0.90f else 0.84f)).horizontalScroll(scroll).padding(horizontal = 8.dp),horizontalArrangement = Arrangement.Center,verticalAlignment = Alignment.CenterVertically,- ) { CompositionLocalProvider(LocalSubToolbarScroll provides scroll, com.chethan616.clearpdf.ui.glass.LocalGlassInk provides probe.color) { content() } }+ ) { CompositionLocalProvider(LocalSubToolbarScroll provides scroll, com.chethan616.clearpdf.ui.glass.LocalGlassInk provides c.icon) { content() } }}}diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ViewerScreen.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ViewerScreen.ktindex d1c4c96..76af688 100644--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ViewerScreen.kt+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ViewerScreen.kt@@ -99,6 +99,8 @@ fun ViewerScreen(vm: AppViewModel, doc: OpenDocument) {val density = LocalDensity.currentval view = LocalView.currentval context = LocalContext.current+ var moreMenuAnchor by remember { mutableStateOf(Rect.Zero) }+ var moreToolsMenuAnchor by remember { mutableStateOf(Rect.Zero) }// The system bars go with the viewer's bars.val statusBar = vm.statusBarInDocuments@@ -138,8 +140,10 @@ fun ViewerScreen(vm: AppViewModel, doc: OpenDocument) {var quickExtraPx by remember { mutableIntStateOf(0) }val bottomPx = with(density) { if (ctl.tool == ViewerTool.None) QuickBarHeight.toPx() + quickExtraPx else BottomBarHeight.toPx() }// keyed on the document too: one opened over another (Create, Combine) has a fresh page view- LaunchedEffect(doc, statusPx, navPx, ctl.searching, ctl.tool, vm.readingMode, bottomPx) {- val bottomShown = !ctl.searching && !vm.readingMode+ LaunchedEffect(doc, statusPx, navPx, ctl.tool, vm.readingMode, bottomPx) {+ // Keep the page viewport fixed while Find replaces the top bar. Releasing the bottom-bar+ // space here shifts every page at the same time as the search pill animates.+ val bottomShown = !vm.readingMode// the first page starts at the top of the screen, under the camera; the glass row floats over// it as over the rest (no empty band above it)doc.viewer.setPadding(@@ -363,15 +367,16 @@ fun ViewerScreen(vm: AppViewModel, doc: OpenDocument) {LaunchedEffect(ctl.searching) {sp.animateTo(if (ctl.searching) 1f else 0f,- if (ctl.searching) com.chethan616.clearpdf.ui.glass.GlassMotion.morph() else com.chethan616.clearpdf.ui.glass.GlassMotion.settle(),+ // Avoid the low-damped overshoot used by menus. Thresholds and widths below+ // stay monotonic, so neither bar flashes back into view mid-transition.+ com.chethan616.clearpdf.ui.glass.GlassMotion.settle(),)}val searchShown by remember { androidx.compose.runtime.derivedStateOf { ctl.searching || sp.value > 0.002f } }- val barShown by remember { androidx.compose.runtime.derivedStateOf { !ctl.searching || sp.value < 0.998f } }Box(barSides) {- if (barShown) Box(- Modifier.graphicsLayer { alpha = (1f - sp.value * 1.8f).coerceIn(0f, 1f) }- .then(if (ctl.searching) Modifier.pointerInput(Unit) {+ Box(+ Modifier.graphicsLayer { alpha = (1f - sp.value).coerceIn(0f, 1f) }+ .then(if (searchShown) Modifier.pointerInput(searchShown) {awaitPointerEventScope { while (true) awaitPointerEvent(androidx.compose.ui.input.pointer.PointerEventPass.Initial).changes.forEach { it.consume() } }} else Modifier),) {@@ -387,14 +392,20 @@ fun ViewerScreen(vm: AppViewModel, doc: OpenDocument) {onBack = { if (ctl.tool != ViewerTool.None) vm.leaveTool(doc) else vm.closeDocument() },onUndo = { vm.undo(doc) },onRedo = { vm.redo(doc) },- onTitle = { ctl.sheet = if (ctl.sheet == ViewerSheet.More) ViewerSheet.None else ViewerSheet.More },+ onTitle = { anchor ->+ moreMenuAnchor = anchor+ ctl.sheet = if (ctl.sheet == ViewerSheet.More) ViewerSheet.None else ViewerSheet.More+ },onSearch = if (vm.readingMode) null else ({selection.clear()ctl.searching = truectl.sheet = ViewerSheet.None}),onShare = { vm.share(doc) },- onMore = { ctl.sheet = if (ctl.sheet == ViewerSheet.More) ViewerSheet.None else ViewerSheet.More },+ onMore = { anchor ->+ moreMenuAnchor = anchor+ ctl.sheet = if (ctl.sheet == ViewerSheet.More) ViewerSheet.None else ViewerSheet.More+ },undoLabel = if (doc.localUndo != null) stringResource(R.string.viewer_undo_drawing) else doc.info.undo,redoLabel = if (doc.localUndo != null) stringResource(R.string.viewer_undo_drawing) else doc.info.redo,)@@ -439,8 +450,13 @@ fun ViewerScreen(vm: AppViewModel, doc: OpenDocument) {QuickToolbar(tools = QuickTool.barFor(doc, vm.quickToolbar.bar),onTool = { vm.runQuickTool(doc, it) },- onMoreTools = if (doc.isOffice) null else ({ ctl.sheet = if (ctl.sheet == ViewerSheet.MoreTools) ViewerSheet.None else ViewerSheet.MoreTools }),- moreToolsOpen = ctl.sheet == ViewerSheet.MoreTools,+ moreTools = if (doc.isOffice) emptyList() else vm.quickToolbar.grid,+ // Rearranging is deliberately kept as its dedicated editor; every+ // normal command now comes straight from the anchored GlassMenu.+ onCustomize = if (doc.isOffice) null else ({ anchor ->+ moreToolsMenuAnchor = anchor+ ctl.sheet = ViewerSheet.MoreTools+ }),)} else {ToolSubToolbar(vm, doc)@@ -468,12 +484,12 @@ fun ViewerScreen(vm: AppViewModel, doc: OpenDocument) {// Sheets and dialogs.SheetHost(ctl.sheet.takeIf { it != ViewerSheet.None }) { sheet ->when (sheet) {- ViewerSheet.More -> MoreSheet(vm, doc)+ ViewerSheet.More -> MoreSheet(vm, doc, moreMenuAnchor)ViewerSheet.ViewSettings -> ViewSettingsSheet(vm, doc)ViewerSheet.Bookmarks -> BookmarksSheet(vm, doc)ViewerSheet.Attachments -> AttachmentsSheet(vm, doc)ViewerSheet.Comments -> Unit- ViewerSheet.MoreTools -> MoreToolsSheet(vm, doc)+ ViewerSheet.MoreTools -> MoreToolsSheet(vm, doc, moreToolsMenuAnchor)ViewerSheet.SaveAs -> SaveAsSheet(vm, doc)ViewerSheet.Signatures -> SignaturesSheet(vm, doc)ViewerSheet.None -> Unit@@ -500,7 +516,7 @@ fun ViewerScreen(vm: AppViewModel, doc: OpenDocument) {}}vm.replyPrompt?.takeIf { it.doc === doc }?.let { ReplySheet(vm, it) }- vm.readAloud?.let { ReadAloudBar(vm, doc, it) }+ vm.readAloud?.let { ReadAloudBar(doc, it) }if (ctl.goToPage) GoToPageDialog(doc, onDismiss = { ctl.goToPage = false })if (ctl.pagesOpen) PagesScreen(vm, doc, onClose = { ctl.pagesOpen = false })}diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ViewerSheets.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ViewerSheets.ktindex b395e54..398c884 100644--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ViewerSheets.kt+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ViewerSheets.kt@@ -37,6 +37,7 @@ import androidx.compose.foundation.combinedClickableimport androidx.compose.ui.draw.clipimport androidx.compose.ui.graphics.Colorimport androidx.compose.ui.graphics.vector.ImageVector+import androidx.compose.ui.geometry.Rectimport androidx.compose.ui.res.stringResourceimport androidx.compose.ui.semantics.Roleimport androidx.compose.ui.semantics.contentDescription@@ -83,92 +84,44 @@ import java.util.Date* reference's order. Drill-in rows (with a chevron) open their own sheet.*/@Composable-fun MoreSheet(vm: AppViewModel, doc: OpenDocument) {- val c = pdfColors+fun MoreSheet(vm: AppViewModel, doc: OpenDocument, anchor: Rect) {val ctl = doc.controller- fun close() {- ctl.sheet = ViewerSheet.None- }val bookmarked = vm.bookmarks.isBookmarked(doc, doc.viewer.currentPage)val starred = vm.isStarred(doc)- // like the reference, the sheet opens part way and rises to full height once its list scrolls- val scroll = rememberScrollState()- var expanded by remember { mutableStateOf(false) }- LaunchedEffect(scroll.value > 0) { if (scroll.value > 0) expanded = true }- val fraction by androidx.compose.animation.core.animateFloatAsState(if (expanded) 1f else 0.69f, label = "sheet")- val density = androidx.compose.ui.platform.LocalDensity.current- val top = with(density) {- maxOf(- androidx.compose.foundation.layout.WindowInsets.statusBars.getTop(density),- androidx.compose.foundation.layout.WindowInsets.displayCutout.getTop(density),- ).toDp()- } + TopBarHeight- PdfSheet(onDismiss = ::close, maxHeightFraction = fraction, topReserve = top) {- // the document: a small paper, its name and what it is, then Star and Print- Row(Modifier.fillMaxWidth().padding(start = 16.dp, end = 14.dp, bottom = 14.dp), verticalAlignment = Alignment.CenterVertically) {- DocGlyph()- Spacer(Modifier.width(12.dp))- Column(Modifier.weight(1f)) {- Text(doc.title, style = ClearType.Title.copy(fontSize = 17.sp), color = clear.ink, maxLines = 1, overflow = TextOverflow.Ellipsis)- Spacer(Modifier.height(2.dp))- Text(- (if (doc.isSlides) stringResource(R.string.sheet_kind_slides) else if (doc.isOffice) stringResource(R.string.sheet_kind_word) else "PDF") + " · ${modifiedLabel(doc.file.lastModified(), stringResource(R.string.common_yesterday))}" + if (!doc.writable) " · " + stringResource(R.string.sheet_read_only) else "",- style = ClearType.Caption.copy(fontSize = 12.sp), color = clear.inkSoft, maxLines = 1, overflow = TextOverflow.Ellipsis,- )- }- Spacer(Modifier.width(8.dp))- SheetCircleButton(- LucideIcons.Star, stringResource(if (starred) R.string.sheet_remove_star else R.string.sheet_add_star), { vm.toggleStar(doc) },- tint = if (starred) Candy.Lemon else Color.Unspecified,- )- Spacer(Modifier.width(8.dp))- SheetCircleButton(LucideIcons.X, stringResource(R.string.ui_close_sheet), ::close)+ val items = buildList {+ add(com.chethan616.clearpdf.ui.glass.GlassMenuItem(stringResource(if (starred) R.string.sheet_remove_star else R.string.sheet_add_star), LucideIcons.Star) { vm.toggleStar(doc) })+ add(com.chethan616.clearpdf.ui.glass.GlassMenuItem(stringResource(if (bookmarked) R.string.sheet_remove_bookmark else R.string.sheet_add_bookmark), if (bookmarked) LucideIcons.BookmarkMinus else LucideIcons.BookmarkPlus) { vm.toggleBookmark(doc) })+ add(com.chethan616.clearpdf.ui.glass.GlassMenuItem(stringResource(R.string.common_tool_read_aloud), LucideIcons.Volume2) { vm.startReadAloud(doc) })+ if (doc.isSlides) add(com.chethan616.clearpdf.ui.glass.GlassMenuItem(stringResource(R.string.office_present), LucideIcons.Presentation) { vm.presenting = doc })+ else if (!doc.isOffice) add(com.chethan616.clearpdf.ui.glass.GlassMenuItem(stringResource(R.string.common_tool_edit_pdf), LucideIcons.FilePenLine) { vm.enterTool(doc, ViewerTool.Edit) })+ add(com.chethan616.clearpdf.ui.glass.GlassMenuItem(stringResource(R.string.sheet_print), LucideIcons.Printer) { vm.print(doc) })+ add(com.chethan616.clearpdf.ui.glass.GlassMenuItem(stringResource(R.string.sheet_view_settings), LucideIcons.Glasses) { ctl.sheet = ViewerSheet.ViewSettings })+ add(com.chethan616.clearpdf.ui.glass.GlassMenuItem(+ stringResource(if (ctl.nightMode) R.string.viewer_night_mode_on else R.string.viewer_night_mode_off),+ if (ctl.nightMode) LucideIcons.Check else LucideIcons.Moon,+ ) { vm.setNightMode(doc, !ctl.nightMode) })+ add(com.chethan616.clearpdf.ui.glass.GlassMenuItem(stringResource(R.string.sheet_pages), LucideIcons.LayoutGrid) { ctl.pagesOpen = true })+ add(com.chethan616.clearpdf.ui.glass.GlassMenuItem(stringResource(R.string.sheet_bookmarks_contents), LucideIcons.Bookmark) { ctl.sheet = ViewerSheet.Bookmarks })+ if (doc.info.attachments > 0u) add(com.chethan616.clearpdf.ui.glass.GlassMenuItem(stringResource(R.string.sheet_attachments), LucideIcons.Paperclip) { ctl.sheet = ViewerSheet.Attachments })+ if (!doc.isOffice) {+ add(com.chethan616.clearpdf.ui.glass.GlassMenuItem(stringResource(R.string.sheet_comment_list), LucideIcons.MessagesSquare) { ctl.sheet = ViewerSheet.Comments })+ add(com.chethan616.clearpdf.ui.glass.GlassMenuItem(stringResource(R.string.sign_signatures), LucideIcons.ShieldCheck) { ctl.sheet = ViewerSheet.Signatures })}- Column(Modifier.verticalScroll(scroll)) {- // the four things done most, as big tiles- Row(Modifier.fillMaxWidth().padding(horizontal = 12.dp, vertical = 2.dp), horizontalArrangement = Arrangement.spacedBy(8.dp)) {- ActionTile(- if (bookmarked) LucideIcons.BookmarkMinus else LucideIcons.BookmarkPlus,- stringResource(if (bookmarked) R.string.sheet_remove_bookmark else R.string.sheet_add_bookmark), Candy.Tangerine,- ) { close(); vm.toggleBookmark(doc) }- ActionTile(LucideIcons.Volume2, stringResource(R.string.common_tool_read_aloud), Candy.Sky) { close(); vm.startReadAloud(doc) }- if (doc.isSlides) ActionTile(LucideIcons.Presentation, stringResource(R.string.office_present), Candy.Bubblegum) { close(); vm.presenting = doc }- else if (!doc.isOffice) ActionTile(LucideIcons.FilePenLine, stringResource(R.string.common_tool_edit_pdf), Candy.Bubblegum) { close(); vm.enterTool(doc, ViewerTool.Edit) }- ActionTile(LucideIcons.Printer, stringResource(R.string.sheet_print), Candy.Grape) { close(); vm.print(doc) }- }- Spacer(Modifier.height(8.dp))- SheetSection {- SheetRow(LucideIcons.Glasses, stringResource(R.string.sheet_view_settings), { ctl.sheet = ViewerSheet.ViewSettings }, chevron = true, tint = Candy.Sky)- SheetRow(LucideIcons.LayoutGrid, stringResource(R.string.sheet_pages), { close(); ctl.pagesOpen = true }, chevron = true, tint = Candy.Mint)- SheetRow(LucideIcons.Bookmark, stringResource(R.string.sheet_bookmarks_contents), { ctl.sheet = ViewerSheet.Bookmarks }, chevron = true, tint = Candy.Tangerine)- if (doc.info.attachments > 0u) SheetRow(LucideIcons.Paperclip, stringResource(R.string.sheet_attachments), { ctl.sheet = ViewerSheet.Attachments }, chevron = true, tint = Candy.Grape)- if (!doc.isOffice) {- SheetRow(LucideIcons.MessagesSquare, stringResource(R.string.sheet_comment_list), { ctl.sheet = ViewerSheet.Comments }, chevron = true, tint = Candy.Bubblegum)- SheetRow(LucideIcons.ShieldCheck, stringResource(R.string.sign_signatures), { ctl.sheet = ViewerSheet.Signatures }, chevron = true, tint = Candy.Lime)- }- }- // an office document: written by its own engine as PDF or another format- if (doc.isOffice) SheetSection {- SheetRow(LucideIcons.FilePdf, stringResource(R.string.office_export_pdf), { close(); vm.exportOffice(doc, "pdf") }, tint = Candy.Tangerine)- SheetRow(LucideIcons.SaveAs, stringResource(R.string.office_save_as), { ctl.sheet = ViewerSheet.SaveAs }, chevron = true, tint = Candy.Lime)- }- if (!doc.isOffice) SheetSection {- SheetRow(LucideIcons.FileOutput, stringResource(R.string.sheet_export_as), { close(); vm.openExport(doc) }, tint = Candy.Tangerine)- SheetRow(LucideIcons.FileArchive, stringResource(R.string.common_tool_compress), { close(); vm.openCompress(doc) }, tint = Candy.Mint)- SheetRow(LucideIcons.Combine, stringResource(R.string.common_tool_combine), { close(); vm.openCombine(doc) }, tint = Candy.Grape)- SheetRow(LucideIcons.FileLock2, stringResource(R.string.common_tool_set_password), { close(); vm.openProtect(doc) }, tint = Candy.Sky)- SheetRow(LucideIcons.FilePlus2, stringResource(R.string.common_tool_create_pdf), { close(); vm.openCreate() }, tint = Candy.Bubblegum)- SheetRow(LucideIcons.Copy, stringResource(R.string.common_save_copy), { close(); vm.saveCopyAs(doc) }, tint = Candy.Lime)- }- if (doc.info.undo != null || doc.info.redo != null) {- SheetSection {- doc.info.undo?.let { SheetRow(LucideIcons.Undo2, stringResource(R.string.sheet_undo_action, it), { close(); vm.undo(doc) }, tint = Candy.Grape) }- doc.info.redo?.let { SheetRow(LucideIcons.Redo2, stringResource(R.string.sheet_redo_action, it), { close(); vm.redo(doc) }, tint = Candy.Grape) }- }- }- Spacer(Modifier.height(6.dp))+ if (doc.isOffice) {+ add(com.chethan616.clearpdf.ui.glass.GlassMenuItem(stringResource(R.string.office_export_pdf), LucideIcons.FilePdf) { vm.exportOffice(doc, "pdf") })+ add(com.chethan616.clearpdf.ui.glass.GlassMenuItem(stringResource(R.string.office_save_as), LucideIcons.SaveAs) { ctl.sheet = ViewerSheet.SaveAs })+ } else {+ add(com.chethan616.clearpdf.ui.glass.GlassMenuItem(stringResource(R.string.sheet_export_as), LucideIcons.FileOutput) { vm.openExport(doc) })+ add(com.chethan616.clearpdf.ui.glass.GlassMenuItem(stringResource(R.string.common_tool_compress), LucideIcons.FileArchive) { vm.openCompress(doc) })+ add(com.chethan616.clearpdf.ui.glass.GlassMenuItem(stringResource(R.string.common_tool_combine), LucideIcons.Combine) { vm.openCombine(doc) })+ add(com.chethan616.clearpdf.ui.glass.GlassMenuItem(stringResource(R.string.common_tool_set_password), LucideIcons.FileLock2) { vm.openProtect(doc) })+ add(com.chethan616.clearpdf.ui.glass.GlassMenuItem(stringResource(R.string.common_tool_create_pdf), LucideIcons.FilePlus2) { vm.openCreate() })+ add(com.chethan616.clearpdf.ui.glass.GlassMenuItem(stringResource(R.string.common_save_copy), LucideIcons.Copy) { vm.saveCopyAs(doc) })}+ doc.info.undo?.let { label -> add(com.chethan616.clearpdf.ui.glass.GlassMenuItem(stringResource(R.string.sheet_undo_action, label), LucideIcons.Undo2) { vm.undo(doc) }) }+ doc.info.redo?.let { label -> add(com.chethan616.clearpdf.ui.glass.GlassMenuItem(stringResource(R.string.sheet_redo_action, label), LucideIcons.Redo2) { vm.redo(doc) }) }}+ com.chethan616.clearpdf.ui.glass.GlassMenu(anchor, { ctl.sheet = ViewerSheet.None }, items)}/** A PDF as a little paper in a sheet's header: grey lines and the red PDF corner. */@@ -240,8 +193,10 @@ fun ViewSettingsSheet(vm: AppViewModel, doc: OpenDocument) {}Spacer(Modifier.height(6.dp))SheetSection {- SheetRow(LucideIcons.Moon, stringResource(R.string.sheet_night_mode), { vm.setNightMode(doc, !ctl.nightMode); ctl.sheet = ViewerSheet.None }, tint = Candy.Grape) {- PdfSwitch(ctl.nightMode, { vm.setNightMode(doc, it); ctl.sheet = ViewerSheet.None })+ // Keep this sheet mounted while the page inversion changes so the switch's touch+ // sequence cannot race a disappearing parent surface.+ SheetRow(LucideIcons.Moon, stringResource(R.string.sheet_night_mode), { vm.setNightMode(doc, !ctl.nightMode) }, tint = Candy.Grape) {+ PdfSwitch(ctl.nightMode, { vm.setNightMode(doc, it) })}}Spacer(Modifier.height(14.dp))@@ -540,44 +495,58 @@ object ToolHues {/** More tools: the tools that aren't on the bar, as a grid of tiles, and Customize toolbar. */@Composable-fun MoreToolsSheet(vm: AppViewModel, doc: OpenDocument) {+fun MoreToolsSheet(vm: AppViewModel, doc: OpenDocument, anchor: Rect) {val ctl = doc.controllervar customizing by remember { mutableStateOf(false) }- PdfSheet(onDismiss = { if (customizing) customizing = false else ctl.sheet = ViewerSheet.None }) {+ val config = androidx.compose.ui.platform.LocalConfiguration.current+ val width = (config.screenWidthDp.dp - 24.dp).coerceAtLeast(236.dp).coerceAtMost(480.dp)+ val maxHeight = (config.screenHeightDp.dp - 112.dp).coerceAtLeast(400.dp)+ val slots = toolbarSlots(config.screenWidthDp)+ val prefs = vm.quickToolbar+ val tools = if (doc.isOffice) emptyList() else prefs.bar.drop(slots) + prefs.grid+ com.chethan616.clearpdf.ui.glass.GlassMenuLayout(+ anchor = anchor,+ onDismiss = { if (customizing) customizing = false else ctl.sheet = ViewerSheet.None },+ width = width,+ maxHeight = maxHeight,+ ) {if (customizing) {CustomizeToolbar(vm) { customizing = false }- return@PdfSheet- }- SheetTitle(stringResource(R.string.common_tool_more_tools))- val slots = toolbarSlots(androidx.compose.ui.platform.LocalConfiguration.current.screenWidthDp)- val prefs = vm.quickToolbar- val tools = if (doc.isOffice) emptyList() else prefs.bar.drop(slots) + prefs.grid- // a grid of app-icon tiles: four to a row on a phone, more on wider screens- androidx.compose.foundation.layout.BoxWithConstraints(Modifier.fillMaxWidth().padding(horizontal = 10.dp, vertical = 2.dp)) {- val perRow = if (maxWidth >= 560.dp) 6 else if (maxWidth >= 400.dp) 5 else 4- val cell = maxWidth / perRow- Column {- tools.chunked(perRow).forEach { row ->- Row(verticalAlignment = Alignment.Top) {- row.forEach { t ->- ToolTile(t.icon, stringResource(t.title), t.hue, Modifier.width(cell)) {- ctl.sheet = ViewerSheet.None- vm.runQuickTool(doc, t)+ } else {+ Spacer(Modifier.height(6.dp))+ Row(Modifier.fillMaxWidth().padding(start = 18.dp, end = 14.dp, bottom = 8.dp), verticalAlignment = Alignment.CenterVertically) {+ Text(stringResource(R.string.common_tool_more_tools), style = ClearType.Title.copy(fontSize = 18.sp), color = clear.ink, modifier = Modifier.weight(1f))+ com.chethan616.clearpdf.ui.glass.GlassCircle(onClick = { ctl.sheet = ViewerSheet.None }, size = 36.dp, label = stringResource(R.string.ui_close_sheet)) {+ com.chethan616.clearpdf.ui.glass.GlassIcon(LucideIcons.X, null, Modifier.size(18.dp))+ }+ }+ // Preserve the existing toolbar's four-column tool grid inside the same frosted menu card.+ androidx.compose.foundation.layout.BoxWithConstraints(Modifier.fillMaxWidth().padding(horizontal = 10.dp, vertical = 2.dp)) {+ val perRow = if (maxWidth >= 560.dp) 6 else if (maxWidth >= 400.dp) 5 else 4+ val cell = maxWidth / perRow+ Column {+ tools.chunked(perRow).forEach { row ->+ Row(verticalAlignment = Alignment.Top) {+ row.forEach { t ->+ ToolTile(t.icon, stringResource(t.title), t.hue, Modifier.width(cell)) {+ ctl.sheet = ViewerSheet.None+ vm.runQuickTool(doc, t)+ }}}+ Spacer(Modifier.height(10.dp))}- Spacer(Modifier.height(10.dp))}}+ com.chethan616.clearpdf.ui.glass.GlassPill(+ onClick = { customizing = true }, modifier = Modifier.padding(horizontal = 16.dp).fillMaxWidth(), height = 48.dp,+ label = stringResource(R.string.sheet_customize_toolbar),+ ) {+ Icon(LucideIcons.SlidersHorizontal, null, tint = clear.ink, modifier = Modifier.size(18.dp))+ Text(stringResource(R.string.sheet_customize_toolbar), style = ClearType.BodyStrong, color = clear.ink)+ }+ Spacer(Modifier.height(12.dp))}- // Customize toolbar: a plain glass capsule across the sheet- com.chethan616.clearpdf.ui.glass.GlassPill(- onClick = { customizing = true }, modifier = Modifier.padding(horizontal = 16.dp).fillMaxWidth(), height = 48.dp,- ) {- Icon(LucideIcons.SlidersHorizontal, null, tint = clear.ink, modifier = Modifier.size(18.dp))- Text(stringResource(R.string.sheet_customize_toolbar), style = ClearType.BodyStrong, color = clear.ink)- }- Spacer(Modifier.height(12.dp))}}diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/WordEdit.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/WordEdit.ktindex 49e2ad7..c96c9e0 100644--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/WordEdit.kt+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/WordEdit.kt@@ -11,6 +11,7 @@ import androidx.compose.foundation.layout.offsetimport androidx.compose.foundation.layout.widthimport androidx.compose.ui.draw.drawBehindimport androidx.compose.ui.graphics.Color+import androidx.compose.ui.graphics.isSpecifiedimport androidx.compose.ui.graphics.SolidColorimport androidx.compose.ui.graphics.drawscope.Strokeimport androidx.compose.ui.text.TextStyle@@ -32,6 +33,7 @@ import androidx.compose.foundation.text.BasicTextFieldimport androidx.compose.foundation.text.KeyboardActionsimport androidx.compose.foundation.text.KeyboardOptionsimport androidx.compose.runtime.Composable+import androidx.compose.runtime.CompositionLocalProviderimport androidx.compose.runtime.DisposableEffectimport androidx.compose.runtime.LaunchedEffectimport androidx.compose.runtime.getValue@@ -63,8 +65,11 @@ import com.chethan616.clearpdf.ui.LucideIconsimport com.chethan616.clearpdf.ui.OpenDocumentimport com.chethan616.clearpdf.ui.glass.GlassCircleimport com.chethan616.clearpdf.ui.glass.GlassIcon+import com.chethan616.clearpdf.ui.glass.InkOnLight+import com.chethan616.clearpdf.ui.glass.LocalGlassInkimport com.chethan616.clearpdf.ui.glass.glassBarimport com.chethan616.clearpdf.ui.glass.pressable+import com.chethan616.clearpdf.ui.glass.rememberGlassInkimport com.chethan616.clearpdf.ui.theme.Candyimport com.chethan616.clearpdf.ui.theme.clear@@ -131,30 +136,32 @@ fun WordEditDock(vm: AppViewModel, doc: OpenDocument) {GlassCircle(onClick = { vm.stopWordEdit() }, size = 48.dp, tint = Candy.Sky, label = stringResource(R.string.common_done)) {GlassIcon(LucideIcons.Check, null, Modifier.size(19.dp))}- Row(- Modifier- .weight(1f)- .height(48.dp)- .glassBar(- surface = if (clear.dark) Color(0xFF1B1E2E).copy(alpha = 0.85f) else Color.White.copy(alpha = 0.90f)- )- .horizontalScroll(rememberScrollState())- .padding(horizontal = 8.dp),- verticalAlignment = Alignment.CenterVertically,- horizontalArrangement = Arrangement.spacedBy(2.dp),- ) {- EditKey(LucideIcons.Undo2, stringResource(R.string.word_undo), doc.info.undo != null) { vm.wordRun(doc, "edit.undo") }- EditKey(LucideIcons.Redo2, stringResource(R.string.word_redo), doc.info.redo != null) { vm.wordRun(doc, "edit.redo") }- EditKey(LucideIcons.Bold, stringResource(R.string.word_bold), on = f.optBoolean("bold")) { vm.wordRun(doc, "format.bold") }- EditKey(LucideIcons.Italic, stringResource(R.string.word_italic), on = f.optBoolean("italic")) { vm.wordRun(doc, "format.italic") }- EditKey(LucideIcons.Underline, stringResource(R.string.common_tool_underline), on = f.opt("underline").let { it != null && it != false && it != "none" && it != org.json.JSONObject.NULL }) { vm.wordRun(doc, "format.underline") }- EditKey(LucideIcons.List, stringResource(R.string.word_bullets)) { vm.wordRun(doc, "para.bullets") }- EditKey(LucideIcons.ListOrdered, stringResource(R.string.word_numbering)) { vm.wordRun(doc, "para.numbering") }- EditKey(LucideIcons.AlignLeft, stringResource(R.string.word_align_left)) { vm.wordRun(doc, "para.alignLeft") }- EditKey(LucideIcons.AlignCenter, stringResource(R.string.word_align_center)) { vm.wordRun(doc, "para.alignCenter") }- EditKey(LucideIcons.AlignRight, stringResource(R.string.word_align_right)) { vm.wordRun(doc, "para.alignRight") }- EditKey(LucideIcons.Heading, stringResource(R.string.word_heading)) { vm.wordRun(doc, "para.style", mapOf("style" to "Heading1")) }- EditKey(LucideIcons.Type, stringResource(R.string.word_body_text)) { vm.wordRun(doc, "para.normal") }+ val probe = rememberGlassInk(InkOnLight)+ CompositionLocalProvider(LocalGlassInk provides probe.color) {+ Row(+ Modifier+ .weight(1f)+ .height(48.dp)+ .then(probe.modifier)+ .glassBar()+ .horizontalScroll(rememberScrollState())+ .padding(horizontal = 8.dp),+ verticalAlignment = Alignment.CenterVertically,+ horizontalArrangement = Arrangement.spacedBy(2.dp),+ ) {+ EditKey(LucideIcons.Undo2, stringResource(R.string.word_undo), doc.info.undo != null) { vm.wordRun(doc, "edit.undo") }+ EditKey(LucideIcons.Redo2, stringResource(R.string.word_redo), doc.info.redo != null) { vm.wordRun(doc, "edit.redo") }+ EditKey(LucideIcons.Bold, stringResource(R.string.word_bold), on = f.optBoolean("bold")) { vm.wordRun(doc, "format.bold") }+ EditKey(LucideIcons.Italic, stringResource(R.string.word_italic), on = f.optBoolean("italic")) { vm.wordRun(doc, "format.italic") }+ EditKey(LucideIcons.Underline, stringResource(R.string.common_tool_underline), on = f.opt("underline").let { it != null && it != false && it != "none" && it != org.json.JSONObject.NULL }) { vm.wordRun(doc, "format.underline") }+ EditKey(LucideIcons.List, stringResource(R.string.word_bullets)) { vm.wordRun(doc, "para.bullets") }+ EditKey(LucideIcons.ListOrdered, stringResource(R.string.word_numbering)) { vm.wordRun(doc, "para.numbering") }+ EditKey(LucideIcons.AlignLeft, stringResource(R.string.word_align_left)) { vm.wordRun(doc, "para.alignLeft") }+ EditKey(LucideIcons.AlignCenter, stringResource(R.string.word_align_center)) { vm.wordRun(doc, "para.alignCenter") }+ EditKey(LucideIcons.AlignRight, stringResource(R.string.word_align_right)) { vm.wordRun(doc, "para.alignRight") }+ EditKey(LucideIcons.Heading, stringResource(R.string.word_heading)) { vm.wordRun(doc, "para.style", mapOf("style" to "Heading1")) }+ EditKey(LucideIcons.Type, stringResource(R.string.word_body_text)) { vm.wordRun(doc, "para.normal") }+ }}}}@@ -162,7 +169,7 @@ fun WordEditDock(vm: AppViewModel, doc: OpenDocument) {/** One glyph of the dock: in the glass's ink, lit by a soft accent while its formatting is on. */@Composableprivate fun EditKey(icon: ImageVector, label: String, enabled: Boolean = true, on: Boolean = false, onClick: () -> Unit) {- val inkColor = if (on) Candy.Sky else if (clear.dark) Color(0xFFF0F4FC) else Color(0xFF1E222D)+ val inkColor = if (on) Candy.Sky else LocalGlassInk.current.takeIf { it.isSpecified } ?: InkOnLightBox(Modifier.size(40.dp)diff --git a/android/app/src/main/res/values/strings.xml b/android/app/src/main/res/values/strings.xmlindex b1630ac..622389b 100644--- a/android/app/src/main/res/values/strings.xml+++ b/android/app/src/main/res/values/strings.xml@@ -436,13 +436,20 @@<!-- Read Aloud: the player --><string name="read_aloud_no_voice">Read aloud needs a text-to-speech voice on this phone.</string>- <string name="read_aloud_open_player">Open the player</string>- <string name="read_aloud_close_player">Close the player</string><string name="read_aloud_read_again">Read again</string><string name="read_aloud_back_15">Back 15 seconds</string><string name="read_aloud_forward_15">Forward 15 seconds</string>+ <string name="read_aloud_stop_reading">Stop reading</string>+ <string name="read_aloud_system_default">System default (%1$s)</string>+ <string name="read_aloud_language_selected">Selected</string>+ <string name="read_aloud_languages_loading">Loading available languages…</string>+ <string name="settings_read_aloud_language">Read aloud language</string>+ <string name="settings_read_aloud_language_body">Choose the language used when reading documents aloud.</string>+ <string name="viewer_night_mode_on">Night mode on</string>+ <string name="viewer_night_mode_off">Night mode off</string><!-- Translator note: opens the choice of the language the voice reads in. -->- <string name="read_aloud_voice">Voice</string>+ <string name="read_aloud_speed">Playback speed</string>+ <string name="sheet_not_found">Not found</string><string name="read_aloud_choose_language">Choose language</string><string name="read_aloud_voice_settings">Voice settings</string>