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.

xlsx: fix oversized share button; main nav bar: restore v4 release's icon-only tabs

Chethan616174356d51c7f
diff --git a/app/src/main/java/com/chethan616/clearpdf/ui/components/DocsBottomTabs.kt b/app/src/main/java/com/chethan616/clearpdf/ui/components/DocsBottomTabs.kt
index ee8e17c..e82f602 100644
--- a/app/src/main/java/com/chethan616/clearpdf/ui/components/DocsBottomTabs.kt
+++ b/app/src/main/java/com/chethan616/clearpdf/ui/components/DocsBottomTabs.kt
@@ -1,7 +1,6 @@
package com.chethan616.clearpdf.ui.components
import androidx.compose.foundation.layout.size
-import androidx.compose.foundation.text.BasicText
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.rounded.Home
import androidx.compose.material.icons.rounded.GridView
@@ -11,20 +10,12 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
-import androidx.compose.ui.text.TextStyle
-import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
-import androidx.compose.ui.unit.sp
import com.chethan616.clearpdf.ui.theme.LiquidGlassColors
import com.chethan616.clearpdf.ui.theme.LocalIsDarkMode
import com.chethan616.clearpdf.R
import com.kyant.backdrop.Backdrop
-/**
- * Icon + label, the same richness the xlsx sheet-tab dock has (a name, not just a glyph) instead of
- * three bare icons — the tab a visitor is actually ON used to be legible only by which capsule the
- * slider sat under, not by anything the tab itself said.
- */
@Composable
fun DocsBottomTabs(
selectedTab: () -> Int,
@@ -33,14 +24,7 @@ fun DocsBottomTabs(
modifier: Modifier = Modifier
) {
val isDarkMode = LocalIsDarkMode.current
- val sub = LiquidGlassColors.secondary(isDarkMode)
- val accent = LiquidGlassColors.Blue
-
- // The selected pill is a light sheen + a whisper of accent (see LiquidBottomTabs'
- // onDrawSurface) in BOTH themes, not a solid fill, so its ink is the accent colour itself —
- // the same convention the xlsx sheet tabs use for their own selected label.
- @Composable
- fun tabColor(index: Int): Color = if (selectedTab() == index) accent else sub
+ val tint = LiquidGlassColors.secondary(isDarkMode)
LiquidBottomTabs(
selectedTabIndex = selectedTab,
@@ -49,28 +33,19 @@ fun DocsBottomTabs(
tabsCount = 3,
modifier = modifier
) {
- val tabs = listOf(
- Triple(Icons.Rounded.Home, R.string.nav_home, 0),
- Triple(Icons.Rounded.GridView, R.string.nav_tools, 1),
- Triple(Icons.Rounded.Tune, R.string.nav_settings, 2)
- )
- tabs.forEach { (icon, labelRes, index) ->
- val label = stringResource(labelRes)
- LiquidBottomTab(onClick = { onTabSelected(index) }) {
- // Ink stays close to the selected pill's own light-sheen + accent-wash surface
- // (see LiquidBottomTabs' onDrawSurface), so it reads against either theme without
- // needing a per-tab recomposition when the selection moves.
- Icon(icon, contentDescription = null, tint = tabColor(index), modifier = Modifier.size(20.dp))
- BasicText(
- label,
- style = TextStyle(
- tabColor(index),
- 10.sp,
- if (selectedTab() == index) FontWeight.SemiBold else FontWeight.Medium
- ),
- maxLines = 1
- )
- }
+ LiquidBottomTab(onClick = { onTabSelected(0) }) {
+ Icon(Icons.Rounded.Home, contentDescription = stringResource(R.string.nav_home), tint = tint,
+ modifier = Modifier.size(22.dp))
+ }
+
+ LiquidBottomTab(onClick = { onTabSelected(1) }) {
+ Icon(Icons.Rounded.GridView, contentDescription = stringResource(R.string.nav_tools), tint = tint,
+ modifier = Modifier.size(22.dp))
+ }
+
+ LiquidBottomTab(onClick = { onTabSelected(2) }) {
+ Icon(Icons.Rounded.Tune, contentDescription = stringResource(R.string.nav_settings), tint = tint,
+ modifier = Modifier.size(22.dp))
}
}
}
diff --git a/app/src/main/java/com/chethan616/clearpdf/ui/screen/SpreadsheetViewerScreen.kt b/app/src/main/java/com/chethan616/clearpdf/ui/screen/SpreadsheetViewerScreen.kt
index 2a25270..fb311d5 100644
--- a/app/src/main/java/com/chethan616/clearpdf/ui/screen/SpreadsheetViewerScreen.kt
+++ b/app/src/main/java/com/chethan616/clearpdf/ui/screen/SpreadsheetViewerScreen.kt
@@ -679,10 +679,12 @@ fun SpreadsheetViewerScreen(
LiquidIconButton(
onClick = { viewModel.shareableUri(context) { u -> u?.let { shareFile(context, it) } } },
backdrop = screenBackdrop.glass,
- // bottom = 6.dp centers this 52dp button on the sheet dock's 44dp-tall, 10dp-bottom-
- // padded capsule (10 + 44/2 = 32dp center; a 52dp button centers there at 32 - 26 = 6dp).
- // Matching the dock's own bottom padding (10dp) left the button sitting visibly lower.
- modifier = Modifier.align(Alignment.BottomEnd).navigationBarsPadding().padding(end = 12.dp, bottom = 6.dp).size(52.dp)
+ // 44dp to match the sheet dock's own barHeight exactly, same bottom padding as the
+ // dock (10dp) so their centers align. LiquidIconButton's internal Modifier.size(40.dp)
+ // is non-required, so it's coerced UP to whatever exact size this external modifier
+ // asks for (that's also why the old 52dp here rendered at a full 52dp, not 40dp --
+ // visibly oversized next to the header's unmodified 40dp icon buttons).
+ modifier = Modifier.align(Alignment.BottomEnd).navigationBarsPadding().padding(end = 12.dp, bottom = 10.dp).size(44.dp)
) {
Icon(Icons.Rounded.IosShare, stringResource(R.string.viewer_share_document), Modifier.size(20.dp), text)
}