Class RequirementsWatcher
- java.lang.Object
-
- com.google.android.exoplayer2.scheduler.RequirementsWatcher
-
public final class RequirementsWatcher extends Object
Watches whether theRequirements
are met and notifies theRequirementsWatcher.Listener
on changes.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
RequirementsWatcher.Listener
Notified when RequirementsWatcher instance first created and on changes whether theRequirements
are met.
-
Constructor Summary
Constructors Constructor Description RequirementsWatcher(Context context, RequirementsWatcher.Listener listener, Requirements requirements)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Requirements
getRequirements()
Returns watchedRequirements
.@com.google.android.exoplayer2.scheduler.Requirements.RequirementFlags int
start()
Starts watching for changes.void
stop()
Stops watching for changes.
-
-
-
Constructor Detail
-
RequirementsWatcher
public RequirementsWatcher(Context context, RequirementsWatcher.Listener listener, Requirements requirements)
- Parameters:
context
- Any context.listener
- Notified whether theRequirements
are met.requirements
- The requirements to watch.
-
-
Method Detail
-
start
@RequirementFlags public @com.google.android.exoplayer2.scheduler.Requirements.RequirementFlags int start()
Starts watching for changes. Must be called from a thread that has an associatedLooper
. Listener methods are called on the caller thread.- Returns:
- Initial
RequirementFlags
that are not met, or 0.
-
stop
public void stop()
Stops watching for changes.
-
getRequirements
public Requirements getRequirements()
Returns watchedRequirements
.
-
-