package com.applovin.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; import com.applovin.sdk.R; /* loaded from: classes.dex */ public final class AspectRatioFrameLayout extends FrameLayout { private final c a; private float b; private int c; public interface b { } public final class c implements Runnable { private float a; private float b; private boolean c; private boolean d; private c() { } @Override // java.lang.Runnable public void run() { this.d = false; AspectRatioFrameLayout.a(AspectRatioFrameLayout.this); } public void a(float f, float f2, boolean z) { this.a = f; this.b = f2; this.c = z; if (this.d) { return; } this.d = true; AspectRatioFrameLayout.this.post(this); } } public AspectRatioFrameLayout(Context context) { this(context, null); } public static /* synthetic */ b a(AspectRatioFrameLayout aspectRatioFrameLayout) { aspectRatioFrameLayout.getClass(); return null; } public int getResizeMode() { return this.c; } @Override // android.widget.FrameLayout, android.view.View public void onMeasure(int i, int i2) { float f; float f2; super.onMeasure(i, i2); if (this.b <= 0.0f) { return; } int measuredWidth = getMeasuredWidth(); int measuredHeight = getMeasuredHeight(); float f3 = measuredWidth; float f4 = measuredHeight; float f5 = f3 / f4; float f6 = (this.b / f5) - 1.0f; if (Math.abs(f6) <= 0.01f) { this.a.a(this.b, f5, false); return; } int i3 = this.c; if (i3 != 0) { if (i3 != 1) { if (i3 == 2) { f = this.b; } else if (i3 == 4) { if (f6 > 0.0f) { f = this.b; } else { f2 = this.b; } } measuredWidth = (int) (f4 * f); } else { f2 = this.b; } measuredHeight = (int) (f3 / f2); } else if (f6 > 0.0f) { f2 = this.b; measuredHeight = (int) (f3 / f2); } else { f = this.b; measuredWidth = (int) (f4 * f); } this.a.a(this.b, f5, true); super.onMeasure(View.MeasureSpec.makeMeasureSpec(measuredWidth, 1073741824), View.MeasureSpec.makeMeasureSpec(measuredHeight, 1073741824)); } public void setAspectRatioListener(@Nullable b bVar) { } public AspectRatioFrameLayout(Context context, @Nullable AttributeSet attributeSet) { super(context, attributeSet); this.c = 0; if (attributeSet != null) { TypedArray obtainStyledAttributes = context.getTheme().obtainStyledAttributes(attributeSet, R.styleable.AppLovinAspectRatioFrameLayout, 0, 0); try { this.c = obtainStyledAttributes.getInt(R.styleable.AppLovinAspectRatioFrameLayout_al_resize_mode, 0); } finally { obtainStyledAttributes.recycle(); } } this.a = new c(); } public void setAspectRatio(float f) { if (this.b != f) { this.b = f; requestLayout(); } } public void setResizeMode(int i) { if (this.c != i) { this.c = i; requestLayout(); } } }