Last active
September 17, 2017 11:44
-
-
Save brainail/23e55fe38e83c5dcdc68200033007dc5 to your computer and use it in GitHub Desktop.
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