public interface FeatureManager extends Manager
FeatureManager
defines an interface for Manager
component that provides an API
for managing Feature
s.Modifier and Type | Method and Description |
---|---|
boolean |
conditionallyRestartFeature(Feature feature,
FeatureView featureView)
Check the execution state of the given
Feature and if not started then start
the Feature for the given FeatureView . |
Feature |
createFeature(java.lang.Class<? extends Feature> featureClass)
Creates the specified
Feature , but does not start it. |
java.util.List<Feature> |
getActiveChildFeatures(Feature parentFeature)
|
java.util.List<Feature> |
getActiveFeatures()
Gets the currently active
Feature s. |
android.app.Application.ActivityLifecycleCallbacks |
getActivityLifecycleCallback()
Gets an object that implements
Application.ActivityLifecycleCallbacks . |
FeatureContainer |
getFeatureContainer(int featureContainerId)
Gets a
FeatureContainer with the given ID. |
android.app.Activity |
getForegroundActivity()
Gets the
Activity that is currently in foreground. |
java.util.List<Feature> |
getForegroundFeatures()
|
android.app.Activity |
getLastPausedActivity()
Gets the
Activity that is the last paused Activity . |
android.app.Activity |
getLastStoppedActivity()
Gets the
Activity that is the last stopped Activity . |
java.util.List<Feature> |
getPausedFeatures()
Gets the currently paused
Feature s. |
boolean |
hasActiveChildFeatures(Feature parentFeature)
|
boolean |
onBackPressed()
Invoked to handle Back Pressed event received by the
FeatureContainer . |
void |
onFeatureDestroyed(Feature feature)
Invoked by a
PluginStateComponent.destroy() when the Feature } has been destroyed. |
void |
onFeaturePaused(Feature feature,
boolean finishing)
Invoked by a
PluginStateComponent.pause() when the Feature } has been paused. |
void |
onFeatureResumed(Feature feature)
Invoked by a
PluginStateComponent.resume() when the Feature } has been resumed. |
void |
onFeatureStopped(Feature feature)
Invoked by a
PluginStateComponent.stop() when the Feature } has been stopped. |
void |
registerFeatureContainerProvider(FeatureContainerProvider provider)
Register the given
FeatureContainerProvider for this FeatureManager so
that Feature s can access their FeatureContainer s. |
void |
setMockScopeOwner(DependencyScopeOwner owner)
Sets a
DependencyScopeOwner that is used to provide a DependencyScope
containing mock dependencies for testing purposes. |
Feature |
startFeature(FeatureContainer featureContainer,
java.lang.Class<? extends Feature> featureClass)
Creates and starts the specified
Feature whose FeatureCompatFragment s are hosted by
the given FeatureContainer . |
Feature |
startFeature(FeatureContainer featureContainer,
java.lang.Class<? extends Feature> featureClass,
Params params)
Creates and starts the specified
Feature whose FeatureCompatFragment s are
shown using the given FeatureContainer . |
Feature |
startFeature(FeatureContainer featureContainer,
Feature feature)
|
Feature |
startFeature(FeatureContainer featureContainer,
Feature feature,
Params params)
|
Feature |
startFeature(int featureContainerId,
java.lang.Class<? extends Feature> featureClass,
Params params)
Creates and starts the specified
Feature whose FeatureCompatFragment s are
shown using the specified FeatureContainer . |
Feature |
startFeature(int featureContainerId,
Feature feature,
Params params)
|
void |
unregisterFeatureContainerProvider(FeatureContainerProvider provider)
Unregister the given
FeatureContainerProvider from this FeatureManager . |
onPlugged, onPluginPlugged, onPluginUnplugged, onUnplugged
android.app.Application.ActivityLifecycleCallbacks getActivityLifecycleCallback()
Application.ActivityLifecycleCallbacks
.Application.ActivityLifecycleCallbacks
.java.util.List<Feature> getActiveChildFeatures(Feature parentFeature)
parentFeature
- A parent Feature
.List
of child features. May not be null
.boolean hasActiveChildFeatures(Feature parentFeature)
parentFeature
- A parent Feature
.boolean
android.app.Activity getForegroundActivity()
Activity
that is currently in foreground.Activity
. May return null
.android.app.Activity getLastPausedActivity()
Activity
that is the last paused Activity
.Activity
. May return null
.android.app.Activity getLastStoppedActivity()
Activity
that is the last stopped Activity
.Activity
. May return null
.void setMockScopeOwner(DependencyScopeOwner owner)
DependencyScopeOwner
that is used to provide a DependencyScope
containing mock dependencies for testing purposes.owner
- A DependencyScopeOwner
.java.util.List<Feature> getActiveFeatures()
Feature
s.List
of Feature
s.java.util.List<Feature> getPausedFeatures()
Feature
s.List
of Feature
s.FeatureContainer getFeatureContainer(int featureContainerId)
FeatureContainer
with the given ID.featureContainerId
- The ID of the FeatureContainer
.FeatureContainer
.Feature createFeature(java.lang.Class<? extends Feature> featureClass)
Feature
, but does not start it. If the feature is
a DependencyScopeOwner
its DependencyScope
is added to cache of
DependencyScope
s.Feature startFeature(FeatureContainer featureContainer, java.lang.Class<? extends Feature> featureClass)
Feature
whose FeatureCompatFragment
s are hosted by
the given FeatureContainer
.featureContainer
- A FeatureContainer
.featureClass
- A Class
specifying the Feature
to be created and started.Feature
.Feature startFeature(int featureContainerId, java.lang.Class<? extends Feature> featureClass, Params params)
Feature
whose FeatureCompatFragment
s are
shown using the specified FeatureContainer
.featureContainerId
- An ID of the FeatureContainer
. In practice the ID is
the layout view ID of the ViewGroup
that contains the View
.featureClass
- A Class
specifying the Feature
to be created and started.params
- A Params
containing parameters for the created and started Feature
.Feature
.Feature startFeature(FeatureContainer featureContainer, java.lang.Class<? extends Feature> featureClass, Params params)
Feature
whose FeatureCompatFragment
s are
shown using the given FeatureContainer
.featureContainer
- A FeatureContainer
.featureClass
- A Class
specifying the Feature
to be created and started.params
- A Params
containing parameters for the created and started Feature
.Feature
.Feature startFeature(FeatureContainer featureContainer, Feature feature)
featureContainer
- A FeatureContainer
.feature
- {The Feature
to be started.Feature
.Feature startFeature(FeatureContainer featureContainer, Feature feature, Params params)
featureContainer
- A FeatureContainer
.feature
- {The Feature
to be started.params
- A Params
containing parameters for the started Feature
.Feature
.boolean onBackPressed()
FeatureContainer
.boolean
value indicating if the event was consumed by this method.void onFeatureResumed(Feature feature)
PluginStateComponent.resume()
when the Feature
} has been resumed.feature
- A Feature
. May not be null
.void onFeaturePaused(Feature feature, boolean finishing)
PluginStateComponent.pause()
when the Feature
} has been paused.feature
- A Feature
. May not be null
.finishing
- A boolean
value indicating if the PluginStateComponent
is
going to be finished i.e. it is not resumed nor restarted anymore.void onFeatureStopped(Feature feature)
PluginStateComponent.stop()
when the Feature
} has been stopped.feature
- A Feature
. May not be null
.void onFeatureDestroyed(Feature feature)
PluginStateComponent.destroy()
when the Feature
} has been destroyed.feature
- A Feature
. May not be null
.void registerFeatureContainerProvider(FeatureContainerProvider provider)
FeatureContainerProvider
for this FeatureManager
so
that Feature
s can access their FeatureContainer
s.provider
- A FeatureContainerProvider
.void unregisterFeatureContainerProvider(FeatureContainerProvider provider)
FeatureContainerProvider
from this FeatureManager
.provider
- A FeatureContainerProvider
.boolean conditionallyRestartFeature(Feature feature, FeatureView featureView)
Feature
and if not started then start
the Feature
for the given FeatureView
.feature
- A Feature
.featureView
- A FeatureView
.boolean
value if the Feature
was restarted.