Class DefaultVisibilityController

java.lang.Object
com.castlabs.sdk.playerui.DefaultVisibilityController
All Implemented Interfaces:
VisibilityController

public class DefaultVisibilityController extends Object implements VisibilityController
Default implementation of the VisibilityController that enabled animation and auto hiding.
Since:
4.0.0
  • Constructor Details

    • DefaultVisibilityController

      public DefaultVisibilityController(View view)
      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

      public void setHideAnimator(ObjectAnimator hideAnimator)
      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 supports Gravity.TOP and Gravity.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 interface VisibilityController
      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 interface VisibilityController
      Parameters:
      userInteraction - Indicates that the call was due to a user interaction
    • isVisible

      public boolean isVisible()
      Specified by:
      isVisible in interface VisibilityController
      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 interface VisibilityController
    • 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 interface VisibilityController