package androidx.appcompat.widget;

import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Parcelable;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.ContextThemeWrapper;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import android.window.OnBackInvokedDispatcher;
import ar.tvplayer.tv.R;
import defpackage.AbstractC0542;
import defpackage.AbstractC2335;
import defpackage.AbstractC2777;
import defpackage.AbstractC2873;
import defpackage.C0062;
import defpackage.C0270;
import defpackage.C0368;
import defpackage.C0629;
import defpackage.C0998;
import defpackage.C1065;
import defpackage.C1223;
import defpackage.C1570;
import defpackage.C2292;
import defpackage.C2652;
import defpackage.C3169;
import defpackage.C4012;
import defpackage.C4436;
import defpackage.InterfaceC0105;
import defpackage.InterfaceC0986;
import defpackage.MenuC2418;
import defpackage.RunnableC1993;
import defpackage.RunnableC2802;
import defpackage.ViewOnClickListenerC3023;
import defpackage.ViewOnClickListenerC4018;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.concurrent.CopyOnWriteArrayList;

/* loaded from: classes3.dex */
public class Toolbar extends ViewGroup {

    /* renamed from: ʾᵻᵭٴ, reason: contains not printable characters */
    public C1065 f213;

    /* renamed from: ˀˁᵨ, reason: contains not printable characters */
    public final int[] f214;

    /* renamed from: ˀᵗᵝᵭ, reason: contains not printable characters */
    public final CharSequence f215;

    /* renamed from: ˀᵗᵩ, reason: contains not printable characters */
    public int f216;

    /* renamed from: ˁˑᵰ, reason: contains not printable characters */
    public int f217;

    /* renamed from: ˆᵴᵜˏ, reason: contains not printable characters */
    public C1223 f218;

    /* renamed from: ˆᵼᵷˊ, reason: contains not printable characters */
    public final int f219;

    /* renamed from: ˊʽˎ, reason: contains not printable characters */
    public boolean f220;

    /* renamed from: ˊʾˊ, reason: contains not printable characters */
    public final ᵧˉʙ f221;

    /* renamed from: ˊᵸˊ, reason: contains not printable characters */
    public int f222;

    /* renamed from: ˌᵪ, reason: contains not printable characters */
    public CharSequence f223;

    /* renamed from: ˌᵹᵨˑ, reason: contains not printable characters */
    public final ˊʘ f224;

    /* renamed from: ˎˑː, reason: contains not printable characters */
    public Context f225;

    /* renamed from: ˎᵬˀ, reason: contains not printable characters */
    public boolean f226;

    /* renamed from: ˑᵝﹳᵜ, reason: contains not printable characters */
    public C4012 f227;

    /* renamed from: ˑᵥˁ, reason: contains not printable characters */
    public View f228;

    /* renamed from: ᐧﾞ, reason: contains not printable characters */
    public final int f229;

    /* renamed from: ᵙᵢᵨᵳ, reason: contains not printable characters */
    public int f230;

    /* renamed from: ᵛˈᵤ, reason: contains not printable characters */
    public CharSequence f231;

    /* renamed from: ᵠᵿː, reason: contains not printable characters */
    public C0062 f232;

    /* renamed from: ᵡˎ, reason: contains not printable characters */
    public C2292 f233;

    /* renamed from: ᵡᵘˎʽ, reason: contains not printable characters */
    public int f234;

    /* renamed from: ᵡᵶᵡ, reason: contains not printable characters */
    public ColorStateList f235;

    /* renamed from: ᵡⁱᵥ, reason: contains not printable characters */
    public final Drawable f236;

    /* renamed from: ᵢˇᵭ, reason: contains not printable characters */
    public C0998 f237;

    /* renamed from: ᵣᵟᵔ, reason: contains not printable characters */
    public boolean f238;

    /* renamed from: ᵤᵙᵷ, reason: contains not printable characters */
    public AppCompatImageView f239;

    /* renamed from: ᵤᵼˑʠ, reason: contains not printable characters */
    public boolean f240;

    /* renamed from: ᵥʩᵩˑ, reason: contains not printable characters */
    public final RunnableC2802 f241;

    /* renamed from: ᵧـˌᵎ, reason: contains not printable characters */
    public int f242;

    /* renamed from: ᵧᵾˀˈ, reason: contains not printable characters */
    public ActionMenuView f243;

    /* renamed from: ᵫᵮʾ, reason: contains not printable characters */
    public final ArrayList f244;

    /* renamed from: ᵮᵠـˌ, reason: contains not printable characters */
    public int f245;

    /* renamed from: ᵳᵹᵺˋ, reason: contains not printable characters */
    public ColorStateList f246;

    /* renamed from: ᵶʔᵢˊ, reason: contains not printable characters */
    public final int f247;

    /* renamed from: ᵷᵱ, reason: contains not printable characters */
    public ArrayList f248;

    /* renamed from: ᵺʙ, reason: contains not printable characters */
    public int f249;

    /* renamed from: ᵺᵠ, reason: contains not printable characters */
    public C4436 f250;

    /* renamed from: ᵽʛ, reason: contains not printable characters */
    public final ArrayList f251;

    /* renamed from: ᵾᵬ, reason: contains not printable characters */
    public C2292 f252;

    /* renamed from: ᵿʗᵝʽ, reason: contains not printable characters */
    public C0998 f253;

    /* renamed from: ﹶـ, reason: contains not printable characters */
    public OnBackInvokedDispatcher f254;

    /* renamed from: ﾞⁱ, reason: contains not printable characters */
    public int f255;

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

    public Toolbar(Context context, AttributeSet attributeSet) {
        this(context, attributeSet, R.attr._11_res_0x7f0406ae);
    }

    public Toolbar(Context context, AttributeSet attributeSet, int i) {
        super(context, attributeSet, i);
        this.f219 = 8388627;
        this.f244 = new ArrayList();
        this.f251 = new ArrayList();
        this.f214 = new int[2];
        this.f221 = new ᵧˉʙ(new RunnableC1993(this, 1));
        this.f248 = new ArrayList();
        this.f224 = new ˊʘ(25, this);
        this.f241 = new RunnableC2802(26, this);
        Context context2 = getContext();
        int[] iArr = AbstractC0542.f2829;
        C1570 c1570M4541 = C1570.m4541(context2, attributeSet, iArr, i);
        AbstractC2873.m7025(this, context, iArr, attributeSet, (TypedArray) c1570M4541.f6230, i);
        TypedArray typedArray = (TypedArray) c1570M4541.f6230;
        this.f242 = typedArray.getResourceId(28, 0);
        this.f249 = typedArray.getResourceId(19, 0);
        this.f219 = typedArray.getInteger(0, 8388627);
        this.f229 = typedArray.getInteger(2, 48);
        int dimensionPixelOffset = typedArray.getDimensionPixelOffset(22, 0);
        dimensionPixelOffset = typedArray.hasValue(27) ? typedArray.getDimensionPixelOffset(27, dimensionPixelOffset) : dimensionPixelOffset;
        this.f234 = dimensionPixelOffset;
        this.f230 = dimensionPixelOffset;
        this.f255 = dimensionPixelOffset;
        this.f217 = dimensionPixelOffset;
        int dimensionPixelOffset2 = typedArray.getDimensionPixelOffset(25, -1);
        if (dimensionPixelOffset2 >= 0) {
            this.f217 = dimensionPixelOffset2;
        }
        int dimensionPixelOffset3 = typedArray.getDimensionPixelOffset(24, -1);
        if (dimensionPixelOffset3 >= 0) {
            this.f255 = dimensionPixelOffset3;
        }
        int dimensionPixelOffset4 = typedArray.getDimensionPixelOffset(26, -1);
        if (dimensionPixelOffset4 >= 0) {
            this.f230 = dimensionPixelOffset4;
        }
        int dimensionPixelOffset5 = typedArray.getDimensionPixelOffset(23, -1);
        if (dimensionPixelOffset5 >= 0) {
            this.f234 = dimensionPixelOffset5;
        }
        this.f247 = typedArray.getDimensionPixelSize(13, -1);
        int dimensionPixelOffset6 = typedArray.getDimensionPixelOffset(9, Integer.MIN_VALUE);
        int dimensionPixelOffset7 = typedArray.getDimensionPixelOffset(5, Integer.MIN_VALUE);
        int dimensionPixelSize = typedArray.getDimensionPixelSize(7, 0);
        int dimensionPixelSize2 = typedArray.getDimensionPixelSize(8, 0);
        m61();
        C4012 c4012 = this.f227;
        c4012.f15091 = false;
        if (dimensionPixelSize != Integer.MIN_VALUE) {
            c4012.f15085 = dimensionPixelSize;
            c4012.f15089 = dimensionPixelSize;
        }
        if (dimensionPixelSize2 != Integer.MIN_VALUE) {
            c4012.f15087 = dimensionPixelSize2;
            c4012.f15090 = dimensionPixelSize2;
        }
        if (dimensionPixelOffset6 != Integer.MIN_VALUE || dimensionPixelOffset7 != Integer.MIN_VALUE) {
            c4012.m8852(dimensionPixelOffset6, dimensionPixelOffset7);
        }
        this.f222 = typedArray.getDimensionPixelOffset(10, Integer.MIN_VALUE);
        this.f216 = typedArray.getDimensionPixelOffset(6, Integer.MIN_VALUE);
        this.f236 = c1570M4541.m4550(4);
        this.f215 = typedArray.getText(3);
        CharSequence text = typedArray.getText(21);
        if (!TextUtils.isEmpty(text)) {
            setTitle(text);
        }
        CharSequence text2 = typedArray.getText(18);
        if (!TextUtils.isEmpty(text2)) {
            setSubtitle(text2);
        }
        this.f225 = getContext();
        setPopupTheme(typedArray.getResourceId(17, 0));
        Drawable drawableM4550 = c1570M4541.m4550(16);
        if (drawableM4550 != null) {
            setNavigationIcon(drawableM4550);
        }
        CharSequence text3 = typedArray.getText(15);
        if (!TextUtils.isEmpty(text3)) {
            setNavigationContentDescription(text3);
        }
        Drawable drawableM45502 = c1570M4541.m4550(11);
        if (drawableM45502 != null) {
            setLogo(drawableM45502);
        }
        CharSequence text4 = typedArray.getText(12);
        if (!TextUtils.isEmpty(text4)) {
            setLogoDescription(text4);
        }
        if (typedArray.hasValue(29)) {
            setTitleTextColor(c1570M4541.m4549(29));
        }
        if (typedArray.hasValue(20)) {
            setSubtitleTextColor(c1570M4541.m4549(20));
        }
        if (typedArray.hasValue(14)) {
            getMenuInflater().inflate(typedArray.getResourceId(14, 0), getMenu());
        }
        c1570M4541.m4542();
    }

    private ArrayList<MenuItem> getCurrentMenuItems() {
        ArrayList<MenuItem> arrayList = new ArrayList<>();
        Menu menu = getMenu();
        for (int i = 0; i < menu.size(); i++) {
            arrayList.add(menu.getItem(i));
        }
        return arrayList;
    }

    private MenuInflater getMenuInflater() {
        return new C0368(getContext());
    }

    /* renamed from: ˌᵜᵹᵩ, reason: contains not printable characters */
    public static int m42(View view) {
        ViewGroup.MarginLayoutParams marginLayoutParams = (ViewGroup.MarginLayoutParams) view.getLayoutParams();
        return marginLayoutParams.topMargin + marginLayoutParams.bottomMargin;
    }

    /* renamed from: ᵝᵵᵺ, reason: contains not printable characters */
    public static C0629 m43(ViewGroup.LayoutParams layoutParams) {
        boolean z = layoutParams instanceof C0629;
        if (z) {
            C0629 c0629 = (C0629) layoutParams;
            C0629 c06292 = new C0629(c0629);
            c06292.f3133 = 0;
            c06292.f3133 = c0629.f3133;
            return c06292;
        }
        if (z) {
            C0629 c06293 = new C0629((C0629) layoutParams);
            c06293.f3133 = 0;
            return c06293;
        }
        if (!(layoutParams instanceof ViewGroup.MarginLayoutParams)) {
            C0629 c06294 = new C0629(layoutParams);
            c06294.f3133 = 0;
            return c06294;
        }
        ViewGroup.MarginLayoutParams marginLayoutParams = (ViewGroup.MarginLayoutParams) layoutParams;
        C0629 c06295 = new C0629(marginLayoutParams);
        c06295.f3133 = 0;
        ((ViewGroup.MarginLayoutParams) c06295).leftMargin = marginLayoutParams.leftMargin;
        ((ViewGroup.MarginLayoutParams) c06295).topMargin = marginLayoutParams.topMargin;
        ((ViewGroup.MarginLayoutParams) c06295).rightMargin = marginLayoutParams.rightMargin;
        ((ViewGroup.MarginLayoutParams) c06295).bottomMargin = marginLayoutParams.bottomMargin;
        return c06295;
    }

    /* renamed from: ᵸˑ, reason: contains not printable characters */
    public static int m44(View view) {
        ViewGroup.MarginLayoutParams marginLayoutParams = (ViewGroup.MarginLayoutParams) view.getLayoutParams();
        return marginLayoutParams.getMarginEnd() + marginLayoutParams.getMarginStart();
    }

    /* renamed from: ᵹᵝᵶ, reason: contains not printable characters */
    public static C0629 m45() {
        C0629 c0629 = new C0629(-2, -2);
        c0629.f3133 = 0;
        c0629.f3132 = 8388627;
        return c0629;
    }

    @Override // android.view.ViewGroup
    public final boolean checkLayoutParams(ViewGroup.LayoutParams layoutParams) {
        return super.checkLayoutParams(layoutParams) && (layoutParams instanceof C0629);
    }

    @Override // android.view.ViewGroup
    public final /* bridge */ /* synthetic */ ViewGroup.LayoutParams generateDefaultLayoutParams() {
        return m45();
    }

    @Override // android.view.ViewGroup
    public final ViewGroup.LayoutParams generateLayoutParams(AttributeSet attributeSet) {
        Context context = getContext();
        C0629 c0629 = new C0629(context, attributeSet);
        c0629.f3132 = 0;
        TypedArray typedArrayObtainStyledAttributes = context.obtainStyledAttributes(attributeSet, AbstractC0542.f2822);
        c0629.f3132 = typedArrayObtainStyledAttributes.getInt(0, 0);
        typedArrayObtainStyledAttributes.recycle();
        c0629.f3133 = 0;
        return c0629;
    }

    @Override // android.view.ViewGroup
    public final /* bridge */ /* synthetic */ ViewGroup.LayoutParams generateLayoutParams(ViewGroup.LayoutParams layoutParams) {
        return m43(layoutParams);
    }

    public CharSequence getCollapseContentDescription() {
        C2292 c2292 = this.f233;
        if (c2292 != null) {
            return c2292.getContentDescription();
        }
        return null;
    }

    public Drawable getCollapseIcon() {
        C2292 c2292 = this.f233;
        if (c2292 != null) {
            return c2292.getDrawable();
        }
        return null;
    }

    public int getContentInsetEnd() {
        C4012 c4012 = this.f227;
        if (c4012 != null) {
            return c4012.f15086 ? c4012.f15089 : c4012.f15090;
        }
        return 0;
    }

    public int getContentInsetEndWithActions() {
        int i = this.f216;
        return i != Integer.MIN_VALUE ? i : getContentInsetEnd();
    }

    public int getContentInsetLeft() {
        C4012 c4012 = this.f227;
        if (c4012 != null) {
            return c4012.f15089;
        }
        return 0;
    }

    public int getContentInsetRight() {
        C4012 c4012 = this.f227;
        if (c4012 != null) {
            return c4012.f15090;
        }
        return 0;
    }

    public int getContentInsetStart() {
        C4012 c4012 = this.f227;
        if (c4012 != null) {
            return c4012.f15086 ? c4012.f15090 : c4012.f15089;
        }
        return 0;
    }

    public int getContentInsetStartWithNavigation() {
        int i = this.f222;
        return i != Integer.MIN_VALUE ? i : getContentInsetStart();
    }

    public int getCurrentContentInsetEnd() {
        MenuC2418 menuC2418;
        ActionMenuView actionMenuView = this.f243;
        return (actionMenuView == null || (menuC2418 = actionMenuView.f141) == null || !menuC2418.hasVisibleItems()) ? getContentInsetEnd() : Math.max(getContentInsetEnd(), Math.max(this.f216, 0));
    }

    public int getCurrentContentInsetLeft() {
        return getLayoutDirection() == 1 ? getCurrentContentInsetEnd() : getCurrentContentInsetStart();
    }

    public int getCurrentContentInsetRight() {
        return getLayoutDirection() == 1 ? getCurrentContentInsetStart() : getCurrentContentInsetEnd();
    }

    public int getCurrentContentInsetStart() {
        return getNavigationIcon() != null ? Math.max(getContentInsetStart(), Math.max(this.f222, 0)) : getContentInsetStart();
    }

    public Drawable getLogo() {
        AppCompatImageView appCompatImageView = this.f239;
        if (appCompatImageView != null) {
            return appCompatImageView.getDrawable();
        }
        return null;
    }

    public CharSequence getLogoDescription() {
        AppCompatImageView appCompatImageView = this.f239;
        if (appCompatImageView != null) {
            return appCompatImageView.getContentDescription();
        }
        return null;
    }

    public Menu getMenu() {
        m46();
        return this.f243.getMenu();
    }

    public View getNavButtonView() {
        return this.f252;
    }

    public CharSequence getNavigationContentDescription() {
        C2292 c2292 = this.f252;
        if (c2292 != null) {
            return c2292.getContentDescription();
        }
        return null;
    }

    public Drawable getNavigationIcon() {
        C2292 c2292 = this.f252;
        if (c2292 != null) {
            return c2292.getDrawable();
        }
        return null;
    }

    public C1065 getOuterActionMenuPresenter() {
        return this.f213;
    }

    public Drawable getOverflowIcon() {
        m46();
        return this.f243.getOverflowIcon();
    }

    public Context getPopupContext() {
        return this.f225;
    }

    public int getPopupTheme() {
        return this.f245;
    }

    public CharSequence getSubtitle() {
        return this.f223;
    }

    public final TextView getSubtitleTextView() {
        return this.f253;
    }

    public CharSequence getTitle() {
        return this.f231;
    }

    public int getTitleMarginBottom() {
        return this.f234;
    }

    public int getTitleMarginEnd() {
        return this.f255;
    }

    public int getTitleMarginStart() {
        return this.f217;
    }

    public int getTitleMarginTop() {
        return this.f230;
    }

    public final TextView getTitleTextView() {
        return this.f237;
    }

    public InterfaceC0105 getWrapper() {
        Drawable drawable;
        if (this.f232 == null) {
            C0062 c0062 = new C0062();
            c0062.f1273 = 0;
            c0062.f1272 = this;
            c0062.f1279 = getTitle();
            c0062.f1271 = getSubtitle();
            c0062.f1268 = c0062.f1279 != null;
            c0062.f1269 = getNavigationIcon();
            C1570 c1570M4541 = C1570.m4541(getContext(), null, AbstractC0542.f2816, R.attr._11_res_0x7f040007);
            TypedArray typedArray = (TypedArray) c1570M4541.f6230;
            c0062.f1275 = c1570M4541.m4550(15);
            CharSequence text = typedArray.getText(27);
            if (!TextUtils.isEmpty(text)) {
                c0062.f1268 = true;
                c0062.f1279 = text;
                if ((c0062.f1276 & 8) != 0) {
                    setTitle(text);
                    if (c0062.f1268) {
                        AbstractC2873.m7018(getRootView(), text);
                    }
                }
            }
            CharSequence text2 = typedArray.getText(25);
            if (!TextUtils.isEmpty(text2)) {
                c0062.f1271 = text2;
                if ((c0062.f1276 & 8) != 0) {
                    setSubtitle(text2);
                }
            }
            Drawable drawableM4550 = c1570M4541.m4550(20);
            if (drawableM4550 != null) {
                c0062.f1266 = drawableM4550;
                c0062.m1132();
            }
            Drawable drawableM45502 = c1570M4541.m4550(17);
            if (drawableM45502 != null) {
                c0062.f1280 = drawableM45502;
                c0062.m1132();
            }
            if (c0062.f1269 == null && (drawable = c0062.f1275) != null) {
                c0062.f1269 = drawable;
                if ((c0062.f1276 & 4) != 0) {
                    setNavigationIcon(drawable);
                } else {
                    setNavigationIcon((Drawable) null);
                }
            }
            c0062.m1133(typedArray.getInt(10, 0));
            int resourceId = typedArray.getResourceId(9, 0);
            if (resourceId != 0) {
                View viewInflate = LayoutInflater.from(getContext()).inflate(resourceId, (ViewGroup) this, false);
                View view = c0062.f1270;
                if (view != null && (c0062.f1276 & 16) != 0) {
                    removeView(view);
                }
                c0062.f1270 = viewInflate;
                if (viewInflate != null && (c0062.f1276 & 16) != 0) {
                    addView(viewInflate);
                }
                c0062.m1133(c0062.f1276 | 16);
            }
            int layoutDimension = typedArray.getLayoutDimension(13, 0);
            if (layoutDimension > 0) {
                ViewGroup.LayoutParams layoutParams = getLayoutParams();
                layoutParams.height = layoutDimension;
                setLayoutParams(layoutParams);
            }
            int dimensionPixelOffset = typedArray.getDimensionPixelOffset(7, -1);
            int dimensionPixelOffset2 = typedArray.getDimensionPixelOffset(3, -1);
            if (dimensionPixelOffset >= 0 || dimensionPixelOffset2 >= 0) {
                int iMax = Math.max(dimensionPixelOffset, 0);
                int iMax2 = Math.max(dimensionPixelOffset2, 0);
                m61();
                this.f227.m8852(iMax, iMax2);
            }
            int resourceId2 = typedArray.getResourceId(28, 0);
            if (resourceId2 != 0) {
                Context context = getContext();
                this.f242 = resourceId2;
                C0998 c0998 = this.f237;
                if (c0998 != null) {
                    c0998.setTextAppearance(context, resourceId2);
                }
            }
            int resourceId3 = typedArray.getResourceId(26, 0);
            if (resourceId3 != 0) {
                Context context2 = getContext();
                this.f249 = resourceId3;
                C0998 c09982 = this.f253;
                if (c09982 != null) {
                    c09982.setTextAppearance(context2, resourceId3);
                }
            }
            int resourceId4 = typedArray.getResourceId(22, 0);
            if (resourceId4 != 0) {
                setPopupTheme(resourceId4);
            }
            c1570M4541.m4542();
            if (R.string._11_res_0x7f130001 != c0062.f1273) {
                c0062.f1273 = R.string._11_res_0x7f130001;
                if (TextUtils.isEmpty(getNavigationContentDescription())) {
                    int i = c0062.f1273;
                    c0062.f1277 = i != 0 ? getContext().getString(i) : null;
                    c0062.m1134();
                }
            }
            c0062.f1277 = getNavigationContentDescription();
            setNavigationOnClickListener(new ViewOnClickListenerC3023(c0062));
            this.f232 = c0062;
        }
        return this.f232;
    }

    @Override // android.view.ViewGroup, android.view.View
    public final void onAttachedToWindow() {
        super.onAttachedToWindow();
        m54();
    }

    @Override // android.view.ViewGroup, android.view.View
    public final void onDetachedFromWindow() {
        super.onDetachedFromWindow();
        removeCallbacks(this.f241);
        m54();
    }

    @Override // android.view.View
    public final boolean onHoverEvent(MotionEvent motionEvent) {
        int actionMasked = motionEvent.getActionMasked();
        if (actionMasked == 9) {
            this.f226 = false;
        }
        if (!this.f226) {
            boolean zOnHoverEvent = super.onHoverEvent(motionEvent);
            if (actionMasked == 9 && !zOnHoverEvent) {
                this.f226 = true;
            }
        }
        if (actionMasked != 10 && actionMasked != 3) {
            return true;
        }
        this.f226 = false;
        return true;
    }

    /* JADX WARN: Removed duplicated region for block: B:108:0x0285 A[LOOP:0: B:107:0x0283->B:108:0x0285, LOOP_END] */
    /* JADX WARN: Removed duplicated region for block: B:111:0x029d A[LOOP:1: B:110:0x029b->B:111:0x029d, LOOP_END] */
    /* JADX WARN: Removed duplicated region for block: B:114:0x02bd A[LOOP:2: B:113:0x02bb->B:114:0x02bd, LOOP_END] */
    /* JADX WARN: Removed duplicated region for block: B:118:0x0303  */
    /* JADX WARN: Removed duplicated region for block: B:123:0x0310 A[LOOP:3: B:122:0x030e->B:123:0x0310, LOOP_END] */
    /* JADX WARN: Removed duplicated region for block: B:20:0x0060  */
    /* JADX WARN: Removed duplicated region for block: B:26:0x0075  */
    /* JADX WARN: Removed duplicated region for block: B:32:0x00b0  */
    /* JADX WARN: Removed duplicated region for block: B:38:0x00c5  */
    /* JADX WARN: Removed duplicated region for block: B:44:0x00e0  */
    /* JADX WARN: Removed duplicated region for block: B:45:0x00f7  */
    /* JADX WARN: Removed duplicated region for block: B:47:0x00fc  */
    /* JADX WARN: Removed duplicated region for block: B:48:0x0115  */
    /* JADX WARN: Removed duplicated region for block: B:51:0x011b  */
    /* JADX WARN: Removed duplicated region for block: B:52:0x011d  */
    /* JADX WARN: Removed duplicated region for block: B:53:0x0120  */
    /* JADX WARN: Removed duplicated region for block: B:55:0x0124  */
    /* JADX WARN: Removed duplicated region for block: B:56:0x0127  */
    /* JADX WARN: Removed duplicated region for block: B:68:0x015a  */
    /* JADX WARN: Removed duplicated region for block: B:78:0x0193  */
    /* JADX WARN: Removed duplicated region for block: B:80:0x01a0  */
    /* JADX WARN: Removed duplicated region for block: B:93:0x020e  */
    @Override // android.view.ViewGroup, android.view.View
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public final void onLayout(boolean r20, int r21, int r22, int r23, int r24) {
        /*
            Method dump skipped, instructions count: 801
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.widget.Toolbar.onLayout(boolean, int, int, int, int):void");
    }

    /* JADX WARN: Multi-variable type inference failed */
    @Override // android.view.View
    public final void onMeasure(int i, int i2) {
        char c;
        Object[] objArr;
        int iM44;
        int iMax;
        int iCombineMeasuredStates;
        int iM442;
        int i3;
        int iM42;
        int iCombineMeasuredStates2;
        int iMax2;
        boolean z = AbstractC2335.f9156;
        int i4 = 0;
        if (getLayoutDirection() == 1) {
            objArr = true;
            c = 0;
        } else {
            c = 1;
            objArr = false;
        }
        if (m51(this.f252)) {
            m60(this.f252, i, 0, i2, this.f247);
            iM44 = m44(this.f252) + this.f252.getMeasuredWidth();
            iMax = Math.max(0, m42(this.f252) + this.f252.getMeasuredHeight());
            iCombineMeasuredStates = View.combineMeasuredStates(0, this.f252.getMeasuredState());
        } else {
            iM44 = 0;
            iMax = 0;
            iCombineMeasuredStates = 0;
        }
        if (m51(this.f233)) {
            m60(this.f233, i, 0, i2, this.f247);
            iM44 = m44(this.f233) + this.f233.getMeasuredWidth();
            iMax = Math.max(iMax, m42(this.f233) + this.f233.getMeasuredHeight());
            iCombineMeasuredStates = View.combineMeasuredStates(iCombineMeasuredStates, this.f233.getMeasuredState());
        }
        int currentContentInsetStart = getCurrentContentInsetStart();
        int iMax3 = Math.max(currentContentInsetStart, iM44);
        int iMax4 = Math.max(0, currentContentInsetStart - iM44);
        Object[] objArr2 = objArr;
        int[] iArr = this.f214;
        iArr[objArr2 == true ? 1 : 0] = iMax4;
        if (m51(this.f243)) {
            m60(this.f243, i, iMax3, i2, this.f247);
            iM442 = m44(this.f243) + this.f243.getMeasuredWidth();
            iMax = Math.max(iMax, m42(this.f243) + this.f243.getMeasuredHeight());
            iCombineMeasuredStates = View.combineMeasuredStates(iCombineMeasuredStates, this.f243.getMeasuredState());
        } else {
            iM442 = 0;
        }
        int currentContentInsetEnd = getCurrentContentInsetEnd();
        int iMax5 = iMax3 + Math.max(currentContentInsetEnd, iM442);
        iArr[c] = Math.max(0, currentContentInsetEnd - iM442);
        if (m51(this.f228)) {
            iMax5 += m52(this.f228, i, iMax5, i2, 0, iArr);
            iMax = Math.max(iMax, m42(this.f228) + this.f228.getMeasuredHeight());
            iCombineMeasuredStates = View.combineMeasuredStates(iCombineMeasuredStates, this.f228.getMeasuredState());
        }
        if (m51(this.f239)) {
            iMax5 += m52(this.f239, i, iMax5, i2, 0, iArr);
            iMax = Math.max(iMax, m42(this.f239) + this.f239.getMeasuredHeight());
            iCombineMeasuredStates = View.combineMeasuredStates(iCombineMeasuredStates, this.f239.getMeasuredState());
        }
        int childCount = getChildCount();
        for (int i5 = 0; i5 < childCount; i5++) {
            View childAt = getChildAt(i5);
            if (((C0629) childAt.getLayoutParams()).f3133 == 0 && m51(childAt)) {
                iMax5 += m52(childAt, i, iMax5, i2, 0, iArr);
                int iMax6 = Math.max(iMax, m42(childAt) + childAt.getMeasuredHeight());
                iCombineMeasuredStates = View.combineMeasuredStates(iCombineMeasuredStates, childAt.getMeasuredState());
                iMax = iMax6;
            } else {
                iMax5 = iMax5;
            }
        }
        int i6 = iMax5;
        int i7 = this.f230 + this.f234;
        int i8 = this.f217 + this.f255;
        if (m51(this.f237)) {
            m52(this.f237, i, i6 + i8, i2, i7, iArr);
            i3 = i7;
            int iM443 = m44(this.f237) + this.f237.getMeasuredWidth();
            iM42 = m42(this.f237) + this.f237.getMeasuredHeight();
            iCombineMeasuredStates2 = View.combineMeasuredStates(iCombineMeasuredStates, this.f237.getMeasuredState());
            iMax2 = iM443;
        } else {
            i3 = i7;
            iM42 = 0;
            iCombineMeasuredStates2 = iCombineMeasuredStates;
            iMax2 = 0;
        }
        if (m51(this.f253)) {
            iMax2 = Math.max(iMax2, m52(this.f253, i, i6 + i8, i2, iM42 + i3, iArr));
            iM42 += m42(this.f253) + this.f253.getMeasuredHeight();
            iCombineMeasuredStates2 = View.combineMeasuredStates(iCombineMeasuredStates2, this.f253.getMeasuredState());
        }
        if (m51(this.f237) || m51(this.f253)) {
            iM42 += i3;
        }
        int iMax7 = Math.max(iMax, iM42);
        int paddingRight = getPaddingRight() + getPaddingLeft() + i6 + iMax2;
        int paddingBottom = getPaddingBottom() + getPaddingTop() + iMax7;
        int iResolveSizeAndState = View.resolveSizeAndState(Math.max(paddingRight, getSuggestedMinimumWidth()), i, (-16777216) & iCombineMeasuredStates2);
        int iResolveSizeAndState2 = View.resolveSizeAndState(Math.max(paddingBottom, getSuggestedMinimumHeight()), i2, iCombineMeasuredStates2 << 16);
        if (!this.f240) {
            i4 = iResolveSizeAndState2;
            break;
        }
        int childCount2 = getChildCount();
        for (int i9 = 0; i9 < childCount2; i9++) {
            View childAt2 = getChildAt(i9);
            if (m51(childAt2) && childAt2.getMeasuredWidth() > 0 && childAt2.getMeasuredHeight() > 0) {
                i4 = iResolveSizeAndState2;
                break;
            }
        }
        setMeasuredDimension(iResolveSizeAndState, i4);
    }

    @Override // android.view.View
    public final void onRestoreInstanceState(Parcelable parcelable) {
        MenuItem menuItemFindItem;
        if (!(parcelable instanceof C3169)) {
            super.onRestoreInstanceState(parcelable);
            return;
        }
        C3169 c3169 = (C3169) parcelable;
        super.onRestoreInstanceState(c3169.f7157);
        ActionMenuView actionMenuView = this.f243;
        MenuC2418 menuC2418 = actionMenuView != null ? actionMenuView.f141 : null;
        int i = c3169.f12019;
        if (i != 0 && this.f250 != null && menuC2418 != null && (menuItemFindItem = menuC2418.findItem(i)) != null) {
            menuItemFindItem.expandActionView();
        }
        if (c3169.f12018) {
            RunnableC2802 runnableC2802 = this.f241;
            removeCallbacks(runnableC2802);
            post(runnableC2802);
        }
    }

    @Override // android.view.View
    public final void onRtlPropertiesChanged(int i) {
        super.onRtlPropertiesChanged(i);
        m61();
        C4012 c4012 = this.f227;
        boolean z = i == 1;
        if (z == c4012.f15086) {
            return;
        }
        c4012.f15086 = z;
        if (!c4012.f15091) {
            c4012.f15089 = c4012.f15085;
            c4012.f15090 = c4012.f15087;
            return;
        }
        if (z) {
            int i2 = c4012.f15092;
            if (i2 == Integer.MIN_VALUE) {
                i2 = c4012.f15085;
            }
            c4012.f15089 = i2;
            int i3 = c4012.f15088;
            if (i3 == Integer.MIN_VALUE) {
                i3 = c4012.f15087;
            }
            c4012.f15090 = i3;
            return;
        }
        int i4 = c4012.f15088;
        if (i4 == Integer.MIN_VALUE) {
            i4 = c4012.f15085;
        }
        c4012.f15089 = i4;
        int i5 = c4012.f15092;
        if (i5 == Integer.MIN_VALUE) {
            i5 = c4012.f15087;
        }
        c4012.f15090 = i5;
    }

    @Override // android.view.View
    public final Parcelable onSaveInstanceState() {
        C1065 c1065;
        C2652 c2652;
        C3169 c3169 = new C3169(super.onSaveInstanceState());
        C4436 c4436 = this.f250;
        if (c4436 != null && (c2652 = c4436.f16580) != null) {
            c3169.f12019 = c2652.f10278;
        }
        ActionMenuView actionMenuView = this.f243;
        c3169.f12018 = (actionMenuView == null || (c1065 = actionMenuView.f145) == null || !c1065.m3451()) ? false : true;
        return c3169;
    }

    @Override // android.view.View
    public final boolean onTouchEvent(MotionEvent motionEvent) {
        int actionMasked = motionEvent.getActionMasked();
        if (actionMasked == 0) {
            this.f220 = false;
        }
        if (!this.f220) {
            boolean zOnTouchEvent = super.onTouchEvent(motionEvent);
            if (actionMasked == 0 && !zOnTouchEvent) {
                this.f220 = true;
            }
        }
        if (actionMasked != 1 && actionMasked != 3) {
            return true;
        }
        this.f220 = false;
        return true;
    }

    public void setBackInvokedCallbackEnabled(boolean z) {
        if (this.f238 != z) {
            this.f238 = z;
            m54();
        }
    }

    public void setCollapseContentDescription(int i) {
        setCollapseContentDescription(i != 0 ? getContext().getText(i) : null);
    }

    public void setCollapseContentDescription(CharSequence charSequence) {
        if (!TextUtils.isEmpty(charSequence)) {
            m50();
        }
        C2292 c2292 = this.f233;
        if (c2292 != null) {
            c2292.setContentDescription(charSequence);
        }
    }

    public void setCollapseIcon(int i) {
        setCollapseIcon(ᵕˏᵛ.ˑᵥˁ(getContext(), i));
    }

    public void setCollapseIcon(Drawable drawable) {
        if (drawable != null) {
            m50();
            this.f233.setImageDrawable(drawable);
        } else {
            C2292 c2292 = this.f233;
            if (c2292 != null) {
                c2292.setImageDrawable(this.f236);
            }
        }
    }

    public void setCollapsible(boolean z) {
        this.f240 = z;
        requestLayout();
    }

    public void setContentInsetEndWithActions(int i) {
        if (i < 0) {
            i = Integer.MIN_VALUE;
        }
        if (i != this.f216) {
            this.f216 = i;
            if (getNavigationIcon() != null) {
                requestLayout();
            }
        }
    }

    public void setContentInsetStartWithNavigation(int i) {
        if (i < 0) {
            i = Integer.MIN_VALUE;
        }
        if (i != this.f222) {
            this.f222 = i;
            if (getNavigationIcon() != null) {
                requestLayout();
            }
        }
    }

    public void setLogo(int i) {
        setLogo(ᵕˏᵛ.ˑᵥˁ(getContext(), i));
    }

    public void setLogo(Drawable drawable) {
        AppCompatImageView appCompatImageView = this.f239;
        if (drawable != null) {
            if (appCompatImageView == null) {
                this.f239 = new AppCompatImageView(getContext());
            }
            if (!m55(this.f239)) {
                m58(this.f239, true);
            }
        } else if (appCompatImageView != null && m55(appCompatImageView)) {
            removeView(this.f239);
            this.f251.remove(this.f239);
        }
        AppCompatImageView appCompatImageView2 = this.f239;
        if (appCompatImageView2 != null) {
            appCompatImageView2.setImageDrawable(drawable);
        }
    }

    public void setLogoDescription(int i) {
        setLogoDescription(getContext().getText(i));
    }

    public void setLogoDescription(CharSequence charSequence) {
        if (!TextUtils.isEmpty(charSequence) && this.f239 == null) {
            this.f239 = new AppCompatImageView(getContext());
        }
        AppCompatImageView appCompatImageView = this.f239;
        if (appCompatImageView != null) {
            appCompatImageView.setContentDescription(charSequence);
        }
    }

    public void setNavigationContentDescription(int i) {
        setNavigationContentDescription(i != 0 ? getContext().getText(i) : null);
    }

    public void setNavigationContentDescription(CharSequence charSequence) {
        if (!TextUtils.isEmpty(charSequence)) {
            m48();
        }
        C2292 c2292 = this.f252;
        if (c2292 != null) {
            c2292.setContentDescription(charSequence);
            ᵙᵛᵯ.ᵧـˌᵎ(this.f252, charSequence);
        }
    }

    public void setNavigationIcon(int i) {
        setNavigationIcon(ᵕˏᵛ.ˑᵥˁ(getContext(), i));
    }

    public void setNavigationIcon(Drawable drawable) {
        if (drawable != null) {
            m48();
            if (!m55(this.f252)) {
                m58(this.f252, true);
            }
        } else {
            C2292 c2292 = this.f252;
            if (c2292 != null && m55(c2292)) {
                removeView(this.f252);
                this.f251.remove(this.f252);
            }
        }
        C2292 c22922 = this.f252;
        if (c22922 != null) {
            c22922.setImageDrawable(drawable);
        }
    }

    public void setNavigationOnClickListener(View.OnClickListener onClickListener) {
        m48();
        this.f252.setOnClickListener(onClickListener);
    }

    public void setOnMenuItemClickListener(InterfaceC0986 interfaceC0986) {
    }

    public void setOverflowIcon(Drawable drawable) {
        m46();
        this.f243.setOverflowIcon(drawable);
    }

    public void setPopupTheme(int i) {
        if (this.f245 != i) {
            this.f245 = i;
            if (i == 0) {
                this.f225 = getContext();
            } else {
                this.f225 = new ContextThemeWrapper(getContext(), i);
            }
        }
    }

    public void setSubtitle(int i) {
        setSubtitle(getContext().getText(i));
    }

    public void setSubtitle(CharSequence charSequence) {
        boolean zIsEmpty = TextUtils.isEmpty(charSequence);
        C0998 c0998 = this.f253;
        if (!zIsEmpty) {
            if (c0998 == null) {
                Context context = getContext();
                C0998 c09982 = new C0998(context, null);
                this.f253 = c09982;
                c09982.setSingleLine();
                this.f253.setEllipsize(TextUtils.TruncateAt.END);
                int i = this.f249;
                if (i != 0) {
                    this.f253.setTextAppearance(context, i);
                }
                ColorStateList colorStateList = this.f235;
                if (colorStateList != null) {
                    this.f253.setTextColor(colorStateList);
                }
            }
            if (!m55(this.f253)) {
                m58(this.f253, true);
            }
        } else if (c0998 != null && m55(c0998)) {
            removeView(this.f253);
            this.f251.remove(this.f253);
        }
        C0998 c09983 = this.f253;
        if (c09983 != null) {
            c09983.setText(charSequence);
        }
        this.f223 = charSequence;
    }

    public void setSubtitleTextColor(int i) {
        setSubtitleTextColor(ColorStateList.valueOf(i));
    }

    public void setSubtitleTextColor(ColorStateList colorStateList) {
        this.f235 = colorStateList;
        C0998 c0998 = this.f253;
        if (c0998 != null) {
            c0998.setTextColor(colorStateList);
        }
    }

    public void setTitle(int i) {
        setTitle(getContext().getText(i));
    }

    public void setTitle(CharSequence charSequence) {
        boolean zIsEmpty = TextUtils.isEmpty(charSequence);
        C0998 c0998 = this.f237;
        if (!zIsEmpty) {
            if (c0998 == null) {
                Context context = getContext();
                C0998 c09982 = new C0998(context, null);
                this.f237 = c09982;
                c09982.setSingleLine();
                this.f237.setEllipsize(TextUtils.TruncateAt.END);
                int i = this.f242;
                if (i != 0) {
                    this.f237.setTextAppearance(context, i);
                }
                ColorStateList colorStateList = this.f246;
                if (colorStateList != null) {
                    this.f237.setTextColor(colorStateList);
                }
            }
            if (!m55(this.f237)) {
                m58(this.f237, true);
            }
        } else if (c0998 != null && m55(c0998)) {
            removeView(this.f237);
            this.f251.remove(this.f237);
        }
        C0998 c09983 = this.f237;
        if (c09983 != null) {
            c09983.setText(charSequence);
        }
        this.f231 = charSequence;
    }

    public void setTitleMarginBottom(int i) {
        this.f234 = i;
        requestLayout();
    }

    public void setTitleMarginEnd(int i) {
        this.f255 = i;
        requestLayout();
    }

    public void setTitleMarginStart(int i) {
        this.f217 = i;
        requestLayout();
    }

    public void setTitleMarginTop(int i) {
        this.f230 = i;
        requestLayout();
    }

    public void setTitleTextColor(int i) {
        setTitleTextColor(ColorStateList.valueOf(i));
    }

    public void setTitleTextColor(ColorStateList colorStateList) {
        this.f246 = colorStateList;
        C0998 c0998 = this.f237;
        if (c0998 != null) {
            c0998.setTextColor(colorStateList);
        }
    }

    /* renamed from: ˇʼʤˎ, reason: contains not printable characters */
    public final void m46() {
        m49();
        ActionMenuView actionMenuView = this.f243;
        if (actionMenuView.f141 == null) {
            MenuC2418 menuC2418 = (MenuC2418) actionMenuView.getMenu();
            if (this.f250 == null) {
                this.f250 = new C4436(this);
            }
            this.f243.setExpandedActionViewsExclusive(true);
            menuC2418.m6194(this.f250, this.f225);
            m54();
        }
    }

    /* renamed from: ˌʾˀ, reason: contains not printable characters */
    public final int m47(View view, int i, int i2, int[] iArr) {
        C0629 c0629 = (C0629) view.getLayoutParams();
        int i3 = ((ViewGroup.MarginLayoutParams) c0629).rightMargin - iArr[1];
        int iMax = i - Math.max(0, i3);
        iArr[1] = Math.max(0, -i3);
        int iM59 = m59(view, i2);
        int measuredWidth = view.getMeasuredWidth();
        view.layout(iMax - measuredWidth, iM59, iMax, view.getMeasuredHeight() + iM59);
        return iMax - (measuredWidth + ((ViewGroup.MarginLayoutParams) c0629).leftMargin);
    }

    /* renamed from: ˎˏʜʾ, reason: contains not printable characters */
    public final void m48() {
        if (this.f252 == null) {
            this.f252 = new C2292(getContext(), null, R.attr._11_res_0x7f0406ad);
            C0629 c0629M45 = m45();
            c0629M45.f3132 = (this.f229 & 112) | 8388611;
            this.f252.setLayoutParams(c0629M45);
        }
    }

    /* renamed from: ˏˋٴ, reason: contains not printable characters */
    public final void m49() {
        if (this.f243 == null) {
            ActionMenuView actionMenuView = new ActionMenuView(getContext());
            this.f243 = actionMenuView;
            actionMenuView.setPopupTheme(this.f245);
            this.f243.setOnMenuItemClickListener(this.f224);
            ActionMenuView actionMenuView2 = this.f243;
            ˑᵽʾʦ r1 = new ˑᵽʾʦ(29, this);
            actionMenuView2.getClass();
            actionMenuView2.f143 = r1;
            C0629 c0629M45 = m45();
            c0629M45.f3132 = (this.f229 & 112) | 8388613;
            this.f243.setLayoutParams(c0629M45);
            m58(this.f243, false);
        }
    }

    /* renamed from: ˏᵙ, reason: contains not printable characters */
    public final void m50() {
        if (this.f233 == null) {
            C2292 c2292 = new C2292(getContext(), null, R.attr._11_res_0x7f0406ad);
            this.f233 = c2292;
            c2292.setImageDrawable(this.f236);
            this.f233.setContentDescription(this.f215);
            C0629 c0629M45 = m45();
            c0629M45.f3132 = (this.f229 & 112) | 8388611;
            c0629M45.f3133 = 2;
            this.f233.setLayoutParams(c0629M45);
            this.f233.setOnClickListener(new ViewOnClickListenerC4018(5, this));
        }
    }

    /* renamed from: ᵞʡ, reason: contains not printable characters */
    public final boolean m51(View view) {
        return (view == null || view.getParent() != this || view.getVisibility() == 8) ? false : true;
    }

    /* renamed from: ᵡʠ, reason: contains not printable characters */
    public final int m52(View view, int i, int i2, int i3, int i4, int[] iArr) {
        ViewGroup.MarginLayoutParams marginLayoutParams = (ViewGroup.MarginLayoutParams) view.getLayoutParams();
        int i5 = marginLayoutParams.leftMargin - iArr[0];
        int i6 = marginLayoutParams.rightMargin - iArr[1];
        int iMax = Math.max(0, i6) + Math.max(0, i5);
        iArr[0] = Math.max(0, -i5);
        iArr[1] = Math.max(0, -i6);
        view.measure(ViewGroup.getChildMeasureSpec(i, getPaddingRight() + getPaddingLeft() + iMax + i2, marginLayoutParams.width), ViewGroup.getChildMeasureSpec(i3, getPaddingBottom() + getPaddingTop() + marginLayoutParams.topMargin + marginLayoutParams.bottomMargin + i4, marginLayoutParams.height));
        return view.getMeasuredWidth() + iMax;
    }

    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    public final void m53(int i, ArrayList arrayList) {
        boolean z = getLayoutDirection() == 1;
        int childCount = getChildCount();
        int absoluteGravity = Gravity.getAbsoluteGravity(i, getLayoutDirection());
        arrayList.clear();
        if (!z) {
            for (int i2 = 0; i2 < childCount; i2++) {
                View childAt = getChildAt(i2);
                C0629 c0629 = (C0629) childAt.getLayoutParams();
                if (c0629.f3133 == 0 && m51(childAt)) {
                    int i3 = c0629.f3132;
                    int layoutDirection = getLayoutDirection();
                    int absoluteGravity2 = Gravity.getAbsoluteGravity(i3, layoutDirection) & 7;
                    if (absoluteGravity2 != 1 && absoluteGravity2 != 3 && absoluteGravity2 != 5) {
                        absoluteGravity2 = layoutDirection == 1 ? 5 : 3;
                    }
                    if (absoluteGravity2 == absoluteGravity) {
                        arrayList.add(childAt);
                    }
                }
            }
            return;
        }
        for (int i4 = childCount - 1; i4 >= 0; i4--) {
            View childAt2 = getChildAt(i4);
            C0629 c06292 = (C0629) childAt2.getLayoutParams();
            if (c06292.f3133 == 0 && m51(childAt2)) {
                int i5 = c06292.f3132;
                int layoutDirection2 = getLayoutDirection();
                int absoluteGravity3 = Gravity.getAbsoluteGravity(i5, layoutDirection2) & 7;
                if (absoluteGravity3 != 1 && absoluteGravity3 != 3 && absoluteGravity3 != 5) {
                    absoluteGravity3 = layoutDirection2 == 1 ? 5 : 3;
                }
                if (absoluteGravity3 == absoluteGravity) {
                    arrayList.add(childAt2);
                }
            }
        }
    }

    /* renamed from: ᵨᵳʝ, reason: contains not printable characters */
    public final void m54() {
        OnBackInvokedDispatcher onBackInvokedDispatcher;
        if (Build.VERSION.SDK_INT >= 33) {
            OnBackInvokedDispatcher onBackInvokedDispatcherM6858 = AbstractC2777.m6858(this);
            C4436 c4436 = this.f250;
            int i = 0;
            boolean z = (c4436 == null || c4436.f16580 == null || onBackInvokedDispatcherM6858 == null || !isAttachedToWindow() || !this.f238) ? false : true;
            if (z && this.f254 == null) {
                if (this.f218 == null) {
                    this.f218 = new C1223(2, new RunnableC1993(this, i));
                }
                AbstractC2777.m6861(onBackInvokedDispatcherM6858, this.f218);
                this.f254 = onBackInvokedDispatcherM6858;
                return;
            }
            if (z || (onBackInvokedDispatcher = this.f254) == null) {
                return;
            }
            AbstractC2777.m6851(onBackInvokedDispatcher, this.f218);
            this.f254 = null;
        }
    }

    /* renamed from: ᵪʩ, reason: contains not printable characters */
    public final boolean m55(View view) {
        return view.getParent() == this || this.f251.contains(view);
    }

    /* renamed from: ᵯٴᵦ, reason: contains not printable characters */
    public final void m56() {
        ArrayList arrayList = this.f248;
        int size = arrayList.size();
        int i = 0;
        while (i < size) {
            Object obj = arrayList.get(i);
            i++;
            getMenu().removeItem(((MenuItem) obj).getItemId());
        }
        getMenu();
        ArrayList<MenuItem> currentMenuItems = getCurrentMenuItems();
        getMenuInflater();
        Iterator it = ((CopyOnWriteArrayList) this.f221.ᵿʗᵝʽ).iterator();
        while (it.hasNext()) {
            ((C0270) it.next()).f1854.m9966();
        }
        ArrayList<MenuItem> currentMenuItems2 = getCurrentMenuItems();
        currentMenuItems2.removeAll(currentMenuItems);
        this.f248 = currentMenuItems2;
    }

    /* renamed from: ᵳٴᵶ, reason: contains not printable characters */
    public final int m57(View view, int i, int i2, int[] iArr) {
        C0629 c0629 = (C0629) view.getLayoutParams();
        int i3 = ((ViewGroup.MarginLayoutParams) c0629).leftMargin - iArr[0];
        int iMax = Math.max(0, i3) + i;
        iArr[0] = Math.max(0, -i3);
        int iM59 = m59(view, i2);
        int measuredWidth = view.getMeasuredWidth();
        view.layout(iMax, iM59, iMax + measuredWidth, view.getMeasuredHeight() + iM59);
        return measuredWidth + ((ViewGroup.MarginLayoutParams) c0629).rightMargin + iMax;
    }

    /* renamed from: ᵴᵳ, reason: contains not printable characters */
    public final void m58(View view, boolean z) {
        ViewGroup.LayoutParams layoutParams = view.getLayoutParams();
        C0629 c0629M45 = layoutParams == null ? m45() : !checkLayoutParams(layoutParams) ? m43(layoutParams) : (C0629) layoutParams;
        c0629M45.f3133 = 1;
        if (!z || this.f228 == null) {
            addView(view, c0629M45);
        } else {
            view.setLayoutParams(c0629M45);
            this.f251.add(view);
        }
    }

    /* renamed from: ᵶᵷᵕ, reason: contains not printable characters */
    public final int m59(View view, int i) {
        C0629 c0629 = (C0629) view.getLayoutParams();
        int measuredHeight = view.getMeasuredHeight();
        int i2 = i > 0 ? (measuredHeight - i) / 2 : 0;
        int i3 = c0629.f3132 & 112;
        if (i3 != 16 && i3 != 48 && i3 != 80) {
            i3 = this.f219 & 112;
        }
        if (i3 == 48) {
            return getPaddingTop() - i2;
        }
        if (i3 == 80) {
            return (((getHeight() - getPaddingBottom()) - measuredHeight) - ((ViewGroup.MarginLayoutParams) c0629).bottomMargin) - i2;
        }
        int paddingTop = getPaddingTop();
        int paddingBottom = getPaddingBottom();
        int height = getHeight();
        int iMax = (((height - paddingTop) - paddingBottom) - measuredHeight) / 2;
        int i4 = ((ViewGroup.MarginLayoutParams) c0629).topMargin;
        if (iMax < i4) {
            iMax = i4;
        } else {
            int i5 = (((height - paddingBottom) - measuredHeight) - iMax) - paddingTop;
            int i6 = ((ViewGroup.MarginLayoutParams) c0629).bottomMargin;
            if (i5 < i6) {
                iMax = Math.max(0, iMax - (i6 - i5));
            }
        }
        return paddingTop + iMax;
    }

    /* renamed from: ᵸʓᵠ, reason: contains not printable characters */
    public final void m60(View view, int i, int i2, int i3, int i4) {
        ViewGroup.MarginLayoutParams marginLayoutParams = (ViewGroup.MarginLayoutParams) view.getLayoutParams();
        int childMeasureSpec = ViewGroup.getChildMeasureSpec(i, getPaddingRight() + getPaddingLeft() + marginLayoutParams.leftMargin + marginLayoutParams.rightMargin + i2, marginLayoutParams.width);
        int childMeasureSpec2 = ViewGroup.getChildMeasureSpec(i3, getPaddingBottom() + getPaddingTop() + marginLayoutParams.topMargin + marginLayoutParams.bottomMargin, marginLayoutParams.height);
        int mode = View.MeasureSpec.getMode(childMeasureSpec2);
        if (mode != 1073741824 && i4 >= 0) {
            if (mode != 0) {
                i4 = Math.min(View.MeasureSpec.getSize(childMeasureSpec2), i4);
            }
            childMeasureSpec2 = View.MeasureSpec.makeMeasureSpec(i4, 1073741824);
        }
        view.measure(childMeasureSpec, childMeasureSpec2);
    }

    /* renamed from: ᵻᵢﹳᵰ, reason: contains not printable characters */
    public final void m61() {
        if (this.f227 == null) {
            C4012 c4012 = new C4012();
            c4012.f15089 = 0;
            c4012.f15090 = 0;
            c4012.f15088 = Integer.MIN_VALUE;
            c4012.f15092 = Integer.MIN_VALUE;
            c4012.f15085 = 0;
            c4012.f15087 = 0;
            c4012.f15086 = false;
            c4012.f15091 = false;
            this.f227 = c4012;
        }
    }
}
