thatfiredev/fireXtensions

Create FirebaseUI extensions

Closed this issue · 0 comments

FirebaseUI is very helpful when developing Android apps. It already handles lots of boilerplate code, but with Kotlin it might be able to handle more. The FirebaseRecyclerViewAdapter for the realtime database is an example:

Database

See how it's currently written here. Here's my proposal:

val options = FirebaseRecyclerOptions.fromQuery<Chat>(query)

val adapter = FirebaseRecyclerAdapter.with<ChatHolder>(options)
  .viewHolder { _, parent ->
    val view = layoutInflater.inflate(R.layout.list_item, parent, false)
    ChatHolder(view)
  }
  .bind { position, model ->
    // Bind the Chat object to the views from the ChatHolder
  }
  .build()