Package moxy.viewstate
Class MvpViewState<View extends MvpView>
- java.lang.Object
-
- moxy.viewstate.MvpViewState<View>
-
- Direct Known Subclasses:
DefaultViewState
public abstract class MvpViewState<View extends MvpView> extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Set<View>inRestoreStateprotected ViewCommands<View>viewCommandsprotected java.util.Set<View>viewsprotected java.util.Map<View,java.util.Set<ViewCommand<View>>>viewStates
-
Constructor Summary
Constructors Constructor Description MvpViewState()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidattachView(View view)Attach view to view state and apply a saved statevoiddestroyView(View view)voiddetachView(View view)Detach a view from the view state.java.util.Set<View>getViews()protected java.lang.BooleanhasNotView()booleanisInRestoreState(View view)Check if the view is in a restore state or notprotected voidrestoreState(View view, java.util.Set<ViewCommand<View>> currentState)Apply a saved state to the attached view
-
-
-
Field Detail
-
viewCommands
protected ViewCommands<View extends MvpView> viewCommands
-
viewStates
protected java.util.Map<View extends MvpView,java.util.Set<ViewCommand<View extends MvpView>>> viewStates
-
-
Method Detail
-
restoreState
protected void restoreState(View view, java.util.Set<ViewCommand<View>> currentState)
Apply a saved state to the attached view- Parameters:
view- mvp view to restore statecurrentState- commands that was applied already
-
hasNotView
protected java.lang.Boolean hasNotView()
- Returns:
- true if the view state has one or more views, false otherwise (if the view state doesn't have any view)
-
attachView
public void attachView(View view)
Attach view to view state and apply a saved state- Parameters:
view- attachment
-
detachView
public void detachView(View view)
Detach a view from the view state. After this call view state will save commands via
StateStrategy.beforeApply(List, ViewCommand).- Parameters:
view- target mvp view to detach
-
destroyView
public void destroyView(View view)
-
getViews
public java.util.Set<View> getViews()
- Returns:
- views attached to this view state instance
-
isInRestoreState
public boolean isInRestoreState(View view)
Check if the view is in a restore state or not- Parameters:
view- a view for check- Returns:
- true if this view state is restoring state to the given view. false otherwise.
-
-