Rework timestamp position.
Add extra empty text to message content to avoid timestamp to overlap the text.
This commit is contained in:
parent
d608c9b9c6
commit
50945e987a
6 changed files with 29 additions and 7 deletions
|
|
@ -253,13 +253,13 @@ private fun MessageEventBubbleContent(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Column(modifier) {
|
Box(modifier) {
|
||||||
ContentView(modifier = contentModifier.padding(start = 12.dp, end = 12.dp, top = 8.dp))
|
ContentView(modifier = contentModifier.padding(start = 12.dp, end = 12.dp, top = 8.dp, bottom = 8.dp))
|
||||||
TimelineEventTimestampView(
|
TimelineEventTimestampView(
|
||||||
event = event,
|
event = event,
|
||||||
onClick = onTimestampClicked,
|
onClick = onTimestampClicked,
|
||||||
modifier = timestampModifier
|
modifier = timestampModifier
|
||||||
.align(Alignment.End)
|
.align(Alignment.BottomEnd)
|
||||||
.padding(horizontal = 8.dp, vertical = 4.dp)
|
.padding(horizontal = 8.dp, vertical = 4.dp)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ fun TimelineItemInformativeView(
|
||||||
fontStyle = FontStyle.Italic,
|
fontStyle = FontStyle.Italic,
|
||||||
color = MaterialTheme.colorScheme.secondary,
|
color = MaterialTheme.colorScheme.secondary,
|
||||||
fontSize = 14.sp,
|
fontSize = 14.sp,
|
||||||
text = text
|
text = text + extraPaddingTrick
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ fun TimelineItemRedactedView(
|
||||||
modifier: Modifier = Modifier
|
modifier: Modifier = Modifier
|
||||||
) {
|
) {
|
||||||
TimelineItemInformativeView(
|
TimelineItemInformativeView(
|
||||||
text = stringResource(id = CommonStrings.common_message_removed),
|
text = stringResource(id = CommonStrings.common_message_removed) + extraPaddingTrick,
|
||||||
iconDescription = stringResource(id = CommonStrings.common_message_removed),
|
iconDescription = stringResource(id = CommonStrings.common_message_removed),
|
||||||
icon = Icons.Default.Delete,
|
icon = Icons.Default.Delete,
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,7 @@ import io.element.android.libraries.designsystem.components.ClickableLinkText
|
||||||
import io.element.android.libraries.designsystem.preview.ElementPreviewDark
|
import io.element.android.libraries.designsystem.preview.ElementPreviewDark
|
||||||
import io.element.android.libraries.designsystem.preview.ElementPreviewLight
|
import io.element.android.libraries.designsystem.preview.ElementPreviewLight
|
||||||
import io.element.android.libraries.theme.LinkColor
|
import io.element.android.libraries.theme.LinkColor
|
||||||
|
import io.element.android.libraries.designsystem.text.toAnnotatedString
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun TimelineItemTextView(
|
fun TimelineItemTextView(
|
||||||
|
|
@ -60,7 +61,7 @@ fun TimelineItemTextView(
|
||||||
val linkStyle = SpanStyle(
|
val linkStyle = SpanStyle(
|
||||||
color = LinkColor,
|
color = LinkColor,
|
||||||
)
|
)
|
||||||
val styledText = remember(content.body) { content.body.linkify(linkStyle) }
|
val styledText = remember(content.body) { content.body.linkify(linkStyle) + extraPaddingTrick.toAnnotatedString() }
|
||||||
ClickableLinkText(
|
ClickableLinkText(
|
||||||
text = styledText,
|
text = styledText,
|
||||||
linkAnnotationTag = "URL",
|
linkAnnotationTag = "URL",
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ fun TimelineItemUnknownView(
|
||||||
modifier: Modifier = Modifier
|
modifier: Modifier = Modifier
|
||||||
) {
|
) {
|
||||||
TimelineItemInformativeView(
|
TimelineItemInformativeView(
|
||||||
text = stringResource(id = CommonStrings.common_unsupported_event),
|
text = stringResource(id = CommonStrings.common_unsupported_event) + extraPaddingTrick,
|
||||||
iconDescription = stringResource(id = CommonStrings.dialog_title_warning),
|
iconDescription = stringResource(id = CommonStrings.dialog_title_warning),
|
||||||
icon = Icons.Default.Info,
|
icon = Icons.Default.Info,
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2023 New Vector Ltd
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package io.element.android.features.messages.impl.timeline.components.event
|
||||||
|
|
||||||
|
// Allow to not overlap the timestamp with the text, in the message bubble.
|
||||||
|
// Compute the size of the worst case.
|
||||||
|
val extraPaddingTrick: String = " ".repeat(" (edited) 88:88 X ".length)
|
||||||
Loading…
Add table
Add a link
Reference in a new issue