Spacing fixes and UI consolidating

Discussed with QA to make sure the 'new message' screen should  indeed behave as the other screens and use disabled state instead of disappearing
feature/compose-cleanup
ThomasSession 9 months ago
parent 98e9d8a8aa
commit e193105902

@ -40,7 +40,8 @@ internal fun InviteFriend(
)) {
AppBar(stringResource(R.string.invite_a_friend), onBack = onBack, onClose = onClose)
Column(
modifier = Modifier.padding(horizontal = LocalDimensions.current.spacing),
modifier = Modifier.padding(horizontal = LocalDimensions.current.spacing)
.padding(top = LocalDimensions.current.spacing),
) {
Text(
accountId,

@ -3,10 +3,11 @@ package org.thoughtcrime.securesms.conversation.start.newmessage
import androidx.compose.animation.AnimatedVisibility
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.imePadding
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.pager.HorizontalPager
@ -24,6 +25,7 @@ import androidx.compose.ui.tooling.preview.PreviewParameter
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.emptyFlow
import network.loki.messenger.R
import org.thoughtcrime.securesms.onboarding.ui.ContinuePrimaryOutlineButton
import org.thoughtcrime.securesms.ui.LoadingArcOr
import org.thoughtcrime.securesms.ui.theme.LocalDimensions
import org.thoughtcrime.securesms.ui.theme.PreviewTheme
@ -74,7 +76,6 @@ private fun EnterAccountId(
callbacks: Callbacks,
onHelp: () -> Unit = {}
) {
Column(
modifier = Modifier
.fillMaxSize()
@ -84,7 +85,6 @@ private fun EnterAccountId(
Column(
modifier = Modifier.padding(vertical = LocalDimensions.current.spacing),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.spacedBy(LocalDimensions.current.smallSpacing)
) {
SessionOutlinedTextField(
text = state.newMessageIdOrOns,
@ -98,6 +98,8 @@ private fun EnterAccountId(
isTextErrorColor = state.isTextErrorColor
)
Spacer(modifier = Modifier.height(LocalDimensions.current.xxxsSpacing))
BorderlessButtonWithIcon(
text = stringResource(R.string.messageNewDescription),
modifier = Modifier
@ -111,18 +113,21 @@ private fun EnterAccountId(
)
}
AnimatedVisibility(state.isNextButtonVisible) {
PrimaryOutlineButton(
modifier = Modifier
.align(Alignment.CenterHorizontally)
.padding(horizontal = LocalDimensions.current.xlargeSpacing)
.fillMaxWidth()
.contentDescription(R.string.next),
onClick = callbacks::onContinue
) {
LoadingArcOr(state.loading) {
Text(stringResource(R.string.next))
}
Spacer(modifier = Modifier.height(LocalDimensions.current.smallSpacing))
Spacer(Modifier.weight(2f))
PrimaryOutlineButton(
modifier = Modifier
.align(Alignment.CenterHorizontally)
.padding(horizontal = LocalDimensions.current.xlargeSpacing)
.padding(bottom = LocalDimensions.current.smallSpacing)
.fillMaxWidth()
.contentDescription(R.string.next),
enabled = state.isNextButtonEnabled,
onClick = callbacks::onContinue
) {
LoadingArcOr(state.loading) {
Text(stringResource(R.string.next))
}
}
}

@ -6,7 +6,6 @@ import androidx.lifecycle.viewModelScope
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job
import kotlinx.coroutines.TimeoutCancellationException
import kotlinx.coroutines.channels.BufferOverflow
import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.flow.MutableStateFlow
@ -22,8 +21,6 @@ import org.session.libsignal.utilities.timeout
import org.thoughtcrime.securesms.ui.GetString
import java.util.concurrent.TimeoutException
import javax.inject.Inject
import kotlin.coroutines.cancellation.CancellationException
import kotlin.time.Duration.Companion.seconds
@HiltViewModel
internal class NewMessageViewModel @Inject constructor(
@ -112,7 +109,7 @@ internal data class State(
val error: GetString? = null,
val loading: Boolean = false
) {
val isNextButtonVisible: Boolean get() = newMessageIdOrOns.isNotBlank()
val isNextButtonEnabled: Boolean get() = newMessageIdOrOns.isNotBlank()
}
internal data class Success(val publicKey: String)

@ -77,7 +77,7 @@ private fun RecoveryPassword(state: State, onChange: (String) -> Unit = {}, onCo
Spacer(modifier = Modifier.height(LocalDimensions.current.smallSpacing))
Column(
modifier = Modifier.padding(horizontal = LocalDimensions.current.xlargeSpacing)
modifier = Modifier.padding(horizontal = LocalDimensions.current.mediumSpacing)
) {
Row {
Text(

@ -54,7 +54,7 @@ internal fun PickDisplayName(
Spacer(modifier = Modifier.height(LocalDimensions.current.smallSpacing))
Column(
modifier = Modifier.padding(horizontal = LocalDimensions.current.xlargeSpacing)
modifier = Modifier.padding(horizontal = LocalDimensions.current.mediumSpacing)
) {
Text(stringResource(state.title), style = LocalType.current.h4)
Spacer(Modifier.height(LocalDimensions.current.smallSpacing))

@ -18,7 +18,7 @@ fun ContinuePrimaryOutlineButton(modifier: Modifier, onContinue: () -> Unit) {
.contentDescription(R.string.AccessibilityId_continue)
.fillMaxWidth()
.padding(horizontal = LocalDimensions.current.xlargeSpacing)
.padding(bottom = LocalDimensions.current.xsSpacing),
.padding(bottom = LocalDimensions.current.smallSpacing),
onClick = onContinue,
)
}

@ -106,7 +106,7 @@ fun MaybeScanQrCode(
} else {
Column(
modifier = Modifier
.background(color = LocalColors.current.backgroundSecondary)
.background(color = LocalColors.current.background)
.fillMaxSize()
.padding(LocalDimensions.current.xlargeSpacing),
horizontalAlignment = Alignment.CenterHorizontally

Loading…
Cancel
Save