package androidx.appcompat.widget;

import X6FRs_4.IMuAHx_6.EuDEkJe_12.ZzDuCHW_20;
import android.content.Context;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.util.TypedValue;
import android.view.View;
import android.widget.FrameLayout;
/* loaded from: classes.dex */
public class ContentFrameLayout extends FrameLayout {

    /* renamed from: IFxWkV_5  reason: collision with root package name */
    public TypedValue f3465IFxWkV_5;
    public final Rect KQgRr5e_0;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public TypedValue f2068KQgRr5e_0;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public KQgRr5e_0 f2069KQgRr5e_0;

    /* renamed from: Mqv2r_3  reason: collision with root package name */
    public TypedValue f3466Mqv2r_3;
    public TypedValue PGPF6hQ_2;
    public TypedValue QxJ9d_1;

    /* renamed from: X6FRs_4  reason: collision with root package name */
    public TypedValue f3467X6FRs_4;

    /* loaded from: classes.dex */
    public interface KQgRr5e_0 {
        void KQgRr5e_0();

        void onDetachedFromWindow();
    }

    public ContentFrameLayout(Context context) {
        this(context, null);
    }

    public void KQgRr5e_0(Rect rect) {
        fitSystemWindows(rect);
    }

    public TypedValue getFixedHeightMajor() {
        if (this.f3467X6FRs_4 == null) {
            this.f3467X6FRs_4 = new TypedValue();
        }
        return this.f3467X6FRs_4;
    }

    public TypedValue getFixedHeightMinor() {
        if (this.f3465IFxWkV_5 == null) {
            this.f3465IFxWkV_5 = new TypedValue();
        }
        return this.f3465IFxWkV_5;
    }

    public TypedValue getFixedWidthMajor() {
        if (this.PGPF6hQ_2 == null) {
            this.PGPF6hQ_2 = new TypedValue();
        }
        return this.PGPF6hQ_2;
    }

    public TypedValue getFixedWidthMinor() {
        if (this.f3466Mqv2r_3 == null) {
            this.f3466Mqv2r_3 = new TypedValue();
        }
        return this.f3466Mqv2r_3;
    }

    public TypedValue getMinWidthMajor() {
        if (this.f2068KQgRr5e_0 == null) {
            this.f2068KQgRr5e_0 = new TypedValue();
        }
        return this.f2068KQgRr5e_0;
    }

    public TypedValue getMinWidthMinor() {
        if (this.QxJ9d_1 == null) {
            this.QxJ9d_1 = new TypedValue();
        }
        return this.QxJ9d_1;
    }

    @Override // android.view.ViewGroup, android.view.View
    public void onAttachedToWindow() {
        super.onAttachedToWindow();
        KQgRr5e_0 kQgRr5e_0 = this.f2069KQgRr5e_0;
        if (kQgRr5e_0 != null) {
            kQgRr5e_0.KQgRr5e_0();
        }
    }

