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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
onComponentViewsChanged
(PlayerController playerController) Called whenever the list of ComponentViews in thePlayerController
has changed.void
onDestroy
(PlayerController playerController) Called when the controller is destroyed.void
onOpenBundle
(PlayerController playerController, Bundle bundle) Called when the player controller is opened with a bundle.void
onOpenState
(PlayerController playerController, PlayerConfig playerConfig) Called when the player controller is opened with a config.scanComponentViews
(ViewGroup container) Implementors should scan for the "desired" Views.void
setComponentViewListener
(PlayerControllerPlugin.ComponentViewListener componentsViewListener) Sets the Listener.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.castlabs.android.player.PlayerControllerPlugin.Component
id
-
Constructor Details
-
VisualComponentProxy
public VisualComponentProxy()
-
-
Method Details
-
onDestroy
Description copied from interface:PlayerControllerPlugin.Component
Called when the controller is destroyed. Implementation must use this to unregister any listeners that were attached to the controller before.- Specified by:
onDestroy
in interfacePlayerControllerPlugin.Component
- Parameters:
playerController
- The player controller
-
onOpenBundle
Description copied from interface:PlayerControllerPlugin.Component
Called when the player controller is opened with a bundle. Implementations can use this to extract or modify bundle data.- Specified by:
onOpenBundle
in interfacePlayerControllerPlugin.Component
- Parameters:
playerController
- The player controllerbundle
- The bundle
-
onOpenState
Description copied from interface:PlayerControllerPlugin.Component
Called when the player controller is opened with a config. Implementations can use this to extract or modify config data.- Specified by:
onOpenState
in interfacePlayerControllerPlugin.Component
- Parameters:
playerController
- The player controllerplayerConfig
- The playback state
-
onComponentViewsChanged
Description copied from interface:PlayerControllerPlugin.ComponentViewListener
Called whenever the list of ComponentViews in thePlayerController
has 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:
onComponentViewsChanged
in interfacePlayerControllerPlugin.ComponentViewListener
- Parameters:
playerController
- the PlayerController firing this event.
-
scanComponentViews
Description copied from interface:PlayerControllerPlugin.ComponentViewListener
Implementors 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:
scanComponentViews
in 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
-