public abstract class MvpActivity<V extends MvpView,P extends <any>> extends AppCompatActivity implements MvpDelegateCallback<V,P>
MvpPresenter to implement a Model-View-Presenter
architecture.| Modifier and Type | Field and Description |
|---|---|
protected ActivityMvpDelegate |
mvpDelegate |
protected P |
presenter |
protected boolean |
retainInstance |
| Constructor and Description |
|---|
MvpActivity() |
| Modifier and Type | Method and Description |
|---|---|
abstract P |
createPresenter()
Instantiate a presenter instance
|
protected ActivityMvpDelegate<V,P> |
getMvpDelegate()
Get the mvp delegate.
|
V |
getMvpView()
Gets the MvpView for the presenter
|
P |
getPresenter()
Gets the presenter.
|
void |
onContentChanged() |
protected void |
onCreate(android.os.Bundle savedInstanceState) |
protected void |
onDestroy() |
protected void |
onPause() |
protected void |
onPostCreate(android.os.Bundle savedInstanceState) |
protected void |
onRestart() |
protected void |
onResume() |
protected void |
onSaveInstanceState(android.os.Bundle outState) |
protected void |
onStart() |
protected void |
onStop() |
void |
setPresenter(P presenter)
Sets the presenter instance
|
protected ActivityMvpDelegate mvpDelegate
protected P extends <any> presenter
protected boolean retainInstance
protected void onCreate(android.os.Bundle savedInstanceState)
protected void onDestroy()
protected void onSaveInstanceState(android.os.Bundle outState)
protected void onPause()
protected void onResume()
protected void onStart()
protected void onStop()
protected void onRestart()
public void onContentChanged()
protected void onPostCreate(android.os.Bundle savedInstanceState)
public abstract P createPresenter()
createPresenter in interface MvpDelegateCallback<V extends MvpView,P extends <any>>MvpPresenter for this viewprotected ActivityMvpDelegate<V,P> getMvpDelegate()
Please note that only one instance of mvp delegate should be used per Activity instance.
Only override this method if you really know what you are doing.
ActivityMvpDelegateImplpublic P getPresenter()
MvpDelegateCallbackMvpDelegateCallback.createPresenter()getPresenter in interface MvpDelegateCallback<V extends MvpView,P extends <any>>public void setPresenter(P presenter)
MvpDelegateCallbacksetPresenter in interface MvpDelegateCallback<V extends MvpView,P extends <any>>presenter - The presenter instancepublic V getMvpView()
MvpDelegateCallbackgetMvpView in interface MvpDelegateCallback<V extends MvpView,P extends <any>>