Advertisement
bngoding

Untitled

Sep 21st, 2019
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. private const val EXTRA_QUERY = "extraQuery"
  2. class DataSourceFactory(
  3. val myAdvancedSearch: myAdvancedSearch,
  4. var query:String
  5. ): DataSource.Factory<Int, Model>() {
  6.  
  7. val mutableLiveData = MutableLiveData<DataSource>()
  8. var dataSource: DataSource? = null
  9.  
  10.  
  11. override fun create(): DataSource<Int, Model> {
  12. query = MyFragment.queryVendor
  13. dataSource = DataSource(myAdvancedSearch,query)
  14. mutableLiveData.postValue(dataSource)
  15. return dataSource as DataSource
  16. }
  17.  
  18. companion object{
  19. fun newInstance(query:String): MyFragment {
  20. return MyFragment().apply {
  21. arguments = Bundle().apply {
  22. putString(EXTRA_QUERY, query)
  23. }
  24. }
  25. }
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement