package androidx.appcompat.widget;

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;
import defpackage.C0471;
import defpackage.C1992;
import defpackage.C3844;
import defpackage.C5536;
import defpackage.InterfaceC4706;
import defpackage.LayoutInflaterFactory2C5168;
import defpackage.MenuC3271;

/* JADX INFO: loaded from: classes3.dex */
public class ContentFrameLayout extends FrameLayout {

    /* JADX INFO: renamed from: ˈᵲᵢ, reason: contains not printable characters */
    public final Rect f157;

    /* JADX INFO: renamed from: ˌᴵ, reason: contains not printable characters */
    public TypedValue f158;

    /* JADX INFO: renamed from: ˌᵨʠᵫ, reason: contains not printable characters */
    public InterfaceC4706 f159;

    /* JADX INFO: renamed from: ᵔᵖᵹᵫ, reason: contains not printable characters */
    public TypedValue f160;

    /* JADX INFO: renamed from: ᵜᵪʾ, reason: contains not printable characters */
    public TypedValue f161;

    /* JADX INFO: renamed from: ᵨᵼⁱ, reason: contains not printable characters */
    public TypedValue f162;

    /* JADX INFO: renamed from: ᵯᵷʽ, reason: contains not printable characters */
    public TypedValue f163;

    /* JADX INFO: renamed from: ᵶˇᵱ, reason: contains not printable characters */
    public TypedValue f164;

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

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

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

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

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

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

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

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

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

    @Override // android.view.ViewGroup, android.view.View
    public final void onAttachedToWindow() {
        super.onAttachedToWindow();
        InterfaceC4706 interfaceC4706 = this.f159;
        if (interfaceC4706 != null) {
            interfaceC4706.getClass();
        }
    }

    @Override // android.view.ViewGroup, android.view.View
    public final void onDetachedFromWindow() {
        C1992 c1992;
        super.onDetachedFromWindow();
        ᵧᵙᵤ r2 = this.f159;
        if (r2 != null) {
            LayoutInflaterFactory2C5168 layoutInflaterFactory2C5168 = (LayoutInflaterFactory2C5168) r2.ᵜᵪʾ;
            ActionBarOverlayLayout actionBarOverlayLayout = layoutInflaterFactory2C5168.f19432;
            if (actionBarOverlayLayout != null) {
                actionBarOverlayLayout.m25();
                ActionMenuView actionMenuView = ((C3844) actionBarOverlayLayout.f136).f14670.f230;
                if (actionMenuView != null && (c1992 = actionMenuView.f146) != null) {
                    c1992.m5372();
                    C5536 c5536 = c1992.f7889;
                    if (c5536 != null && c5536.m5936()) {
                        c5536.f9081.dismiss();
                    }
                }
            }
            if (layoutInflaterFactory2C5168.f19428 != null) {
                layoutInflaterFactory2C5168.f19451.getDecorView().removeCallbacks(layoutInflaterFactory2C5168.f19456);
                if (layoutInflaterFactory2C5168.f19428.isShowing()) {
                    try {
                        layoutInflaterFactory2C5168.f19428.dismiss();
                    } catch (IllegalArgumentException unused) {
                    }
                }
                layoutInflaterFactory2C5168.f19428 = null;
            }
            C0471 c0471 = layoutInflaterFactory2C5168.f19449;
            if (c0471 != null) {
                c0471.m1929();
            }
            MenuC3271 menuC3271 = layoutInflaterFactory2C5168.m10679(0).f7608;
            if (menuC3271 != null) {
                menuC3271.m7500(true);
            }
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:21:0x004e  */
    /* JADX WARN: Removed duplicated region for block: B:22:0x0062  */
    /* JADX WARN: Removed duplicated region for block: B:37:0x008a  */
    /* JADX WARN: Removed duplicated region for block: B:38:0x009d  */
    /* JADX WARN: Removed duplicated region for block: B:55:0x00d1  */
    /* JADX WARN: Removed duplicated region for block: B:57:0x00d9  */
    /* JADX WARN: Removed duplicated region for block: B:58:0x00de  */
    @Override // android.widget.FrameLayout, android.view.View
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final void onMeasure(int i, int i2) {
        int iMakeMeasureSpec;
        boolean z;
        int iMakeMeasureSpec2;
        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);
        Rect rect = this.f157;
        if (mode != Integer.MIN_VALUE) {
            iMakeMeasureSpec = i;
            z = false;
        } else {
            TypedValue typedValue = z3 ? this.f162 : this.f160;
            if (typedValue != null && (i7 = typedValue.type) != 0) {
                if (i7 == 5) {
                    fraction3 = typedValue.getDimension(displayMetrics);
                } else if (i7 == 6) {
                    int i9 = displayMetrics.widthPixels;
                    fraction3 = typedValue.getFraction(i9, i9);
                } else {
                    i8 = 0;
                    if (i8 <= 0) {
                        iMakeMeasureSpec = View.MeasureSpec.makeMeasureSpec(Math.min(i8 - (rect.left + rect.right), View.MeasureSpec.getSize(i)), 1073741824);
                        z = true;
                    }
                }
                i8 = (int) fraction3;
                if (i8 <= 0) {
                }
            }
        }
        if (mode2 != Integer.MIN_VALUE) {
            iMakeMeasureSpec2 = i2;
        } else {
            TypedValue typedValue2 = z3 ? this.f163 : this.f164;
            if (typedValue2 != null && (i5 = typedValue2.type) != 0) {
                if (i5 == 5) {
                    fraction2 = typedValue2.getDimension(displayMetrics);
                } else if (i5 == 6) {
                    int i10 = displayMetrics.heightPixels;
                    fraction2 = typedValue2.getFraction(i10, i10);
                } else {
                    i6 = 0;
                    if (i6 <= 0) {
                        iMakeMeasureSpec2 = View.MeasureSpec.makeMeasureSpec(Math.min(i6 - (rect.top + rect.bottom), View.MeasureSpec.getSize(i2)), 1073741824);
                    }
                }
                i6 = (int) fraction2;
                if (i6 <= 0) {
                }
            }
        }
        super.onMeasure(iMakeMeasureSpec, iMakeMeasureSpec2);
        int measuredWidth = getMeasuredWidth();
        int iMakeMeasureSpec3 = View.MeasureSpec.makeMeasureSpec(measuredWidth, 1073741824);
        if (z || mode != Integer.MIN_VALUE) {
            z2 = false;
        } else {
            TypedValue typedValue3 = z3 ? this.f161 : this.f158;
            if (typedValue3 != null && (i3 = typedValue3.type) != 0) {
                if (i3 == 5) {
                    fraction = typedValue3.getDimension(displayMetrics);
                } else if (i3 == 6) {
                    int i11 = displayMetrics.widthPixels;
                    fraction = typedValue3.getFraction(i11, i11);
                } else {
                    i4 = 0;
                    if (i4 > 0) {
                        i4 -= rect.left + rect.right;
                    }
                    if (measuredWidth >= i4) {
                        iMakeMeasureSpec3 = View.MeasureSpec.makeMeasureSpec(i4, 1073741824);
                    }
                }
                i4 = (int) fraction;
                if (i4 > 0) {
                }
                if (measuredWidth >= i4) {
                }
            }
        }
        if (z2) {
            super.onMeasure(iMakeMeasureSpec3, iMakeMeasureSpec2);
        }
    }

    public void setAttachListener(InterfaceC4706 interfaceC4706) {
        this.f159 = interfaceC4706;
    }
}
