Class VisualComponentProxy
- All Implemented Interfaces:
PlayerControllerPlugin.Component,PlayerControllerPlugin.ComponentViewListener,PlayerControllerPlugin.VisualComponent
- Direct Known Subclasses:
ExoSubtitlesRendererPlugin.ExoSubtitleComponent
PlayerControllerPlugin.ComponentViewListener
with the PlayerControllerPlugin.Component machinery.
Here we forward the events to a PlayerControllerPlugin.ComponentViewListener.
Thus giving it a chance to update its inner View.
We also take care of async calls. For instance, the SubtitlesTrackRenderer will set the
listener
in its createRenderer() call. This is too late, for instance in the case where the client
code uses PlayerController.scanComponentViews(ViewGroup). In this case, we would be
called scanComponentViews(ViewGroup) before having a componentsViewListener.
That's why we save the ViewGroup and forward the pending call to the
listener as soon as it is set.
Users of this Class should implement the PlayerControllerPlugin.Component.id() method returning the concrete
Class's class. This is why you should *not* create anonymous concrete Classes.
- Since:
- 4.2.2
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidonComponentViewsChanged(PlayerController playerController) Called whenever the list of ComponentViews in thePlayerControllerhas changed.voidonDestroy(PlayerController playerController) Called when the controller is destroyed.voidonOpenBundle(PlayerController playerController, Bundle bundle) Called when the player controller is opened with a bundle.voidonOpenState(PlayerController playerController, PlayerConfig playerConfig) Called when the player controller is opened with a config.scanComponentViews(ViewGroup container) Implementors should scan for the "desired" Views.voidsetComponentViewListener(PlayerControllerPlugin.ComponentViewListener componentsViewListener) Sets the Listener.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.castlabs.android.player.PlayerControllerPlugin.Component
id
-
Constructor Details
-
VisualComponentProxy
public VisualComponentProxy()Default constructor.
-
-
Method Details
-
onDestroy
Description copied from interface:PlayerControllerPlugin.ComponentCalled when the controller is destroyed. Implementation must use this to unregister any listeners that were attached to the controller before.- Specified by:
onDestroyin interfacePlayerControllerPlugin.Component- Parameters:
playerController- The player controller
-
onOpenBundle
Description copied from interface:PlayerControllerPlugin.ComponentCalled when the player controller is opened with a bundle. Implementations can use this to extract or modify bundle data.- Specified by:
onOpenBundlein interfacePlayerControllerPlugin.Component- Parameters:
playerController- The player controllerbundle- The bundle
-
onOpenState
Description copied from interface:PlayerControllerPlugin.ComponentCalled when the player controller is opened with a config. Implementations can use this to extract or modify config data.- Specified by:
onOpenStatein interfacePlayerControllerPlugin.Component- Parameters:
playerController- The player controllerplayerConfig- The playback state
-
onComponentViewsChanged
Description copied from interface:PlayerControllerPlugin.ComponentViewListenerCalled whenever the list of ComponentViews in thePlayerControllerhas changed. This is whenever a View is added, or removed. Implementors should use this callback to detach from an old View (if any) and attach to the new one (if any). It is possible that there's actually no change affecting one particular ComponentViewListener. In this case the callback should just be ignored.- Specified by:
onComponentViewsChangedin interfacePlayerControllerPlugin.ComponentViewListener- Parameters:
playerController- the PlayerController firing this event.
-
scanComponentViews
Description copied from interface:PlayerControllerPlugin.ComponentViewListenerImplementors should scan for the "desired" Views. The Views could be at any hierarchy level, so the use ofView.findViewById(int)is encouraged. You *should not* hold a reference to the found Views.- Specified by:
scanComponentViewsin interfacePlayerControllerPlugin.ComponentViewListener- Parameters:
container- the ViewGroup where there specific Views should be looked for.- Returns:
- a Collection of the found Views in the container
-
setComponentViewListener
public void setComponentViewListener(PlayerControllerPlugin.ComponentViewListener componentsViewListener) Sets the Listener.Will be immediately called if there's a pending
scanComponentViews(ViewGroup)call.- Parameters:
componentsViewListener- the listener to set
-