Fixed height for group name editing

This commit is contained in:
SessionHero01 2024-10-24 15:28:22 +11:00
parent 6e1fa1b257
commit 2fa433585a
No known key found for this signature in database
2 changed files with 21 additions and 5 deletions

View File

@ -7,9 +7,13 @@ import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.heightIn
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.layout.widthIn
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.material3.ExperimentalMaterial3Api
@ -150,9 +154,8 @@ fun EditGroup(
// Group name title
Row(
modifier = Modifier
.animateContentSize()
.fillMaxWidth()
.padding(LocalDimensions.current.smallSpacing),
.heightIn(min = 72.dp),
horizontalArrangement = Arrangement.spacedBy(
LocalDimensions.current.xxxsSpacing,
Alignment.CenterHorizontally
@ -160,7 +163,9 @@ fun EditGroup(
verticalAlignment = CenterVertically,
) {
if (editingName != null) {
IconButton(onClick = onEditNameCancelClicked) {
IconButton(
modifier = Modifier.size(LocalDimensions.current.spacing),
onClick = onEditNameCancelClicked) {
Icon(
painter = painterResource(R.drawable.ic_x),
contentDescription = stringResource(R.string.AccessibilityId_cancel),
@ -169,23 +174,30 @@ fun EditGroup(
}
SessionOutlinedTextField(
modifier = Modifier.width(180.dp),
modifier = Modifier.widthIn(
min = LocalDimensions.current.mediumSpacing,
max = 240.dp
),
text = editingName,
onChange = onEditingNameValueChanged,
textStyle = LocalType.current.h8,
singleLine = true,
innerPadding = PaddingValues(
horizontal = LocalDimensions.current.spacing,
vertical = LocalDimensions.current.smallSpacing
)
)
IconButton(onClick = onEditNameConfirmed) {
IconButton(
modifier = Modifier.size(LocalDimensions.current.spacing),
onClick = onEditNameConfirmed) {
Icon(
painter = painterResource(R.drawable.check),
contentDescription = stringResource(R.string.AccessibilityId_confirm),
tint = LocalColors.current.text,
)
}
} else {
Text(
text = groupName,

View File

@ -40,6 +40,7 @@ import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.TextUnit
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.max
import androidx.compose.ui.unit.sp
import network.loki.messenger.R
import org.thoughtcrime.securesms.ui.theme.LocalDimensions
@ -51,6 +52,7 @@ import org.thoughtcrime.securesms.ui.theme.textSecondary
import org.thoughtcrime.securesms.ui.contentDescription
import org.thoughtcrime.securesms.ui.theme.LocalType
import org.thoughtcrime.securesms.ui.theme.bold
import kotlin.math.sin
@Preview
@Composable
@ -98,6 +100,7 @@ fun SessionOutlinedTextField(
error: String? = null,
isTextErrorColor: Boolean = error != null,
enabled: Boolean = true,
singleLine: Boolean = false,
) {
BasicTextField(
value = text,
@ -113,6 +116,7 @@ fun SessionOutlinedTextField(
onSearch = { onContinue() },
onSend = { onContinue() },
),
singleLine = singleLine,
decorationBox = { innerTextField ->
Column(modifier = Modifier.animateContentSize()) {
Box(