From 5eceab15b68b32adf134b6f61fa89339ba4370d2 Mon Sep 17 00:00:00 2001 From: Marco Antonio Alvarez Date: Thu, 4 Jan 2024 10:53:53 +0100 Subject: [PATCH] use different heights for reaction summary view and reaction buttons Signed-off-by: Marco Antonio Alvarez --- .../impl/timeline/components/MessagesReactionButton.kt | 2 +- .../components/reactionsummary/ReactionSummaryView.kt | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/components/MessagesReactionButton.kt b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/components/MessagesReactionButton.kt index b136dd94bf..7720295d1d 100644 --- a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/components/MessagesReactionButton.kt +++ b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/components/MessagesReactionButton.kt @@ -119,7 +119,7 @@ sealed interface MessagesReactionsButtonContent { val isHighlighted get() = this is Reaction && reaction.isHighlighted } -internal val REACTION_EMOJI_LINE_HEIGHT = 25.sp +internal val REACTION_EMOJI_LINE_HEIGHT = 20.sp internal const val REACTION_IMAGE_ASPECT_RATIO = 1.0f private val ADD_EMOJI_SIZE = 16.dp diff --git a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/components/reactionsummary/ReactionSummaryView.kt b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/components/reactionsummary/ReactionSummaryView.kt index 5ab974fcca..24f6a52d0a 100644 --- a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/components/reactionsummary/ReactionSummaryView.kt +++ b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/components/reactionsummary/ReactionSummaryView.kt @@ -60,7 +60,6 @@ import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import coil.compose.AsyncImage import io.element.android.compound.theme.ElementTheme -import io.element.android.features.messages.impl.timeline.components.REACTION_EMOJI_LINE_HEIGHT import io.element.android.features.messages.impl.timeline.components.REACTION_IMAGE_ASPECT_RATIO import io.element.android.features.messages.impl.timeline.model.AggregatedReaction import io.element.android.libraries.designsystem.components.avatar.Avatar @@ -78,6 +77,8 @@ import io.element.android.libraries.matrix.ui.media.MediaRequestData import io.element.android.libraries.matrix.ui.model.getAvatarData import kotlinx.coroutines.launch +internal val REACTION_SUMMARY_LINE_HEIGHT = 25.sp + @OptIn(ExperimentalMaterial3Api::class) @Composable fun ReactionSummaryView( @@ -203,7 +204,7 @@ private fun AggregatedReactionButton( if (reaction.key.startsWith("mxc://")) { AsyncImage( modifier = Modifier - .heightIn(min = REACTION_EMOJI_LINE_HEIGHT.toDp(), max = REACTION_EMOJI_LINE_HEIGHT.toDp()) + .heightIn(min = REACTION_SUMMARY_LINE_HEIGHT.toDp(), max = REACTION_SUMMARY_LINE_HEIGHT.toDp()) .aspectRatio(REACTION_IMAGE_ASPECT_RATIO, false), model = MediaRequestData(MediaSource(reaction.key), MediaRequestData.Kind.Content), contentDescription = null @@ -214,7 +215,7 @@ private fun AggregatedReactionButton( text = reaction.displayKey, style = ElementTheme.typography.fontBodyMdRegular.copy( fontSize = 20.sp, - lineHeight = REACTION_EMOJI_LINE_HEIGHT + lineHeight = REACTION_SUMMARY_LINE_HEIGHT ), ) } @@ -225,7 +226,7 @@ private fun AggregatedReactionButton( color = textColor, style = ElementTheme.typography.fontBodyMdRegular.copy( fontSize = 20.sp, - lineHeight = REACTION_EMOJI_LINE_HEIGHT + lineHeight = REACTION_SUMMARY_LINE_HEIGHT ) ) }