DefaultTimeBar


@UnstableApi
class DefaultTimeBar : View, TimeBar


A time bar that shows a current position, buffered position, duration and ad markers.

A DefaultTimeBar can be customized by setting attributes, as outlined below.

Attributes

The following attributes can be set on a DefaultTimeBar when used in a layout XML file:
  • bar_height - Dimension for the height of the time bar.
  • touch_target_height - Dimension for the height of the area in which touch interactions with the time bar are handled. If no height is specified, this also determines the height of the view.
  • ad_marker_width - Dimension for the width of any ad markers shown on the bar. Ad markers are superimposed on the time bar to show the times at which ads will play.
  • scrubber_enabled_size - Dimension for the diameter of the circular scrubber handle when scrubbing is enabled but not in progress. Set to zero if no scrubber handle should be shown.
  • scrubber_disabled_size - Dimension for the diameter of the circular scrubber handle when scrubbing isn't enabled. Set to zero if no scrubber handle should be shown.
  • scrubber_dragged_size - Dimension for the diameter of the circular scrubber handle when scrubbing is in progress. Set to zero if no scrubber handle should be shown.
  • scrubber_drawable - Optional reference to a drawable to draw for the scrubber handle. If set, this overrides the default behavior, which is to draw a circle for the scrubber handle.
  • played_color - Color for the portion of the time bar representing media before the current playback position.
  • scrubber_color - Color for the scrubber handle.
  • buffered_color - Color for the portion of the time bar after the current played position up to the current buffered position.
  • unplayed_color - Color for the portion of the time bar after the current buffered position.
  • ad_marker_color - Color for unplayed ad markers.
  • played_ad_marker_color - Color for played ad markers.

Summary

Constants

const Int

Vertical gravity for progress bar to be located at the bottom in the view.

const Int

Vertical gravity for progress bar to be located at the center in the view.

const Int

Default color for ad markers.

const Int

Default width for ad markers, in dp.

const Int

Default height for the time bar, in dp.

const Int

Default color for the buffered portion of the time bar.

const Int

Default color for played ad markers.

const Int

Default color for the played portion of the time bar.

const Int

Default color for the scrubber handle.

const Int

Default diameter for the scrubber when disabled, in dp.

const Int

Default diameter for the scrubber when dragged, in dp.

const Int

Default diameter for the scrubber when enabled, in dp.

const Int

Default height for the touch target, in dp.

const Int

Default color for the unplayed portion of the time bar.

Public constructors

DefaultTimeBar(context: Context!, attrs: AttributeSet?)
DefaultTimeBar(context: Context!, attrs: AttributeSet?, defStyleAttr: Int)
DefaultTimeBar(
    context: Context!,
    attrs: AttributeSet?,
    defStyleAttr: Int,
    timebarAttrs: AttributeSet?
)
DefaultTimeBar(
    context: Context!,
    attrs: AttributeSet?,
    defStyleAttr: Int,
    timebarAttrs: AttributeSet?,
    defStyleRes: Int
)

Public functions

Unit

Adds a listener for scrubbing events.

Long

Returns the preferred delay in milliseconds of media time after which the time bar position should be updated.

Unit
hideScrubber(disableScrubberPadding: Boolean)

Hides the scrubber handle.

Unit
hideScrubber(hideAnimationDurationMs: Long)

Hides the scrubber handle with animation.

Unit
Unit
onDraw(canvas: Canvas!)
Unit
Unit
Boolean
onKeyDown(keyCode: Int, event: KeyEvent!)
Unit
onRtlPropertiesChanged(layoutDirection: Int)
Boolean
Boolean
Unit

Removes a listener for scrubbing events.

Unit
setAdGroupTimesMs(
    adGroupTimesMs: LongArray?,
    playedAdGroups: BooleanArray?,
    adGroupCount: Int
)

Sets the times of ad groups and whether each ad group has been played.

Unit
setAdMarkerColor(adMarkerColor: @ColorInt Int)

Sets the color for unplayed ad markers.

Unit
setBufferedColor(bufferedColor: @ColorInt Int)

Sets the color for the portion of the time bar after the current played position up to the current buffered position.

Unit
setBufferedPosition(bufferedPosition: Long)

Sets the buffered position.

Unit
setDuration(duration: Long)

Sets the duration.

Unit
setEnabled(enabled: Boolean)
Unit

Sets the position increment for key presses and accessibility actions, as a number of increments that divide the duration of the media.

Unit

Sets the position increment for key presses and accessibility actions, in milliseconds.

Unit
setPlayedAdMarkerColor(playedAdMarkerColor: @ColorInt Int)

Sets the color for played ad markers.

Unit
setPlayedColor(playedColor: @ColorInt Int)

Sets the color for the portion of the time bar representing media before the playback position.

Unit
setPosition(position: Long)

Sets the current position.

Unit
setScrubberColor(scrubberColor: @ColorInt Int)

Sets the color for the scrubber handle.

Unit
setUnplayedColor(unplayedColor: @ColorInt Int)

Sets the color for the portion of the time bar after the current played position.

Unit

Shows the scrubber handle.

Unit
showScrubber(showAnimationDurationMs: Long)

Shows the scrubber handle with animation.

Protected functions

Unit
Unit
onFocusChanged(
    gainFocus: Boolean,
    direction: Int,
    previouslyFocusedRect: Rect?
)
Unit
onLayout(changed: Boolean, left: Int, top: Int, right: Int, bottom: Int)
Unit
onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int)

Inherited Constants

From android.view.View
const Int
const Int
const Int
const Int
const Int
const Int
const Property<View!, Float!>!
const Int
const String!
AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DATE = "creditCardExpirationDate"
const String!
AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DAY = "creditCardExpirationDay"
const String!
AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_MONTH = "creditCardExpirationMonth"
const String!
AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_YEAR = "creditCardExpirationYear"
const String!
const String!
AUTOFILL_HINT_CREDIT_CARD_SECURITY_CODE = "creditCardSecurityCode"
const String!
const String!
const String!
const String!
const String!
const String!
const String!
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int

This property is deprecated.

const Int

This property is deprecated.

const Int

This property is deprecated.

const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const Int
const Int
const Int
const Int
const Int
const Int
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const Int
const Int
const Int
const Int
const Int
const Int
const Int
GONE = 8
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
KEEP_SCREEN_ON = 67108864
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
NO_ID = -1
const Int
const Int
const Int
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const Property<View!, Float!>!
const Property<View!, Float!>!
const Property<View!, Float!>!
const Property<View!, Float!>!
const Property<View!, Float!>!
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const IntArray<Int>!
const IntArray<Int>!
const Int
const Int

This property is deprecated.

const Int

This property is deprecated.

const Int

This property is deprecated.

const Int

This property is deprecated.

const Int

This property is deprecated.

const Int

This property is deprecated.

const Int

This property is deprecated.

const Int

This property is deprecated.

const Int

This property is deprecated.

const Int

This property is deprecated.

const Int

This property is deprecated.

const Int

This property is deprecated.

const Int

This property is deprecated.

const Int

This property is deprecated.

const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Property<View!, Float!>!
const Property<View!, Float!>!
const Property<View!, Float!>!
const String!
VIEW_LOG_TAG = "View"
const Int
const IntArray<Int>!
const Property<View!, Float!>!
const Property<View!, Float!>!
const Property<View!, Float!>!

Inherited functions

From android.view.View
Unit
Unit
addExtraDataToAccessibilityNodeInfo(
    info: AccessibilityNodeInfo!,
    extraDataKey: String!,
    arguments: Bundle!
)
Unit
addFocusables(views: ArrayList<View!>!, direction: Int)
Unit
addKeyboardNavigationClusters(
    views: (Mutable)Collection<View!>!,
    direction: Int
)
Unit
Unit
Unit
Unit
ViewPropertyAnimator!
Unit
Unit
Boolean
Unit
Unit

This function is deprecated.

Unit
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Unit
Unit
Unit
Boolean
Unit
Unit
Unit
java-static Int
combineMeasuredStates(curState: Int, newState: Int)
Int
Int
Int
Unit
WindowInsets!
computeSystemWindowInsets(in: WindowInsets!, outLocalInsets: Rect!)
Int
Int
Int
AccessibilityNodeInfo!
Unit
Unit

This function is deprecated.

WindowInsets!
Boolean
Unit
Unit
dispatchCreateViewTranslationRequest(
    viewIds: (Mutable)Map<AutofillId!, LongArray!>!,
    supportedFormats: IntArray!,
    capability: TranslationCapability!,
    requests: (Mutable)List<ViewTranslationRequest!>!
)
Unit
Boolean
Unit
dispatchDraw(canvas: Canvas!)
Unit
Unit
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
dispatchNestedFling(velocityX: Float, velocityY: Float, consumed: Boolean)
Boolean
dispatchNestedPreFling(velocityX: Float, velocityY: Float)
Boolean
dispatchNestedPrePerformAccessibilityAction(
    action: Int,
    arguments: Bundle!
)
Boolean
dispatchNestedPreScroll(
    dx: Int,
    dy: Int,
    consumed: IntArray!,
    offsetInWindow: IntArray!
)
Boolean
dispatchNestedScroll(
    dxConsumed: Int,
    dyConsumed: Int,
    dxUnconsumed: Int,
    dyUnconsumed: Int,
    offsetInWindow: IntArray!
)
Unit
Boolean
Unit
Unit
Unit
Unit
Unit
dispatchScrollCaptureSearch(
    localVisibleRect: Rect!,
    windowOffset: Point!,
    targets: Consumer<ScrollCaptureTarget!>!
)
Unit
Unit
Unit
Unit
Unit

This function is deprecated.

Boolean
Boolean
Boolean
dispatchUnhandledMove(focused: View!, direction: Int)
Unit
dispatchVisibilityChanged(changedView: View!, visibility: Int)
Unit
Unit
Unit
WindowInsets!
dispatchWindowInsetsAnimationProgress(
    insets: WindowInsets!,
    runningAnimations: (Mutable)List<WindowInsetsAnimation!>!
)
WindowInsetsAnimation.Bounds!
Unit

This function is deprecated.

Unit
Unit
draw(canvas: Canvas!)
Unit
View!
OnBackInvokedDispatcher!
T!
<T : View?> findViewById(id: Int)
T!
<T : View?> findViewWithTag(tag: Any!)
Unit
findViewsWithText(
    outViews: ArrayList<View!>!,
    searched: CharSequence!,
    flags: Int
)
Boolean

This function is deprecated.

View!
focusSearch(direction: Int)
Unit
forceHasOverlappingRendering(hasOverlappingRendering: Boolean)
Unit
Boolean
Unit
generateDisplayHash(
    hashAlgorithm: String!,
    bounds: Rect!,
    executor: Executor!,
    callback: DisplayHashResultCallback!
)
java-static Int
CharSequence!
View.AccessibilityDelegate!
Int
AccessibilityNodeProvider!
CharSequence!
Int
Int
String!
String!
Float
Animation!
Matrix!
IBinder!
IntArray<Int>!
(Mutable)Map<Int!, Int!>!
Array<String!>!
AutofillId!
Int
AutofillValue!
Drawable!
BlendMode!
ColorStateList!
PorterDuff.Mode!
Int
Int
Float
Int
Float
Rect!
Boolean
getClipBounds(outRect: Rect!)
Boolean
ContentCaptureSession!
CharSequence!
Context!
ContextMenu.ContextMenuInfo!
Boolean
java-static Int
getDefaultSize(size: Int, measureSpec: Int)
Display!
IntArray<Int>!
Bitmap!

This function is deprecated.

Int

This function is deprecated.

Int

This function is deprecated.

Unit
getDrawingRect(outRect: Rect!)
Long
Float
Int
Boolean
Boolean
Int
ArrayList<View!>!
getFocusables(direction: Int)
Unit
Drawable!
Int
BlendMode!
ColorStateList!
PorterDuff.Mode!
Boolean
getGlobalVisibleRect(r: Rect!, globalOffset: Point!)
Handler!
Float
Float
Float
Float
Runnable!
Boolean
Int
Unit
getHitRect(outRect: Rect!)
Int
Int
Drawable!
Drawable!
Int
Int
Int
Int
Boolean
KeyEvent.DispatcherState!
Int
Int
Int
ViewGroup.LayoutParams!
Int
Float
Int
Boolean
Unit
Unit
Unit
Matrix!
Int
Int
Int
Int
Int
Int
Int
Int
Int
Int
Int
Int
Int
View.OnFocusChangeListener!
Int
ViewOutlineProvider!
Int
Int
ViewOverlay!
Int
Int
Int
Int
Int
Int
ViewParent!
ViewParent!
Float
Float
PointerIcon!
(Mutable)List<Rect!>!
Array<String!>!
Resources!
Boolean
Int
Float
Int
AttachedSurfaceControl!
View!
WindowInsets!
Float
Float
Float
Float
Float
Int
Int
Int
Int
Int
Int
Int
Int
Int
Int
CharSequence!
StateListAnimator!
Int
Int
(Mutable)List<Rect!>!
Int

This function is deprecated.

Any!
Int
Int
CharSequence!
Int
Float
Int
TouchDelegate!
ArrayList<View!>!
Float
String!
Float
Float
Float
Long
Int
Int
Drawable!
Drawable!
Int
ViewTranslationResponse!
ViewTreeObserver!
Int
Int
Int
WindowId!
WindowInsetsController!
Int

This function is deprecated.

IBinder!
Int
Unit
Float
Float
Float
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
java-static View!
inflate(context: Context!, resource: Int, root: ViewGroup!)
Unit
invalidate(dirty: Rect!)

This function is deprecated.

Unit
Unit
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean

This function is deprecated.

Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
View!
keyboardNavigationClusterSearch(currentCluster: View!, direction: Int)
Unit
layout(l: Int, t: Int, r: Int, b: Int)
Unit
measure(widthMeasureSpec: Int, heightMeasureSpec: Int)
java-static IntArray<Int>!
mergeDrawableStates(baseState: IntArray!, additionalState: IntArray!)
Unit
Unit
Unit
Unit
WindowInsets!
Unit
Unit
Boolean
Boolean
Unit
Unit
IntArray<Int>!
InputConnection!
Unit
onCreateViewTranslationRequest(
    supportedFormats: IntArray!,
    requestsCollector: Consumer<ViewTranslationRequest!>!
)
Unit
onCreateVirtualViewTranslationRequests(
    virtualIds: LongArray!,
    supportedFormats: IntArray!,
    requestsCollector: Consumer<ViewTranslationRequest!>!
)
Unit
Unit
Boolean
Unit
Unit
Boolean
Unit
Unit
Boolean
Unit
Boolean
Boolean
onKeyLongPress(keyCode: Int, event: KeyEvent!)
Boolean
onKeyMultiple(keyCode: Int, repeatCount: Int, event: KeyEvent!)
Boolean
onKeyPreIme(keyCode: Int, event: KeyEvent!)
Boolean
onKeyShortcut(keyCode: Int, event: KeyEvent!)
Boolean
onKeyUp(keyCode: Int, event: KeyEvent!)
Unit
onOverScrolled(
    scrollX: Int,
    scrollY: Int,
    clampedX: Boolean,
    clampedY: Boolean
)
Unit
Unit
Unit
Unit
Unit
Unit
Unit
ContentInfo!
PointerIcon!
onResolvePointerIcon(event: MotionEvent!, pointerIndex: Int)
Unit
Parcelable!
Unit
onScreenStateChanged(screenState: Int)
Unit
onScrollCaptureSearch(
    localVisibleRect: Rect!,
    windowOffset: Point!,
    targets: Consumer<ScrollCaptureTarget!>!
)
Unit
onScrollChanged(l: Int, t: Int, oldl: Int, oldt: Int)
Boolean
onSetAlpha(alpha: Int)
Unit
onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int)
Unit
Boolean
Unit
Unit
Unit
Unit
onVisibilityChanged(changedView: View!, visibility: Int)
Unit
onWindowFocusChanged(hasWindowFocus: Boolean)
Unit

This function is deprecated.

Unit
Boolean
overScrollBy(
    deltaX: Int,
    deltaY: Int,
    scrollX: Int,
    scrollY: Int,
    scrollRangeX: Int,
    scrollRangeY: Int,
    maxOverScrollX: Int,
    maxOverScrollY: Int,
    isTouchEvent: Boolean
)
Boolean
Boolean
Boolean
performHapticFeedback(feedbackConstant: Int)
Boolean
ContentInfo!
Unit
playSoundEffect(soundConstant: Int)
Boolean
post(action: Runnable!)
Boolean
postDelayed(action: Runnable!, delayMillis: Long)
Unit
Unit
postInvalidateDelayed(delayMilliseconds: Long)
Unit
Unit
Unit
postOnAnimationDelayed(action: Runnable!, delayMillis: Long)
Unit
Unit
Boolean
Unit
Unit
Unit
Unit
Unit

This function is deprecated.

Boolean
Boolean
Unit
Unit
Boolean
Unit
T!
<T : View?> requireViewById(id: Int)
Unit
java-static Int
resolveSize(size: Int, measureSpec: Int)
java-static Int
resolveSizeAndState(size: Int, measureSpec: Int, childMeasuredState: Int)
Boolean
Unit
Unit
saveAttributeDataForStyleable(
    context: Context!,
    styleable: IntArray!,
    attrs: AttributeSet!,
    t: TypedArray!,
    defStyleAttr: Int,
    defStyleRes: Int
)
Unit
Unit
scheduleDrawable(who: Drawable!, what: Runnable!, when: Long)
Unit
scrollBy(x: Int, y: Int)
Unit
scrollTo(x: Int, y: Int)
Unit
Unit
Unit
setAccessibilityDataSensitive(accessibilityDataSensitive: Int)
Unit
Unit
Unit
Unit
setAccessibilityPaneTitle(accessibilityPaneTitle: CharSequence!)
Unit
Unit
Unit
setActivated(activated: Boolean)
Unit
setAllowClickWhenDisabled(clickableWhenDisabled: Boolean)
Unit
Unit
Unit
setAlpha(alpha: Float)
Unit
setAnimation(animation: Animation!)
Unit
Unit
Unit
setAutofillHints(autofillHints: Array<String!>!)
Unit
Unit
setBackground(background: Drawable!)
Unit
Unit

This function is deprecated.

Unit
Unit
Unit
Unit
Unit
setBottom(bottom: Int)
Unit
Unit
setClickable(clickable: Boolean)
Unit
setClipBounds(clipBounds: Rect!)
Unit
setClipToOutline(clipToOutline: Boolean)
Unit
Unit
setContentDescription(contentDescription: CharSequence!)
Unit
setContextClickable(contextClickable: Boolean)
Unit
setDefaultFocusHighlightEnabled(defaultFocusHighlightEnabled: Boolean)
Unit

This function is deprecated.

Unit

This function is deprecated.

Unit

This function is deprecated.

Unit
Unit
setElevation(elevation: Float)
Unit
Unit
Unit
setFitsSystemWindows(fitSystemWindows: Boolean)
Unit
setFocusable(focusable: Boolean)
Unit
setFocusableInTouchMode(focusableInTouchMode: Boolean)
Unit
setFocusedByDefault(isFocusedByDefault: Boolean)
Unit
Unit
setForeground(foreground: Drawable!)
Unit
Unit
Unit
Unit
Unit
setHandwritingBoundsOffsets(
    offsetLeft: Float,
    offsetTop: Float,
    offsetRight: Float,
    offsetBottom: Float
)
Unit
Unit
setHapticFeedbackEnabled(hapticFeedbackEnabled: Boolean)
Unit
setHasTransientState(hasTransientState: Boolean)
Unit
setHorizontalFadingEdgeEnabled(horizontalFadingEdgeEnabled: Boolean)
Unit
setHorizontalScrollBarEnabled(horizontalScrollBarEnabled: Boolean)
Unit
Unit
Unit
setHovered(hovered: Boolean)
Unit
setId(id: Int)
Unit
Unit
Unit
Unit
setIsCredential(isCredential: Boolean)
Unit
setIsHandwritingDelegate(isHandwritingDelegate: Boolean)
Unit
setKeepScreenOn(keepScreenOn: Boolean)
Unit
Unit
Unit
Unit
setLayerType(layerType: Int, paint: Paint!)
Unit
setLayoutDirection(layoutDirection: Int)
Unit
Unit
setLeft(left: Int)
Unit
setLeftTopRightBottom(left: Int, top: Int, right: Int, bottom: Int)
Unit
setLongClickable(longClickable: Boolean)
Unit
setMeasuredDimension(measuredWidth: Int, measuredHeight: Int)
Unit
setMinimumHeight(minHeight: Int)
Unit
setMinimumWidth(minWidth: Int)
Unit
Unit
setNextClusterForwardId(nextClusterForwardId: Int)
Unit
setNextFocusDownId(nextFocusDownId: Int)
Unit
setNextFocusForwardId(nextFocusForwardId: Int)
Unit
setNextFocusLeftId(nextFocusLeftId: Int)
Unit
setNextFocusRightId(nextFocusRightId: Int)
Unit
setNextFocusUpId(nextFocusUpId: Int)
Unit
Unit
Unit
Unit
Unit
Unit
Unit
Unit
Unit
Unit
Unit
Unit
setOnReceiveContentListener(
    mimeTypes: Array<String!>!,
    listener: OnReceiveContentListener!
)
Unit
Unit

This function is deprecated.

Unit
Unit
Unit
Unit
Unit
setOverScrollMode(overScrollMode: Int)
Unit
setPadding(left: Int, top: Int, right: Int, bottom: Int)
Unit
setPaddingRelative(start: Int, top: Int, end: Int, bottom: Int)
Unit
setPivotX(pivotX: Float)
Unit
setPivotY(pivotY: Float)
Unit
setPointerIcon(pointerIcon: PointerIcon!)
Unit
setPreferKeepClear(preferKeepClear: Boolean)
Unit
Unit
setPressed(pressed: Boolean)
Unit
setRenderEffect(renderEffect: RenderEffect!)
Unit
setRevealOnFocusHint(revealOnFocus: Boolean)
Unit
setRight(right: Int)
Unit
setRotation(rotation: Float)
Unit
setRotationX(rotationX: Float)
Unit
setRotationY(rotationY: Float)
Unit
Unit
Unit
setScaleX(scaleX: Float)
Unit
setScaleY(scaleY: Float)
Unit
setScreenReaderFocusable(screenReaderFocusable: Boolean)
Unit
setScrollBarDefaultDelayBeforeFade(
    scrollBarDefaultDelayBeforeFade: Int
)
Unit
setScrollBarFadeDuration(scrollBarFadeDuration: Int)
Unit
setScrollBarSize(scrollBarSize: Int)
Unit
Unit
Unit
Unit
setScrollContainer(isScrollContainer: Boolean)
Unit
setScrollIndicators(indicators: Int)
Unit
setScrollX(value: Int)
Unit
setScrollY(value: Int)
Unit
Unit
setSelected(selected: Boolean)
Unit
setSoundEffectsEnabled(soundEffectsEnabled: Boolean)
Unit
setStateDescription(stateDescription: CharSequence!)
Unit
Unit
Unit

This function is deprecated.

Unit
setTag(tag: Any!)
Unit
setTextAlignment(textAlignment: Int)
Unit
setTextDirection(textDirection: Int)
Unit
Unit
setTop(top: Int)
Unit
Unit
Unit
setTransitionName(transitionName: String!)
Unit
Unit
setTranslationX(translationX: Float)
Unit
setTranslationY(translationY: Float)
Unit
setTranslationZ(translationZ: Float)
Unit
setVerticalFadingEdgeEnabled(verticalFadingEdgeEnabled: Boolean)
Unit
setVerticalScrollBarEnabled(verticalScrollBarEnabled: Boolean)
Unit
Unit
Unit
Unit
Unit
setVisibility(visibility: Int)
Unit
setWillNotCacheDrawing(willNotCacheDrawing: Boolean)

This function is deprecated.

Unit
setWillNotDraw(willNotDraw: Boolean)
Unit
Unit
setX(x: Float)
Unit
setY(y: Float)
Unit
setZ(z: Float)
Boolean
ActionMode!
Unit
Boolean
startDrag(
    data: ClipData!,
    shadowBuilder: View.DragShadowBuilder!,
    myLocalState: Any!,
    flags: Int
)

This function is deprecated.

Boolean
startDragAndDrop(
    data: ClipData!,
    shadowBuilder: View.DragShadowBuilder!,
    myLocalState: Any!,
    flags: Int
)
Boolean
Unit
String!
Unit
Unit
Unit
Unit
Boolean
Boolean

This function is deprecated.

Boolean

Constants

BAR_GRAVITY_BOTTOM

const val BAR_GRAVITY_BOTTOM = 1: Int

Vertical gravity for progress bar to be located at the bottom in the view.

BAR_GRAVITY_CENTER

const val BAR_GRAVITY_CENTER = 0: Int

Vertical gravity for progress bar to be located at the center in the view.

DEFAULT_AD_MARKER_COLOR

const val DEFAULT_AD_MARKER_COLOR = -1291845888: Int

Default color for ad markers.

DEFAULT_AD_MARKER_WIDTH_DP

const val DEFAULT_AD_MARKER_WIDTH_DP = 4: Int

Default width for ad markers, in dp.

DEFAULT_BAR_HEIGHT_DP

const val DEFAULT_BAR_HEIGHT_DP = 4: Int

Default height for the time bar, in dp.

DEFAULT_BUFFERED_COLOR

const val DEFAULT_BUFFERED_COLOR = -855638017: Int

Default color for the buffered portion of the time bar.

DEFAULT_PLAYED_AD_MARKER_COLOR

const val DEFAULT_PLAYED_AD_MARKER_COLOR = 872414976: Int

Default color for played ad markers.

DEFAULT_PLAYED_COLOR

const val DEFAULT_PLAYED_COLOR = -1: Int

Default color for the played portion of the time bar.

DEFAULT_SCRUBBER_COLOR

const val DEFAULT_SCRUBBER_COLOR = -1: Int

Default color for the scrubber handle.

DEFAULT_SCRUBBER_DISABLED_SIZE_DP

const val DEFAULT_SCRUBBER_DISABLED_SIZE_DP = 0: Int

Default diameter for the scrubber when disabled, in dp.

DEFAULT_SCRUBBER_DRAGGED_SIZE_DP

const val DEFAULT_SCRUBBER_DRAGGED_SIZE_DP = 16: Int

Default diameter for the scrubber when dragged, in dp.

DEFAULT_SCRUBBER_ENABLED_SIZE_DP

const val DEFAULT_SCRUBBER_ENABLED_SIZE_DP = 12: Int

Default diameter for the scrubber when enabled, in dp.

DEFAULT_TOUCH_TARGET_HEIGHT_DP

const val DEFAULT_TOUCH_TARGET_HEIGHT_DP = 26: Int

Default height for the touch target, in dp.

DEFAULT_UNPLAYED_COLOR

const val DEFAULT_UNPLAYED_COLOR = 872415231: Int

Default color for the unplayed portion of the time bar.

Public constructors

DefaultTimeBar

DefaultTimeBar(context: Context!)

DefaultTimeBar

DefaultTimeBar(context: Context!, attrs: AttributeSet?)

DefaultTimeBar

DefaultTimeBar(context: Context!, attrs: AttributeSet?, defStyleAttr: Int)

DefaultTimeBar

DefaultTimeBar(
    context: Context!,
    attrs: AttributeSet?,
    defStyleAttr: Int,
    timebarAttrs: AttributeSet?
)

DefaultTimeBar

DefaultTimeBar(
    context: Context!,
    attrs: AttributeSet?,
    defStyleAttr: Int,
    timebarAttrs: AttributeSet?,
    defStyleRes: Int
)

Public functions

addListener

fun addListener(listener: TimeBar.OnScrubListener!): Unit

Adds a listener for scrubbing events.

Parameters
listener: TimeBar.OnScrubListener!

The listener to add.

getPreferredUpdateDelay

fun getPreferredUpdateDelay(): Long

Returns the preferred delay in milliseconds of media time after which the time bar position should be updated.

Returns
Long

Preferred delay, in milliseconds of media time.

hideScrubber

fun hideScrubber(disableScrubberPadding: Boolean): Unit

Hides the scrubber handle.

hideScrubber

fun hideScrubber(hideAnimationDurationMs: Long): Unit

Hides the scrubber handle with animation.

Parameters
hideAnimationDurationMs: Long

The duration for scrubber hiding animation.

jumpDrawablesToCurrentState

fun jumpDrawablesToCurrentState(): Unit

onDraw

fun onDraw(canvas: Canvas!): Unit

onInitializeAccessibilityEvent

fun onInitializeAccessibilityEvent(event: AccessibilityEvent!): Unit

onInitializeAccessibilityNodeInfo

fun onInitializeAccessibilityNodeInfo(info: AccessibilityNodeInfo!): Unit

onKeyDown

fun onKeyDown(keyCode: Int, event: KeyEvent!): Boolean

onRtlPropertiesChanged

fun onRtlPropertiesChanged(layoutDirection: Int): Unit

onTouchEvent

fun onTouchEvent(event: MotionEvent!): Boolean

performAccessibilityAction

fun performAccessibilityAction(action: Int, args: Bundle?): Boolean

removeListener

fun removeListener(listener: TimeBar.OnScrubListener!): Unit

Removes a listener for scrubbing events.

Parameters
listener: TimeBar.OnScrubListener!

The listener to remove.

setAdGroupTimesMs

fun setAdGroupTimesMs(
    adGroupTimesMs: LongArray?,
    playedAdGroups: BooleanArray?,
    adGroupCount: Int
): Unit

Sets the times of ad groups and whether each ad group has been played.

Parameters
adGroupTimesMs: LongArray?

An array where the first adGroupCount elements are the times of ad groups in milliseconds. May be null if there are no ad groups.

playedAdGroups: BooleanArray?

An array where the first adGroupCount elements indicate whether the corresponding ad groups have been played. May be null if there are no ad groups.

adGroupCount: Int

The number of ad groups.

setAdMarkerColor

fun setAdMarkerColor(adMarkerColor: @ColorInt Int): Unit

Sets the color for unplayed ad markers.

Parameters
adMarkerColor: @ColorInt Int

The color for unplayed ad markers.

setBufferedColor

fun setBufferedColor(bufferedColor: @ColorInt Int): Unit

Sets the color for the portion of the time bar after the current played position up to the current buffered position.

Parameters
bufferedColor: @ColorInt Int

The color for the portion of the time bar after the current played position up to the current buffered position.

setBufferedPosition

fun setBufferedPosition(bufferedPosition: Long): Unit

Sets the buffered position.

Parameters
bufferedPosition: Long

The current buffered position to show, in milliseconds.

setDuration

fun setDuration(duration: Long): Unit

Sets the duration.

Parameters
duration: Long

The duration to show, in milliseconds.

setEnabled

fun setEnabled(enabled: Boolean): Unit

setKeyCountIncrement

fun setKeyCountIncrement(count: Int): Unit

Sets the position increment for key presses and accessibility actions, as a number of increments that divide the duration of the media. For example, passing 20 will cause key presses to increment/decrement the position by 1/20th of the duration (if known).

Clears any increment specified in a preceding call to setKeyTimeIncrement.

Parameters
count: Int

The number of increments that divide the duration of the media.

setKeyTimeIncrement

fun setKeyTimeIncrement(time: Long): Unit

Sets the position increment for key presses and accessibility actions, in milliseconds.

Clears any increment specified in a preceding call to setKeyCountIncrement.

Parameters
time: Long

The time increment, in milliseconds.

setPlayedAdMarkerColor

fun setPlayedAdMarkerColor(playedAdMarkerColor: @ColorInt Int): Unit

Sets the color for played ad markers.

Parameters
playedAdMarkerColor: @ColorInt Int

The color for played ad markers.

setPlayedColor

fun setPlayedColor(playedColor: @ColorInt Int): Unit

Sets the color for the portion of the time bar representing media before the playback position.

Parameters
playedColor: @ColorInt Int

The color for the portion of the time bar representing media before the playback position.

setPosition

fun setPosition(position: Long): Unit

Sets the current position.

Parameters
position: Long

The current position to show, in milliseconds.

setScrubberColor

fun setScrubberColor(scrubberColor: @ColorInt Int): Unit

Sets the color for the scrubber handle.

Parameters
scrubberColor: @ColorInt Int

The color for the scrubber handle.

setUnplayedColor

fun setUnplayedColor(unplayedColor: @ColorInt Int): Unit

Sets the color for the portion of the time bar after the current played position.

Parameters
unplayedColor: @ColorInt Int

The color for the portion of the time bar after the current played position.

showScrubber

fun showScrubber(): Unit

Shows the scrubber handle.

showScrubber

fun showScrubber(showAnimationDurationMs: Long): Unit

Shows the scrubber handle with animation.

Parameters
showAnimationDurationMs: Long

The duration for scrubber showing animation.

Protected functions

drawableStateChanged

protected fun drawableStateChanged(): Unit

onFocusChanged

protected fun onFocusChanged(
    gainFocus: Boolean,
    direction: Int,
    previouslyFocusedRect: Rect?
): Unit

onLayout

protected fun onLayout(changed: Boolean, left: Int, top: Int, right: Int, bottom: Int): Unit

onMeasure

protected fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int): Unit