Skip to content

Instantly share code, notes, and snippets.

@tony-albanese
Created May 6, 2019 18:55
Show Gist options
  • Save tony-albanese/888343ba5d3271f25806b4054a6e4604 to your computer and use it in GitHub Desktop.
Save tony-albanese/888343ba5d3271f25806b4054a6e4604 to your computer and use it in GitHub Desktop.
The function to setup the adapter.
fun initializeCoworkerRecyclerView() {
//Setup the query.
val query = db.collection(COLLECTION_USERS).orderBy("name")
val options = FirestoreRecyclerOptions.Builder<AppUser>().setQuery(query, AppUser::class.java).build()
adapter = CoworkerListAdapter(options)
val recyclerView = activity!!.findViewById<RecyclerView>(R.id.coworker_recycler_view)
recyclerView.setHasFixedSize(true)
recyclerView.layoutManager = LinearLayoutManager(context)
recyclerView.adapter = adapter
adapter.startListening()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment