Merge pull request #4378 from element-hq/feature/bma/customSuperButton

Be able to correctly render the UI with other colors.
This commit is contained in:
Benoit Marty 2025-03-11 09:26:54 +01:00 committed by GitHub
commit 44b837a6bd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
20 changed files with 131 additions and 37 deletions

View file

@ -8,6 +8,8 @@
package io.element.android.features.messages.impl.timeline.components
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
@ -28,7 +30,10 @@ import io.element.android.features.messages.impl.timeline.model.event.TimelineIt
import io.element.android.features.messages.impl.timeline.model.event.TimelineItemStateContent
import io.element.android.features.messages.impl.timeline.protection.TimelineProtectionEvent
import io.element.android.features.messages.impl.timeline.protection.TimelineProtectionState
import io.element.android.libraries.designsystem.preview.ElementPreview
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
import io.element.android.libraries.designsystem.text.toPx
import io.element.android.libraries.designsystem.theme.LocalBuildMeta
import io.element.android.libraries.designsystem.theme.highlightedMessageBackgroundColor
import io.element.android.libraries.matrix.api.core.EventId
import io.element.android.libraries.matrix.api.core.UserId
@ -171,8 +176,13 @@ private fun Modifier.focusedEvent(
focusedEventOffset: Dp
): Modifier {
val highlightedLineColor = ElementTheme.colors.textActionAccent
val gradientFirstColor = if (LocalBuildMeta.current.isEnterpriseBuild) {
ElementTheme.colors.textActionAccent.copy(alpha = 0.125f)
} else {
ElementTheme.colors.highlightedMessageBackgroundColor
}
val gradientColors = listOf(
ElementTheme.colors.highlightedMessageBackgroundColor,
gradientFirstColor,
ElementTheme.colors.bgCanvasDefault,
)
val verticalOffset = focusedEventOffset.toPx()
@ -196,3 +206,15 @@ private fun Modifier.focusedEvent(
}
}.padding(top = 4.dp)
}
@PreviewsDayNight
@Composable
internal fun FocusedEventPreview() = ElementPreview {
Box(
modifier = Modifier
.padding(16.dp)
.fillMaxWidth()
.height(160.dp)
.focusedEvent(0.dp),
)
}

View file

@ -37,13 +37,13 @@ internal fun TimelineItemReadMarkerView(
Text(
text = stringResource(id = R.string.screen_room_timeline_read_marker_title).uppercase(),
style = ElementTheme.typography.fontBodySmMedium,
color = ElementTheme.colors.textSecondary,
color = ElementTheme.colors.textActionAccent,
)
HorizontalDivider(
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = 2.dp),
color = ElementTheme.colors.borderInteractivePrimary,
color = ElementTheme.colors.textActionAccent,
)
}
}