@OptIn( ExperimentalFoundationApi::class, ExperimentalComposeUiApi::class, ) @Composable private fun RecentlyVisitedHistoryHighlight( recentVisit: RecentHistoryHighlight, menuItems: List<RecentVisitMenuItem>, clickableEnabled: Boolean, showDividerLine: Boolean, onRecentVisitClick: (RecentHistoryHighlight) -> Unit = { _ -> }, ) { var isMenuExpanded by remember { mutableStateOf(false) } Row( modifier = Modifier .combinedClickable( enabled = clickableEnabled, onClick = { onRecentVisitClick(recentVisit) }, onLongClick = { isMenuExpanded = true }, ) .size(268.dp, 56.dp) .semantics { testTagsAsResourceId = true testTag = "recent.visits.highlight" }, verticalAlignment = Alignment.CenterVertically, ) { Favicon(url = recentVisit.url, size = 24.dp) Spacer(modifier = Modifier.width(16.dp)) Box(modifier = Modifier.fillMaxSize()) { RecentlyVisitedTitle( text = recentVisit.title.trimmed(), modifier = Modifier .align(Alignment.CenterStart) .semantics { testTagsAsResourceId = true testTag = "recent.visits.highlight.title" }, ) if (showDividerLine) { Divider(modifier = Modifier.align(Alignment.BottomCenter)) } } RecentlyVisitedMenu( showMenu = isMenuExpanded, menuItems = menuItems, recentVisit = recentVisit, onDismissRequest = { isMenuExpanded = false }, ) } }
A recently visited history item.