@@ -24,7 +24,10 @@ import androidx.compose.foundation.layout.heightIn
2424import androidx.compose.foundation.layout.padding
2525import androidx.compose.foundation.layout.size
2626import androidx.compose.foundation.layout.widthIn
27+ import androidx.compose.foundation.text.InlineTextContent
28+ import androidx.compose.foundation.text.appendInlineContent
2729import androidx.compose.material.icons.Icons
30+ import androidx.compose.material.icons.automirrored.filled.OpenInNew
2831import androidx.compose.material.icons.automirrored.filled.PlaylistPlay
2932import androidx.compose.material.icons.filled.Tune
3033import androidx.compose.material3.BottomSheetDefaults
@@ -54,6 +57,8 @@ import androidx.compose.ui.platform.ComposeView
5457import androidx.compose.ui.platform.LocalContext
5558import androidx.compose.ui.res.painterResource
5659import androidx.compose.ui.res.stringResource
60+ import androidx.compose.ui.text.Placeholder
61+ import androidx.compose.ui.text.PlaceholderVerticalAlign
5762import androidx.compose.ui.text.SpanStyle
5863import androidx.compose.ui.text.buildAnnotatedString
5964import androidx.compose.ui.text.font.FontWeight
@@ -379,13 +384,14 @@ fun LongPressMenuHeader(
379384 Text (
380385 text = subtitle,
381386 style = MaterialTheme .typography.bodyMedium,
387+ inlineContent = getSubtitleInlineContent(),
382388 modifier = if (onUploaderClick == null ) {
383389 Modifier
384390 } else {
385391 Modifier .clickable(onClick = onUploaderClick)
386392 }
387393 .fillMaxWidth()
388- .fadedMarquee(edgeWidth = 12 .dp)
394+ .fadedMarquee(edgeWidth = 12 .dp),
389395 )
390396 }
391397 }
@@ -413,6 +419,9 @@ fun getSubtitleAnnotatedString(
413419 } else {
414420 append(item.uploader)
415421 }
422+ append(" " )
423+ // see getSubtitleInlineContent()
424+ appendInlineContent(" open_in_new" , " ↗" )
416425 }
417426 shouldAddSeparator = true
418427 } else if (! item.uploader.isNullOrBlank()) {
@@ -441,6 +450,27 @@ fun getSubtitleAnnotatedString(
441450 }
442451}
443452
453+ /* *
454+ * [getSubtitleAnnotatedString] returns a string that might make use of the OpenInNew icon, and we
455+ * provide it to [Text] through its `inlineContent` parameter.
456+ */
457+ @Composable
458+ fun getSubtitleInlineContent () = mapOf (
459+ " open_in_new" to InlineTextContent (
460+ placeholder = Placeholder (
461+ width = MaterialTheme .typography.bodyMedium.fontSize,
462+ height = MaterialTheme .typography.bodyMedium.fontSize,
463+ placeholderVerticalAlign = PlaceholderVerticalAlign .Center ,
464+ )
465+ ) {
466+ Icon (
467+ imageVector = Icons .AutoMirrored .Filled .OpenInNew ,
468+ contentDescription = null ,
469+ tint = MaterialTheme .customColors.onSurfaceVariantLink,
470+ )
471+ }
472+ )
473+
444474@Composable
445475fun LongPressMenuButton (
446476 icon : ImageVector ,
0 commit comments