- 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
132 lines
4.4 KiB
Java
132 lines
4.4 KiB
Java
package com.google.android.exoplayer2.ui;
|
|
|
|
import android.content.Context;
|
|
import android.content.res.TypedArray;
|
|
import android.util.AttributeSet;
|
|
import android.view.View;
|
|
import android.widget.FrameLayout;
|
|
import androidx.annotation.Nullable;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public final class AspectRatioFrameLayout extends FrameLayout {
|
|
public final AspectRatioUpdateDispatcher aspectRatioUpdateDispatcher;
|
|
public int resizeMode;
|
|
public float videoAspectRatio;
|
|
|
|
public interface AspectRatioListener {
|
|
}
|
|
|
|
public void setAspectRatioListener(@Nullable AspectRatioListener aspectRatioListener) {
|
|
}
|
|
|
|
public static /* synthetic */ AspectRatioListener access$100(AspectRatioFrameLayout aspectRatioFrameLayout) {
|
|
aspectRatioFrameLayout.getClass();
|
|
return null;
|
|
}
|
|
|
|
public AspectRatioFrameLayout(Context context) {
|
|
this(context, null);
|
|
}
|
|
|
|
public AspectRatioFrameLayout(Context context, @Nullable AttributeSet attributeSet) {
|
|
super(context, attributeSet);
|
|
this.resizeMode = 0;
|
|
if (attributeSet != null) {
|
|
TypedArray obtainStyledAttributes = context.getTheme().obtainStyledAttributes(attributeSet, R$styleable.AspectRatioFrameLayout, 0, 0);
|
|
try {
|
|
this.resizeMode = obtainStyledAttributes.getInt(R$styleable.AspectRatioFrameLayout_resize_mode, 0);
|
|
} finally {
|
|
obtainStyledAttributes.recycle();
|
|
}
|
|
}
|
|
this.aspectRatioUpdateDispatcher = new AspectRatioUpdateDispatcher();
|
|
}
|
|
|
|
public void setAspectRatio(float f) {
|
|
if (this.videoAspectRatio != f) {
|
|
this.videoAspectRatio = f;
|
|
requestLayout();
|
|
}
|
|
}
|
|
|
|
public void setResizeMode(int i) {
|
|
if (this.resizeMode != i) {
|
|
this.resizeMode = i;
|
|
requestLayout();
|
|
}
|
|
}
|
|
|
|
@Override // android.widget.FrameLayout, android.view.View
|
|
public void onMeasure(int i, int i2) {
|
|
float f;
|
|
float f2;
|
|
super.onMeasure(i, i2);
|
|
if (this.videoAspectRatio <= 0.0f) {
|
|
return;
|
|
}
|
|
int measuredWidth = getMeasuredWidth();
|
|
int measuredHeight = getMeasuredHeight();
|
|
float f3 = measuredWidth;
|
|
float f4 = measuredHeight;
|
|
float f5 = f3 / f4;
|
|
float f6 = (this.videoAspectRatio / f5) - 1.0f;
|
|
if (Math.abs(f6) <= 0.01f) {
|
|
this.aspectRatioUpdateDispatcher.scheduleUpdate(this.videoAspectRatio, f5, false);
|
|
return;
|
|
}
|
|
int i3 = this.resizeMode;
|
|
if (i3 != 0) {
|
|
if (i3 != 1) {
|
|
if (i3 == 2) {
|
|
f = this.videoAspectRatio;
|
|
} else if (i3 == 4) {
|
|
if (f6 > 0.0f) {
|
|
f = this.videoAspectRatio;
|
|
} else {
|
|
f2 = this.videoAspectRatio;
|
|
}
|
|
}
|
|
measuredWidth = (int) (f4 * f);
|
|
} else {
|
|
f2 = this.videoAspectRatio;
|
|
}
|
|
measuredHeight = (int) (f3 / f2);
|
|
} else if (f6 > 0.0f) {
|
|
f2 = this.videoAspectRatio;
|
|
measuredHeight = (int) (f3 / f2);
|
|
} else {
|
|
f = this.videoAspectRatio;
|
|
measuredWidth = (int) (f4 * f);
|
|
}
|
|
this.aspectRatioUpdateDispatcher.scheduleUpdate(this.videoAspectRatio, f5, true);
|
|
super.onMeasure(View.MeasureSpec.makeMeasureSpec(measuredWidth, 1073741824), View.MeasureSpec.makeMeasureSpec(measuredHeight, 1073741824));
|
|
}
|
|
|
|
public final class AspectRatioUpdateDispatcher implements Runnable {
|
|
public boolean aspectRatioMismatch;
|
|
public boolean isScheduled;
|
|
public float naturalAspectRatio;
|
|
public float targetAspectRatio;
|
|
|
|
public AspectRatioUpdateDispatcher() {
|
|
}
|
|
|
|
public void scheduleUpdate(float f, float f2, boolean z) {
|
|
this.targetAspectRatio = f;
|
|
this.naturalAspectRatio = f2;
|
|
this.aspectRatioMismatch = z;
|
|
if (this.isScheduled) {
|
|
return;
|
|
}
|
|
this.isScheduled = true;
|
|
AspectRatioFrameLayout.this.post(this);
|
|
}
|
|
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
this.isScheduled = false;
|
|
AspectRatioFrameLayout.access$100(AspectRatioFrameLayout.this);
|
|
}
|
|
}
|
|
}
|