@OptIn( ExperimentalFoundationApi::class, ExperimentalComposeUiApi::class, ) @Composable private fun RecentlyVisitedHistoryGroup( recentVisit: RecentHistoryGroup, menuItems: List<RecentVisitMenuItem>, clickableEnabled: Boolean, showDividerLine: Boolean, onRecentVisitClick: (RecentHistoryGroup) -> 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.group" }, verticalAlignment = Alignment.CenterVertically, ) { Image( painter = painterResource(R.drawable.ic_multiple_tabs), contentDescription = null, modifier = Modifier.size(24.dp), ) Spacer(modifier = Modifier.width(16.dp)) Column( modifier = Modifier.fillMaxSize(), ) { RecentlyVisitedTitle( text = recentVisit.title, modifier = Modifier .padding(top = 7.dp, bottom = 2.dp) .weight(1f) .semantics { testTagsAsResourceId = true testTag = "recent.visits.group.title" }, ) RecentlyVisitedCaption( count = recentVisit.historyMetadata.size, modifier = Modifier .weight(1f) .semantics { testTagsAsResourceId = true testTag = "recent.visits.group.caption" }, ) if (showDividerLine) { Divider() } } RecentlyVisitedMenu( showMenu = isMenuExpanded, menuItems = menuItems, recentVisit = recentVisit, onDismissRequest = { isMenuExpanded = false }, ) } }
A recently visited history group.