public interface Feature extends PresenterListener, PluginStateComponent
Feature
defines an interface for PluginStateComponent
s that implement of
application feature as a component. A concrete Feature
implementation may implement logic
for UI navigation and UI flow logic. A Feature
is also
a DependencyScopeOwner
that provides a DependencyScope
for providing dependencies.Modifier and Type | Method and Description |
---|---|
FeatureView |
addActiveView(FeatureView view)
|
boolean |
canGoBack()
Tests if the previous
FeatureView can be navigated back to. |
void |
clearBackStack()
Clears the back stack managed by
FragmentManager . |
void |
finish()
Finishes this
Feature . |
java.util.List<FeatureView> |
getActiveViews()
Gets the currently active
FeatureView s. |
FeatureContainer |
getFeatureContainer()
|
Params |
getParams()
|
Feature |
getParentFeature()
|
void |
goBack()
Goes back to previous
FeatureView . |
boolean |
hasBackStackViews()
Tests if this
Feature has any FeatureView s in back stack. |
boolean |
hasForegroundView()
Tests if this
Feature is in foreground i.e. |
void |
hideView(java.lang.Class<? extends Presenter> presenterClass,
boolean addedToBackStack,
java.lang.String tag)
Hides the
FeatureView attached to the given Presenter . |
void |
hideView(FeaturePresenter presenter,
boolean addedToBackStack,
java.lang.String tag)
Hides the
FeatureView attached to the given Presenter . |
boolean |
isActiveView(FeatureView view)
Tests if the given
FeatureView is currently active one. |
boolean |
isActivityFeature()
Tests if this
Feature is set to be an Activity Feature that is owned and controlled
by an Activity . |
boolean |
isBackPressedEventHandler()
Tests if this
Feature handles the back pressed event. |
void |
onFeatureContainerPaused(FeatureContainer container,
boolean finishing)
Invoked when a
FeatureContainer has been paused. |
void |
onFeatureContainerResumed(FeatureContainer container)
Invoked when a
FeatureContainer has been resumed. |
void |
onFeatureContainerStarted(FeatureContainer container)
Invoked when a
FeatureContainer has been started. |
void |
onFeatureContainerStopped(FeatureContainer container,
boolean finishing)
Invoked when a
FeatureContainer has been stopped. |
void |
pause(boolean finishing)
Invoked to pause this
Feature . |
FeatureView |
removeActiveView(FeatureView view)
|
void |
setActivityFeature(boolean isActivityFeature)
Sets this
Feature to be an Activity Feature that is owned and controlled by
an Activity . |
void |
setFeatureContainer(FeatureContainer container)
|
void |
setFeatureManager(FeatureManager manager)
Sets the
FeatureManager that started this Feature . |
void |
setParentFeature(Feature parentFeature)
|
FeatureView |
showView(java.lang.Class<? extends Presenter> presenterClass,
boolean addToBackStack,
Params... params)
Shows the
FeatureView attached to the specified Presenter . |
FeatureView |
showView(FeatureTransitionManager transitionManager,
java.lang.Class<? extends Presenter> presenterClass,
boolean addToBackStack,
java.lang.String tag,
Params... params)
Shows the
FeatureView attached to the specified Presenter . |
FeatureView |
showView(int featureContainerId,
java.lang.Class<? extends Presenter> presenterClass,
boolean addToBackStack,
java.lang.String tag,
Params... params)
Shows the
FeatureView attached to the specified Presenter . |
onPresenterFinished
destroy, getLifecycleState, getState, isDestroyed, isPaused, isRestarted, isResumed, isStarted, isStopped, pause, restart, resume, start, start, stop
onPlugged, onPluginPlugged, onPluginUnplugged, onUnplugged
java.util.List<FeatureView> getActiveViews()
FeatureView
s.List
containing the currently active views as FeatureView
s.boolean isActiveView(FeatureView view)
FeatureView
is currently active one.view
- A FeatureView
.boolean
value.FeatureView addActiveView(FeatureView view)
view
- A FeatureView
to be added.FeatureView
if it was added as a new active FeatureView
.FeatureView removeActiveView(FeatureView view)
view
- A FeatureView
to be removed.FeatureView
if it was removed from being an active FeatureView
.void setFeatureManager(FeatureManager manager)
FeatureManager
that started this Feature
.manager
- A FeatureManager
.FeatureContainer getFeatureContainer()
FeatureContainer
.void setFeatureContainer(FeatureContainer container)
container
- A FeatureContainer
.void setParentFeature(Feature parentFeature)
parentFeature
- A Feature
.void setActivityFeature(boolean isActivityFeature)
Feature
to be an Activity Feature that is owned and controlled by
an Activity
.isActivityFeature
- A boolean
value.boolean isActivityFeature()
Feature
is set to be an Activity Feature that is owned and controlled
by an Activity
.boolean
value.boolean hasForegroundView()
Feature
is in foreground i.e. it has at least one visible
FeatureView
.boolean
value.boolean isBackPressedEventHandler()
Feature
handles the back pressed event.boolean
value.boolean hasBackStackViews()
Feature
has any FeatureView
s in back stack.boolean
value.void clearBackStack()
FragmentManager
.boolean canGoBack()
FeatureView
can be navigated back to.boolean
value.void goBack()
FeatureView
.void pause(boolean finishing)
Feature
.finishing
- A boolean
value indicating if the Feature
is
going to be finished i.e. it is not resumed nor restarted anymore.void finish()
Feature
. A finished Feature
is stopped and destroyed.
If a Feature
is implements a PluginComponent
it is
unplugged from a PluginBus
.FeatureView showView(java.lang.Class<? extends Presenter> presenterClass, boolean addToBackStack, Params... params)
FeatureView
attached to the specified Presenter
.presenterClass
- A Class
specifying the Presenter
.addToBackStack
- A boolean
value specifying if the FeatureView
is added
to back stack.params
- Optional Params
.FeatureView
. May be PlugInvoker
.FeatureView showView(int featureContainerId, java.lang.Class<? extends Presenter> presenterClass, boolean addToBackStack, java.lang.String tag, Params... params)
FeatureView
attached to the specified Presenter
.
The FeatureView
is shown using the specified FeatureContainer
.featureContainerId
- An id of the FeatureContainer
.presenterClass
- A Class
specifying the Presenter
.addToBackStack
- A boolean
value specifying if the FeatureView
is to
be added to back stack.tag
- A tag for the FeatureView
used for FragmentTransaction
.
May be null
.params
- Optional Params
.FeatureView
. May be PlugInvoker
.FeatureView showView(FeatureTransitionManager transitionManager, java.lang.Class<? extends Presenter> presenterClass, boolean addToBackStack, java.lang.String tag, Params... params)
FeatureView
attached to the specified Presenter
.
The FeatureView
is shown using the given FeatureTransitionManager
.transitionManager
- A FeatureTransitionManager
.presenterClass
- A Class
specifying the Presenter
.addToBackStack
- A boolean
value specifying if the FeatureView
is to
be added to back stack.tag
- A tag for the FeatureView
used for FragmentTransaction
.
May be null
.params
- Optional Params
.FeatureView
. May be PlugInvoker
.void hideView(java.lang.Class<? extends Presenter> presenterClass, boolean addedToBackStack, java.lang.String tag)
FeatureView
attached to the given Presenter
.presenterClass
- A Presenter
.addedToBackStack
- A boolean
value specifying if the FeatureView
was
added to backstack.tag
- A tag for the FeatureView
used for FragmentTransaction
.
May be null
.void hideView(FeaturePresenter presenter, boolean addedToBackStack, java.lang.String tag)
FeatureView
attached to the given Presenter
.presenter
- A Presenter
.addedToBackStack
- A boolean
value specifying if the FeatureView
was
added to backstack.tag
- A tag for the FeatureView
used for FragmentTransaction
.
May be null
.void onFeatureContainerStarted(FeatureContainer container)
FeatureContainer
has been started.container
- A FeatureContainer
.void onFeatureContainerPaused(FeatureContainer container, boolean finishing)
FeatureContainer
has been paused.container
- A FeatureContainer
.finishing
- A boolean
flag indicating if the FeatureContainer
is finishing.void onFeatureContainerResumed(FeatureContainer container)
FeatureContainer
has been resumed.container
- A FeatureContainer
.void onFeatureContainerStopped(FeatureContainer container, boolean finishing)
FeatureContainer
has been stopped.container
- A FeatureContainer
.finishing
- A boolean
flag indicating if the FeatureContainer
is finishing.