Last active
November 16, 2016 22:22
-
-
Save dazza5000/14d78ed1c8de8339ee24e7d23d919447 to your computer and use it in GitHub Desktop.
Events Presenter Implementation
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
public class EventsPresenter implements EventsContract.Presenter { | |
private EventsRepository repository; | |
private EventsContract.View view; | |
.... | |
public EventsPresenter(EventsRepository repository, EventsContract.View view) { | |
this.view = view; | |
this.repository = repository; | |
} | |
@Override | |
public void loadEvents() { | |
repository.getEvents(new EventsDataSource.LoadEventsCallback() { | |
@Override | |
public void onEventsLoaded(List<Event> events) { | |
//Filter events | |
//Sort events | |
... | |
if (currentEvents.size() > 0 ) { | |
view.showEvents(currentEvents); | |
} else { | |
view.showNoEventsView(); | |
} | |
} | |
@Override | |
public void onError(String error) { | |
Log.e("OOPS", "We have an errorrrrr"); | |
} | |
..... | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment