FirebaseUI-FirebaseRecyclerAdapter is not supported by NavigationUI
FirebaseUI-FirebaseRecyclerAdapter is not supported by NavigationUI!
After clicking item in recyclerview its navigated to another fragment. Once returning back or onBackPressed() previous loadstate is now working. *Code below reference.
class UserList : Fragment(R.layout.recyclerview) {
private var fbAdapter: FirebaseRecyclerAdapter<UserMO, UserVH>? = null
override fun onActivityCreated(savedInstanceState: Bundle?) {
super.onActivityCreated(savedInstanceState)
val userQuery = databaseReference.child("user-list")
val fbOpt = FirebaseRecyclerOptions.Builder<UserMO>()
.setQuery(userQuery, UserMO::class.java).build()
fbAdapter = object : FirebaseRecyclerAdapter<UserMO, UserVH>(fbOpt) {
override fun onCreateViewHolder(viewGroup: ViewGroup, i: Int): UserVH {
val inflater = LayoutInflater.from(viewGroup.context)
return UserVH(inflater.inflate(R.layout.allusers, viewGroup, false))
}
override fun onBindViewHolder(uservh: UserVH, i: Int, allusers: UserMO) {
uservh.listUser(allusers)
uservh.itemView.setOnClickListener {
findNavController().navigate(R.id.userdetails)
}
}
}
rView.apply {
addItemDecoration(DividerItemDecoration(activity, DividerItemDecoration.VERTICAL))
layoutManager = LinearLayoutManager(activity)
adapter = fbAdapter
}
}
override fun onStart() {
super.onStart()
fbAdapter?.startListening()
}
override fun onStop() {
super.onStop()
fbAdapter?.stopListening()
}
}
@15r can you explain how this is a bug in FirebaseUI? What does this library do wrong? RecyclerView shouldn't have anything to do with navigation.
App output
Step 01 - Open app Step 02 - Scroll down and click USER16 item Step 03 - Onclick navigated to UserDetails fragment and onBackPressed() Step 04 is the result. Step 04 - See the image 4.

Expected output
Step 01 - Open app Step 02 - Scroll down and click USER16 item Step 03 - Onclick navigated to UserDetails fragment and onBackPressed() Step 04 has to the result. Step 04 - See the image 4.

@samtstern find the android project for reference https://github.com/15r/Users
@15r sorry for the slow response but maybe you want to follow this guide: https://proandroiddev.com/fui-rv-state-a66833c3bb88
I'm still not sure this is a FirebaseUI issue, sounds like a general difficulty with RecyclerView + Navigation.