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.

Offer a clean appearance throughout Artefact

Kzyube Napoles671584c6f5e0
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 10ad93a..8b5d387 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
@@ -975,13 +975,15 @@ class AppViewModel(app: Application, private val saved: SavedStateHandle) : Andr
appPrefs.edit().putString("theme", t.name).apply()
}
- /** Whether Files uses solid surfaces in the current app theme. */
- var cleanFiles by mutableStateOf(appPrefs.getBoolean("cleanFiles", false))
+ /** Whether the app uses solid surfaces in the current app theme. */
+ var cleanAppearance by mutableStateOf(com.chethan616.clearpdf.ui.theme.savedCleanAppearance(app))
private set
- fun updateCleanFiles(clean: Boolean) {
- cleanFiles = clean
- appPrefs.edit().putBoolean("cleanFiles", clean).apply()
+ fun updateCleanAppearance(clean: Boolean) {
+ cleanAppearance = clean
+ appPrefs.edit().putBoolean("cleanAppearance", clean).apply()
+ com.chethan616.clearpdf.widget.Widgets.refreshAll(getApplication())
+ com.chethan616.clearpdf.widget.Widgets.refreshRecent(this, force = true)
}
/**
diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/ClearApp.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/ClearApp.kt
index bf3bf74..6ca6358 100644
--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/ClearApp.kt
+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/ClearApp.kt
@@ -122,7 +122,7 @@ import kotlinx.coroutines.delay
@Composable
fun ClearApp(vm: AppViewModel, onBrowse: () -> Unit, onPickSignatureImage: () -> Unit) {
val overlays = remember { GlassOverlayHost() }
- ClearTheme(vm.theme) {
+ ClearTheme(vm.theme, vm.cleanAppearance) {
PdfcraftTheme(vm.theme) {
ProvideGlassHaptics {
// Adaptive luminance: one sampler of the window for every screen's glass
@@ -195,11 +195,7 @@ private fun Shell(vm: AppViewModel, onBrowse: () -> Unit, onPickSignatureImage:
// (nor while a document from Quick Preview opens: the desk is never seen on that way in)
val underDoc = Modifier.drawWithContent { if (!reveal.covering && !vm.expandingPreview) drawContent() }
GlassStage(
- wallpaper = {
- if (route == HomeTab.Files.name && vm.cleanFiles) {
- Box(Modifier.fillMaxSize().then(underDoc).background(c.desk))
- } else Aurora(mood, underDoc)
- },
+ wallpaper = { Aurora(mood, underDoc) },
screens = {
Box(Modifier.fillMaxSize().then(underDoc).windowInsetsPadding(WindowInsets.safeDrawing.only(WindowInsetsSides.Horizontal))) {
RouteHost(route) { r ->
diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/Theme.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/Theme.kt
index daafae3..e5fa9f7 100644
--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/Theme.kt
+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/Theme.kt
@@ -11,6 +11,7 @@ import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.Immutable
import androidx.compose.runtime.staticCompositionLocalOf
import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.graphics.compositeOver
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontWeight
@@ -89,13 +90,13 @@ enum class ThemeChoice { System, Light, Dark }
private fun pdfColorsFrom(cc: com.chethan616.clearpdf.ui.theme.ClearColors): PdfColors {
val candy = com.chethan616.clearpdf.ui.theme.Candy
val dark = cc.dark
- val surface = if (dark) Color(0xFF12132B) else Color(0xFFF5F7FB)
- val raised = if (dark) Color(0xFF1C1D3E) else Color(0xFFE9EDF4)
+ val surface = if (cc.clean) cc.solidPanel else if (dark) Color(0xFF12132B) else Color(0xFFF5F7FB)
+ val raised = if (cc.clean) cc.canvas else if (dark) Color(0xFF1C1D3E) else Color(0xFFE9EDF4)
return PdfColors(
dark = dark,
surface = surface,
surfaceRaised = raised,
- pressed = if (dark) Color(0xFF2A2B52) else Color(0xFFDDE3EC),
+ pressed = if (cc.clean) cc.ink.copy(alpha = 0.12f).compositeOver(surface) else if (dark) Color(0xFF2A2B52) else Color(0xFFDDE3EC),
desk = cc.desk,
pageEdge = if (dark) Color.Transparent else Color(0x1F000000),
text = cc.ink,
diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/desk/Common.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/desk/Common.kt
index bfa03bd..b158ccf 100644
--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/desk/Common.kt
+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/desk/Common.kt
@@ -237,7 +237,7 @@ fun FileListItem(vm: AppViewModel, r: FileRow, recent: Boolean, modifier: Modifi
Spacer(Modifier.height(2.dp))
Text(
listOfNotNull(whenLabel(r.date), r.size.takeIf { it > 0 }?.let { formatSize(it) }).joinToString(" · "),
- style = ClearType.Caption, color = if (vm.cleanFiles && ticked) c.ink else c.inkSoft, maxLines = 1,
+ style = ClearType.Caption, color = if (vm.cleanAppearance && ticked) c.ink else c.inkSoft, maxLines = 1,
)
}
if (selecting) {
diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/desk/FilesScreen.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/desk/FilesScreen.kt
index 6aad5a1..dc88da3 100644
--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/desk/FilesScreen.kt
+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/desk/FilesScreen.kt
@@ -5,7 +5,6 @@ import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
-import androidx.compose.foundation.layout.ColumnScope
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
@@ -14,7 +13,6 @@ import androidx.compose.foundation.layout.WindowInsetsSides
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
-import androidx.compose.foundation.layout.heightIn
import androidx.compose.foundation.layout.navigationBars
import androidx.compose.foundation.layout.only
import androidx.compose.foundation.layout.padding
@@ -23,7 +21,6 @@ import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.layout.windowInsetsBottomHeight
import androidx.compose.foundation.layout.windowInsetsPadding
-import androidx.compose.foundation.selection.selectableGroup
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.LazyListScope
import androidx.compose.foundation.text.BasicTextField
@@ -42,7 +39,6 @@ import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
-import androidx.compose.ui.draw.clip
import androidx.compose.ui.geometry.Rect
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.SolidColor
@@ -51,11 +47,7 @@ import androidx.compose.ui.layout.boundsInWindow
import androidx.compose.ui.layout.onGloballyPositioned
import androidx.compose.ui.res.pluralStringResource
import androidx.compose.ui.res.stringResource
-import androidx.compose.ui.semantics.Role
-import androidx.compose.ui.semantics.selected
-import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.text.input.ImeAction
-import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import com.chethan616.clearpdf.R
import com.chethan616.clearpdf.ui.AppViewModel
@@ -70,7 +62,6 @@ import com.chethan616.clearpdf.ui.glass.GlassRow
import com.chethan616.clearpdf.ui.glass.GlassTab
import com.chethan616.clearpdf.ui.glass.GlassTabs
import com.chethan616.clearpdf.ui.glass.WashPanel
-import com.chethan616.clearpdf.ui.glass.RoundedRectangle
import com.chethan616.clearpdf.ui.glass.glass
import com.chethan616.clearpdf.ui.glass.pressable
import com.chethan616.clearpdf.ui.home.FileRow
@@ -92,7 +83,7 @@ private const val PanelRows = 20
@Composable
fun FilesScreen(vm: AppViewModel, onBrowse: () -> Unit) {
val c = clear
- val clean = vm.cleanFiles
+ val clean = vm.cleanAppearance
var tab by rememberSaveable { mutableIntStateOf(0) }
var query by rememberSaveable { mutableStateOf("") }
var sortByName by rememberSaveable { mutableStateOf(false) }
@@ -167,14 +158,15 @@ fun FilesScreen(vm: AppViewModel, onBrowse: () -> Unit) {
item(key = "search") { SearchCapsule(query, { query = it }, clean, onSearch = { vm.addRecentSearch(query) }) }
if (query.isBlank()) {
item(key = "tabs") {
- FilesTabs(
+ GlassTabs(
tabs = listOf(
GlassTab(stringResource(R.string.home_list_recent), accent = Candy.Tomato),
GlassTab(stringResource(R.string.home_list_starred), accent = Candy.Tangerine),
GlassTab(stringResource(R.string.home_list_on_device), accent = Candy.Sky),
),
selected = tab, onSelect = { tab = it; vm.selectedFiles.clear() },
- clean = clean,
+ modifier = Modifier.padding(horizontal = 16.dp, vertical = 6.dp).fillMaxWidth(),
+ height = 48.dp,
)
}
}
@@ -255,7 +247,7 @@ private fun LazyListScope.panels(vm: AppViewModel, key: String, title: String?,
item(key = "t-$key") {
Row(Modifier.fillMaxWidth().padding(start = 24.dp, end = 24.dp, top = 22.dp, bottom = 8.dp), verticalAlignment = Alignment.Bottom) {
Text(title, style = ClearType.Title, color = clear.ink, modifier = Modifier.weight(1f))
- Text(rows.size.toString(), style = ClearType.Number, color = if (vm.cleanFiles) clear.ink else clear.inkFaint)
+ Text(rows.size.toString(), style = ClearType.Number, color = if (vm.cleanAppearance) clear.ink else clear.inkFaint)
}
}
} else {
@@ -263,10 +255,10 @@ private fun LazyListScope.panels(vm: AppViewModel, key: String, title: String?,
}
rows.chunked(PanelRows).forEachIndexed { i, chunk ->
item(key = "p-$key-$i") {
- FilesPanel(vm.cleanFiles, Modifier.padding(horizontal = 16.dp, vertical = 4.dp).fillMaxWidth()) {
+ WashPanel(Modifier.padding(horizontal = 16.dp, vertical = 4.dp).fillMaxWidth()) {
Spacer(Modifier.height(4.dp))
chunk.forEachIndexed { index, r ->
- if (vm.cleanFiles && index > 0) HorizontalDivider(Modifier.padding(horizontal = 14.dp), color = clear.line)
+ if (vm.cleanAppearance && index > 0) HorizontalDivider(Modifier.padding(horizontal = 14.dp), color = clear.line)
FileListItem(vm, r, recent)
}
Spacer(Modifier.height(4.dp))
@@ -275,35 +267,6 @@ private fun LazyListScope.panels(vm: AppViewModel, key: String, title: String?,
}
}
-/** The same grouped rows sit on the wallpaper or an opaque surface in the current theme. */
-@Composable
-private fun FilesPanel(clean: Boolean, modifier: Modifier, content: @Composable ColumnScope.() -> Unit) {
- if (clean) {
- Column(modifier.clip(RoundedRectangle(28.dp)).background(clear.solidPanel), content = content)
- } else WashPanel(modifier, content = content)
-}
-
-/** A solid segmented control in Clean, or the draggable glass capsule on the wallpaper. */
-@Composable
-private fun FilesTabs(tabs: List<GlassTab>, selected: Int, onSelect: (Int) -> Unit, clean: Boolean) {
- val modifier = Modifier.padding(horizontal = 16.dp, vertical = 6.dp).fillMaxWidth()
- if (!clean) {
- GlassTabs(tabs, selected, onSelect, modifier, height = 48.dp)
- return
- }
- Row(modifier.clip(Capsule).background(clear.solidPanel).selectableGroup().padding(2.dp), verticalAlignment = Alignment.CenterVertically) {
- tabs.forEachIndexed { index, tab ->
- val active = index == selected
- Box(
- Modifier.weight(1f).heightIn(min = 44.dp).clip(Capsule)
- .background(if (active) Candy.Sky.copy(alpha = 0.16f) else Color.Transparent)
- .pressable({ onSelect(index) }, role = Role.Tab).semantics { this.selected = active },
- contentAlignment = Alignment.Center,
- ) { Text(tab.label, style = ClearType.Label, color = clear.ink, textAlign = TextAlign.Center) }
- }
- }
-}
-
/** The Files search capsule, including its clear button and IME search action. */
@Composable
private fun SearchCapsule(query: String, onQuery: (String) -> Unit, clean: Boolean, onSearch: () -> Unit) {
@@ -353,7 +316,7 @@ private fun SelectionHeader(vm: AppViewModel, recent: Boolean, onDelete: () -> U
private fun Places(vm: AppViewModel, onBrowse: () -> Unit, onDevice: () -> Unit) {
Column {
Text(stringResource(R.string.files_places), style = ClearType.Title, color = clear.ink, modifier = Modifier.padding(start = 24.dp, top = 26.dp, bottom = 8.dp))
- FilesPanel(vm.cleanFiles, Modifier.padding(horizontal = 16.dp).fillMaxWidth()) {
+ WashPanel(Modifier.padding(horizontal = 16.dp).fillMaxWidth()) {
Spacer(Modifier.height(4.dp))
PlaceRow(LucideIcons.Smartphone, stringResource(R.string.home_on_this_device), Candy.Sky, onDevice)
PlaceRow(LucideIcons.Images, stringResource(R.string.home_photos), Candy.Lemon) { vm.pickPhotosToPdf() }
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 afa8ddc..8ac3b99 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
@@ -156,7 +156,7 @@ private fun SettingsRoot(vm: AppViewModel, openLicences: () -> Unit, openGlass:
val motionName = MotionStyle.Presets.indexOf(MotionSettings.style).let { if (it < 0) custom else motionPresetNames()[it] }
Panel {
ThemePicker(vm.theme) { vm.setThemeChoice(it) }
- FilesAppearancePicker(vm.cleanFiles, vm::updateCleanFiles)
+ AppearancePicker(vm.cleanAppearance, vm::updateCleanAppearance)
SettingRow(LucideIcons.Globe, Candy.Sky, stringResource(R.string.settings_language), openAppLanguage, value = appLanguage, chevron = true)
SettingRow(LucideIcons.Sparkles, Candy.Grape, stringResource(R.string.settings_glass_motion), openGlass, value = "$glassName · $motionName", chevron = true)
ToggleRow(LucideIcons.Smartphone, Candy.Bubblegum, stringResource(R.string.settings_haptics), null, GlassSettings.haptics) { GlassSettings.updateHaptics(context, it) }
@@ -168,7 +168,7 @@ private fun SettingsRoot(vm: AppViewModel, openLicences: () -> Unit, openGlass:
Panel {
// the name Today greets (small, above "Good Morning"); empty: none
SettingRow(LucideIcons.UserRound, Candy.Tangerine, stringResource(R.string.settings_your_name), { naming = true }, value = vm.ownerName.ifBlank { null }, chevron = true, first = true)
- WallpaperPicker(context)
+ if (!clear.clean) WallpaperPicker(context)
}
}
@@ -402,13 +402,13 @@ internal fun Panel(content: @Composable ColumnScope.() -> Unit) {
}
}
-/** The Files surface choice is independent of the app's light or dark theme. */
+/** The app surface choice is independent of the app's light or dark theme. */
@Composable
-private fun FilesAppearancePicker(cleanFiles: Boolean, onPick: (Boolean) -> Unit) {
- Choice(stringResource(R.string.settings_files_appearance)) {
+private fun AppearancePicker(cleanAppearance: Boolean, onPick: (Boolean) -> Unit) {
+ Choice(stringResource(R.string.settings_app_appearance)) {
Column(Modifier.selectableGroup()) {
for (clean in listOf(false, true)) {
- val active = clean == cleanFiles
+ val active = clean == cleanAppearance
Row(
Modifier.fillMaxWidth().pressable({ onPick(clean) }, role = Role.RadioButton)
.semantics { selected = active }.heightIn(min = 48.dp).padding(horizontal = 8.dp, vertical = 4.dp),
@@ -418,8 +418,8 @@ private fun FilesAppearancePicker(cleanFiles: Boolean, onPick: (Boolean) -> Unit
RadioButton(selected = active, onClick = null,
colors = RadioButtonDefaults.colors(selectedColor = Candy.Sky, unselectedColor = clear.inkSoft))
Column {
- Text(stringResource(if (clean) R.string.files_style_clean else R.string.files_style_glass), style = ClearType.BodyStrong, color = clear.ink)
- Text(stringResource(if (clean) R.string.files_style_clean_detail else R.string.files_style_glass_detail), style = ClearType.Caption, color = clear.inkSoft)
+ Text(stringResource(if (clean) R.string.app_style_clean else R.string.app_style_glass), style = ClearType.BodyStrong, color = clear.ink)
+ Text(stringResource(if (clean) R.string.app_style_clean_detail else R.string.app_style_glass_detail), style = ClearType.Caption, color = clear.inkSoft)
}
}
}
@@ -439,6 +439,16 @@ private fun ThemePicker(current: ThemeChoice, onPick: (ThemeChoice) -> Unit) {
ThemeChoice.Light to stringResource(R.string.settings_theme_light),
ThemeChoice.Dark to stringResource(R.string.settings_theme_dark),
)
+ if (c.clean) {
+ Choice(stringResource(R.string.settings_theme)) {
+ GlassTabs(
+ choices.map { GlassTab(it.second, accent = Candy.Sky) },
+ choices.indexOfFirst { it.first == current }, { onPick(choices[it].first) },
+ Modifier.fillMaxWidth(), height = 48.dp,
+ )
+ }
+ return
+ }
Row(Modifier.fillMaxWidth().padding(start = 14.dp, end = 14.dp, top = 12.dp, bottom = 10.dp), horizontalArrangement = Arrangement.spacedBy(12.dp)) {
choices.forEach { (choice, label) ->
val on = choice == current
diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/desk/ToolsScreen.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/desk/ToolsScreen.kt
index 0ebdc05..78060a2 100644
--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/desk/ToolsScreen.kt
+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/desk/ToolsScreen.kt
@@ -1,5 +1,6 @@
package com.chethan616.clearpdf.ui.desk
+import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.BoxWithConstraints
@@ -101,19 +102,37 @@ private fun toneOf(t: ToolDef): Tone = when (t.key) {
@Composable
fun ToolsScreen(vm: AppViewModel) {
var cat by rememberSaveable { mutableStateOf("All") }
+ val clean = clear.clean
val tools = ToolCatalog.All.filter { cat == "All" || cat in it.categories }
LazyColumn(Modifier.fillMaxSize(), contentPadding = PaddingValues(bottom = DockClearance)) {
item { Spacer(Modifier.windowInsetsTopHeight(WindowInsets.statusBars)) }
item(key = "header") {
Spacer(Modifier.height(16.dp))
- ScreenHeader(null, stringResource(R.string.home_tab_tools), titleStyle = ClearType.ToolsTitle, onBack = { vm.homeTab = HomeTab.Home })
+ ScreenHeader(null, stringResource(R.string.home_tab_tools), titleStyle = if (clean) ClearType.Display else ClearType.ToolsTitle, onBack = { vm.homeTab = HomeTab.Home })
}
item(key = "chips") {
LazyRow(Modifier.chipRowFade(),contentPadding = PaddingValues(horizontal = 20.dp, vertical = 16.dp), horizontalArrangement = Arrangement.spacedBy(8.dp)) {
items(Categories, key = { it.first }) { (k, label) -> com.chethan616.clearpdf.ui.home.DeskChip(stringResource(label), k == cat) { cat = k } }
}
}
- item(key = "bento") {
+ if (clean) {
+ items(tools.size, key = { tools[it].key }) { index ->
+ val tool = tools[index]
+ Row(
+ Modifier.fillMaxWidth().padding(horizontal = 16.dp, vertical = 3.dp)
+ .background(clear.solidPanel, com.chethan616.clearpdf.ui.glass.RoundedRectangle(16.dp))
+ .pressable({ tool.go(vm) }).padding(16.dp),
+ verticalAlignment = Alignment.CenterVertically,
+ horizontalArrangement = Arrangement.spacedBy(14.dp),
+ ) {
+ Icon(tool.icon, null, Modifier.size(22.dp), tint = clear.tone(Tone.Paper).accent)
+ Column {
+ Text(stringResource(tool.label), style = ClearType.BodyStrong, color = clear.ink)
+ Text(stringResource(tool.about), style = ClearType.Body, color = clear.inkSoft)
+ }
+ }
+ }
+ } else item(key = "bento") {
val measurer = rememberTextMeasurer()
val density = LocalDensity.current
val names = ToolCatalog.All.map { stringResource(it.label) }
diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/AdaptiveGlass.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/AdaptiveGlass.kt
index 8bc9a16..a07bd45 100644
--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/AdaptiveGlass.kt
+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/AdaptiveGlass.kt
@@ -133,7 +133,7 @@ class GlassLuminance internal constructor(initial: Float, internal val layer: Gr
*/
@Composable
fun rememberGlassLuminance(enabled: Boolean = GlassSettings.adaptive): GlassLuminance? {
- if (!enabled) return null
+ if (!enabled || clear.clean) return null
val layer = rememberGraphicsLayer()
val dark = clear.dark
// the first guess: what the screen as a whole looks like now (the window's sampler, running
diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/AdaptiveInk.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/AdaptiveInk.kt
index 5c8ad67..45d5a00 100644
--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/AdaptiveInk.kt
+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/AdaptiveInk.kt
@@ -36,6 +36,7 @@ import androidx.compose.ui.layout.onGloballyPositioned
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.platform.LocalView
import androidx.compose.ui.unit.dp
+import com.chethan616.clearpdf.ui.theme.clear
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import kotlinx.coroutines.flow.first
@@ -183,7 +184,7 @@ fun ProvideScreenInk(enabled: Boolean = true, content: @Composable () -> Unit) {
val view = LocalView.current
val window = remember(view) { view.context.findActivity()?.window }
val sampler = remember { ScreenInkSampler() }
- val runs = enabled && above == null && window != null
+ val runs = enabled && !clear.clean && above == null && window != null
if (runs && window != null) LaunchedEffect(window, view) { sampler.run(window, view) }
CompositionLocalProvider(LocalScreenInk provides (above ?: if (runs) sampler else null), content = content)
}
@@ -210,7 +211,7 @@ class SurroundLuminance internal constructor(initial: Float) {
fun rememberSurroundLuminance(): SurroundLuminance? {
val sampler = LocalScreenInk.current
if (!GlassSettings.adaptive || sampler == null) return null
- val dark = com.chethan616.clearpdf.ui.theme.clear.dark
+ val dark = clear.dark
val state = remember { SurroundLuminance(sampler.frame?.average() ?: if (dark) 0.14f else 0.86f) }
val gap = with(LocalDensity.current) { 7.dp.toPx() }
val overlays = LocalGlassOverlayHost.current
@@ -307,4 +308,5 @@ private tailrec fun Context.findActivity(): Activity? = when (this) {
*/
@Composable
fun rememberGlassInk(fallback: Color): InkProbe =
- if (LocalScreenInk.current != null) rememberAdaptiveInk(fallback) else remember(fallback) { InkProbe(Modifier, fallback) }
+ if (clear.clean) InkProbe(Modifier, clear.ink)
+ else if (LocalScreenInk.current != null) rememberAdaptiveInk(fallback) else remember(fallback) { InkProbe(Modifier, fallback) }
diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Backdrops.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Backdrops.kt
index 41088ed..5b2688c 100644
--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Backdrops.kt
+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Backdrops.kt
@@ -1,5 +1,6 @@
package com.chethan616.clearpdf.ui.glass
+import androidx.compose.foundation.background
import androidx.compose.animation.core.Animatable
import androidx.compose.animation.core.AnimationVector4D
import androidx.compose.animation.core.TwoWayConverter
@@ -109,6 +110,10 @@ private val OffsetPairConverter = TwoWayConverter<Pair<Offset, Offset>, Animatio
*/
@Composable
fun Aurora(mood: AuroraMood, modifier: Modifier = Modifier) {
+ if (clear.clean) {
+ androidx.compose.foundation.layout.Spacer(modifier.fillMaxSize().background(clear.desk))
+ return
+ }
// the old ClearPDF's glossy blobs: their hard, shaded edges are what the glass's lens bends at
// every rim, so the buttons over them read raised, as they did there
val custom = GlassSettings.customWallpaper
diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Buttons.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Buttons.kt
index b251f31..abd43f9 100644
--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Buttons.kt
+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Buttons.kt
@@ -1,5 +1,8 @@
package com.chethan616.clearpdf.ui.glass
+import androidx.compose.ui.graphics.compositeOver
+import androidx.compose.ui.draw.drawBehind
+import androidx.compose.foundation.background
import androidx.compose.ui.draw.drawWithContent
import androidx.compose.runtime.setValue
@@ -79,6 +82,16 @@ private fun Modifier.glassControl(
aroundOut: ((SurroundLuminance?) -> Unit)? = null,
): Modifier {
val backdrop = LocalBackdrop.current
+ if (clear.clean) {
+ val panel = clear.solidPanel
+ return clip(shape).drawBehind {
+ val accent = tintAt?.invoke() ?: tint
+ drawRect(if (accent.isSpecified) accent.compositeOver(panel) else panel)
+ if (surface.isSpecified) drawRect(surface)
+ fill?.invoke()?.let { drawRect(it) }
+ }.pressable(onClick, onLongClick, feel = tap)
+ .then(if (label == null) Modifier else Modifier.semantics { contentDescription = label })
+ }
// Adaptive luminance on: the glass reads the screen around it and turns to suit, its frost,
// colour and tint set by that instead of the glass preset. [adaptWash] false keeps the milk or
// smoke off a control whose ink is the caller's (a chip's label), where only the glass adapts.
@@ -186,6 +199,10 @@ fun rememberBeat(action: () -> Unit, millis: Long = BackBeatMillis): () -> Unit
*/
@Composable
fun Modifier.glassBar(shape: Shape = ChromeCapsule, surface: Color = Color.Unspecified, blur: Dp = 2.dp): Modifier {
+ if (clear.clean) {
+ val panel = clear.solidPanel
+ return clip(shape).background(if (surface.isSpecified) surface.compositeOver(panel) else panel)
+ }
val backdrop = LocalBackdrop.current
val scope = rememberCoroutineScope()
val highlight = remember(scope) { InteractiveHighlight(scope) }
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 fc678f5..f122486 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
@@ -151,7 +151,7 @@ fun MorphButtonSurface(
}
val glyph: @Composable () -> Unit = icon ?: MorphAnchors.glyphAt(anchor) ?: {}
// Android 13+: the liquid version (the glass shaders it needs); before that the plain expansion
- if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.TIRAMISU) {
+ if (!com.chethan616.clearpdf.ui.theme.clear.clean && android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.TIRAMISU) {
LiquidMorphSurface(anchor, open, onDismiss, gone, menuWidth, maxHeight, glyph, ghost, body)
} else {
RectMorphSurface(anchor, open, onDismiss, gone, menuWidth, maxHeight, glyph, ghost, body)
diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Surfaces.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Surfaces.kt
index d4ecb3c..c638698 100644
--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Surfaces.kt
+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Surfaces.kt
@@ -46,6 +46,7 @@ fun Modifier.glass(
styleOverride: GlassStyle? = null,
luminance: GlassLuminance? = null,
): Modifier {
+ if (clear.clean) return clip(shape).background(clear.solidPanel)
val backdrop = LocalBackdrop.current
val style = styleOverride ?: GlassSettings.style
// adaptive: the glass answers what is behind it instead of wearing the theme's wash
@@ -135,6 +136,7 @@ fun GlassHost(
*/
@Composable
fun Modifier.wash(shape: Shape = RoundedRectangle(28.dp), tint: Color = clear.glass): Modifier {
+ if (clear.clean) return clip(shape).background(clear.solidPanel)
val dark = clear.dark
val rimTop = Color.White.copy(alpha = if (dark) 0.16f else 0.70f)
val rimBottom = Color.White.copy(alpha = if (dark) 0.03f else 0.18f)
diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Tabs.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Tabs.kt
index b745ff7..ef6ef1b 100644
--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Tabs.kt
+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Tabs.kt
@@ -4,6 +4,11 @@ import androidx.compose.animation.animateColorAsState
import androidx.compose.animation.core.Animatable
import androidx.compose.animation.core.EaseOut
import androidx.compose.animation.core.spring
+import androidx.compose.foundation.background
+import androidx.compose.foundation.layout.heightIn
+import androidx.compose.foundation.selection.selectableGroup
+import androidx.compose.ui.draw.clip
+import androidx.compose.ui.text.style.TextAlign
import androidx.compose.foundation.clickable
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.Arrangement
@@ -90,6 +95,24 @@ fun GlassTabs(
textStyle: TextStyle = ClearType.Label,
) {
val c = clear
+ if (c.clean) {
+ Row(modifier.clip(Capsule).background(c.solidPanel).selectableGroup().padding(2.dp),
+ verticalAlignment = Alignment.CenterVertically) {
+ tabs.forEachIndexed { index, tab ->
+ val active = index == selected
+ Column(
+ Modifier.weight(1f).heightIn(min = height - 4.dp).clip(Capsule)
+ .background(if (active) com.chethan616.clearpdf.ui.theme.Candy.Sky.copy(alpha = 0.16f) else Color.Transparent)
+ .pressable({ onSelect(index) }, role = Role.Tab).semantics { this.selected = active; contentDescription = tab.label },
+ horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.Center,
+ ) {
+ tab.icon?.let { Icon(it, null, Modifier.size(20.dp), tint = c.ink) }
+ if (tab.label.isNotEmpty()) Text(tab.label, style = textStyle, color = c.ink, textAlign = TextAlign.Center)
+ }
+ }
+ }
+ return
+ }
val backdrop = LocalBackdrop.current
val haptics = LocalHaptics.current
val count = tabs.size
diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/home/Cards.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/home/Cards.kt
index 37387f8..c06edac 100644
--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/home/Cards.kt
+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/home/Cards.kt
@@ -96,6 +96,7 @@ val CardShape = RoundedRectangle(30.dp)
/** A desk card's paint: its tone's gradient, a soft light in one corner, a lit rim. */
@Composable
fun Modifier.cardPaint(tone: CardTone, glow: Offset = Offset(0.85f, 0.05f)): Modifier {
+ if (clear.clean) return clip(CardShape).background(clear.solidPanel)
val dark = clear.dark
return clip(CardShape)
.drawBehind {
@@ -161,7 +162,7 @@ fun ListCard(
Column(Modifier.padding(start = 12.dp, end = 12.dp, top = 20.dp, bottom = 14.dp)) {
WordFitText(
note.title.ifBlank { stringResource(R.string.notes_untitled_list) },
- ClearType.DotTitle.copy(color = tone.ink.copy(alpha = 0.92f), textAlign = TextAlign.Center),
+ (if (clear.clean) ClearType.Title else ClearType.DotTitle).copy(color = tone.ink.copy(alpha = 0.92f), textAlign = TextAlign.Center),
maxLines = 3,
modifier = Modifier.fillMaxWidth().padding(horizontal = 2.dp),
)
@@ -259,7 +260,7 @@ fun NoteCard(
Column(
modifier.heightIn(min = 156.dp).pressable(onOpen, onLong, pressedScale = 0.96f).cardPaint(tone, Offset(0.1f, 0.0f)).padding(18.dp),
) {
- WordFitText(title.ifBlank { stringResource(R.string.notes_untitled_note) }, ClearType.CardTitle.copy(color = tone.accent), maxLines = 4)
+ WordFitText(title.ifBlank { stringResource(R.string.notes_untitled_note) }, (if (clear.clean) ClearType.Title else ClearType.CardTitle).copy(color = tone.accent), maxLines = 4)
if (body.isNotBlank() && title.length < 40) {
Spacer(Modifier.height(8.dp))
Text(body, style = ClearType.Label, color = tone.ink.copy(alpha = 0.62f), maxLines = 3, overflow = TextOverflow.Ellipsis, modifier = if (fitHeight) Modifier.weight(1f, fill = false) else Modifier)
@@ -297,7 +298,7 @@ fun MapCard(note: Note, onOpen: () -> Unit, onLong: () -> Unit, modifier: Modifi
Text(stringResource(R.string.mindmap_title), style = ClearType.Caption.copy(fontSize = 11.sp), color = tone.ink.copy(alpha = 0.75f))
}
Spacer(Modifier.height(6.dp))
- WordFitText(note.title.ifBlank { stringResource(R.string.mindmap_title) }, ClearType.CardTitle.copy(color = tone.accent), maxLines = 3)
+ WordFitText(note.title.ifBlank { stringResource(R.string.mindmap_title) }, (if (clear.clean) ClearType.Title else ClearType.CardTitle).copy(color = tone.accent), maxLines = 3)
Spacer(Modifier.height(10.dp))
// the map itself, small: on a soft well so its colours read on the lavender
Canvas(
@@ -328,7 +329,7 @@ fun ThoughtCard(onOpen: () -> Unit, modifier: Modifier = Modifier) {
val res = androidx.compose.ui.platform.LocalContext.current.resources
val quote = remember(res) { com.chethan616.clearpdf.notes.thoughtFor(res).quote }
Column(modifier.heightIn(min = 188.dp).pressable(onOpen, pressedScale = 0.96f).cardPaint(tone, Offset(0.1f, 0.0f)).padding(18.dp)) {
- WordFitText(stringResource(R.string.thought_title), ClearType.CardTitle.copy(color = tone.accent), maxLines = 4)
+ WordFitText(stringResource(R.string.thought_title), (if (clear.clean) ClearType.Title else ClearType.CardTitle).copy(color = tone.accent), maxLines = 4)
Spacer(Modifier.height(10.dp))
Text("“$quote”", style = ClearType.Body.copy(fontSize = 14.sp, lineHeight = 19.sp, fontStyle = androidx.compose.ui.text.font.FontStyle.Italic), color = tone.ink.copy(alpha = 0.8f), maxLines = 5, overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis)
Spacer(Modifier.weight(1f))
@@ -376,7 +377,7 @@ val LocalHomeVm = androidx.compose.runtime.staticCompositionLocalOf<AppViewModel
*/
@Composable
fun VoiceCard(note: Note, playing: Boolean, progress: () -> Float, onPlay: () -> Unit, onLong: () -> Unit, modifier: Modifier = Modifier) {
- val tone = VoiceTone
+ val tone = if (clear.clean) clear.tone(Tone.Paper) else VoiceTone
Box(
modifier.height(92.dp).pressable(onPlay, onLong, pressedScale = 0.96f).voicePaint(tone),
) {
@@ -384,14 +385,14 @@ fun VoiceCard(note: Note, playing: Boolean, progress: () -> Float, onPlay: () ->
Modifier.align(Alignment.TopStart).fillMaxWidth().padding(start = 16.dp, end = 14.dp, top = 13.dp),
verticalAlignment = Alignment.CenterVertically,
) {
- PlayMark(playing, Modifier.size(13.dp))
+ PlayMark(playing, Modifier.size(13.dp), tone.ink)
Spacer(Modifier.width(8.dp))
Text(
- note.title, style = ClearType.Label.copy(fontSize = 12.sp, lineHeight = 14.sp), color = Color.White.copy(alpha = 0.95f),
+ note.title, style = ClearType.Label.copy(fontSize = 12.sp, lineHeight = 14.sp), color = tone.ink.copy(alpha = 0.95f),
maxLines = 1, overflow = TextOverflow.Ellipsis, modifier = Modifier.weight(1f),
)
if (note.durationMs > 0) {
- Text(com.chethan616.clearpdf.ui.viewer.clock(note.durationMs), style = ClearType.Caption.copy(fontSize = 10.5.sp, fontFeatureSettings = "tnum"), color = Color.White.copy(alpha = 0.78f))
+ Text(com.chethan616.clearpdf.ui.viewer.clock(note.durationMs), style = ClearType.Caption.copy(fontSize = 10.5.sp, fontFeatureSettings = "tnum"), color = tone.ink.copy(alpha = 0.78f))
}
}
val bars = remember(note.wave) { voiceBars(note.wave) }
@@ -399,8 +400,8 @@ fun VoiceCard(note: Note, playing: Boolean, progress: () -> Float, onPlay: () ->
// the mock's waveform: under half the card's width, centred a little below the middle
Box(Modifier.align(Alignment.Center).padding(top = 14.dp).fillMaxWidth(0.46f).height(46.dp)) {
// the glow: the same bars, blurred, behind the crisp ones (a still layer: it's cached)
- Waveform(bars, p, Modifier.matchParentSize().blur(9.dp, BlurredEdgeTreatment.Unbounded).graphicsLayer { alpha = 0.9f })
- Waveform(bars, p, Modifier.matchParentSize())
+ if (!clear.clean) Waveform(bars, p, Modifier.matchParentSize().blur(9.dp, BlurredEdgeTreatment.Unbounded).graphicsLayer { alpha = 0.9f })
+ Waveform(bars, p, Modifier.matchParentSize(), color = tone.accent)
}
}
}
@@ -410,6 +411,7 @@ private val VoiceTone = CardTone(Color(0xFFA3AAF0), Color(0xFFC2C5F7), Color.Whi
@Composable
private fun Modifier.voicePaint(tone: CardTone): Modifier {
+ if (clear.clean) return clip(CardShape).background(clear.solidPanel)
val dark = clear.dark
return clip(CardShape)
.drawBehind {
@@ -427,12 +429,12 @@ private fun Modifier.voicePaint(tone: CardTone): Modifier {
/** A rounded play triangle (or two pause bars), in white. */
@Composable
-private fun PlayMark(playing: Boolean, modifier: Modifier) {
+private fun PlayMark(playing: Boolean, modifier: Modifier, color: Color) {
Canvas(modifier) {
if (playing) {
val w = size.width * 0.3f
- drawRoundRect(Color.White, Offset(size.width * 0.1f, 0f), Size(w, size.height), CornerRadius(w / 2f))
- drawRoundRect(Color.White, Offset(size.width * 0.6f, 0f), Size(w, size.height), CornerRadius(w / 2f))
+ drawRoundRect(color, Offset(size.width * 0.1f, 0f), Size(w, size.height), CornerRadius(w / 2f))
+ drawRoundRect(color, Offset(size.width * 0.6f, 0f), Size(w, size.height), CornerRadius(w / 2f))
} else {
val path = Path().apply {
moveTo(size.width * 0.12f, size.height * 0.05f)
@@ -440,8 +442,8 @@ private fun PlayMark(playing: Boolean, modifier: Modifier) {
lineTo(size.width * 0.12f, size.height * 0.95f)
close()
}
- drawPath(path, Color.White)
- drawPath(path, Color.White, style = androidx.compose.ui.graphics.drawscope.Stroke(width = size.width * 0.16f, join = androidx.compose.ui.graphics.StrokeJoin.Round))
+ drawPath(path, color)
+ drawPath(path, color, style = androidx.compose.ui.graphics.drawscope.Stroke(width = size.width * 0.16f, join = androidx.compose.ui.graphics.StrokeJoin.Round))
}
}
}
@@ -495,6 +497,18 @@ fun Waveform(levels: List<Float>, progress: () -> Float, modifier: Modifier, col
/** A collection ("Files", "Pdf"): its word set big in serif, and two papers fanned in the corner. */
@Composable
fun CollectionCard(word: String, tone: CardTone, onOpen: () -> Unit, modifier: Modifier = Modifier, height: Dp = 150.dp, count: Int? = null) {
+ if (clear.clean) {
+ Row(
+ modifier.heightIn(min = 64.dp).cardPaint(tone).pressable(onOpen).padding(14.dp),
+ horizontalArrangement = Arrangement.spacedBy(10.dp),
+ verticalAlignment = Alignment.CenterVertically,
+ ) {
+ Icon(LucideIcons.FolderOpen, null, Modifier.size(20.dp), tint = tone.accent)
+ Text(word, style = ClearType.Title, color = tone.ink, modifier = Modifier.weight(1f))
+ if (count != null && count > 0) Text(count.toString(), style = ClearType.Label, color = tone.ink)
+ }
+ return
+ }
Box(modifier.height(height).pressable(onOpen, pressedScale = 0.95f).cardPaint(tone, Offset(0.2f, 1.0f))) {
Papers(Modifier.align(Alignment.TopEnd).padding(top = 14.dp, end = 14.dp))
Text(
@@ -637,7 +651,7 @@ fun RecentCard(
.pressable(onAll, onLong?.let { { it(bounds) } }, pressedScale = 0.95f),
) {
// a blush card peeking out behind, turned
- Box(Modifier.fillMaxSize().padding(vertical = 8.dp).graphicsLayer { rotationZ = 5f; translationX = 8.dp.toPx() }.clip(CardShape).background(Brush.verticalGradient(listOf(clear.tone(Tone.Blush).top, clear.tone(Tone.Blush).bottom))))
+ if (!clear.clean) Box(Modifier.fillMaxSize().padding(vertical = 8.dp).graphicsLayer { rotationZ = 5f; translationX = 8.dp.toPx() }.clip(CardShape).background(Brush.verticalGradient(listOf(clear.tone(Tone.Blush).top, clear.tone(Tone.Blush).bottom))))
// the card and the pages fanned on it are the layer the chips' glass refracts
GlassHost(
Modifier.fillMaxSize(),
diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/home/CreateDock.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/home/CreateDock.kt
index ef4d412..caebfb6 100644
--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/home/CreateDock.kt
+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/home/CreateDock.kt
@@ -275,9 +275,9 @@ fun BoxScope.CreateDock(
desk.haptics?.play(if (desk.fanOpen) Feel.Rise else Feel.Fall)
}
GlassCircle(
- onClick = { if (desk.recorder == null) desk.startRecording(vm) }, tap = null, size = 54.dp, surface = Color.White.copy(alpha = 0.30f),
+ onClick = { if (desk.recorder == null) desk.startRecording(vm) }, tap = null, size = 54.dp, surface = if (c.clean) c.solidPanel else Color.White.copy(alpha = 0.30f),
label = stringResource(R.string.create_voice),
- ) { GlassIcon(LucideIcons.Mic, null, Modifier.size(22.dp), tint = DockInk) }
+ ) { GlassIcon(LucideIcons.Mic, null, Modifier.size(22.dp), tint = if (c.clean) c.ink else DockInk) }
}
shown?.let { r ->
Box(
@@ -310,7 +310,7 @@ fun BoxScope.CreateDock(
// the very glass of the Back and menu buttons; the recorder darkens it so its white reads
.glass(Capsule, c.glass, blur = 3.dp, lensHeight = 14.dp, lensAmount = 26.dp)
.graphicsLayer { clip = true; shape = Capsule }
- .drawBehind { drawRect(c.capsule, alpha = lerp(0.5f, 1.9f, morph.value.coerceIn(0f, 1f)).coerceAtMost(1f)) }
+ .drawBehind { drawRect(if (c.clean && shown != null) DockInk else c.capsule, alpha = lerp(0.5f, 1.9f, morph.value.coerceIn(0f, 1f)).coerceAtMost(1f)) }
.padding(6.dp),
) { measurables, constraints ->
val loose = constraints.copy(minWidth = 0, minHeight = 0)
diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/home/DeskPages.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/home/DeskPages.kt
index 8f0ffa5..45d0408 100644
--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/home/DeskPages.kt
+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/home/DeskPages.kt
@@ -1,5 +1,6 @@
package com.chethan616.clearpdf.ui.home
+import androidx.compose.foundation.layout.statusBarsPadding
import androidx.compose.animation.animateContentSize
import androidx.compose.animation.core.Animatable
import androidx.compose.animation.core.animateFloatAsState
@@ -196,6 +197,10 @@ private fun BaselineStack(gaps: List<androidx.compose.ui.unit.Dp>, after: androi
*/
@Composable
private fun FadeIntoBlur(from: Float, blur: androidx.compose.ui.unit.Dp, modifier: Modifier = Modifier, content: @Composable () -> Unit) {
+ if (clear.clean) {
+ Box(modifier) { content() }
+ return
+ }
Box(modifier) {
Box(
Modifier.graphicsLayer { compositingStrategy = androidx.compose.ui.graphics.CompositingStrategy.Offscreen }
@@ -274,7 +279,7 @@ fun ThoughtsScreen(vm: AppViewModel, desk: DeskState) {
FadeIntoBlur(0.5f, m(3.2f, k), Modifier.fillMaxWidth().baselineAt(null, m(239, k))) {
Text(
stringResource(R.string.thought_title),
- style = outfit(500, s(55.5f, k), -0.016f, (84 * k).sp).copy(color = Color.White, textAlign = TextAlign.Center),
+ style = outfit(500, s(55.5f, k), -0.016f, (84 * k).sp).copy(color = clear.hero, textAlign = TextAlign.Center),
modifier = Modifier.fillMaxWidth().padding(horizontal = m(40, k)),
)
}
@@ -289,7 +294,7 @@ fun ThoughtsScreen(vm: AppViewModel, desk: DeskState) {
Column(Modifier.fillMaxWidth().offset(y = m(452, k)), horizontalAlignment = Alignment.CenterHorizontally) {
if (notes.isEmpty()) {
Text(
- stringResource(R.string.thoughts_empty), style = outfit(400, s(12.9f, k)).copy(color = Color(0xFF2C1E3D), textAlign = TextAlign.Center),
+ stringResource(R.string.thoughts_empty), style = outfit(400, s(12.9f, k)).copy(color = if (clear.clean) clear.inkSoft else Color(0xFF2C1E3D), textAlign = TextAlign.Center),
modifier = Modifier.padding(top = m(60, k), bottom = m(60, k)).padding(horizontal = m(40, k)),
)
} else {
@@ -335,6 +340,13 @@ internal fun DeskHeaderRow(leading: @Composable () -> Unit, trailing: @Composabl
/** The mock's "Create new": a white pill (190 × 56 px) in a slate glass ring (212 × 79 px). */
@Composable
private fun CreateNewPill(k: Float, modifier: Modifier, onClick: () -> Unit) {
+ if (clear.clean) {
+ GlassPill(onClick, modifier) {
+ Icon(LucideIcons.Plus, null, Modifier.size(18.dp), tint = clear.ink)
+ Text(stringResource(R.string.thoughts_create_new), style = ClearType.BodyStrong, color = clear.ink)
+ }
+ return
+ }
Box(
modifier.size(m(212, k), m(79, k)).clip(androidx.compose.foundation.shape.CircleShape).background(Color(0xFF4E5E78).copy(alpha = 0.94f))
.pressable(onClick, pressedScale = 0.94f),
@@ -497,7 +509,7 @@ private fun DeckCard(
if (!front) Box(Modifier.matchParentSize().pointerInput(Unit) { detectTapGestures { } })
// further back: tinted (cream, then pink) and blurred, as the mock's cards behind
if (d > 0.01f) {
- val tint = if (d <= 1f) Color(0xFFFBFCF0) else androidx.compose.ui.graphics.lerp(Color(0xFFFBFCF0), Color(0xFFFCEEFD), (d - 1f).coerceIn(0f, 1f))
+ val tint = if (clear.clean) clear.desk else if (d <= 1f) Color(0xFFFBFCF0) else androidx.compose.ui.graphics.lerp(Color(0xFFFBFCF0), Color(0xFFFCEEFD), (d - 1f).coerceIn(0f, 1f))
Box(
Modifier.matchParentSize().clip(RoundedRectangle(m(28, k)))
.background(tint.copy(alpha = (0.62f * d).coerceAtMost(0.8f))),
@@ -541,9 +553,12 @@ private fun FrontCard(
active: Boolean = true,
) {
// a voice memo plays (or pauses) on a tap; anything else opens
+ val c = clear
+ val paper = if (c.clean) c.solidPanel else Color.White
+ val ink = if (c.clean) c.ink else Color.Black
val open = { if (n.kind == NoteKind.Voice) onPlay() else vm.openNote = n.id }
val (lead, rest) = leadAndRest(n)
- Box(modifier.clip(RoundedRectangle(m(28, k))).background(Color.White).pressable(open, onLong, pressedScale = 0.98f, enabled = active)) {
+ Box(modifier.clip(RoundedRectangle(m(28, k))).background(paper).pressable(open, onLong, pressedScale = 0.98f, enabled = active)) {
val gaps = buildList {
add(m(47, k)); add(m(22, k))
if (lead != null) add(m(56, k))
@@ -551,14 +566,14 @@ private fun FrontCard(
if (n.images.isNotEmpty()) add(m(31, k))
}
BaselineStack(gaps, m(26, k), Modifier.padding(horizontal = m(25, k))) {
- Text(titleOf(n).ifBlank { stringResource(R.string.notes_untitled_note) }, style = outfit(600, s(13.7f, k), -0.03f).copy(color = Color.Black), maxLines = 1, overflow = TextOverflow.Ellipsis, modifier = Modifier.padding(end = m(60, k)))
+ Text(titleOf(n).ifBlank { stringResource(R.string.notes_untitled_note) }, style = outfit(600, s(13.7f, k), -0.03f).copy(color = ink), maxLines = 1, overflow = TextOverflow.Ellipsis, modifier = Modifier.padding(end = m(60, k)))
Text(
DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT).format(Date(n.updated)) +
(if (n.kind == NoteKind.Voice && n.durationMs > 0) " · " + com.chethan616.clearpdf.ui.viewer.clock(n.durationMs) else ""),
- style = outfit(400, s(9.2f, k), -0.02f).copy(color = Color(0xFF525658)),
+ style = outfit(400, s(9.2f, k), -0.02f).copy(color = if (c.clean) c.inkSoft else Color(0xFF525658)),
)
- if (lead != null) Text(lead, style = outfit(600, s(18.9f, k), -0.005f, (31 * k).sp).copy(color = Color(0xFF2B649B)), maxLines = 3, overflow = TextOverflow.Ellipsis)
- if (rest.isNotBlank()) Text(rest, style = outfit(400, s(12.9f, k), 0f, (25 * k).sp).copy(color = Color.Black), maxLines = 5, overflow = TextOverflow.Ellipsis)
+ if (lead != null) Text(lead, style = outfit(600, s(18.9f, k), -0.005f, (31 * k).sp).copy(color = if (c.clean) c.tone(Tone.Paper).accent else Color(0xFF2B649B)), maxLines = 3, overflow = TextOverflow.Ellipsis)
+ if (rest.isNotBlank()) Text(rest, style = outfit(400, s(12.9f, k), 0f, (25 * k).sp).copy(color = ink), maxLines = 5, overflow = TextOverflow.Ellipsis)
if (n.images.isNotEmpty()) {
Row(horizontalArrangement = Arrangement.spacedBy(m(16, k))) {
NoteImage(n.images[0], Modifier.weight(if (n.images.size > 1) 226f else 1f).height(m(129, k)).clip(RoundedRectangle(m(20, k))))
@@ -571,9 +586,9 @@ private fun FrontCard(
Box(
Modifier.align(Alignment.TopEnd).padding(top = m(28, k), end = m(16, k)).size(m(54, k))
.graphicsLayer { shadowElevation = 6.dp.toPx(); shape = androidx.compose.foundation.shape.CircleShape; clip = true; ambientShadowColor = Color(0x22000000); spotShadowColor = Color(0x22000000) }
- .background(Color.White).pressable(open, pressedScale = 0.9f, enabled = active),
+ .background(paper).pressable(open, pressedScale = 0.9f, enabled = active),
contentAlignment = Alignment.Center,
- ) { Icon(LucideIcons.PencilOutline, stringResource(R.string.notes_open), tint = Color(0xFF1A1A1A), modifier = Modifier.size(m(26, k))) }
+ ) { Icon(LucideIcons.PencilOutline, stringResource(R.string.notes_open), tint = if (c.clean) ink else Color(0xFF1A1A1A), modifier = Modifier.size(m(26, k))) }
}
}
}
@@ -610,7 +625,7 @@ fun TodayScreen(vm: AppViewModel) {
.flatMap { n -> n.items.filter { !it.done && it.text.isNotBlank() } }
}
Box(Modifier.fillMaxSize().verticalScroll(rememberScrollState())) {
- Box(Modifier.fillMaxWidth().height(m(1068, k))) {
+ Box(Modifier.fillMaxWidth().then(if (clear.clean) Modifier else Modifier.height(m(1068, k)))) {
// the desk's own header: its mark (a tap goes back to the desk) and its menu button
DeskHeaderRow(
leading = {
@@ -632,89 +647,123 @@ fun TodayScreen(vm: AppViewModel) {
) { FourDots(Color.Unspecified) }
},
)
- // the name: Outfit 300 at 15, its baseline at 178 px; a tap names it (faint "Your name" until then)
- Box(Modifier.fillMaxWidth().baselineAt(null, m(178, k)), contentAlignment = Alignment.Center) {
- Text(
- name.ifBlank { stringResource(R.string.settings_your_name) }.uppercase(),
- style = outfit(300, s(15f, k), 0.01f).copy(color = Color.White.copy(alpha = if (name.isBlank()) 0.55f else 1f), textAlign = TextAlign.Center),
- modifier = Modifier.pressable({ naming = true }, pressedScale = 0.94f).padding(horizontal = 12.dp, vertical = 4.dp),
- )
- }
- // the greeting: Outfit 500 at 73, baselines 264 and 354 px, white at 62 %, fading into blur
- FadeIntoBlur(0.55f, m(2.6f, k), Modifier.fillMaxWidth().baselineAt(null, m(264, k)).graphicsLayer { alpha = 0.62f }) {
- Text(
- greeting, style = outfit(500, s(73f, k), 0f, (90 * k).sp).copy(color = Color.White, textAlign = TextAlign.Center),
- modifier = Modifier.fillMaxWidth().padding(horizontal = m(20, k)),
- )
- }
- // the day's thought: a 205 × 200 px frosted card centred at (152, 440), turned 6° left
- Box(
- Modifier.offset(m(152 - 102.5f, k), m(440 - 100, k)).size(m(205, k), m(200, k))
- .graphicsLayer { rotationZ = -6f }
- .clip(RoundedRectangle(m(22, k))).background(Color(0xFFFFF6F6).copy(alpha = 0.86f))
- .pressable({ vm.openDeskPage(DeskPage.Thoughts) }, pressedScale = 0.96f),
- ) {
- Text(stringResource(R.string.thought_title), style = outfit(500, s(13.4f, k), -0.01f).copy(color = Color(0xFF3B6593)), modifier = Modifier.baselineAt(m(17, k), m(42, k)))
- Text(shortDate(System.currentTimeMillis()), style = outfit(400, s(10f, k)).copy(color = Color(0xFF9D9591)), modifier = Modifier.baselineAt(m(17, k), m(66, k)))
- FadeIntoBlur(0.48f, m(3.5f, k), Modifier.padding(start = m(17, k), end = m(14, k)).baselineAt(null, m(112, k))) {
- Text(
- (thought.quote + " " + thought.reflection).replace("**", ""), style = outfit(400, s(11.1f, k), 0f, (16 * k).sp).copy(color = Color(0xFF1E1515)),
- maxLines = 5, overflow = TextOverflow.Clip,
- )
- }
- }
- // the latest picture: 222 × 272 px centred at (343, 605), turned 2° right, over the thought
- val pic = pictures.firstOrNull()
- val scan = if (pic == null) scanRows(vm.recentRows()).firstOrNull() else null
- Box(
- Modifier.offset(m(343 - 111, k), m(605 - 136, k)).size(m(222, k), m(272, k))
- .graphicsLayer { rotationZ = 2f; shadowElevation = 4.dp.toPx(); shape = RoundedRectangle(m(28, k)); clip = true }
- .background(Color(0xFF9CCDE4))
- // the picture's own note, or the scan itself; with neither, the desk's pictures
- .pressable({
+ if (clear.clean) {
+ val picture = pictures.firstOrNull()
+ val scan = if (picture == null) scanRows(vm.recentRows()).firstOrNull() else null
+ Column(
+ Modifier.fillMaxWidth().statusBarsPadding().padding(start = 16.dp, end = 16.dp, top = 80.dp, bottom = 96.dp),
+ verticalArrangement = Arrangement.spacedBy(12.dp),
+ ) {
+ Text(name.ifBlank { stringResource(R.string.settings_your_name) },
+ modifier = Modifier.pressable({ naming = true }).padding(vertical = 8.dp),
+ style = ClearType.Label, color = clear.inkSoft)
+ Text(greeting, style = ClearType.Display, color = clear.ink)
+ Column(Modifier.fillMaxWidth().clip(RoundedRectangle(16.dp)).background(clear.solidPanel)
+ .pressable({ vm.openDeskPage(DeskPage.Thoughts) }).padding(16.dp)) {
+ Text(stringResource(R.string.thought_title), style = ClearType.Title, color = clear.ink)
+ Text((thought.quote + " " + thought.reflection).replace("**", ""), style = ClearType.Body, color = clear.inkSoft)
+ }
+ com.chethan616.clearpdf.ui.glass.GlassRow(stringResource(R.string.desk_highlights), {
when {
- pic != null -> vm.openNote = pic.note.id
+ picture != null -> vm.openNote = picture.note.id
scan != null -> scan.open()
else -> { vm.deskPages.clear(); vm.deskShelf = DeskFilter.Images }
}
- }, pressedScale = 0.96f),
- ) {
- if (pic != null) NoteImage(pic.name, Modifier.matchParentSize(), maxPx = 900)
- else if (scan != null) PageFill(vm, scan.thumbPath)
- else Icon(LucideIcons.Images, null, tint = Color.White.copy(alpha = 0.7f), modifier = Modifier.align(Alignment.Center).size(m(56, k)))
- // a scanned page is white: a soft shade under the label so it still reads
- if (pic == null && scan != null) Box(Modifier.fillMaxWidth().height(m(90, k)).background(Brush.verticalGradient(listOf(Color.Black.copy(alpha = 0.32f), Color.Transparent))))
- Text(stringResource(R.string.desk_highlights), style = outfit(500, s(13.4f, k), -0.01f).copy(color = Color.White), modifier = Modifier.baselineAt(m(25, k), m(37, k)))
- Text(shortDate(pic?.note?.updated ?: scan?.date ?: System.currentTimeMillis()), style = outfit(500, s(10.6f, k)).copy(color = Color.White), modifier = Modifier.baselineAt(m(25, k), m(61, k)))
- }
- // the date: frosted glass, 220 × 202 px at (55, 700), 30 px corners
- val now = Date()
- Box(
- Modifier.offset(m(55, k), m(700, k)).size(m(220, k), m(202, k))
- .graphicsLayer { shadowElevation = 3.dp.toPx(); shape = RoundedRectangle(m(30, k)); clip = true; ambientShadowColor = Color(0x22000000); spotShadowColor = Color(0x22000000) }
- .background(Color(0xFFF4F8FF).copy(alpha = 0.78f))
- // the day's to-dos: their lists on the desk (or the desk itself, all done)
- .pressable({ vm.deskPages.clear(); if (todos.isNotEmpty()) vm.deskShelf = DeskFilter.Todo }, pressedScale = 0.96f),
- ) {
- Text(java.text.SimpleDateFormat("EEEE", java.util.Locale.getDefault()).format(now), style = outfit(700, s(37.6f, k), -0.035f).copy(color = Color.Black), maxLines = 1, modifier = Modifier.baselineAt(m(22, k), m(52, k)))
- Text(
- java.text.SimpleDateFormat(android.text.format.DateFormat.getBestDateTimePattern(java.util.Locale.getDefault(), "MMMd"), java.util.Locale.getDefault()).format(now),
- style = outfit(300, s(32f, k)).copy(color = Color(0xFF737D87)), maxLines = 1, modifier = Modifier.baselineAt(m(22, k), m(96, k)),
- )
- // the overview: how many to-dos are left, and the next one
- Text(
- if (todos.isEmpty()) stringResource(R.string.today_all_done)
- else androidx.compose.ui.res.pluralStringResource(R.plurals.today_todos_left, todos.size, todos.size),
- style = outfit(500, s(13.4f, k), -0.01f).copy(color = Color(0xFF3B6593)), maxLines = 1, overflow = TextOverflow.Ellipsis,
- modifier = Modifier.padding(end = m(16, k)).baselineAt(m(22, k), m(133, k)),
- )
- todos.firstOrNull()?.let { next ->
+ }, modifier = Modifier.background(clear.solidPanel, RoundedRectangle(16.dp)), icon = LucideIcons.Images)
+ Column(Modifier.fillMaxWidth().clip(RoundedRectangle(16.dp)).background(clear.solidPanel)
+ .pressable({ vm.deskPages.clear(); if (todos.isNotEmpty()) vm.deskShelf = DeskFilter.Todo }).padding(16.dp)) {
+ Text(shortDate(System.currentTimeMillis()), style = ClearType.Title, color = clear.ink)
+ Text(if (todos.isEmpty()) stringResource(R.string.today_all_done) else
+ androidx.compose.ui.res.pluralStringResource(R.plurals.today_todos_left, todos.size, todos.size),
+ style = ClearType.Body, color = clear.inkSoft)
+ todos.firstOrNull()?.let { Text(it.text, style = ClearType.Body, color = clear.ink) }
+ }
+ }
+ } else {
+ // the name: Outfit 300 at 15, its baseline at 178 px; a tap names it (faint "Your name" until then)
+ Box(Modifier.fillMaxWidth().baselineAt(null, m(178, k)), contentAlignment = Alignment.Center) {
+ Text(
+ name.ifBlank { stringResource(R.string.settings_your_name) }.uppercase(),
+ style = outfit(300, s(15f, k), 0.01f).copy(color = Color.White.copy(alpha = if (name.isBlank()) 0.55f else 1f), textAlign = TextAlign.Center),
+ modifier = Modifier.pressable({ naming = true }, pressedScale = 0.94f).padding(horizontal = 12.dp, vertical = 4.dp),
+ )
+ }
+ // the greeting: Outfit 500 at 73, baselines 264 and 354 px, white at 62 %, fading into blur
+ FadeIntoBlur(0.55f, m(2.6f, k), Modifier.fillMaxWidth().baselineAt(null, m(264, k)).graphicsLayer { alpha = 0.62f }) {
Text(
- next.text, style = outfit(400, s(11.1f, k)).copy(color = Color(0xFF1E1515)), maxLines = 1, overflow = TextOverflow.Ellipsis,
- modifier = Modifier.padding(end = m(16, k)).baselineAt(m(22, k), m(153, k)),
+ greeting, style = outfit(500, s(73f, k), 0f, (90 * k).sp).copy(color = Color.White, textAlign = TextAlign.Center),
+ modifier = Modifier.fillMaxWidth().padding(horizontal = m(20, k)),
)
}
- Text(stringResource(R.string.today_overview), style = outfit(400, s(11.1f, k)).copy(color = Color(0xFF84909C)), modifier = Modifier.baselineAt(m(22, k), m(177, k)))
+ // the day's thought: a 205 × 200 px frosted card centred at (152, 440), turned 6° left
+ Box(
+ Modifier.offset(m(152 - 102.5f, k), m(440 - 100, k)).size(m(205, k), m(200, k))
+ .graphicsLayer { rotationZ = -6f }
+ .clip(RoundedRectangle(m(22, k))).background(Color(0xFFFFF6F6).copy(alpha = 0.86f))
+ .pressable({ vm.openDeskPage(DeskPage.Thoughts) }, pressedScale = 0.96f),
+ ) {
+ Text(stringResource(R.string.thought_title), style = outfit(500, s(13.4f, k), -0.01f).copy(color = Color(0xFF3B6593)), modifier = Modifier.baselineAt(m(17, k), m(42, k)))
+ Text(shortDate(System.currentTimeMillis()), style = outfit(400, s(10f, k)).copy(color = Color(0xFF9D9591)), modifier = Modifier.baselineAt(m(17, k), m(66, k)))
+ FadeIntoBlur(0.48f, m(3.5f, k), Modifier.padding(start = m(17, k), end = m(14, k)).baselineAt(null, m(112, k))) {
+ Text(
+ (thought.quote + " " + thought.reflection).replace("**", ""), style = outfit(400, s(11.1f, k), 0f, (16 * k).sp).copy(color = Color(0xFF1E1515)),
+ maxLines = 5, overflow = TextOverflow.Clip,
+ )
+ }
+ }
+ // the latest picture: 222 × 272 px centred at (343, 605), turned 2° right, over the thought
+ val pic = pictures.firstOrNull()
+ val scan = if (pic == null) scanRows(vm.recentRows()).firstOrNull() else null
+ Box(
+ Modifier.offset(m(343 - 111, k), m(605 - 136, k)).size(m(222, k), m(272, k))
+ .graphicsLayer { rotationZ = 2f; shadowElevation = 4.dp.toPx(); shape = RoundedRectangle(m(28, k)); clip = true }
+ .background(Color(0xFF9CCDE4))
+ // the picture's own note, or the scan itself; with neither, the desk's pictures
+ .pressable({
+ when {
+ pic != null -> vm.openNote = pic.note.id
+ scan != null -> scan.open()
+ else -> { vm.deskPages.clear(); vm.deskShelf = DeskFilter.Images }
+ }
+ }, pressedScale = 0.96f),
+ ) {
+ if (pic != null) NoteImage(pic.name, Modifier.matchParentSize(), maxPx = 900)
+ else if (scan != null) PageFill(vm, scan.thumbPath)
+ else Icon(LucideIcons.Images, null, tint = Color.White.copy(alpha = 0.7f), modifier = Modifier.align(Alignment.Center).size(m(56, k)))
+ // a scanned page is white: a soft shade under the label so it still reads
+ if (pic == null && scan != null) Box(Modifier.fillMaxWidth().height(m(90, k)).background(Brush.verticalGradient(listOf(Color.Black.copy(alpha = 0.32f), Color.Transparent))))
+ Text(stringResource(R.string.desk_highlights), style = outfit(500, s(13.4f, k), -0.01f).copy(color = Color.White), modifier = Modifier.baselineAt(m(25, k), m(37, k)))
+ Text(shortDate(pic?.note?.updated ?: scan?.date ?: System.currentTimeMillis()), style = outfit(500, s(10.6f, k)).copy(color = Color.White), modifier = Modifier.baselineAt(m(25, k), m(61, k)))
+ }
+ // the date: frosted glass, 220 × 202 px at (55, 700), 30 px corners
+ val now = Date()
+ Box(
+ Modifier.offset(m(55, k), m(700, k)).size(m(220, k), m(202, k))
+ .graphicsLayer { shadowElevation = 3.dp.toPx(); shape = RoundedRectangle(m(30, k)); clip = true; ambientShadowColor = Color(0x22000000); spotShadowColor = Color(0x22000000) }
+ .background(Color(0xFFF4F8FF).copy(alpha = 0.78f))
+ // the day's to-dos: their lists on the desk (or the desk itself, all done)
+ .pressable({ vm.deskPages.clear(); if (todos.isNotEmpty()) vm.deskShelf = DeskFilter.Todo }, pressedScale = 0.96f),
+ ) {
+ Text(java.text.SimpleDateFormat("EEEE", java.util.Locale.getDefault()).format(now), style = outfit(700, s(37.6f, k), -0.035f).copy(color = Color.Black), maxLines = 1, modifier = Modifier.baselineAt(m(22, k), m(52, k)))
+ Text(
+ java.text.SimpleDateFormat(android.text.format.DateFormat.getBestDateTimePattern(java.util.Locale.getDefault(), "MMMd"), java.util.Locale.getDefault()).format(now),
+ style = outfit(300, s(32f, k)).copy(color = Color(0xFF737D87)), maxLines = 1, modifier = Modifier.baselineAt(m(22, k), m(96, k)),
+ )
+ // the overview: how many to-dos are left, and the next one
+ Text(
+ if (todos.isEmpty()) stringResource(R.string.today_all_done)
+ else androidx.compose.ui.res.pluralStringResource(R.plurals.today_todos_left, todos.size, todos.size),
+ style = outfit(500, s(13.4f, k), -0.01f).copy(color = Color(0xFF3B6593)), maxLines = 1, overflow = TextOverflow.Ellipsis,
+ modifier = Modifier.padding(end = m(16, k)).baselineAt(m(22, k), m(133, k)),
+ )
+ todos.firstOrNull()?.let { next ->
+ Text(
+ next.text, style = outfit(400, s(11.1f, k)).copy(color = Color(0xFF1E1515)), maxLines = 1, overflow = TextOverflow.Ellipsis,
+ modifier = Modifier.padding(end = m(16, k)).baselineAt(m(22, k), m(153, k)),
+ )
+ }
+ Text(stringResource(R.string.today_overview), style = outfit(400, s(11.1f, k)).copy(color = Color(0xFF84909C)), modifier = Modifier.baselineAt(m(22, k), m(177, k)))
+ }
}
}
}
diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/home/HomeScreen.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/home/HomeScreen.kt
index 2cfe3ad..98c6ed8 100644
--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/home/HomeScreen.kt
+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/home/HomeScreen.kt
@@ -371,6 +371,10 @@ private fun DeskTitle(filter: DeskFilter) {
val c = clear
val measurer = rememberTextMeasurer()
val density = LocalDensity.current
+ if (c.clean) {
+ Text(stringResource(filter.title), style = ClearType.Display, color = c.ink, modifier = Modifier.padding(start = 6.dp, top = 20.dp))
+ return
+ }
val titles = DeskFilter.entries.map { it to stringResource(it.title) }
BoxWithConstraints(Modifier.fillMaxWidth().padding(start = 6.dp, top = 20.dp)) {
val widthPx = constraints.maxWidth
@@ -461,12 +465,12 @@ fun DeskChip(label: String, chosen: Boolean, onClick: () -> Unit) {
com.chethan616.clearpdf.ui.glass.GlassChip(
onClick = onClick,
height = 46.dp,
- fill = { Candy.Chip.copy(alpha = 0.94f * lit) },
+ fill = { if (c.clean) Candy.Sky.copy(alpha = 0.16f * lit) else Candy.Chip.copy(alpha = 0.94f * lit) },
contentPadding = PaddingValues(horizontal = 22.dp),
tap = com.chethan616.clearpdf.ui.glass.Feel.Tick,
- ink = if (chosen) Color(0xFF1C2433) else c.ink,
+ ink = if (chosen && !c.clean) Color(0xFF1C2433) else c.ink,
) {
- Text(label, style = ClearType.Body.copy(fontSize = 16.sp), color = if (chosen) Color(0xFF1C2433) else c.ink)
+ Text(label, style = ClearType.Body.copy(fontSize = 16.sp), color = if (chosen && !c.clean) Color(0xFF1C2433) else c.ink)
}
}
diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/onboarding/Onboarding.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/onboarding/Onboarding.kt
index 30e95a6..04128c2 100644
--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/onboarding/Onboarding.kt
+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/onboarding/Onboarding.kt
@@ -240,7 +240,7 @@ private fun Title(eyebrow: String, title: String, accent: String, body: String,
buildAnnotatedString {
append(title)
append(" ")
- withStyle(SpanStyle(brush = Brush.linearGradient(listOf(Color.White, Color(0xFFFFD6EE), Color(0xFFD7E4FF))))) { append(accent) }
+ withStyle(if (c.clean) SpanStyle(color = c.tone(Tone.Paper).accent) else SpanStyle(brush = Brush.linearGradient(listOf(Color.White, Color(0xFFFFD6EE), Color(0xFFD7E4FF))))) { append(accent) }
},
style = ClearType.Hero.copy(fontSize = 44.sp, lineHeight = 46.sp, color = c.hero).glowing(c),
)
@@ -446,6 +446,7 @@ private fun PdfTools(sway: () -> Float) {
@Composable
private fun Modifier.frost(shape: androidx.compose.ui.graphics.Shape): Modifier {
val c = clear
+ if (c.clean) return clip(shape).background(c.solidPanel)
return clip(shape)
.background(if (c.dark) Color.White.copy(alpha = 0.10f) else Color.White.copy(alpha = 0.55f))
.border(1.dp, Brush.verticalGradient(listOf(Color.White.copy(alpha = if (c.dark) 0.25f else 0.85f), Color.White.copy(alpha = 0.1f))), shape)
diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/theme/ClearTheme.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/theme/ClearTheme.kt
index 0f8d346..eb19daf 100644
--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/theme/ClearTheme.kt
+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/theme/ClearTheme.kt
@@ -1,9 +1,12 @@
package com.chethan616.clearpdf.ui.theme
+import android.content.Context
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.Immutable
+import androidx.compose.runtime.remember
+import androidx.compose.ui.platform.LocalContext
import androidx.compose.runtime.staticCompositionLocalOf
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.graphics.Color
@@ -75,6 +78,7 @@ data class ClearColors(
/** The dark glass of the floating create capsule. */
val capsule: Color,
val tones: Map<Tone, CardTone>,
+ val clean: Boolean = false,
) {
/** The canvas colour (the wallpaper's middle), for places that need one flat colour. */
val canvas: Color get() = wall[wall.size / 2]
@@ -291,12 +295,35 @@ object ClearType {
/** A hero title's soft glow, so white type reads on the pale sky. */
fun TextStyle.glowing(c: ClearColors): TextStyle = copy(shadow = Shadow(c.heroGlow, Offset(0f, 2f), 22f))
+/** Also reads the Files-only choice from earlier builds. */
+fun savedCleanAppearance(context: Context): Boolean {
+ val prefs = context.getSharedPreferences("app", Context.MODE_PRIVATE)
+ return prefs.getBoolean("cleanAppearance", prefs.getBoolean("cleanFiles", false))
+}
+
@Composable
-fun ClearTheme(choice: ThemeChoice, content: @Composable () -> Unit) {
+fun ClearTheme(
+ choice: ThemeChoice,
+ cleanAppearance: Boolean = savedCleanAppearance(LocalContext.current),
+ content: @Composable () -> Unit,
+) {
val dark = when (choice) {
ThemeChoice.System -> isSystemInDarkTheme()
ThemeChoice.Light -> false
ThemeChoice.Dark -> true
}
- CompositionLocalProvider(LocalClearColors provides if (dark) DarkClear else LightClear, content = content)
+ val base = if (dark) DarkClear else LightClear
+ val colors = remember(base, cleanAppearance) {
+ if (cleanAppearance) {
+ val paper = if (dark) Color(0xFF20242A) else Color.White
+ val canvas = if (dark) Color(0xFF111418) else Color(0xFFF2F4F7)
+ val neutral = CardTone(paper, paper, base.ink, base.tone(Tone.Paper).accent)
+ base.copy(
+ clean = true, hero = base.ink, heroGlow = Color.Transparent,
+ desk = canvas, wall = listOf(canvas, canvas), glass = paper, frost = paper,
+ tones = Tone.entries.associateWith { neutral },
+ )
+ } else base
+ }
+ CompositionLocalProvider(LocalClearColors provides colors, content = content)
}
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 fcee4dc..20f6dfa 100644
--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ViewerBars.kt
+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ViewerBars.kt
@@ -71,6 +71,7 @@ import com.chethan616.clearpdf.ui.glass.GlassMenu
import com.chethan616.clearpdf.ui.glass.GlassMenuItem
import com.chethan616.clearpdf.ui.glass.GlassMotion
import com.chethan616.clearpdf.ui.glass.GlassPill
+import com.chethan616.clearpdf.ui.glass.RoundedRectangle
import com.chethan616.clearpdf.ui.glass.LocalGlassInk
import com.chethan616.clearpdf.ui.glass.glass
import com.chethan616.clearpdf.ui.glass.glassBar
@@ -353,7 +354,9 @@ fun QuickToolbar(
moreTools: List<QuickTool> = emptyList(),
onCustomize: ((Rect) -> Unit)? = null,
) {
- val slots = dockSlots(LocalConfiguration.current.screenWidthDp)
+ 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)
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.
@@ -369,7 +372,26 @@ fun QuickToolbar(
lit = null
}
}
- Row(
+ if (clear.clean) {
+ Row(
+ Modifier.fillMaxWidth().height(BottomBarHeight).padding(horizontal = 12.dp, vertical = 4.dp)
+ .glassBar(RoundedRectangle(16.dp)).padding(4.dp),
+ verticalAlignment = Alignment.CenterVertically,
+ ) {
+ for (tool in shown) {
+ LabeledDockItem(tool.icon, stringResource(tool.label), Modifier.weight(1f), lit == tool) {
+ lit = tool
+ onTool(tool)
+ }
+ }
+ if (overflow.isNotEmpty() || onCustomize != null) {
+ LabeledDockItem(
+ LucideIcons.LayoutGrid, stringResource(R.string.common_tool_more_tools),
+ Modifier.weight(1f).onGloballyPositioned { moreRect = it.boundsInWindow() }, menuAt != null,
+ ) { menuAt = moreRect }
+ }
+ }
+ } else Row(
Modifier.fillMaxWidth().height(BottomBarHeight).padding(horizontal = 12.dp, vertical = 8.dp),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(10.dp),
@@ -407,6 +429,22 @@ fun QuickToolbar(
}
}
+@Composable
+private fun LabeledDockItem(icon: ImageVector, label: String, modifier: Modifier, lit: Boolean, onClick: () -> Unit) {
+ val c = clear
+ Column(
+ modifier.fillMaxHeight().clip(RoundedRectangle(12.dp))
+ .background(if (lit) Candy.Sky.copy(alpha = 0.16f) else Color.Transparent)
+ .pressable(onClick).padding(horizontal = 2.dp),
+ 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)
+ }
+}
+
private fun Modifier.androidxRotate(degrees: Float) = this.graphicsLayer { rotationZ = degrees }
/** A tool of the dock: its glyph in the bar's ink; [lit], white on a blue disc. */
diff --git a/android/app/src/main/res/values-ar/strings.xml b/android/app/src/main/res/values-ar/strings.xml
index 2c9658d..587b539 100644
--- a/android/app/src/main/res/values-ar/strings.xml
+++ b/android/app/src/main/res/values-ar/strings.xml
@@ -1282,9 +1282,9 @@
<string name="settings_your_name">اسمك</string>
<string name="settings_your_name_hint">يظهر فوق تحية اليوم</string>
<string name="thoughts_audios">صوتيات</string>
- <string name="settings_files_appearance">مظهر الملفات</string>
- <string name="files_style_glass">الزجاج السائل</string>
- <string name="files_style_clean">بسيط</string>
- <string name="files_style_glass_detail">الافتراضي · أسطح شبه شفافة</string>
- <string name="files_style_clean_detail">أسطح معتمة</string>
+ <string name="settings_app_appearance">مظهر التطبيق</string>
+ <string name="app_style_glass">الزجاج السائل</string>
+ <string name="app_style_clean">بسيط</string>
+ <string name="app_style_glass_detail">الافتراضي · أسطح شبه شفافة</string>
+ <string name="app_style_clean_detail">أسطح معتمة</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 ec09a71..67d3e4a 100644
--- a/android/app/src/main/res/values-de/strings.xml
+++ b/android/app/src/main/res/values-de/strings.xml
@@ -1624,9 +1624,9 @@
<string name="settings_your_name">Dein Name</string>
<string name="settings_your_name_hint">Steht über dem Gruß in Heute</string>
<string name="thoughts_audios">Audios</string>
- <string name="settings_files_appearance">Dateiansicht</string>
- <string name="files_style_glass">Flüssiges Glas</string>
- <string name="files_style_clean">Schlicht</string>
- <string name="files_style_glass_detail">Standard · Durchscheinende Flächen</string>
- <string name="files_style_clean_detail">Deckende Flächen</string>
+ <string name="settings_app_appearance">App-Darstellung</string>
+ <string name="app_style_glass">Flüssiges Glas</string>
+ <string name="app_style_clean">Schlicht</string>
+ <string name="app_style_glass_detail">Standard · Durchscheinende Flächen</string>
+ <string name="app_style_clean_detail">Deckende Flächen</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 46add11..7d401ad 100644
--- a/android/app/src/main/res/values-es/strings.xml
+++ b/android/app/src/main/res/values-es/strings.xml
@@ -1633,9 +1633,9 @@
<string name="settings_your_name">Tu nombre</string>
<string name="settings_your_name_hint">Se muestra sobre el saludo de Hoy</string>
<string name="thoughts_audios">Audios</string>
- <string name="settings_files_appearance">Aspecto de Archivos</string>
- <string name="files_style_glass">Cristal líquido</string>
- <string name="files_style_clean">Sencillo</string>
- <string name="files_style_glass_detail">Predeterminado · Superficies translúcidas</string>
- <string name="files_style_clean_detail">Superficies opacas</string>
+ <string name="settings_app_appearance">Aspecto de la aplicación</string>
+ <string name="app_style_glass">Cristal líquido</string>
+ <string name="app_style_clean">Sencillo</string>
+ <string name="app_style_glass_detail">Predeterminado · Superficies translúcidas</string>
+ <string name="app_style_clean_detail">Superficies opacas</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 8a6d958..4a3acf5 100644
--- a/android/app/src/main/res/values-fr/strings.xml
+++ b/android/app/src/main/res/values-fr/strings.xml
@@ -1505,9 +1505,9 @@
<string name="settings_your_name">Votre nom</string>
<string name="settings_your_name_hint">Affiché au-dessus du message d’Aujourd’hui</string>
<string name="thoughts_audios">Audios</string>
- <string name="settings_files_appearance">Apparence des fichiers</string>
- <string name="files_style_glass">Verre liquide</string>
- <string name="files_style_clean">Épuré</string>
- <string name="files_style_glass_detail">Par défaut · Surfaces translucides</string>
- <string name="files_style_clean_detail">Surfaces opaques</string>
+ <string name="settings_app_appearance">Apparence de l’application</string>
+ <string name="app_style_glass">Verre liquide</string>
+ <string name="app_style_clean">Épuré</string>
+ <string name="app_style_glass_detail">Par défaut · Surfaces translucides</string>
+ <string name="app_style_clean_detail">Surfaces opaques</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 72a3e45..ed6eb87 100644
--- a/android/app/src/main/res/values-it/strings.xml
+++ b/android/app/src/main/res/values-it/strings.xml
@@ -1615,9 +1615,9 @@
<string name="settings_your_name">Il tuo nome</string>
<string name="settings_your_name_hint">Mostrato sopra il saluto di Oggi</string>
<string name="thoughts_audios">Audio</string>
- <string name="settings_files_appearance">Aspetto dei file</string>
- <string name="files_style_glass">Vetro liquido</string>
- <string name="files_style_clean">Essenziale</string>
- <string name="files_style_glass_detail">Predefinito · Superfici traslucide</string>
- <string name="files_style_clean_detail">Superfici opache</string>
+ <string name="settings_app_appearance">Aspetto dell’app</string>
+ <string name="app_style_glass">Vetro liquido</string>
+ <string name="app_style_clean">Essenziale</string>
+ <string name="app_style_glass_detail">Predefinito · Superfici traslucide</string>
+ <string name="app_style_clean_detail">Superfici opache</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 16f8bd4..b226a0a 100644
--- a/android/app/src/main/res/values-pt-rBR/strings.xml
+++ b/android/app/src/main/res/values-pt-rBR/strings.xml
@@ -1210,9 +1210,9 @@
<string name="settings_your_name">Seu nome</string>
<string name="settings_your_name_hint">Mostrado acima da saudação de Hoje</string>
<string name="thoughts_audios">Áudios</string>
- <string name="settings_files_appearance">Aparência dos arquivos</string>
- <string name="files_style_glass">Vidro líquido</string>
- <string name="files_style_clean">Simples</string>
- <string name="files_style_glass_detail">Padrão · Superfícies translúcidas</string>
- <string name="files_style_clean_detail">Superfícies opacas</string>
+ <string name="settings_app_appearance">Aparência do aplicativo</string>
+ <string name="app_style_glass">Vidro líquido</string>
+ <string name="app_style_clean">Simples</string>
+ <string name="app_style_glass_detail">Padrão · Superfícies translúcidas</string>
+ <string name="app_style_clean_detail">Superfícies opacas</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 87440ba..c50e750 100644
--- a/android/app/src/main/res/values-pt/strings.xml
+++ b/android/app/src/main/res/values-pt/strings.xml
@@ -1210,9 +1210,9 @@
<string name="settings_your_name">O seu nome</string>
<string name="settings_your_name_hint">Mostrado acima da saudação de Hoje</string>
<string name="thoughts_audios">Áudios</string>
- <string name="settings_files_appearance">Aspeto dos ficheiros</string>
- <string name="files_style_glass">Vidro líquido</string>
- <string name="files_style_clean">Simples</string>
- <string name="files_style_glass_detail">Predefinido · Superfícies translúcidas</string>
- <string name="files_style_clean_detail">Superfícies opacas</string>
+ <string name="settings_app_appearance">Aspeto da aplicação</string>
+ <string name="app_style_glass">Vidro líquido</string>
+ <string name="app_style_clean">Simples</string>
+ <string name="app_style_glass_detail">Predefinido · Superfícies translúcidas</string>
+ <string name="app_style_clean_detail">Superfícies opacas</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 6e181e4..922970c 100644
--- a/android/app/src/main/res/values-ru/strings.xml
+++ b/android/app/src/main/res/values-ru/strings.xml
@@ -1243,9 +1243,9 @@
<string name="settings_your_name">Ваше имя</string>
<string name="settings_your_name_hint">Показывается над приветствием «Сегодня»</string>
<string name="thoughts_audios">Аудио</string>
- <string name="settings_files_appearance">Оформление файлов</string>
- <string name="files_style_glass">Жидкое стекло</string>
- <string name="files_style_clean">Простой</string>
- <string name="files_style_glass_detail">По умолчанию · Полупрозрачные панели</string>
- <string name="files_style_clean_detail">Непрозрачные панели</string>
+ <string name="settings_app_appearance">Оформление приложения</string>
+ <string name="app_style_glass">Жидкое стекло</string>
+ <string name="app_style_clean">Простой</string>
+ <string name="app_style_glass_detail">По умолчанию · Полупрозрачные панели</string>
+ <string name="app_style_clean_detail">Непрозрачные панели</string>
</resources>
diff --git a/android/app/src/main/res/values/strings.xml b/android/app/src/main/res/values/strings.xml
index 323da10..5dc0ae1 100644
--- a/android/app/src/main/res/values/strings.xml
+++ b/android/app/src/main/res/values/strings.xml
@@ -1683,9 +1683,9 @@
<string name="settings_your_name">Your name</string>
<string name="settings_your_name_hint">Shown above Today\'s greeting</string>
<string name="thoughts_audios">Audios</string>
- <string name="settings_files_appearance">Files appearance</string>
- <string name="files_style_glass">Liquid Glass</string>
- <string name="files_style_clean">Clean</string>
- <string name="files_style_glass_detail">Default · Translucent surfaces</string>
- <string name="files_style_clean_detail">Solid surfaces</string>
+ <string name="settings_app_appearance">App appearance</string>
+ <string name="app_style_glass">Liquid Glass</string>
+ <string name="app_style_clean">Clean</string>
+ <string name="app_style_glass_detail">Default · Translucent surfaces</string>
+ <string name="app_style_clean_detail">Solid surfaces</string>
</resources>