Plugin provides annotations for Model-View-Presenter (MVP) pattern. This plugin follows the approach that activities and fragments are presenters.
Add AndroidAnnotations and MVP plugin to your android module.
repositories {
maven {
url "http://dl.bintray.com/nenick/maven"
}
}
def AndroidAnnotations = 4.3.0
def AndroidAnnotationsMvp = 1.0.0
deoendencies {
apt "org.androidannotations:androidannotations:$AndroidAnnotations"
compile "org.androidannotations:androidannotations:$AndroidAnnotations"
apt "de.nenick:androidannotations-mvp:$AndroidAnnotationsMvp"
compile "de.nenick:androidannotations-mvp-api:$AndroidAnnotationsMvp"
}
Base annotations to enable MVP plugin features.
Annotation | Short Description |
---|---|
@EMvpPresenter | Enhance activity or fragment class as presenter. |
@EMvpView | Enhance bean class as view. |
Annotation | Short Description |
---|---|
@MvpActivity | Inject new non static MVP presenter activity intent builder. |
@MvpFragment | Inject new MVP presenter fragment instance. |
@MvpView | Inject new MVP view instance. |
@MvpCallback View | Inject existing MVP presenter instance for MVP view. |
@MvpCallback Presenter | Inject existing parent MVP presenter instance for MVP presenter fragment. |
Example how typically activity code may be separated into presenter and view ...
Typical activity class without MVP separation | Presenter with MVP separation | View with MVP separation |
---|---|---|
|
|
|
For any issue or question please open an issue for support.
Please contribute using Github Flow. Create a branch, add commits, and open a pull request.
Build and run MVP plugin tests
- from project root execute
./gradlew check
- from project root execute
./gradlew connectedCheck
(needs android device or emulator)
Release MVP plugin
- update
RELEASE_PLAN.md
with new release information - from project root execute
./gradlew release -Prelease.version=X.X.X
- after release is done, update
README.md
with latest project version number