Large scale application development and MVP - Part II - 0 views
-
segment the code that declares the UI from the code that drives the UI.
-
we want the our ContactsPresenter to implement a Presenter interface that allows our ContactsView to callback into the presenter when it receives a click, select or other event. The Presenter interface defines the following: public interface Presenter<T> { void onAddButtonClicked(); void onDeleteButtonClicked(); void onItemClicked(T clickedItem); void onItemSelected(T selectedItem); }
-
The first part of wiring everything up is to have our ContactsPresenter implement the Presenter interface, and then register itself with the underlying view. To register itself, we'll need our ContactsView to expose a setPresenter() method: private Presenter<T> presenter; public void setPresenter(Presenter<T> presenter) { this.presenter = presenter; }
- ...8 more annotations...