public abstract class MvpPresenter<View extends MvpView>
extends java.lang.Object
| Constructor and Description |
|---|
MvpPresenter() |
| Modifier and Type | Method and Description |
|---|---|
void |
attachView(View view)
Attach view to view state or to presenter(if view state not exists).
|
void |
destroyView(View view) |
void |
detachView(View view)
Detach view from view state or from presenter(if view state not exists).
|
java.util.Set<View> |
getAttachedViews() |
View |
getViewState() |
boolean |
isInRestoreState(View view)
Check if view is in restore state or not
|
void |
onDestroy()
Called before reference on this presenter will be cleared and instance of presenter
will be never used.
|
protected void |
onFirstViewAttach()
Callback after first presenter init and view binding.
|
void |
setViewState(MvpViewState<View> viewState)
Set view state to presenter
|
public void attachView(View view)
Attach view to view state or to presenter(if view state not exists).
If you use MvpDelegate, you should not call this method directly.
It will be called on MvpDelegate.onAttach(), if view does not attached.
view - to attachmentprotected void onFirstViewAttach()
Callback after first presenter init and view binding. If this presenter instance will have to attach some view in future, this method will not be called.
There you can to interact with mViewState.
public void detachView(View view)
Detach view from view state or from presenter(if view state not exists).
If you use MvpDelegate, you should not call this method directly.
It will be called on MvpDelegate.onDetach().
view - view to detachpublic void destroyView(View view)
public java.util.Set<View> getAttachedViews()
public View getViewState()
public boolean isInRestoreState(View view)
view - view for checkpublic void setViewState(MvpViewState<View> viewState)
viewState - that implements type, setted as View generic parampublic void onDestroy()
Called before reference on this presenter will be cleared and instance of presenter will be never used.