Skip to content

Instantly share code, notes, and snippets.

@miquelbeltran
Created September 5, 2016 17:41
Show Gist options
  • Save miquelbeltran/9f9018e735e7a7c97051169dc9b2713a to your computer and use it in GitHub Desktop.
Save miquelbeltran/9f9018e735e7a7c97051169dc9b2713a to your computer and use it in GitHub Desktop.
public void ProfilePresenter {
private final ProfileInteractor interactor;
private ProfileView view;
public ProfilePresenter(ProfileInteractor interactor) {
this.interactor = interactor.
}
public void attachView(ProfileView view) {
this.view = view;
fetchAndDisplay();
}
public void dettachView() {
// Not covered by this example:
// You should handle the subscription
}
public void fetchAndDisplay() {
// Not covered by this example:
// You should handle the subscription
// You should also check if view is not null
// You should also handle the onError
interactor.getUserProfile().subscribe(userProfile -> view.display(userProfile));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment