Skip to content

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

Rebuild the viewer's PDF menus: one home per tool, grouped lists, a dock you can choose

Hk-1783e7f462e4a4c
diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/AppViewModel.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/AppViewModel.kt
index 927b159..a0d657c 100644
--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/AppViewModel.kt
+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/AppViewModel.kt
@@ -940,6 +940,15 @@ class AppViewModel(app: Application, private val saved: SavedStateHandle) : Andr
appPrefs.edit().putString("pageMode", if (mode == com.chethan616.clearpdf.ui.viewer.PageMode.SinglePage) "single" else "continuous").apply()
}
+ /** Whether the bars name each tool under its glyph (Preferences; on as it comes). */
+ var toolbarLabels by mutableStateOf(appPrefs.getBoolean("toolbarLabels", true))
+ private set
+
+ fun updateToolbarLabels(on: Boolean) {
+ toolbarLabels = on
+ appPrefs.edit().putBoolean("toolbarLabels", on).apply()
+ }
+
fun setNightMode(doc: OpenDocument, on: Boolean) {
doc.controller.nightMode = on
setNightModeDefault(on)
diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/desk/FileMenu.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/desk/FileMenu.kt
index 101ce1e..d7bb90c 100644
--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/desk/FileMenu.kt
+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/desk/FileMenu.kt
@@ -131,7 +131,7 @@ private fun ColumnScope.FileMenuBody(vm: AppViewModel, r: FileRow, recent: Boole
Spacer(Modifier.height(4.dp))
@Composable
fun row(label: String, icon: ImageVector, destructive: Boolean = false, action: () -> Unit) {
- MorphMenuRow(GlassMenuItem(label, icon, destructive, action), shut) { choose(action) }
+ MorphMenuRow(GlassMenuItem(label, icon, destructive = destructive, onClick = action), shut) { choose(action) }
}
row(stringResource(R.string.common_tool_edit_pdf), LucideIcons.FilePenLine) { vm.openFor(r, FileTool.Edit) }
row(stringResource(R.string.common_tool_read_aloud), LucideIcons.Volume2) { vm.openFor(r, FileTool.ReadAloud) }
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.kt
index 25b24c4..ace053d 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
@@ -141,6 +141,7 @@ private fun SettingsRoot(vm: AppViewModel, openLicences: () -> Unit, openGlass:
var leaving by remember { mutableStateOf<String?>(null) }
var naming by remember { mutableStateOf(false) }
var authorDialog by remember { mutableStateOf(false) }
+ var customizingDock by remember { mutableStateOf(false) }
LazyColumn(Modifier.fillMaxSize().screenColumn(), contentPadding = PaddingValues(bottom = 32.dp)) {
item { Spacer(Modifier.windowInsetsTopHeight(WindowInsets.statusBars)) }
item(key = "title") {
@@ -157,6 +158,14 @@ private fun SettingsRoot(vm: AppViewModel, openLicences: () -> Unit, openGlass:
Panel {
ThemePicker(vm.theme) { vm.setThemeChoice(it) }
AppearancePicker(vm.cleanAppearance, vm::updateCleanAppearance)
+ ToggleRow(
+ LucideIcons.Type, Candy.Mint, stringResource(R.string.settings_toolbar_labels),
+ stringResource(R.string.settings_toolbar_labels_body), vm.toolbarLabels,
+ ) { vm.updateToolbarLabels(it) }
+ SettingRow(
+ LucideIcons.LayoutGrid, Candy.Sky, stringResource(R.string.settings_customize_dock),
+ { customizingDock = true }, chevron = true,
+ )
// a Liquid Glass setting: Clean is solid surfaces already
if (!vm.cleanAppearance) ToggleRow(
LucideIcons.Contrast, Candy.Sky, stringResource(R.string.settings_reduce_transparency),
@@ -236,6 +245,12 @@ private fun SettingsRoot(vm: AppViewModel, openLicences: () -> Unit, openGlass:
dismiss = stringResource(R.string.common_cancel),
) { GlassTextField(name, { name = it }, stringResource(R.string.common_your_name)) }
}
+ // the dock's editor: which tools it holds, and in what order (the More list is derived)
+ if (customizingDock) {
+ com.chethan616.clearpdf.ui.PdfSheet(onDismiss = { customizingDock = false }) {
+ com.chethan616.clearpdf.ui.viewer.CustomizeDock(vm) { customizingDock = false }
+ }
+ }
}
/** Choose the language used throughout Artefact. */
diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/MorphButton.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/MorphButton.kt
index 3f39254..433ea89 100644
--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/MorphButton.kt
+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/MorphButton.kt
@@ -25,8 +25,6 @@ import androidx.compose.foundation.layout.wrapContentWidth
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
-import androidx.compose.material3.Icon
-import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.LaunchedEffect
@@ -50,14 +48,11 @@ import androidx.compose.ui.layout.onGloballyPositioned
import androidx.compose.ui.layout.onSizeChanged
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.platform.LocalView
-import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.Constraints
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.IntOffset
import androidx.compose.ui.unit.dp
import androidx.compose.ui.util.lerp
-import com.chethan616.clearpdf.ui.theme.Candy
-import com.chethan616.clearpdf.ui.theme.ClearType
import com.chethan616.clearpdf.ui.theme.clear
import kotlin.math.max
import kotlin.math.min
@@ -120,7 +115,9 @@ fun MorphButtonSurface(
maxHeight: Dp = 480.dp,
icon: (@Composable () -> Unit)? = null,
) = MorphButtonSurface(anchor, open, onDismiss, onGone, menuWidth, maxHeight, icon) { shut, choose ->
- items.forEach { item -> MorphMenuRow(item, shut) { choose(item.onClick) } }
+ // the surface runs the row's action once its glass has folded back into the button, and only once
+ var picked by remember { mutableStateOf(false) }
+ MenuRows(items) { item -> if (!picked && !shut) { picked = true; choose(item.onClick) } }
}
/**
@@ -398,23 +395,27 @@ private fun RectMorphSurface(
}
}
-/** One of the menu's rows, as [GlassMenu]'s: the label, its glyph at the end; it runs once the glass has folded. */
+/**
+ * One of a menu's rows, for a menu that lays out its own rows (a [MorphButtonSurface]'s `body`): the
+ * shared face, at the same height as every other menu's rows. Its action runs once the glass has
+ * folded back into the button.
+ */
@Composable
internal fun MorphMenuRow(item: GlassMenuItem, shut: Boolean, close: () -> Unit) {
var chosen by remember { mutableStateOf(false) }
- val ink = LocalGlassInk.current
Row(
- Modifier.fillMaxWidth().pressable({
- if (!chosen && !shut) {
- chosen = true
- // the surface runs the row's action once its glass has folded back into the button
- close()
- }
- }).padding(horizontal = 16.dp, vertical = 11.dp),
+ Modifier.fillMaxWidth()
+ .pressable({
+ if (!chosen && !shut) {
+ chosen = true
+ close()
+ }
+ })
+ .heightIn(min = 48.dp)
+ .padding(horizontal = 16.dp, vertical = 6.dp),
verticalAlignment = Alignment.CenterVertically,
) {
- Text(item.label, style = ClearType.BodyStrong, color = if (item.destructive) Candy.Tomato else 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 ink.copy(alpha = 0.65f), modifier = Modifier.size(19.dp))
+ MenuRowFace(item)
}
}
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.kt
index f98cacb..fd75179 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
@@ -4,6 +4,7 @@ import androidx.activity.compose.BackHandler
import androidx.compose.animation.core.Animatable
import androidx.compose.animation.core.AnimationVector1D
import androidx.compose.foundation.background
+import androidx.compose.foundation.border
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.clickable
import androidx.compose.foundation.gestures.Orientation
@@ -18,6 +19,7 @@ import androidx.compose.foundation.layout.BoxScope
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.ColumnScope
import androidx.compose.foundation.layout.Row
+import androidx.compose.foundation.layout.RowScope
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.fillMaxSize
@@ -73,6 +75,7 @@ import androidx.compose.ui.unit.IntOffset
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import androidx.compose.ui.util.lerp
+import com.chethan616.clearpdf.ui.LucideIcons
import com.chethan616.clearpdf.ui.theme.Candy
import com.chethan616.clearpdf.ui.theme.ClearType
import com.chethan616.clearpdf.ui.theme.clear
@@ -313,7 +316,28 @@ fun GlassRow(
}
/** An item of a [GlassMenu]. */
-data class GlassMenuItem(val label: String, val icon: ImageVector? = null, val destructive: Boolean = false, val onClick: () -> Unit)
+data class GlassMenuItem(
+ val label: String,
+ val icon: ImageVector? = null,
+ val destructive: Boolean = false,
+ /** A small heading above this row, drawn when it differs from the row before it. */
+ val section: String? = null,
+ /** What the row's right edge shows: nothing, a chevron, or a switch. */
+ val trail: MenuTrail = MenuTrail.None,
+ val onClick: () -> Unit,
+)
+
+/** What a menu row shows at its right edge. */
+sealed interface MenuTrail {
+ /** Nothing: the row itself is the action. */
+ object None : MenuTrail
+
+ /** The row opens a sheet or a panel of its own. */
+ object Chevron : MenuTrail
+
+ /** An on/off, drawn as the app's glass switch; the row's action flips it. */
+ data class Switch(val on: Boolean) : MenuTrail
+}
/**
* A popover menu anchored to [anchor] (window bounds of its trigger): unfolds from the trigger's
@@ -341,8 +365,17 @@ fun MenuCard(modifier: Modifier = Modifier, shape: androidx.compose.ui.graphics.
val c = clear
val luminance = rememberGlassLuminance()
GlassCard(
- // unseen for the frame or two it takes to read what is behind it (see [GlassLuminance])
- modifier.graphicsLayer { alpha = if (luminance == null || luminance.measured) 1f else 0f },
+ // unseen for the frame or two it takes to read what is behind it (see [GlassLuminance]);
+ // a hairline rim and a soft shadow keep its edge where the card crosses from a white page
+ // onto the dark ground behind it, where a wash alone has no edge at all
+ modifier
+ .graphicsLayer {
+ alpha = if (luminance == null || luminance.measured) 1f else 0f
+ shadowElevation = 10.dp.toPx()
+ this.shape = shape
+ clip = false
+ }
+ .border(1.dp, if (c.dark) Color.White.copy(alpha = 0.16f) else c.ink.copy(alpha = 0.10f), shape),
shape = shape,
wash = if (c.dark) MenuDarkWash else MenuLightWash,
blur = 16.dp,
@@ -356,8 +389,92 @@ fun MenuCard(modifier: Modifier = Modifier, shape: androidx.compose.ui.graphics.
}
}
+/** The small heading that starts a menu's section: [GlassMenuItem.section] puts one above its row. */
@Composable
-fun GlassMenu(anchor: Rect, onDismiss: () -> Unit, items: List<GlassMenuItem>) {
+internal fun MenuSectionLabel(text: String) {
+ Text(
+ text,
+ style = ClearType.Eyebrow,
+ color = LocalGlassInk.current.copy(alpha = 0.55f),
+ modifier = Modifier.padding(start = 16.dp, end = 16.dp, top = 10.dp, bottom = 2.dp),
+ )
+}
+
+/**
+ * A menu row's face, the same in every menu: the glyph first, its words beside it, then whatever the
+ * row's right edge shows ([GlassMenuItem.trail]) — a chevron for a row that opens its own sheet, the
+ * glass switch for an on/off, nothing for a row that simply acts.
+ *
+ * The row's own press belongs to the caller — or, when its right edge is the control ([onPress]),
+ * to the glyph and the words alone: a switch never consumes a tap, so a pressable row around one
+ * would run the row's action too and flip the setting twice (which is no flip at all).
+ */
+@Composable
+internal fun RowScope.MenuRowFace(item: GlassMenuItem, onPress: (() -> Unit)? = null) {
+ val ink = LocalGlassInk.current
+ val face: @Composable RowScope.() -> Unit = {
+ if (item.icon != null) {
+ Icon(
+ item.icon, null,
+ tint = if (item.destructive) Candy.Tomato else ink.copy(alpha = 0.85f),
+ modifier = Modifier.size(20.dp),
+ )
+ Spacer(Modifier.width(12.dp))
+ }
+ Text(
+ item.label,
+ style = ClearType.Body,
+ color = if (item.destructive) Candy.Tomato else ink,
+ modifier = Modifier.weight(1f),
+ maxLines = 2,
+ overflow = TextOverflow.Ellipsis,
+ )
+ }
+ if (onPress != null) {
+ Row(Modifier.weight(1f).pressable(onPress), verticalAlignment = Alignment.CenterVertically, content = face)
+ } else {
+ face()
+ }
+ when (val trail = item.trail) {
+ MenuTrail.None -> Unit
+ MenuTrail.Chevron -> {
+ Spacer(Modifier.width(8.dp))
+ Icon(LucideIcons.ChevronRight, null, tint = ink.copy(alpha = 0.4f), modifier = Modifier.size(16.dp))
+ }
+ is MenuTrail.Switch -> {
+ Spacer(Modifier.width(10.dp))
+ GlassToggle(trail.on, { item.onClick() }, accent = Candy.Sky)
+ }
+ }
+}
+
+/** [items] as menu rows, each section's rows under its own small heading. */
+@Composable
+internal fun MenuRows(items: List<GlassMenuItem>, onChoose: (GlassMenuItem) -> Unit) {
+ var section: String? = null
+ items.forEach { item ->
+ item.section?.let { if (it != section) MenuSectionLabel(it) }
+ section = item.section
+ // a row whose switch is its right edge is pressed on its words alone (see [MenuRowFace])
+ val switching = item.trail is MenuTrail.Switch
+ Row(
+ Modifier.fillMaxWidth()
+ .then(if (switching) Modifier else Modifier.pressable({ onChoose(item) }))
+ .heightIn(min = 48.dp)
+ .padding(horizontal = 16.dp, vertical = 6.dp),
+ verticalAlignment = Alignment.CenterVertically,
+ ) {
+ MenuRowFace(item, onPress = if (switching) ({ item.onClick() }) else null)
+ }
+ }
+}
+
+@Composable
+fun GlassMenu(
+ anchor: Rect,
+ onDismiss: () -> Unit,
+ items: List<GlassMenuItem>,
+) {
// opened from a round glass button: that button's glass becomes the menu (MorphButtonSurface)
if (isMorphAnchor(anchor, LocalDensity.current)) {
MorphButtonSurface(anchor, open = true, onDismiss = onDismiss, onGone = {}, items = items)
@@ -366,19 +483,11 @@ fun 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))
+ MenuRows(items) { item ->
+ if (!closing) {
+ closing = true
+ onDismiss()
+ android.os.Handler(android.os.Looper.getMainLooper()).postDelayed({ item.onClick() }, MenuGoneMillis)
}
}
Spacer(Modifier.height(6.dp))
diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/Edit.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/Edit.kt
index 24d3f28..5cbddd9 100644
--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/Edit.kt
+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/Edit.kt
@@ -183,7 +183,8 @@ private fun EditToolsBar(vm: AppViewModel, doc: OpenDocument) {
SubToolbar {
val textHint = stringResource(R.string.edit_tap_for_text)
val imageHint = stringResource(R.string.edit_tap_for_image)
- SubTool(LucideIcons.LayoutGrid, stringResource(R.string.common_tool_organize), vm.organizing, {
+ // the bar names tools in a word: "Organize", not the sheet's "Organize pages"
+ SubTool(LucideIcons.LayoutGrid, stringResource(R.string.toolbar_label_organize), vm.organizing, {
vm.organizing = true
doc.controller.pagesOpen = true
})
diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/PagesScreen.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/PagesScreen.kt
index b4a2340..d905c54 100644
--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/PagesScreen.kt
+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/PagesScreen.kt
@@ -61,6 +61,7 @@ import androidx.compose.ui.semantics.Role
import androidx.compose.ui.semantics.contentDescription
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.text.font.FontWeight
+import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.chethan616.clearpdf.R
@@ -134,7 +135,7 @@ fun PagesScreen(vm: AppViewModel, doc: OpenDocument, onClose: () -> Unit) {
}
Spacer(Modifier.width(14.dp))
Text(
- if (organizing && picked.isNotEmpty()) pluralStringResource(R.plurals.pages_selected_count, picked.size, picked.size) else if (organizing) stringResource(R.string.pages_select) else stringResource(R.string.pages_title),
+ if (organizing && picked.isNotEmpty()) pluralStringResource(R.plurals.pages_selected_count, picked.size, picked.size) else if (organizing) stringResource(R.string.toolbar_label_organize) else stringResource(R.string.pages_title),
style = com.chethan616.clearpdf.ui.theme.ClearType.Title, color = com.chethan616.clearpdf.ui.theme.clear.ink, maxLines = 1, modifier = Modifier.weight(1f),
)
if (organizing && exporting == null) {
@@ -254,7 +255,7 @@ fun PagesScreen(vm: AppViewModel, doc: OpenDocument, onClose: () -> Unit) {
OrganizeItem(LucideIcons.Save, stringResource(R.string.common_save), enabled) { vm.writeImages(doc, exporting, picked, share = false) }
OrganizeItem(LucideIcons.Share2, stringResource(R.string.common_share), enabled) { vm.writeImages(doc, exporting, picked, share = true) }
} else if (organizing) {
- OrganizeItem(LucideIcons.FilePlus, stringResource(R.string.pages_insert_page), true) { insertMenu = true }
+ OrganizeItem(LucideIcons.FilePlus, stringResource(R.string.pages_insert_page), true, stringResource(R.string.pages_insert)) { insertMenu = true }
OrganizeItem(LucideIcons.FileOutput, stringResource(R.string.pages_extract), enabled) { vm.extractPages(doc, picked) }
OrganizeItem(LucideIcons.Trash2, stringResource(R.string.common_delete), enabled && picked.size < doc.pageCount) {
vm.runTool(doc, "page_delete", mapOf("pages" to picked.map { it + 1 }))
@@ -263,11 +264,11 @@ fun PagesScreen(vm: AppViewModel, doc: OpenDocument, onClose: () -> Unit) {
OrganizeItem(LucideIcons.RotateCcw, stringResource(R.string.pages_rotate_left), enabled) { vm.runTool(doc, "page_rotate", mapOf("pages" to picked.map { it + 1 }, "degrees" to -90)) }
OrganizeItem(LucideIcons.RotateCw, stringResource(R.string.pages_rotate_right), enabled) { vm.runTool(doc, "page_rotate", mapOf("pages" to picked.map { it + 1 }, "degrees" to 90)) }
} else {
- OrganizeItem(LucideIcons.FilePenLine, stringResource(R.string.common_tool_edit_pdf), true) {
+ OrganizeItem(LucideIcons.FilePenLine, stringResource(R.string.common_tool_edit_pdf), true, stringResource(R.string.pages_edit)) {
close()
vm.enterTool(doc, ViewerTool.Edit)
}
- OrganizeItem(LucideIcons.Crop, stringResource(R.string.common_tool_crop), true) {
+ OrganizeItem(LucideIcons.Crop, stringResource(R.string.common_tool_crop), true, stringResource(R.string.toolbar_label_crop)) {
close()
vm.runQuickTool(doc, QuickTool.Crop)
}
@@ -312,14 +313,28 @@ fun PagesScreen(vm: AppViewModel, doc: OpenDocument, onClose: () -> Unit) {
}
}
-/** An action of the pages' glass bar: its glyph in the glass's ink (it names itself to TalkBack), faint while it can't be used. */
+/**
+ * An action of the pages' glass bar: its glyph in the glass's ink, over its one-word name while the
+ * bars are labelled (Settings ▸ Toolbar labels), faint while it can't be used. It always names
+ * itself to TalkBack in full ([label]); [short] is only what fits under the glyph.
+ */
@Composable
-private fun androidx.compose.foundation.layout.RowScope.OrganizeItem(icon: ImageVector, label: String, enabled: Boolean, onClick: () -> Unit) {
- Box(
+private fun androidx.compose.foundation.layout.RowScope.OrganizeItem(icon: ImageVector, label: String, enabled: Boolean, short: String = label, onClick: () -> Unit) {
+ val named = LocalToolbarLabels.current
+ val ink = com.chethan616.clearpdf.ui.theme.clear.ink
+ Column(
Modifier.weight(1f).fillMaxHeight().pressable(onClick, enabled = enabled, pressedScale = 0.86f).semantics { contentDescription = label },
- contentAlignment = Alignment.Center,
+ horizontalAlignment = Alignment.CenterHorizontally,
+ verticalArrangement = Arrangement.Center,
) {
- com.chethan616.clearpdf.ui.glass.GlassIcon(icon, null, Modifier.size(24.dp).graphicsLayer { alpha = if (enabled) 1f else 0.35f })
+ com.chethan616.clearpdf.ui.glass.GlassIcon(icon, null, Modifier.size(if (named) 22.dp else 24.dp).graphicsLayer { alpha = if (enabled) 1f else 0.35f })
+ // the action's name under its glyph: five glyphs are told apart without trying each
+ if (named) Text(
+ short,
+ style = com.chethan616.clearpdf.ui.theme.ClearType.Caption.copy(fontSize = 10.sp, lineHeight = 12.sp),
+ color = if (enabled) ink else ink.copy(alpha = 0.38f),
+ maxLines = 1, softWrap = false, overflow = TextOverflow.Ellipsis,
+ )
}
}
diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/QuickTools.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/QuickTools.kt
index 4b5c8de..e68b1a5 100644
--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/QuickTools.kt
+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/QuickTools.kt
@@ -70,26 +70,43 @@ import com.chethan616.clearpdf.ui.OpenDocument
import com.chethan616.clearpdf.ui.pdfColors
import kotlin.math.roundToInt
+/** The fixed groups of a PDF's More list, in the order they are always shown. */
+enum class ToolGroup(@StringRes val label: Int) {
+ EditAndMarkUp(R.string.tool_group_edit),
+ Pages(R.string.tool_group_pages),
+ Convert(R.string.tool_group_convert),
+ Security(R.string.tool_group_security),
+}
+
/**
- * A tool that can sit on the viewer's bottom toolbar or in More tools: [label] on the bar,
- * [title] in More tools, [subTools] when it opens a row of sub-tools (the bar's corner mark).
+ * A tool that can sit on the viewer's bottom toolbar or in More: [label] on the bar, [title] in
+ * More, [subTools] when it opens a row of sub-tools (the bar's corner mark), and [group], the
+ * More list's section (null for the tools the header menu owns and for an office document's own).
*/
-enum class QuickTool(val id: String, @StringRes val label: Int, @StringRes val title: Int, val icon: ImageVector, val hue: Color, val subTools: Boolean = false) {
- Edit("edit", R.string.common_tool_edit_pdf, R.string.common_tool_edit_pdf, LucideIcons.FilePenLine, ToolHues.edit),
- Comment("comment", R.string.common_tool_comment, R.string.common_tool_comment, LucideIcons.MessageSquareText, ToolHues.comment, subTools = true),
- Highlight("highlight", R.string.common_tool_highlight, R.string.common_tool_highlight, LucideIcons.Highlighter, ToolHues.text, subTools = true),
- Draw("draw", R.string.common_tool_draw, R.string.common_tool_draw, LucideIcons.PenLine, ToolHues.sign),
- FillSign("fillsign", R.string.common_tool_fill_sign, R.string.common_tool_fill_sign, LucideIcons.Signature, ToolHues.sign, subTools = true),
- Export("export", R.string.common_tool_export, R.string.common_tool_export, LucideIcons.FileOutput, ToolHues.export),
- Combine("combine", R.string.toolbar_label_combine, R.string.common_tool_combine, LucideIcons.Combine, ToolHues.combine),
- Compress("compress", R.string.toolbar_label_compress, R.string.common_tool_compress, LucideIcons.FileArchive, ToolHues.compress),
- Protect("protect", R.string.tool_encryption, R.string.tool_encryption, LucideIcons.FileLock2, ToolHues.protect),
- Organize("organize", R.string.toolbar_label_organize, R.string.common_tool_organize, LucideIcons.LayoutGrid, ToolHues.organize),
- Crop("crop", R.string.toolbar_label_crop, R.string.common_tool_crop, LucideIcons.Crop, ToolHues.crop),
- Ocr("ocr", R.string.toolbar_label_recognize, R.string.common_tool_recognize_text, LucideIcons.ScanText, ToolHues.ocr),
- Create("create", R.string.common_tool_create_pdf, R.string.common_tool_create_pdf, LucideIcons.FilePlus2, ToolHues.create),
- Text("text", R.string.toolbar_label_add_text, R.string.toolbar_tool_text, LucideIcons.Type, ToolHues.text),
- Scan("scan", R.string.common_tool_scan, R.string.common_tool_scan, LucideIcons.Camera, ToolHues.scan),
+enum class QuickTool(
+ val id: String,
+ @StringRes val label: Int,
+ @StringRes val title: Int,
+ val icon: ImageVector,
+ val hue: Color,
+ val subTools: Boolean = false,
+ val group: ToolGroup? = null,
+) {
+ Edit("edit", R.string.common_tool_edit_pdf, R.string.common_tool_edit_pdf, LucideIcons.FilePenLine, ToolHues.edit, group = ToolGroup.EditAndMarkUp),
+ Comment("comment", R.string.common_tool_comment, R.string.common_tool_comment, LucideIcons.MessageSquareText, ToolHues.comment, subTools = true, group = ToolGroup.EditAndMarkUp),
+ Highlight("highlight", R.string.common_tool_highlight, R.string.common_tool_highlight, LucideIcons.Highlighter, ToolHues.text, subTools = true, group = ToolGroup.EditAndMarkUp),
+ Draw("draw", R.string.common_tool_draw, R.string.common_tool_draw, LucideIcons.PenLine, ToolHues.sign, group = ToolGroup.EditAndMarkUp),
+ FillSign("fillsign", R.string.common_tool_fill_sign, R.string.common_tool_fill_sign, LucideIcons.Signature, ToolHues.sign, subTools = true, group = ToolGroup.EditAndMarkUp),
+ Export("export", R.string.common_tool_export, R.string.common_tool_export, LucideIcons.FileOutput, ToolHues.export, group = ToolGroup.Convert),
+ Combine("combine", R.string.toolbar_label_combine, R.string.common_tool_combine, LucideIcons.Combine, ToolHues.combine, group = ToolGroup.Pages),
+ Compress("compress", R.string.toolbar_label_compress, R.string.common_tool_compress, LucideIcons.FileArchive, ToolHues.compress, group = ToolGroup.Convert),
+ Protect("protect", R.string.tool_encryption, R.string.tool_encryption, LucideIcons.FileLock2, ToolHues.protect, group = ToolGroup.Security),
+ Organize("organize", R.string.toolbar_label_organize, R.string.common_tool_organize, LucideIcons.LayoutGrid, ToolHues.organize, group = ToolGroup.Pages),
+ Crop("crop", R.string.toolbar_label_crop, R.string.common_tool_crop, LucideIcons.Crop, ToolHues.crop, group = ToolGroup.Pages),
+ Ocr("ocr", R.string.toolbar_label_recognize, R.string.common_tool_recognize_text, LucideIcons.ScanText, ToolHues.ocr, group = ToolGroup.Convert),
+ Create("create", R.string.common_tool_create_pdf, R.string.common_tool_create_pdf, LucideIcons.FilePlus2, ToolHues.create, group = ToolGroup.Pages),
+ Text("text", R.string.toolbar_label_add_text, R.string.toolbar_tool_text, LucideIcons.Type, ToolHues.text, group = ToolGroup.EditAndMarkUp),
+ Scan("scan", R.string.common_tool_scan, R.string.common_tool_scan, LucideIcons.Camera, ToolHues.scan, group = ToolGroup.Pages),
ReadAloud("readaloud", R.string.common_tool_read_aloud, R.string.common_tool_read_aloud, LucideIcons.Volume2, ToolHues.read),
// office documents' own tools (their engines: WordCraft, DeckCraft)
@@ -108,46 +125,107 @@ enum class QuickTool(val id: String, @StringRes val label: Int, @StringRes val t
/** A presentation's bar: a full-screen show first. */
val SLIDES = listOf(Present, ReadAloud, ExportPdf, SaveAs, Print)
- /** The bar for [doc]: an office document's own tools, else the PDF bar as arranged. */
- fun barFor(doc: com.chethan616.clearpdf.ui.OpenDocument, arranged: List<QuickTool>): List<QuickTool> = when {
- doc.isSlides -> SLIDES
- doc.isOffice -> WORD
- else -> arranged
+ /** The bar for [kind]: an office document's own tools, else the PDF bar as arranged. */
+ fun barFor(kind: ToolDocKind, arranged: List<QuickTool>): List<QuickTool> = when (kind) {
+ ToolDocKind.Slides -> SLIDES
+ ToolDocKind.Word -> WORD
+ ToolDocKind.Pdf -> arranged
}
+ /** The bar for [doc]: an office document's own tools, else the PDF bar as arranged. */
+ fun barFor(doc: com.chethan616.clearpdf.ui.OpenDocument, arranged: List<QuickTool>): List<QuickTool> =
+ barFor(docKind(doc), arranged)
+
fun of(id: String): QuickTool? = entries.firstOrNull { it.id == id }
}
}
-/** How many tools fit on the bar beside More tools at a screen [widthDp] wide. */
+/** What kind of document a tool list is being built for. */
+enum class ToolDocKind { Pdf, Word, Slides }
+
+fun docKind(doc: com.chethan616.clearpdf.ui.OpenDocument): ToolDocKind = when {
+ doc.isSlides -> ToolDocKind.Slides
+ doc.isOffice -> ToolDocKind.Word
+ else -> ToolDocKind.Pdf
+}
+
+/** Tools only an office document has: never in a PDF's dock or lists. */
+private val OfficeOnlyTools = setOf(QuickTool.Present, QuickTool.ExportPdf, QuickTool.SaveAs)
+
+/**
+ * The tools the header (More) menu owns. The dock may still hold them; a PDF's More list never
+ * does, so no action has two homes.
+ */
+private val HeaderOwnedTools = setOf(QuickTool.Edit, QuickTool.ReadAloud, QuickTool.Print)
+
+fun QuickTool.appliesTo(kind: ToolDocKind): Boolean = kind != ToolDocKind.Pdf || this !in OfficeOnlyTools
+
+/** The dock's tools: an office document's fixed bar, else the arranged one, as many as [slots] hold. */
+fun dockTools(kind: ToolDocKind, arranged: List<QuickTool>, slots: Int): List<QuickTool> =
+ QuickTool.barFor(kind, arranged).filter { it.appliesTo(kind) }.distinct().take(slots)
+
+/** The header menu's own tool rows, in a fixed order, without the tools the dock already shows. */
+fun headerTools(kind: ToolDocKind, dock: List<QuickTool>): List<QuickTool> = when (kind) {
+ ToolDocKind.Pdf -> listOf(QuickTool.Edit, QuickTool.ReadAloud, QuickTool.Print).filter { it !in dock }
+ else -> QuickTool.barFor(kind, emptyList()).filter { it !in dock }
+}
+
+/**
+ * A PDF's More list: every tool that applies, not on the dock and not in the header menu, in the
+ * fixed group order and, inside a group, in declaration order. Never the user's arrangement.
+ */
+fun moreTools(kind: ToolDocKind, arranged: List<QuickTool>, slots: Int): List<QuickTool> {
+ val dock = dockTools(kind, arranged, slots)
+ return when (kind) {
+ ToolDocKind.Pdf -> ToolGroup.entries.flatMap { group ->
+ QuickTool.entries.filter { it.group == group && it !in dock && it !in HeaderOwnedTools }
+ }
+ // an office bar does not fit a narrow dock: the header keeps what is left, so the two
+ // lists never show the same tool
+ else -> QuickTool.barFor(kind, emptyList()).filter { it !in dock && it !in headerTools(kind, dock) }
+ }
+}
+
+/** Where every tool of [kind] appears: the dock, the header menu's rows, and the More list. */
+class ToolLayout(val dock: List<QuickTool>, val header: List<QuickTool>, val more: List<QuickTool>)
+
+fun toolLayout(kind: ToolDocKind, arranged: List<QuickTool>, slots: Int): ToolLayout {
+ val dock = dockTools(kind, arranged, slots)
+ return ToolLayout(dock, headerTools(kind, dock), moreTools(kind, arranged, slots))
+}
+
+/** How many tools fit on the bar beside More at a screen [widthDp] wide. */
fun toolbarSlots(widthDp: Int): Int = dockSlots(widthDp)
-/** The bar's tools and More tools' order, as the user arranged them (kept in the app's preferences). */
+/** The dock's room when its tools carry their names (Clean appearance needs a little more). */
+fun toolbarSlots(widthDp: Int, clean: Boolean): Int =
+ if (clean) ((widthDp - 24) / 76 - 1).coerceIn(1, 8) else dockSlots(widthDp)
+
+/** The dock's tools, in the order the user arranged them (kept in the app's preferences). */
@Stable
class QuickToolbarPrefs(context: Context) {
private val prefs = context.getSharedPreferences("quick_toolbar", Context.MODE_PRIVATE)
- var bar by mutableStateOf(read("bar") ?: QuickTool.DEFAULT_BAR)
- private set
-
- /** More tools' order: every tool not on the bar. */
- var grid by mutableStateOf(complete(read("grid").orEmpty(), bar))
+ var bar by mutableStateOf(validBar(read()))
private set
- private fun read(key: String): List<QuickTool>? =
- prefs.getString(key, null)?.let { csv -> csv.split(',').filter { it.isNotBlank() }.mapNotNull(QuickTool::of).distinct() }
+ private fun read(): List<QuickTool> =
+ prefs.getString("bar", null)?.let { csv ->
+ csv.split(',').filter { it.isNotBlank() }.mapNotNull(QuickTool::of)
+ }.orEmpty()
- fun save(newBar: List<QuickTool>, newGrid: List<QuickTool>) {
- bar = newBar.distinct()
- grid = complete(newGrid, bar)
- prefs.edit().putString("bar", bar.joinToString(",") { it.id }).putString("grid", grid.joinToString(",") { it.id }).apply()
+ fun save(newBar: List<QuickTool>) {
+ bar = validBar(newBar)
+ // a layout saved before the More list was derived kept a "grid" order: it is never read
+ // again, so drop it once rather than leaving it to confuse a later version
+ prefs.edit().putString("bar", bar.joinToString(",") { it.id }).remove("grid").apply()
}
companion object {
- /** [order] without the bar's tools, followed by any tool it is missing. */
- fun complete(order: List<QuickTool>, bar: List<QuickTool>): List<QuickTool> {
- val g = order.filter { it !in bar }.distinct()
- return g + QuickTool.entries.filter { it !in bar && it !in g }
+ /** [order] without office-only tools or repeats; empty, the dock's default tools. */
+ fun validBar(order: List<QuickTool>): List<QuickTool> {
+ val tools = order.filter { it.appliesTo(ToolDocKind.Pdf) }.distinct()
+ return tools.ifEmpty { QuickTool.DEFAULT_BAR }
}
}
}
@@ -187,56 +265,44 @@ fun AppViewModel.runQuickTool(doc: OpenDocument, tool: QuickTool) {
}
/**
- * Customize toolbar: the bar's tools on top and the rest below, as More tools holds them. A tool
- * is dragged (or tapped) from one to the other; dropped on a full bar it pushes the bar's last
- * tool down. The tick keeps the new arrangement, the cross leaves the old one.
+ * Customize dock: the tools the bottom bar holds, in the order it holds them. Drag one along the
+ * capsule to move it, tap one to take it off; tap a tool below to put it on. A full dock makes
+ * room by dropping its last tool. The tick keeps the arrangement, the cross leaves it.
+ *
+ * Only the dock is arranged. The More list is derived from it in a fixed order, so nothing here
+ * can reorder it.
*/
@Composable
-fun CustomizeToolbar(vm: AppViewModel, onDone: () -> Unit) {
+fun CustomizeDock(vm: AppViewModel, onDone: () -> Unit) {
val c = pdfColors
val prefs = vm.quickToolbar
- val slots = toolbarSlots(LocalConfiguration.current.screenWidthDp)
+ val slots = toolbarSlots(LocalConfiguration.current.screenWidthDp, com.chethan616.clearpdf.ui.theme.clear.clean)
val bar = remember { prefs.bar.take(slots).toMutableStateList() }
- val grid = remember { mutableStateListOf<QuickTool>().apply { addAll(QuickToolbarPrefs.complete(prefs.grid + prefs.bar.drop(slots), bar)) } }
+ // every tool that could sit on the dock, in the app's own order: never arranged here
+ val rest = QuickTool.entries.filter { it.appliesTo(ToolDocKind.Pdf) && it !in bar }
val rects = remember { mutableStateMapOf<QuickTool, Rect>() }
var barRect by remember { mutableStateOf(Rect.Zero) }
- var gridRect by remember { mutableStateOf(Rect.Zero) }
var origin by remember { mutableStateOf(Offset.Zero) }
var dragging by remember { mutableStateOf<QuickTool?>(null) }
var dragPos by remember { mutableStateOf(Offset.Zero) }
- fun toBar(t: QuickTool, index: Int) {
- bar.remove(t)
- grid.remove(t)
- bar.add(index.coerceIn(0, bar.size), t)
- while (bar.size > slots) grid.add(0, bar.removeAt(bar.lastIndex))
+ fun put(t: QuickTool) {
+ if (t in bar) return
+ if (bar.size >= slots) bar.removeAt(bar.lastIndex)
+ bar.add(t)
}
- fun toGrid(t: QuickTool, index: Int) {
+ fun move(t: QuickTool, at: Offset) {
+ if (!barRect.contains(at)) return
bar.remove(t)
- grid.remove(t)
- grid.add(index.coerceIn(0, grid.size), t)
- }
-
- fun drop(t: QuickTool, at: Offset) {
- when {
- barRect.contains(at) -> toBar(t, bar.count { it != t && (rects[it]?.center?.x ?: 0f) < at.x })
- gridRect.contains(at) -> {
- // before the nearest tile, or after it when dropped on its right half
- val near = grid.filter { it != t }.minByOrNull { (rects[it]?.center ?: Offset.Infinite).minus(at).getDistanceSquared() }
- val others = grid.filter { it != t }
- val i = near?.let { n -> others.indexOf(n) + if (at.x > (rects[n]?.center?.x ?: 0f)) 1 else 0 } ?: others.size
- toGrid(t, i)
- }
- }
+ bar.add(bar.count { (rects[it]?.center?.x ?: 0f) < at.x }.coerceIn(0, bar.size), t)
}
val wobble by rememberInfiniteTransition(label = "jiggle").animateFloat(-1.5f, 1.5f, infiniteRepeatable(tween(140), RepeatMode.Reverse), label = "angle")
@Composable
- fun Draggable(t: QuickTool, content: @Composable () -> Unit) {
- val title = stringResource(t.title)
- val description = if (t in bar) stringResource(R.string.toolbar_tool_on_bar, title) else stringResource(R.string.toolbar_tool_in_more_tools, title)
+ fun DockTool(t: QuickTool) {
+ val description = stringResource(R.string.toolbar_tool_on_bar, stringResource(t.title))
Box(
Modifier
.onGloballyPositioned { rects[t] = it.boundsInRoot() }
@@ -253,30 +319,31 @@ fun CustomizeToolbar(vm: AppViewModel, onDone: () -> Unit) {
dragPos += amount
},
onDragEnd = {
- drop(t, dragPos)
+ move(t, dragPos)
dragging = null
},
onDragCancel = { dragging = null },
)
}
- .clickable(role = Role.Button) { if (t in bar) toGrid(t, 0) else toBar(t, bar.size) }
+ // a tap takes it off the dock: the More list takes it back in its own group
+ .clickable(role = Role.Button) { bar.remove(t) }
.semantics { contentDescription = description },
- ) { content() }
+ ) { BarGlyph(t.icon, menuInk()) }
}
Box(Modifier.fillMaxWidth().onGloballyPositioned { origin = it.boundsInRoot().topLeft }) {
Column {
- // as More tools' header: its title, a glass close, and the blue tick that keeps the arrangement
+ // as the menus' headers: the title, a glass close, and the blue tick that keeps the dock
val ink = menuInk()
Spacer(Modifier.height(6.dp))
Row(Modifier.fillMaxWidth().padding(start = 18.dp, end = 14.dp), verticalAlignment = Alignment.CenterVertically) {
- Text(stringResource(R.string.toolbar_customize), style = com.chethan616.clearpdf.ui.theme.ClearType.Title.copy(fontSize = 18.sp), color = ink, modifier = Modifier.weight(1f))
+ Text(stringResource(R.string.settings_customize_dock), style = com.chethan616.clearpdf.ui.theme.ClearType.Title.copy(fontSize = 18.sp), color = ink, modifier = Modifier.weight(1f))
com.chethan616.clearpdf.ui.glass.GlassCircle(onDone, size = 36.dp, label = stringResource(R.string.common_cancel)) {
com.chethan616.clearpdf.ui.glass.GlassIcon(LucideIcons.X, null, Modifier.size(18.dp))
}
Spacer(Modifier.width(8.dp))
com.chethan616.clearpdf.ui.glass.GlassCircle({
- prefs.save(bar.toList(), grid.toList())
+ prefs.save(bar.toList())
onDone()
}, size = 36.dp, tint = com.chethan616.clearpdf.ui.theme.Candy.Sky, label = stringResource(R.string.toolbar_save)) {
com.chethan616.clearpdf.ui.glass.GlassIcon(LucideIcons.Check, null, Modifier.size(18.dp))
@@ -291,7 +358,7 @@ fun CustomizeToolbar(vm: AppViewModel, onDone: () -> Unit) {
stringResource(R.string.toolbar_section_toolbar).uppercase(), style = com.chethan616.clearpdf.ui.theme.ClearType.Eyebrow, color = ink.copy(alpha = 0.55f),
modifier = Modifier.padding(start = 20.dp, top = 18.dp, bottom = 8.dp),
)
- // the toolbar as it looks on the page: a capsule of its glyphs, the blue More tools circle at its end
+ // the dock as it looks on the page: a capsule of its glyphs, the blue More circle at its end
Row(
Modifier.fillMaxWidth().padding(horizontal = 12.dp).height(60.dp),
verticalAlignment = Alignment.CenterVertically,
@@ -305,25 +372,35 @@ fun CustomizeToolbar(vm: AppViewModel, onDone: () -> Unit) {
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.SpaceEvenly,
) {
- for (t in bar) Draggable(t) { BarGlyph(t.icon, ink) }
- // room left on the bar: faint places to drop a tool
+ for (t in bar) DockTool(t)
+ // room left on the dock: faint places to drop a tool
repeat(slots - bar.size) { Box(Modifier.size(44.dp), contentAlignment = Alignment.Center) { Box(Modifier.size(8.dp).clip(androidx.compose.foundation.shape.CircleShape).background(ink.copy(alpha = 0.18f))) } }
}
Spacer(Modifier.width(10.dp))
- // More tools always ends the bar
+ // More always ends the dock
Box(Modifier.size(52.dp).clip(androidx.compose.foundation.shape.CircleShape).background(com.chethan616.clearpdf.ui.theme.Candy.Sky), contentAlignment = Alignment.Center) {
Icon(LucideIcons.LayoutGrid, null, tint = Color.White, modifier = Modifier.size(24.dp))
}
}
Text(
- stringResource(R.string.common_tool_more_tools).uppercase(), style = com.chethan616.clearpdf.ui.theme.ClearType.Eyebrow, color = ink.copy(alpha = 0.55f),
- modifier = Modifier.padding(start = 20.dp, top = 18.dp, bottom = 4.dp),
+ stringResource(R.string.settings_off_the_dock).uppercase(), style = com.chethan616.clearpdf.ui.theme.ClearType.Eyebrow, color = ink.copy(alpha = 0.55f),
+ modifier = Modifier.padding(start = 20.dp, top = 18.dp, bottom = 6.dp),
)
- // More tools' own tiles, four to a row
- Column(Modifier.fillMaxWidth().padding(horizontal = 10.dp).heightIn(min = 96.dp).onGloballyPositioned { gridRect = it.boundsInRoot() }) {
- grid.chunked(4).forEach { row ->
+ // the tools that are not on the dock, four to a row, in the app's own order
+ Column(Modifier.fillMaxWidth().padding(horizontal = 10.dp)) {
+ rest.chunked(4).forEach { row ->
Row(Modifier.fillMaxWidth(), verticalAlignment = Alignment.Top) {
- row.forEach { t -> Box(Modifier.weight(1f), contentAlignment = Alignment.TopCenter) { Draggable(t) { ToolTileFace(t.icon, stringResource(t.title), t.hue) } } }
+ row.forEach { t ->
+ val title = stringResource(t.title)
+ val description = stringResource(R.string.toolbar_tool_off_dock, title)
+ Box(
+ Modifier.weight(1f), contentAlignment = Alignment.TopCenter,
+ ) {
+ Box(
+ Modifier.clickable(role = Role.Button) { put(t) }.semantics { contentDescription = description },
+ ) { ToolTileFace(t.icon, title, t.hue) }
+ }
+ }
repeat(4 - row.size) { Spacer(Modifier.weight(1f)) }
}
Spacer(Modifier.height(6.dp))
diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/Tools.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/Tools.kt
index b8a3e78..4c0a9dc 100644
--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/Tools.kt
+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/Tools.kt
@@ -28,6 +28,7 @@ import androidx.compose.material3.Slider
import androidx.compose.material3.SliderDefaults
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.DisposableEffect
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
@@ -368,6 +369,7 @@ fun ToolSubToolbar(vm: AppViewModel, doc: OpenDocument) {
fun toggle(p: Picker) {
ctl.picker = if (ctl.picker == p) Picker.None else p
}
+ CompositionLocalProvider(LocalToolbarLabels provides vm.toolbarLabels) {
when (ctl.tool) {
ViewerTool.Markup -> SubToolbar {
SubTool(LucideIcons.Highlighter, stringResource(R.string.common_tool_highlight), ctl.markup == TextMarkup.Highlight, { ctl.markup = TextMarkup.Highlight })
@@ -403,6 +405,7 @@ fun ToolSubToolbar(vm: AppViewModel, doc: OpenDocument) {
ViewerTool.Edit -> EditToolbar(vm, doc)
ViewerTool.None -> Unit
}
+ }
}
/**
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.kt
index 2c294da..b64ca8a 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
@@ -70,6 +70,7 @@ import com.chethan616.clearpdf.ui.glass.BarGlyphButton
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.MenuTrail
import com.chethan616.clearpdf.ui.glass.GlassMotion
import com.chethan616.clearpdf.ui.glass.GlassPill
import com.chethan616.clearpdf.ui.glass.MinTouch
@@ -353,23 +354,25 @@ internal fun dockSlots(widthDp: Int): Int = when {
/**
* The floating dock, in the manner of the tools' own bars (Edit, Comment, Fill & Sign): the tools
* the reader keeps there as glyphs on one glass capsule, the one just tapped on a blue disc for a
- * moment, and More tools as a blue glass circle beside it (where those bars keep Done). One capsule
+ * moment, and More as a blue glass circle beside it (where those bars keep Done). One capsule
* is one piece of glass to draw, where a row of glass circles was one each.
*/
@Composable
fun QuickToolbar(
tools: List<QuickTool>,
onTool: (QuickTool) -> Unit,
- moreTools: List<QuickTool> = emptyList(),
- onCustomize: ((Rect) -> Unit)? = null,
+ /** Name each tool under its glyph (Settings ▸ Toolbar labels). */
+ labels: Boolean = true,
+ /** Everything the dock has no room for, in the fixed order its groups go in. */
+ more: List<QuickTool> = emptyList(),
) {
val width = LocalConfiguration.current.screenWidthDp
- // Leave room for a readable label and keep the remaining actions in More tools.
- val slots = if (clear.clean) ((width - 24) / 76 - 1).coerceIn(1, 8) else dockSlots(width)
+ // Leave room for a readable label and keep the remaining actions in More.
+ val slots = toolbarSlots(width, clear.clean)
val shown = tools.take(slots)
- // 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() }
+ // The four-dot control is an anchored action menu, not another bottom sheet. It holds what
+ // the dock has no room for, already worked out by the one layout both menus share.
+ val overflow = remember(more) { more.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, GlassMotion.morph(), label = "more")
@@ -388,15 +391,15 @@ fun QuickToolbar(
verticalAlignment = Alignment.CenterVertically,
) {
for (tool in shown) {
- LabeledDockItem(tool.icon, stringResource(tool.label), Modifier.weight(1f), lit == tool) {
+ LabeledDockItem(tool.icon, stringResource(tool.label), Modifier.weight(1f), lit == tool, labels) {
lit = tool
onTool(tool)
}
}
- if (overflow.isNotEmpty() || onCustomize != null) {
+ if (overflow.isNotEmpty()) {
LabeledDockItem(
- LucideIcons.LayoutGrid, stringResource(R.string.common_tool_more_tools),
- Modifier.weight(1f).onGloballyPositioned { moreRect = it.boundsInWindow() }, menuAt != null,
+ LucideIcons.LayoutGrid, stringResource(R.string.common_tool_more),
+ Modifier.weight(1f).onGloballyPositioned { moreRect = it.boundsInWindow() }, menuAt != null, labels,
) { menuAt = moreRect }
}
}
@@ -412,7 +415,7 @@ fun QuickToolbar(
verticalAlignment = Alignment.CenterVertically,
) {
CompositionLocalProvider(LocalGlassInk provides ink.color) {
- for (t in shown) DockItem(t.icon, stringResource(t.label), lit == t) {
+ for (t in shown) DockItem(t.icon, stringResource(t.label), lit == t, labels) {
lit = t
onTool(t)
}
@@ -420,28 +423,33 @@ fun QuickToolbar(
}
// 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(
+ if (overflow.isNotEmpty()) GlassCircle(
onClick = { menuAt = moreRect },
size = 48.dp,
tint = Candy.Sky,
// solid, not blended over the page: a washed-out blue lost its white glyph on white (#158)
solid = true,
- label = stringResource(R.string.common_tool_more_tools),
+ label = stringResource(R.string.common_tool_more),
modifier = Modifier.onGloballyPositioned { moreRect = it.boundsInWindow() },
) {
GlassIcon(LucideIcons.LayoutGrid, null, Modifier.size(22.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) })
+ // the fixed group order, then the order the tools were declared in; never the user's own
+ val rows = overflow.sortedWith(compareBy<QuickTool>({ it.group?.ordinal ?: Int.MAX_VALUE }, { it.ordinal }))
+ GlassMenu(anchor, { menuAt = null }, rows.map { tool ->
+ GlassMenuItem(
+ stringResource(tool.title), tool.icon,
+ section = tool.group?.let { stringResource(it.label) },
+ trail = if (tool.subTools) MenuTrail.Chevron else MenuTrail.None,
+ ) { onTool(tool) }
})
}
}
@Composable
-private fun LabeledDockItem(icon: ImageVector, label: String, modifier: Modifier, lit: Boolean, onClick: () -> Unit) {
+private fun LabeledDockItem(icon: ImageVector, label: String, modifier: Modifier, lit: Boolean, showLabel: Boolean, onClick: () -> Unit) {
val c = clear
Column(
modifier.fillMaxHeight().clip(RoundedRectangle(12.dp))
@@ -450,9 +458,11 @@ private fun LabeledDockItem(icon: ImageVector, label: String, modifier: Modifier
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center,
) {
- Icon(icon, null, Modifier.size(20.dp), tint = c.ink)
- Text(label, style = ClearType.Caption, color = c.ink, maxLines = 2, overflow = TextOverflow.Ellipsis,
- textAlign = androidx.compose.ui.text.style.TextAlign.Center)
+ Icon(icon, null, Modifier.size(if (showLabel) 20.dp else 24.dp), tint = c.ink)
+ if (showLabel) Text(
+ label, style = ClearType.Caption, color = c.ink, maxLines = 2, overflow = TextOverflow.Ellipsis,
+ textAlign = androidx.compose.ui.text.style.TextAlign.Center,
+ )
}
}
@@ -463,7 +473,7 @@ private fun Modifier.androidxRotate(degrees: Float) = this.graphicsLayer { rotat
* eraser, highlighter, scribble) are told apart without trying each (#158); [lit], white on a blue pill.
*/
@Composable
-private fun DockItem(icon: ImageVector, label: String, lit: Boolean, onClick: () -> Unit) {
+private fun DockItem(icon: ImageVector, label: String, lit: Boolean, showLabel: Boolean, onClick: () -> Unit) {
val disc by animateColorAsState(if (lit) Candy.Sky else Color.Transparent, GlassMotion.settle(), label = "dock")
val ink = com.chethan616.clearpdf.ui.glass.LocalGlassInk.current.takeIf { it != Color.Unspecified } ?: clear.ink
val glyph by animateColorAsState(if (lit) Color.White else ink, GlassMotion.settle(), label = "dockInk")
@@ -475,14 +485,19 @@ private fun DockItem(icon: ImageVector, label: String, lit: Boolean, onClick: ()
Box(Modifier.size(width = 44.dp, height = 28.dp).clip(Capsule).background(disc), contentAlignment = Alignment.Center) {
Icon(icon, null, tint = glyph, modifier = Modifier.size(21.dp))
}
- Spacer(Modifier.height(2.dp))
- Text(
- label, style = ClearType.Caption.copy(fontSize = 11.sp, lineHeight = 13.sp, fontWeight = androidx.compose.ui.text.font.FontWeight.Medium),
- color = ink, maxLines = 1, softWrap = false, overflow = TextOverflow.Ellipsis,
- )
+ if (showLabel) {
+ Spacer(Modifier.height(2.dp))
+ Text(
+ label, style = ClearType.Caption.copy(fontSize = 11.sp, lineHeight = 13.sp, fontWeight = androidx.compose.ui.text.font.FontWeight.Medium),
+ color = ink, maxLines = 1, softWrap = false, overflow = TextOverflow.Ellipsis,
+ )
+ }
}
}
+/** Whether the bars name each tool under its glyph (Settings ▸ Toolbar labels). */
+val LocalToolbarLabels = androidx.compose.runtime.compositionLocalOf { true }
+
/** No line along bars any more: glass floats. Kept so the tools' own bars can call it. */
fun Modifier.barTopLine(): Modifier = this
@@ -563,6 +578,7 @@ private fun SubButton(icon: ImageVector, description: String, selected: Boolean,
@Composable
private fun SubFace(description: String, selected: Boolean, onClick: () -> Unit, width: Dp, enabled: Boolean = true, shaded: Boolean = false, glyph: @Composable (Color) -> Unit) {
val c = clear
+ val ink = com.chethan616.clearpdf.ui.glass.LocalGlassInk.current.takeIf { it != Color.Unspecified } ?: c.ink
val vivid = selected && !shaded
val disc by animateColorAsState(
when {
@@ -572,13 +588,23 @@ private fun SubFace(description: String, selected: Boolean, onClick: () -> Unit,
},
GlassMotion.settle(), label = "sub",
)
- Box(
+ val named = LocalToolbarLabels.current
+ Column(
Modifier.width(width).fillMaxHeight().slideToWhenChosen(vivid).pressable(onClick, enabled = enabled, pressedScale = 0.86f).semantics { contentDescription = description },
- contentAlignment = Alignment.Center,
+ horizontalAlignment = Alignment.CenterHorizontally,
+ verticalArrangement = Arrangement.Center,
) {
- Box(Modifier.size(42.dp).clip(CircleShape).background(disc))
- val ink = com.chethan616.clearpdf.ui.glass.LocalGlassInk.current.takeIf { it != Color.Unspecified } ?: c.ink
- glyph(if (!enabled) ink.copy(alpha = 0.38f) else if (vivid) Color.White else ink)
+ Box(contentAlignment = Alignment.Center) {
+ Box(Modifier.size(42.dp).clip(CircleShape).background(disc))
+ glyph(if (!enabled) ink.copy(alpha = 0.38f) else if (vivid) Color.White else ink)
+ }
+ // the tool's name under its glyph: five look-alike glyphs are told apart without trying each
+ if (named) Text(
+ description,
+ style = ClearType.Caption.copy(fontSize = 10.sp, lineHeight = 12.sp),
+ color = if (!enabled) ink.copy(alpha = 0.38f) else ink,
+ maxLines = 1, softWrap = false, overflow = TextOverflow.Ellipsis,
+ )
}
}
diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ViewerController.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ViewerController.kt
index 4f9b0e2..1c9e15d 100644
--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ViewerController.kt
+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ViewerController.kt
@@ -36,7 +36,7 @@ enum class TextMarkup { Highlight, Underline, Strikethrough }
enum class CommentMode { Text, Voice }
/** What the bottom sheet over the viewer shows. */
-enum class ViewerSheet { None, More, ViewSettings, Attachments, Bookmarks, Comments, MoreTools, Signatures, SaveAs, SlideNotes, Info }
+enum class ViewerSheet { None, More, ViewSettings, Attachments, Bookmarks, Comments, Signatures, SaveAs, SlideNotes, Info }
/**
* The viewer's own state for one document, beside the page view ([ViewerState]): whether the
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.kt
index 75b2704..1b81646 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
@@ -103,7 +103,6 @@ fun ViewerScreen(vm: AppViewModel, doc: OpenDocument) {
// More opened from its circle: the circle itself becomes the menu (MorphButtonSurface), hidden in the bar meanwhile
var moreFromButton by remember { mutableStateOf(false) }
var moreMorphUp by remember { mutableStateOf(false) }
- var moreToolsMenuAnchor by remember { mutableStateOf(Rect.Zero) }
// The system bars go with the viewer's bars.
val statusBar = vm.statusBarInDocuments
@@ -479,16 +478,19 @@ fun ViewerScreen(vm: AppViewModel, doc: OpenDocument) {
if (vm.wordEditing == doc) {
WordEditDock(vm, doc)
} else if (ctl.tool == ViewerTool.None) {
+ // one layout for the dock, the header's rows and More: no tool in two places
+ val layout = toolLayout(
+ docKind(doc), vm.quickToolbar.bar,
+ toolbarSlots(
+ androidx.compose.ui.platform.LocalConfiguration.current.screenWidthDp,
+ com.chethan616.clearpdf.ui.theme.clear.clean,
+ ),
+ )
QuickToolbar(
- tools = QuickTool.barFor(doc, vm.quickToolbar.bar),
+ tools = layout.dock,
onTool = { vm.runQuickTool(doc, it) },
- 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
- }),
+ labels = vm.toolbarLabels,
+ more = layout.more,
)
} else {
ToolSubToolbar(vm, doc)
@@ -521,7 +523,6 @@ fun ViewerScreen(vm: AppViewModel, doc: OpenDocument) {
ViewerSheet.Bookmarks -> BookmarksSheet(vm, doc)
ViewerSheet.Attachments -> AttachmentsSheet(vm, doc)
ViewerSheet.Comments -> Unit
- ViewerSheet.MoreTools -> MoreToolsSheet(vm, doc, moreToolsMenuAnchor)
ViewerSheet.SaveAs -> SaveAsSheet(vm, doc)
ViewerSheet.SlideNotes -> SlideNotesSheet(vm, doc)
ViewerSheet.Info -> DocumentInfoSheet(vm, doc)
@@ -552,7 +553,10 @@ fun ViewerScreen(vm: AppViewModel, doc: OpenDocument) {
vm.replyPrompt?.takeIf { it.doc === doc }?.let { ReplySheet(vm, 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 })
+ // the pages bar is one of the bottom bars: it names its actions only while they are named
+ if (ctl.pagesOpen) CompositionLocalProvider(LocalToolbarLabels provides vm.toolbarLabels) {
+ 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.kt
index e435040..fa5f83d 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
@@ -68,6 +68,7 @@ import com.chethan616.clearpdf.ui.SheetTitle
import com.chethan616.clearpdf.ui.pdfColors
import com.chethan616.clearpdf.ui.SheetCircleButton
import com.chethan616.clearpdf.ui.SheetSection
+import com.chethan616.clearpdf.ui.glass.MenuTrail
import com.chethan616.clearpdf.ui.glass.pressable
import com.chethan616.clearpdf.ui.theme.Candy
import com.chethan616.clearpdf.ui.theme.ClearType
@@ -97,36 +98,42 @@ fun MoreSheet(
val ctl = doc.controller
val bookmarked = vm.bookmarks.isBookmarked(doc, doc.viewer.currentPage)
val starred = vm.isStarred(doc)
+ // what the bottom bar already shows is not offered again here: one action, one place. The
+ // rows come from the same layout both menus are built from, so they cannot drift.
+ val layout = toolLayout(
+ docKind(doc), vm.quickToolbar.bar,
+ toolbarSlots(androidx.compose.ui.platform.LocalConfiguration.current.screenWidthDp, clear.clean),
+ )
+ val page = stringResource(R.string.menu_section_page)
+ val reading = stringResource(R.string.settings_reading)
+ val file = stringResource(R.string.menu_section_file)
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 })
- if (doc.isSlides) add(com.chethan616.clearpdf.ui.glass.GlassMenuItem(stringResource(R.string.office_slide_notes), LucideIcons.FileText) { ctl.sheet = ViewerSheet.SlideNotes })
- 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 (QuickTool.ReadAloud in layout.header) add(com.chethan616.clearpdf.ui.glass.GlassMenuItem(stringResource(R.string.common_tool_read_aloud), LucideIcons.Volume2) { vm.startReadAloud(doc) })
+ if (QuickTool.Present in layout.header) add(com.chethan616.clearpdf.ui.glass.GlassMenuItem(stringResource(R.string.office_present), LucideIcons.Presentation) { vm.presenting = doc })
+ if (QuickTool.Edit in layout.header && !doc.isOffice) add(com.chethan616.clearpdf.ui.glass.GlassMenuItem(stringResource(R.string.common_tool_edit_pdf), LucideIcons.FilePenLine) { vm.enterTool(doc, ViewerTool.Edit) })
+ // the document itself: its pages, its contents and what is written on them
+ if (doc.isSlides) add(com.chethan616.clearpdf.ui.glass.GlassMenuItem(stringResource(R.string.office_slide_notes), LucideIcons.FileText, section = page, trail = MenuTrail.Chevron) { ctl.sheet = ViewerSheet.SlideNotes })
+ add(com.chethan616.clearpdf.ui.glass.GlassMenuItem(stringResource(R.string.sheet_pages), LucideIcons.LayoutGrid, section = page, trail = MenuTrail.Chevron) { ctl.pagesOpen = true })
+ add(com.chethan616.clearpdf.ui.glass.GlassMenuItem(stringResource(R.string.sheet_bookmarks_contents), LucideIcons.Bookmark, section = page, trail = MenuTrail.Chevron) { ctl.sheet = ViewerSheet.Bookmarks })
+ if (doc.info.attachments > 0u) add(com.chethan616.clearpdf.ui.glass.GlassMenuItem(stringResource(R.string.sheet_attachments), LucideIcons.Paperclip, section = page, trail = MenuTrail.Chevron) { 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 })
+ add(com.chethan616.clearpdf.ui.glass.GlassMenuItem(stringResource(R.string.sheet_comment_list), LucideIcons.MessagesSquare, section = page, trail = MenuTrail.Chevron) { ctl.sheet = ViewerSheet.Comments })
+ add(com.chethan616.clearpdf.ui.glass.GlassMenuItem(stringResource(R.string.sign_signatures), LucideIcons.ShieldCheck, section = page, trail = MenuTrail.Chevron) { ctl.sheet = ViewerSheet.Signatures })
}
+ // how it reads
+ add(com.chethan616.clearpdf.ui.glass.GlassMenuItem(stringResource(R.string.sheet_night_mode), LucideIcons.Moon, section = reading, trail = MenuTrail.Switch(ctl.nightMode)) { vm.setNightMode(doc, !ctl.nightMode) })
+ add(com.chethan616.clearpdf.ui.glass.GlassMenuItem(stringResource(R.string.sheet_view_settings), LucideIcons.Glasses, section = reading, trail = MenuTrail.Chevron) { ctl.sheet = ViewerSheet.ViewSettings })
+ // the file itself: what the bar cannot hold
+ if (QuickTool.Print in layout.header) add(com.chethan616.clearpdf.ui.glass.GlassMenuItem(stringResource(R.string.sheet_print), LucideIcons.Printer, section = file) { vm.print(doc) })
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 })
+ if (QuickTool.ExportPdf in layout.header) add(com.chethan616.clearpdf.ui.glass.GlassMenuItem(stringResource(R.string.office_export_pdf), LucideIcons.FilePdf, section = file) { vm.exportOffice(doc, "pdf") })
+ if (QuickTool.SaveAs in layout.header) add(com.chethan616.clearpdf.ui.glass.GlassMenuItem(stringResource(R.string.office_save_as), LucideIcons.SaveAs, section = file, trail = MenuTrail.Chevron) { 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) })
+ add(com.chethan616.clearpdf.ui.glass.GlassMenuItem(stringResource(R.string.common_save_copy), LucideIcons.Copy, section = file) { vm.saveCopyAs(doc) })
+ // the rest of the tools (Export, Compress, Combine, Protect, Create PDF) live in the
+ // dock's own More list, each under its group
}
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) }) }
@@ -191,7 +198,7 @@ internal fun modifiedLabel(t: Long, yesterday: String, now: Long = System.curren
fun ViewSettingsSheet(vm: AppViewModel, doc: OpenDocument) {
val ctl = doc.controller
PdfSheet(onDismiss = { ctl.sheet = ViewerSheet.None }) {
- SheetBackHeader(stringResource(R.string.sheet_view_settings), onBack = { ctl.sheet = ViewerSheet.More })
+ SheetBackHeader(stringResource(R.string.sheet_view_settings), onBack = { ctl.sheet = ViewerSheet.None })
// how the pages run, as three cards to choose from (the chosen one lit in blue)
Row(Modifier.fillMaxWidth().padding(horizontal = 12.dp, vertical = 4.dp), horizontalArrangement = Arrangement.spacedBy(8.dp)) {
LayoutChoice(LucideIcons.GalleryVerticalEnd, stringResource(R.string.sheet_continuous), doc.viewer.mode == PageMode.Continuous && !vm.twoPages && !vm.readingMode) {
@@ -282,7 +289,7 @@ fun BookmarksSheet(vm: AppViewModel, doc: OpenDocument) {
var parent by remember { mutableStateOf(-1) }
var renaming by remember { mutableStateOf<Int?>(null) }
PdfSheet(onDismiss = { ctl.sheet = ViewerSheet.None }, maxHeightFraction = 0.69f, fill = true) {
- SheetBackHeader(stringResource(R.string.sheet_bookmarks_contents), onBack = { ctl.sheet = ViewerSheet.More })
+ SheetBackHeader(stringResource(R.string.sheet_bookmarks_contents), onBack = { ctl.sheet = ViewerSheet.None })
// Contents | Bookmarks: the glass segmented control
com.chethan616.clearpdf.ui.glass.GlassTabs(
listOf(
@@ -450,7 +457,7 @@ fun AttachmentsSheet(vm: AppViewModel, doc: OpenDocument) {
// the document's own files, as the reference lists them (a comment's file is opened from the comment)
val files = list.filter { !it.onPage }
PdfSheet(onDismiss = { ctl.sheet = ViewerSheet.None }, maxHeightFraction = 0.7f) {
- SheetBackHeader(stringResource(R.string.sheet_attachments), onBack = { ctl.sheet = ViewerSheet.More })
+ SheetBackHeader(stringResource(R.string.sheet_attachments), onBack = { ctl.sheet = ViewerSheet.None })
LazyColumn(Modifier.padding(horizontal = 12.dp).clip(RoundedRectangle(22.dp)).background(cellFill())) {
items(files) { a ->
SheetRow(LucideIcons.FileText, a.name, { ctl.sheet = ViewerSheet.None; vm.openAttachment(doc, a.name) }, tint = Candy.Grape, chevron = true)
@@ -544,64 +551,6 @@ object ToolHues {
val redact = Color(0xFFF2615C)
}
-/** 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, anchor: Rect) {
- val ctl = doc.controller
- var customizing by remember { mutableStateOf(false) }
- 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 }
- } 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 = menuInk(), 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))
- }
- }
- }
- 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 = menuInk(), modifier = Modifier.size(18.dp))
- Text(stringResource(R.string.sheet_customize_toolbar), style = ClearType.BodyStrong, color = menuInk())
- }
- Spacer(Modifier.height(12.dp))
- }
- }
-}
-
-
/** Save as: the formats the document's engine writes, each saved to Downloads. */
/**
* What the document is, as a card about it: its first page and name up top with what kind of file it
diff --git a/android/app/src/main/res/values-ar/strings.xml b/android/app/src/main/res/values-ar/strings.xml
index bdddcac..a7b6650 100644
--- a/android/app/src/main/res/values-ar/strings.xml
+++ b/android/app/src/main/res/values-ar/strings.xml
@@ -10,6 +10,9 @@
<string name="settings_language_system">لغة النظام (%1$s)</string>
<string name="settings_open_in_night_mode">افتح ملفات PDF والمستندات دائمًا بالوضع الليلي</string>
<string name="settings_open_in_night_mode_body">افتح كل ملف PDF ومستند مع تفعيل الوضع الليلي.</string>
+ <!-- bars: a name under each tool's glyph -->
+ <string name="settings_toolbar_labels">تسميات شريط الأدوات</string>
+ <string name="settings_toolbar_labels_body">ضع اسم كل أداة أسفل رمزها في الأشرطة.</string>
<string name="open_with">فتح باستخدام Artefact</string>
<string name="common_ok">موافق</string>
<string name="common_cancel">إلغاء</string>
@@ -46,7 +49,6 @@
<string name="common_tool_crop">اقتصاص الصفحات</string>
<string name="common_tool_fill_sign">تعبئة وتوقيع</string>
<string name="common_tool_scan">مسح ضوئي</string>
- <string name="common_tool_more_tools">المزيد من الأدوات</string>
<string name="common_tool_recognize_text">التعرّف على النص</string>
<string name="common_tool_comment">تعليق</string>
<string name="common_tool_highlight">تمييز</string>
@@ -317,7 +319,6 @@
<string name="voice_open_settings">فتح الإعدادات</string>
<string name="voice_not_now">ليس الآن</string>
<string name="pages_title">الصفحات</string>
- <string name="pages_select">تحديد الصفحات</string>
<plurals name="pages_selected_count">
<item quantity="zero">لم تُحدّد أي صفحة</item>
<item quantity="one">حُدّدت صفحة واحدة</item>
@@ -331,6 +332,8 @@
<string name="pages_extract">استخراج</string>
<string name="pages_rotate_left">يسار</string>
<string name="pages_rotate_right">يمين</string>
+ <!-- Translator note: Edit PDF, as the pages bar names it. Keep it short. -->
+ <string name="pages_edit">تحرير</string>
<string name="pages_insert">إدراج</string>
<string name="pages_at_start">في البداية</string>
<string name="pages_at_end">في النهاية</string>
@@ -431,6 +434,10 @@
<string name="sheet_single_page">صفحة واحدة</string>
<string name="sheet_reading_mode">وضع القراءة</string>
<string name="sheet_night_mode">الوضع الليلي</string>
+
+ <!-- More menu: the small headings that group its rows -->
+ <string name="menu_section_page">صفحة</string>
+ <string name="menu_section_file">ملف</string>
<string name="sheet_tab_contents">الفهرس</string>
<string name="sheet_tab_bookmarks">الإشارات المرجعية</string>
<string name="sheet_no_contents">لا يحتوي هذا المستند على فهرس.</string>
@@ -442,7 +449,6 @@
<string name="sheet_bookmark_removed">تمت إزالة الإشارة المرجعية %1$s</string>
<string name="sheet_delete_all">حذف الكل</string>
<string name="sheet_page">الصفحة %1$d</string>
- <string name="sheet_customize_toolbar">تخصيص شريط الأدوات</string>
<plurals name="sheet_size_bytes">
<item quantity="zero">صفر بايت</item>
<item quantity="one">بايت واحد</item>
@@ -513,19 +519,13 @@
<string name="toolbar_label_recognize">التعرّف</string>
<string name="toolbar_label_add_text">إضافة نص</string>
<string name="toolbar_tool_text">نص</string>
- <string name="toolbar_customize">تخصيص شريط الأدوات</string>
<string name="toolbar_save">حفظ شريط الأدوات</string>
<plurals name="toolbar_customize_hint">
- <item quantity="zero">اسحب الأدوات بين شريط الأدوات والأدوات الإضافية. يتسع الشريط لـ %1$d.</item>
- <item quantity="one">اسحب الأدوات بين شريط الأدوات والأدوات الإضافية. يتسع الشريط لـ %1$d.</item>
- <item quantity="two">اسحب الأدوات بين شريط الأدوات والأدوات الإضافية. يتسع الشريط لـ %1$d.</item>
- <item quantity="few">اسحب الأدوات بين شريط الأدوات والأدوات الإضافية. يتسع الشريط لـ %1$d.</item>
- <item quantity="many">اسحب الأدوات بين شريط الأدوات والأدوات الإضافية. يتسع الشريط لـ %1$d.</item>
- <item quantity="other">اسحب الأدوات بين شريط الأدوات والأدوات الإضافية. يتسع الشريط لـ %1$d.</item>
+ <item quantity="one">اسحب لإعادة الترتيب. يتسع الشريط لـ %1$d.</item>
+ <item quantity="other">اسحب لإعادة الترتيب. يتسع الشريط لـ %1$d.</item>
</plurals>
<string name="toolbar_section_toolbar">شريط الأدوات</string>
<string name="toolbar_tool_on_bar">%1$s، في شريط الأدوات</string>
- <string name="toolbar_tool_in_more_tools">%1$s، في المزيد من الأدوات</string>
<string name="toolbar_strikethrough">شطب</string>
<string name="toolbar_no_text_to_mark">لا يوجد نص قابل للتحديد في هذه الصفحة. استخدم التعرّف على النص أولًا من «المزيد من الأدوات».</string>
<string name="toolbar_draw_freeform">رسم حر</string>
@@ -1297,4 +1297,15 @@
<string name="settings_reduce_transparency_detail">يصبح الزجاج والأشرطة العائمة معتمًا، لا يظهر شيء من خلفها</string>
<string name="qr_scanner">ماسح رموز QR</string>
<string name="qr_scan_prompt">وجّه الكاميرا نحو رمز QR</string>
+ <!-- The fixed sections of a PDF's More list -->
+ <string name="tool_group_edit">التحرير والتمييز</string>
+ <string name="tool_group_pages">الصفحات</string>
+ <string name="tool_group_convert">التحويل والمشاركة</string>
+ <string name="tool_group_security">الأمان</string>
+ <!-- The dock's round button: the tools the dock has no room for -->
+ <string name="common_tool_more">المزيد</string>
+ <!-- The dock's editor in Settings, and the tools it does not hold -->
+ <string name="settings_customize_dock">تخصيص الشريط</string>
+ <string name="settings_off_the_dock">خارج الشريط</string>
+ <string name="toolbar_tool_off_dock">%1$s، خارج الشريط</string>
</resources>
diff --git a/android/app/src/main/res/values-de/strings.xml b/android/app/src/main/res/values-de/strings.xml
index 318f732..8c9d60b 100644
--- a/android/app/src/main/res/values-de/strings.xml
+++ b/android/app/src/main/res/values-de/strings.xml
@@ -8,6 +8,9 @@
<string name="settings_language_system">Systemstandard (%1$s)</string>
<string name="settings_open_in_night_mode">PDFs und Dokumente immer im Nachtmodus öffnen</string>
<string name="settings_open_in_night_mode_body">PDFs und Dokumente standardmäßig im Nachtmodus öffnen.</string>
+ <!-- bars: a name under each tool's glyph -->
+ <string name="settings_toolbar_labels">Beschriftungen der Werkzeugleiste</string>
+ <string name="settings_toolbar_labels_body">Jedes Werkzeug unter seinem Symbol benennen.</string>
<string name="open_with">In Artefact öffnen</string>
<!-- Shared: buttons and words used on many screens -->
@@ -48,7 +51,6 @@
<string name="common_tool_crop">Seiten zuschneiden</string>
<string name="common_tool_fill_sign">Ausfüllen und unterschreiben</string>
<string name="common_tool_scan">Scannen</string>
- <string name="common_tool_more_tools">Weitere Tools</string>
<string name="common_tool_recognize_text">Text erkennen</string>
<string name="common_tool_comment">Kommentieren</string>
<string name="common_tool_highlight">Hervorheben</string>
@@ -459,7 +461,6 @@
<!-- Pages: the grid of pages and organizing -->
<string name="pages_title">Seiten</string>
- <string name="pages_select">Seiten auswählen</string>
<!-- Translator note: the title while organizing; %1$d is how many pages are ticked. -->
<plurals name="pages_selected_count">
<item quantity="one">%1$d ausgewählt</item>
@@ -473,6 +474,8 @@
<string name="pages_rotate_left">Links</string>
<!-- Translator note: rotate the selected pages a quarter turn to the right. Keep it short. -->
<string name="pages_rotate_right">Rechts</string>
+ <!-- Translator note: Edit PDF, as the pages bar names it. Keep it short. -->
+ <string name="pages_edit">Bearbeiten</string>
<!-- Pages: Insert sheet (where the new pages go, and what they are) -->
<string name="pages_insert">Einfügen</string>
@@ -630,6 +633,10 @@
<string name="sheet_reading_mode">Lesemodus</string>
<string name="sheet_night_mode">Nachtmodus</string>
+ <!-- More menu: the small headings that group its rows -->
+ <string name="menu_section_page">Seite</string>
+ <string name="menu_section_file">Datei</string>
+
<!-- Viewer sheets: Bookmarks & Table of Contents -->
<!-- Translator note: the tab with the document's table of contents -->
<string name="sheet_tab_contents">Inhalt</string>
@@ -649,7 +656,6 @@
<string name="sheet_page">Seite %1$d</string>
<!-- Viewer sheets: More tools -->
- <string name="sheet_customize_toolbar">Symbolleiste anpassen</string>
<!-- Viewer sheets: file sizes -->
<plurals name="sheet_size_bytes">
@@ -747,19 +753,17 @@
<string name="toolbar_tool_text">Text</string>
<!-- Customize toolbar: moving tools between the bottom toolbar and More tools -->
- <string name="toolbar_customize">Symbolleiste anpassen</string>
<string name="toolbar_save">Symbolleiste speichern</string>
<!-- Note: %1$d is how many tools fit on the toolbar (6 to 8) -->
<plurals name="toolbar_customize_hint">
- <item quantity="one">Ziehe Werkzeuge zwischen die Symbolleiste und „Weitere Werkzeuge“. Auf die Symbolleiste passt %1$d Werkzeug.</item>
- <item quantity="other">Ziehe Werkzeuge zwischen die Symbolleiste und „Weitere Werkzeuge“. Auf die Symbolleiste passen %1$d Werkzeuge.</item>
+ <item quantity="one">Zum Umsortieren ziehen. Das Dock fasst %1$d.</item>
+ <item quantity="other">Zum Umsortieren ziehen. Das Dock fasst %1$d.</item>
</plurals>
<!-- Note: heading over the tools that are on the bottom toolbar -->
<string name="toolbar_section_toolbar">Symbolleiste</string>
<!-- Note: spoken for a tool tile; %1$s is the tool's name -->
<string name="toolbar_tool_on_bar">%1$s, in der Symbolleiste</string>
<!-- Note: spoken for a tool tile; %1$s is the tool's name -->
- <string name="toolbar_tool_in_more_tools">%1$s, unter „Weitere Werkzeuge“</string>
<!-- Highlight tool: marking text -->
<string name="toolbar_strikethrough">Durchstreichen</string>
@@ -1639,4 +1643,15 @@
<string name="settings_reduce_transparency_detail">Glas und schwebende Leisten werden deckend, nichts scheint durch</string>
<string name="qr_scanner">QR-Scanner</string>
<string name="qr_scan_prompt">Richte die Kamera auf einen QR-Code</string>
+ <!-- The fixed sections of a PDF's More list -->
+ <string name="tool_group_edit">Bearbeiten und markieren</string>
+ <string name="tool_group_pages">Seiten</string>
+ <string name="tool_group_convert">Konvertieren und teilen</string>
+ <string name="tool_group_security">Sicherheit</string>
+ <!-- The dock's round button: the tools the dock has no room for -->
+ <string name="common_tool_more">Mehr</string>
+ <!-- The dock's editor in Settings, and the tools it does not hold -->
+ <string name="settings_customize_dock">Dock anpassen</string>
+ <string name="settings_off_the_dock">Nicht im Dock</string>
+ <string name="toolbar_tool_off_dock">%1$s, nicht im Dock</string>
</resources>
diff --git a/android/app/src/main/res/values-es/strings.xml b/android/app/src/main/res/values-es/strings.xml
index af1ed13..3faa50b 100644
--- a/android/app/src/main/res/values-es/strings.xml
+++ b/android/app/src/main/res/values-es/strings.xml
@@ -15,6 +15,9 @@
<string name="settings_language_system">Idioma del sistema (%1$s)</string>
<string name="settings_open_in_night_mode">Abrir siempre archivos PDF y documentos en modo nocturno</string>
<string name="settings_open_in_night_mode_body">Abre cada PDF y documento con el modo nocturno activado.</string>
+ <!-- bars: a name under each tool's glyph -->
+ <string name="settings_toolbar_labels">Etiquetas de la barra</string>
+ <string name="settings_toolbar_labels_body">Poner el nombre de cada herramienta bajo su icono.</string>
<string name="open_with">Abrir con Artefact</string>
<!-- Shared: buttons and words used on many screens -->
@@ -55,7 +58,6 @@
<string name="common_tool_crop">Recortar páginas</string>
<string name="common_tool_fill_sign">Rellenar y firmar</string>
<string name="common_tool_scan">Escanear</string>
- <string name="common_tool_more_tools">Más herramientas</string>
<string name="common_tool_recognize_text">Reconocer texto</string>
<string name="common_tool_comment">Comentar</string>
<string name="common_tool_highlight">Resaltar</string>
@@ -466,7 +468,6 @@
<!-- Pages: the grid of pages and organizing -->
<string name="pages_title">Páginas</string>
- <string name="pages_select">Seleccionar páginas</string>
<!-- Translator note: the title while organizing; %1$d is how many pages are ticked. -->
<plurals name="pages_selected_count">
<item quantity="one">%1$d seleccionadas</item>
@@ -480,6 +481,8 @@
<string name="pages_rotate_left">Izquierda</string>
<!-- Translator note: rotate the selected pages a quarter turn to the right. Keep it short. -->
<string name="pages_rotate_right">Derecha</string>
+ <!-- Translator note: Edit PDF, as the pages bar names it. Keep it short. -->
+ <string name="pages_edit">Editar</string>
<!-- Pages: Insert sheet (where the new pages go, and what they are) -->
<string name="pages_insert">Insertar</string>
@@ -637,6 +640,10 @@
<string name="sheet_reading_mode">Modo lectura</string>
<string name="sheet_night_mode">Modo nocturno</string>
+ <!-- More menu: the small headings that group its rows -->
+ <string name="menu_section_page">Página</string>
+ <string name="menu_section_file">Archivo</string>
+
<!-- Viewer sheets: Bookmarks & Table of Contents -->
<!-- Translator note: the tab with the document's table of contents -->
<string name="sheet_tab_contents">Índice</string>
@@ -656,7 +663,6 @@
<string name="sheet_page">Página %1$d</string>
<!-- Viewer sheets: More tools -->
- <string name="sheet_customize_toolbar">Personalizar barra de herramientas</string>
<!-- Viewer sheets: file sizes -->
<plurals name="sheet_size_bytes">
@@ -755,19 +761,17 @@
<string name="toolbar_tool_text">Texto</string>
<!-- Customize toolbar: moving tools between the bottom toolbar and More tools -->
- <string name="toolbar_customize">Personalizar barra de herramientas</string>
<string name="toolbar_save">Guardar barra</string>
<!-- Note: %1$d is how many tools fit on the toolbar (6 to 8) -->
<plurals name="toolbar_customize_hint">
- <item quantity="one">Arrastra herramientas entre la barra y Más herramientas. La barra admite %1$d.</item>
- <item quantity="other">Arrastra herramientas entre la barra y Más herramientas. La barra admite %1$d.</item>
+ <item quantity="one">Arrastra para reordenar. El dock admite %1$d.</item>
+ <item quantity="other">Arrastra para reordenar. El dock admite %1$d.</item>
</plurals>
<!-- Note: heading over the tools that are on the bottom toolbar -->
<string name="toolbar_section_toolbar">Barra de herramientas</string>
<!-- Note: spoken for a tool tile; %1$s is the tool's name -->
<string name="toolbar_tool_on_bar">%1$s, en la barra</string>
<!-- Note: spoken for a tool tile; %1$s is the tool's name -->
- <string name="toolbar_tool_in_more_tools">%1$s, en Más herramientas</string>
<!-- Highlight tool: marking text -->
<string name="toolbar_strikethrough">Tachar</string>
@@ -1648,4 +1652,15 @@
<string name="settings_reduce_transparency_detail">El vidrio y las barras flotantes se vuelven opacos, no se ve nada detrás</string>
<string name="qr_scanner">Escáner QR</string>
<string name="qr_scan_prompt">Apunta la cámara a un código QR</string>
+ <!-- The fixed sections of a PDF's More list -->
+ <string name="tool_group_edit">Editar y marcar</string>
+ <string name="tool_group_pages">Páginas</string>
+ <string name="tool_group_convert">Convertir y compartir</string>
+ <string name="tool_group_security">Seguridad</string>
+ <!-- The dock's round button: the tools the dock has no room for -->
+ <string name="common_tool_more">Más</string>
+ <!-- The dock's editor in Settings, and the tools it does not hold -->
+ <string name="settings_customize_dock">Personalizar el dock</string>
+ <string name="settings_off_the_dock">Fuera del dock</string>
+ <string name="toolbar_tool_off_dock">%1$s, fuera del dock</string>
</resources>
diff --git a/android/app/src/main/res/values-fr/strings.xml b/android/app/src/main/res/values-fr/strings.xml
index 8723174..e6c27fa 100644
--- a/android/app/src/main/res/values-fr/strings.xml
+++ b/android/app/src/main/res/values-fr/strings.xml
@@ -8,6 +8,9 @@
<string name="settings_language_system">Langue du système (%1$s)</string>
<string name="settings_open_in_night_mode">Toujours ouvrir les PDF et documents en mode nuit</string>
<string name="settings_open_in_night_mode_body">Ouvrir chaque PDF et document avec le mode nuit activé.</string>
+ <!-- bars: a name under each tool's glyph -->
+ <string name="settings_toolbar_labels">Étiquettes de la barre</string>
+ <string name="settings_toolbar_labels_body">Nommer chaque outil sous son icône dans les barres.</string>
<string name="open_with">Ouvrir dans Artefact</string>
<!-- Shared: buttons and words used on many screens -->
@@ -48,7 +51,6 @@
<string name="common_tool_crop">Rogner les pages</string>
<string name="common_tool_fill_sign">Remplir et signer</string>
<string name="common_tool_scan">Numériser</string>
- <string name="common_tool_more_tools">Plus d\'outils</string>
<string name="common_tool_recognize_text">Reconnaître le texte</string>
<string name="common_tool_comment">Commenter</string>
<string name="common_tool_highlight">Surligner</string>
@@ -443,7 +445,6 @@
<!-- Pages: the grid of pages and organizing -->
<string name="pages_title">Pages</string>
- <string name="pages_select">Sélectionner des pages</string>
<plurals name="pages_selected_count">
<item quantity="one">%1$d sélectionnée</item>
<item quantity="other">%1$d sélectionnées</item>
@@ -453,6 +454,8 @@
<string name="pages_extract">Extraire</string>
<string name="pages_rotate_left">Gauche</string>
<string name="pages_rotate_right">Droite</string>
+ <!-- Translator note: Edit PDF, as the pages bar names it. Keep it short. -->
+ <string name="pages_edit">Modifier</string>
<!-- Pages: Insert sheet (where the new pages go, and what they are) -->
<string name="pages_insert">Insérer</string>
@@ -580,6 +583,10 @@
<string name="sheet_reading_mode">Mode lecture</string>
<string name="sheet_night_mode">Mode nuit</string>
+ <!-- More menu: the small headings that group its rows -->
+ <string name="menu_section_page">Page</string>
+ <string name="menu_section_file">Fichier</string>
+
<!-- Viewer sheets: Bookmarks & Table of Contents -->
<string name="sheet_tab_contents">Sommaire</string>
<string name="sheet_tab_bookmarks">Signets</string>
@@ -594,7 +601,6 @@
<string name="sheet_page">Page %1$d</string>
<!-- Viewer sheets: More tools -->
- <string name="sheet_customize_toolbar">Personnaliser la barre d\'outils</string>
<!-- Viewer sheets: file sizes -->
<plurals name="sheet_size_bytes">
@@ -680,15 +686,13 @@
<string name="toolbar_tool_text">Texte</string>
<!-- Customize toolbar: moving tools between the bottom toolbar and More tools -->
- <string name="toolbar_customize">Personnaliser la barre d\'outils</string>
<string name="toolbar_save">Enregistrer la barre d\'outils</string>
<plurals name="toolbar_customize_hint">
- <item quantity="one">Faites glisser les outils entre la barre d\'outils et Plus d\'outils. La barre d\'outils en contient %1$d.</item>
- <item quantity="other">Faites glisser les outils entre la barre d\'outils et Plus d\'outils. La barre d\'outils en contient %1$d.</item>
+ <item quantity="one">Faites glisser pour réordonner. Le dock en contient %1$d.</item>
+ <item quantity="other">Faites glisser pour réordonner. Le dock en contient %1$d.</item>
</plurals>
<string name="toolbar_section_toolbar">Barre d\'outils</string>
<string name="toolbar_tool_on_bar">%1$s, dans la barre d\'outils</string>
- <string name="toolbar_tool_in_more_tools">%1$s, dans Plus d\'outils</string>
<!-- Highlight tool: marking text -->
<string name="toolbar_strikethrough">Barré</string>
@@ -1520,4 +1524,15 @@
<string name="settings_reduce_transparency_detail">Le verre et les barres flottantes deviennent opaques, rien ne transparaît</string>
<string name="qr_scanner">Scanner QR</string>
<string name="qr_scan_prompt">Pointez la caméra vers un code QR</string>
+ <!-- The fixed sections of a PDF's More list -->
+ <string name="tool_group_edit">Modifier et annoter</string>
+ <string name="tool_group_pages">Pages</string>
+ <string name="tool_group_convert">Convertir et partager</string>
+ <string name="tool_group_security">Sécurité</string>
+ <!-- The dock's round button: the tools the dock has no room for -->
+ <string name="common_tool_more">Plus</string>
+ <!-- The dock's editor in Settings, and the tools it does not hold -->
+ <string name="settings_customize_dock">Personnaliser le dock</string>
+ <string name="settings_off_the_dock">Hors du dock</string>
+ <string name="toolbar_tool_off_dock">%1$s, hors du dock</string>
</resources>
diff --git a/android/app/src/main/res/values-it/strings.xml b/android/app/src/main/res/values-it/strings.xml
index 59a8b25..6669320 100644
--- a/android/app/src/main/res/values-it/strings.xml
+++ b/android/app/src/main/res/values-it/strings.xml
@@ -14,6 +14,9 @@
<string name="settings_language_system">Lingua di sistema (%1$s)</string>
<string name="settings_open_in_night_mode">Apri sempre PDF e documenti in modalità notturna</string>
<string name="settings_open_in_night_mode_body">Apri ogni PDF e documento con la modalità notturna attiva.</string>
+ <!-- bars: a name under each tool's glyph -->
+ <string name="settings_toolbar_labels">Etichette della barra</string>
+ <string name="settings_toolbar_labels_body">Mostra il nome di ogni strumento sotto la sua icona.</string>
<string name="open_with">Apri in Artefact</string>
<!-- ================================================================ -->
@@ -58,7 +61,6 @@
<string name="common_tool_crop">Ritaglia pagine</string>
<string name="common_tool_fill_sign">Compila e firma</string>
<string name="common_tool_scan">Scansiona</string>
- <string name="common_tool_more_tools">Altri strumenti</string>
<string name="common_tool_recognize_text">Riconosci testo</string>
<string name="common_tool_comment">Commenta</string>
<string name="common_tool_highlight">Evidenzia</string>
@@ -472,7 +474,6 @@
<!-- ================================================================ -->
<string name="pages_title">Pagine</string>
- <string name="pages_select">Seleziona pagine</string>
<plurals name="pages_selected_count">
<item quantity="one">%1$d pagina selezionata</item>
<item quantity="other">%1$d pagine selezionate</item>
@@ -482,6 +483,8 @@
<string name="pages_extract">Estrai</string>
<string name="pages_rotate_left">Sinistra</string>
<string name="pages_rotate_right">Destra</string>
+ <!-- Translator note: Edit PDF, as the pages bar names it. Keep it short. -->
+ <string name="pages_edit">Modifica</string>
<!-- Inserimento di pagine -->
@@ -624,6 +627,10 @@
<string name="sheet_reading_mode">Modalità lettura</string>
<string name="sheet_night_mode">Modalità notturna</string>
+ <!-- More menu: the small headings that group its rows -->
+ <string name="menu_section_page">Pagina</string>
+ <string name="menu_section_file">File</string>
+
<!-- Segnalibri e indice -->
<string name="sheet_tab_contents">Indice</string>
@@ -640,7 +647,6 @@
<!-- Altri strumenti -->
- <string name="sheet_customize_toolbar">Personalizza barra degli strumenti</string>
<!-- Dimensioni dei file -->
@@ -735,15 +741,13 @@
<!-- Personalizzazione della barra degli strumenti -->
- <string name="toolbar_customize">Personalizza barra degli strumenti</string>
<string name="toolbar_save">Salva barra degli strumenti</string>
<plurals name="toolbar_customize_hint">
- <item quantity="one">Trascina gli strumenti tra la barra e Altri strumenti. La barra può contenerne %1$d.</item>
- <item quantity="other">Trascina gli strumenti tra la barra e Altri strumenti. La barra può contenerne %1$d.</item>
+ <item quantity="one">Trascina per riordinare. Il dock ne contiene %1$d.</item>
+ <item quantity="other">Trascina per riordinare. Il dock ne contiene %1$d.</item>
</plurals>
<string name="toolbar_section_toolbar">Barra degli strumenti</string>
<string name="toolbar_tool_on_bar">%1$s, nella barra degli strumenti</string>
- <string name="toolbar_tool_in_more_tools">%1$s, in Altri strumenti</string>
<!-- Evidenziazione e marcatura del testo -->
@@ -1630,4 +1634,15 @@
<string name="settings_reduce_transparency_detail">Vetro e barre mobili diventano opachi, non traspare nulla</string>
<string name="qr_scanner">Scanner QR</string>
<string name="qr_scan_prompt">Inquadra un codice QR</string>
+ <!-- The fixed sections of a PDF's More list -->
+ <string name="tool_group_edit">Modifica e annota</string>
+ <string name="tool_group_pages">Pagine</string>
+ <string name="tool_group_convert">Converti e condividi</string>
+ <string name="tool_group_security">Sicurezza</string>
+ <!-- The dock's round button: the tools the dock has no room for -->
+ <string name="common_tool_more">Altro</string>
+ <!-- The dock's editor in Settings, and the tools it does not hold -->
+ <string name="settings_customize_dock">Personalizza dock</string>
+ <string name="settings_off_the_dock">Fuori dal dock</string>
+ <string name="toolbar_tool_off_dock">%1$s, fuori dal dock</string>
</resources>
diff --git a/android/app/src/main/res/values-pt-rBR/strings.xml b/android/app/src/main/res/values-pt-rBR/strings.xml
index 1373f6c..84a0100 100644
--- a/android/app/src/main/res/values-pt-rBR/strings.xml
+++ b/android/app/src/main/res/values-pt-rBR/strings.xml
@@ -5,6 +5,9 @@
<string name="settings_language_system">Idioma do sistema (%1$s)</string>
<string name="settings_open_in_night_mode">Sempre abrir PDFs e documentos no modo noturno</string>
<string name="settings_open_in_night_mode_body">Abrir cada PDF e documento com o modo noturno ativado.</string>
+ <!-- bars: a name under each tool's glyph -->
+ <string name="settings_toolbar_labels">Rótulos da barra</string>
+ <string name="settings_toolbar_labels_body">Mostrar o nome de cada ferramenta sob o seu ícone.</string>
<string name="open_with">Abrir no Artefact</string>
<string name="common_ok">OK</string>
<string name="common_cancel">Cancelar</string>
@@ -41,7 +44,6 @@
<string name="common_tool_crop">Recortar páginas</string>
<string name="common_tool_fill_sign">Preencher e assinar</string>
<string name="common_tool_scan">Digitalizar</string>
- <string name="common_tool_more_tools">Mais ferramentas</string>
<string name="common_tool_recognize_text">Reconhecer texto</string>
<string name="common_tool_comment">Comentar</string>
<string name="common_tool_highlight">Destacar</string>
@@ -296,7 +298,6 @@
<string name="voice_open_settings">Abrir configurações</string>
<string name="voice_not_now">Agora não</string>
<string name="pages_title">Páginas</string>
- <string name="pages_select">Selecionar páginas</string>
<plurals name="pages_selected_count">
<item quantity="one">%1$d selecionada</item>
<item quantity="other">%1$d selecionadas</item>
@@ -306,6 +307,8 @@
<string name="pages_extract">Extrair</string>
<string name="pages_rotate_left">Esquerda</string>
<string name="pages_rotate_right">Direita</string>
+ <!-- Translator note: Edit PDF, as the pages bar names it. Keep it short. -->
+ <string name="pages_edit">Editar</string>
<string name="pages_insert">Inserir</string>
<string name="pages_at_start">No início</string>
<string name="pages_at_end">No final</string>
@@ -406,6 +409,10 @@
<string name="sheet_single_page">Página única</string>
<string name="sheet_reading_mode">Modo de leitura</string>
<string name="sheet_night_mode">Modo noturno</string>
+
+ <!-- More menu: the small headings that group its rows -->
+ <string name="menu_section_page">Página</string>
+ <string name="menu_section_file">Arquivo</string>
<string name="sheet_tab_contents">Sumário</string>
<string name="sheet_tab_bookmarks">Favoritos</string>
<string name="sheet_no_contents">Este documento não tem sumário.</string>
@@ -417,7 +424,6 @@
<string name="sheet_bookmark_removed">Favorito %1$s removido</string>
<string name="sheet_delete_all">Excluir tudo</string>
<string name="sheet_page">Página %1$d</string>
- <string name="sheet_customize_toolbar">Personalizar barra de ferramentas</string>
<plurals name="sheet_size_bytes">
<item quantity="one">%1$d byte</item>
<item quantity="other">%1$d bytes</item>
@@ -480,15 +486,13 @@
<string name="toolbar_label_recognize">Reconhecer</string>
<string name="toolbar_label_add_text">Adicionar texto</string>
<string name="toolbar_tool_text">Texto</string>
- <string name="toolbar_customize">Personalizar barra de ferramentas</string>
<string name="toolbar_save">Salvar barra de ferramentas</string>
<plurals name="toolbar_customize_hint">
- <item quantity="one">Arraste as ferramentas entre a barra e Mais ferramentas. A barra comporta %1$d.</item>
- <item quantity="other">Arraste as ferramentas entre a barra e Mais ferramentas. A barra comporta %1$d.</item>
+ <item quantity="one">Arraste para reordenar. O dock comporta %1$d.</item>
+ <item quantity="other">Arraste para reordenar. O dock comporta %1$d.</item>
</plurals>
<string name="toolbar_section_toolbar">Barra de ferramentas</string>
<string name="toolbar_tool_on_bar">%1$s, na barra de ferramentas</string>
- <string name="toolbar_tool_in_more_tools">%1$s, em Mais ferramentas</string>
<string name="toolbar_strikethrough">Tachado</string>
<string name="toolbar_no_text_to_mark">Não há texto para marcar nesta página. Reconheça o texto primeiro (Mais ferramentas ▸ Reconhecer texto).</string>
<string name="toolbar_draw_freeform">Desenho à mão livre</string>
@@ -1225,4 +1229,15 @@
<string name="settings_reduce_transparency_detail">O vidro e as barras flutuantes ficam opacos, nada aparece por trás</string>
<string name="qr_scanner">Leitor de QR</string>
<string name="qr_scan_prompt">Aponte a câmera para um código QR</string>
+ <!-- The fixed sections of a PDF's More list -->
+ <string name="tool_group_edit">Editar e anotar</string>
+ <string name="tool_group_pages">Páginas</string>
+ <string name="tool_group_convert">Converter e compartilhar</string>
+ <string name="tool_group_security">Segurança</string>
+ <!-- The dock's round button: the tools the dock has no room for -->
+ <string name="common_tool_more">Mais</string>
+ <!-- The dock's editor in Settings, and the tools it does not hold -->
+ <string name="settings_customize_dock">Personalizar dock</string>
+ <string name="settings_off_the_dock">Fora do dock</string>
+ <string name="toolbar_tool_off_dock">%1$s, fora do dock</string>
</resources>
diff --git a/android/app/src/main/res/values-pt/strings.xml b/android/app/src/main/res/values-pt/strings.xml
index fb53ea4..de3af5c 100644
--- a/android/app/src/main/res/values-pt/strings.xml
+++ b/android/app/src/main/res/values-pt/strings.xml
@@ -5,6 +5,9 @@
<string name="settings_language_system">Idioma do sistema (%1$s)</string>
<string name="settings_open_in_night_mode">Abrir sempre PDFs e documentos no modo noturno</string>
<string name="settings_open_in_night_mode_body">Abrir cada PDF e documento com o modo noturno ativado.</string>
+ <!-- bars: a name under each tool's glyph -->
+ <string name="settings_toolbar_labels">Rótulos da barra</string>
+ <string name="settings_toolbar_labels_body">Mostrar o nome de cada ferramenta sob o seu ícone.</string>
<string name="open_with">Abrir no Artefact</string>
<string name="common_ok">OK</string>
<string name="common_cancel">Cancelar</string>
@@ -41,7 +44,6 @@
<string name="common_tool_crop">Recortar páginas</string>
<string name="common_tool_fill_sign">Preencher e assinar</string>
<string name="common_tool_scan">Digitalizar</string>
- <string name="common_tool_more_tools">Mais ferramentas</string>
<string name="common_tool_recognize_text">Reconhecer texto</string>
<string name="common_tool_comment">Comentar</string>
<string name="common_tool_highlight">Realçar</string>
@@ -297,7 +299,6 @@
<string name="voice_open_settings">Abrir definições</string>
<string name="voice_not_now">Agora não</string>
<string name="pages_title">Páginas</string>
- <string name="pages_select">Selecionar páginas</string>
<plurals name="pages_selected_count">
<item quantity="one">%1$d selecionada</item>
<item quantity="other">%1$d selecionadas</item>
@@ -307,6 +308,8 @@
<string name="pages_extract">Extrair</string>
<string name="pages_rotate_left">Esquerda</string>
<string name="pages_rotate_right">Direita</string>
+ <!-- Translator note: Edit PDF, as the pages bar names it. Keep it short. -->
+ <string name="pages_edit">Editar</string>
<string name="pages_insert">Inserir</string>
<string name="pages_at_start">No início</string>
<string name="pages_at_end">No fim</string>
@@ -408,6 +411,10 @@
<string name="sheet_single_page">Página única</string>
<string name="sheet_reading_mode">Modo de leitura</string>
<string name="sheet_night_mode">Modo noturno</string>
+
+ <!-- More menu: the small headings that group its rows -->
+ <string name="menu_section_page">Página</string>
+ <string name="menu_section_file">Ficheiro</string>
<string name="sheet_tab_contents">Índice</string>
<string name="sheet_tab_bookmarks">Marcadores</string>
<string name="sheet_no_contents">Este documento não tem índice.</string>
@@ -419,7 +426,6 @@
<string name="sheet_bookmark_removed">Marcador %1$s removido</string>
<string name="sheet_delete_all">Eliminar tudo</string>
<string name="sheet_page">Página %1$d</string>
- <string name="sheet_customize_toolbar">Personalizar barra de ferramentas</string>
<plurals name="sheet_size_bytes">
<item quantity="one">%1$d byte</item>
<item quantity="other">%1$d bytes</item>
@@ -482,15 +488,13 @@
<string name="toolbar_label_recognize">Reconhecer</string>
<string name="toolbar_label_add_text">Adicionar texto</string>
<string name="toolbar_tool_text">Texto</string>
- <string name="toolbar_customize">Personalizar barra de ferramentas</string>
<string name="toolbar_save">Guardar barra de ferramentas</string>
<plurals name="toolbar_customize_hint">
- <item quantity="one">Arraste ferramentas entre a barra e Mais ferramentas. A barra leva %1$d.</item>
- <item quantity="other">Arraste ferramentas entre a barra e Mais ferramentas. A barra leva %1$d.</item>
+ <item quantity="one">Arrasta para reordenar. O dock tem %1$d.</item>
+ <item quantity="other">Arrasta para reordenar. O dock tem %1$d.</item>
</plurals>
<string name="toolbar_section_toolbar">Barra de ferramentas</string>
<string name="toolbar_tool_on_bar">%1$s, na barra de ferramentas</string>
- <string name="toolbar_tool_in_more_tools">%1$s, em Mais ferramentas</string>
<string name="toolbar_strikethrough">Rasurado</string>
<string name="toolbar_no_text_to_mark">Esta página não tem texto para marcar. Reconheça primeiro o texto (Mais ferramentas ▸ Reconhecer texto).</string>
<string name="toolbar_draw_freeform">Desenhar à mão livre</string>
@@ -1225,4 +1229,15 @@
<string name="settings_reduce_transparency_detail">O vidro e as barras flutuantes ficam opacos, nada transparece</string>
<string name="qr_scanner">Leitor de QR</string>
<string name="qr_scan_prompt">Aponte a câmara para um código QR</string>
+ <!-- The fixed sections of a PDF's More list -->
+ <string name="tool_group_edit">Editar e anotar</string>
+ <string name="tool_group_pages">Páginas</string>
+ <string name="tool_group_convert">Converter e partilhar</string>
+ <string name="tool_group_security">Segurança</string>
+ <!-- The dock's round button: the tools the dock has no room for -->
+ <string name="common_tool_more">Mais</string>
+ <!-- The dock's editor in Settings, and the tools it does not hold -->
+ <string name="settings_customize_dock">Personalizar dock</string>
+ <string name="settings_off_the_dock">Fora do dock</string>
+ <string name="toolbar_tool_off_dock">%1$s, fora do dock</string>
</resources>
diff --git a/android/app/src/main/res/values-ru/strings.xml b/android/app/src/main/res/values-ru/strings.xml
index cbbc0ea..3bd8b17 100644
--- a/android/app/src/main/res/values-ru/strings.xml
+++ b/android/app/src/main/res/values-ru/strings.xml
@@ -5,6 +5,9 @@
<string name="settings_language_system">Язык системы (%1$s)</string>
<string name="settings_open_in_night_mode">Всегда открывать PDF и документы в ночном режиме</string>
<string name="settings_open_in_night_mode_body">Открывать каждый PDF и документ с включённым ночным режимом.</string>
+ <!-- bars: a name under each tool's glyph -->
+ <string name="settings_toolbar_labels">Подписи на панели</string>
+ <string name="settings_toolbar_labels_body">Показывать название каждого инструмента под значком.</string>
<string name="open_with">Открыть в Artefact</string>
<string name="common_ok">ОК</string>
<string name="common_cancel">Отмена</string>
@@ -41,7 +44,6 @@
<string name="common_tool_crop">Обрезать страницы</string>
<string name="common_tool_fill_sign">Заполнить и подписать</string>
<string name="common_tool_scan">Сканировать</string>
- <string name="common_tool_more_tools">Другие инструменты</string>
<string name="common_tool_recognize_text">Распознать текст</string>
<string name="common_tool_comment">Комментарий</string>
<string name="common_tool_highlight">Выделить</string>
@@ -305,7 +307,6 @@
<string name="voice_open_settings">Открыть настройки</string>
<string name="voice_not_now">Не сейчас</string>
<string name="pages_title">Страницы</string>
- <string name="pages_select">Выбрать страницы</string>
<plurals name="pages_selected_count">
<item quantity="one">Выбрана %1$d</item>
<item quantity="few">Выбрано %1$d</item>
@@ -317,6 +318,8 @@
<string name="pages_extract">Извлечь</string>
<string name="pages_rotate_left">Влево</string>
<string name="pages_rotate_right">Вправо</string>
+ <!-- Translator note: Edit PDF, as the pages bar names it. Keep it short. -->
+ <string name="pages_edit">Изменить</string>
<string name="pages_insert">Вставить</string>
<string name="pages_at_start">В начало</string>
<string name="pages_at_end">В конец</string>
@@ -418,6 +421,10 @@
<string name="sheet_single_page">Одна страница</string>
<string name="sheet_reading_mode">Режим чтения</string>
<string name="sheet_night_mode">Ночной режим</string>
+
+ <!-- More menu: the small headings that group its rows -->
+ <string name="menu_section_page">Страница</string>
+ <string name="menu_section_file">Файл</string>
<string name="sheet_tab_contents">Оглавление</string>
<string name="sheet_tab_bookmarks">Закладки</string>
<string name="sheet_no_contents">В этом документе нет оглавления.</string>
@@ -429,7 +436,6 @@
<string name="sheet_bookmark_removed">Закладка «%1$s» удалена</string>
<string name="sheet_delete_all">Удалить все</string>
<string name="sheet_page">Страница %1$d</string>
- <string name="sheet_customize_toolbar">Настроить панель</string>
<plurals name="sheet_size_bytes">
<item quantity="one">%1$d байт</item>
<item quantity="few">%1$d байта</item>
@@ -496,17 +502,13 @@
<string name="toolbar_label_recognize">Распознать</string>
<string name="toolbar_label_add_text">Добавить текст</string>
<string name="toolbar_tool_text">Текст</string>
- <string name="toolbar_customize">Настроить панель</string>
<string name="toolbar_save">Сохранить панель</string>
<plurals name="toolbar_customize_hint">
- <item quantity="one">Перетаскивайте инструменты между панелью и «Другими инструментами». На панели помещается %1$d.</item>
- <item quantity="few">Перетаскивайте инструменты между панелью и «Другими инструментами». На панели помещается %1$d.</item>
- <item quantity="many">Перетаскивайте инструменты между панелью и «Другими инструментами». На панели помещается %1$d.</item>
- <item quantity="other">Перетаскивайте инструменты между панелью и «Другими инструментами». На панели помещается %1$d.</item>
+ <item quantity="one">Перетащите, чтобы изменить порядок. На панели: %1$d.</item>
+ <item quantity="other">Перетащите, чтобы изменить порядок. На панели: %1$d.</item>
</plurals>
<string name="toolbar_section_toolbar">Панель</string>
<string name="toolbar_tool_on_bar">%1$s, на панели</string>
- <string name="toolbar_tool_in_more_tools">%1$s, в «Других инструментах»</string>
<string name="toolbar_strikethrough">Зачеркнуть</string>
<string name="toolbar_no_text_to_mark">На этой странице нет текста для пометок. Сначала распознайте текст («Другие инструменты» ▸ «Распознать текст»).</string>
<string name="toolbar_draw_freeform">Рисовать от руки</string>
@@ -1258,4 +1260,15 @@
<string name="settings_reduce_transparency_detail">Стекло и плавающие панели становятся непрозрачными, ничего не просвечивает</string>
<string name="qr_scanner">QR-сканер</string>
<string name="qr_scan_prompt">Наведите камеру на QR-код</string>
+ <!-- The fixed sections of a PDF's More list -->
+ <string name="tool_group_edit">Правка и пометки</string>
+ <string name="tool_group_pages">Страницы</string>
+ <string name="tool_group_convert">Конвертация и отправка</string>
+ <string name="tool_group_security">Безопасность</string>
+ <!-- The dock's round button: the tools the dock has no room for -->
+ <string name="common_tool_more">Ещё</string>
+ <!-- The dock's editor in Settings, and the tools it does not hold -->
+ <string name="settings_customize_dock">Настроить панель</string>
+ <string name="settings_off_the_dock">Не на панели</string>
+ <string name="toolbar_tool_off_dock">%1$s, не на панели</string>
</resources>
diff --git a/android/app/src/main/res/values-zh-rCN/strings.xml b/android/app/src/main/res/values-zh-rCN/strings.xml
index 7d8ef99..a37305a 100644
--- a/android/app/src/main/res/values-zh-rCN/strings.xml
+++ b/android/app/src/main/res/values-zh-rCN/strings.xml
@@ -41,7 +41,6 @@
<string name="common_tool_crop">裁剪页面</string>
<string name="common_tool_fill_sign">填写和签名</string>
<string name="common_tool_scan">扫描</string>
- <string name="common_tool_more_tools">更多工具</string>
<string name="common_tool_recognize_text">识别文字</string>
<string name="common_tool_comment">批注</string>
<string name="common_tool_highlight">高亮</string>
@@ -466,6 +465,9 @@
<string name="settings_language_system">跟随系统(%1$s)</string>
<string name="settings_open_in_night_mode">文档默认用夜间模式</string>
<string name="settings_open_in_night_mode_body">每次打开 PDF 或其他文档时,自动开启夜间模式。</string>
+ <!-- bars: a name under each tool's glyph -->
+ <string name="settings_toolbar_labels">工具栏文字</string>
+ <string name="settings_toolbar_labels_body">在各栏图标下方显示工具名称。</string>
<string name="viewer_night_mode_on">已切换到夜间模式</string>
<string name="viewer_night_mode_off">已退出夜间模式</string>
<!-- Translator note: opens the choice of the language the voice reads in. -->
@@ -499,7 +501,6 @@
<!-- Pages: the grid of pages and organizing -->
<string name="pages_title">页面</string>
- <string name="pages_select">选择页面</string>
<!-- Translator note: the title while organizing; %1$d is how many pages are ticked. -->
<plurals name="pages_selected_count">
<item quantity="one">已选 %1$d 页</item>
@@ -513,6 +514,8 @@
<string name="pages_rotate_left">左转</string>
<!-- Translator note: rotate the selected pages a quarter turn to the right. Keep it short. -->
<string name="pages_rotate_right">右转</string>
+ <!-- Translator note: Edit PDF, as the pages bar names it. Keep it short. -->
+ <string name="pages_edit">编辑</string>
<!-- Pages: Insert sheet (where the new pages go, and what they are) -->
<string name="pages_insert">插入</string>
@@ -672,6 +675,10 @@
<string name="sheet_reading_mode">阅读模式</string>
<string name="sheet_night_mode">夜间模式</string>
+ <!-- More menu: the small headings that group its rows -->
+ <string name="menu_section_page">页面</string>
+ <string name="menu_section_file">文件</string>
+
<!-- Viewer sheets: Bookmarks & Table of Contents -->
<!-- Translator note: the tab with the document's table of contents -->
<string name="sheet_tab_contents">目录</string>
@@ -691,7 +698,6 @@
<string name="sheet_page">第 %1$d 页</string>
<!-- Viewer sheets: More tools -->
- <string name="sheet_customize_toolbar">自定义工具栏</string>
<!-- Viewer sheets: file sizes -->
<plurals name="sheet_size_bytes">
@@ -798,19 +804,17 @@
<string name="toolbar_tool_text">文本</string>
<!-- Customize toolbar: moving tools between the bottom toolbar and More tools -->
- <string name="toolbar_customize">自定义工具栏</string>
<string name="toolbar_save">保存工具栏</string>
<!-- Note: %1$d is how many tools fit on the toolbar (6 to 8) -->
<plurals name="toolbar_customize_hint">
- <item quantity="one">拖动工具,可移入工具栏或放回“更多工具”。工具栏最多放 %1$d 个。</item>
- <item quantity="other">拖动工具,可移入工具栏或放回“更多工具”。工具栏最多放 %1$d 个。</item>
+ <item quantity="one">拖动以重新排序。程序坞可容纳 %1$d 个。</item>
+ <item quantity="other">拖动以重新排序。程序坞可容纳 %1$d 个。</item>
</plurals>
<!-- Note: heading over the tools that are on the bottom toolbar -->
<string name="toolbar_section_toolbar">工具栏</string>
<!-- Note: spoken for a tool tile; %1$s is the tool's name -->
<string name="toolbar_tool_on_bar">%1$s,在工具栏中</string>
<!-- Note: spoken for a tool tile; %1$s is the tool's name -->
- <string name="toolbar_tool_in_more_tools">%1$s,在“更多工具”中</string>
<!-- Highlight tool: marking text -->
<string name="toolbar_strikethrough">删除线</string>
@@ -1681,4 +1685,15 @@
<string name="thoughts_audios">音频</string>
<string name="settings_reduce_transparency">降低透明度</string>
<string name="settings_reduce_transparency_detail">玻璃与浮动栏变为不透明,不透出任何内容</string>
+ <!-- The fixed sections of a PDF's More list -->
+ <string name="tool_group_edit">编辑与标记</string>
+ <string name="tool_group_pages">页面</string>
+ <string name="tool_group_convert">转换与分享</string>
+ <string name="tool_group_security">安全</string>
+ <!-- The dock's round button: the tools the dock has no room for -->
+ <string name="common_tool_more">更多</string>
+ <!-- The dock's editor in Settings, and the tools it does not hold -->
+ <string name="settings_customize_dock">自定义程序坞</string>
+ <string name="settings_off_the_dock">不在程序坞中</string>
+ <string name="toolbar_tool_off_dock">%1$s,不在程序坞中</string>
</resources>
diff --git a/android/app/src/main/res/values/strings.xml b/android/app/src/main/res/values/strings.xml
index e04940a..ff80145 100644
--- a/android/app/src/main/res/values/strings.xml
+++ b/android/app/src/main/res/values/strings.xml
@@ -51,7 +51,6 @@
<string name="common_tool_crop">Crop pages</string>
<string name="common_tool_fill_sign">Fill &amp; Sign</string>
<string name="common_tool_scan">Scan</string>
- <string name="common_tool_more_tools">More tools</string>
<string name="common_tool_recognize_text">Recognize text</string>
<string name="common_tool_comment">Comment</string>
<string name="common_tool_highlight">Highlight</string>
@@ -477,6 +476,9 @@
<string name="settings_language_system">System default (%1$s)</string>
<string name="settings_open_in_night_mode">Always open PDFs and documents in night mode</string>
<string name="settings_open_in_night_mode_body">Open each PDF and document with night mode enabled.</string>
+ <!-- bars: a name under each tool's glyph -->
+ <string name="settings_toolbar_labels">Toolbar labels</string>
+ <string name="settings_toolbar_labels_body">Name each tool under its glyph in the bars.</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. -->
@@ -510,7 +512,6 @@
<!-- Pages: the grid of pages and organizing -->
<string name="pages_title">Pages</string>
- <string name="pages_select">Select pages</string>
<!-- Translator note: the title while organizing; %1$d is how many pages are ticked. -->
<plurals name="pages_selected_count">
<item quantity="one">Selected %1$d</item>
@@ -524,6 +525,8 @@
<string name="pages_rotate_left">Left</string>
<!-- Translator note: rotate the selected pages a quarter turn to the right. Keep it short. -->
<string name="pages_rotate_right">Right</string>
+ <!-- Translator note: Edit PDF, as the pages bar names it. Keep it short. -->
+ <string name="pages_edit">Edit</string>
<!-- Pages: Insert sheet (where the new pages go, and what they are) -->
<string name="pages_insert">Insert</string>
@@ -683,6 +686,10 @@
<string name="sheet_reading_mode">Reading Mode</string>
<string name="sheet_night_mode">Night Mode</string>
+ <!-- More menu: the small headings that group its rows -->
+ <string name="menu_section_page">Page</string>
+ <string name="menu_section_file">File</string>
+
<!-- Viewer sheets: Bookmarks & Table of Contents -->
<!-- Translator note: the tab with the document's table of contents -->
<string name="sheet_tab_contents">Contents</string>
@@ -702,7 +709,6 @@
<string name="sheet_page">Page %1$d</string>
<!-- Viewer sheets: More tools -->
- <string name="sheet_customize_toolbar">Customize toolbar</string>
<!-- Viewer sheets: file sizes -->
<plurals name="sheet_size_bytes">
@@ -809,19 +815,17 @@
<string name="toolbar_tool_text">Text</string>
<!-- Customize toolbar: moving tools between the bottom toolbar and More tools -->
- <string name="toolbar_customize">Customize toolbar</string>
<string name="toolbar_save">Save toolbar</string>
<!-- Note: %1$d is how many tools fit on the toolbar (6 to 8) -->
<plurals name="toolbar_customize_hint">
- <item quantity="one">Drag tools between the toolbar and More tools. The toolbar holds %1$d.</item>
- <item quantity="other">Drag tools between the toolbar and More tools. The toolbar holds %1$d.</item>
+ <item quantity="one">Drag to reorder. The dock holds %1$d.</item>
+ <item quantity="other">Drag to reorder. The dock holds %1$d.</item>
</plurals>
<!-- Note: heading over the tools that are on the bottom toolbar -->
<string name="toolbar_section_toolbar">Toolbar</string>
<!-- Note: spoken for a tool tile; %1$s is the tool's name -->
<string name="toolbar_tool_on_bar">%1$s, on the toolbar</string>
<!-- Note: spoken for a tool tile; %1$s is the tool's name -->
- <string name="toolbar_tool_in_more_tools">%1$s, in More tools</string>
<!-- Highlight tool: marking text -->
<string name="toolbar_strikethrough">Strikethrough</string>
@@ -1699,4 +1703,15 @@
<string name="settings_reduce_transparency_detail">Glass and floating bars go solid, nothing shows through</string>
<string name="qr_scanner">QR Scanner</string>
<string name="qr_scan_prompt">Point the camera at a QR code</string>
+ <!-- The fixed sections of a PDF's More list -->
+ <string name="tool_group_edit">Edit and mark up</string>
+ <string name="tool_group_pages">Pages</string>
+ <string name="tool_group_convert">Convert and share</string>
+ <string name="tool_group_security">Security</string>
+ <!-- The dock's round button: the tools the dock has no room for -->
+ <string name="common_tool_more">More</string>
+ <!-- The dock's editor in Settings, and the tools it does not hold -->
+ <string name="settings_customize_dock">Customize dock</string>
+ <string name="settings_off_the_dock">Off the dock</string>
+ <string name="toolbar_tool_off_dock">%1$s, off the dock</string>
</resources>
diff --git a/android/app/src/test/java/com/chethan616/clearpdf/ui/QuickToolbarTest.kt b/android/app/src/test/java/com/chethan616/clearpdf/ui/QuickToolbarTest.kt
index c20ddbc..8c79628 100644
--- a/android/app/src/test/java/com/chethan616/clearpdf/ui/QuickToolbarTest.kt
+++ b/android/app/src/test/java/com/chethan616/clearpdf/ui/QuickToolbarTest.kt
@@ -2,6 +2,10 @@ package com.chethan616.clearpdf.ui
import com.chethan616.clearpdf.ui.viewer.QuickTool
import com.chethan616.clearpdf.ui.viewer.QuickToolbarPrefs
+import com.chethan616.clearpdf.ui.viewer.ToolDocKind
+import com.chethan616.clearpdf.ui.viewer.ToolGroup
+import com.chethan616.clearpdf.ui.viewer.appliesTo
+import com.chethan616.clearpdf.ui.viewer.toolLayout
import com.chethan616.clearpdf.ui.viewer.toolbarSlots
import org.junit.Assert.assertEquals
import org.junit.Assert.assertTrue
@@ -19,14 +23,15 @@ class QuickToolbarTest {
}
@Test
- fun moreToolsHoldsEveryToolNotOnTheBar() {
- val bar = listOf(QuickTool.Comment, QuickTool.Scan)
- val grid = QuickToolbarPrefs.complete(listOf(QuickTool.ReadAloud, QuickTool.Scan, QuickTool.ReadAloud), bar)
- // the saved order first, without the bar's tools or repeats, then the rest
- assertEquals(QuickTool.ReadAloud, grid.first())
- assertEquals(QuickTool.entries.size - bar.size, grid.size)
- assertTrue(grid.none { it in bar })
- assertEquals(grid.size, grid.toSet().size)
+ fun theDockDropsOfficeToolsAndRepeats() {
+ // an old layout may name a tool a PDF does not have, or name one twice
+ assertEquals(
+ listOf(QuickTool.Scan),
+ QuickToolbarPrefs.validBar(listOf(QuickTool.Scan, QuickTool.Present, QuickTool.Scan)),
+ )
+ // nothing left: the dock's default tools
+ assertEquals(QuickTool.DEFAULT_BAR, QuickToolbarPrefs.validBar(emptyList()))
+ assertEquals(QuickTool.DEFAULT_BAR, QuickToolbarPrefs.validBar(listOf(QuickTool.Present)))
}
@Test
@@ -34,4 +39,91 @@ class QuickToolbarTest {
assertEquals(QuickTool.entries.size, QuickTool.entries.map { it.id }.toSet().size)
for (t in QuickTool.entries) assertEquals(t, QuickTool.of(t.id))
}
+
+ @Test
+ fun everyToolHasOnePlaceAndTheGroupsKeepTheirOrder() {
+ // the group order is fixed: edit, pages, convert, security
+ assertEquals(
+ listOf(ToolGroup.EditAndMarkUp, ToolGroup.Pages, ToolGroup.Convert, ToolGroup.Security),
+ ToolGroup.entries.toList(),
+ )
+ // a grouped tool belongs to that one group; only the header's and the office bars' tools have none
+ assertEquals(
+ setOf(QuickTool.ReadAloud, QuickTool.Print, QuickTool.Present, QuickTool.ExportPdf, QuickTool.SaveAs),
+ QuickTool.entries.filter { it.group == null }.toSet(),
+ )
+ for (t in QuickTool.entries.filter { it.group != null }) {
+ assertEquals(t.id, 1, ToolGroup.entries.count { group -> QuickTool.entries.filter { it.group == group }.contains(t) })
+ }
+ }
+
+ @Test
+ fun everyToolAppearsOnceAcrossTheDockTheHeaderAndMore() {
+ for (kind in ToolDocKind.entries) {
+ for (slots in listOf(2, 5, 8)) {
+ val layout = toolLayout(kind, QuickTool.DEFAULT_BAR, slots)
+ val all = layout.dock + layout.header + layout.more
+ assertEquals("$kind at $slots", all.size, all.toSet().size)
+ for (t in layout.dock + layout.more) assertTrue("$kind: $t", t.appliesTo(kind))
+ // the header never repeats the dock
+ assertTrue(layout.header.none { it in layout.dock })
+ }
+ }
+ // for a PDF nothing is left out: dock, header and More cover every tool a PDF has
+ val pdf = toolLayout(ToolDocKind.Pdf, QuickTool.DEFAULT_BAR, 5)
+ assertEquals(QuickTool.entries.filter { it.appliesTo(ToolDocKind.Pdf) }.toSet(), (pdf.dock + pdf.header + pdf.more).toSet())
+ }
+
+ @Test
+ fun aPdfsMoreListHoldsNoOfficeToolAndNoHeaderTool() {
+ for (arranged in listOf(QuickTool.DEFAULT_BAR, listOf(QuickTool.Scan, QuickTool.Protect, QuickTool.Comment))) {
+ val more = toolLayout(ToolDocKind.Pdf, arranged, 5).more
+ assertTrue(more.none { it == QuickTool.Present || it == QuickTool.ExportPdf || it == QuickTool.SaveAs })
+ assertTrue(more.none { it == QuickTool.ReadAloud || it == QuickTool.Print || it == QuickTool.Edit })
+ assertTrue(more.none { it in arranged.take(5) })
+ }
+ }
+
+ @Test
+ fun theMoreListIsInGroupOrderThenDeclarationOrder() {
+ val more = toolLayout(ToolDocKind.Pdf, QuickTool.DEFAULT_BAR, 5).more
+ // the group order never changes, whatever the dock holds
+ assertEquals(
+ more.sortedWith(compareBy<QuickTool>({ it.group!!.ordinal }, { it.ordinal })),
+ more,
+ )
+ for (dock in listOf(QuickTool.DEFAULT_BAR, QuickTool.DEFAULT_BAR.reversed(), listOf(QuickTool.Scan, QuickTool.Edit))) {
+ val list = toolLayout(ToolDocKind.Pdf, dock, 5).more
+ assertEquals(list.sortedWith(compareBy<QuickTool>({ it.group!!.ordinal }, { it.ordinal })), list)
+ }
+ }
+
+ @Test
+ fun takingAToolOffTheDockPutsItBackInItsOwnGroup() {
+ val withComment = toolLayout(ToolDocKind.Pdf, QuickTool.DEFAULT_BAR, 5)
+ val withoutComment = toolLayout(ToolDocKind.Pdf, QuickTool.DEFAULT_BAR - QuickTool.Comment, 5)
+ // on the dock: not in the list
+ assertTrue(QuickTool.Comment in withComment.dock)
+ assertTrue(QuickTool.Comment !in withComment.more)
+ // off the dock: back in its group, at its own place, and the rest of the list keeps its order
+ assertTrue(QuickTool.Comment in withoutComment.more)
+ assertEquals(ToolGroup.EditAndMarkUp, withoutComment.more.first { it == QuickTool.Comment }.group)
+ assertEquals(withComment.more, withoutComment.more.filter { it != QuickTool.Comment })
+ // a tool the dock has no room for belongs in its group too
+ val squeezed = toolLayout(ToolDocKind.Pdf, QuickTool.DEFAULT_BAR, 2)
+ assertTrue(squeezed.more.containsAll(QuickTool.DEFAULT_BAR.drop(2)))
+ assertTrue(squeezed.more.all { it.group != null })
+ }
+
+ @Test
+ fun anOfficeDocumentKeepsItsOwnBarAndItsOwnList() {
+ for (kind in listOf(ToolDocKind.Word, ToolDocKind.Slides)) {
+ val fixed = QuickTool.barFor(kind, QuickTool.DEFAULT_BAR)
+ val layout = toolLayout(kind, QuickTool.DEFAULT_BAR, fixed.size)
+ // the arranged PDF bar never reaches an office document
+ assertEquals(fixed, layout.dock)
+ assertTrue(layout.more.isEmpty())
+ assertTrue(layout.header.isEmpty())
+ }
+ }
}