I'm putting in place the Android Navigation Component in my app.
Some transitions work fine, but for this one I have an error. The transition view, from fragment A, stay on the new fragment (B) and hide some elements. Moreover, when I scroll in the fragment, the view don't scroll with it. This is the error I get:
W/t.qoqa.ui.debu: Accessing hidden method Landroid/view/GhostView;->removeGhost(Landroid/view/View;)V (greylist-max-p, reflection, denied)
I/GhostViewApi21: Failed to retrieve removeGhost method
java.lang.NoSuchMethodException: android.view.GhostView.removeGhost [class android.view.View]
I start from a RecyclerView in fragment A, where on click I set a unique the transition name.
Then, I pass this name as an argument using SafeArgs along with the view in FragmentNavigatorExtras.
In fragment B, I delay the transition in onCreate: postponeEnterTransition()
and set the transition type :
transition = TransitionSet().apply {
addTransition(ChangeTransform())
addTransition(ChangeBounds())
startDelay = 150
}
sharedElementEnterTransition = transition
sharedElementReturnTransition = transition
I set the name in onViewCreated: ViewCompat.setTransitionName(product_image, args.imageTransitionName)
And finally, a Glide Listener start the transition when the image is ready to be shown:
listener = object: RequestListener<Drawable> {
override fun onLoadFailed(
e: GlideException?,
model: Any?,
target: Target<Drawable>?,
isFirstResource: Boolean
): Boolean {
startPostponedEnterTransition()
return false
}
override fun onResourceReady(
resource: Drawable?,
model: Any?,
target: Target<Drawable>?,
dataSource: DataSource?,
isFirstResource: Boolean
): Boolean {
startPostponedEnterTransition()
return false
}
}
And the return transition does not work either.
I'm using only androidx.transition.*
elements
Thanks in advance for the help