simple-mvp

by tinmegali

tinmegali / simple-mvp

Framework canônico para aplicação do padrão Model View Presenter no Android

203 Stars 54 Forks Last release: Not found 35 Commits 2 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:

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
    •         <li>VIEW layer of MVP pattern <br>
                  <code>
                      class VIEW_Activity extends GenericMVPActivity<mvp_mainactivity.requiredviewops mvp_mainactivity.providedpresenterops mainpresenter> 
                      implements MVP_MainActivity.RequiredViewOps
                  </mvp_mainactivity.requiredviewops></code> <br>
                  <em>Could also extend <code>GenericMVPFragment</code></em>
              </li>
      
              <li>PRESENTER from Model View Presenter (MVP) Pattern. <br>
                  <code>
                      class MainPresenter extends GenericPresenter<mvp_mainactivity.requiredpresenterops mvp_mainactivity.providedmodelops mvp_mainactivity.requiredviewops mainmodel>
                      implements
                          MVP_MainActivity.RequiredPresenterOps,
                          MVP_MainActivity.ProvidedPresenterOps
                  </mvp_mainactivity.requiredpresenterops></code>
              </li>
      
          </ul>
      </li>

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

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.