Skip to content
This repository was archived by the owner on Nov 21, 2019. It is now read-only.

Commit 80cd551

Browse files
committed
Apply the valid container view id to fix a crash
1 parent 41ff9d4 commit 80cd551

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

  • motionlayout/src/main/java/com/google/androidstudio/motionlayoutexample/fragmentsdemo

motionlayout/src/main/java/com/google/androidstudio/motionlayoutexample/fragmentsdemo/CustomAdapter.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class CustomAdapter(private val userList: ArrayList<User>): RecyclerView.Adapter
3131
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
3232
holder.txtName.text = userList[position].name
3333
holder.txtTitle.text = userList[position].title
34-
holder.itemView.setOnClickListener({
34+
holder.itemView.setOnClickListener {
3535
val parent = it?.parent?.parent?.parent?.parent
3636
if (parent is MotionLayout) {
3737
val offsetViewBounds = Rect()
@@ -40,11 +40,11 @@ class CustomAdapter(private val userList: ArrayList<User>): RecyclerView.Adapter
4040
val transaction = (it.context as AppCompatActivity).supportFragmentManager.beginTransaction()
4141
val fragment = ItemFragment.newInstance()
4242
fragment.update(holder)
43-
transaction.replace(R.id.rv_item_placeholder, fragment)
43+
transaction.replace(R.id.container, fragment)
4444
transaction.commitNow()
4545
parent.transitionToEnd()
4646
}
47-
})
47+
}
4848
}
4949

5050
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {

0 commit comments

Comments
 (0)