- Added realracing3-community.apk (71.57 MB) - Removed 32-bit support (armeabi-v7a) - Only includes arm64-v8a libraries - Decompiled source code included - Added README-community.md with analysis
813 lines
30 KiB
Java
813 lines
30 KiB
Java
package com.google.android.exoplayer2.ui;
|
|
|
|
import android.animation.ValueAnimator;
|
|
import android.content.Context;
|
|
import android.content.res.TypedArray;
|
|
import android.graphics.Canvas;
|
|
import android.graphics.Paint;
|
|
import android.graphics.Point;
|
|
import android.graphics.Rect;
|
|
import android.graphics.drawable.Drawable;
|
|
import android.os.Bundle;
|
|
import android.util.AttributeSet;
|
|
import android.view.MotionEvent;
|
|
import android.view.View;
|
|
import android.view.ViewParent;
|
|
import android.view.accessibility.AccessibilityEvent;
|
|
import android.view.accessibility.AccessibilityNodeInfo;
|
|
import androidx.annotation.ColorInt;
|
|
import androidx.annotation.Nullable;
|
|
import com.google.android.exoplayer2.ui.TimeBar;
|
|
import com.google.android.exoplayer2.util.Assertions;
|
|
import com.google.android.exoplayer2.util.Util;
|
|
import com.mbridge.msdk.playercommon.exoplayer2.C;
|
|
import java.util.Collections;
|
|
import java.util.Formatter;
|
|
import java.util.Iterator;
|
|
import java.util.Locale;
|
|
import java.util.concurrent.CopyOnWriteArraySet;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public class DefaultTimeBar extends View implements TimeBar {
|
|
public int adGroupCount;
|
|
public long[] adGroupTimesMs;
|
|
public final Paint adMarkerPaint;
|
|
public final int adMarkerWidth;
|
|
public final int barGravity;
|
|
public final int barHeight;
|
|
public final Rect bufferedBar;
|
|
public final Paint bufferedPaint;
|
|
public long bufferedPosition;
|
|
public final float density;
|
|
public long duration;
|
|
public final int fineScrubYThreshold;
|
|
public final StringBuilder formatBuilder;
|
|
public final Formatter formatter;
|
|
public int keyCountIncrement;
|
|
public long keyTimeIncrement;
|
|
public int lastCoarseScrubXPosition;
|
|
public Rect lastExclusionRectangle;
|
|
public final CopyOnWriteArraySet listeners;
|
|
public boolean[] playedAdGroups;
|
|
public final Paint playedAdMarkerPaint;
|
|
public final Paint playedPaint;
|
|
public long position;
|
|
public final Rect progressBar;
|
|
public long scrubPosition;
|
|
public final Rect scrubberBar;
|
|
public final int scrubberDisabledSize;
|
|
public final int scrubberDraggedSize;
|
|
public final Drawable scrubberDrawable;
|
|
public final int scrubberEnabledSize;
|
|
public final int scrubberPadding;
|
|
public boolean scrubberPaddingDisabled;
|
|
public final Paint scrubberPaint;
|
|
public float scrubberScale;
|
|
public ValueAnimator scrubberScalingAnimator;
|
|
public boolean scrubbing;
|
|
public final Rect seekBounds;
|
|
public final Runnable stopScrubbingRunnable;
|
|
public final Point touchPosition;
|
|
public final int touchTargetHeight;
|
|
public final Paint unplayedPaint;
|
|
|
|
public static int dpToPx(float f, int i) {
|
|
return (int) ((i * f) + 0.5f);
|
|
}
|
|
|
|
public DefaultTimeBar(Context context) {
|
|
this(context, null);
|
|
}
|
|
|
|
public DefaultTimeBar(Context context, @Nullable AttributeSet attributeSet) {
|
|
this(context, attributeSet, 0);
|
|
}
|
|
|
|
public DefaultTimeBar(Context context, @Nullable AttributeSet attributeSet, int i) {
|
|
this(context, attributeSet, i, attributeSet);
|
|
}
|
|
|
|
public DefaultTimeBar(Context context, AttributeSet attributeSet, int i, AttributeSet attributeSet2) {
|
|
this(context, attributeSet, i, attributeSet2, 0);
|
|
}
|
|
|
|
public DefaultTimeBar(Context context, AttributeSet attributeSet, int i, AttributeSet attributeSet2, int i2) {
|
|
super(context, attributeSet, i);
|
|
this.seekBounds = new Rect();
|
|
this.progressBar = new Rect();
|
|
this.bufferedBar = new Rect();
|
|
this.scrubberBar = new Rect();
|
|
Paint paint = new Paint();
|
|
this.playedPaint = paint;
|
|
Paint paint2 = new Paint();
|
|
this.bufferedPaint = paint2;
|
|
Paint paint3 = new Paint();
|
|
this.unplayedPaint = paint3;
|
|
Paint paint4 = new Paint();
|
|
this.adMarkerPaint = paint4;
|
|
Paint paint5 = new Paint();
|
|
this.playedAdMarkerPaint = paint5;
|
|
Paint paint6 = new Paint();
|
|
this.scrubberPaint = paint6;
|
|
paint6.setAntiAlias(true);
|
|
this.listeners = new CopyOnWriteArraySet();
|
|
this.touchPosition = new Point();
|
|
float f = context.getResources().getDisplayMetrics().density;
|
|
this.density = f;
|
|
this.fineScrubYThreshold = dpToPx(f, -50);
|
|
int dpToPx = dpToPx(f, 4);
|
|
int dpToPx2 = dpToPx(f, 26);
|
|
int dpToPx3 = dpToPx(f, 4);
|
|
int dpToPx4 = dpToPx(f, 12);
|
|
int dpToPx5 = dpToPx(f, 0);
|
|
int dpToPx6 = dpToPx(f, 16);
|
|
if (attributeSet2 != null) {
|
|
TypedArray obtainStyledAttributes = context.getTheme().obtainStyledAttributes(attributeSet2, R$styleable.DefaultTimeBar, i, i2);
|
|
try {
|
|
Drawable drawable = obtainStyledAttributes.getDrawable(R$styleable.DefaultTimeBar_scrubber_drawable);
|
|
this.scrubberDrawable = drawable;
|
|
if (drawable != null) {
|
|
setDrawableLayoutDirection(drawable);
|
|
dpToPx2 = Math.max(drawable.getMinimumHeight(), dpToPx2);
|
|
}
|
|
this.barHeight = obtainStyledAttributes.getDimensionPixelSize(R$styleable.DefaultTimeBar_bar_height, dpToPx);
|
|
this.touchTargetHeight = obtainStyledAttributes.getDimensionPixelSize(R$styleable.DefaultTimeBar_touch_target_height, dpToPx2);
|
|
this.barGravity = obtainStyledAttributes.getInt(R$styleable.DefaultTimeBar_bar_gravity, 0);
|
|
this.adMarkerWidth = obtainStyledAttributes.getDimensionPixelSize(R$styleable.DefaultTimeBar_ad_marker_width, dpToPx3);
|
|
this.scrubberEnabledSize = obtainStyledAttributes.getDimensionPixelSize(R$styleable.DefaultTimeBar_scrubber_enabled_size, dpToPx4);
|
|
this.scrubberDisabledSize = obtainStyledAttributes.getDimensionPixelSize(R$styleable.DefaultTimeBar_scrubber_disabled_size, dpToPx5);
|
|
this.scrubberDraggedSize = obtainStyledAttributes.getDimensionPixelSize(R$styleable.DefaultTimeBar_scrubber_dragged_size, dpToPx6);
|
|
int i3 = obtainStyledAttributes.getInt(R$styleable.DefaultTimeBar_played_color, -1);
|
|
int i4 = obtainStyledAttributes.getInt(R$styleable.DefaultTimeBar_scrubber_color, -1);
|
|
int i5 = obtainStyledAttributes.getInt(R$styleable.DefaultTimeBar_buffered_color, -855638017);
|
|
int i6 = obtainStyledAttributes.getInt(R$styleable.DefaultTimeBar_unplayed_color, 872415231);
|
|
int i7 = obtainStyledAttributes.getInt(R$styleable.DefaultTimeBar_ad_marker_color, -1291845888);
|
|
int i8 = obtainStyledAttributes.getInt(R$styleable.DefaultTimeBar_played_ad_marker_color, 872414976);
|
|
paint.setColor(i3);
|
|
paint6.setColor(i4);
|
|
paint2.setColor(i5);
|
|
paint3.setColor(i6);
|
|
paint4.setColor(i7);
|
|
paint5.setColor(i8);
|
|
obtainStyledAttributes.recycle();
|
|
} catch (Throwable th) {
|
|
obtainStyledAttributes.recycle();
|
|
throw th;
|
|
}
|
|
} else {
|
|
this.barHeight = dpToPx;
|
|
this.touchTargetHeight = dpToPx2;
|
|
this.barGravity = 0;
|
|
this.adMarkerWidth = dpToPx3;
|
|
this.scrubberEnabledSize = dpToPx4;
|
|
this.scrubberDisabledSize = dpToPx5;
|
|
this.scrubberDraggedSize = dpToPx6;
|
|
paint.setColor(-1);
|
|
paint6.setColor(-1);
|
|
paint2.setColor(-855638017);
|
|
paint3.setColor(872415231);
|
|
paint4.setColor(-1291845888);
|
|
paint5.setColor(872414976);
|
|
this.scrubberDrawable = null;
|
|
}
|
|
StringBuilder sb = new StringBuilder();
|
|
this.formatBuilder = sb;
|
|
this.formatter = new Formatter(sb, Locale.getDefault());
|
|
this.stopScrubbingRunnable = new Runnable() { // from class: com.google.android.exoplayer2.ui.DefaultTimeBar$$ExternalSyntheticLambda1
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
DefaultTimeBar.this.lambda$new$0();
|
|
}
|
|
};
|
|
Drawable drawable2 = this.scrubberDrawable;
|
|
if (drawable2 != null) {
|
|
this.scrubberPadding = (drawable2.getMinimumWidth() + 1) / 2;
|
|
} else {
|
|
this.scrubberPadding = (Math.max(this.scrubberDisabledSize, Math.max(this.scrubberEnabledSize, this.scrubberDraggedSize)) + 1) / 2;
|
|
}
|
|
this.scrubberScale = 1.0f;
|
|
ValueAnimator valueAnimator = new ValueAnimator();
|
|
this.scrubberScalingAnimator = valueAnimator;
|
|
valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { // from class: com.google.android.exoplayer2.ui.DefaultTimeBar$$ExternalSyntheticLambda2
|
|
@Override // android.animation.ValueAnimator.AnimatorUpdateListener
|
|
public final void onAnimationUpdate(ValueAnimator valueAnimator2) {
|
|
DefaultTimeBar.this.lambda$new$1(valueAnimator2);
|
|
}
|
|
});
|
|
this.duration = C.TIME_UNSET;
|
|
this.keyTimeIncrement = C.TIME_UNSET;
|
|
this.keyCountIncrement = 20;
|
|
setFocusable(true);
|
|
if (getImportantForAccessibility() == 0) {
|
|
setImportantForAccessibility(1);
|
|
}
|
|
}
|
|
|
|
public final /* synthetic */ void lambda$new$0() {
|
|
stopScrubbing(false);
|
|
}
|
|
|
|
public final /* synthetic */ void lambda$new$1(ValueAnimator valueAnimator) {
|
|
this.scrubberScale = ((Float) valueAnimator.getAnimatedValue()).floatValue();
|
|
invalidate(this.seekBounds);
|
|
}
|
|
|
|
public void showScrubber() {
|
|
if (this.scrubberScalingAnimator.isStarted()) {
|
|
this.scrubberScalingAnimator.cancel();
|
|
}
|
|
this.scrubberPaddingDisabled = false;
|
|
this.scrubberScale = 1.0f;
|
|
invalidate(this.seekBounds);
|
|
}
|
|
|
|
public void showScrubber(long j) {
|
|
if (this.scrubberScalingAnimator.isStarted()) {
|
|
this.scrubberScalingAnimator.cancel();
|
|
}
|
|
this.scrubberPaddingDisabled = false;
|
|
this.scrubberScalingAnimator.setFloatValues(this.scrubberScale, 1.0f);
|
|
this.scrubberScalingAnimator.setDuration(j);
|
|
this.scrubberScalingAnimator.start();
|
|
}
|
|
|
|
public void hideScrubber(boolean z) {
|
|
if (this.scrubberScalingAnimator.isStarted()) {
|
|
this.scrubberScalingAnimator.cancel();
|
|
}
|
|
this.scrubberPaddingDisabled = z;
|
|
this.scrubberScale = 0.0f;
|
|
invalidate(this.seekBounds);
|
|
}
|
|
|
|
public void hideScrubber(long j) {
|
|
if (this.scrubberScalingAnimator.isStarted()) {
|
|
this.scrubberScalingAnimator.cancel();
|
|
}
|
|
this.scrubberScalingAnimator.setFloatValues(this.scrubberScale, 0.0f);
|
|
this.scrubberScalingAnimator.setDuration(j);
|
|
this.scrubberScalingAnimator.start();
|
|
}
|
|
|
|
public void setPlayedColor(@ColorInt int i) {
|
|
this.playedPaint.setColor(i);
|
|
invalidate(this.seekBounds);
|
|
}
|
|
|
|
public void setScrubberColor(@ColorInt int i) {
|
|
this.scrubberPaint.setColor(i);
|
|
invalidate(this.seekBounds);
|
|
}
|
|
|
|
public void setBufferedColor(@ColorInt int i) {
|
|
this.bufferedPaint.setColor(i);
|
|
invalidate(this.seekBounds);
|
|
}
|
|
|
|
public void setUnplayedColor(@ColorInt int i) {
|
|
this.unplayedPaint.setColor(i);
|
|
invalidate(this.seekBounds);
|
|
}
|
|
|
|
public void setAdMarkerColor(@ColorInt int i) {
|
|
this.adMarkerPaint.setColor(i);
|
|
invalidate(this.seekBounds);
|
|
}
|
|
|
|
public void setPlayedAdMarkerColor(@ColorInt int i) {
|
|
this.playedAdMarkerPaint.setColor(i);
|
|
invalidate(this.seekBounds);
|
|
}
|
|
|
|
@Override // com.google.android.exoplayer2.ui.TimeBar
|
|
public void addListener(TimeBar.OnScrubListener onScrubListener) {
|
|
Assertions.checkNotNull(onScrubListener);
|
|
this.listeners.add(onScrubListener);
|
|
}
|
|
|
|
public void setKeyTimeIncrement(long j) {
|
|
Assertions.checkArgument(j > 0);
|
|
this.keyCountIncrement = -1;
|
|
this.keyTimeIncrement = j;
|
|
}
|
|
|
|
public void setKeyCountIncrement(int i) {
|
|
Assertions.checkArgument(i > 0);
|
|
this.keyCountIncrement = i;
|
|
this.keyTimeIncrement = C.TIME_UNSET;
|
|
}
|
|
|
|
@Override // com.google.android.exoplayer2.ui.TimeBar
|
|
public void setPosition(long j) {
|
|
if (this.position == j) {
|
|
return;
|
|
}
|
|
this.position = j;
|
|
setContentDescription(getProgressText());
|
|
update();
|
|
}
|
|
|
|
@Override // com.google.android.exoplayer2.ui.TimeBar
|
|
public void setBufferedPosition(long j) {
|
|
if (this.bufferedPosition == j) {
|
|
return;
|
|
}
|
|
this.bufferedPosition = j;
|
|
update();
|
|
}
|
|
|
|
public void setDuration(long j) {
|
|
if (this.duration == j) {
|
|
return;
|
|
}
|
|
this.duration = j;
|
|
if (this.scrubbing && j == C.TIME_UNSET) {
|
|
stopScrubbing(true);
|
|
}
|
|
update();
|
|
}
|
|
|
|
public void setAdGroupTimesMs(@Nullable long[] jArr, @Nullable boolean[] zArr, int i) {
|
|
Assertions.checkArgument(i == 0 || !(jArr == null || zArr == null));
|
|
this.adGroupCount = i;
|
|
this.adGroupTimesMs = jArr;
|
|
this.playedAdGroups = zArr;
|
|
update();
|
|
}
|
|
|
|
@Override // android.view.View, com.google.android.exoplayer2.ui.TimeBar
|
|
public void setEnabled(boolean z) {
|
|
super.setEnabled(z);
|
|
if (!this.scrubbing || z) {
|
|
return;
|
|
}
|
|
stopScrubbing(true);
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public void onDraw(Canvas canvas) {
|
|
canvas.save();
|
|
drawTimeBar(canvas);
|
|
drawPlayhead(canvas);
|
|
canvas.restore();
|
|
}
|
|
|
|
/* JADX WARN: Code restructure failed: missing block: B:11:0x0025, code lost:
|
|
|
|
if (r3 != 3) goto L34;
|
|
*/
|
|
@Override // android.view.View
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
To view partially-correct add '--show-bad-code' argument
|
|
*/
|
|
public boolean onTouchEvent(android.view.MotionEvent r8) {
|
|
/*
|
|
r7 = this;
|
|
boolean r0 = r7.isEnabled()
|
|
r1 = 0
|
|
if (r0 == 0) goto L76
|
|
long r2 = r7.duration
|
|
r4 = 0
|
|
int r0 = (r2 > r4 ? 1 : (r2 == r4 ? 0 : -1))
|
|
if (r0 > 0) goto L10
|
|
goto L76
|
|
L10:
|
|
android.graphics.Point r0 = r7.resolveRelativeTouchPosition(r8)
|
|
int r2 = r0.x
|
|
int r0 = r0.y
|
|
int r3 = r8.getAction()
|
|
r4 = 1
|
|
if (r3 == 0) goto L5d
|
|
r5 = 3
|
|
if (r3 == r4) goto L4e
|
|
r6 = 2
|
|
if (r3 == r6) goto L28
|
|
if (r3 == r5) goto L4e
|
|
goto L76
|
|
L28:
|
|
boolean r8 = r7.scrubbing
|
|
if (r8 == 0) goto L76
|
|
int r8 = r7.fineScrubYThreshold
|
|
if (r0 >= r8) goto L3a
|
|
int r8 = r7.lastCoarseScrubXPosition
|
|
int r2 = r2 - r8
|
|
int r2 = r2 / r5
|
|
int r8 = r8 + r2
|
|
float r8 = (float) r8
|
|
r7.positionScrubber(r8)
|
|
goto L40
|
|
L3a:
|
|
r7.lastCoarseScrubXPosition = r2
|
|
float r8 = (float) r2
|
|
r7.positionScrubber(r8)
|
|
L40:
|
|
long r0 = r7.getScrubberPosition()
|
|
r7.updateScrubbing(r0)
|
|
r7.update()
|
|
r7.invalidate()
|
|
return r4
|
|
L4e:
|
|
boolean r0 = r7.scrubbing
|
|
if (r0 == 0) goto L76
|
|
int r8 = r8.getAction()
|
|
if (r8 != r5) goto L59
|
|
r1 = r4
|
|
L59:
|
|
r7.stopScrubbing(r1)
|
|
return r4
|
|
L5d:
|
|
float r8 = (float) r2
|
|
float r0 = (float) r0
|
|
boolean r0 = r7.isInSeekBar(r8, r0)
|
|
if (r0 == 0) goto L76
|
|
r7.positionScrubber(r8)
|
|
long r0 = r7.getScrubberPosition()
|
|
r7.startScrubbing(r0)
|
|
r7.update()
|
|
r7.invalidate()
|
|
return r4
|
|
L76:
|
|
return r1
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: com.google.android.exoplayer2.ui.DefaultTimeBar.onTouchEvent(android.view.MotionEvent):boolean");
|
|
}
|
|
|
|
/* JADX WARN: Can't fix incorrect switch cases order, some code will duplicate */
|
|
/* JADX WARN: Removed duplicated region for block: B:9:0x001a */
|
|
@Override // android.view.View, android.view.KeyEvent.Callback
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
To view partially-correct add '--show-bad-code' argument
|
|
*/
|
|
public boolean onKeyDown(int r5, android.view.KeyEvent r6) {
|
|
/*
|
|
r4 = this;
|
|
boolean r0 = r4.isEnabled()
|
|
if (r0 == 0) goto L30
|
|
long r0 = r4.getPositionIncrement()
|
|
r2 = 66
|
|
r3 = 1
|
|
if (r5 == r2) goto L27
|
|
switch(r5) {
|
|
case 21: goto L13;
|
|
case 22: goto L14;
|
|
case 23: goto L27;
|
|
default: goto L12;
|
|
}
|
|
L12:
|
|
goto L30
|
|
L13:
|
|
long r0 = -r0
|
|
L14:
|
|
boolean r0 = r4.scrubIncrementally(r0)
|
|
if (r0 == 0) goto L30
|
|
java.lang.Runnable r5 = r4.stopScrubbingRunnable
|
|
r4.removeCallbacks(r5)
|
|
java.lang.Runnable r5 = r4.stopScrubbingRunnable
|
|
r0 = 1000(0x3e8, double:4.94E-321)
|
|
r4.postDelayed(r5, r0)
|
|
return r3
|
|
L27:
|
|
boolean r0 = r4.scrubbing
|
|
if (r0 == 0) goto L30
|
|
r5 = 0
|
|
r4.stopScrubbing(r5)
|
|
return r3
|
|
L30:
|
|
boolean r5 = super.onKeyDown(r5, r6)
|
|
return r5
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: com.google.android.exoplayer2.ui.DefaultTimeBar.onKeyDown(int, android.view.KeyEvent):boolean");
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public void onFocusChanged(boolean z, int i, Rect rect) {
|
|
super.onFocusChanged(z, i, rect);
|
|
if (!this.scrubbing || z) {
|
|
return;
|
|
}
|
|
stopScrubbing(false);
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public void drawableStateChanged() {
|
|
super.drawableStateChanged();
|
|
updateDrawableState();
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public void jumpDrawablesToCurrentState() {
|
|
super.jumpDrawablesToCurrentState();
|
|
Drawable drawable = this.scrubberDrawable;
|
|
if (drawable != null) {
|
|
drawable.jumpToCurrentState();
|
|
}
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public void onMeasure(int i, int i2) {
|
|
int mode = View.MeasureSpec.getMode(i2);
|
|
int size = View.MeasureSpec.getSize(i2);
|
|
if (mode == 0) {
|
|
size = this.touchTargetHeight;
|
|
} else if (mode != 1073741824) {
|
|
size = Math.min(this.touchTargetHeight, size);
|
|
}
|
|
setMeasuredDimension(View.MeasureSpec.getSize(i), size);
|
|
updateDrawableState();
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public void onLayout(boolean z, int i, int i2, int i3, int i4) {
|
|
int i5;
|
|
int i6;
|
|
int i7 = i3 - i;
|
|
int i8 = i4 - i2;
|
|
int paddingLeft = getPaddingLeft();
|
|
int paddingRight = i7 - getPaddingRight();
|
|
int i9 = this.scrubberPaddingDisabled ? 0 : this.scrubberPadding;
|
|
if (this.barGravity == 1) {
|
|
i5 = (i8 - getPaddingBottom()) - this.touchTargetHeight;
|
|
int paddingBottom = i8 - getPaddingBottom();
|
|
int i10 = this.barHeight;
|
|
i6 = (paddingBottom - i10) - Math.max(i9 - (i10 / 2), 0);
|
|
} else {
|
|
i5 = (i8 - this.touchTargetHeight) / 2;
|
|
i6 = (i8 - this.barHeight) / 2;
|
|
}
|
|
this.seekBounds.set(paddingLeft, i5, paddingRight, this.touchTargetHeight + i5);
|
|
Rect rect = this.progressBar;
|
|
Rect rect2 = this.seekBounds;
|
|
rect.set(rect2.left + i9, i6, rect2.right - i9, this.barHeight + i6);
|
|
if (Util.SDK_INT >= 29) {
|
|
setSystemGestureExclusionRectsV29(i7, i8);
|
|
}
|
|
update();
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public void onRtlPropertiesChanged(int i) {
|
|
Drawable drawable = this.scrubberDrawable;
|
|
if (drawable == null || !setDrawableLayoutDirection(drawable, i)) {
|
|
return;
|
|
}
|
|
invalidate();
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public void onInitializeAccessibilityEvent(AccessibilityEvent accessibilityEvent) {
|
|
super.onInitializeAccessibilityEvent(accessibilityEvent);
|
|
if (accessibilityEvent.getEventType() == 4) {
|
|
accessibilityEvent.getText().add(getProgressText());
|
|
}
|
|
accessibilityEvent.setClassName("android.widget.SeekBar");
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo accessibilityNodeInfo) {
|
|
super.onInitializeAccessibilityNodeInfo(accessibilityNodeInfo);
|
|
accessibilityNodeInfo.setClassName("android.widget.SeekBar");
|
|
accessibilityNodeInfo.setContentDescription(getProgressText());
|
|
if (this.duration <= 0) {
|
|
return;
|
|
}
|
|
if (Util.SDK_INT >= 21) {
|
|
accessibilityNodeInfo.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_FORWARD);
|
|
accessibilityNodeInfo.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_BACKWARD);
|
|
} else {
|
|
accessibilityNodeInfo.addAction(4096);
|
|
accessibilityNodeInfo.addAction(8192);
|
|
}
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public boolean performAccessibilityAction(int i, Bundle bundle) {
|
|
if (super.performAccessibilityAction(i, bundle)) {
|
|
return true;
|
|
}
|
|
if (this.duration <= 0) {
|
|
return false;
|
|
}
|
|
if (i == 8192) {
|
|
if (scrubIncrementally(-getPositionIncrement())) {
|
|
stopScrubbing(false);
|
|
}
|
|
} else {
|
|
if (i != 4096) {
|
|
return false;
|
|
}
|
|
if (scrubIncrementally(getPositionIncrement())) {
|
|
stopScrubbing(false);
|
|
}
|
|
}
|
|
sendAccessibilityEvent(4);
|
|
return true;
|
|
}
|
|
|
|
public final void startScrubbing(long j) {
|
|
this.scrubPosition = j;
|
|
this.scrubbing = true;
|
|
setPressed(true);
|
|
ViewParent parent = getParent();
|
|
if (parent != null) {
|
|
parent.requestDisallowInterceptTouchEvent(true);
|
|
}
|
|
Iterator it = this.listeners.iterator();
|
|
while (it.hasNext()) {
|
|
((TimeBar.OnScrubListener) it.next()).onScrubStart(this, j);
|
|
}
|
|
}
|
|
|
|
public final void updateScrubbing(long j) {
|
|
if (this.scrubPosition == j) {
|
|
return;
|
|
}
|
|
this.scrubPosition = j;
|
|
Iterator it = this.listeners.iterator();
|
|
while (it.hasNext()) {
|
|
((TimeBar.OnScrubListener) it.next()).onScrubMove(this, j);
|
|
}
|
|
}
|
|
|
|
public final void stopScrubbing(boolean z) {
|
|
removeCallbacks(this.stopScrubbingRunnable);
|
|
this.scrubbing = false;
|
|
setPressed(false);
|
|
ViewParent parent = getParent();
|
|
if (parent != null) {
|
|
parent.requestDisallowInterceptTouchEvent(false);
|
|
}
|
|
invalidate();
|
|
Iterator it = this.listeners.iterator();
|
|
while (it.hasNext()) {
|
|
((TimeBar.OnScrubListener) it.next()).onScrubStop(this, this.scrubPosition, z);
|
|
}
|
|
}
|
|
|
|
public final boolean scrubIncrementally(long j) {
|
|
long j2 = this.duration;
|
|
if (j2 <= 0) {
|
|
return false;
|
|
}
|
|
long j3 = this.scrubbing ? this.scrubPosition : this.position;
|
|
long constrainValue = Util.constrainValue(j3 + j, 0L, j2);
|
|
if (constrainValue == j3) {
|
|
return false;
|
|
}
|
|
if (!this.scrubbing) {
|
|
startScrubbing(constrainValue);
|
|
} else {
|
|
updateScrubbing(constrainValue);
|
|
}
|
|
update();
|
|
return true;
|
|
}
|
|
|
|
public final void update() {
|
|
this.bufferedBar.set(this.progressBar);
|
|
this.scrubberBar.set(this.progressBar);
|
|
long j = this.scrubbing ? this.scrubPosition : this.position;
|
|
if (this.duration > 0) {
|
|
int width = (int) ((this.progressBar.width() * this.bufferedPosition) / this.duration);
|
|
Rect rect = this.bufferedBar;
|
|
Rect rect2 = this.progressBar;
|
|
rect.right = Math.min(rect2.left + width, rect2.right);
|
|
int width2 = (int) ((this.progressBar.width() * j) / this.duration);
|
|
Rect rect3 = this.scrubberBar;
|
|
Rect rect4 = this.progressBar;
|
|
rect3.right = Math.min(rect4.left + width2, rect4.right);
|
|
} else {
|
|
Rect rect5 = this.bufferedBar;
|
|
int i = this.progressBar.left;
|
|
rect5.right = i;
|
|
this.scrubberBar.right = i;
|
|
}
|
|
invalidate(this.seekBounds);
|
|
}
|
|
|
|
public final void positionScrubber(float f) {
|
|
Rect rect = this.scrubberBar;
|
|
Rect rect2 = this.progressBar;
|
|
rect.right = Util.constrainValue((int) f, rect2.left, rect2.right);
|
|
}
|
|
|
|
public final Point resolveRelativeTouchPosition(MotionEvent motionEvent) {
|
|
this.touchPosition.set((int) motionEvent.getX(), (int) motionEvent.getY());
|
|
return this.touchPosition;
|
|
}
|
|
|
|
public final long getScrubberPosition() {
|
|
if (this.progressBar.width() <= 0 || this.duration == C.TIME_UNSET) {
|
|
return 0L;
|
|
}
|
|
return (this.scrubberBar.width() * this.duration) / this.progressBar.width();
|
|
}
|
|
|
|
public final boolean isInSeekBar(float f, float f2) {
|
|
return this.seekBounds.contains((int) f, (int) f2);
|
|
}
|
|
|
|
public final void drawTimeBar(Canvas canvas) {
|
|
int height = this.progressBar.height();
|
|
int centerY = this.progressBar.centerY() - (height / 2);
|
|
int i = height + centerY;
|
|
if (this.duration <= 0) {
|
|
Rect rect = this.progressBar;
|
|
canvas.drawRect(rect.left, centerY, rect.right, i, this.unplayedPaint);
|
|
return;
|
|
}
|
|
Rect rect2 = this.bufferedBar;
|
|
int i2 = rect2.left;
|
|
int i3 = rect2.right;
|
|
int max = Math.max(Math.max(this.progressBar.left, i3), this.scrubberBar.right);
|
|
int i4 = this.progressBar.right;
|
|
if (max < i4) {
|
|
canvas.drawRect(max, centerY, i4, i, this.unplayedPaint);
|
|
}
|
|
int max2 = Math.max(i2, this.scrubberBar.right);
|
|
if (i3 > max2) {
|
|
canvas.drawRect(max2, centerY, i3, i, this.bufferedPaint);
|
|
}
|
|
if (this.scrubberBar.width() > 0) {
|
|
Rect rect3 = this.scrubberBar;
|
|
canvas.drawRect(rect3.left, centerY, rect3.right, i, this.playedPaint);
|
|
}
|
|
if (this.adGroupCount == 0) {
|
|
return;
|
|
}
|
|
long[] jArr = (long[]) Assertions.checkNotNull(this.adGroupTimesMs);
|
|
boolean[] zArr = (boolean[]) Assertions.checkNotNull(this.playedAdGroups);
|
|
int i5 = this.adMarkerWidth / 2;
|
|
for (int i6 = 0; i6 < this.adGroupCount; i6++) {
|
|
int width = ((int) ((this.progressBar.width() * Util.constrainValue(jArr[i6], 0L, this.duration)) / this.duration)) - i5;
|
|
Rect rect4 = this.progressBar;
|
|
canvas.drawRect(rect4.left + Math.min(rect4.width() - this.adMarkerWidth, Math.max(0, width)), centerY, r10 + this.adMarkerWidth, i, zArr[i6] ? this.playedAdMarkerPaint : this.adMarkerPaint);
|
|
}
|
|
}
|
|
|
|
public final void drawPlayhead(Canvas canvas) {
|
|
int i;
|
|
if (this.duration <= 0) {
|
|
return;
|
|
}
|
|
Rect rect = this.scrubberBar;
|
|
int constrainValue = Util.constrainValue(rect.right, rect.left, this.progressBar.right);
|
|
int centerY = this.scrubberBar.centerY();
|
|
if (this.scrubberDrawable == null) {
|
|
if (this.scrubbing || isFocused()) {
|
|
i = this.scrubberDraggedSize;
|
|
} else {
|
|
i = isEnabled() ? this.scrubberEnabledSize : this.scrubberDisabledSize;
|
|
}
|
|
canvas.drawCircle(constrainValue, centerY, (int) ((i * this.scrubberScale) / 2.0f), this.scrubberPaint);
|
|
return;
|
|
}
|
|
int intrinsicWidth = ((int) (r2.getIntrinsicWidth() * this.scrubberScale)) / 2;
|
|
int intrinsicHeight = ((int) (this.scrubberDrawable.getIntrinsicHeight() * this.scrubberScale)) / 2;
|
|
this.scrubberDrawable.setBounds(constrainValue - intrinsicWidth, centerY - intrinsicHeight, constrainValue + intrinsicWidth, centerY + intrinsicHeight);
|
|
this.scrubberDrawable.draw(canvas);
|
|
}
|
|
|
|
public final void updateDrawableState() {
|
|
Drawable drawable = this.scrubberDrawable;
|
|
if (drawable != null && drawable.isStateful() && this.scrubberDrawable.setState(getDrawableState())) {
|
|
invalidate();
|
|
}
|
|
}
|
|
|
|
public final void setSystemGestureExclusionRectsV29(int i, int i2) {
|
|
Rect rect = this.lastExclusionRectangle;
|
|
if (rect != null && rect.width() == i && this.lastExclusionRectangle.height() == i2) {
|
|
return;
|
|
}
|
|
Rect rect2 = new Rect(0, 0, i, i2);
|
|
this.lastExclusionRectangle = rect2;
|
|
setSystemGestureExclusionRects(Collections.singletonList(rect2));
|
|
}
|
|
|
|
public final String getProgressText() {
|
|
return Util.getStringForTime(this.formatBuilder, this.formatter, this.position);
|
|
}
|
|
|
|
public final long getPositionIncrement() {
|
|
long j = this.keyTimeIncrement;
|
|
if (j != C.TIME_UNSET) {
|
|
return j;
|
|
}
|
|
long j2 = this.duration;
|
|
if (j2 == C.TIME_UNSET) {
|
|
return 0L;
|
|
}
|
|
return j2 / this.keyCountIncrement;
|
|
}
|
|
|
|
public final boolean setDrawableLayoutDirection(Drawable drawable) {
|
|
return Util.SDK_INT >= 23 && setDrawableLayoutDirection(drawable, getLayoutDirection());
|
|
}
|
|
|
|
public static boolean setDrawableLayoutDirection(Drawable drawable, int i) {
|
|
return Util.SDK_INT >= 23 && drawable.setLayoutDirection(i);
|
|
}
|
|
}
|