mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-28 20:45:17 +00:00
Animation for group name edit
This commit is contained in:
parent
02d4741bd7
commit
acbeaad71c
@ -1,11 +1,14 @@
|
|||||||
package org.thoughtcrime.securesms.groups.compose
|
package org.thoughtcrime.securesms.groups.compose
|
||||||
|
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
|
import androidx.compose.animation.Crossfade
|
||||||
import androidx.compose.foundation.clickable
|
import androidx.compose.foundation.clickable
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.PaddingValues
|
import androidx.compose.foundation.layout.PaddingValues
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
|
import androidx.compose.foundation.layout.RowScope
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.heightIn
|
import androidx.compose.foundation.layout.heightIn
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
@ -150,17 +153,9 @@ fun EditGroup(
|
|||||||
GroupMinimumVersionBanner()
|
GroupMinimumVersionBanner()
|
||||||
|
|
||||||
// Group name title
|
// Group name title
|
||||||
Row(
|
Crossfade(editingName != null, label = "Editable group name") { showNameEditing ->
|
||||||
modifier = Modifier
|
if (showNameEditing) {
|
||||||
.fillMaxWidth()
|
GroupNameContainer {
|
||||||
.heightIn(min = 72.dp),
|
|
||||||
horizontalArrangement = Arrangement.spacedBy(
|
|
||||||
LocalDimensions.current.xxxsSpacing,
|
|
||||||
Alignment.CenterHorizontally
|
|
||||||
),
|
|
||||||
verticalAlignment = CenterVertically,
|
|
||||||
) {
|
|
||||||
if (editingName != null) {
|
|
||||||
IconButton(
|
IconButton(
|
||||||
modifier = Modifier.size(LocalDimensions.current.spacing),
|
modifier = Modifier.size(LocalDimensions.current.spacing),
|
||||||
onClick = onEditNameCancelClicked) {
|
onClick = onEditNameCancelClicked) {
|
||||||
@ -176,7 +171,7 @@ fun EditGroup(
|
|||||||
min = LocalDimensions.current.mediumSpacing,
|
min = LocalDimensions.current.mediumSpacing,
|
||||||
max = 240.dp
|
max = 240.dp
|
||||||
),
|
),
|
||||||
text = editingName,
|
text = editingName.orEmpty(),
|
||||||
onChange = onEditingNameValueChanged,
|
onChange = onEditingNameValueChanged,
|
||||||
textStyle = LocalType.current.h8,
|
textStyle = LocalType.current.h8,
|
||||||
singleLine = true,
|
singleLine = true,
|
||||||
@ -195,8 +190,11 @@ fun EditGroup(
|
|||||||
tint = LocalColors.current.text,
|
tint = LocalColors.current.text,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
GroupNameContainer {
|
||||||
Text(
|
Text(
|
||||||
text = groupName,
|
text = groupName,
|
||||||
style = LocalType.current.h4,
|
style = LocalType.current.h4,
|
||||||
@ -214,10 +212,14 @@ fun EditGroup(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Header & Add member button
|
// Header & Add member button
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier.padding(horizontal = 16.dp, vertical = 8.dp),
|
modifier = Modifier.padding(
|
||||||
|
horizontal = LocalDimensions.current.smallSpacing,
|
||||||
|
vertical = LocalDimensions.current.xxsSpacing
|
||||||
|
),
|
||||||
verticalAlignment = CenterVertically
|
verticalAlignment = CenterVertically
|
||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
@ -295,6 +297,21 @@ fun EditGroup(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
private fun GroupNameContainer(content: @Composable RowScope.() -> Unit) {
|
||||||
|
Row(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.heightIn(min = 72.dp),
|
||||||
|
horizontalArrangement = Arrangement.spacedBy(
|
||||||
|
LocalDimensions.current.xxxsSpacing,
|
||||||
|
Alignment.CenterHorizontally
|
||||||
|
),
|
||||||
|
verticalAlignment = CenterVertically,
|
||||||
|
content = content
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun ConfirmRemovingMemberDialog(
|
private fun ConfirmRemovingMemberDialog(
|
||||||
onConfirmed: (accountId: AccountId, removeMessages: Boolean) -> Unit,
|
onConfirmed: (accountId: AccountId, removeMessages: Boolean) -> Unit,
|
||||||
|
Loading…
Reference in New Issue
Block a user