public abstract class VideoControls
extends android.widget.RelativeLayout
VideoView to have a single "View" to add
or remove for the Default Video Controls.| Modifier and Type | Class and Description |
|---|---|
protected class |
VideoControls.InternalListener
An internal class used to handle the default functionality for the
VideoControls
|
android.widget.RelativeLayout.LayoutParamsandroid.view.ViewGroup.MarginLayoutParams, android.view.ViewGroup.OnHierarchyChangeListenerandroid.view.View.AccessibilityDelegate, android.view.View.BaseSavedState, android.view.View.DragShadowBuilder, android.view.View.MeasureSpec, android.view.View.OnApplyWindowInsetsListener, android.view.View.OnAttachStateChangeListener, android.view.View.OnClickListener, android.view.View.OnContextClickListener, android.view.View.OnCreateContextMenuListener, android.view.View.OnDragListener, android.view.View.OnFocusChangeListener, android.view.View.OnGenericMotionListener, android.view.View.OnHoverListener, android.view.View.OnKeyListener, android.view.View.OnLayoutChangeListener, android.view.View.OnLongClickListener, android.view.View.OnScrollChangeListener, android.view.View.OnSystemUiVisibilityChangeListener, android.view.View.OnTouchListener| Modifier and Type | Field and Description |
|---|---|
protected VideoControlsButtonListener |
buttonsListener |
protected boolean |
canViewHide |
protected static long |
CONTROL_VISIBILITY_ANIMATION_LENGTH |
protected android.view.ViewGroup |
controlsContainer |
protected android.widget.TextView |
currentTimeTextView |
static int |
DEFAULT_CONTROL_HIDE_DELAY |
protected android.widget.TextView |
descriptionTextView |
protected android.util.SparseBooleanArray |
enabledViews |
protected android.widget.TextView |
endTimeTextView |
protected long |
hideDelay |
protected boolean |
hideEmptyTextContainer |
protected VideoControls.InternalListener |
internalListener |
protected boolean |
isLoading |
protected boolean |
isVisible |
protected android.widget.ProgressBar |
loadingProgressBar |
protected android.widget.ImageButton |
nextButton |
protected android.graphics.drawable.Drawable |
pauseDrawable |
protected android.graphics.drawable.Drawable |
playDrawable |
protected android.widget.ImageButton |
playPauseButton |
protected android.widget.ImageButton |
previousButton |
protected Repeater |
progressPollRepeater |
protected VideoControlsSeekListener |
seekListener |
protected android.widget.TextView |
subTitleTextView |
protected android.view.ViewGroup |
textContainer |
protected android.widget.TextView |
titleTextView |
protected VideoView |
videoView |
protected android.os.Handler |
visibilityHandler |
protected VideoControlsVisibilityListener |
visibilityListener |
ABOVE, ALIGN_BASELINE, ALIGN_BOTTOM, ALIGN_END, ALIGN_LEFT, ALIGN_PARENT_BOTTOM, ALIGN_PARENT_END, ALIGN_PARENT_LEFT, ALIGN_PARENT_RIGHT, ALIGN_PARENT_START, ALIGN_PARENT_TOP, ALIGN_RIGHT, ALIGN_START, ALIGN_TOP, BELOW, CENTER_HORIZONTAL, CENTER_IN_PARENT, CENTER_VERTICAL, END_OF, LEFT_OF, RIGHT_OF, START_OF, TRUECLIP_TO_PADDING_MASK, FOCUS_AFTER_DESCENDANTS, FOCUS_BEFORE_DESCENDANTS, FOCUS_BLOCK_DESCENDANTS, LAYOUT_MODE_CLIP_BOUNDS, LAYOUT_MODE_OPTICAL_BOUNDS, PERSISTENT_ALL_CACHES, PERSISTENT_ANIMATION_CACHE, PERSISTENT_NO_CACHE, PERSISTENT_SCROLLING_CACHEACCESSIBILITY_LIVE_REGION_ASSERTIVE, ACCESSIBILITY_LIVE_REGION_NONE, ACCESSIBILITY_LIVE_REGION_POLITE, ALPHA, DRAG_FLAG_GLOBAL, DRAG_FLAG_GLOBAL_PERSISTABLE_URI_PERMISSION, DRAG_FLAG_GLOBAL_PREFIX_URI_PERMISSION, DRAG_FLAG_GLOBAL_URI_READ, DRAG_FLAG_GLOBAL_URI_WRITE, DRAG_FLAG_OPAQUE, DRAWING_CACHE_QUALITY_AUTO, DRAWING_CACHE_QUALITY_HIGH, DRAWING_CACHE_QUALITY_LOW, EMPTY_STATE_SET, ENABLED_FOCUSED_SELECTED_STATE_SET, ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, ENABLED_FOCUSED_STATE_SET, ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET, ENABLED_SELECTED_STATE_SET, ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET, ENABLED_STATE_SET, ENABLED_WINDOW_FOCUSED_STATE_SET, FIND_VIEWS_WITH_CONTENT_DESCRIPTION, FIND_VIEWS_WITH_TEXT, FOCUS_BACKWARD, FOCUS_DOWN, FOCUS_FORWARD, FOCUS_LEFT, FOCUS_RIGHT, FOCUS_UP, FOCUSABLES_ALL, FOCUSABLES_TOUCH_MODE, FOCUSED_SELECTED_STATE_SET, FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, FOCUSED_STATE_SET, FOCUSED_WINDOW_FOCUSED_STATE_SET, GONE, HAPTIC_FEEDBACK_ENABLED, IMPORTANT_FOR_ACCESSIBILITY_AUTO, IMPORTANT_FOR_ACCESSIBILITY_NO, IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS, IMPORTANT_FOR_ACCESSIBILITY_YES, INVISIBLE, KEEP_SCREEN_ON, LAYER_TYPE_HARDWARE, LAYER_TYPE_NONE, LAYER_TYPE_SOFTWARE, LAYOUT_DIRECTION_INHERIT, LAYOUT_DIRECTION_LOCALE, LAYOUT_DIRECTION_LTR, LAYOUT_DIRECTION_RTL, MEASURED_HEIGHT_STATE_SHIFT, MEASURED_SIZE_MASK, MEASURED_STATE_MASK, MEASURED_STATE_TOO_SMALL, NO_ID, OVER_SCROLL_ALWAYS, OVER_SCROLL_IF_CONTENT_SCROLLS, OVER_SCROLL_NEVER, PRESSED_ENABLED_FOCUSED_SELECTED_STATE_SET, PRESSED_ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_FOCUSED_STATE_SET, PRESSED_ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_SELECTED_STATE_SET, PRESSED_ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_STATE_SET, PRESSED_ENABLED_WINDOW_FOCUSED_STATE_SET, PRESSED_FOCUSED_SELECTED_STATE_SET, PRESSED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_FOCUSED_STATE_SET, PRESSED_FOCUSED_WINDOW_FOCUSED_STATE_SET, PRESSED_SELECTED_STATE_SET, PRESSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_STATE_SET, PRESSED_WINDOW_FOCUSED_STATE_SET, ROTATION, ROTATION_X, ROTATION_Y, SCALE_X, SCALE_Y, SCREEN_STATE_OFF, SCREEN_STATE_ON, SCROLL_AXIS_HORIZONTAL, SCROLL_AXIS_NONE, SCROLL_AXIS_VERTICAL, SCROLL_INDICATOR_BOTTOM, SCROLL_INDICATOR_END, SCROLL_INDICATOR_LEFT, SCROLL_INDICATOR_RIGHT, SCROLL_INDICATOR_START, SCROLL_INDICATOR_TOP, SCROLLBAR_POSITION_DEFAULT, SCROLLBAR_POSITION_LEFT, SCROLLBAR_POSITION_RIGHT, SCROLLBARS_INSIDE_INSET, SCROLLBARS_INSIDE_OVERLAY, SCROLLBARS_OUTSIDE_INSET, SCROLLBARS_OUTSIDE_OVERLAY, SELECTED_STATE_SET, SELECTED_WINDOW_FOCUSED_STATE_SET, SOUND_EFFECTS_ENABLED, STATUS_BAR_HIDDEN, STATUS_BAR_VISIBLE, SYSTEM_UI_FLAG_FULLSCREEN, SYSTEM_UI_FLAG_HIDE_NAVIGATION, SYSTEM_UI_FLAG_IMMERSIVE, SYSTEM_UI_FLAG_IMMERSIVE_STICKY, SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN, SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION, SYSTEM_UI_FLAG_LAYOUT_STABLE, SYSTEM_UI_FLAG_LIGHT_STATUS_BAR, SYSTEM_UI_FLAG_LOW_PROFILE, SYSTEM_UI_FLAG_VISIBLE, SYSTEM_UI_LAYOUT_FLAGS, TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_GRAVITY, TEXT_ALIGNMENT_INHERIT, TEXT_ALIGNMENT_TEXT_END, TEXT_ALIGNMENT_TEXT_START, TEXT_ALIGNMENT_VIEW_END, TEXT_ALIGNMENT_VIEW_START, TEXT_DIRECTION_ANY_RTL, TEXT_DIRECTION_FIRST_STRONG, TEXT_DIRECTION_FIRST_STRONG_LTR, TEXT_DIRECTION_FIRST_STRONG_RTL, TEXT_DIRECTION_INHERIT, TEXT_DIRECTION_LOCALE, TEXT_DIRECTION_LTR, TEXT_DIRECTION_RTL, TRANSLATION_X, TRANSLATION_Y, TRANSLATION_Z, VIEW_LOG_TAG, VISIBLE, WINDOW_FOCUSED_STATE_SET, X, Y, Z| Constructor and Description |
|---|
VideoControls(android.content.Context context) |
VideoControls(android.content.Context context,
android.util.AttributeSet attrs) |
VideoControls(android.content.Context context,
android.util.AttributeSet attrs,
int defStyleAttr) |
VideoControls(android.content.Context context,
android.util.AttributeSet attrs,
int defStyleAttr,
int defStyleRes) |
| Modifier and Type | Method and Description |
|---|---|
void |
addExtraView(android.view.View view) |
protected abstract void |
animateVisibility(boolean toVisible)
Performs the control visibility animation for showing or hiding
this view
|
abstract void |
finishLoading()
Update the controls to indicate that the video is no longer loading
which will re-display the play/pause, progress, etc.
|
java.util.List<android.view.View> |
getExtraViews() |
protected abstract int |
getLayoutResource()
Used to retrieve the layout resource identifier to inflate
|
void |
hide()
Immediately starts the animation to hide the controls
|
void |
hideDelayed()
After the specified delay the view will be hidden.
|
void |
hideDelayed(long delay)
After the specified delay the view will be hidden.
|
protected boolean |
isTextContainerEmpty()
Determines if the
textContainer doesn't have any text associated with it |
boolean |
isVisible()
Returns
true if the VideoControls are visible |
protected void |
onAttachedToWindow() |
protected void |
onDetachedFromWindow() |
protected void |
onNextClick()
Performs the functionality to inform any listeners that the next
button has been clicked
|
protected void |
onPlayPauseClick()
Performs the functionality when the PlayPause button is clicked.
|
protected void |
onPreviousClick()
Performs the functionality to inform any listeners that the previous
button has been clicked
|
protected void |
onVisibilityChanged()
Performs the functionality to inform the callback
that the DefaultControls visibility has changed
|
protected void |
registerListeners()
Registers any internal listeners to perform the playback controls,
such as play/pause, next, and previous
|
void |
removeExtraView(android.view.View view) |
protected void |
retrieveViews()
Retrieves the view references from the xml layout
|
void |
setButtonListener(VideoControlsButtonListener callback)
Specifies the callback to inform of button click events
|
void |
setCanHide(boolean canHide)
Sets weather this control can be hidden.
|
void |
setDescription(java.lang.CharSequence description)
Sets the description text to display for the current item in playback.
|
abstract void |
setDuration(long duration)
Sets the video duration in Milliseconds to display
at the end of the progress bar
|
void |
setFastForwardButtonEnabled(boolean enabled)
Sets the button state for the Fast Forward button.
|
void |
setFastForwardButtonRemoved(boolean removed)
Adds or removes the FastForward button.
|
void |
setFastForwardDrawable(android.graphics.drawable.Drawable drawable)
Sets the drawable for the Fast button
|
void |
setHideDelay(long delay)
Sets the delay to use when hiding the controls via the
hideDelayed()
method. |
void |
setHideEmptyTextContainer(boolean hide)
Sets weather the text block and associated container will be hidden
when no content is specified.
|
void |
setNextButtonEnabled(boolean enabled)
Sets the button state for the Next button.
|
void |
setNextButtonRemoved(boolean removed)
Adds or removes the Next button.
|
void |
setNextDrawable(android.graphics.drawable.Drawable drawable)
Sets the drawable for the next button
|
void |
setPlayPauseDrawables(android.graphics.drawable.Drawable playDrawable,
android.graphics.drawable.Drawable pauseDrawable)
Sets the drawables to use for the PlayPause button
|
abstract void |
setPosition(long position)
Sets the current video position, updating the seek bar
and the current time field
|
void |
setPreviousButtonEnabled(boolean enabled)
Sets the button state for the Previous button.
|
void |
setPreviousButtonRemoved(boolean removed)
Adds or removes the Previous button.
|
void |
setPreviousDrawable(android.graphics.drawable.Drawable drawable)
Sets the drawable for the previous button
|
void |
setRewindButtonEnabled(boolean enabled)
Sets the button state for the Rewind button.
|
void |
setRewindButtonRemoved(boolean removed)
Adds or removes the Rewind button.
|
void |
setRewindDrawable(android.graphics.drawable.Drawable drawable)
Sets the drawable for the rewind button
|
void |
setSeekListener(VideoControlsSeekListener callbacks)
Sets the callbacks to inform of progress seek events
|
void |
setSubTitle(java.lang.CharSequence subTitle)
Sets the subtitle to display for the current item in playback.
|
void |
setTitle(java.lang.CharSequence title)
Sets the title to display for the current item in playback
|
protected void |
setup(android.content.Context context)
Performs any initialization steps such as retrieving views, registering listeners,
and updating any drawables.
|
void |
setVideoView(VideoView VideoView)
Sets the parent view to use for determining playback length, position,
state, etc.
|
void |
setVisibilityListener(VideoControlsVisibilityListener callbacks)
Sets the callbacks to inform of visibility changes
|
void |
show()
Immediately starts the animation to show the controls
|
abstract void |
showLoading(boolean initialLoad)
Update the controls to indicate that the video
is loading.
|
protected void |
updateButtonDrawables()
Updates the drawables used for the buttons to AppCompatTintDrawables
|
void |
updatePlaybackState(boolean isPlaying)
Informs the controls that the playback state has changed.
|
void |
updatePlayPauseImage(boolean isPlaying)
Makes sure the playPause button represents the correct playback state
|
protected void |
updateProgress()
Called by the
progressPollRepeater to update the progress
bar using the videoView to retrieve the correct information |
abstract void |
updateProgress(long position,
long duration,
int bufferPercent)
Performs the progress update on the current time field,
and the seek bar
|
protected abstract void |
updateTextContainerVisibility()
Update the current visibility of the text block independent of
the controls visibility
|
checkLayoutParams, generateDefaultLayoutParams, generateLayoutParams, generateLayoutParams, getAccessibilityClassName, getBaseline, getGravity, onLayout, onMeasure, requestLayout, setGravity, setHorizontalGravity, setIgnoreGravity, setVerticalGravity, shouldDelayChildPressedStateaddChildrenForAccessibility, addFocusables, addStatesFromChildren, addTouchables, addView, addView, addView, addView, addView, addViewInLayout, addViewInLayout, attachLayoutAnimationParameters, attachViewToParent, bringChildToFront, canAnimate, childDrawableStateChanged, childHasTransientStateChanged, cleanupLayoutState, clearChildFocus, clearDisappearingChildren, clearFocus, debug, detachAllViewsFromParent, detachViewFromParent, detachViewFromParent, detachViewsFromParent, dispatchApplyWindowInsets, dispatchConfigurationChanged, dispatchDisplayHint, dispatchDragEvent, dispatchDraw, dispatchDrawableHotspotChanged, dispatchFreezeSelfOnly, dispatchGenericFocusedEvent, dispatchGenericPointerEvent, dispatchHoverEvent, dispatchKeyEvent, dispatchKeyEventPreIme, dispatchKeyShortcutEvent, dispatchProvideStructure, dispatchRestoreInstanceState, dispatchSaveInstanceState, dispatchSetActivated, dispatchSetPressed, dispatchSetSelected, dispatchSystemUiVisibilityChanged, dispatchThawSelfOnly, dispatchTouchEvent, dispatchTrackballEvent, dispatchUnhandledMove, dispatchVisibilityChanged, dispatchWindowFocusChanged, dispatchWindowSystemUiVisiblityChanged, dispatchWindowVisibilityChanged, drawableStateChanged, drawChild, endViewTransition, findFocus, findViewsWithText, focusableViewAvailable, focusSearch, gatherTransparentRegion, getChildAt, getChildCount, getChildDrawingOrder, getChildMeasureSpec, getChildStaticTransformation, getChildVisibleRect, getClipChildren, getClipToPadding, getDescendantFocusability, getFocusedChild, getLayoutAnimation, getLayoutAnimationListener, getLayoutMode, getLayoutTransition, getNestedScrollAxes, getOverlay, getPersistentDrawingCache, getTouchscreenBlocksFocus, hasFocus, hasFocusable, hasTransientState, indexOfChild, invalidateChild, invalidateChildInParent, isAlwaysDrawnWithCacheEnabled, isAnimationCacheEnabled, isChildrenDrawingOrderEnabled, isChildrenDrawnWithCacheEnabled, isMotionEventSplittingEnabled, isTransitionGroup, jumpDrawablesToCurrentState, layout, measureChild, measureChildren, measureChildWithMargins, notifySubtreeAccessibilityStateChanged, offsetDescendantRectToMyCoords, offsetRectIntoDescendantCoords, onCreateDrawableState, onInterceptHoverEvent, onInterceptTouchEvent, onNestedFling, onNestedPreFling, onNestedPrePerformAccessibilityAction, onNestedPreScroll, onNestedScroll, onNestedScrollAccepted, onRequestFocusInDescendants, onRequestSendAccessibilityEvent, onResolvePointerIcon, onStartNestedScroll, onStopNestedScroll, onViewAdded, onViewRemoved, recomputeViewAttributes, removeAllViews, removeAllViewsInLayout, removeDetachedView, removeView, removeViewAt, removeViewInLayout, removeViews, removeViewsInLayout, requestChildFocus, requestChildRectangleOnScreen, requestDisallowInterceptTouchEvent, requestFocus, requestSendAccessibilityEvent, requestTransparentRegion, scheduleLayoutAnimation, setAddStatesFromChildren, setAlwaysDrawnWithCacheEnabled, setAnimationCacheEnabled, setChildrenDrawingCacheEnabled, setChildrenDrawingOrderEnabled, setChildrenDrawnWithCacheEnabled, setClipChildren, setClipToPadding, setDescendantFocusability, setLayoutAnimation, setLayoutAnimationListener, setLayoutMode, setLayoutTransition, setMotionEventSplittingEnabled, setOnHierarchyChangeListener, setPersistentDrawingCache, setStaticTransformationsEnabled, setTouchscreenBlocksFocus, setTransitionGroup, showContextMenuForChild, showContextMenuForChild, startActionModeForChild, startActionModeForChild, startLayoutAnimation, startViewTransition, updateViewLayoutaddFocusables, addOnAttachStateChangeListener, addOnLayoutChangeListener, animate, announceForAccessibility, awakenScrollBars, awakenScrollBars, awakenScrollBars, bringToFront, buildDrawingCache, buildDrawingCache, buildLayer, callOnClick, cancelDragAndDrop, cancelLongPress, cancelPendingInputEvents, canResolveLayoutDirection, canResolveTextAlignment, canResolveTextDirection, canScrollHorizontally, canScrollVertically, checkInputConnectionProxy, clearAnimation, combineMeasuredStates, computeHorizontalScrollExtent, computeHorizontalScrollOffset, computeHorizontalScrollRange, computeScroll, computeSystemWindowInsets, computeVerticalScrollExtent, computeVerticalScrollOffset, computeVerticalScrollRange, createAccessibilityNodeInfo, createContextMenu, destroyDrawingCache, dispatchFinishTemporaryDetach, dispatchGenericMotionEvent, dispatchNestedFling, dispatchNestedPreFling, dispatchNestedPrePerformAccessibilityAction, dispatchNestedPreScroll, dispatchNestedScroll, dispatchPopulateAccessibilityEvent, dispatchStartTemporaryDetach, draw, drawableHotspotChanged, findViewById, findViewWithTag, fitSystemWindows, focusSearch, forceHasOverlappingRendering, forceLayout, generateViewId, getAccessibilityLiveRegion, getAccessibilityNodeProvider, getAccessibilityTraversalAfter, getAccessibilityTraversalBefore, getAlpha, getAnimation, getApplicationWindowToken, getBackground, getBackgroundTintList, getBackgroundTintMode, getBottom, getBottomFadingEdgeStrength, getBottomPaddingOffset, getCameraDistance, getClipBounds, getClipBounds, getClipToOutline, getContentDescription, getContext, getContextMenuInfo, getDefaultSize, getDisplay, getDrawableState, getDrawingCache, getDrawingCache, getDrawingCacheBackgroundColor, getDrawingCacheQuality, getDrawingRect, getDrawingTime, getElevation, getFilterTouchesWhenObscured, getFitsSystemWindows, getFocusables, getFocusedRect, getForeground, getForegroundGravity, getForegroundTintList, getForegroundTintMode, getGlobalVisibleRect, getGlobalVisibleRect, getHandler, getHasOverlappingRendering, getHeight, getHitRect, getHorizontalFadingEdgeLength, getHorizontalScrollbarHeight, getId, getImportantForAccessibility, getKeepScreenOn, getKeyDispatcherState, getLabelFor, getLayerType, getLayoutDirection, getLayoutParams, getLeft, getLeftFadingEdgeStrength, getLeftPaddingOffset, getLocalVisibleRect, getLocationInWindow, getLocationOnScreen, getMatrix, getMeasuredHeight, getMeasuredHeightAndState, getMeasuredState, getMeasuredWidth, getMeasuredWidthAndState, getMinimumHeight, getMinimumWidth, getNextFocusDownId, getNextFocusForwardId, getNextFocusLeftId, getNextFocusRightId, getNextFocusUpId, getOnFocusChangeListener, getOutlineProvider, getOverScrollMode, getPaddingBottom, getPaddingEnd, getPaddingLeft, getPaddingRight, getPaddingStart, getPaddingTop, getParent, getParentForAccessibility, getPivotX, getPivotY, getPointerIcon, getResources, getRevealOnFocusHint, getRight, getRightFadingEdgeStrength, getRightPaddingOffset, getRootView, getRootWindowInsets, getRotation, getRotationX, getRotationY, getScaleX, getScaleY, getScrollBarDefaultDelayBeforeFade, getScrollBarFadeDuration, getScrollBarSize, getScrollBarStyle, getScrollIndicators, getScrollX, getScrollY, getSolidColor, getStateListAnimator, getSuggestedMinimumHeight, getSuggestedMinimumWidth, getSystemUiVisibility, getTag, getTag, getTextAlignment, getTextDirection, getTop, getTopFadingEdgeStrength, getTopPaddingOffset, getTouchables, getTouchDelegate, getTransitionName, getTranslationX, getTranslationY, getTranslationZ, getVerticalFadingEdgeLength, getVerticalScrollbarPosition, getVerticalScrollbarWidth, getViewTreeObserver, getVisibility, getWidth, getWindowAttachCount, getWindowId, getWindowSystemUiVisibility, getWindowToken, getWindowVisibility, getWindowVisibleDisplayFrame, getX, getY, getZ, hasNestedScrollingParent, hasOnClickListeners, hasOverlappingRendering, hasWindowFocus, inflate, invalidate, invalidate, invalidate, invalidateDrawable, invalidateOutline, isAccessibilityFocused, isActivated, isAttachedToWindow, isClickable, isContextClickable, isDirty, isDrawingCacheEnabled, isDuplicateParentStateEnabled, isEnabled, isFocusable, isFocusableInTouchMode, isFocused, isHapticFeedbackEnabled, isHardwareAccelerated, isHorizontalFadingEdgeEnabled, isHorizontalScrollBarEnabled, isHovered, isImportantForAccessibility, isInEditMode, isInLayout, isInTouchMode, isLaidOut, isLayoutDirectionResolved, isLayoutRequested, isLongClickable, isNestedScrollingEnabled, isOpaque, isPaddingOffsetRequired, isPaddingRelative, isPressed, isSaveEnabled, isSaveFromParentEnabled, isScrollbarFadingEnabled, isScrollContainer, isSelected, isShown, isSoundEffectsEnabled, isTemporarilyDetached, isTextAlignmentResolved, isTextDirectionResolved, isVerticalFadingEdgeEnabled, isVerticalScrollBarEnabled, measure, mergeDrawableStates, offsetLeftAndRight, offsetTopAndBottom, onAnimationEnd, onAnimationStart, onApplyWindowInsets, onCancelPendingInputEvents, onCheckIsTextEditor, onConfigurationChanged, onCreateContextMenu, onCreateInputConnection, onDisplayHint, onDragEvent, onDraw, onDrawForeground, onDrawScrollBars, onFilterTouchEventForSecurity, onFinishInflate, onFinishTemporaryDetach, onFocusChanged, onGenericMotionEvent, onHoverChanged, onHoverEvent, onInitializeAccessibilityEvent, onInitializeAccessibilityNodeInfo, onKeyDown, onKeyLongPress, onKeyMultiple, onKeyPreIme, onKeyShortcut, onKeyUp, onOverScrolled, onPopulateAccessibilityEvent, onProvideStructure, onProvideVirtualStructure, onRestoreInstanceState, onRtlPropertiesChanged, onSaveInstanceState, onScreenStateChanged, onScrollChanged, onSetAlpha, onSizeChanged, onStartTemporaryDetach, onTouchEvent, onTrackballEvent, onVisibilityAggregated, onVisibilityChanged, onWindowFocusChanged, onWindowSystemUiVisibilityChanged, onWindowVisibilityChanged, overScrollBy, performAccessibilityAction, performClick, performContextClick, performContextClick, performHapticFeedback, performHapticFeedback, performLongClick, performLongClick, playSoundEffect, post, postDelayed, postInvalidate, postInvalidate, postInvalidateDelayed, postInvalidateDelayed, postInvalidateOnAnimation, postInvalidateOnAnimation, postOnAnimation, postOnAnimationDelayed, refreshDrawableState, removeCallbacks, removeOnAttachStateChangeListener, removeOnLayoutChangeListener, requestApplyInsets, requestFitSystemWindows, requestFocus, requestFocus, requestFocusFromTouch, requestRectangleOnScreen, requestRectangleOnScreen, requestUnbufferedDispatch, resolveSize, resolveSizeAndState, restoreHierarchyState, saveHierarchyState, scheduleDrawable, scrollBy, scrollTo, sendAccessibilityEvent, sendAccessibilityEventUnchecked, setAccessibilityDelegate, setAccessibilityLiveRegion, setAccessibilityTraversalAfter, setAccessibilityTraversalBefore, setActivated, setAlpha, setAnimation, setBackground, setBackgroundColor, setBackgroundDrawable, setBackgroundResource, setBackgroundTintList, setBackgroundTintMode, setBottom, setCameraDistance, setClickable, setClipBounds, setClipToOutline, setContentDescription, setContextClickable, setDrawingCacheBackgroundColor, setDrawingCacheEnabled, setDrawingCacheQuality, setDuplicateParentStateEnabled, setElevation, setEnabled, setFadingEdgeLength, setFilterTouchesWhenObscured, setFitsSystemWindows, setFocusable, setFocusableInTouchMode, setForeground, setForegroundGravity, setForegroundTintList, setForegroundTintMode, setHapticFeedbackEnabled, setHasTransientState, setHorizontalFadingEdgeEnabled, setHorizontalScrollBarEnabled, setHovered, setId, setImportantForAccessibility, setKeepScreenOn, setLabelFor, setLayerPaint, setLayerType, setLayoutDirection, setLayoutParams, setLeft, setLongClickable, setMeasuredDimension, setMinimumHeight, setMinimumWidth, setNestedScrollingEnabled, setNextFocusDownId, setNextFocusForwardId, setNextFocusLeftId, setNextFocusRightId, setNextFocusUpId, setOnApplyWindowInsetsListener, setOnClickListener, setOnContextClickListener, setOnCreateContextMenuListener, setOnDragListener, setOnFocusChangeListener, setOnGenericMotionListener, setOnHoverListener, setOnKeyListener, setOnLongClickListener, setOnScrollChangeListener, setOnSystemUiVisibilityChangeListener, setOnTouchListener, setOutlineProvider, setOverScrollMode, setPadding, setPaddingRelative, setPivotX, setPivotY, setPointerIcon, setPressed, setRevealOnFocusHint, setRight, setRotation, setRotationX, setRotationY, setSaveEnabled, setSaveFromParentEnabled, setScaleX, setScaleY, setScrollBarDefaultDelayBeforeFade, setScrollBarFadeDuration, setScrollbarFadingEnabled, setScrollBarSize, setScrollBarStyle, setScrollContainer, setScrollIndicators, setScrollIndicators, setScrollX, setScrollY, setSelected, setSoundEffectsEnabled, setStateListAnimator, setSystemUiVisibility, setTag, setTag, setTextAlignment, setTextDirection, setTop, setTouchDelegate, setTransitionName, setTranslationX, setTranslationY, setTranslationZ, setVerticalFadingEdgeEnabled, setVerticalScrollBarEnabled, setVerticalScrollbarPosition, setVisibility, setWillNotCacheDrawing, setWillNotDraw, setX, setY, setZ, showContextMenu, showContextMenu, startActionMode, startActionMode, startAnimation, startDrag, startDragAndDrop, startNestedScroll, stopNestedScroll, toString, unscheduleDrawable, unscheduleDrawable, updateDragShadow, verifyDrawable, willNotCacheDrawing, willNotDrawclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcanResolveLayoutDirection, canResolveTextAlignment, canResolveTextDirection, createContextMenu, getLayoutDirection, getParent, getParentForAccessibility, getTextAlignment, getTextDirection, isLayoutDirectionResolved, isLayoutRequested, isTextAlignmentResolved, isTextDirectionResolved, requestFitSystemWindowspublic static final int DEFAULT_CONTROL_HIDE_DELAY
protected static final long CONTROL_VISIBILITY_ANIMATION_LENGTH
protected android.widget.TextView currentTimeTextView
protected android.widget.TextView endTimeTextView
protected android.widget.TextView titleTextView
protected android.widget.TextView subTitleTextView
protected android.widget.TextView descriptionTextView
protected android.widget.ImageButton playPauseButton
protected android.widget.ImageButton previousButton
protected android.widget.ImageButton nextButton
protected android.widget.ProgressBar loadingProgressBar
protected android.view.ViewGroup controlsContainer
protected android.view.ViewGroup textContainer
protected android.graphics.drawable.Drawable playDrawable
protected android.graphics.drawable.Drawable pauseDrawable
@NonNull protected android.os.Handler visibilityHandler
@NonNull protected Repeater progressPollRepeater
@Nullable protected VideoView videoView
@Nullable protected VideoControlsSeekListener seekListener
@Nullable protected VideoControlsButtonListener buttonsListener
@Nullable protected VideoControlsVisibilityListener visibilityListener
@NonNull protected VideoControls.InternalListener internalListener
@NonNull protected android.util.SparseBooleanArray enabledViews
protected long hideDelay
protected boolean isLoading
protected boolean isVisible
protected boolean canViewHide
protected boolean hideEmptyTextContainer
public VideoControls(android.content.Context context)
public VideoControls(android.content.Context context,
android.util.AttributeSet attrs)
public VideoControls(android.content.Context context,
android.util.AttributeSet attrs,
int defStyleAttr)
public VideoControls(android.content.Context context,
android.util.AttributeSet attrs,
int defStyleAttr,
int defStyleRes)
public abstract void setPosition(long position)
position - The position in millisecondspublic abstract void setDuration(long duration)
duration - The duration of the video in millisecondspublic abstract void updateProgress(long position,
long duration,
int bufferPercent)
@LayoutRes protected abstract int getLayoutResource()
protected abstract void animateVisibility(boolean toVisible)
toVisible - True if the view should be visible at the end of the animationprotected abstract void updateTextContainerVisibility()
public abstract void showLoading(boolean initialLoad)
initialLoad - True if the loading is the initial state, not for seeking or bufferingpublic abstract void finishLoading()
protected void onAttachedToWindow()
onAttachedToWindow in class android.view.ViewGroupprotected void onDetachedFromWindow()
onDetachedFromWindow in class android.view.ViewGrouppublic void setVideoView(@Nullable
VideoView VideoView)
VideoView - The Parent view to these controlspublic void setSeekListener(@Nullable
VideoControlsSeekListener callbacks)
callbacks - The callbacks to informpublic void setButtonListener(@Nullable
VideoControlsButtonListener callback)
callback - The callbackpublic void setVisibilityListener(@Nullable
VideoControlsVisibilityListener callbacks)
callbacks - The callbacks to informpublic void updatePlaybackState(boolean isPlaying)
isPlaying - True if the media is currently playingpublic void setTitle(@Nullable
java.lang.CharSequence title)
title - The title to displaypublic void setSubTitle(@Nullable
java.lang.CharSequence subTitle)
subTitle - The sub title to displaypublic void setDescription(@Nullable
java.lang.CharSequence description)
setTitle(CharSequence) and setSubTitle(CharSequence)
this text wont be limited to a single line of textdescription - The artist to displaypublic void setPlayPauseDrawables(android.graphics.drawable.Drawable playDrawable,
android.graphics.drawable.Drawable pauseDrawable)
playDrawable - The drawable to represent playpauseDrawable - The drawable to represent pausepublic void setPreviousDrawable(android.graphics.drawable.Drawable drawable)
drawable - The drawable to usepublic void setNextDrawable(android.graphics.drawable.Drawable drawable)
drawable - The drawable to usepublic void setRewindDrawable(android.graphics.drawable.Drawable drawable)
drawable - The drawable to usepublic void setFastForwardDrawable(android.graphics.drawable.Drawable drawable)
drawable - The drawable to usepublic void updatePlayPauseImage(boolean isPlaying)
isPlaying - If the video is currently playingpublic void setPreviousButtonEnabled(boolean enabled)
setPreviousDrawable(Drawable),
or use the defaults if they haven't been set, and block any click events.
This method will NOT re-add buttons that have previously been removed with
setNextButtonRemoved(boolean).
enabled - If the Previous button is enabled [default: false]public void setNextButtonEnabled(boolean enabled)
setNextDrawable(Drawable),
or use the defaults if they haven't been set, and block any click events.
This method will NOT re-add buttons that have previously been removed with
setPreviousButtonRemoved(boolean).
enabled - If the Next button is enabled [default: false]public void setRewindButtonEnabled(boolean enabled)
setRewindDrawable(Drawable),
or use the defaults if they haven't been set
This method will NOT re-add buttons that have previously been removed with
setRewindButtonRemoved(boolean).
enabled - If the Rewind button is enabled [default: false]public void setFastForwardButtonEnabled(boolean enabled)
setFastForwardDrawable(Drawable),
or use the defaults if they haven't been set
This method will NOT re-add buttons that have previously been removed with
setFastForwardButtonRemoved(boolean).
enabled - If the Rewind button is enabled [default: false]public void setPreviousButtonRemoved(boolean removed)
setPreviousButtonEnabled(boolean)removed - If the Previous button should be removed [default: true]public void setNextButtonRemoved(boolean removed)
setNextButtonEnabled(boolean)removed - If the Next button should be removed [default: true]public void setRewindButtonRemoved(boolean removed)
setRewindButtonEnabled(boolean)removed - If the Rewind button should be removed [default: true]public void setFastForwardButtonRemoved(boolean removed)
setFastForwardButtonEnabled(boolean)removed - If the FastForward button should be removed [default: true]public void addExtraView(@NonNull
android.view.View view)
public void removeExtraView(@NonNull
android.view.View view)
@NonNull public java.util.List<android.view.View> getExtraViews()
public void show()
public void hide()
public void hideDelayed()
public void hideDelayed(long delay)
delay - The delay in milliseconds to wait to start the hide animationpublic void setHideDelay(long delay)
hideDelayed()
method. This value will be overridden if hideDelayed(long) is called.delay - The delay in milliseconds to wait to start the hide animationpublic void setCanHide(boolean canHide)
canHide - If this control can be hidden [default: true]public void setHideEmptyTextContainer(boolean hide)
hide - If the empty text blocks can be hidden [default: true]public boolean isVisible()
true if the VideoControls are visibletrue if the controls are visibleprotected void retrieveViews()
protected void registerListeners()
protected void updateButtonDrawables()
protected void onPlayPauseClick()
protected void onPreviousClick()
protected void onNextClick()
protected void setup(android.content.Context context)
context - The context to use for retrieving the correct layoutprotected boolean isTextContainerEmpty()
textContainer doesn't have any text associated with ittextContainerprotected void onVisibilityChanged()
protected void updateProgress()
progressPollRepeater to update the progress
bar using the videoView to retrieve the correct information