com.google.android.exoplayer2.ui.DefaultTimeBar Java Examples
The following examples show how to use
com.google.android.exoplayer2.ui.DefaultTimeBar.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PreviewTimeBar.java From PreviewSeekBar with Apache License 2.0 | 4 votes |
public PreviewTimeBar(Context context, AttributeSet attrs) { super(context, attrs); TypedArray typedArray = context.getTheme().obtainStyledAttributes(attrs, com.google.android.exoplayer2.ui.R.styleable.DefaultTimeBar, 0, 0); scrubberColor = typedArray.getInt( com.google.android.exoplayer2.ui.R.styleable.DefaultTimeBar_scrubber_color, DEFAULT_SCRUBBER_COLOR); final Drawable scrubberDrawable = typedArray.getDrawable( com.google.android.exoplayer2.ui.R.styleable.DefaultTimeBar_scrubber_drawable); final int scrubberEnabledSize = typedArray.getDimensionPixelSize( com.google.android.exoplayer2.ui.R.styleable.DefaultTimeBar_scrubber_enabled_size, dpToPx(context.getResources().getDisplayMetrics(), DEFAULT_SCRUBBER_ENABLED_SIZE_DP)); final int scrubberDisabledSize = typedArray.getDimensionPixelSize( com.google.android.exoplayer2.ui.R.styleable.DefaultTimeBar_scrubber_disabled_size, dpToPx(context.getResources().getDisplayMetrics(), DEFAULT_SCRUBBER_DISABLED_SIZE_DP)); final int scrubberDraggedSize = typedArray.getDimensionPixelSize( com.google.android.exoplayer2.ui.R.styleable.DefaultTimeBar_scrubber_dragged_size, dpToPx(context.getResources().getDisplayMetrics(), DEFAULT_SCRUBBER_DRAGGED_SIZE_DP)); // Calculate the scrubber padding based on the maximum size the scrubber can have if (scrubberDrawable != null) { scrubberPadding = (scrubberDrawable.getMinimumWidth() + 1) / 2; } else { scrubberPadding = (Math.max(scrubberDisabledSize, Math.max(scrubberEnabledSize, scrubberDraggedSize)) + 1) / 2; } typedArray.recycle(); typedArray = context.getTheme().obtainStyledAttributes( attrs, R.styleable.PreviewTimeBar, 0, 0); previewId = typedArray.getResourceId( R.styleable.PreviewTimeBar_previewFrameLayout, View.NO_ID); delegate = new PreviewDelegate(this); delegate.setPreviewEnabled(isEnabled()); delegate.setAnimationEnabled(typedArray.getBoolean( R.styleable.PreviewTimeBar_previewAnimationEnabled, true)); delegate.setPreviewEnabled(typedArray.getBoolean( R.styleable.PreviewTimeBar_previewEnabled, true)); delegate.setAutoHidePreview(typedArray.getBoolean( R.styleable.PreviewTimeBar_previewAutoHide, true)); typedArray.recycle(); addListener(new TimeBarDefaultOnScrubListener()); }