Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
The main activity where we display our list
class KitsuMainActivity : AppCompatActivity() {
private val viewModel by lazy { ViewModelProviders.of(this).get(KitsuViewModel::class.java) }
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
initFlysearch(savedInstanceState)
searchForResults("Android")
}
private fun initKitsu() {
val kitsuAdapter = KitsuPagedListAdapter()
searchResultsRecyclerView.adapter = kitsuAdapter
viewModel.allKitsu.observe(this, Observer(kitsuAdapter::setList))
}
private fun searchForResults(queryFilter: String) {
viewModel.setQueryFilter(queryFilter)
initKitsu()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment