public abstract class AbstractFeatureManager extends AbstractManager implements FeatureManager, android.app.Application.ActivityLifecycleCallbacks
AbstractFeatureManager
provides a default implementation of FeatureManager
.Constructor and Description |
---|
AbstractFeatureManager() |
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()
|
static FeatureManager |
getInstance() |
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)
|
void |
onActivityCreated(android.app.Activity activity,
android.os.Bundle inState) |
void |
onActivityDestroyed(android.app.Activity activity) |
void |
onActivityPaused(android.app.Activity activity) |
void |
onActivityResumed(android.app.Activity activity) |
void |
onActivitySaveInstanceState(android.app.Activity activity,
android.os.Bundle outState) |
void |
onActivityStarted(android.app.Activity activity) |
void |
onActivityStopped(android.app.Activity activity) |
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. |
static void |
setInstance(FeatureManager instance) |
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
getScope, setScope
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
onPlugged, onPluginPlugged, onPluginUnplugged, onUnplugged
public static FeatureManager getInstance()
public static void setInstance(FeatureManager instance)
public java.util.List<Feature> getActiveChildFeatures(Feature parentFeature)
FeatureManager
getActiveChildFeatures
in interface FeatureManager
parentFeature
- A parent Feature
.List
of child features. May not be null
.public boolean hasActiveChildFeatures(Feature parentFeature)
FeatureManager
hasActiveChildFeatures
in interface FeatureManager
parentFeature
- A parent Feature
.boolean
public android.app.Application.ActivityLifecycleCallbacks getActivityLifecycleCallback()
FeatureManager
Application.ActivityLifecycleCallbacks
.getActivityLifecycleCallback
in interface FeatureManager
Application.ActivityLifecycleCallbacks
.public android.app.Activity getForegroundActivity()
FeatureManager
Activity
that is currently in foreground.getForegroundActivity
in interface FeatureManager
Activity
. May return null
.public android.app.Activity getLastPausedActivity()
FeatureManager
Activity
that is the last paused Activity
.getLastPausedActivity
in interface FeatureManager
Activity
. May return null
.public android.app.Activity getLastStoppedActivity()
FeatureManager
Activity
that is the last stopped Activity
.getLastStoppedActivity
in interface FeatureManager
Activity
. May return null
.public void setMockScopeOwner(DependencyScopeOwner owner)
FeatureManager
DependencyScopeOwner
that is used to provide a DependencyScope
containing mock dependencies for testing purposes.setMockScopeOwner
in interface FeatureManager
owner
- A DependencyScopeOwner
.public java.util.List<Feature> getActiveFeatures()
FeatureManager
Feature
s.getActiveFeatures
in interface FeatureManager
List
of Feature
s.public java.util.List<Feature> getPausedFeatures()
FeatureManager
Feature
s.getPausedFeatures
in interface FeatureManager
List
of Feature
s.public java.util.List<Feature> getForegroundFeatures()
FeatureManager
getForegroundFeatures
in interface FeatureManager
List
of Feature
s.public FeatureContainer getFeatureContainer(int featureContainerId)
FeatureManager
FeatureContainer
with the given ID.getFeatureContainer
in interface FeatureManager
featureContainerId
- The ID of the FeatureContainer
.FeatureContainer
.public Feature createFeature(java.lang.Class<? extends Feature> featureClass)
FeatureManager
Feature
, but does not start it. If the feature is
a DependencyScopeOwner
its DependencyScope
is added to cache of
DependencyScope
s.createFeature
in interface FeatureManager
featureClass
- A Feature
Feature
.public Feature startFeature(FeatureContainer featureContainer, java.lang.Class<? extends Feature> featureClass)
FeatureManager
Feature
whose FeatureCompatFragment
s are hosted by
the given FeatureContainer
.startFeature
in interface FeatureManager
featureContainer
- A FeatureContainer
.featureClass
- A Class
specifying the Feature
to be created and started.Feature
.public Feature startFeature(int featureContainerId, java.lang.Class<? extends Feature> featureClass, Params params)
FeatureManager
Feature
whose FeatureCompatFragment
s are
shown using the specified FeatureContainer
.startFeature
in interface FeatureManager
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
.public Feature startFeature(FeatureContainer featureContainer, java.lang.Class<? extends Feature> featureClass, Params params)
FeatureManager
Feature
whose FeatureCompatFragment
s are
shown using the given FeatureContainer
.startFeature
in interface FeatureManager
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
.public Feature startFeature(FeatureContainer featureContainer, Feature feature)
FeatureManager
startFeature
in interface FeatureManager
featureContainer
- A FeatureContainer
.feature
- {The Feature
to be started.Feature
.public Feature startFeature(FeatureContainer featureContainer, Feature feature, Params params)
FeatureManager
startFeature
in interface FeatureManager
featureContainer
- A FeatureContainer
.feature
- {The Feature
to be started.params
- A Params
containing parameters for the started Feature
.Feature
.public Feature startFeature(int featureContainerId, Feature feature, Params params)
FeatureManager
startFeature
in interface FeatureManager
featureContainerId
- An ID of the FeatureContainer
. In practice the ID is
the layout view ID of the ViewGroup
that contains the View
.feature
- {The Feature
to be started.params
- A Params
containing parameters for the started Feature
.Feature
.public boolean conditionallyRestartFeature(Feature feature, FeatureView featureView)
FeatureManager
Feature
and if not started then start
the Feature
for the given FeatureView
.conditionallyRestartFeature
in interface FeatureManager
feature
- A Feature
.featureView
- A FeatureView
.boolean
value if the Feature
was restarted.public void registerFeatureContainerProvider(FeatureContainerProvider provider)
FeatureManager
FeatureContainerProvider
for this FeatureManager
so
that Feature
s can access their FeatureContainer
s.registerFeatureContainerProvider
in interface FeatureManager
provider
- A FeatureContainerProvider
.public void unregisterFeatureContainerProvider(FeatureContainerProvider provider)
FeatureManager
FeatureContainerProvider
from this FeatureManager
.unregisterFeatureContainerProvider
in interface FeatureManager
provider
- A FeatureContainerProvider
.public boolean onBackPressed()
FeatureContainer
.onBackPressed
in interface FeatureManager
boolean
value indicating if the event was consumed by this method.public void onFeatureResumed(Feature feature)
FeatureManager
PluginStateComponent.resume()
when the Feature
} has been resumed.onFeatureResumed
in interface FeatureManager
feature
- A Feature
. May not be null
.public void onFeaturePaused(Feature feature, boolean finishing)
FeatureManager
PluginStateComponent.pause()
when the Feature
} has been paused.onFeaturePaused
in interface FeatureManager
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.public void onFeatureStopped(Feature feature)
FeatureManager
PluginStateComponent.stop()
when the Feature
} has been stopped.onFeatureStopped
in interface FeatureManager
feature
- A Feature
. May not be null
.public void onFeatureDestroyed(Feature feature)
FeatureManager
PluginStateComponent.destroy()
when the Feature
} has been destroyed.onFeatureDestroyed
in interface FeatureManager
feature
- A Feature
. May not be null
.public void onActivityCreated(android.app.Activity activity, android.os.Bundle inState)
onActivityCreated
in interface android.app.Application.ActivityLifecycleCallbacks
public void onActivityStarted(android.app.Activity activity)
onActivityStarted
in interface android.app.Application.ActivityLifecycleCallbacks
public void onActivityResumed(android.app.Activity activity)
onActivityResumed
in interface android.app.Application.ActivityLifecycleCallbacks
public void onActivityPaused(android.app.Activity activity)
onActivityPaused
in interface android.app.Application.ActivityLifecycleCallbacks
public void onActivityStopped(android.app.Activity activity)
onActivityStopped
in interface android.app.Application.ActivityLifecycleCallbacks
public void onActivitySaveInstanceState(android.app.Activity activity, android.os.Bundle outState)
onActivitySaveInstanceState
in interface android.app.Application.ActivityLifecycleCallbacks
public void onActivityDestroyed(android.app.Activity activity)
onActivityDestroyed
in interface android.app.Application.ActivityLifecycleCallbacks