Skip to content

Commit

Permalink
SC timeline layout: don't center media captions
Browse files Browse the repository at this point in the history
Change-Id: Ia7bc0fbae2182939f3b348b18d52893f67848913
  • Loading branch information
SpiritCroc committed Feb 1, 2025
1 parent 1001d16 commit e8da0d6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package io.element.android.features.messages.impl.timeline.components.event

import androidx.compose.runtime.Composable
import androidx.compose.ui.unit.Dp
import chat.schildi.lib.preferences.ScPrefs
import chat.schildi.lib.preferences.value

@Composable
fun scLayoutDpUnspecified() = if (ScPrefs.SC_TIMELINE_LAYOUT.value()) Dp.Unspecified else null
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ fun TimelineItemImageView(
EditorStyledText(
modifier = Modifier
.padding(horizontal = 4.dp) // This is (12.dp - 8.dp) contentPadding from CommonLayout
.widthIn(min = MIN_HEIGHT_IN_DP.dp * aspectRatio, max = MAX_HEIGHT_IN_DP.dp * aspectRatio),
.widthIn(min = scLayoutDpUnspecified() ?: (MIN_HEIGHT_IN_DP.dp * aspectRatio), max = MAX_HEIGHT_IN_DP.dp * aspectRatio),
text = caption,
style = ElementRichTextEditorStyle.textStyle(),
onLinkClickedListener = onLinkClick,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ fun TimelineItemVideoView(
EditorStyledText(
modifier = Modifier
.padding(horizontal = 4.dp) // This is (12.dp - 8.dp) contentPadding from CommonLayout
.widthIn(min = MIN_HEIGHT_IN_DP.dp * aspectRatio, max = MAX_HEIGHT_IN_DP.dp * aspectRatio),
.widthIn(min = scLayoutDpUnspecified() ?: (MIN_HEIGHT_IN_DP.dp * aspectRatio), max = MAX_HEIGHT_IN_DP.dp * aspectRatio),
text = caption,
onLinkClickedListener = onLinkClick,
onLinkLongClickedListener = scLinkLongClickListener(),
Expand Down

0 comments on commit e8da0d6

Please sign in to comment.