The main activity where we display our list
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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