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 a view state or to a presenter (if a view state doesn't exist).
|
void |
destroyView(View view) |
void |
detachView(View view)
Detach view from a view state or from a presenter (if a view state doesn't exist).
|
java.util.Set<View> |
getAttachedViews() |
View |
getViewState() |
boolean |
isInRestoreState(View view)
Check if view is in restore state or not
|
void |
onDestroy()
Called before the reference to this presenter will be cleared and an instance of the presenter
will be never used.
|
protected void |
onFirstViewAttach()
Callback after the first presenter init and view binding.
|
void |
setViewState(MvpViewState<View> viewState)
Set a view state to the presenter
|
public void attachView(View view)
Attach view to a view state or to a presenter (if a view state doesn't exist).
If you're using a MvpDelegate, you should not call this method directly.
It will be called on MvpDelegate.onAttach(), if a view is not attached yet.
view - a view to attachprotected void onFirstViewAttach()
Callback after the first presenter init and view binding. If this presenter instance will have to attach more views in the future, this method will not be called.
There you can interact with a viewState.
public void detachView(View view)
Detach view from a view state or from a presenter (if a view state doesn't exist).
If you're using a MvpDelegate, you should not call this method directly.
It will be called on MvpDelegate.onDetach().
view - a view to detachpublic void destroyView(View view)
public java.util.Set<View> getAttachedViews()
public View getViewState()
public void setViewState(MvpViewState<View> viewState)
viewState - that implements type, setted as View generic parampublic boolean isInRestoreState(View view)
view - a view for checkpublic void onDestroy()
Called before the reference to this presenter will be cleared and an instance of the presenter will be never used.