@@ -2,8 +2,11 @@ package app.passwordstore.ui.crypto
2
2
3
3
import androidx.compose.foundation.layout.Box
4
4
import androidx.compose.foundation.layout.Column
5
+ import androidx.compose.foundation.layout.IntrinsicSize
5
6
import androidx.compose.foundation.layout.fillMaxSize
7
+ import androidx.compose.foundation.layout.fillMaxWidth
6
8
import androidx.compose.foundation.layout.padding
9
+ import androidx.compose.foundation.layout.width
7
10
import androidx.compose.material3.Icon
8
11
import androidx.compose.material3.IconButton
9
12
import androidx.compose.material3.MaterialTheme
@@ -48,32 +51,28 @@ fun PasswordEntryScreen(
48
51
entryName : String ,
49
52
entry : PasswordEntry ,
50
53
readOnly : Boolean ,
54
+ onNavigateUp : () -> Unit ,
51
55
modifier : Modifier = Modifier ,
52
56
) {
53
57
Scaffold (
54
58
topBar = {
55
59
APSAppBar (
56
- title = " " ,
60
+ title = entryName ,
57
61
navigationIcon = painterResource(R .drawable.ic_arrow_back_black_24dp),
58
- onNavigationIconClick = {} ,
62
+ onNavigationIconClick = onNavigateUp ,
59
63
backgroundColor = MaterialTheme .colorScheme.surface,
60
64
)
61
65
},
62
66
) { 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()) {
70
69
if (entry.password != null ) {
71
70
PasswordField (
72
71
value = entry.password!! ,
73
72
label = stringResource(R .string.password),
74
73
initialVisibility = false ,
75
74
readOnly = readOnly,
76
- modifier = Modifier .padding(bottom = 8 .dp),
75
+ modifier = Modifier .padding(bottom = 8 .dp).fillMaxWidth() ,
77
76
)
78
77
}
79
78
if (entry.hasTotp() && readOnly) {
@@ -84,7 +83,7 @@ fun PasswordEntryScreen(
84
83
readOnly = true ,
85
84
label = { Text (" OTP (expires in ${totp.remainingTime.inWholeSeconds} s)" ) },
86
85
trailingIcon = { CopyButton ({ totp.value }) },
87
- modifier = Modifier .padding(bottom = 8 .dp),
86
+ modifier = Modifier .padding(bottom = 8 .dp).fillMaxWidth() ,
88
87
)
89
88
}
90
89
if (entry.username != null && readOnly) {
@@ -94,7 +93,7 @@ fun PasswordEntryScreen(
94
93
readOnly = true ,
95
94
label = { Text (stringResource(R .string.username)) },
96
95
trailingIcon = { CopyButton ({ entry.username!! }) },
97
- modifier = Modifier .padding(bottom = 8 .dp),
96
+ modifier = Modifier .padding(bottom = 8 .dp).fillMaxWidth() ,
98
97
)
99
98
}
100
99
ExtraContent (entry = entry, readOnly = readOnly)
@@ -117,16 +116,16 @@ private fun ExtraContent(
117
116
readOnly = true ,
118
117
label = { Text (label.capitalize(Locale .current)) },
119
118
trailingIcon = { CopyButton ({ value }) },
120
- modifier = modifier.padding(bottom = 8 .dp),
119
+ modifier = modifier.padding(bottom = 8 .dp).fillMaxWidth() ,
121
120
)
122
121
}
123
122
} else {
124
123
TextField (
125
- value = entry.extraContentWithoutAuthData ,
124
+ value = entry.extraContentString ,
126
125
onValueChange = {},
127
126
readOnly = false ,
128
127
label = { Text (" Extra content" ) },
129
- modifier = modifier,
128
+ modifier = modifier.fillMaxWidth() ,
130
129
)
131
130
}
132
131
}
@@ -152,7 +151,12 @@ private fun CopyButton(
152
151
@Composable
153
152
private fun PasswordEntryPreview () {
154
153
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
+ )
156
160
}
157
161
}
158
162
0 commit comments