Skip to content

Instantly share code, notes, and snippets.

@dsheikherev
Created August 26, 2022 11:27
Show Gist options
  • Save dsheikherev/d11d43be7ddcbf8dd85dd7042911c1b5 to your computer and use it in GitHub Desktop.
Save dsheikherev/d11d43be7ddcbf8dd85dd7042911c1b5 to your computer and use it in GitHub Desktop.
BugseeOverlayView
@Composable
fun BugseeOverlayView(w: Int, h: Int) {
AndroidView(
modifier = Modifier.fillMaxSize(),
factory = { ctx ->
View(ctx).apply {
layoutParams = LinearLayout.LayoutParams(w, h)
println("!!!!! layout w=" + w + " h=" + h)
alpha = 0.0F
}
}, update = {
Bugsee.addSecureView(it)
}
)
}
// That's how I'm trying to use it:
//...
var size by remember { mutableStateOf(Size.Zero)}
Box(Modifier
.fillMaxSize()
.background(Color.Yellow)
.onGloballyPositioned { coordinates ->
size = coordinates.size.toSize()
println("!!!!! Size= " + size)
})
{
Text("asdasdasdasdsadsadasdasdasdasdasdasdasdaddssdsdsddsdssdsd")
BugseeOverlayView(size.width.toInt(), size.height.toInt())
}
//....
// I see in logs that AndroidView is created with width and height equal to 0:
// !!!!! layout w=0 h=0
// !!!!! Size= Size(1080.0, 249.0)
// !!!!! Size= Size(1080.0, 249.0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment