Package com.castlabs.sdk.playerui
Class DefaultVisibilityController
java.lang.Object
com.castlabs.sdk.playerui.DefaultVisibilityController
- All Implemented Interfaces:
VisibilityController
Default implementation of the
VisibilityController
that enabled animation
and auto hiding.- Since:
- 4.0.0
-
Constructor Summary
ConstructorDescriptionCreate a new instance of this controller with the view that will be controlled by it. -
Method Summary
Modifier and TypeMethodDescriptionint
void
hide
(boolean userInteraction) Called when the controlled view should be made invisiblvoid
Call this method when the user starts interacting with the view under control.void
Call this method when the user stopped interacting with the component under control.boolean
boolean
void
setAnimationDurationMs
(int animationDurationMs) Set the animation duration in millisecondsvoid
setAnimationEnabled
(boolean animationEnabled) Enable animationvoid
setAutoHideDelayMs
(int autoHideDelayMs) Set the delay in milliseconds when the controller should auto-hide a view.void
setAutoHideEnabled
(boolean autoHideEnabled) Enable or disable auto hidingvoid
setHideAnimator
(ObjectAnimator hideAnimator) Set the hide animator that will be used to hide the controlled view.void
setViewPosition
(int viewPosition) Set the position of the controlled view relative to its parent.void
show
(boolean userInteraction) Called when the controlled view should be made visible
-
Constructor Details
-
DefaultVisibilityController
Create a new instance of this controller with the view that will be controlled by it. Animation will be enabled and the assumption is that the view position is at the bottom of the parent component.Auto hiding will also be enabled by default.
- Parameters:
view
- The view
-
-
Method Details
-
setHideAnimator
Set the hide animator that will be used to hide the controlled view. Showing will be animated by reversing the animator- Parameters:
hideAnimator
- The animator
-
setAnimationEnabled
public void setAnimationEnabled(boolean animationEnabled) Enable animation- Parameters:
animationEnabled
- Enable or disable animation
-
setAnimationDurationMs
public void setAnimationDurationMs(int animationDurationMs) Set the animation duration in milliseconds- Parameters:
animationDurationMs
- The animation duration
-
getAutoHideDelayMs
public int getAutoHideDelayMs()- Returns:
- delayMs The delay in milliseconds when the controller should auto-hide a view
-
setAutoHideDelayMs
public void setAutoHideDelayMs(int autoHideDelayMs) Set the delay in milliseconds when the controller should auto-hide a view. Calling this method will reset the ongoing inner timer to hide the controls.- Parameters:
autoHideDelayMs
- The delay in milliseconds
-
isAutoHideEnabled
public boolean isAutoHideEnabled()- Returns:
- True if auto hiding is enable
-
setAutoHideEnabled
public void setAutoHideEnabled(boolean autoHideEnabled) Enable or disable auto hiding- Parameters:
autoHideEnabled
- Enable or disable auto hiding
-
setViewPosition
public void setViewPosition(int viewPosition) Set the position of the controlled view relative to its parent. This currently supportsGravity.TOP
andGravity.BOTTOM
and is used to create the default move in and out animation- Parameters:
viewPosition
- The view position
-
show
public void show(boolean userInteraction) Description copied from interface:VisibilityController
Called when the controlled view should be made visible- Specified by:
show
in interfaceVisibilityController
- Parameters:
userInteraction
- Indicates that the call was due to a user interaction
-
hide
public void hide(boolean userInteraction) Description copied from interface:VisibilityController
Called when the controlled view should be made invisibl- Specified by:
hide
in interfaceVisibilityController
- Parameters:
userInteraction
- Indicates that the call was due to a user interaction
-
isVisible
public boolean isVisible()- Specified by:
isVisible
in interfaceVisibilityController
- Returns:
- True if the view is visible or about to become visible, i.e. an animation is running that will make the view visible when finished
-
interactionStarted
public void interactionStarted()Description copied from interface:VisibilityController
Call this method when the user starts interacting with the view under control. This should disable for example any auto-hiding function.- Specified by:
interactionStarted
in interfaceVisibilityController
-
interactionStopped
public void interactionStopped()Description copied from interface:VisibilityController
Call this method when the user stopped interacting with the component under control.- Specified by:
interactionStopped
in interfaceVisibilityController
-