Skip to content

It not working with navigation component #20

@sangnguyen-it

Description

@sangnguyen-it

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)
            }
        }
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions