@Composable
fun AdItem(nativeAd: NativeAd, modifier: Modifier = Modifier) {
AndroidView(
factory = { context ->
NativeAdView(context)
},
update = {
val composeView = ComposeView(it.context)
it.setNativeAd(nativeAd)
it.removeAllViews()
it.addView(composeView)
composeView.setContent {
Column(horizontalAlignment = Alignment.CenterHorizontally) {
// My other views for native banner
AdAttributions(adChoiceClick = {
//What should go here?
})
}
}
})
}
@Composable
fun AdAttributions(adChoiceClick: () -> Unit) {
Row(
modifier = Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.SpaceBetween
) {
Box(
contentAlignment = Alignment.BottomEnd,
modifier = Modifier
.clickable {
adChoiceClick()
}
) {
Icon(
painterResource(id = R.drawable.ad_choise),
modifier = Modifier
.width(20.dp)
.height(20.dp)
.padding(bottom = 4.dp),
tint = Color(0xff00aecd),
contentDescription = null
)
}
//Ad Mark below
}
}
What action should the adChoiceClick function trigger when the AdChoice
icon is clicked? Additionally, I've encountered some suggestions that
the AdChoice icon could be implemented automatically. However, I'm not
certain whether this is applicable when utilizing Jetpack Compose. Any
information or guidance on this would be immensely helpful. Thank you so
much!