Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It not working with navigation component #20

Open
sunny0092 opened this issue Jan 20, 2021 · 2 comments
Open

It not working with navigation component #20

sunny0092 opened this issue Jan 20, 2021 · 2 comments

Comments

@sunny0092
Copy link

Please complete the following information:

  • Library Version [e.g. v1.0.7]
  • Affected Device(s) [e.g. Android 10.0]

Describe the Bug:
I using navigation component call Home fragment => Home Detail Fragment, it not working with navigation component.
Can you please give me more instructions

====>RecyclerView Adapter

 holder.binding.transformationLayout.transitionName = data[position].id.toString()
        holder.binding.layoutRoot.setOnClickListener {
            onItemClickListener?.let {
                onItemClickListener?.onItemClick(
                    holder.binding.transformationLayout,
                    holder.binding.transformationLayout,
                    data[position]
                )
            }
        }

====>Home Fragment

  override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        onTransformationStartContainer()
    }


  val bundle = itemView.getBundle(Constants.PARAMS_LAYOUT_KEY)
        bundle.putParcelable("detail_feature_key", item)
        val extras = FragmentNavigatorExtras(view to Constants.PARAMS_LAYOUT_KEY)
        findNavController().navigate(
            R.id.action_global_homeFeatureDetailFragment,
            bundle,
            null,
            extras
        )

=====>Home Detail Fragment

override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        sharedElementEnterTransition = TransitionInflater.from(context).inflateTransition(android.R.transition.move)
        arguments?.let {
            paramsLayout = it.getParcelable(PARAMS_LAYOUT_KEY)
            if(paramsLayout != null) {
                onTransformationEndContainer(paramsLayout)
            }
        }
    }
@skydoves
Copy link
Owner

skydoves commented Jan 20, 2021

Hi,
onTransformationStartContainer() and onTransformationEndContainer must be called before super.onCreate.

@sunny0092
Copy link
Author

I have followed the instructions but still have not solved the problem, when clicking on the item it blinks
https://drive.google.com/drive/folders/1nl08FknTsuXeqzyD_FrzCBRQGYIMpBWp?usp=sharing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants