Framework canônico para aplicação do padrão Model View Presenter no Android
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
AndroidMVP - info updated Mar 16, 2016 Update Mar 16, 2016


A Model View Presenter Library using plain and simple interfaces, based on concept from Dr. Douglas Schmidt

Attention: simple-mvp is still an experimental library created for education purposes.
Some methods and operations may change until its maturity.

Created by Tin Megali

Learn more

Quick install

  1. add build.gradle
    compile 'com.tinmegali.mvp:mvp:0.0.7'
  2. Create interfaces to communicate between MVP layers
    • interface RequiredViewOps extends ActivityView
      with VIEW methods to be accessed by PRESENTER
    • interface ProvidedPresenterOps extends PresenterOps
      Operations offered to VIEW to communicate with PRESENTER
    • interface RequiredPresenterOps
      with Required PRESENTER methods available to MODEL
    • interface ProvidedModelOps extends ModelOps
      Operations offered to MODEL to communicate with PRESENTER
  3. Implement MVP objects extending its generics
    • MODEL from Model View Presenter (MVP) pattern.
      class MODEL extends GenericModel implements MVP_MainActivity.ProvidedModelOps
    • 		<li>VIEW layer of MVP pattern <br/>
      				class VIEW_Activity extends GenericMVPActivity<MVP_MainActivity.RequiredViewOps,
                      implements MVP_MainActivity.RequiredViewOps
      			</code> <br />
      			<em>Could also extend <code>GenericMVPFragment</code></em>
      		<li>PRESENTER from Model View Presenter (MVP) Pattern. <br/>
      				class MainPresenter extends GenericPresenter<MVP_MainActivity.RequiredPresenterOps,
      					MVP_MainActivity.ProvidedModelOps, MVP_MainActivity.RequiredViewOps, MainModel>

Instalação rápida

  • Crie as interfaces de comunicação entre os módulos View, Presenter e Model
    1. interface RequiredViewOps fornece métodos para Presenter comunicar com View. É necessário extender ActivityView
    2. interface ProvidedPresenterOps fornece operações oferecidas ao layer View para comunicação com Presenter. É preciso extender PresenterOps
    3. interface RequiredPresenterOps operações oferecidas pelo layer Presenter para comunicações com Model
    4. interface ProvidedModelOps operações oferecidos pelo layer Model para comunicações com Presenter. É preciso extender ModelOps
  • Crie a classe Model extendendo GenericModel e implementando ProvidedModelOps ex: {@link com.tinmegali.androidmvp.main.model.MainModel}
  • Crie a classe Presenter extendendo GenericPresenter, implementando RequiredPresenterOps e ProvidedPresenterOps. exemplo: {@link com.tinmegali.androidmvp.main.presenter.MainPresenter}
  • Crie a classe View GenericMVPActivity ou GenericMVPFragment e implementando RequiredViewOps Exemplo: {@link com.tinmegali.androidmvp.main.view.MainActivity}
  • .

Android MVP Class Diagram