fix: add an explicit delete button to PGP key list items
This commit is contained in:
parent
6a4c0a223f
commit
35a6e3b8ff
2 changed files with 24 additions and 7 deletions
2
.idea/kotlinc.xml
generated
2
.idea/kotlinc.xml
generated
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="KotlinJpsPluginSettings">
|
<component name="KotlinJpsPluginSettings">
|
||||||
<option name="version" value="1.7.20" />
|
<option name="version" value="1.7.21" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
|
@ -1,16 +1,22 @@
|
||||||
package app.passwordstore.ui.pgp
|
package app.passwordstore.ui.pgp
|
||||||
|
|
||||||
import androidx.compose.foundation.clickable
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.lazy.LazyColumn
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
import androidx.compose.foundation.lazy.items
|
import androidx.compose.foundation.lazy.items
|
||||||
|
import androidx.compose.material3.Icon
|
||||||
|
import androidx.compose.material3.IconButton
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.res.painterResource
|
||||||
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
|
import app.passwordstore.R
|
||||||
import app.passwordstore.crypto.GpgIdentifier
|
import app.passwordstore.crypto.GpgIdentifier
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
@ -20,15 +26,14 @@ fun KeyList(
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
LazyColumn(modifier = modifier) {
|
LazyColumn(modifier = modifier) {
|
||||||
items(identifiers) { identifier ->
|
items(identifiers) { identifier -> KeyItem(identifier = identifier, onItemClick = onItemClick) }
|
||||||
KeyItem(identifier = identifier, modifier = Modifier.clickable { onItemClick(identifier) })
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun KeyItem(
|
private fun KeyItem(
|
||||||
identifier: GpgIdentifier,
|
identifier: GpgIdentifier,
|
||||||
|
onItemClick: (identifier: GpgIdentifier) -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
val label =
|
val label =
|
||||||
|
@ -36,7 +41,19 @@ private fun KeyItem(
|
||||||
is GpgIdentifier.KeyId -> identifier.id.toString()
|
is GpgIdentifier.KeyId -> identifier.id.toString()
|
||||||
is GpgIdentifier.UserId -> identifier.email
|
is GpgIdentifier.UserId -> identifier.email
|
||||||
}
|
}
|
||||||
Box(modifier = modifier.padding(16.dp).fillMaxWidth()) { Text(text = label) }
|
Row(
|
||||||
|
modifier = modifier.padding(16.dp).fillMaxWidth(),
|
||||||
|
horizontalArrangement = Arrangement.SpaceBetween,
|
||||||
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
|
) {
|
||||||
|
Text(text = label)
|
||||||
|
IconButton(onClick = { onItemClick(identifier) }) {
|
||||||
|
Icon(
|
||||||
|
painter = painterResource(R.drawable.ic_delete_24dp),
|
||||||
|
stringResource(id = R.string.delete)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Preview
|
@Preview
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue