public abstract class VideoControls extends android.widget.RelativeLayout implements VideoControlsCore
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.OnCapturedPointerListener, 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, android.view.View.OnUnhandledKeyEventListener| 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, AUTOFILL_FLAG_INCLUDE_NOT_IMPORTANT_VIEWS, AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DATE, AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DAY, AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_MONTH, AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_YEAR, AUTOFILL_HINT_CREDIT_CARD_NUMBER, AUTOFILL_HINT_CREDIT_CARD_SECURITY_CODE, AUTOFILL_HINT_EMAIL_ADDRESS, AUTOFILL_HINT_NAME, AUTOFILL_HINT_PASSWORD, AUTOFILL_HINT_PHONE, AUTOFILL_HINT_POSTAL_ADDRESS, AUTOFILL_HINT_POSTAL_CODE, AUTOFILL_HINT_USERNAME, AUTOFILL_TYPE_DATE, AUTOFILL_TYPE_LIST, AUTOFILL_TYPE_NONE, AUTOFILL_TYPE_TEXT, AUTOFILL_TYPE_TOGGLE, 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, FOCUSABLE, FOCUSABLE_AUTO, 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, IMPORTANT_FOR_AUTOFILL_AUTO, IMPORTANT_FOR_AUTOFILL_NO, IMPORTANT_FOR_AUTOFILL_NO_EXCLUDE_DESCENDANTS, IMPORTANT_FOR_AUTOFILL_YES, IMPORTANT_FOR_AUTOFILL_YES_EXCLUDE_DESCENDANTS, 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, NOT_FOCUSABLE, 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_NAVIGATION_BAR, 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
|
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 |
hide(boolean delayed)
Hides the controls immediately if
delayed is false
otherwise a delay determined by the implementation will be used
before the controls are hidden. |
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 |
void |
onAttachedToView(VideoView videoView)
Called when the controls have been registered by the
VideoView. |
protected void |
onAttachedToWindow() |
void |
onDetachedFromView(VideoView videoView)
Called when the controls have been cleaned up on the
VideoView
side in preparation for detachment. |
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.
|
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)
Deprecated.
|
void |
setVisibilityListener(VideoControlsVisibilityListener callbacks)
Sets the callbacks to inform of visibility changes
|
void |
show()
Immediately starts the animation to show the controls
|
protected void |
updateButtonDrawables()
Updates the drawables used for the buttons to AppCompatTintDrawables
|
protected void |
updateButtonDrawables(int tintList) |
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, addKeyboardNavigationClusters, 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, dispatchCapturedPointerEvent, dispatchConfigurationChanged, dispatchDisplayHint, dispatchDragEvent, dispatchDraw, dispatchDrawableHotspotChanged, dispatchFinishTemporaryDetach, dispatchFreezeSelfOnly, dispatchGenericFocusedEvent, dispatchGenericPointerEvent, dispatchHoverEvent, dispatchKeyEvent, dispatchKeyEventPreIme, dispatchKeyShortcutEvent, dispatchPointerCaptureChanged, dispatchProvideAutofillStructure, dispatchProvideStructure, dispatchRestoreInstanceState, dispatchSaveInstanceState, dispatchSetActivated, dispatchSetPressed, dispatchSetSelected, dispatchStartTemporaryDetach, 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, hasTransientState, indexOfChild, invalidateChild, invalidateChildInParent, isAlwaysDrawnWithCacheEnabled, isAnimationCacheEnabled, isChildrenDrawingOrderEnabled, isChildrenDrawnWithCacheEnabled, isMotionEventSplittingEnabled, isTransitionGroup, jumpDrawablesToCurrentState, layout, measureChild, measureChildren, measureChildWithMargins, notifySubtreeAccessibilityStateChanged, offsetDescendantRectToMyCoords, offsetRectIntoDescendantCoords, onCreateDrawableState, onDescendantInvalidated, 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, restoreDefaultFocus, 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, updateViewLayoutaddExtraDataToAccessibilityNodeInfo, addFocusables, addOnAttachStateChangeListener, addOnLayoutChangeListener, addOnUnhandledKeyEventListener, animate, announceForAccessibility, autofill, autofill, 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, dispatchGenericMotionEvent, dispatchNestedFling, dispatchNestedPreFling, dispatchNestedPrePerformAccessibilityAction, dispatchNestedPreScroll, dispatchNestedScroll, dispatchPopulateAccessibilityEvent, draw, drawableHotspotChanged, findViewById, findViewWithTag, fitSystemWindows, focusSearch, forceHasOverlappingRendering, forceLayout, generateViewId, getAccessibilityLiveRegion, getAccessibilityNodeProvider, getAccessibilityPaneTitle, getAccessibilityTraversalAfter, getAccessibilityTraversalBefore, getAlpha, getAnimation, getApplicationWindowToken, getAutofillHints, getAutofillId, getAutofillType, getAutofillValue, getBackground, getBackgroundTintList, getBackgroundTintMode, getBottom, getBottomFadingEdgeStrength, getBottomPaddingOffset, getCameraDistance, getClipBounds, getClipBounds, getClipToOutline, getContentDescription, getContext, getContextMenuInfo, getDefaultFocusHighlightEnabled, getDefaultSize, getDisplay, getDrawableState, getDrawingCache, getDrawingCache, getDrawingCacheBackgroundColor, getDrawingCacheQuality, getDrawingRect, getDrawingTime, getElevation, getFilterTouchesWhenObscured, getFitsSystemWindows, getFocusable, getFocusables, getFocusedRect, getForeground, getForegroundGravity, getForegroundTintList, getForegroundTintMode, getGlobalVisibleRect, getGlobalVisibleRect, getHandler, getHasOverlappingRendering, getHeight, getHitRect, getHorizontalFadingEdgeLength, getHorizontalScrollbarHeight, getId, getImportantForAccessibility, getImportantForAutofill, getKeepScreenOn, getKeyDispatcherState, getLabelFor, getLayerType, getLayoutDirection, getLayoutParams, getLeft, getLeftFadingEdgeStrength, getLeftPaddingOffset, getLocalVisibleRect, getLocationInWindow, getLocationOnScreen, getMatrix, getMeasuredHeight, getMeasuredHeightAndState, getMeasuredState, getMeasuredWidth, getMeasuredWidthAndState, getMinimumHeight, getMinimumWidth, getNextClusterForwardId, getNextFocusDownId, getNextFocusForwardId, getNextFocusLeftId, getNextFocusRightId, getNextFocusUpId, getOnFocusChangeListener, getOutlineAmbientShadowColor, getOutlineProvider, getOutlineSpotShadowColor, 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, getTooltipText, getTop, getTopFadingEdgeStrength, getTopPaddingOffset, getTouchables, getTouchDelegate, getTransitionName, getTranslationX, getTranslationY, getTranslationZ, getVerticalFadingEdgeLength, getVerticalScrollbarPosition, getVerticalScrollbarWidth, getViewTreeObserver, getVisibility, getWidth, getWindowAttachCount, getWindowId, getWindowSystemUiVisibility, getWindowToken, getWindowVisibility, getWindowVisibleDisplayFrame, getX, getY, getZ, hasExplicitFocusable, hasFocusable, hasNestedScrollingParent, hasOnClickListeners, hasOverlappingRendering, hasPointerCapture, hasWindowFocus, inflate, invalidate, invalidate, invalidate, invalidateDrawable, invalidateOutline, isAccessibilityFocused, isAccessibilityHeading, isActivated, isAttachedToWindow, isClickable, isContextClickable, isDirty, isDrawingCacheEnabled, isDuplicateParentStateEnabled, isEnabled, isFocusable, isFocusableInTouchMode, isFocused, isFocusedByDefault, isHapticFeedbackEnabled, isHardwareAccelerated, isHorizontalFadingEdgeEnabled, isHorizontalScrollBarEnabled, isHovered, isImportantForAccessibility, isImportantForAutofill, isInEditMode, isInLayout, isInTouchMode, isKeyboardNavigationCluster, isLaidOut, isLayoutDirectionResolved, isLayoutRequested, isLongClickable, isNestedScrollingEnabled, isOpaque, isPaddingOffsetRequired, isPaddingRelative, isPivotSet, isPressed, isSaveEnabled, isSaveFromParentEnabled, isScreenReaderFocusable, isScrollbarFadingEnabled, isScrollContainer, isSelected, isShown, isSoundEffectsEnabled, isTemporarilyDetached, isTextAlignmentResolved, isTextDirectionResolved, isVerticalFadingEdgeEnabled, isVerticalScrollBarEnabled, isVisibleToUserForAutofill, keyboardNavigationClusterSearch, measure, mergeDrawableStates, offsetLeftAndRight, offsetTopAndBottom, onAnimationEnd, onAnimationStart, onApplyWindowInsets, onCancelPendingInputEvents, onCapturedPointerEvent, 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, onPointerCaptureChange, onPopulateAccessibilityEvent, onProvideAutofillStructure, onProvideAutofillVirtualStructure, 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, releasePointerCapture, removeCallbacks, removeOnAttachStateChangeListener, removeOnLayoutChangeListener, removeOnUnhandledKeyEventListener, requestApplyInsets, requestFitSystemWindows, requestFocus, requestFocus, requestFocusFromTouch, requestPointerCapture, requestRectangleOnScreen, requestRectangleOnScreen, requestUnbufferedDispatch, requireViewById, resetPivot, resolveSize, resolveSizeAndState, restoreHierarchyState, saveHierarchyState, scheduleDrawable, scrollBy, scrollTo, sendAccessibilityEvent, sendAccessibilityEventUnchecked, setAccessibilityDelegate, setAccessibilityHeading, setAccessibilityLiveRegion, setAccessibilityPaneTitle, setAccessibilityTraversalAfter, setAccessibilityTraversalBefore, setActivated, setAlpha, setAnimation, setAutofillHints, setAutofillId, setBackground, setBackgroundColor, setBackgroundDrawable, setBackgroundResource, setBackgroundTintList, setBackgroundTintMode, setBottom, setCameraDistance, setClickable, setClipBounds, setClipToOutline, setContentDescription, setContextClickable, setDefaultFocusHighlightEnabled, setDrawingCacheBackgroundColor, setDrawingCacheEnabled, setDrawingCacheQuality, setDuplicateParentStateEnabled, setElevation, setEnabled, setFadingEdgeLength, setFilterTouchesWhenObscured, setFitsSystemWindows, setFocusable, setFocusable, setFocusableInTouchMode, setFocusedByDefault, setForeground, setForegroundGravity, setForegroundTintList, setForegroundTintMode, setHapticFeedbackEnabled, setHasTransientState, setHorizontalFadingEdgeEnabled, setHorizontalScrollBarEnabled, setHovered, setId, setImportantForAccessibility, setImportantForAutofill, setKeepScreenOn, setKeyboardNavigationCluster, setLabelFor, setLayerPaint, setLayerType, setLayoutDirection, setLayoutParams, setLeft, setLongClickable, setMeasuredDimension, setMinimumHeight, setMinimumWidth, setNestedScrollingEnabled, setNextClusterForwardId, setNextFocusDownId, setNextFocusForwardId, setNextFocusLeftId, setNextFocusRightId, setNextFocusUpId, setOnApplyWindowInsetsListener, setOnCapturedPointerListener, setOnClickListener, setOnContextClickListener, setOnCreateContextMenuListener, setOnDragListener, setOnFocusChangeListener, setOnGenericMotionListener, setOnHoverListener, setOnKeyListener, setOnLongClickListener, setOnScrollChangeListener, setOnSystemUiVisibilityChangeListener, setOnTouchListener, setOutlineAmbientShadowColor, setOutlineProvider, setOutlineSpotShadowColor, setOverScrollMode, setPadding, setPaddingRelative, setPivotX, setPivotY, setPointerIcon, setPressed, setRevealOnFocusHint, setRight, setRotation, setRotationX, setRotationY, setSaveEnabled, setSaveFromParentEnabled, setScaleX, setScaleY, setScreenReaderFocusable, setScrollBarDefaultDelayBeforeFade, setScrollBarFadeDuration, setScrollbarFadingEnabled, setScrollBarSize, setScrollBarStyle, setScrollContainer, setScrollIndicators, setScrollIndicators, setScrollX, setScrollY, setSelected, setSoundEffectsEnabled, setStateListAnimator, setSystemUiVisibility, setTag, setTag, setTextAlignment, setTextDirection, setTooltipText, 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, waitfinishLoading, setDuration, showLoadingcanResolveLayoutDirection, canResolveTextAlignment, canResolveTextDirection, createContextMenu, getLayoutDirection, getParent, getParentForAccessibility, getTextAlignment, getTextDirection, isLayoutDirectionResolved, isLayoutRequested, isTextAlignmentResolved, isTextDirectionResolved, keyboardNavigationClusterSearch, 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
protected android.os.Handler visibilityHandler
protected Repeater progressPollRepeater
protected VideoView videoView
protected VideoControlsSeekListener seekListener
protected VideoControlsButtonListener buttonsListener
protected VideoControlsVisibilityListener visibilityListener
protected VideoControls.InternalListener internalListener
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 updateProgress(long position,
long duration,
int bufferPercent)
position - The position in millisecondsduration - The duration of the video in millisecondsbufferPercent - The integer percent that is buffered [0, 100] inclusiveprotected 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()
protected void onAttachedToWindow()
onAttachedToWindow in class android.view.ViewGroupprotected void onDetachedFromWindow()
onDetachedFromWindow in class android.view.ViewGrouppublic void onAttachedToView(VideoView videoView)
VideoControlsCoreVideoView.onAttachedToView in interface VideoControlsCorevideoView - The VideoView that the controls are attached topublic void onDetachedFromView(VideoView videoView)
VideoControlsCoreVideoView
side in preparation for detachment.onDetachedFromView in interface VideoControlsCorevideoView - The VideoView that the controls are detaching from@Deprecated public void setVideoView(VideoView VideoView)
onAttachedToView(VideoView) and onDetachedFromView(VideoView)VideoView - The Parent view to these controlspublic void setSeekListener(VideoControlsSeekListener callbacks)
callbacks - The callbacks to informpublic void setButtonListener(VideoControlsButtonListener callback)
callback - The callbackpublic void setVisibilityListener(VideoControlsVisibilityListener callbacks)
callbacks - The callbacks to informpublic void updatePlaybackState(boolean isPlaying)
updatePlaybackState in interface VideoControlsCoreisPlaying - True if the media is currently playingpublic void setTitle(java.lang.CharSequence title)
title - The title to displaypublic void setSubTitle(java.lang.CharSequence subTitle)
subTitle - The sub title to displaypublic void setDescription(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(android.view.View view)
public void removeExtraView(android.view.View view)
public java.util.List<android.view.View> getExtraViews()
public void show()
show in interface VideoControlsCorepublic void hide(boolean delayed)
VideoControlsCoredelayed is false
otherwise a delay determined by the implementation will be used
before the controls are hidden. If the user is interacting with
the controls then we wait until after they are done to start the
delay.hide in interface VideoControlsCorepublic 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 visibleisVisible in interface VideoControlsCoretrue if the controls are visibleprotected void retrieveViews()
protected void registerListeners()
protected void updateButtonDrawables()
protected void updateButtonDrawables(int tintList)
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