22164daef2c9

feat: Recompose settings shell with design primitives (v2.3.63)

time
2026-07-08 21:29 UTC · 3 months ago
machine
koh2
parent
1979844ef1df
3 files app/build.gradle+2 −2app/src/main/java/com/peachpasswords/ui/components/PeachExpandableCard.kt+2 −2app/src/main/java/com/peachpasswords/ui/settings/SettingsScreen.kt+70 −32
app/build.gradle+2 −2
@@ -16,8 +16,8 @@1616         applicationId "com.peachpasswords"1717         minSdk 261818         targetSdk 3519-        versionCode 23620020-        versionName "2.3.62"19+        versionCode 23630020+        versionName "2.3.63"2121 2222         testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"2323         vectorDrawables {

view file

app/src/main/java/com/peachpasswords/ui/components/PeachExpandableCard.kt+2 −2
@@ -9,7 +9,7 @@99 import androidx.compose.foundation.layout.Column1010 import androidx.compose.foundation.layout.ColumnScope1111 import androidx.compose.foundation.layout.fillMaxWidth12-import androidx.compose.foundation.layout.heightIn12+import androidx.compose.foundation.layout.height1313 import androidx.compose.foundation.layout.padding1414 import androidx.compose.foundation.shape.RoundedCornerShape1515 import androidx.compose.material3.Surface@@ -52,7 +52,7 @@5252     Surface(5353         modifier = modifier5454             .fillMaxWidth()55-            .heightIn(min = collapsedHeight, max = animatedHeight)55+            .height(animatedHeight)5656             .scrollable(scrollState, orientation = Orientation.Vertical),5757         color = peachColors.SurfaceElevated,5858         contentColor = peachColors.T0,

view file

app/src/main/java/com/peachpasswords/ui/settings/SettingsScreen.kt+70 −32
@@ -25,8 +25,8 @@2525 import androidx.compose.foundation.layout.padding2626 import androidx.compose.foundation.layout.size2727 import androidx.compose.foundation.layout.statusBarsPadding28-import androidx.compose.foundation.rememberScrollState2928 import androidx.compose.foundation.shape.RoundedCornerShape29+import androidx.compose.foundation.rememberScrollState3030 import androidx.compose.foundation.verticalScroll3131 import androidx.compose.runtime.Composable3232 import androidx.compose.runtime.LaunchedEffect@@ -60,8 +60,10 @@6060 import androidx.compose.ui.zIndex6161 import androidx.hilt.navigation.compose.hiltViewModel6262 import androidx.compose.material3.Text63+import com.peachpasswords.ui.components.PeachTopBar6364 import com.peachpasswords.ui.theme.LocalPeachAccent6465 import com.peachpasswords.ui.theme.LocalReduceMotion66+import com.peachpasswords.ui.theme.PeachSpacing6567 import com.peachpasswords.ui.theme.peachColors6668 import com.peachpasswords.ui.theme.PeachMotion6769 import com.peachpasswords.ui.theme.PeachTheme@@ -176,36 +178,18 @@176178     // user's chosen accent and reduce-motion preference.177179     PeachTheme(darkTheme = true, accent = accent, reduceMotion = reduceMotion) {178180     ShellBackground {179-        Column(Modifier.fillMaxSize().statusBarsPadding().padding(horizontal = 12.dp)) {180-            // Masthead: back chevron · "Settings" · card counter.181-            Row(182-                Modifier.fillMaxWidth().padding(top = 10.dp, bottom = 8.dp),183-                verticalAlignment = Alignment.CenterVertically,184-            ) {185-                Box(186-                    Modifier.size(28.dp).clip(RoundedCornerShape(999.dp))187-                        .background(Color(0x04F0E8D8))188-                        .clickable { handleBack() },189-                    contentAlignment = Alignment.Center,190-                ) {191-                    Text("‹", color = peachColors.T1, fontFamily = PeachType.Mono, fontSize = 16.sp)192-                }193-                Text(194-                    "Settings",195-                    modifier = Modifier.weight(1f).padding(start = 10.dp),196-                    color = peachColors.T0,197-                    fontFamily = PeachType.Display,198-                    fontStyle = FontStyle.Italic,199-                    fontSize = 22.sp,200-                )201-                Text(202-                    "${activeIndex + 1} / ${STACK_CARDS.size}",203-                    color = peachColors.T2,204-                    fontFamily = PeachType.Mono,205-                    fontSize = 9.sp,206-                    letterSpacing = 0.22.em,207-                )208-            }181+        Column(182+            Modifier183+                .fillMaxSize()184+                .statusBarsPadding()185+                .padding(horizontal = PeachSpacing.md),186+        ) {187+            SettingsTopBar(188+                activeIndex = activeIndex,189+                total = STACK_CARDS.size,190+                onBack = { handleBack() },191+            )192+            Spacer(Modifier.height(PeachSpacing.sm))209193 210194             BoxWithConstraints(Modifier.fillMaxSize()) {211195                 val deckHeight = settingsDeckHeight(maxHeight)@@ -410,7 +394,7 @@410394                         .verticalScroll(rememberScrollState()),411395                 ) {412396                     body()413-                    Spacer(Modifier.height(24.dp))397+                    SettingsCardEndState(spec.fg)414398                 }415399             }416400         } else {@@ -428,6 +412,60 @@428412                 )429413             }430414         }415+    }416+}417+418+@Composable419+private fun SettingsTopBar(activeIndex: Int, total: Int, onBack: () -> Unit) {420+    PeachTopBar(421+        title = "Settings",422+        leading = {423+            Box(424+                Modifier425+                    .size(40.dp)426+                    .clip(RoundedCornerShape(999.dp))427+                    .clickable(onClick = onBack),428+                contentAlignment = Alignment.Center,429+            ) {430+                Text("‹", color = peachColors.T1, fontFamily = PeachType.Mono, fontSize = 18.sp)431+            }432+        },433+        actions = {434+            Text(435+                "${activeIndex + 1} / $total",436+                color = peachColors.T2,437+                fontFamily = PeachType.Mono,438+                fontSize = 9.sp,439+                letterSpacing = 0.22.em,440+                modifier = Modifier.padding(horizontal = PeachSpacing.sm),441+            )442+        },443+    )444+}445+446+@Composable447+private fun SettingsCardEndState(fg: Color) {448+    Column(449+        Modifier450+            .fillMaxWidth()451+            .padding(top = PeachSpacing.md, bottom = PeachSpacing.lg),452+        horizontalAlignment = Alignment.CenterHorizontally,453+        verticalArrangement = Arrangement.spacedBy(PeachSpacing.xs),454+    ) {455+        Text(456+            "end of card",457+            color = fg.copy(alpha = 0.62f),458+            fontFamily = PeachType.Display,459+            fontStyle = FontStyle.Italic,460+            fontSize = 16.sp,461+        )462+        Text(463+            "Drag or tap the stack to move between settings.",464+            color = fg.copy(alpha = 0.45f),465+            fontFamily = PeachType.Mono,466+            fontSize = 8.5.sp,467+            letterSpacing = 0.08.em,468+        )431469     }432470 }433471 

view file