From 91f73010e0f601fe7224dff51ae0d770ea73b750 Mon Sep 17 00:00:00 2001 From: Andrew Date: Tue, 18 Jun 2024 21:45:36 +0930 Subject: [PATCH] Rename dimensions for readability --- .../start/home/NewConversationHome.kt | 8 ++--- .../start/invitefriend/InviteFriend.kt | 12 ++++---- .../start/newmessage/NewMessage.kt | 10 +++---- .../conversation/v2/MessageDetailActivity.kt | 4 +-- .../thoughtcrime/securesms/home/EmptyView.kt | 6 ++-- .../securesms/home/SeedReminder.kt | 8 ++--- .../securesms/onboarding/landing/Landing.kt | 16 +++++----- .../onboarding/loadaccount/LoadAccount.kt | 8 ++--- .../securesms/onboarding/loading/Loading.kt | 2 +- .../MessageNotifications.kt | 10 +++---- .../onboarding/pickname/PickDisplayName.kt | 8 ++--- .../securesms/onboarding/ui/ContinueButton.kt | 8 ++--- .../securesms/preferences/QRCodeActivity.kt | 4 +-- .../securesms/preferences/SettingsActivity.kt | 8 ++--- .../recoverypassword/RecoveryPassword.kt | 18 ++++++------ .../thoughtcrime/securesms/ui/AlertDialog.kt | 12 ++++---- .../thoughtcrime/securesms/ui/Components.kt | 2 +- .../thoughtcrime/securesms/ui/Dimensions.kt | 29 ++++++++++--------- .../securesms/ui/components/QR.kt | 10 +++---- .../securesms/ui/components/Text.kt | 2 +- 20 files changed, 93 insertions(+), 92 deletions(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/start/home/NewConversationHome.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/start/home/NewConversationHome.kt index d7d3c264dd..2fb7e1fb00 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/start/home/NewConversationHome.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/start/home/NewConversationHome.kt @@ -71,17 +71,17 @@ private fun ColumnScope.Items( R.string.AccessibilityId_invite_friend_button), onClick = delegate::onInviteFriend) Column( modifier = Modifier - .padding(horizontal = LocalDimensions.current.marginMedium) - .padding(top = LocalDimensions.current.itemSpacingMedium) + .padding(horizontal = LocalDimensions.current.margin) + .padding(top = LocalDimensions.current.itemSpacing) ) { Text(stringResource(R.string.accountIdYours), style = xl) - Spacer(modifier = Modifier.height(LocalDimensions.current.itemSpacingTiny)) + Spacer(modifier = Modifier.height(LocalDimensions.current.xxxsItemSpacing)) Text( text = stringResource(R.string.qrYoursDescription), color = LocalColors.current.textSecondary, style = small ) - Spacer(modifier = Modifier.height(LocalDimensions.current.itemSpacingSmall)) + Spacer(modifier = Modifier.height(LocalDimensions.current.smallItemSpacing)) QrImage(string = accountId, Modifier.contentDescription(R.string.AccessibilityId_qr_code)) } } diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/start/invitefriend/InviteFriend.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/start/invitefriend/InviteFriend.kt index 356e5a2ba6..32bebaf149 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/start/invitefriend/InviteFriend.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/start/invitefriend/InviteFriend.kt @@ -37,7 +37,7 @@ internal fun InviteFriend( Column(modifier = Modifier.background(LocalColors.current.backgroundSecondary)) { AppBar(stringResource(R.string.invite_a_friend), onBack = onBack, onClose = onClose) Column( - modifier = Modifier.padding(horizontal = LocalDimensions.current.itemSpacingMedium), + modifier = Modifier.padding(horizontal = LocalDimensions.current.itemSpacing), ) { Text( accountId, @@ -45,24 +45,24 @@ internal fun InviteFriend( .contentDescription(R.string.AccessibilityId_recovery_password_container) .fillMaxWidth() .border() - .padding(LocalDimensions.current.marginSmall), + .padding(LocalDimensions.current.smallMargin), textAlign = TextAlign.Center, style = base ) - Spacer(modifier = Modifier.height(LocalDimensions.current.itemSpacingXSmall)) + Spacer(modifier = Modifier.height(LocalDimensions.current.xsItemSpacing)) Text( stringResource(R.string.invite_your_friend_to_chat_with_you_on_session_by_sharing_your_account_id_with_them), textAlign = TextAlign.Center, style = small, color = LocalColors.current.textSecondary, - modifier = Modifier.padding(horizontal = LocalDimensions.current.itemSpacingSmall) + modifier = Modifier.padding(horizontal = LocalDimensions.current.smallItemSpacing) ) - Spacer(modifier = Modifier.height(LocalDimensions.current.itemSpacingSmall)) + Spacer(modifier = Modifier.height(LocalDimensions.current.smallItemSpacing)) - Row(horizontalArrangement = spacedBy(LocalDimensions.current.itemSpacingSmall)) { + Row(horizontalArrangement = spacedBy(LocalDimensions.current.smallItemSpacing)) { SlimOutlineButton( stringResource(R.string.share), modifier = Modifier diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/start/newmessage/NewMessage.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/start/newmessage/NewMessage.kt index 20465d3230..518b0b101b 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/start/newmessage/NewMessage.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/start/newmessage/NewMessage.kt @@ -68,15 +68,15 @@ private fun EnterAccountId( ) { Column( modifier = Modifier - .padding(horizontal = LocalDimensions.current.marginExtraExtraSmall, vertical = LocalDimensions.current.marginExtraSmall) + .padding(horizontal = LocalDimensions.current.xxsMargin, vertical = LocalDimensions.current.xsMargin) .fillMaxHeight(), horizontalAlignment = Alignment.CenterHorizontally, - verticalArrangement = Arrangement.spacedBy(LocalDimensions.current.marginExtraSmall) + verticalArrangement = Arrangement.spacedBy(LocalDimensions.current.xsMargin) ) { SessionOutlinedTextField( text = state.newMessageIdOrOns, modifier = Modifier - .padding(horizontal = LocalDimensions.current.marginSmall) + .padding(horizontal = LocalDimensions.current.smallMargin) .contentDescription("Session id input box"), placeholder = stringResource(R.string.accountIdOrOnsEnter), onChange = callbacks::onChange, @@ -91,14 +91,14 @@ private fun EnterAccountId( modifier = Modifier .animateContentSize() .contentDescription(R.string.AccessibilityId_help_desk_link) - .padding(horizontal = LocalDimensions.current.marginMedium) + .padding(horizontal = LocalDimensions.current.margin) .fillMaxWidth(), ) { onHelp() } OutlineButton( modifier = Modifier .align(Alignment.CenterHorizontally) - .padding(horizontal = LocalDimensions.current.marginLarge) + .padding(horizontal = LocalDimensions.current.largeMargin) .fillMaxWidth() .contentDescription(R.string.next), color = LocalColors.current.primary, diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/MessageDetailActivity.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/MessageDetailActivity.kt index eea601d981..1ff44d5adb 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/MessageDetailActivity.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/MessageDetailActivity.kt @@ -339,7 +339,7 @@ fun FileDetails(fileDetails: List) { CellWithPaddingAndMargin(padding = 0.dp) { FlowRow( - modifier = Modifier.padding(vertical = 24.dp, horizontal = LocalDimensions.current.itemSpacingXSmall), + modifier = Modifier.padding(vertical = 24.dp, horizontal = LocalDimensions.current.xsItemSpacing), verticalArrangement = Arrangement.spacedBy(16.dp) ) { fileDetails.forEach { @@ -348,7 +348,7 @@ fun FileDetails(fileDetails: List) { it, modifier = Modifier .widthIn(min = maxWidth.div(2)) - .padding(horizontal = LocalDimensions.current.itemSpacingXSmall) + .padding(horizontal = LocalDimensions.current.xsItemSpacing) .width(IntrinsicSize.Max) ) } diff --git a/app/src/main/java/org/thoughtcrime/securesms/home/EmptyView.kt b/app/src/main/java/org/thoughtcrime/securesms/home/EmptyView.kt index 87ba9cc805..12c6c8dc36 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/home/EmptyView.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/home/EmptyView.kt @@ -32,7 +32,7 @@ internal fun EmptyView(newAccount: Boolean) { Column( horizontalAlignment = Alignment.CenterHorizontally, modifier = Modifier - .padding(horizontal = LocalDimensions.current.marginHomeEmptyView) + .padding(horizontal = LocalDimensions.current.homeEmptyViewMargin) ) { Spacer(modifier = Modifier.weight(1f)) Icon( @@ -54,13 +54,13 @@ internal fun EmptyView(newAccount: Boolean) { ) } - Divider(modifier = Modifier.padding(vertical = LocalDimensions.current.marginExtraSmall)) + Divider(modifier = Modifier.padding(vertical = LocalDimensions.current.xsMargin)) Text( stringResource(R.string.conversationsNone), style = h8, textAlign = TextAlign.Center, - modifier = Modifier.padding(bottom = LocalDimensions.current.itemSpacingXSmall)) + modifier = Modifier.padding(bottom = LocalDimensions.current.xsItemSpacing)) Text( stringResource(R.string.onboardingHitThePlusButton), style = small, diff --git a/app/src/main/java/org/thoughtcrime/securesms/home/SeedReminder.kt b/app/src/main/java/org/thoughtcrime/securesms/home/SeedReminder.kt index aac34065bb..0d5c09e3ee 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/home/SeedReminder.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/home/SeedReminder.kt @@ -44,8 +44,8 @@ internal fun SeedReminder(startRecoveryPasswordActivity: () -> Unit) { Modifier .background(LocalColors.current.backgroundSecondary) .padding( - horizontal = LocalDimensions.current.marginSmall, - vertical = LocalDimensions.current.marginExtraSmall + horizontal = LocalDimensions.current.smallMargin, + vertical = LocalDimensions.current.xsMargin ) ) { Column(Modifier.weight(1f)) { @@ -54,7 +54,7 @@ internal fun SeedReminder(startRecoveryPasswordActivity: () -> Unit) { stringResource(R.string.save_your_recovery_password), style = h8 ) - Spacer(Modifier.requiredWidth(LocalDimensions.current.itemSpacingXXSmall)) + Spacer(Modifier.requiredWidth(LocalDimensions.current.xxsItemSpacing)) SessionShieldIcon() } Text( @@ -62,7 +62,7 @@ internal fun SeedReminder(startRecoveryPasswordActivity: () -> Unit) { style = small ) } - Spacer(Modifier.width(LocalDimensions.current.marginExtraExtraSmall)) + Spacer(Modifier.width(LocalDimensions.current.xxsMargin)) SlimOutlineButton( text = stringResource(R.string.continue_2), modifier = Modifier diff --git a/app/src/main/java/org/thoughtcrime/securesms/onboarding/landing/Landing.kt b/app/src/main/java/org/thoughtcrime/securesms/onboarding/landing/Landing.kt index 17ea27debd..78e9c8913d 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/onboarding/landing/Landing.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/onboarding/landing/Landing.kt @@ -107,7 +107,7 @@ internal fun LandingScreen( Column { Column(modifier = Modifier .weight(1f) - .padding(horizontal = LocalDimensions.current.marginOnboarding) + .padding(horizontal = LocalDimensions.current.onboardingMargin) ) { Spacer(modifier = Modifier.weight(1f)) Text( @@ -116,7 +116,7 @@ internal fun LandingScreen( style = h4, textAlign = TextAlign.Center ) - Spacer(modifier = Modifier.height(LocalDimensions.current.itemSpacingMedium)) + Spacer(modifier = Modifier.height(LocalDimensions.current.itemSpacing)) LazyColumn( state = listState, @@ -124,7 +124,7 @@ internal fun LandingScreen( .heightIn(min = LocalDimensions.current.minScrollableViewHeight) .fillMaxWidth() .weight(3f), - verticalArrangement = Arrangement.spacedBy(LocalDimensions.current.itemSpacingSmall) + verticalArrangement = Arrangement.spacedBy(LocalDimensions.current.smallItemSpacing) ) { items( MESSAGES.take(count), @@ -140,7 +140,7 @@ internal fun LandingScreen( Spacer(modifier = Modifier.weight(1f)) } - Column(modifier = Modifier.padding(horizontal = LocalDimensions.current.marginLarge)) { + Column(modifier = Modifier.padding(horizontal = LocalDimensions.current.largeMargin)) { PrimaryFillButton( text = stringResource(R.string.onboardingAccountCreate), modifier = Modifier @@ -149,7 +149,7 @@ internal fun LandingScreen( .contentDescription(R.string.AccessibilityId_create_account_button), onClick = createAccount ) - Spacer(modifier = Modifier.height(LocalDimensions.current.itemSpacingSmall)) + Spacer(modifier = Modifier.height(LocalDimensions.current.smallItemSpacing)) PrimaryOutlineButton( stringResource(R.string.onboardingAccountExists), modifier = Modifier @@ -166,7 +166,7 @@ internal fun LandingScreen( .contentDescription(R.string.AccessibilityId_open_url), onClick = { isUrlDialogVisible = true } ) - Spacer(modifier = Modifier.height(LocalDimensions.current.itemSpacingXXSmall)) + Spacer(modifier = Modifier.height(LocalDimensions.current.xxsItemSpacing)) } } } @@ -220,8 +220,8 @@ private fun MessageText( style = large, color = textColor, modifier = Modifier.padding( - horizontal = LocalDimensions.current.itemSpacingSmall, - vertical = LocalDimensions.current.itemSpacingXSmall + horizontal = LocalDimensions.current.smallItemSpacing, + vertical = LocalDimensions.current.xsItemSpacing ) ) } diff --git a/app/src/main/java/org/thoughtcrime/securesms/onboarding/loadaccount/LoadAccount.kt b/app/src/main/java/org/thoughtcrime/securesms/onboarding/loadaccount/LoadAccount.kt index 1ee47d37d8..601bbf14f2 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/onboarding/loadaccount/LoadAccount.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/onboarding/loadaccount/LoadAccount.kt @@ -71,7 +71,7 @@ private fun PreviewRecoveryPassword() { private fun RecoveryPassword(state: State, onChange: (String) -> Unit = {}, onContinue: () -> Unit = {}) { Column { Column( - modifier = Modifier.padding(horizontal = LocalDimensions.current.marginLarge) + modifier = Modifier.padding(horizontal = LocalDimensions.current.largeMargin) .weight(1f) ) { Spacer(Modifier.weight(1f)) @@ -80,18 +80,18 @@ private fun RecoveryPassword(state: State, onChange: (String) -> Unit = {}, onCo stringResource(R.string.sessionRecoveryPassword), style = h4 ) - Spacer(Modifier.width(LocalDimensions.current.itemSpacingXXSmall)) + Spacer(Modifier.width(LocalDimensions.current.xxsItemSpacing)) Icon( painter = painterResource(id = R.drawable.ic_shield_outline), contentDescription = null, ) } - Spacer(Modifier.height(LocalDimensions.current.itemSpacingSmall)) + Spacer(Modifier.height(LocalDimensions.current.smallItemSpacing)) Text( stringResource(R.string.activity_link_enter_your_recovery_password_to_load_your_account_if_you_haven_t_saved_it_you_can_find_it_in_your_app_settings), style = base ) - Spacer(Modifier.height(LocalDimensions.current.itemSpacingMedium)) + Spacer(Modifier.height(LocalDimensions.current.itemSpacing)) SessionOutlinedTextField( text = state.recoveryPhrase, modifier = Modifier diff --git a/app/src/main/java/org/thoughtcrime/securesms/onboarding/loading/Loading.kt b/app/src/main/java/org/thoughtcrime/securesms/onboarding/loading/Loading.kt index 53a7338080..6c7c639a9a 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/onboarding/loading/Loading.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/onboarding/loading/Loading.kt @@ -41,7 +41,7 @@ internal fun LoadingScreen(state: State) { stringResource(R.string.waitOneMoment), style = h7 ) - Spacer(modifier = Modifier.height(LocalDimensions.current.itemSpacingTiny)) + Spacer(modifier = Modifier.height(LocalDimensions.current.xxxsItemSpacing)) Text( stringResource(R.string.loadAccountProgressMessage), style = base diff --git a/app/src/main/java/org/thoughtcrime/securesms/onboarding/messagenotifications/MessageNotifications.kt b/app/src/main/java/org/thoughtcrime/securesms/onboarding/messagenotifications/MessageNotifications.kt index f64a826b4e..b81b8db2f1 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/onboarding/messagenotifications/MessageNotifications.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/onboarding/messagenotifications/MessageNotifications.kt @@ -46,11 +46,11 @@ internal fun MessageNotificationsScreen( Column { Spacer(Modifier.weight(1f)) - Column(modifier = Modifier.padding(horizontal = LocalDimensions.current.marginOnboarding)) { + Column(modifier = Modifier.padding(horizontal = LocalDimensions.current.onboardingMargin)) { Text(stringResource(R.string.notificationsMessage), style = h4) - Spacer(Modifier.height(LocalDimensions.current.marginExtraSmall)) + Spacer(Modifier.height(LocalDimensions.current.xsMargin)) Text(stringResource(R.string.onboardingMessageNotificationExplaination), style = base) - Spacer(Modifier.height(LocalDimensions.current.itemSpacingMedium)) + Spacer(Modifier.height(LocalDimensions.current.itemSpacing)) NotificationRadioButton( R.string.activity_pn_mode_fast_mode, R.string.activity_pn_mode_fast_mode_explanation, @@ -59,7 +59,7 @@ internal fun MessageNotificationsScreen( selected = state.pushEnabled, onClick = { setEnabled(true) } ) - Spacer(Modifier.height(LocalDimensions.current.itemSpacingXSmall)) + Spacer(Modifier.height(LocalDimensions.current.xsItemSpacing)) NotificationRadioButton( R.string.activity_pn_mode_slow_mode, R.string.activity_pn_mode_slow_mode_explanation, @@ -99,7 +99,7 @@ private fun NotificationRadioButton( shape = RoundedCornerShape(8.dp) ) { Column( - verticalArrangement = Arrangement.spacedBy(LocalDimensions.current.itemSpacingXXSmall) + verticalArrangement = Arrangement.spacedBy(LocalDimensions.current.xxsItemSpacing) ) { Text(stringResource(title), style = h8) Text(stringResource(explanation), style = small) diff --git a/app/src/main/java/org/thoughtcrime/securesms/onboarding/pickname/PickDisplayName.kt b/app/src/main/java/org/thoughtcrime/securesms/onboarding/pickname/PickDisplayName.kt index 7a9acb2734..a07b9f773f 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/onboarding/pickname/PickDisplayName.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/onboarding/pickname/PickDisplayName.kt @@ -36,17 +36,17 @@ internal fun DisplayName(state: State, onChange: (String) -> Unit = {}, onContin Column { Column( modifier = Modifier - .padding(horizontal = LocalDimensions.current.marginOnboarding) + .padding(horizontal = LocalDimensions.current.onboardingMargin) .weight(1f) ) { Spacer(modifier = Modifier.weight(1f)) Text(stringResource(state.title), style = h4) - Spacer(Modifier.height(LocalDimensions.current.itemSpacingSmall)) + Spacer(Modifier.height(LocalDimensions.current.smallItemSpacing)) Text( stringResource(state.description), style = base, - modifier = Modifier.padding(bottom = LocalDimensions.current.itemSpacingXSmall)) - Spacer(Modifier.height(LocalDimensions.current.itemSpacingMedium)) + modifier = Modifier.padding(bottom = LocalDimensions.current.xsItemSpacing)) + Spacer(Modifier.height(LocalDimensions.current.itemSpacing)) SessionOutlinedTextField( text = state.displayName, modifier = Modifier diff --git a/app/src/main/java/org/thoughtcrime/securesms/onboarding/ui/ContinueButton.kt b/app/src/main/java/org/thoughtcrime/securesms/onboarding/ui/ContinueButton.kt index 87b104d255..0f5121082f 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/onboarding/ui/ContinueButton.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/onboarding/ui/ContinueButton.kt @@ -17,8 +17,8 @@ fun ContinueButton(modifier: Modifier, onContinue: () -> Unit) { modifier = modifier .contentDescription(R.string.AccessibilityId_continue) .fillMaxWidth() - .padding(horizontal = LocalDimensions.current.marginLarge) - .padding(bottom = LocalDimensions.current.marginExtraExtraSmall), + .padding(horizontal = LocalDimensions.current.largeMargin) + .padding(bottom = LocalDimensions.current.xxsMargin), onClick = onContinue, ) } @@ -29,8 +29,8 @@ fun OnboardingButton(text: String, modifier: Modifier, onClick: () -> Unit) { text, modifier = modifier .fillMaxWidth() - .padding(horizontal = LocalDimensions.current.marginLarge) - .padding(bottom = LocalDimensions.current.marginExtraExtraSmall), + .padding(horizontal = LocalDimensions.current.largeMargin) + .padding(bottom = LocalDimensions.current.xxsMargin), onClick = onClick, ) } diff --git a/app/src/main/java/org/thoughtcrime/securesms/preferences/QRCodeActivity.kt b/app/src/main/java/org/thoughtcrime/securesms/preferences/QRCodeActivity.kt index f074ecf895..f3cd947569 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/preferences/QRCodeActivity.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/preferences/QRCodeActivity.kt @@ -93,13 +93,13 @@ fun QrPage(string: String) { Column( modifier = Modifier .background(LocalColors.current.backgroundSecondary) - .padding(horizontal = LocalDimensions.current.marginMedium) + .padding(horizontal = LocalDimensions.current.margin) .fillMaxSize() ) { QrImage( string = string, modifier = Modifier - .padding(top = LocalDimensions.current.marginMedium, bottom = LocalDimensions.current.marginExtraExtraSmall) + .padding(top = LocalDimensions.current.margin, bottom = LocalDimensions.current.xxsMargin) .contentDescription(R.string.AccessibilityId_qr_code), icon = R.drawable.session ) diff --git a/app/src/main/java/org/thoughtcrime/securesms/preferences/SettingsActivity.kt b/app/src/main/java/org/thoughtcrime/securesms/preferences/SettingsActivity.kt index ada05e67b9..e1eb9f0eef 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/preferences/SettingsActivity.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/preferences/SettingsActivity.kt @@ -387,9 +387,9 @@ class SettingsActivity : PassphraseRequiredActionBarActivity() { Column { Row( modifier = Modifier - .padding(horizontal = LocalDimensions.current.marginSmall) - .padding(top = LocalDimensions.current.marginTiny), - horizontalArrangement = Arrangement.spacedBy(LocalDimensions.current.itemSpacingSmall), + .padding(horizontal = LocalDimensions.current.smallMargin) + .padding(top = LocalDimensions.current.xxxsMargin), + horizontalArrangement = Arrangement.spacedBy(LocalDimensions.current.smallItemSpacing), ) { OutlineButton( stringResource(R.string.share), @@ -403,7 +403,7 @@ class SettingsActivity : PassphraseRequiredActionBarActivity() { ) } - Spacer(modifier = Modifier.height(LocalDimensions.current.itemSpacingMedium)) + Spacer(modifier = Modifier.height(LocalDimensions.current.itemSpacing)) var hasPaths by remember { mutableStateOf(false) diff --git a/app/src/main/java/org/thoughtcrime/securesms/recoverypassword/RecoveryPassword.kt b/app/src/main/java/org/thoughtcrime/securesms/recoverypassword/RecoveryPassword.kt index 2465545a1e..9547710043 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/recoverypassword/RecoveryPassword.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/recoverypassword/RecoveryPassword.kt @@ -47,11 +47,11 @@ internal fun RecoveryPasswordScreen( onHide:() -> Unit = {} ) { Column( - verticalArrangement = Arrangement.spacedBy(LocalDimensions.current.marginExtraSmall), + verticalArrangement = Arrangement.spacedBy(LocalDimensions.current.xsMargin), modifier = Modifier .contentDescription(R.string.AccessibilityId_recovery_password) .verticalScroll(rememberScrollState()) - .padding(bottom = LocalDimensions.current.marginExtraSmall) + .padding(bottom = LocalDimensions.current.xsMargin) ) { RecoveryPasswordCell(seed, copySeed) HideRecoveryPasswordCell(onHide) @@ -71,11 +71,11 @@ private fun RecoveryPasswordCell(seed: String, copySeed:() -> Unit = {}) { stringResource(R.string.sessionRecoveryPassword), style = h8 ) - Spacer(Modifier.width(LocalDimensions.current.itemSpacingXXSmall)) + Spacer(Modifier.width(LocalDimensions.current.xxsItemSpacing)) SessionShieldIcon() } - Spacer(modifier = Modifier.height(LocalDimensions.current.marginTiny)) + Spacer(modifier = Modifier.height(LocalDimensions.current.xxxsMargin)) Text( stringResource(R.string.recoveryPasswordDescription), @@ -93,7 +93,7 @@ private fun RecoveryPasswordCell(seed: String, copySeed:() -> Unit = {}) { QrImage( seed, modifier = Modifier - .padding(vertical = LocalDimensions.current.marginSmall) + .padding(vertical = LocalDimensions.current.smallMargin) .contentDescription(R.string.AccessibilityId_qr_code), icon = R.drawable.session_shield ) @@ -101,7 +101,7 @@ private fun RecoveryPasswordCell(seed: String, copySeed:() -> Unit = {}) { AnimatedVisibility(!showQr) { Row( - horizontalArrangement = Arrangement.spacedBy(LocalDimensions.current.itemSpacingSmall), + horizontalArrangement = Arrangement.spacedBy(LocalDimensions.current.smallItemSpacing), verticalAlignment = Alignment.CenterVertically ) { SlimOutlineCopyButton( @@ -131,9 +131,9 @@ private fun RecoveryPassword(seed: String) { seed, modifier = Modifier .contentDescription(R.string.AccessibilityId_recovery_password_container) - .padding(vertical = LocalDimensions.current.marginSmall) + .padding(vertical = LocalDimensions.current.smallMargin) .border() - .padding(LocalDimensions.current.marginSmall), + .padding(LocalDimensions.current.smallMargin), textAlign = TextAlign.Center, style = extraSmallMonospace, color = LocalColors.current.run { if (isLight) text else primary }, @@ -156,7 +156,7 @@ private fun HideRecoveryPasswordCell(onHide: () -> Unit = {}) { style = base ) } - Spacer(modifier = Modifier.width(LocalDimensions.current.marginExtraExtraSmall)) + Spacer(modifier = Modifier.width(LocalDimensions.current.xxsMargin)) SlimOutlineButton( text = stringResource(R.string.hide), modifier = Modifier diff --git a/app/src/main/java/org/thoughtcrime/securesms/ui/AlertDialog.kt b/app/src/main/java/org/thoughtcrime/securesms/ui/AlertDialog.kt index 998c7b570a..1778018bc8 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/ui/AlertDialog.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/ui/AlertDialog.kt @@ -56,15 +56,15 @@ fun AlertDialog( horizontalAlignment = Alignment.CenterHorizontally, modifier = Modifier .fillMaxWidth() - .padding(top = LocalDimensions.current.itemSpacingSmall) - .padding(horizontal = LocalDimensions.current.itemSpacingSmall) + .padding(top = LocalDimensions.current.smallItemSpacing) + .padding(horizontal = LocalDimensions.current.smallItemSpacing) ) { title?.let { Text( it, textAlign = TextAlign.Center, style = h7, - modifier = Modifier.padding(bottom = LocalDimensions.current.itemSpacingXXSmall) + modifier = Modifier.padding(bottom = LocalDimensions.current.xxsItemSpacing) ) } text?.let { @@ -72,7 +72,7 @@ fun AlertDialog( it, textAlign = TextAlign.Center, style = large, - modifier = Modifier.padding(bottom = LocalDimensions.current.itemSpacingXXSmall) + modifier = Modifier.padding(bottom = LocalDimensions.current.xxsItemSpacing) ) } } @@ -109,8 +109,8 @@ fun DialogButton(text: String, modifier: Modifier, onClick: () -> Unit) { color = LocalColors.current.text, style = largeBold, modifier = Modifier.padding( - top = LocalDimensions.current.itemSpacingSmall, - bottom = LocalDimensions.current.itemSpacingMedium + top = LocalDimensions.current.smallItemSpacing, + bottom = LocalDimensions.current.itemSpacing ) ) } diff --git a/app/src/main/java/org/thoughtcrime/securesms/ui/Components.kt b/app/src/main/java/org/thoughtcrime/securesms/ui/Components.kt index 2c7003f586..f8b97eca6c 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/ui/Components.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/ui/Components.kt @@ -326,7 +326,7 @@ fun Modifier.fadingEdges( @Composable fun Divider(modifier: Modifier = Modifier, startIndent: Dp = 0.dp) { androidx.compose.material.Divider( - modifier = modifier.padding(horizontal = LocalDimensions.current.marginExtraSmall), + modifier = modifier.padding(horizontal = LocalDimensions.current.xsMargin), color = LocalColors.current.divider, startIndent = startIndent ) diff --git a/app/src/main/java/org/thoughtcrime/securesms/ui/Dimensions.kt b/app/src/main/java/org/thoughtcrime/securesms/ui/Dimensions.kt index 77fb5318f4..1e3a209331 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/ui/Dimensions.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/ui/Dimensions.kt @@ -7,23 +7,24 @@ import androidx.compose.ui.unit.dp val LocalDimensions = staticCompositionLocalOf { Dimensions() } data class Dimensions( - val itemSpacingTiny: Dp = 4.dp, - val itemSpacingXXSmall: Dp = 8.dp, - val itemSpacingXSmall: Dp = 12.dp, - val itemSpacingSmall: Dp = 16.dp, - val itemSpacingOnboarding: Dp = 20.dp, - val itemSpacingMedium: Dp = 24.dp, - val marginTiny: Dp = 8.dp, - val marginExtraExtraSmall: Dp = 12.dp, - val marginExtraSmall: Dp = 16.dp, - val marginSmall: Dp = 24.dp, - val marginMedium: Dp = 32.dp, - val marginOnboarding: Dp = 36.dp, - val marginLarge: Dp = 64.dp, + val xxxsItemSpacing: Dp = 4.dp, + val xxsItemSpacing: Dp = 8.dp, + val xsItemSpacing: Dp = 12.dp, + val smallItemSpacing: Dp = 16.dp, + val itemSpacing: Dp = 24.dp, + + val xxxsMargin: Dp = 8.dp, + val xxsMargin: Dp = 12.dp, + val xsMargin: Dp = 16.dp, + val smallMargin: Dp = 24.dp, + val margin: Dp = 32.dp, + val onboardingMargin: Dp = 36.dp, + val largeMargin: Dp = 64.dp, + val homeEmptyViewMargin: Dp = 50.dp, + val dividerIndent: Dp = 80.dp, val appBarHeight: Dp = 64.dp, val minScrollableViewHeight: Dp = 200.dp, - val marginHomeEmptyView: Dp = 50.dp, val indicatorHeight: Dp = 4.dp, val borderStroke: Dp = 1.dp diff --git a/app/src/main/java/org/thoughtcrime/securesms/ui/components/QR.kt b/app/src/main/java/org/thoughtcrime/securesms/ui/components/QR.kt index 810ebe7b16..8b6d78258c 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/ui/components/QR.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/ui/components/QR.kt @@ -95,7 +95,7 @@ fun MaybeScanQrCode( style = base, textAlign = TextAlign.Center ) - Spacer(modifier = Modifier.size(LocalDimensions.current.itemSpacingMedium)) + Spacer(modifier = Modifier.size(LocalDimensions.current.itemSpacing)) OutlineButton( stringResource(R.string.sessionSettings), modifier = Modifier.align(Alignment.CenterHorizontally), @@ -103,7 +103,7 @@ fun MaybeScanQrCode( ) } } else { - Box(modifier = Modifier.fillMaxSize().padding(LocalDimensions.current.marginLarge)) { + Box(modifier = Modifier.fillMaxSize().padding(LocalDimensions.current.largeMargin)) { SlimOutlineButton( stringResource(R.string.cameraGrantAccess), modifier = Modifier @@ -163,11 +163,11 @@ fun ScanQrCode(errors: Flow, onScan: (String) -> Unit) { snackbarHost = { SnackbarHost( hostState = scaffoldState.snackbarHostState, - modifier = Modifier.padding(LocalDimensions.current.itemSpacingSmall) + modifier = Modifier.padding(LocalDimensions.current.smallItemSpacing) ) { data -> Snackbar( snackbarData = data, - modifier = Modifier.padding(LocalDimensions.current.itemSpacingSmall) + modifier = Modifier.padding(LocalDimensions.current.smallItemSpacing) ) } } @@ -181,7 +181,7 @@ fun ScanQrCode(errors: Flow, onScan: (String) -> Unit) { Box( Modifier .aspectRatio(1f) - .padding(LocalDimensions.current.itemSpacingMedium) + .padding(LocalDimensions.current.itemSpacing) .clip(shape = RoundedCornerShape(26.dp)) .background(Color(0x33ffffff)) .align(Alignment.Center) diff --git a/app/src/main/java/org/thoughtcrime/securesms/ui/components/Text.kt b/app/src/main/java/org/thoughtcrime/securesms/ui/components/Text.kt index 083f75a126..ce4e86cfbb 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/ui/components/Text.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/ui/components/Text.kt @@ -66,7 +66,7 @@ fun SessionOutlinedTextField( shape = MaterialTheme.shapes.small ) error?.let { - Spacer(modifier = Modifier.height(LocalDimensions.current.itemSpacingXSmall)) + Spacer(modifier = Modifier.height(LocalDimensions.current.xsItemSpacing)) Text( it, modifier = Modifier.fillMaxWidth(),