    @Override // android.view.ViewGroup, android.view.View
    public void onDetachedFromWindow() {
        super.onDetachedFromWindow();
        KQgRr5e_0 kQgRr5e_0 = this.f2069KQgRr5e_0;
        if (kQgRr5e_0 != null) {
            kQgRr5e_0.onDetachedFromWindow();
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:21:0x004a  */
    /* JADX WARN: Removed duplicated region for block: B:24:0x0063  */
    /* JADX WARN: Removed duplicated region for block: B:37:0x0086  */
    /* JADX WARN: Removed duplicated region for block: B:42:0x00ab  */
    /* JADX WARN: Removed duplicated region for block: B:43:0x00ae  */
    /* JADX WARN: Removed duplicated region for block: B:48:0x00b8  */
    /* JADX WARN: Removed duplicated region for block: B:50:0x00be  */
    /* JADX WARN: Removed duplicated region for block: B:54:0x00cc  */
    /* JADX WARN: Removed duplicated region for block: B:56:0x00d6  */
    /* JADX WARN: Removed duplicated region for block: B:59:0x00de  */
    /* JADX WARN: Removed duplicated region for block: B:61:? A[RETURN, SYNTHETIC] */
    @Override // android.widget.FrameLayout, android.view.View
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public void onMeasure(int i, int i2) {
        boolean z;
        int measuredWidth;
        TypedValue typedValue;
        int i3;
        int i4;
        float fraction;
        int i5;
        int i6;
        float fraction2;
        int i7;
        int i8;
        float fraction3;
        DisplayMetrics displayMetrics = getContext().getResources().getDisplayMetrics();
        boolean z2 = true;
        boolean z3 = displayMetrics.widthPixels < displayMetrics.heightPixels;
        int mode = View.MeasureSpec.getMode(i);
        int mode2 = View.MeasureSpec.getMode(i2);
        if (mode == Integer.MIN_VALUE) {
            TypedValue typedValue2 = z3 ? this.f3466Mqv2r_3 : this.PGPF6hQ_2;
            if (typedValue2 != null && (i7 = typedValue2.type) != 0) {
                if (i7 == 5) {
                    fraction3 = typedValue2.getDimension(displayMetrics);
                } else if (i7 == 6) {
                    int i9 = displayMetrics.widthPixels;
                    fraction3 = typedValue2.getFraction(i9, i9);
                } else {
                    i8 = 0;
                    if (i8 > 0) {
                        Rect rect = this.KQgRr5e_0;
                        i = View.MeasureSpec.makeMeasureSpec(Math.min(i8 - (rect.left + rect.right), View.MeasureSpec.getSize(i)), 1073741824);
                        z = true;
                        if (mode2 == Integer.MIN_VALUE) {
                            TypedValue typedValue3 = z3 ? this.f3467X6FRs_4 : this.f3465IFxWkV_5;
                            if (typedValue3 != null && (i5 = typedValue3.type) != 0) {
                                if (i5 == 5) {
                                    fraction2 = typedValue3.getDimension(displayMetrics);
                                } else if (i5 == 6) {
                                    int i10 = displayMetrics.heightPixels;
                                    fraction2 = typedValue3.getFraction(i10, i10);
                                } else {
                                    i6 = 0;
                                    if (i6 > 0) {
                                        Rect rect2 = this.KQgRr5e_0;
                                        i2 = View.MeasureSpec.makeMeasureSpec(Math.min(i6 - (rect2.top + rect2.bottom), View.MeasureSpec.getSize(i2)), 1073741824);
                                    }
                                }
                                i6 = (int) fraction2;
                                if (i6 > 0) {
                                }
                            }
                        }
                        super.onMeasure(i, i2);
                        measuredWidth = getMeasuredWidth();
                        int makeMeasureSpec = View.MeasureSpec.makeMeasureSpec(measuredWidth, 1073741824);
                        if (!z && mode == Integer.MIN_VALUE) {
                            typedValue = !z3 ? this.QxJ9d_1 : this.f2068KQgRr5e_0;
                            if (typedValue != null && (i3 = typedValue.type) != 0) {
                                if (i3 != 5) {
                                    fraction = typedValue.getDimension(displayMetrics);
                                } else if (i3 == 6) {
                                    int i11 = displayMetrics.widthPixels;
                                    fraction = typedValue.getFraction(i11, i11);
                                } else {
                                    i4 = 0;
                                    if (i4 > 0) {
                                        Rect rect3 = this.KQgRr5e_0;
                                        i4 -= rect3.left + rect3.right;
                                    }
                                    if (measuredWidth < i4) {
                                        makeMeasureSpec = View.MeasureSpec.makeMeasureSpec(i4, 1073741824);
                                        if (z2) {
                                            super.onMeasure(makeMeasureSpec, i2);
                                            return;
                                        }
                                        return;
                                    }
                                }
                                i4 = (int) fraction;
                                if (i4 > 0) {
                                }
                                if (measuredWidth < i4) {
                                }
                            }
                        }
                        z2 = false;
                        if (z2) {
                        }
                    }
                }
                i8 = (int) fraction3;
                if (i8 > 0) {
                }
            }
        }
        z = false;
        if (mode2 == Integer.MIN_VALUE) {
        }
        super.onMeasure(i, i2);
        measuredWidth = getMeasuredWidth();
        int makeMeasureSpec2 = View.MeasureSpec.makeMeasureSpec(measuredWidth, 1073741824);
        if (!z) {
            if (!z3) {
            }
            if (typedValue != null) {
                if (i3 != 5) {
                }
                i4 = (int) fraction;
                if (i4 > 0) {
                }
                if (measuredWidth < i4) {
                }
            }
        }
        z2 = false;
        if (z2) {
        }
    }

    public void setAttachListener(KQgRr5e_0 kQgRr5e_0) {
        this.f2069KQgRr5e_0 = kQgRr5e_0;
    }

    public ContentFrameLayout(Context context, AttributeSet attributeSet) {
        this(context, attributeSet, 0);
    }

    public void KQgRr5e_0(int i, int i2, int i3, int i4) {
        this.KQgRr5e_0.set(i, i2, i3, i4);
        if (ZzDuCHW_20.m248FSaI4_7((View) this)) {
            requestLayout();
        }
    }

    public ContentFrameLayout(Context context, AttributeSet attributeSet, int i) {
        super(context, attributeSet, i);
        this.KQgRr5e_0 = new Rect();
    }
}
