Skip to content

Instantly share code, notes, and snippets.

@nbarraille
Created December 3, 2015 00:45
Show Gist options
  • Save nbarraille/e9778750174df700dd72 to your computer and use it in GitHub Desktop.
Save nbarraille/e9778750174df700dd72 to your computer and use it in GitHub Desktop.
Example of interface for MVP architecture
interface MessageView {
// View methods should be directives, as the View is just executing orders from the
// Presenter.
// Methods for updating the view
void setMessageBody(String body);
void setAuthorName(String name);
void showTranslationButton(boolean shouldShow);
// Navigation methods
void goToUserProfile(User user);
}
interface MessagePresenter {
// Presenter methods should mostly be callbacks, as the View is reporting events for the
// Presenter to evaluate
// Lifecycle events methods
void onStart();
// Input events methods
void onAuthorClicked();
void onThreeFingersSwipe();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment