mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-23 18:15:22 +00:00
Standardise margins
This commit is contained in:
parent
e2eea61c68
commit
2341685fd3
@ -94,7 +94,7 @@ class LandingActivity: BaseActionBarActivity() {
|
|||||||
|
|
||||||
@Preview
|
@Preview
|
||||||
@Composable
|
@Composable
|
||||||
private fun LandingScreen(
|
private fun PreviewLandingScreen(
|
||||||
@PreviewParameter(SessionColorsParameterProvider::class) colors: Colors
|
@PreviewParameter(SessionColorsParameterProvider::class) colors: Colors
|
||||||
) {
|
) {
|
||||||
PreviewTheme(colors) {
|
PreviewTheme(colors) {
|
||||||
@ -119,7 +119,8 @@ class LandingActivity: BaseActionBarActivity() {
|
|||||||
Column {
|
Column {
|
||||||
Column(modifier = Modifier
|
Column(modifier = Modifier
|
||||||
.weight(1f)
|
.weight(1f)
|
||||||
.padding(horizontal = LocalDimensions.current.marginMedium)) {
|
.padding(horizontal = LocalDimensions.current.marginOnboarding)
|
||||||
|
) {
|
||||||
Spacer(modifier = Modifier.weight(1f))
|
Spacer(modifier = Modifier.weight(1f))
|
||||||
Text(
|
Text(
|
||||||
stringResource(R.string.onboardingBubblePrivacyInYourPocket),
|
stringResource(R.string.onboardingBubblePrivacyInYourPocket),
|
||||||
@ -132,7 +133,7 @@ class LandingActivity: BaseActionBarActivity() {
|
|||||||
LazyColumn(
|
LazyColumn(
|
||||||
state = listState,
|
state = listState,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.heightIn(min = 200.dp)
|
.heightIn(min = LocalDimensions.current.minScrollableViewHeight)
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.weight(3f),
|
.weight(3f),
|
||||||
verticalArrangement = Arrangement.spacedBy(LocalDimensions.current.itemSpacingSmall)
|
verticalArrangement = Arrangement.spacedBy(LocalDimensions.current.itemSpacingSmall)
|
||||||
|
@ -32,6 +32,7 @@ import org.session.libsession.utilities.TextSecurePreferences
|
|||||||
import org.thoughtcrime.securesms.BaseActionBarActivity
|
import org.thoughtcrime.securesms.BaseActionBarActivity
|
||||||
import org.thoughtcrime.securesms.onboarding.loading.LoadingManager
|
import org.thoughtcrime.securesms.onboarding.loading.LoadingManager
|
||||||
import org.thoughtcrime.securesms.onboarding.messagenotifications.startMessageNotificationsActivity
|
import org.thoughtcrime.securesms.onboarding.messagenotifications.startMessageNotificationsActivity
|
||||||
|
import org.thoughtcrime.securesms.onboarding.ui.ContinueButton
|
||||||
import org.thoughtcrime.securesms.ui.LocalDimensions
|
import org.thoughtcrime.securesms.ui.LocalDimensions
|
||||||
import org.thoughtcrime.securesms.ui.PreviewTheme
|
import org.thoughtcrime.securesms.ui.PreviewTheme
|
||||||
import org.thoughtcrime.securesms.ui.base
|
import org.thoughtcrime.securesms.ui.base
|
||||||
@ -116,45 +117,43 @@ fun PreviewRecoveryPassword() {
|
|||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun RecoveryPassword(state: LinkDeviceState, onChange: (String) -> Unit = {}, onContinue: () -> Unit = {}) {
|
fun RecoveryPassword(state: LinkDeviceState, onChange: (String) -> Unit = {}, onContinue: () -> Unit = {}) {
|
||||||
Column(
|
Column {
|
||||||
modifier = Modifier.padding(horizontal = LocalDimensions.current.marginLarge)
|
Column(
|
||||||
) {
|
modifier = Modifier.padding(horizontal = LocalDimensions.current.marginLarge)
|
||||||
Spacer(Modifier.weight(1f))
|
.weight(1f)
|
||||||
Row {
|
) {
|
||||||
|
Spacer(Modifier.weight(1f))
|
||||||
|
Row {
|
||||||
|
Text(
|
||||||
|
stringResource(R.string.sessionRecoveryPassword),
|
||||||
|
style = h4
|
||||||
|
)
|
||||||
|
Spacer(Modifier.width(6.dp))
|
||||||
|
Icon(
|
||||||
|
painter = painterResource(id = R.drawable.ic_shield_outline),
|
||||||
|
contentDescription = null,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
Spacer(Modifier.size(28.dp))
|
||||||
Text(
|
Text(
|
||||||
stringResource(R.string.sessionRecoveryPassword),
|
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 = h4
|
style = base
|
||||||
)
|
)
|
||||||
Spacer(Modifier.width(6.dp))
|
Spacer(Modifier.size(24.dp))
|
||||||
Icon(
|
SessionOutlinedTextField(
|
||||||
painter = painterResource(id = R.drawable.ic_shield_outline),
|
text = state.recoveryPhrase,
|
||||||
contentDescription = null,
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.contentDescription(R.string.AccessibilityId_recovery_phrase_input),
|
||||||
|
placeholder = stringResource(R.string.recoveryPasswordEnter),
|
||||||
|
onChange = onChange,
|
||||||
|
onContinue = onContinue,
|
||||||
|
error = state.error
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Spacer(Modifier.weight(2f))
|
||||||
}
|
}
|
||||||
Spacer(Modifier.size(28.dp))
|
|
||||||
Text(
|
ContinueButton(modifier = Modifier.align(Alignment.CenterHorizontally), onContinue)
|
||||||
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.size(24.dp))
|
|
||||||
SessionOutlinedTextField(
|
|
||||||
text = state.recoveryPhrase,
|
|
||||||
modifier = Modifier
|
|
||||||
.fillMaxWidth()
|
|
||||||
.contentDescription(R.string.AccessibilityId_recovery_phrase_input),
|
|
||||||
placeholder = stringResource(R.string.recoveryPasswordEnter),
|
|
||||||
onChange = onChange,
|
|
||||||
onContinue = onContinue,
|
|
||||||
error = state.error
|
|
||||||
)
|
|
||||||
Spacer(Modifier.weight(2f))
|
|
||||||
OutlineButton(
|
|
||||||
stringResource(R.string.continue_2),
|
|
||||||
modifier = Modifier
|
|
||||||
.align(Alignment.CenterHorizontally)
|
|
||||||
.padding(vertical = 20.dp)
|
|
||||||
.fillMaxWidth(),
|
|
||||||
onClick = onContinue
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@ import androidx.compose.ui.res.stringResource
|
|||||||
import androidx.compose.ui.tooling.preview.Preview
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
import androidx.compose.ui.tooling.preview.PreviewParameter
|
import androidx.compose.ui.tooling.preview.PreviewParameter
|
||||||
import network.loki.messenger.R
|
import network.loki.messenger.R
|
||||||
|
import org.thoughtcrime.securesms.onboarding.ui.ContinueButton
|
||||||
import org.thoughtcrime.securesms.ui.LocalDimensions
|
import org.thoughtcrime.securesms.ui.LocalDimensions
|
||||||
import org.thoughtcrime.securesms.ui.PreviewTheme
|
import org.thoughtcrime.securesms.ui.PreviewTheme
|
||||||
import org.thoughtcrime.securesms.ui.SessionColorsParameterProvider
|
import org.thoughtcrime.securesms.ui.SessionColorsParameterProvider
|
||||||
@ -42,7 +43,8 @@ fun MessageNotificationsScreen(
|
|||||||
) {
|
) {
|
||||||
Column {
|
Column {
|
||||||
Spacer(Modifier.weight(1f))
|
Spacer(Modifier.weight(1f))
|
||||||
Column(modifier = Modifier.padding(horizontal = LocalDimensions.current.marginMedium)) {
|
|
||||||
|
Column(modifier = Modifier.padding(horizontal = LocalDimensions.current.marginOnboarding)) {
|
||||||
Text(stringResource(R.string.notificationsMessage), style = h4)
|
Text(stringResource(R.string.notificationsMessage), style = h4)
|
||||||
Spacer(Modifier.height(LocalDimensions.current.marginExtraSmall))
|
Spacer(Modifier.height(LocalDimensions.current.marginExtraSmall))
|
||||||
Text(stringResource(R.string.onboardingMessageNotificationExplaination), style = base)
|
Text(stringResource(R.string.onboardingMessageNotificationExplaination), style = base)
|
||||||
@ -64,16 +66,9 @@ fun MessageNotificationsScreen(
|
|||||||
onClick = { setEnabled(false) }
|
onClick = { setEnabled(false) }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
Spacer(Modifier.weight(1f))
|
Spacer(Modifier.weight(1f))
|
||||||
OutlineButton(
|
|
||||||
stringResource(R.string.continue_2),
|
ContinueButton(Modifier.align(Alignment.CenterHorizontally), onContinue)
|
||||||
modifier = Modifier
|
|
||||||
.padding(horizontal = LocalDimensions.current.marginLarge)
|
|
||||||
.contentDescription(R.string.AccessibilityId_continue)
|
|
||||||
.align(Alignment.CenterHorizontally)
|
|
||||||
.fillMaxWidth(),
|
|
||||||
onClick = onContinue
|
|
||||||
)
|
|
||||||
Spacer(modifier = Modifier.height(LocalDimensions.current.marginExtraExtraSmall))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,6 @@ import androidx.compose.foundation.layout.Column
|
|||||||
import androidx.compose.foundation.layout.Spacer
|
import androidx.compose.foundation.layout.Spacer
|
||||||
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.layout.width
|
|
||||||
import androidx.compose.material.Text
|
import androidx.compose.material.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
@ -14,9 +13,10 @@ 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 network.loki.messenger.R
|
import network.loki.messenger.R
|
||||||
|
import org.thoughtcrime.securesms.onboarding.ui.ContinueButton
|
||||||
|
import org.thoughtcrime.securesms.ui.LocalDimensions
|
||||||
import org.thoughtcrime.securesms.ui.PreviewTheme
|
import org.thoughtcrime.securesms.ui.PreviewTheme
|
||||||
import org.thoughtcrime.securesms.ui.base
|
import org.thoughtcrime.securesms.ui.base
|
||||||
import org.thoughtcrime.securesms.ui.components.OutlineButton
|
|
||||||
import org.thoughtcrime.securesms.ui.components.SessionOutlinedTextField
|
import org.thoughtcrime.securesms.ui.components.SessionOutlinedTextField
|
||||||
import org.thoughtcrime.securesms.ui.contentDescription
|
import org.thoughtcrime.securesms.ui.contentDescription
|
||||||
import org.thoughtcrime.securesms.ui.h4
|
import org.thoughtcrime.securesms.ui.h4
|
||||||
@ -31,39 +31,34 @@ fun PreviewDisplayName() {
|
|||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun DisplayName(state: State, onChange: (String) -> Unit = {}, onContinue: () -> Unit = {}) {
|
fun DisplayName(state: State, onChange: (String) -> Unit = {}, onContinue: () -> Unit = {}) {
|
||||||
Column(
|
Column {
|
||||||
verticalArrangement = Arrangement.spacedBy(20.dp),
|
Column(
|
||||||
modifier = Modifier
|
verticalArrangement = Arrangement.spacedBy(LocalDimensions.current.itemSpacingOnboarding),
|
||||||
.padding(horizontal = 50.dp)
|
|
||||||
.padding(bottom = 12.dp)
|
|
||||||
) {
|
|
||||||
Spacer(modifier = Modifier.weight(1f))
|
|
||||||
Text(stringResource(state.title), style = h4)
|
|
||||||
Text(
|
|
||||||
stringResource(state.description),
|
|
||||||
style = base,
|
|
||||||
modifier = Modifier.padding(bottom = 12.dp))
|
|
||||||
|
|
||||||
SessionOutlinedTextField(
|
|
||||||
text = state.displayName,
|
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.padding(horizontal = LocalDimensions.current.marginOnboarding)
|
||||||
.contentDescription(R.string.AccessibilityId_enter_display_name),
|
.weight(1f)
|
||||||
placeholder = stringResource(R.string.displayNameEnter),
|
) {
|
||||||
onChange = onChange,
|
Spacer(modifier = Modifier.weight(1f))
|
||||||
onContinue = onContinue,
|
Text(stringResource(state.title), style = h4)
|
||||||
error = state.error?.let { stringResource(it) }
|
Text(
|
||||||
)
|
stringResource(state.description),
|
||||||
|
style = base,
|
||||||
|
modifier = Modifier.padding(bottom = 12.dp))
|
||||||
|
|
||||||
Spacer(modifier = Modifier.weight(2f))
|
SessionOutlinedTextField(
|
||||||
|
text = state.displayName,
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.contentDescription(R.string.AccessibilityId_enter_display_name),
|
||||||
|
placeholder = stringResource(R.string.displayNameEnter),
|
||||||
|
onChange = onChange,
|
||||||
|
onContinue = onContinue,
|
||||||
|
error = state.error?.let { stringResource(it) }
|
||||||
|
)
|
||||||
|
|
||||||
OutlineButton(
|
Spacer(modifier = Modifier.weight(2f))
|
||||||
stringResource(R.string.continue_2),
|
}
|
||||||
modifier = Modifier
|
|
||||||
.contentDescription(R.string.AccessibilityId_continue)
|
ContinueButton(Modifier.align(Alignment.CenterHorizontally), onContinue)
|
||||||
.align(Alignment.CenterHorizontally)
|
|
||||||
.width(262.dp),
|
|
||||||
onClick = onContinue,
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,6 @@ import org.thoughtcrime.securesms.ui.contentDescription
|
|||||||
import org.thoughtcrime.securesms.ui.extraSmallMonospace
|
import org.thoughtcrime.securesms.ui.extraSmallMonospace
|
||||||
import org.thoughtcrime.securesms.ui.h8
|
import org.thoughtcrime.securesms.ui.h8
|
||||||
|
|
||||||
|
|
||||||
@Preview
|
@Preview
|
||||||
@Composable
|
@Composable
|
||||||
fun PreviewRecoveryPasswordScreen(
|
fun PreviewRecoveryPasswordScreen(
|
||||||
|
@ -0,0 +1,36 @@
|
|||||||
|
package org.thoughtcrime.securesms.onboarding.ui
|
||||||
|
|
||||||
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
|
import androidx.compose.foundation.layout.padding
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.res.stringResource
|
||||||
|
import network.loki.messenger.R
|
||||||
|
import org.thoughtcrime.securesms.ui.LocalDimensions
|
||||||
|
import org.thoughtcrime.securesms.ui.components.OutlineButton
|
||||||
|
import org.thoughtcrime.securesms.ui.contentDescription
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun ContinueButton(modifier: Modifier, onContinue: () -> Unit) {
|
||||||
|
OutlineButton(
|
||||||
|
stringResource(R.string.continue_2),
|
||||||
|
modifier = modifier
|
||||||
|
.contentDescription(R.string.AccessibilityId_continue)
|
||||||
|
.fillMaxWidth()
|
||||||
|
.padding(horizontal = LocalDimensions.current.marginLarge)
|
||||||
|
.padding(bottom = LocalDimensions.current.marginExtraExtraSmall),
|
||||||
|
onClick = onContinue,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun OnboardingButton(text: String, modifier: Modifier, onClick: () -> Unit) {
|
||||||
|
OutlineButton(
|
||||||
|
text,
|
||||||
|
modifier = modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.padding(horizontal = LocalDimensions.current.marginLarge)
|
||||||
|
.padding(bottom = LocalDimensions.current.marginExtraExtraSmall),
|
||||||
|
onClick = onClick,
|
||||||
|
)
|
||||||
|
}
|
@ -10,13 +10,16 @@ data class Dimensions(
|
|||||||
val itemSpacingTiny: Dp = 4.dp,
|
val itemSpacingTiny: Dp = 4.dp,
|
||||||
val itemSpacingExtraSmall: Dp = 8.dp,
|
val itemSpacingExtraSmall: Dp = 8.dp,
|
||||||
val itemSpacingSmall: Dp = 16.dp,
|
val itemSpacingSmall: Dp = 16.dp,
|
||||||
|
val itemSpacingOnboarding: Dp = 20.dp,
|
||||||
val itemSpacingMedium: Dp = 24.dp,
|
val itemSpacingMedium: Dp = 24.dp,
|
||||||
val marginTiny: Dp = 8.dp,
|
val marginTiny: Dp = 8.dp,
|
||||||
val marginExtraExtraSmall: Dp = 12.dp,
|
val marginExtraExtraSmall: Dp = 12.dp,
|
||||||
val marginExtraSmall: Dp = 16.dp,
|
val marginExtraSmall: Dp = 16.dp,
|
||||||
val marginSmall: Dp = 24.dp,
|
val marginSmall: Dp = 24.dp,
|
||||||
val marginMedium: Dp = 32.dp,
|
val marginMedium: Dp = 32.dp,
|
||||||
|
val marginOnboarding: Dp = 36.dp,
|
||||||
val marginLarge: Dp = 64.dp,
|
val marginLarge: Dp = 64.dp,
|
||||||
val dividerIndent: Dp = 80.dp,
|
val dividerIndent: Dp = 80.dp,
|
||||||
val appBarHeight: Dp = 64.dp
|
val appBarHeight: Dp = 64.dp,
|
||||||
|
val minScrollableViewHeight: Dp = 200.dp
|
||||||
)
|
)
|
||||||
|
@ -50,7 +50,6 @@ import org.thoughtcrime.securesms.ui.baseBold
|
|||||||
import org.thoughtcrime.securesms.ui.color.Colors
|
import org.thoughtcrime.securesms.ui.color.Colors
|
||||||
import org.thoughtcrime.securesms.ui.color.LocalColors
|
import org.thoughtcrime.securesms.ui.color.LocalColors
|
||||||
import org.thoughtcrime.securesms.ui.color.radioButtonColors
|
import org.thoughtcrime.securesms.ui.color.radioButtonColors
|
||||||
import org.thoughtcrime.securesms.ui.color.slimOutlineButton
|
|
||||||
import org.thoughtcrime.securesms.ui.contentDescription
|
import org.thoughtcrime.securesms.ui.contentDescription
|
||||||
import org.thoughtcrime.securesms.ui.extraSmall
|
import org.thoughtcrime.securesms.ui.extraSmall
|
||||||
import org.thoughtcrime.securesms.ui.h8
|
import org.thoughtcrime.securesms.ui.h8
|
||||||
|
Loading…
Reference in New Issue
Block a user