From fba95c051675e67c487574cb2b0b973a187131db Mon Sep 17 00:00:00 2001 From: k1ngsterr1 Date: Mon, 23 Feb 2026 17:08:03 +0500 Subject: [PATCH] feat: Enhance selection mode animations and adjust bottom padding in ChatDetailScreen --- .../messenger/ui/chats/ChatDetailScreen.kt | 40 ++++++++++++++----- 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/com/rosetta/messenger/ui/chats/ChatDetailScreen.kt b/app/src/main/java/com/rosetta/messenger/ui/chats/ChatDetailScreen.kt index d114486..2c1682d 100644 --- a/app/src/main/java/com/rosetta/messenger/ui/chats/ChatDetailScreen.kt +++ b/app/src/main/java/com/rosetta/messenger/ui/chats/ChatDetailScreen.kt @@ -10,14 +10,18 @@ import androidx.activity.result.contract.ActivityResultContracts import androidx.compose.animation.AnimatedContent import androidx.compose.animation.Crossfade import androidx.compose.animation.core.Spring +import androidx.compose.animation.core.animateDpAsState import androidx.compose.animation.core.animateFloatAsState import androidx.compose.animation.core.spring import androidx.compose.animation.core.tween +import androidx.compose.animation.SizeTransform import androidx.compose.animation.fadeIn import androidx.compose.animation.fadeOut import androidx.compose.animation.expandVertically import androidx.compose.animation.shrinkVertically import androidx.compose.animation.scaleOut +import androidx.compose.animation.slideInVertically +import androidx.compose.animation.slideOutVertically import androidx.compose.animation.togetherWith import androidx.compose.foundation.background import androidx.compose.foundation.clickable @@ -1336,7 +1340,7 @@ fun ChatDetailScreen( // 🔥 Bottom bar - инпут с умным padding bottomBar = { val useImePadding = - !coordinator.isEmojiBoxVisible && !isSelectionMode + !coordinator.isEmojiBoxVisible val bottomModifier = if (useImePadding) { Modifier.imePadding() @@ -1349,10 +1353,22 @@ fun ChatDetailScreen( AnimatedContent( targetState = isSelectionMode, transitionSpec = { - fadeIn( + (slideInVertically( + initialOffsetY = { fullHeight -> fullHeight }, + animationSpec = tween(250) + ) + fadeIn( animationSpec = tween(200) - ) togetherWith - fadeOut(animationSpec = tween(150)) + )) togetherWith ( + slideOutVertically( + targetOffsetY = { fullHeight -> fullHeight }, + animationSpec = tween(200) + ) + fadeOut( + animationSpec = tween(150) + ) + ) using SizeTransform( + clip = true, + sizeAnimationSpec = { _, _ -> tween(250) } + ) }, label = "bottomBarContent" ) { selectionMode -> @@ -1400,9 +1416,9 @@ fun ChatDetailScreen( animationSpec = spring( dampingRatio = - Spring.DampingRatioMediumBouncy, + Spring.DampingRatioNoBouncy, stiffness = - Spring.StiffnessMedium + Spring.StiffnessMediumLow ), label = "buttonScale" @@ -1805,6 +1821,12 @@ fun ChatDetailScreen( ) { // Список сообщений - занимает всё доступное место Box(modifier = Modifier.weight(1f).fillMaxWidth()) { + // Плавная анимация bottom padding при входе/выходе из selection mode + val animatedListBottomPadding by animateDpAsState( + targetValue = if (isSelectionMode) 16.dp else 16.dp, + animationSpec = tween(250), + label = "listBottomPadding" + ) when { // 🔥 СКЕЛЕТОН - показываем пока загружаются // сообщения @@ -1965,11 +1987,7 @@ fun ChatDetailScreen( end = 0.dp, top = 8.dp, bottom = - if (isSelectionMode - ) - 100.dp - else - 16.dp + animatedListBottomPadding ), reverseLayout = true, verticalArrangement = Arrangement.Bottom