Javier
07/13/2022, 1:25 PMBenoit Quenaudon
07/13/2022, 1:35 PMJavier
07/13/2022, 1:47 PMBenoit Quenaudon
07/13/2022, 1:55 PMpaparazzi.gif(view, start = 500L, end = 500L, fps = 1)
Javier
07/13/2022, 1:59 PMBenoit Quenaudon
07/13/2022, 2:01 PMJavier
07/13/2022, 2:02 PMgif
methodView
Benoit Quenaudon
07/13/2022, 2:04 PMfun snapshot(name: String? = null, composable: @Composable () -> Unit) {
val hostView = ComposeView(context)
// During onAttachedToWindow, AbstractComposeView will attempt to resolve its parent's
// CompositionContext, which requires first finding the "content view", then using that to
// find a root view with a ViewTreeLifecycleOwner
val parent = FrameLayout(context).apply { id = android.R.id.content }
parent.addView(hostView, LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)
PaparazziComposeOwner.register(parent)
hostView.setContent(composable)
snapshot(parent, name)
forceReleaseComposeReferenceLeaks()
}
You can try to copy the hack it’s doing and pass the view to the gif methodJavier
07/13/2022, 2:05 PMyschimke
07/24/2022, 10:28 AMJavier
07/24/2022, 10:47 AMyschimke
07/24/2022, 11:04 AMJavier
11/04/2022, 4:18 PMBenoit Quenaudon
11/04/2022, 8:27 PMJavier
11/04/2022, 8:28 PM