diff options
author | Harsh Shandilya <me@msfjarvis.dev> | 2024-05-29 02:43:15 +0530 |
---|---|---|
committer | Harsh Shandilya <me@msfjarvis.dev> | 2024-05-29 02:43:15 +0530 |
commit | f60c20060db8922c710294396b6a4107b77abdc2 (patch) | |
tree | 5d0a2eaca7b8a3325e97ce933c0bfa17122e0435 /app/src | |
parent | 4939153e8150457c64d26ea76727f26880baf807 (diff) |
refactor(ui): tokenize spacing
Diffstat (limited to 'app/src')
3 files changed, 20 insertions, 13 deletions
diff --git a/app/src/main/java/app/passwordstore/ui/crypto/EditPasswordScreen.kt b/app/src/main/java/app/passwordstore/ui/crypto/EditPasswordScreen.kt index b456fcc5..3c18207d 100644 --- a/app/src/main/java/app/passwordstore/ui/crypto/EditPasswordScreen.kt +++ b/app/src/main/java/app/passwordstore/ui/crypto/EditPasswordScreen.kt @@ -14,12 +14,13 @@ 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.data.passfile.PasswordEntry import app.passwordstore.ui.APSAppBar import app.passwordstore.ui.compose.PasswordField import app.passwordstore.ui.compose.theme.APSTheme +import app.passwordstore.ui.compose.theme.SpacingLarge +import app.passwordstore.ui.compose.theme.SpacingMedium import app.passwordstore.util.time.UserClock import app.passwordstore.util.totp.UriTotpFinder @@ -43,13 +44,16 @@ fun EditPasswordScreen( } ) { paddingValues -> Box(modifier = modifier.padding(paddingValues)) { - Column(modifier = Modifier.padding(vertical = 8.dp, horizontal = 16.dp).fillMaxSize()) { + Column( + modifier = + Modifier.padding(vertical = SpacingMedium, horizontal = SpacingLarge).fillMaxSize() + ) { if (entry.password != null) { PasswordField( value = entry.password!!, label = stringResource(R.string.password), initialVisibility = false, - modifier = Modifier.padding(bottom = 8.dp).fillMaxWidth(), + modifier = Modifier.padding(bottom = SpacingMedium).fillMaxWidth(), ) } ExtraContent(entry = entry) diff --git a/app/src/main/java/app/passwordstore/ui/crypto/ViewPasswordScreen.kt b/app/src/main/java/app/passwordstore/ui/crypto/ViewPasswordScreen.kt index 18a07893..a141af9c 100644 --- a/app/src/main/java/app/passwordstore/ui/crypto/ViewPasswordScreen.kt +++ b/app/src/main/java/app/passwordstore/ui/crypto/ViewPasswordScreen.kt @@ -18,13 +18,14 @@ import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.capitalize import androidx.compose.ui.text.intl.Locale import androidx.compose.ui.tooling.preview.Preview -import androidx.compose.ui.unit.dp import app.passwordstore.R import app.passwordstore.data.passfile.PasswordEntry import app.passwordstore.ui.APSAppBar import app.passwordstore.ui.compose.CopyButton import app.passwordstore.ui.compose.PasswordField import app.passwordstore.ui.compose.theme.APSTheme +import app.passwordstore.ui.compose.theme.SpacingLarge +import app.passwordstore.ui.compose.theme.SpacingMedium import app.passwordstore.util.time.UserClock import app.passwordstore.util.totp.UriTotpFinder import kotlinx.coroutines.flow.first @@ -49,14 +50,17 @@ fun ViewPasswordScreen( } ) { paddingValues -> Box(modifier = modifier.padding(paddingValues)) { - Column(modifier = Modifier.padding(vertical = 8.dp, horizontal = 16.dp).fillMaxSize()) { + Column( + modifier = + Modifier.padding(vertical = SpacingMedium, horizontal = SpacingLarge).fillMaxSize() + ) { if (entry.password != null) { PasswordField( value = entry.password!!, label = stringResource(R.string.password), initialVisibility = false, readOnly = true, - modifier = Modifier.padding(bottom = 8.dp).fillMaxWidth(), + modifier = Modifier.padding(bottom = SpacingMedium).fillMaxWidth(), ) } if (entry.hasTotp()) { @@ -67,7 +71,7 @@ fun ViewPasswordScreen( readOnly = true, label = { Text("OTP (expires in ${totp.remainingTime.inWholeSeconds}s)") }, trailingIcon = { CopyButton(totp.value, R.string.copy_label) }, - modifier = Modifier.padding(bottom = 8.dp).fillMaxWidth(), + modifier = Modifier.padding(bottom = SpacingMedium).fillMaxWidth(), ) } if (entry.username != null) { @@ -77,7 +81,7 @@ fun ViewPasswordScreen( readOnly = true, label = { Text(stringResource(R.string.username)) }, trailingIcon = { CopyButton(entry.username!!, R.string.copy_label) }, - modifier = Modifier.padding(bottom = 8.dp).fillMaxWidth(), + modifier = Modifier.padding(bottom = SpacingMedium).fillMaxWidth(), ) } ExtraContent(entry = entry) @@ -95,7 +99,7 @@ private fun ExtraContent(entry: PasswordEntry, modifier: Modifier = Modifier) { readOnly = true, label = { Text(label.capitalize(Locale.current)) }, trailingIcon = { CopyButton(value, R.string.copy_label) }, - modifier = modifier.padding(bottom = 8.dp).fillMaxWidth(), + modifier = modifier.padding(bottom = SpacingMedium).fillMaxWidth(), ) } } 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 dae2ce0b..fa9c2495 100644 --- a/app/src/main/java/app/passwordstore/ui/pgp/PGPKeyList.kt +++ b/app/src/main/java/app/passwordstore/ui/pgp/PGPKeyList.kt @@ -10,7 +10,6 @@ import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.layout.requiredSize import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.items import androidx.compose.material3.AlertDialog @@ -30,10 +29,10 @@ import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.tooling.preview.Preview -import androidx.compose.ui.unit.dp import app.passwordstore.R import app.passwordstore.crypto.PGPIdentifier import app.passwordstore.ui.compose.theme.APSTheme +import app.passwordstore.ui.compose.theme.SpacingLarge import app.passwordstore.util.extensions.conditional import kotlinx.collections.immutable.ImmutableList import kotlinx.collections.immutable.persistentListOf @@ -90,7 +89,7 @@ private fun KeyItem( } Row( modifier = - modifier.padding(16.dp).fillMaxWidth().conditional(onKeySelected != null) { + modifier.padding(SpacingLarge).fillMaxWidth().conditional(onKeySelected != null) { clickable { onKeySelected?.invoke(identifier) } }, horizontalArrangement = Arrangement.SpaceBetween, @@ -103,7 +102,7 @@ private fun KeyItem( maxLines = 1, ) if (onKeySelected == null) { - IconButton(onClick = { isDeleting = true }, modifier = Modifier.requiredSize(24.dp)) { + IconButton(onClick = { isDeleting = true }) { Icon( painter = painterResource(R.drawable.ic_delete_24dp), stringResource(id = R.string.delete), |