package defpackage;

import android.content.Context;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import androidx.appcompat.widget.Toolbar;
import java.util.ArrayList;

/* renamed from: ᵱᵷ, reason: contains not printable characters */
/* loaded from: classes3.dex */
public final class C4436 implements InterfaceC5245 {

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

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

    /* renamed from: ᵿʗᵝʽ, reason: contains not printable characters */
    public final /* synthetic */ Toolbar f16582;

    public C4436(Toolbar toolbar) {
        this.f16582 = toolbar;
    }

    @Override // defpackage.InterfaceC5245
    /* renamed from: ˇʼʤˎ */
    public final void mo3443(MenuC2418 menuC2418, boolean z) {
    }

    @Override // defpackage.InterfaceC5245
    /* renamed from: ˏᵙ */
    public final boolean mo3447() {
        return false;
    }

    @Override // defpackage.InterfaceC5245
    /* renamed from: ᵝᵵᵺ */
    public final void mo3448() {
        if (this.f16580 != null) {
            MenuC2418 menuC2418 = this.f16581;
            if (menuC2418 != null) {
                int size = menuC2418.f9424.size();
                for (int i = 0; i < size; i++) {
                    if (this.f16581.getItem(i) == this.f16580) {
                        return;
                    }
                }
            }
            mo3454(this.f16580);
        }
    }

    @Override // defpackage.InterfaceC5245
    /* renamed from: ᵴᵳ */
    public final boolean mo3450(SubMenuC0664 subMenuC0664) {
        return false;
    }

    @Override // defpackage.InterfaceC5245
    /* renamed from: ᵸˑ */
    public final void mo3452(Context context, MenuC2418 menuC2418) {
        C2652 c2652;
        MenuC2418 menuC24182 = this.f16581;
        if (menuC24182 != null && (c2652 = this.f16580) != null) {
            menuC24182.mo2619(c2652);
        }
        this.f16581 = menuC2418;
    }

    @Override // defpackage.InterfaceC5245
    /* renamed from: ᵹᵝᵶ */
    public final boolean mo3453(C2652 c2652) {
        Toolbar toolbar = this.f16582;
        toolbar.m50();
        ViewParent parent = toolbar.f233.getParent();
        if (parent != toolbar) {
            if (parent instanceof ViewGroup) {
                ((ViewGroup) parent).removeView(toolbar.f233);
            }
            toolbar.addView(toolbar.f233);
        }
        View actionView = c2652.getActionView();
        toolbar.f228 = actionView;
        this.f16580 = c2652;
        ViewParent parent2 = actionView.getParent();
        if (parent2 != toolbar) {
            if (parent2 instanceof ViewGroup) {
                ((ViewGroup) parent2).removeView(toolbar.f228);
            }
            C0629 c0629M45 = Toolbar.m45();
            c0629M45.f3132 = (toolbar.f229 & 112) | 8388611;
            c0629M45.f3133 = 2;
            toolbar.f228.setLayoutParams(c0629M45);
            toolbar.addView(toolbar.f228);
        }
        for (int childCount = toolbar.getChildCount() - 1; childCount >= 0; childCount--) {
            View childAt = toolbar.getChildAt(childCount);
            if (((C0629) childAt.getLayoutParams()).f3133 != 2 && childAt != toolbar.f243) {
                toolbar.removeViewAt(childCount);
                toolbar.f251.add(childAt);
            }
        }
        toolbar.requestLayout();
        c2652.f10274 = true;
        c2652.f10281.m6182(false);
        KeyEvent.Callback callback = toolbar.f228;
        if (callback instanceof InterfaceC1003) {
            ((C5087) ((InterfaceC1003) callback)).f19014.onActionViewExpanded();
        }
        toolbar.m54();
        return true;
    }

    @Override // defpackage.InterfaceC5245
    /* renamed from: ᵻᵢﹳᵰ */
    public final boolean mo3454(C2652 c2652) {
        Toolbar toolbar = this.f16582;
        KeyEvent.Callback callback = toolbar.f228;
        if (callback instanceof InterfaceC1003) {
            ((C5087) ((InterfaceC1003) callback)).f19014.onActionViewCollapsed();
        }
        toolbar.removeView(toolbar.f228);
        toolbar.removeView(toolbar.f233);
        toolbar.f228 = null;
        ArrayList arrayList = toolbar.f251;
        for (int size = arrayList.size() - 1; size >= 0; size--) {
            toolbar.addView((View) arrayList.get(size));
        }
        arrayList.clear();
        this.f16580 = null;
        toolbar.requestLayout();
        c2652.f10274 = false;
        c2652.f10281.m6182(false);
        toolbar.m54();
        return true;
    }
}
