Skip to content
This repository was archived by the owner on Oct 15, 2024. It is now read-only.

Commit 4c28098

Browse files
committed
fix(ui): adjust width of items in PasswordEntryScreen
1 parent 0c8bed4 commit 4c28098

File tree

1 file changed

+20
-16
lines changed

1 file changed

+20
-16
lines changed

app/src/main/java/app/passwordstore/ui/crypto/DecryptScreen.kt

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@ package app.passwordstore.ui.crypto
22

33
import androidx.compose.foundation.layout.Box
44
import androidx.compose.foundation.layout.Column
5+
import androidx.compose.foundation.layout.IntrinsicSize
56
import androidx.compose.foundation.layout.fillMaxSize
7+
import androidx.compose.foundation.layout.fillMaxWidth
68
import androidx.compose.foundation.layout.padding
9+
import androidx.compose.foundation.layout.width
710
import androidx.compose.material3.Icon
811
import androidx.compose.material3.IconButton
912
import androidx.compose.material3.MaterialTheme
@@ -48,32 +51,28 @@ fun PasswordEntryScreen(
4851
entryName: String,
4952
entry: PasswordEntry,
5053
readOnly: Boolean,
54+
onNavigateUp: () -> Unit,
5155
modifier: Modifier = Modifier,
5256
) {
5357
Scaffold(
5458
topBar = {
5559
APSAppBar(
56-
title = "",
60+
title = entryName,
5761
navigationIcon = painterResource(R.drawable.ic_arrow_back_black_24dp),
58-
onNavigationIconClick = {},
62+
onNavigationIconClick = onNavigateUp,
5963
backgroundColor = MaterialTheme.colorScheme.surface,
6064
)
6165
},
6266
) { paddingValues ->
63-
Box(modifier = modifier.fillMaxSize().padding(paddingValues)) {
64-
Column(modifier = Modifier.padding(8.dp)) {
65-
Text(
66-
text = entryName,
67-
style = MaterialTheme.typography.headlineSmall,
68-
modifier = Modifier.padding(bottom = 8.dp),
69-
)
67+
Box(modifier = modifier.padding(paddingValues)) {
68+
Column(modifier = Modifier.padding(vertical = 8.dp, horizontal = 16.dp).fillMaxSize()) {
7069
if (entry.password != null) {
7170
PasswordField(
7271
value = entry.password!!,
7372
label = stringResource(R.string.password),
7473
initialVisibility = false,
7574
readOnly = readOnly,
76-
modifier = Modifier.padding(bottom = 8.dp),
75+
modifier = Modifier.padding(bottom = 8.dp).fillMaxWidth(),
7776
)
7877
}
7978
if (entry.hasTotp() && readOnly) {
@@ -84,7 +83,7 @@ fun PasswordEntryScreen(
8483
readOnly = true,
8584
label = { Text("OTP (expires in ${totp.remainingTime.inWholeSeconds}s)") },
8685
trailingIcon = { CopyButton({ totp.value }) },
87-
modifier = Modifier.padding(bottom = 8.dp),
86+
modifier = Modifier.padding(bottom = 8.dp).fillMaxWidth(),
8887
)
8988
}
9089
if (entry.username != null && readOnly) {
@@ -94,7 +93,7 @@ fun PasswordEntryScreen(
9493
readOnly = true,
9594
label = { Text(stringResource(R.string.username)) },
9695
trailingIcon = { CopyButton({ entry.username!! }) },
97-
modifier = Modifier.padding(bottom = 8.dp),
96+
modifier = Modifier.padding(bottom = 8.dp).fillMaxWidth(),
9897
)
9998
}
10099
ExtraContent(entry = entry, readOnly = readOnly)
@@ -117,16 +116,16 @@ private fun ExtraContent(
117116
readOnly = true,
118117
label = { Text(label.capitalize(Locale.current)) },
119118
trailingIcon = { CopyButton({ value }) },
120-
modifier = modifier.padding(bottom = 8.dp),
119+
modifier = modifier.padding(bottom = 8.dp).fillMaxWidth(),
121120
)
122121
}
123122
} else {
124123
TextField(
125-
value = entry.extraContentWithoutAuthData,
124+
value = entry.extraContentString,
126125
onValueChange = {},
127126
readOnly = false,
128127
label = { Text("Extra content") },
129-
modifier = modifier,
128+
modifier = modifier.fillMaxWidth(),
130129
)
131130
}
132131
}
@@ -152,7 +151,12 @@ private fun CopyButton(
152151
@Composable
153152
private fun PasswordEntryPreview() {
154153
APSThemePreview {
155-
PasswordEntryScreen(entryName = "Test Entry", entry = createTestEntry(), readOnly = true)
154+
PasswordEntryScreen(
155+
entryName = "Test Entry",
156+
entry = createTestEntry(),
157+
readOnly = true,
158+
onNavigateUp = {},
159+
)
156160
}
157161
}
158162

0 commit comments

Comments
 (0)