/** * Sets the color for unplayed ad markers. * * @param adMarkerColor The color for unplayed ad markers. */ public void setAdMarkerColor(@ColorInt int adMarkerColor) { adMarkerPaint.setColor(adMarkerColor); invalidate(seekBounds); }
/** * Sets the color for the portion of the time bar representing media before the playback position. * * @param playedColor The color for the portion of the time bar representing media before the * playback position. */ public void setPlayedColor(@ColorInt int playedColor) { playedPaint.setColor(playedColor); invalidate(seekBounds); }
/** * Sets the color for the portion of the time bar after the current played position. * * @param unplayedColor The color for the portion of the time bar after the current played * position. */ public void setUnplayedColor(@ColorInt int unplayedColor) { unplayedPaint.setColor(unplayedColor); invalidate(seekBounds); }
/** * Sets the color for played ad markers. * * @param playedAdMarkerColor The color for played ad markers. */ public void setPlayedAdMarkerColor(@ColorInt int playedAdMarkerColor) { playedAdMarkerPaint.setColor(playedAdMarkerColor); invalidate(seekBounds); }
/** * Sets the color for the scrubber handle. * * @param scrubberColor The color for the scrubber handle. */ public void setScrubberColor(@ColorInt int scrubberColor) { scrubberPaint.setColor(scrubberColor); invalidate(seekBounds); }
/** * Sets the color for the portion of the time bar after the current played position up to the * current buffered position. * * @param bufferedColor The color for the portion of the time bar after the current played * position up to the current buffered position. */ public void setBufferedColor(@ColorInt int bufferedColor) { bufferedPaint.setColor(bufferedColor); invalidate(seekBounds); }
private void update() { bufferedBar.set(progressBar); scrubberBar.set(progressBar); long newScrubberTime = scrubbing ? scrubPosition : position; if (duration > 0) { int bufferedPixelWidth = (int) ((progressBar.width() * bufferedPosition) / duration); bufferedBar.right = Math.min(progressBar.left + bufferedPixelWidth, progressBar.right); int scrubberPixelPosition = (int) ((progressBar.width() * newScrubberTime) / duration); scrubberBar.right = Math.min(progressBar.left + scrubberPixelPosition, progressBar.right); } else { bufferedBar.right = progressBar.left; scrubberBar.right = progressBar.left; } invalidate(seekBounds); }
@Override public void onRtlPropertiesChanged(int layoutDirection) { if (scrubberDrawable != null && setDrawableLayoutDirection(scrubberDrawable, layoutDirection)) { invalidate(); } }
private void updateDrawableState() { if (scrubberDrawable != null && scrubberDrawable.isStateful() && scrubberDrawable.setState(getDrawableState())) { invalidate(); } }
private void stopScrubbing(boolean canceled) { scrubbing = false; setPressed(false); ViewParent parent = getParent(); if (parent != null) { parent.requestDisallowInterceptTouchEvent(false); } invalidate(); for (OnScrubListener listener : listeners) { listener.onScrubStop(this, getScrubberPosition(), canceled); } }
scrubPosition = getScrubberPosition(); update(); invalidate(); return true; invalidate(); return true;