in JetNews/app/src/main/java/com/example/jetnews/ui/home/PostCards.kt [135:200]
fun PostCardHistory(post: Post, navigateToArticle: (String) -> Unit) {
var openDialog by remember { mutableStateOf(false) }
Row(
Modifier
.clickable(onClick = { navigateToArticle(post.id) })
) {
PostImage(
post = post,
modifier = Modifier.padding(top = 16.dp, start = 16.dp, end = 16.dp)
)
Column(
Modifier
.weight(1f)
.padding(top = 16.dp, bottom = 16.dp)
) {
CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.medium) {
Text(
text = stringResource(id = R.string.home_post_based_on_history),
style = MaterialTheme.typography.overline
)
}
PostTitle(post = post)
AuthorAndReadTime(
post = post,
modifier = Modifier.padding(top = 4.dp)
)
}
CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.medium) {
IconButton(onClick = { openDialog = true }) {
Icon(
imageVector = Icons.Filled.MoreVert,
contentDescription = stringResource(R.string.cd_more_actions)
)
}
}
}
if (openDialog) {
AlertDialog(
modifier = Modifier.padding(20.dp),
onDismissRequest = { openDialog = false },
title = {
Text(
text = stringResource(id = R.string.fewer_stories),
style = MaterialTheme.typography.h6
)
},
text = {
Text(
text = stringResource(id = R.string.fewer_stories_content),
style = MaterialTheme.typography.body1
)
},
confirmButton = {
Text(
text = stringResource(id = R.string.agree),
style = MaterialTheme.typography.button,
color = MaterialTheme.colors.primary,
modifier = Modifier
.padding(15.dp)
.clickable { openDialog = false }
)
}
)
}
}