Framework canônico para aplicação do padrão Model View Presenter no Android
Java
Latest commit df726db Mar 16, 2016 @tinmegali Update README.md
instructions updated
Permalink
Failed to load latest commit information.
AndroidMVP - info updated Mar 16, 2016
README.md Update README.md Mar 16, 2016

README.md

Android-Model-View-Presenter-MVP

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
    • VIEW layer of MVP pattern
      class VIEW_Activity extends GenericMVPActivity implements MVP_MainActivity.RequiredViewOps
      Could also extend GenericMVPFragment
    • PRESENTER from Model View Presenter (MVP) Pattern.
      class MainPresenter extends GenericPresenter implements MVP_MainActivity.RequiredPresenterOps, MVP_MainActivity.ProvidedPresenterOps

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