81c0378cca35
fix: Restore browser-style entry landing and bottom search strip (v2.2.13)
- time
- 2026-06-11 16:44 UTC · 5 months ago
- machine
- koh2
- parent
- d2259e6c0e05
↓ peach-android-81c0378c.tar.gzatlas at this save
files changed4 files
app/build.gradle+2 −2app/src/main/java/com/peachpasswords/ui/PeachAppNavHost.kt+2 −6app/src/main/java/com/peachpasswords/ui/vault/EntryDetailScreen.kt+180 −68app/src/main/java/com/peachpasswords/ui/vault/EntryDetailViewModel.kt+14 −0app/build.gradle+2 −2
@@ -16,8 +16,8 @@1616 applicationId "com.peachpasswords"1717 minSdk 261818 targetSdk 3519- versionCode 20310020- versionName "2.2.11"19+ versionCode 20330020+ versionName "2.2.13"2121 2222 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"2323 vectorDrawables {app/src/main/java/com/peachpasswords/ui/PeachAppNavHost.kt+2 −6
@@ -103,13 +103,9 @@103103 composable(PeachNav.Lock.route) {104104 LockScreen(105105 onUnlocked = { dest ->106- navController.navigate(PeachNav.VaultList.route) {106+ navController.navigate(dest.route) {107107 popUpTo(PeachNav.Lock.route) { inclusive = true }108- launchSingleTop = true109108 }110- if (dest.route != PeachNav.VaultList.route) {111- navController.navigate(dest.route)112- }113109 },114110 onNavigate = nav,115111 )@@ -123,7 +119,7 @@123119 EntryDetailScreen(124120 id = backStack.arguments?.getString("id").orEmpty(),125121 onNavigate = nav,126- onBack = back,122+ onBack = { navController.navigate(PeachNav.VaultList.route) },127123 )128124 }129125 composable(app/src/main/java/com/peachpasswords/ui/vault/EntryDetailScreen.kt+180 −68
@@ -12,16 +12,19 @@1212 import androidx.compose.foundation.background1313 import androidx.compose.foundation.border1414 import androidx.compose.foundation.clickable15+import androidx.compose.foundation.gestures.detectVerticalDragGestures1516 import androidx.compose.foundation.layout.Arrangement1617 import androidx.compose.foundation.layout.Box1718 import androidx.compose.foundation.layout.Column1819 import androidx.compose.foundation.layout.Row1920 import androidx.compose.foundation.layout.Spacer2021 import androidx.compose.foundation.layout.fillMaxSize22+import androidx.compose.foundation.layout.fillMaxHeight2123 import androidx.compose.foundation.layout.fillMaxWidth2224 import androidx.compose.foundation.layout.height2325 import androidx.compose.foundation.layout.offset2426 import androidx.compose.foundation.layout.padding27+import androidx.compose.foundation.layout.navigationBarsPadding2528 import androidx.compose.foundation.layout.size2629 import androidx.compose.foundation.layout.statusBarsPadding2730 import androidx.compose.foundation.layout.width@@ -30,9 +33,11 @@3033 import androidx.compose.foundation.shape.RoundedCornerShape3134 import androidx.compose.material.icons.rounded.Check3235 import androidx.compose.material.icons.rounded.ContentCopy36+import androidx.compose.material.icons.rounded.Search3337 import androidx.compose.foundation.verticalScroll3438 import androidx.compose.material.icons.Icons3539 import androidx.compose.material.icons.automirrored.rounded.ArrowBack40+import androidx.compose.material.icons.automirrored.rounded.ArrowForward3641 import androidx.compose.material.icons.outlined.DeleteOutline3742 import androidx.compose.material3.Icon3843 import androidx.compose.material3.Text@@ -54,6 +59,7 @@5459 import androidx.compose.ui.graphics.Color5560 import androidx.compose.ui.graphics.graphicsLayer5661 import androidx.compose.ui.platform.LocalContext62+import androidx.compose.ui.input.pointer.pointerInput5763 import androidx.compose.ui.text.TextStyle5864 import androidx.compose.ui.text.font.FontStyle5965 import androidx.compose.ui.text.style.TextOverflow@@ -87,6 +93,7 @@8793 vm: EntryDetailViewModel = hiltViewModel(),8894 ) {8995 val entry by vm.entry.collectAsState()96+ val activeEntries by vm.activeEntries.collectAsState()9097 val identitySuggestions by vm.identitySuggestions.collectAsState()9198 val cvcRevealed by vm.cvcRevealed.collectAsState()9299 var cardRevealed by remember { mutableStateOf(false) }@@ -106,83 +113,85 @@106113 107114 val e = entry108115 ShellBackground {109- Column(Modifier.fillMaxSize().statusBarsPadding()) {110- // Header: back · favicon+domain (or delete confirm) · trash111- Row(112- Modifier.fillMaxWidth().height(56.dp).padding(horizontal = 8.dp),113- verticalAlignment = Alignment.CenterVertically,116+ Box(Modifier.fillMaxSize().statusBarsPadding()) {117+ Column(118+ Modifier.fillMaxSize()119+ .padding(bottom = 100.dp)120+ .verticalScroll(rememberScrollState())121+ .padding(horizontal = 24.dp),114122 ) {115- Icon(116- Icons.AutoMirrored.Rounded.ArrowBack, contentDescription = "back", tint = peachColors.T0,117- modifier = Modifier.size(40.dp).clip(CircleShape).clickable(onClick = onBack).padding(8.dp),118- )119- Box(Modifier.weight(1f), contentAlignment = Alignment.Center) {120- when {121- e == null -> {}122- confirmingDelete -> Text(123- "delete “${e.title}”?",124- color = peachColors.Breach,125- style = PeachType.labelMono.copy(letterSpacing = 0.08.em),126- )127- else -> Row(128- verticalAlignment = Alignment.CenterVertically,129- horizontalArrangement = Arrangement.spacedBy(8.dp),130- ) {131- FaviconInitials(source = e.url ?: e.title, size = 16.dp)132- val domain = remember(e.url, e.title) { e.displayDomain() }133- if (domain.isNotEmpty()) {134- Text(domain, color = peachColors.T2, style = TextStyle(fontFamily = PeachType.Mono, fontSize = 9.sp))123+ // Header: back · favicon+domain (or delete confirm) · trash124+ Row(125+ Modifier.fillMaxWidth().height(56.dp).padding(horizontal = 8.dp),126+ verticalAlignment = Alignment.CenterVertically,127+ ) {128+ Icon(129+ Icons.AutoMirrored.Rounded.ArrowBack, contentDescription = "back", tint = peachColors.T0,130+ modifier = Modifier.size(40.dp).clip(CircleShape).clickable(onClick = onBack).padding(8.dp),131+ )132+ Box(Modifier.weight(1f), contentAlignment = Alignment.Center) {133+ when {134+ e == null -> {}135+ confirmingDelete -> Text(136+ "delete “${e.title}”?",137+ color = peachColors.Breach,138+ style = PeachType.labelMono.copy(letterSpacing = 0.08.em),139+ )140+ else -> Row(141+ verticalAlignment = Alignment.CenterVertically,142+ horizontalArrangement = Arrangement.spacedBy(8.dp),143+ ) {144+ FaviconInitials(source = e.url ?: e.title, size = 16.dp)145+ val domain = remember(e.url, e.title) { e.displayDomain() }146+ if (domain.isNotEmpty()) {147+ Text(domain, color = peachColors.T2, style = TextStyle(fontFamily = PeachType.Mono, fontSize = 9.sp))148+ }135149 }136150 }137151 }152+ if (e != null) {153+ Icon(154+ Icons.Outlined.DeleteOutline, contentDescription = "delete",155+ tint = if (confirmingDelete) peachColors.Breach else peachColors.T1,156+ modifier = Modifier.size(40.dp).clip(CircleShape)157+ .clickable { if (confirmingDelete) vm.delete(onDone = onBack) else confirmingDelete = true }158+ .padding(8.dp),159+ )160+ }138161 }139- if (e != null) {140- Icon(141- Icons.Outlined.DeleteOutline, contentDescription = "delete",142- tint = if (confirmingDelete) peachColors.Breach else peachColors.T1,143- modifier = Modifier.size(40.dp).clip(CircleShape)144- .clickable { if (confirmingDelete) vm.delete(onDone = onBack) else confirmingDelete = true }145- .padding(8.dp),146- )147- }148- }149162 150- if (e == null) {151- Box(Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {152- Text("entry not found", color = peachColors.T1, style = PeachType.bodyMono)163+ if (e == null) {164+ Box(Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {165+ Text("entry not found", color = peachColors.T1, style = PeachType.bodyMono)166+ }167+ return@Column153168 }154- return@Column155- }156169 157- // D11 — breach banner strip when this entry's password is known-compromised.158- if (e.isBreach()) {159- Row(160- Modifier.fillMaxWidth()161- .background(peachColors.BreachBg)162- .padding(horizontal = 16.dp, vertical = 8.dp),163- verticalAlignment = Alignment.CenterVertically,164- ) {165- Text("⚠", color = peachColors.Breach, style = PeachType.bodyMono)166- Spacer(Modifier.width(10.dp))167- Text(168- "Password found in a data breach — change it now",169- color = peachColors.Breach, style = PeachType.labelMono,170- modifier = Modifier.weight(1f),171- )172- Text(173- "Change password",174- color = accent, style = PeachType.labelMono,175- modifier = Modifier.clip(RoundedCornerShape(6.dp))176- .clickable { onNavigate(PeachNav.EntryEdit(e.id)) }177- .padding(horizontal = 6.dp, vertical = 4.dp),178- )170+ // D11 — breach banner strip when this entry's password is known-compromised.171+ if (e.isBreach()) {172+ Row(173+ Modifier.fillMaxWidth()174+ .background(peachColors.BreachBg)175+ .padding(horizontal = 16.dp, vertical = 8.dp),176+ verticalAlignment = Alignment.CenterVertically,177+ ) {178+ Text("⚠", color = peachColors.Breach, style = PeachType.bodyMono)179+ Spacer(Modifier.width(10.dp))180+ Text(181+ "Password found in a data breach — change it now",182+ color = peachColors.Breach, style = PeachType.labelMono,183+ modifier = Modifier.weight(1f),184+ )185+ Text(186+ "Change password",187+ color = accent, style = PeachType.labelMono,188+ modifier = Modifier.clip(RoundedCornerShape(6.dp))189+ .clickable { onNavigate(PeachNav.EntryEdit(e.id)) }190+ .padding(horizontal = 6.dp, vertical = 4.dp),191+ )192+ }179193 }180- }181194 182- Column(183- Modifier.fillMaxSize().verticalScroll(rememberScrollState())184- .padding(horizontal = 24.dp),185- ) {186195 // Hero — ghost PeachScript watermark behind the entry name. The full187196 // title is drawn (not just its first letter); a long title overflows188197 // and clips naturally, which is the intended watermark behavior.@@ -310,9 +319,20 @@310319 )311320 }312321 313- Spacer(Modifier.height(48.dp))322+ Spacer(Modifier.height(24.dp))314323 }315324 325+ if (e != null) {326+ EntryDetailSearchStrip(327+ currentIndex = activeEntries.indexOfFirst { it.id == e.id },328+ totalEntries = activeEntries.size,329+ onOpenList = { onNavigate(PeachNav.VaultList) },330+ onPrevious = { vm.adjacentDestination(-1)?.let(onNavigate) },331+ onNext = { vm.adjacentDestination(1)?.let(onNavigate) },332+ modifier = Modifier.align(Alignment.BottomCenter),333+ )334+ }335+316336 if (generatorOpen) {317337 GeneratorSheet(318338 copied = copiedField == "genDraft",@@ -321,6 +341,98 @@321341 onDismiss = { generatorOpen = false },322342 )323343 }344+ }345+ }346+}347+348+@Composable349+private fun EntryDetailSearchStrip(350+ currentIndex: Int,351+ totalEntries: Int,352+ onOpenList: () -> Unit,353+ onPrevious: () -> Unit,354+ onNext: () -> Unit,355+ modifier: Modifier = Modifier,356+) {357+ val accent = LocalPeachAccent.current358+ val hasEntries = totalEntries > 0 && currentIndex >= 0359+ val counter = if (hasEntries) "${currentIndex + 1} / $totalEntries" else "0 entries"360+361+ Column(362+ modifier363+ .fillMaxWidth()364+ .navigationBarsPadding()365+ .padding(horizontal = 16.dp, vertical = 12.dp),366+ ) {367+ Row(368+ Modifier369+ .fillMaxWidth()370+ .height(56.dp)371+ .clip(RoundedCornerShape(16.dp))372+ .background(peachColors.S1)373+ .border(1.dp, peachColors.T3, RoundedCornerShape(16.dp))374+ .padding(horizontal = 12.dp),375+ verticalAlignment = Alignment.CenterVertically,376+ ) {377+ Row(378+ Modifier379+ .weight(1f)380+ .fillMaxHeight()381+ .clickable(onClick = onOpenList)382+ .pointerInput(onOpenList) {383+ var opened = false384+ detectVerticalDragGestures(385+ onDragEnd = { opened = false },386+ onDragCancel = { opened = false },387+ ) { _, dragAmount ->388+ if (!opened && dragAmount < -4f) {389+ opened = true390+ onOpenList()391+ }392+ }393+ },394+ verticalAlignment = Alignment.CenterVertically,395+ ) {396+ Icon(397+ Icons.Rounded.Search,398+ contentDescription = null,399+ tint = accent,400+ modifier = Modifier.size(14.dp),401+ )402+ Spacer(Modifier.width(8.dp))403+ Text(404+ "search vault...",405+ color = peachColors.T2,406+ style = PeachType.searchInput,407+ modifier = Modifier.weight(1f),408+ )409+ Text(410+ counter,411+ color = peachColors.T2,412+ style = PeachType.labelMono,413+ )414+ }415+ Spacer(Modifier.width(8.dp))416+ Icon(417+ Icons.AutoMirrored.Rounded.ArrowBack,418+ contentDescription = "Previous entry",419+ tint = if (hasEntries) peachColors.T0 else peachColors.T2,420+ modifier = Modifier421+ .size(38.dp)422+ .clip(CircleShape)423+ .clickable(enabled = hasEntries, onClick = onPrevious)424+ .padding(9.dp),425+ )426+ Icon(427+ Icons.AutoMirrored.Rounded.ArrowForward,428+ contentDescription = "Next entry",429+ tint = if (hasEntries) peachColors.T0 else peachColors.T2,430+ modifier = Modifier431+ .size(38.dp)432+ .clip(CircleShape)433+ .clickable(enabled = hasEntries, onClick = onNext)434+ .padding(9.dp),435+ )324436 }325437 }326438 }app/src/main/java/com/peachpasswords/ui/vault/EntryDetailViewModel.kt+14 −0
@@ -5,6 +5,8 @@55 import androidx.lifecycle.SavedStateHandle66 import androidx.lifecycle.ViewModel77 import androidx.lifecycle.viewModelScope8+import com.peachpasswords.ui.PeachNav9+import com.peachpasswords.ui.vault.entryTapDestination810 import com.peachpasswords.vault.LastViewedEntryStore911 import com.peachpasswords.vault.TOTPGenerator1012 import com.peachpasswords.vault.VaultEntry@@ -39,6 +41,9 @@3941 vault.entries.map { list -> list.firstOrNull { it.id == id } }4042 .stateIn(viewModelScope, SharingStarted.WhileSubscribed(5000), vault.getEntry(id))4143 44+ val activeEntries: StateFlow<List<VaultEntry>> =45+ vault.entries.stateIn(viewModelScope, SharingStarted.WhileSubscribed(5000), vault.getActiveEntries())46+4247 /** Distinct prior username/email values for the identity-suggest dropdown. */4348 val identitySuggestions: StateFlow<List<String>> =4449 vault.entries@@ -90,6 +95,15 @@9095 fun copyTotp() {9196 val totp = entry.value?.totp ?: return9297 copy("totp", TOTPGenerator.generateCode(totp))98+ }99+100+ fun adjacentDestination(offset: Int): PeachNav? {101+ val list = activeEntries.value102+ if (list.isEmpty()) return null103+ val currentIndex = list.indexOfFirst { it.id == id }104+ if (currentIndex < 0) return null105+ val nextIndex = (currentIndex + offset + list.size) % list.size106+ return entryTapDestination(list[nextIndex])93107 }94108 95109 /**