Animate transition from/to space manage rooms mode.
This commit is contained in:
parent
bed35807d2
commit
6d3dfe7687
1 changed files with 58 additions and 33 deletions
|
|
@ -10,9 +10,17 @@ package io.element.android.features.space.impl.root
|
|||
|
||||
import androidx.activity.compose.BackHandler
|
||||
import androidx.annotation.StringRes
|
||||
import androidx.compose.animation.AnimatedVisibility
|
||||
import androidx.compose.animation.expandVertically
|
||||
import androidx.compose.animation.fadeIn
|
||||
import androidx.compose.animation.fadeOut
|
||||
import androidx.compose.animation.shrinkVertically
|
||||
import androidx.compose.animation.slideIn
|
||||
import androidx.compose.animation.veilOut
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.interaction.MutableInteractionSource
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
|
|
@ -103,14 +111,24 @@ fun SpaceView(
|
|||
Scaffold(
|
||||
modifier = modifier,
|
||||
topBar = {
|
||||
if (state.isManageMode) {
|
||||
Box {
|
||||
AnimatedVisibility(
|
||||
visible = state.isManageMode,
|
||||
enter = fadeIn(),
|
||||
exit = fadeOut()
|
||||
) {
|
||||
ManageModeTopBar(
|
||||
selectedCount = state.selectedCount,
|
||||
isRemoveButtonEnabled = state.isRemoveButtonEnabled,
|
||||
onCancelClick = { state.eventSink(SpaceEvents.ExitManageMode) },
|
||||
onRemoveClick = { state.eventSink(SpaceEvents.RemoveSelectedRooms) },
|
||||
)
|
||||
} else {
|
||||
}
|
||||
AnimatedVisibility(
|
||||
visible = !state.isManageMode,
|
||||
enter = fadeIn(),
|
||||
exit = fadeOut()
|
||||
) {
|
||||
SpaceViewTopBar(
|
||||
currentSpace = state.currentSpace,
|
||||
canAccessSpaceSettings = state.canAccessSpaceSettings,
|
||||
|
|
@ -123,6 +141,7 @@ fun SpaceView(
|
|||
onManageRoomsClick = { state.eventSink(SpaceEvents.EnterManageMode) },
|
||||
)
|
||||
}
|
||||
}
|
||||
},
|
||||
content = { padding ->
|
||||
Box(
|
||||
|
|
@ -218,7 +237,13 @@ private fun SpaceViewContent(
|
|||
LazyColumn(modifier.fillMaxSize()) {
|
||||
val currentSpace = state.currentSpace
|
||||
if (currentSpace != null) {
|
||||
item {
|
||||
item(key = "space_header") {
|
||||
AnimatedVisibility(
|
||||
!state.isManageMode,
|
||||
enter = fadeIn() + expandVertically(),
|
||||
exit = fadeOut() + shrinkVertically()
|
||||
) {
|
||||
Column {
|
||||
SpaceHeaderView(
|
||||
avatarData = currentSpace.getAvatarData(AvatarSize.SpaceHeader),
|
||||
name = currentSpace.displayName,
|
||||
|
|
@ -229,11 +254,11 @@ private fun SpaceViewContent(
|
|||
numberOfMembers = currentSpace.numJoinedMembers,
|
||||
onTopicClick = onTopicClick
|
||||
)
|
||||
}
|
||||
item {
|
||||
HorizontalDivider()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
itemsIndexed(
|
||||
items = state.children,
|
||||
key = { _, spaceRoom -> spaceRoom.roomId }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue