package ῲ.ῲ.㴹;

import android.content.Context;
import android.graphics.drawable.Drawable;
import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import androidx.appcompat.R$attr;
import androidx.appcompat.R$string;
import androidx.appcompat.R$styleable;
import androidx.appcompat.widget.ActionMenuPresenter;
import androidx.appcompat.widget.ScrollingTabContainerView;
import androidx.appcompat.widget.Toolbar;
import com.google.android.material.badge.BadgeDrawable;
import ῲ.ᨨ.ᨨ.C1729;
import ῲ.ᨨ.ᨨ.C1749;
import ῲ.ᨨ.ᨨ.C1768;

/* renamed from: ῲ.ῲ.㴹.㮝  reason: contains not printable characters */
/* compiled from: ToolbarWidgetWrapper */
public class C2040 implements AbstractC2002 {

    /* renamed from: ʬ  reason: contains not printable characters */
    public View f6924;

    /* renamed from: Ԕ  reason: contains not printable characters */
    public ActionMenuPresenter f6925;

    /* renamed from: ؿ  reason: contains not printable characters */
    public int f6926 = 0;

    /* renamed from: ඓ  reason: contains not printable characters */
    public Drawable f6927;

    /* renamed from: ᓣ  reason: contains not printable characters */
    public Drawable f6928;

    /* renamed from: ᕣ  reason: contains not printable characters */
    public CharSequence f6929;

    /* renamed from: ᨨ  reason: contains not printable characters */
    public CharSequence f6930;

    /* renamed from: ῲ  reason: contains not printable characters */
    public int f6931;

    /* renamed from: ⁱ  reason: contains not printable characters */
    public Drawable f6932;

    /* renamed from: K  reason: contains not printable characters */
    public Toolbar f6933;

    /* renamed from: 㑃  reason: contains not printable characters */
    public Window.Callback f6934;

    /* renamed from: 㗗  reason: contains not printable characters */
    public int f6935 = 0;

    /* renamed from: 㳳  reason: contains not printable characters */
    public CharSequence f6936;

    /* renamed from: 㴹  reason: contains not printable characters */
    public Drawable f6937;

    /* renamed from: 㸾  reason: contains not printable characters */
    public View f6938;

    /* renamed from: 㿎  reason: contains not printable characters */
    public boolean f6939;

    /* renamed from: 䁗  reason: contains not printable characters */
    public boolean f6940;

    /* renamed from: ῲ.ῲ.㴹.㮝$K  reason: contains not printable characters */
    /* compiled from: ToolbarWidgetWrapper */
    public class C2041 extends C1749 {

        /* renamed from: ῲ  reason: contains not printable characters */
        public final /* synthetic */ int f6942;

        /* renamed from: K  reason: contains not printable characters */
        public boolean f6943 = false;

        public C2041(int i) {
            this.f6942 = i;
        }

        @Override // ῲ.ᨨ.ᨨ.AbstractC1738, ῲ.ᨨ.ᨨ.C1749
        /* renamed from: ʬ  reason: contains not printable characters */
        public void m5303(View view) {
            this.f6943 = true;
        }

        @Override // ῲ.ᨨ.ᨨ.AbstractC1738, ῲ.ᨨ.ᨨ.C1749
        /* renamed from: ῲ  reason: contains not printable characters */
        public void m5304(View view) {
            C2040.this.f6933.setVisibility(0);
        }

        @Override // ῲ.ᨨ.ᨨ.AbstractC1738
        /* renamed from: K  reason: contains not printable characters */
        public void m5305(View view) {
            if (!this.f6943) {
                C2040.this.f6933.setVisibility(this.f6942);
            }
        }
    }

    public C2040(Toolbar toolbar, boolean z) {
        int i;
        Drawable drawable;
        int i2 = R$string.abc_action_bar_up_description;
        this.f6933 = toolbar;
        this.f6930 = toolbar.getTitle();
        this.f6936 = toolbar.getSubtitle();
        this.f6939 = this.f6930 != null;
        this.f6932 = toolbar.getNavigationIcon();
        String str = null;
        C2019 r7 = C2019.m5223(toolbar.getContext(), null, R$styleable.ActionBar, R$attr.actionBarStyle, 0);
        this.f6928 = r7.m5229(R$styleable.ActionBar_homeAsUpIndicator);
        if (z) {
            CharSequence r8 = r7.m5227(R$styleable.ActionBar_title);
            if (!TextUtils.isEmpty(r8)) {
                this.f6939 = true;
                m5299(r8);
            }
            CharSequence r82 = r7.m5227(R$styleable.ActionBar_subtitle);
            if (!TextUtils.isEmpty(r82)) {
                this.f6936 = r82;
                if ((this.f6931 & 8) != 0) {
                    this.f6933.setSubtitle(r82);
                }
            }
            Drawable r83 = r7.m5229(R$styleable.ActionBar_logo);
            if (r83 != null) {
                m5297(r83);
            }
            Drawable r84 = r7.m5229(R$styleable.ActionBar_icon);
            if (r84 != null) {
                this.f6927 = r84;
                m5301();
            }
            if (this.f6932 == null && (drawable = this.f6928) != null) {
                this.f6932 = drawable;
                m5292();
            }
            m5296(r7.m5238(R$styleable.ActionBar_displayOptions, 0));
            int r85 = r7.m5230(R$styleable.ActionBar_customNavigationLayout, 0);
            if (r85 != 0) {
                View inflate = LayoutInflater.from(this.f6933.getContext()).inflate(r85, (ViewGroup) this.f6933, false);
                View view = this.f6938;
                if (!(view == null || (this.f6931 & 16) == 0)) {
                    this.f6933.removeView(view);
                }
                this.f6938 = inflate;
                if (!(inflate == null || (this.f6931 & 16) == 0)) {
                    this.f6933.addView(this.f6938);
                }
                m5296(this.f6931 | 16);
            }
            int r86 = r7.m5236(R$styleable.ActionBar_height, 0);
            if (r86 > 0) {
                ViewGroup.LayoutParams layoutParams = this.f6933.getLayoutParams();
                layoutParams.height = r86;
                this.f6933.setLayoutParams(layoutParams);
            }
            int r87 = r7.m5228(R$styleable.ActionBar_contentInsetStart, -1);
            int r2 = r7.m5228(R$styleable.ActionBar_contentInsetEnd, -1);
            if (r87 >= 0 || r2 >= 0) {
                this.f6933.setContentInsetsRelative(Math.max(r87, 0), Math.max(r2, 0));
            }
            int r88 = r7.m5230(R$styleable.ActionBar_titleTextStyle, 0);
            if (r88 != 0) {
                Toolbar toolbar2 = this.f6933;
                toolbar2.setTitleTextAppearance(toolbar2.getContext(), r88);
            }
            int r89 = r7.m5230(R$styleable.ActionBar_subtitleTextStyle, 0);
            if (r89 != 0) {
                Toolbar toolbar3 = this.f6933;
                toolbar3.setSubtitleTextAppearance(toolbar3.getContext(), r89);
            }
            int r810 = r7.m5230(R$styleable.ActionBar_popupTheme, 0);
            if (r810 != 0) {
                this.f6933.setPopupTheme(r810);
            }
        } else {
            if (this.f6933.getNavigationIcon() != null) {
                i = 15;
                this.f6928 = this.f6933.getNavigationIcon();
            } else {
                i = 11;
            }
            this.f6931 = i;
        }
        r7.f6846.recycle();
        if (i2 != this.f6926) {
            this.f6926 = i2;
            if (TextUtils.isEmpty(this.f6933.getNavigationContentDescription())) {
                int i3 = this.f6926;
                this.f6929 = i3 != 0 ? m5294().getString(i3) : str;
                m5302();
            }
        }
        this.f6929 = this.f6933.getNavigationContentDescription();
        this.f6933.setNavigationOnClickListener(new View$OnClickListenerC1990(this));
    }

    /* renamed from: ʬ  reason: contains not printable characters */
    public void m5291() {
        Log.i("ToolbarWidgetWrapper", "Progress display unsupported");
    }

    /* renamed from: ඓ  reason: contains not printable characters */
    public final void m5292() {
        if ((this.f6931 & 4) != 0) {
            Toolbar toolbar = this.f6933;
            Drawable drawable = this.f6932;
            if (drawable == null) {
                drawable = this.f6928;
            }
            toolbar.setNavigationIcon(drawable);
            return;
        }
        this.f6933.setNavigationIcon((Drawable) null);
    }

    /* renamed from: ῲ  reason: contains not printable characters */
    public void m5293() {
        Log.i("ToolbarWidgetWrapper", "Progress display unsupported");
    }

    /* renamed from: K  reason: contains not printable characters */
    public Context m5294() {
        return this.f6933.getContext();
    }

    /* renamed from: K  reason: contains not printable characters */
    public void m5300(boolean z) {
    }

    /* renamed from: 㴹  reason: contains not printable characters */
    public final void m5301() {
        Drawable drawable;
        int i = this.f6931;
        if ((i & 2) == 0) {
            drawable = null;
        } else if ((i & 1) != 0) {
            drawable = this.f6937;
            if (drawable == null) {
                drawable = this.f6927;
            }
        } else {
            drawable = this.f6927;
        }
        this.f6933.setLogo(drawable);
    }

    /* renamed from: 㸾  reason: contains not printable characters */
    public final void m5302() {
        if ((this.f6931 & 4) == 0) {
            return;
        }
        if (TextUtils.isEmpty(this.f6929)) {
            this.f6933.setNavigationContentDescription(this.f6926);
        } else {
            this.f6933.setNavigationContentDescription(this.f6929);
        }
    }

    /* renamed from: K  reason: contains not printable characters */
    public final void m5299(CharSequence charSequence) {
        this.f6930 = charSequence;
        if ((this.f6931 & 8) != 0) {
            this.f6933.setTitle(charSequence);
        }
    }

    /* renamed from: K  reason: contains not printable characters */
    public void m5297(Drawable drawable) {
        this.f6937 = drawable;
        m5301();
    }

    /* renamed from: K  reason: contains not printable characters */
    public void m5296(int i) {
        View view;
        int i2 = this.f6931 ^ i;
        this.f6931 = i;
        if (i2 != 0) {
            if ((i2 & 4) != 0) {
                if ((i & 4) != 0) {
                    m5302();
                }
                m5292();
            }
            if ((i2 & 3) != 0) {
                m5301();
            }
            if ((i2 & 8) != 0) {
                if ((i & 8) != 0) {
                    this.f6933.setTitle(this.f6930);
                    this.f6933.setSubtitle(this.f6936);
                } else {
                    this.f6933.setTitle((CharSequence) null);
                    this.f6933.setSubtitle((CharSequence) null);
                }
            }
            if ((i2 & 16) != 0 && (view = this.f6938) != null) {
                if ((i & 16) != 0) {
                    this.f6933.addView(view);
                } else {
                    this.f6933.removeView(view);
                }
            }
        }
    }

    /* renamed from: K  reason: contains not printable characters */
    public void m5298(ScrollingTabContainerView scrollingTabContainerView) {
        Toolbar toolbar;
        View view = this.f6924;
        if (view != null && view.getParent() == (toolbar = this.f6933)) {
            toolbar.removeView(this.f6924);
        }
        this.f6924 = scrollingTabContainerView;
        if (scrollingTabContainerView != null && this.f6935 == 2) {
            this.f6933.addView(this.f6924, 0);
            Toolbar.C0116 r0 = (Toolbar.C0116) this.f6924.getLayoutParams();
            ((ViewGroup.MarginLayoutParams) r0).width = -2;
            ((ViewGroup.MarginLayoutParams) r0).height = -2;
            r0.f6691 = BadgeDrawable.BOTTOM_START;
            scrollingTabContainerView.setAllowCollapse(true);
        }
    }

    /* renamed from: K  reason: contains not printable characters */
    public C1768 m5295(int i, long j) {
        C1768 r0 = C1729.m4470(this.f6933);
        r0.m4617(i == 0 ? 1.0f : 0.0f);
        r0.m4618(j);
        r0.m4619(new C2041(i));
        return r0;
    }
}
