Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private const val EXTRA_QUERY = "extraQuery"
- class DataSourceFactory(
- val myAdvancedSearch: myAdvancedSearch,
- var query:String
- ): DataSource.Factory<Int, Model>() {
- val mutableLiveData = MutableLiveData<DataSource>()
- var dataSource: DataSource? = null
- override fun create(): DataSource<Int, Model> {
- query = MyFragment.queryVendor
- dataSource = DataSource(myAdvancedSearch,query)
- mutableLiveData.postValue(dataSource)
- return dataSource as DataSource
- }
- companion object{
- fun newInstance(query:String): MyFragment {
- return MyFragment().apply {
- arguments = Bundle().apply {
- putString(EXTRA_QUERY, query)
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement