use different heights for reaction summary view and reaction buttons

Signed-off-by: Marco Antonio Alvarez <surakin@gmail.com>
This commit is contained in:
Marco Antonio Alvarez
2024-01-04 10:53:53 +01:00
parent 20b5f02fba
commit 5eceab15b6
2 changed files with 6 additions and 5 deletions

View File

@@ -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

View File

@@ -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
)
)
}