I have two fragments and I want to use shared element transitions between them. But the I still want to use navigation action to pass data between them.
From the first fragment, I only have image uri loaded using Glide and it's from the recyclerView. I'm passing the image description as well as the image id-> fileId
val action =
MediaFragmentDirections.actionNavMediaToPhotoGalleryEditImageFragment(
imageUri,
description,
fileId
)
findNavController().navigate(action)
In the second fragment I get the uri from args and display it with glide again
private val args: MediaFragmentPhotoNameArgs by navArgs()
...
val photoIV = args.imageData
/*load the image sent from media fragment*/
Glide.with(this)
.load(photoIV)
.into(photoGalleryImage)
In the documentation this is what is there
val extras = FragmentNavigatorExtras(view1 to "hero_image")
view.findNavController().navigate(
R.id.confirmationAction,
null, // Bundle of args
null, // NavOptions
extras)
I don't know how i can pass action with it because I need the other variables in the second fragment as well.
Please how can i achieve this?