mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-27 12:05:22 +00:00
Unifying dimensions and reusing values
This commit is contained in:
parent
6ea535c9c7
commit
1eaf51aee1
@ -104,11 +104,7 @@
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/Theme.Session.DayNight.FlatActionBar" />
|
||||
<activity
|
||||
android:name="org.thoughtcrime.securesms.onboarding.RegisterActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/Theme.Session.DayNight.FlatActionBar" />
|
||||
<activity
|
||||
android:name="org.thoughtcrime.securesms.onboarding.LoadAccountActivity"
|
||||
android:name="org.thoughtcrime.securesms.onboarding.loadaccount.LoadAccountActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="adjustResize"
|
||||
android:theme="@style/Theme.Session.DayNight.FlatActionBar" />
|
||||
|
@ -14,6 +14,7 @@ import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.wrapContentHeight
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material.MaterialTheme
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
@ -29,6 +30,7 @@ import network.loki.messenger.R
|
||||
import org.session.libsession.utilities.TextSecurePreferences
|
||||
import org.thoughtcrime.securesms.preferences.copyPublicKey
|
||||
import org.thoughtcrime.securesms.preferences.sendInvitationToUseSession
|
||||
import org.thoughtcrime.securesms.ui.LocalDimensions
|
||||
import org.thoughtcrime.securesms.ui.color.LocalColors
|
||||
import org.thoughtcrime.securesms.ui.PreviewTheme
|
||||
import org.thoughtcrime.securesms.ui.base
|
||||
@ -84,7 +86,7 @@ private fun InviteFriend(
|
||||
.border(
|
||||
width = 1.dp,
|
||||
color = LocalColors.current.textSecondary,
|
||||
shape = RoundedCornerShape(size = 13.dp)
|
||||
shape = MaterialTheme.shapes.small
|
||||
)
|
||||
.fillMaxWidth()
|
||||
.wrapContentHeight()
|
||||
|
@ -64,6 +64,7 @@ import org.thoughtcrime.securesms.ui.Divider
|
||||
import org.thoughtcrime.securesms.ui.GetString
|
||||
import org.thoughtcrime.securesms.ui.HorizontalPagerIndicator
|
||||
import org.thoughtcrime.securesms.ui.ItemButton
|
||||
import org.thoughtcrime.securesms.ui.LocalDimensions
|
||||
import org.thoughtcrime.securesms.ui.color.LocalColors
|
||||
import org.thoughtcrime.securesms.ui.PreviewTheme
|
||||
import org.thoughtcrime.securesms.ui.color.Colors
|
||||
@ -338,7 +339,7 @@ fun FileDetails(fileDetails: List<TitledText>) {
|
||||
|
||||
CellWithPaddingAndMargin(padding = 0.dp) {
|
||||
FlowRow(
|
||||
modifier = Modifier.padding(vertical = 24.dp, horizontal = 12.dp),
|
||||
modifier = Modifier.padding(vertical = 24.dp, horizontal = LocalDimensions.current.itemSpacingXSmall),
|
||||
verticalArrangement = Arrangement.spacedBy(16.dp)
|
||||
) {
|
||||
fileDetails.forEach {
|
||||
@ -347,7 +348,7 @@ fun FileDetails(fileDetails: List<TitledText>) {
|
||||
it,
|
||||
modifier = Modifier
|
||||
.widthIn(min = maxWidth.div(2))
|
||||
.padding(horizontal = 12.dp)
|
||||
.padding(horizontal = LocalDimensions.current.itemSpacingXSmall)
|
||||
.width(IntrinsicSize.Max)
|
||||
)
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ internal fun EmptyView(newAccount: Boolean) {
|
||||
stringResource(R.string.conversationsNone),
|
||||
style = h8,
|
||||
textAlign = TextAlign.Center,
|
||||
modifier = Modifier.padding(bottom = 12.dp))
|
||||
modifier = Modifier.padding(bottom = LocalDimensions.current.itemSpacingXSmall))
|
||||
Text(
|
||||
stringResource(R.string.onboardingHitThePlusButton),
|
||||
style = small,
|
||||
|
@ -54,7 +54,7 @@ internal fun SeedReminder(startRecoveryPasswordActivity: () -> Unit) {
|
||||
stringResource(R.string.save_your_recovery_password),
|
||||
style = h8
|
||||
)
|
||||
Spacer(Modifier.requiredWidth(LocalDimensions.current.itemSpacingExtraSmall))
|
||||
Spacer(Modifier.requiredWidth(LocalDimensions.current.itemSpacingXXSmall))
|
||||
SessionShieldIcon()
|
||||
}
|
||||
Text(
|
||||
|
@ -18,6 +18,7 @@ import androidx.compose.foundation.lazy.items
|
||||
import androidx.compose.foundation.lazy.rememberLazyListState
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material.Card
|
||||
import androidx.compose.material.MaterialTheme
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
@ -148,7 +149,7 @@ internal fun LandingScreen(
|
||||
.contentDescription(R.string.AccessibilityId_create_account_button),
|
||||
onClick = createAccount
|
||||
)
|
||||
Spacer(modifier = Modifier.height(LocalDimensions.current.itemSpacingExtraSmall))
|
||||
Spacer(modifier = Modifier.height(LocalDimensions.current.itemSpacingSmall))
|
||||
PrimaryOutlineButton(
|
||||
stringResource(R.string.onboardingAccountExists),
|
||||
modifier = Modifier
|
||||
@ -165,7 +166,7 @@ internal fun LandingScreen(
|
||||
.contentDescription(R.string.AccessibilityId_open_url),
|
||||
onClick = { isUrlDialogVisible = true }
|
||||
)
|
||||
Spacer(modifier = Modifier.height(LocalDimensions.current.itemSpacingExtraSmall))
|
||||
Spacer(modifier = Modifier.height(LocalDimensions.current.itemSpacingXXSmall))
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -210,7 +211,7 @@ private fun MessageText(
|
||||
) {
|
||||
Card(
|
||||
modifier = modifier.fillMaxWidth(0.666f),
|
||||
shape = RoundedCornerShape(size = 13.dp),
|
||||
shape = MaterialTheme.shapes.small,
|
||||
backgroundColor = color,
|
||||
elevation = 0.dp
|
||||
) {
|
||||
@ -218,7 +219,10 @@ private fun MessageText(
|
||||
text,
|
||||
style = large,
|
||||
color = textColor,
|
||||
modifier = Modifier.padding(horizontal = 16.dp, vertical = 12.dp)
|
||||
modifier = Modifier.padding(
|
||||
horizontal = LocalDimensions.current.itemSpacingSmall,
|
||||
vertical = LocalDimensions.current.itemSpacingXSmall
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.layout.width
|
||||
@ -85,12 +86,12 @@ private fun RecoveryPassword(state: State, onChange: (String) -> Unit = {}, onCo
|
||||
contentDescription = null,
|
||||
)
|
||||
}
|
||||
Spacer(Modifier.size(28.dp))
|
||||
Spacer(Modifier.height(LocalDimensions.current.itemSpacingSmall))
|
||||
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.size(24.dp))
|
||||
Spacer(Modifier.height(LocalDimensions.current.itemSpacingMedium))
|
||||
SessionOutlinedTextField(
|
||||
text = state.recoveryPhrase,
|
||||
modifier = Modifier
|
||||
|
@ -8,6 +8,7 @@ import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material.ButtonDefaults
|
||||
import androidx.compose.material.RadioButton
|
||||
@ -49,7 +50,7 @@ internal fun MessageNotificationsScreen(
|
||||
Text(stringResource(R.string.notificationsMessage), style = h4)
|
||||
Spacer(Modifier.height(LocalDimensions.current.marginExtraSmall))
|
||||
Text(stringResource(R.string.onboardingMessageNotificationExplaination), style = base)
|
||||
Spacer(Modifier.height(LocalDimensions.current.marginExtraSmall))
|
||||
Spacer(Modifier.height(LocalDimensions.current.itemSpacingMedium))
|
||||
NotificationRadioButton(
|
||||
R.string.activity_pn_mode_fast_mode,
|
||||
R.string.activity_pn_mode_fast_mode_explanation,
|
||||
@ -58,7 +59,7 @@ internal fun MessageNotificationsScreen(
|
||||
selected = state.pushEnabled,
|
||||
onClick = { setEnabled(true) }
|
||||
)
|
||||
Spacer(Modifier.height(LocalDimensions.current.marginExtraSmall))
|
||||
Spacer(Modifier.height(LocalDimensions.current.itemSpacingXSmall))
|
||||
NotificationRadioButton(
|
||||
R.string.activity_pn_mode_slow_mode,
|
||||
R.string.activity_pn_mode_slow_mode_explanation,
|
||||
|
@ -4,7 +4,9 @@ import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
@ -33,18 +35,18 @@ private fun PreviewDisplayName() {
|
||||
internal fun DisplayName(state: State, onChange: (String) -> Unit = {}, onContinue: () -> Unit = {}) {
|
||||
Column {
|
||||
Column(
|
||||
verticalArrangement = Arrangement.spacedBy(LocalDimensions.current.itemSpacingOnboarding),
|
||||
modifier = Modifier
|
||||
.padding(horizontal = LocalDimensions.current.marginOnboarding)
|
||||
.weight(1f)
|
||||
) {
|
||||
Spacer(modifier = Modifier.weight(1f))
|
||||
Text(stringResource(state.title), style = h4)
|
||||
Spacer(Modifier.height(LocalDimensions.current.itemSpacingSmall))
|
||||
Text(
|
||||
stringResource(state.description),
|
||||
style = base,
|
||||
modifier = Modifier.padding(bottom = 12.dp))
|
||||
|
||||
modifier = Modifier.padding(bottom = LocalDimensions.current.itemSpacingXSmall))
|
||||
Spacer(Modifier.height(LocalDimensions.current.itemSpacingMedium))
|
||||
SessionOutlinedTextField(
|
||||
text = state.displayName,
|
||||
modifier = Modifier
|
||||
|
@ -13,6 +13,7 @@ import androidx.compose.foundation.layout.wrapContentWidth
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.material.MaterialTheme
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
@ -73,7 +74,7 @@ private fun RecoveryPasswordCell(seed: String, copySeed:() -> Unit = {}) {
|
||||
stringResource(R.string.sessionRecoveryPassword),
|
||||
style = h8
|
||||
)
|
||||
Spacer(Modifier.width(LocalDimensions.current.itemSpacingExtraSmall))
|
||||
Spacer(Modifier.width(LocalDimensions.current.itemSpacingXXSmall))
|
||||
SessionShieldIcon()
|
||||
}
|
||||
|
||||
@ -137,7 +138,7 @@ private fun RecoveryPassword(seed: String) {
|
||||
.border(
|
||||
width = 1.dp,
|
||||
color = LocalColors.current.borders,
|
||||
shape = RoundedCornerShape(11.dp)
|
||||
shape = MaterialTheme.shapes.small
|
||||
)
|
||||
.padding(LocalDimensions.current.marginSmall),
|
||||
textAlign = TextAlign.Center,
|
||||
|
@ -8,6 +8,7 @@ import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material.Icon
|
||||
import androidx.compose.material.IconButton
|
||||
import androidx.compose.material.MaterialTheme
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.material.TextButton
|
||||
import androidx.compose.runtime.Composable
|
||||
@ -35,7 +36,7 @@ fun AlertDialog(
|
||||
) {
|
||||
androidx.compose.material.AlertDialog(
|
||||
onDismissRequest,
|
||||
shape = RoundedCornerShape(12.dp),
|
||||
shape = MaterialTheme.shapes.small,
|
||||
backgroundColor = LocalColors.current.backgroundSecondary,
|
||||
buttons = {
|
||||
Box {
|
||||
|
@ -23,6 +23,7 @@ import androidx.compose.material.Icon
|
||||
import androidx.compose.material.IconButton
|
||||
import androidx.compose.material.LocalContentAlpha
|
||||
import androidx.compose.material.LocalContentColor
|
||||
import androidx.compose.material.MaterialTheme
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.rememberCoroutineScope
|
||||
@ -46,7 +47,7 @@ import kotlin.math.sign
|
||||
@Composable
|
||||
fun BoxScope.HorizontalPagerIndicator(pagerState: PagerState) {
|
||||
if (pagerState.pageCount >= 2) Card(
|
||||
shape = RoundedCornerShape(50.dp),
|
||||
shape = MaterialTheme.shapes.large,
|
||||
backgroundColor = Color.Black.copy(alpha = 0.4f),
|
||||
modifier = Modifier
|
||||
.align(Alignment.BottomCenter)
|
||||
|
@ -31,6 +31,7 @@ import androidx.compose.material.Card
|
||||
import androidx.compose.material.CircularProgressIndicator
|
||||
import androidx.compose.material.Icon
|
||||
import androidx.compose.material.LocalContentColor
|
||||
import androidx.compose.material.MaterialTheme
|
||||
import androidx.compose.material.RadioButton
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.material.TextButton
|
||||
@ -213,7 +214,7 @@ fun CellWithPaddingAndMargin(
|
||||
) {
|
||||
Card(
|
||||
backgroundColor = LocalColors.current.backgroundSecondary,
|
||||
shape = RoundedCornerShape(16.dp),
|
||||
shape = MaterialTheme.shapes.medium,
|
||||
elevation = 0.dp,
|
||||
modifier = Modifier
|
||||
.wrapContentHeight()
|
||||
|
@ -8,7 +8,8 @@ val LocalDimensions = staticCompositionLocalOf { Dimensions() }
|
||||
|
||||
data class Dimensions(
|
||||
val itemSpacingTiny: Dp = 4.dp,
|
||||
val itemSpacingExtraSmall: Dp = 8.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,
|
||||
|
@ -14,6 +14,7 @@ import androidx.compose.runtime.CompositionLocalProvider
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.tooling.preview.PreviewParameterProvider
|
||||
import androidx.compose.ui.unit.dp
|
||||
import org.session.libsession.utilities.AppTextSecurePreferences
|
||||
import org.thoughtcrime.securesms.ui.color.ClassicDark
|
||||
import org.thoughtcrime.securesms.ui.color.ClassicLight
|
||||
@ -80,7 +81,9 @@ private fun Colors.toMaterialColors() = androidx.compose.material.Colors(
|
||||
@Composable private fun Context.colors() = AppTextSecurePreferences(this).colors()
|
||||
|
||||
val sessionShapes = Shapes(
|
||||
small = RoundedCornerShape(50)
|
||||
small = RoundedCornerShape(12.dp),
|
||||
medium = RoundedCornerShape(16.dp),
|
||||
large = RoundedCornerShape(50.dp)
|
||||
)
|
||||
|
||||
/**
|
||||
|
@ -61,7 +61,7 @@ fun Button(
|
||||
modifier: Modifier = Modifier,
|
||||
enabled: Boolean = true,
|
||||
size: ButtonStyle = ButtonStyle.Large,
|
||||
shape: Shape = MaterialTheme.shapes.small,
|
||||
shape: Shape = MaterialTheme.shapes.large,
|
||||
border: BorderStroke? = type.border(color, enabled),
|
||||
colors: ButtonColors = type.buttonColors(color),
|
||||
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
|
||||
@ -98,7 +98,7 @@ fun Button(
|
||||
modifier: Modifier = Modifier,
|
||||
enabled: Boolean = true,
|
||||
size: ButtonStyle = ButtonStyle.Large,
|
||||
shape: Shape = MaterialTheme.shapes.small,
|
||||
shape: Shape = MaterialTheme.shapes.large,
|
||||
border: BorderStroke? = type.border(color, enabled),
|
||||
colors: ButtonColors = type.buttonColors(color),
|
||||
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
|
||||
|
@ -182,7 +182,7 @@ fun ScanQrCode(errors: Flow<String>, onScan: (String) -> Unit) {
|
||||
Modifier
|
||||
.aspectRatio(1f)
|
||||
.padding(20.dp)
|
||||
.clip(shape = RoundedCornerShape(20.dp))
|
||||
.clip(shape = RoundedCornerShape(26.dp))
|
||||
.background(Color(0x33ffffff))
|
||||
.align(Alignment.Center)
|
||||
)
|
||||
|
@ -12,6 +12,7 @@ import androidx.compose.foundation.text.InlineTextContent
|
||||
import androidx.compose.foundation.text.KeyboardActions
|
||||
import androidx.compose.foundation.text.appendInlineContent
|
||||
import androidx.compose.material.Icon
|
||||
import androidx.compose.material.MaterialTheme
|
||||
import androidx.compose.material.OutlinedTextField
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
@ -26,6 +27,7 @@ import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.unit.TextUnit
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import org.thoughtcrime.securesms.ui.LocalDimensions
|
||||
import org.thoughtcrime.securesms.ui.base
|
||||
import org.thoughtcrime.securesms.ui.baseBold
|
||||
import org.thoughtcrime.securesms.ui.color.LocalColors
|
||||
@ -61,7 +63,7 @@ fun SessionOutlinedTextField(
|
||||
onSend = { onContinue() },
|
||||
),
|
||||
isError = error != null,
|
||||
shape = RoundedCornerShape(12.dp)
|
||||
shape = MaterialTheme.shapes.small
|
||||
)
|
||||
error?.let {
|
||||
Spacer(modifier = Modifier.height(14.dp))
|
||||
|
Loading…
Reference in New Issue
Block a user