mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-24 16:57:50 +00:00
Cleaning up more dimensions
This commit is contained in:
parent
b24d331cc5
commit
96d09f3367
@ -10,7 +10,9 @@ import androidx.compose.foundation.layout.Arrangement.Absolute.spacedBy
|
||||
import androidx.compose.foundation.layout.Box
|
||||
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.wrapContentHeight
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
@ -39,6 +41,7 @@ import org.thoughtcrime.securesms.ui.components.SlimOutlineButton
|
||||
import org.thoughtcrime.securesms.ui.components.SlimOutlineCopyButton
|
||||
import org.thoughtcrime.securesms.ui.contentDescription
|
||||
import org.thoughtcrime.securesms.ui.createThemedComposeView
|
||||
import org.thoughtcrime.securesms.ui.extraSmallMonospace
|
||||
import org.thoughtcrime.securesms.ui.small
|
||||
|
||||
@AndroidEntryPoint
|
||||
@ -78,39 +81,36 @@ private 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 = 24.dp),
|
||||
verticalArrangement = spacedBy(10.dp)
|
||||
modifier = Modifier.padding(horizontal = LocalDimensions.current.itemSpacingMedium),
|
||||
) {
|
||||
Box(
|
||||
Text(
|
||||
accountId,
|
||||
modifier = Modifier
|
||||
.contentDescription(R.string.AccessibilityId_recovery_password_container)
|
||||
.fillMaxWidth()
|
||||
.border(
|
||||
width = 1.dp,
|
||||
color = LocalColors.current.textSecondary,
|
||||
width = LocalDimensions.current.borderStroke,
|
||||
color = LocalColors.current.borders,
|
||||
shape = MaterialTheme.shapes.small
|
||||
)
|
||||
.fillMaxWidth()
|
||||
.wrapContentHeight()
|
||||
) {
|
||||
Text(
|
||||
accountId,
|
||||
modifier = Modifier
|
||||
.contentDescription("Your account ID")
|
||||
.align(Alignment.Center)
|
||||
.padding(22.dp),
|
||||
textAlign = TextAlign.Center,
|
||||
style = base
|
||||
)
|
||||
}
|
||||
.padding(LocalDimensions.current.marginSmall),
|
||||
textAlign = TextAlign.Center,
|
||||
style = base
|
||||
)
|
||||
|
||||
Spacer(modifier = Modifier.height(LocalDimensions.current.itemSpacingXSmall))
|
||||
|
||||
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 = 8.dp)
|
||||
modifier = Modifier.padding(horizontal = LocalDimensions.current.itemSpacingSmall)
|
||||
)
|
||||
|
||||
Row(horizontalArrangement = spacedBy(20.dp)) {
|
||||
Spacer(modifier = Modifier.height(LocalDimensions.current.itemSpacingSmall))
|
||||
|
||||
Row(horizontalArrangement = spacedBy(LocalDimensions.current.itemSpacingSmall)) {
|
||||
SlimOutlineButton(
|
||||
stringResource(R.string.share),
|
||||
modifier = Modifier
|
||||
|
@ -37,7 +37,7 @@ internal fun SeedReminder(startRecoveryPasswordActivity: () -> Unit) {
|
||||
Box(
|
||||
Modifier
|
||||
.fillMaxWidth()
|
||||
.height(4.dp)
|
||||
.height(LocalDimensions.current.indicatorHeight)
|
||||
.background(LocalColors.current.primary)
|
||||
)
|
||||
Row(
|
||||
|
@ -80,7 +80,7 @@ private fun RecoveryPassword(state: State, onChange: (String) -> Unit = {}, onCo
|
||||
stringResource(R.string.sessionRecoveryPassword),
|
||||
style = h4
|
||||
)
|
||||
Spacer(Modifier.width(6.dp))
|
||||
Spacer(Modifier.width(LocalDimensions.current.itemSpacingXXSmall))
|
||||
Icon(
|
||||
painter = painterResource(id = R.drawable.ic_shield_outline),
|
||||
contentDescription = null,
|
||||
|
@ -4,6 +4,7 @@ import androidx.compose.animation.core.Animatable
|
||||
import androidx.compose.animation.core.TweenSpec
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
@ -12,6 +13,7 @@ import androidx.compose.ui.Alignment
|
||||
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.ProgressArc
|
||||
import org.thoughtcrime.securesms.ui.base
|
||||
import org.thoughtcrime.securesms.ui.contentDescription
|
||||
@ -39,6 +41,7 @@ internal fun LoadingScreen(state: State) {
|
||||
stringResource(R.string.waitOneMoment),
|
||||
style = h7
|
||||
)
|
||||
Spacer(modifier = Modifier.height(LocalDimensions.current.itemSpacingTiny))
|
||||
Text(
|
||||
stringResource(R.string.loadAccountProgressMessage),
|
||||
style = base
|
||||
|
@ -99,7 +99,7 @@ private fun NotificationRadioButton(
|
||||
shape = RoundedCornerShape(8.dp)
|
||||
) {
|
||||
Column(
|
||||
verticalArrangement = Arrangement.spacedBy(6.dp)
|
||||
verticalArrangement = Arrangement.spacedBy(LocalDimensions.current.itemSpacingXXSmall)
|
||||
) {
|
||||
Text(stringResource(title), style = h8)
|
||||
Text(stringResource(explanation), style = small)
|
||||
|
@ -403,7 +403,7 @@ class SettingsActivity : PassphraseRequiredActionBarActivity() {
|
||||
)
|
||||
}
|
||||
|
||||
Spacer(modifier = Modifier.height(24.dp))
|
||||
Spacer(modifier = Modifier.height(LocalDimensions.current.itemSpacingMedium))
|
||||
|
||||
var hasPaths by remember {
|
||||
mutableStateOf(false)
|
||||
|
@ -114,7 +114,7 @@ private fun RecoveryPasswordCell(seed: String, copySeed:() -> Unit = {}) {
|
||||
|
||||
AnimatedVisibility(!showQr) {
|
||||
Row(
|
||||
horizontalArrangement = Arrangement.spacedBy(LocalDimensions.current.marginMedium),
|
||||
horizontalArrangement = Arrangement.spacedBy(LocalDimensions.current.itemSpacingSmall),
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
SlimOutlineCopyButton(
|
||||
@ -146,7 +146,7 @@ private fun RecoveryPassword(seed: String) {
|
||||
.contentDescription(R.string.AccessibilityId_recovery_password_container)
|
||||
.padding(vertical = LocalDimensions.current.marginSmall)
|
||||
.border(
|
||||
width = 1.dp,
|
||||
width = LocalDimensions.current.borderStroke,
|
||||
color = LocalColors.current.borders,
|
||||
shape = MaterialTheme.shapes.small
|
||||
)
|
||||
|
@ -44,7 +44,11 @@ fun AlertDialog(
|
||||
onClick = onDismissRequest,
|
||||
modifier = Modifier.align(Alignment.TopEnd)
|
||||
) {
|
||||
Icon(painter = painterResource(id = R.drawable.ic_dialog_x), tint = LocalColors.current.text, contentDescription = "back")
|
||||
Icon(
|
||||
painter = painterResource(id = R.drawable.ic_dialog_x),
|
||||
tint = LocalColors.current.text,
|
||||
contentDescription = "back"
|
||||
)
|
||||
}
|
||||
|
||||
Column(modifier = Modifier.fillMaxWidth()) {
|
||||
@ -52,14 +56,24 @@ fun AlertDialog(
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(top = 24.dp)
|
||||
.padding(horizontal = 24.dp)
|
||||
.padding(top = LocalDimensions.current.itemSpacingSmall)
|
||||
.padding(horizontal = LocalDimensions.current.itemSpacingSmall)
|
||||
) {
|
||||
title?.let {
|
||||
Text(it, textAlign = TextAlign.Center, style = h7, modifier = Modifier.padding(bottom = 8.dp))
|
||||
Text(
|
||||
it,
|
||||
textAlign = TextAlign.Center,
|
||||
style = h7,
|
||||
modifier = Modifier.padding(bottom = LocalDimensions.current.itemSpacingXXSmall)
|
||||
)
|
||||
}
|
||||
text?.let {
|
||||
Text(it, textAlign = TextAlign.Center, style = large, modifier = Modifier.padding(bottom = 8.dp))
|
||||
Text(
|
||||
it,
|
||||
textAlign = TextAlign.Center,
|
||||
style = large,
|
||||
modifier = Modifier.padding(bottom = LocalDimensions.current.itemSpacingXXSmall)
|
||||
)
|
||||
}
|
||||
}
|
||||
buttons?.takeIf { it.isNotEmpty() }?.let {
|
||||
@ -95,8 +109,8 @@ fun DialogButton(text: String, modifier: Modifier, onClick: () -> Unit) {
|
||||
color = LocalColors.current.text,
|
||||
style = largeBold,
|
||||
modifier = Modifier.padding(
|
||||
top = 16.dp,
|
||||
bottom = 24.dp
|
||||
top = LocalDimensions.current.itemSpacingSmall,
|
||||
bottom = LocalDimensions.current.itemSpacingMedium
|
||||
)
|
||||
)
|
||||
}
|
||||
|
@ -23,5 +23,8 @@ data class Dimensions(
|
||||
val dividerIndent: Dp = 80.dp,
|
||||
val appBarHeight: Dp = 64.dp,
|
||||
val minScrollableViewHeight: Dp = 200.dp,
|
||||
val marginHomeEmptyView: Dp = 50.dp
|
||||
val marginHomeEmptyView: Dp = 50.dp,
|
||||
|
||||
val indicatorHeight: Dp = 4.dp,
|
||||
val borderStroke: Dp = 1.dp
|
||||
)
|
||||
|
@ -60,7 +60,7 @@ fun Button(
|
||||
type: ButtonType,
|
||||
modifier: Modifier = Modifier,
|
||||
enabled: Boolean = true,
|
||||
size: ButtonStyle = ButtonStyle.Large,
|
||||
style: ButtonStyle = ButtonStyle.Large,
|
||||
elevation: ButtonElevation? = type.elevation,
|
||||
shape: Shape = MaterialTheme.shapes.large,
|
||||
border: BorderStroke? = type.border(color, enabled),
|
||||
@ -68,10 +68,10 @@ fun Button(
|
||||
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
|
||||
content: @Composable RowScope.() -> Unit
|
||||
) {
|
||||
size.applyButtonConstraints {
|
||||
style.applyButtonConstraints {
|
||||
androidx.compose.material.Button(
|
||||
onClick,
|
||||
modifier.heightIn(min = size.minHeight),
|
||||
modifier.heightIn(min = style.minHeight),
|
||||
enabled,
|
||||
interactionSource,
|
||||
elevation,
|
||||
@ -80,7 +80,7 @@ fun Button(
|
||||
colors
|
||||
) {
|
||||
// Button sets LocalTextStyle, so text style is applied inside to override that.
|
||||
size.applyTextConstraints {
|
||||
style.applyTextConstraints {
|
||||
content()
|
||||
}
|
||||
}
|
||||
@ -158,7 +158,7 @@ fun OutlineCopyButton(
|
||||
Button(
|
||||
modifier = modifier.contentDescription(R.string.AccessibilityId_copy_button),
|
||||
interactionSource = interactionSource,
|
||||
size = size,
|
||||
style = size,
|
||||
type = ButtonType.Outline,
|
||||
color = color,
|
||||
onClick = onClick
|
||||
|
@ -7,6 +7,7 @@ import androidx.compose.material.ButtonElevation
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.unit.dp
|
||||
import org.thoughtcrime.securesms.ui.LocalDimensions
|
||||
import org.thoughtcrime.securesms.ui.color.LocalColors
|
||||
|
||||
interface ButtonType {
|
||||
@ -19,7 +20,10 @@ interface ButtonType {
|
||||
object Outline: ButtonType {
|
||||
@Composable
|
||||
override fun border(color: Color, enabled: Boolean) =
|
||||
BorderStroke(1.dp, if (enabled) color else LocalColors.current.disabled)
|
||||
BorderStroke(
|
||||
width = LocalDimensions.current.borderStroke,
|
||||
color = if (enabled) color else LocalColors.current.disabled
|
||||
)
|
||||
@Composable
|
||||
override fun buttonColors(color: Color) = ButtonDefaults.buttonColors(
|
||||
contentColor = color,
|
||||
|
@ -95,7 +95,7 @@ fun MaybeScanQrCode(
|
||||
style = base,
|
||||
textAlign = TextAlign.Center
|
||||
)
|
||||
Spacer(modifier = Modifier.size(20.dp))
|
||||
Spacer(modifier = Modifier.size(LocalDimensions.current.itemSpacingMedium))
|
||||
OutlineButton(
|
||||
stringResource(R.string.sessionSettings),
|
||||
modifier = Modifier.align(Alignment.CenterHorizontally),
|
||||
@ -163,11 +163,11 @@ fun ScanQrCode(errors: Flow<String>, onScan: (String) -> Unit) {
|
||||
snackbarHost = {
|
||||
SnackbarHost(
|
||||
hostState = scaffoldState.snackbarHostState,
|
||||
modifier = Modifier.padding(16.dp)
|
||||
modifier = Modifier.padding(LocalDimensions.current.itemSpacingSmall)
|
||||
) { data ->
|
||||
Snackbar(
|
||||
snackbarData = data,
|
||||
modifier = Modifier.padding(16.dp)
|
||||
modifier = Modifier.padding(LocalDimensions.current.itemSpacingSmall)
|
||||
)
|
||||
}
|
||||
}
|
||||
@ -181,7 +181,7 @@ fun ScanQrCode(errors: Flow<String>, onScan: (String) -> Unit) {
|
||||
Box(
|
||||
Modifier
|
||||
.aspectRatio(1f)
|
||||
.padding(20.dp)
|
||||
.padding(LocalDimensions.current.itemSpacingMedium)
|
||||
.clip(shape = RoundedCornerShape(26.dp))
|
||||
.background(Color(0x33ffffff))
|
||||
.align(Alignment.Center)
|
||||
|
@ -19,6 +19,7 @@ import androidx.compose.ui.tooling.preview.PreviewParameter
|
||||
import androidx.compose.ui.unit.dp
|
||||
import kotlinx.coroutines.launch
|
||||
import network.loki.messenger.R
|
||||
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
|
||||
@ -39,7 +40,7 @@ fun SessionTabRow(pagerState: PagerState, titles: List<Int>) {
|
||||
TabRowDefaults.Indicator(
|
||||
Modifier.tabIndicatorOffset(tabPositions[pagerState.currentPage]),
|
||||
color = LocalColors.current.primary,
|
||||
height = 5.dp
|
||||
height = LocalDimensions.current.indicatorHeight
|
||||
)
|
||||
},
|
||||
divider = { TabRowDefaults.Divider(color = LocalColors.current.divider) },
|
||||
|
@ -66,7 +66,7 @@ fun SessionOutlinedTextField(
|
||||
shape = MaterialTheme.shapes.small
|
||||
)
|
||||
error?.let {
|
||||
Spacer(modifier = Modifier.height(14.dp))
|
||||
Spacer(modifier = Modifier.height(LocalDimensions.current.itemSpacingXSmall))
|
||||
Text(
|
||||
it,
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
|
Loading…
x
Reference in New Issue
Block a user