aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.idea/kotlinc.xml2
-rw-r--r--app/src/main/java/app/passwordstore/ui/pgp/PGPKeyList.kt29
2 files changed, 24 insertions, 7 deletions
diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml
index e1eea1d6..0e65ceac 100644
--- a/.idea/kotlinc.xml
+++ b/.idea/kotlinc.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="KotlinJpsPluginSettings">
- <option name="version" value="1.7.20" />
+ <option name="version" value="1.7.21" />
</component>
</project> \ No newline at end of file
diff --git a/app/src/main/java/app/passwordstore/ui/pgp/PGPKeyList.kt b/app/src/main/java/app/passwordstore/ui/pgp/PGPKeyList.kt
index fd2369e0..8f46b8d5 100644
--- a/app/src/main/java/app/passwordstore/ui/pgp/PGPKeyList.kt
+++ b/app/src/main/java/app/passwordstore/ui/pgp/PGPKeyList.kt
@@ -1,16 +1,22 @@
package app.passwordstore.ui.pgp
-import androidx.compose.foundation.clickable
-import androidx.compose.foundation.layout.Box
+import androidx.compose.foundation.layout.Arrangement
+import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
+import androidx.compose.material3.Icon
+import androidx.compose.material3.IconButton
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
+import androidx.compose.ui.Alignment
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.unit.dp
+import app.passwordstore.R
import app.passwordstore.crypto.GpgIdentifier
@Composable
@@ -20,15 +26,14 @@ fun KeyList(
modifier: Modifier = Modifier,
) {
LazyColumn(modifier = modifier) {
- items(identifiers) { identifier ->
- KeyItem(identifier = identifier, modifier = Modifier.clickable { onItemClick(identifier) })
- }
+ items(identifiers) { identifier -> KeyItem(identifier = identifier, onItemClick = onItemClick) }
}
}
@Composable
private fun KeyItem(
identifier: GpgIdentifier,
+ onItemClick: (identifier: GpgIdentifier) -> Unit,
modifier: Modifier = Modifier,
) {
val label =
@@ -36,7 +41,19 @@ private fun KeyItem(
is GpgIdentifier.KeyId -> identifier.id.toString()
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