Created
October 3, 2019 08:34
-
-
Save inan-mahmud/2e3cd302207a10c03008bb08d22413b6 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
public class EventDataSourceFactory extends DataSource.Factory { | |
private String date; | |
private Context context; | |
private MutableLiveData<PageKeyedDataSource<Integer, EventsItem>> liveDataSource = new MutableLiveData<>(); | |
public EventDataSourceFactory(String date, Context context) { | |
this.date = date; | |
this.context = context; | |
} | |
@Override | |
public DataSource create() { | |
EventDataSource eventDataSource = new EventDataSource(context, date); | |
liveDataSource.postValue(eventDataSource); | |
return eventDataSource; | |
} | |
public MutableLiveData<PageKeyedDataSource<Integer, EventsItem>> getLiveDataSource() { | |
return liveDataSource; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment