package m;

import android.graphics.drawable.Drawable;
import android.text.TextUtils;
import android.view.View;
import android.view.Window;
import androidx.appcompat.widget.Toolbar;

/* JADX INFO: loaded from: classes.dex */
public final class W0 implements S {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public Toolbar f9089a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public int f9090b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public View f9091c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public Drawable f9092d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public Drawable f9093e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public Drawable f9094f;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    public boolean f9095g;

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    public CharSequence f9096h;
    public CharSequence i;

    /* JADX INFO: renamed from: j, reason: collision with root package name */
    public CharSequence f9097j;

    /* JADX INFO: renamed from: k, reason: collision with root package name */
    public Window.Callback f9098k;

    /* JADX INFO: renamed from: l, reason: collision with root package name */
    public int f9099l;

    /* JADX INFO: renamed from: m, reason: collision with root package name */
    public Drawable f9100m;

    public final void a(int i) {
        View view;
        int i5 = this.f9090b ^ i;
        this.f9090b = i;
        if (i5 != 0) {
            if ((i5 & 4) != 0) {
                if ((i & 4) != 0) {
                    b();
                }
                int i6 = this.f9090b & 4;
                Toolbar toolbar = this.f9089a;
                if (i6 != 0) {
                    Drawable drawable = this.f9094f;
                    if (drawable == null) {
                        drawable = this.f9100m;
                    }
                    toolbar.setNavigationIcon(drawable);
                } else {
                    toolbar.setNavigationIcon((Drawable) null);
                }
            }
            if ((i5 & 3) != 0) {
                c();
            }
            int i7 = i5 & 8;
            Toolbar toolbar2 = this.f9089a;
            if (i7 != 0) {
                if ((i & 8) != 0) {
                    toolbar2.setTitle(this.f9096h);
                    toolbar2.setSubtitle(this.i);
                } else {
                    toolbar2.setTitle((CharSequence) null);
                    toolbar2.setSubtitle((CharSequence) null);
                }
            }
            if ((i5 & 16) == 0 || (view = this.f9091c) == null) {
                return;
            }
            if ((i & 16) != 0) {
                toolbar2.addView(view);
            } else {
                toolbar2.removeView(view);
            }
        }
    }

    public final void b() {
        if ((this.f9090b & 4) != 0) {
            boolean zIsEmpty = TextUtils.isEmpty(this.f9097j);
            Toolbar toolbar = this.f9089a;
            if (zIsEmpty) {
                toolbar.setNavigationContentDescription(this.f9099l);
            } else {
                toolbar.setNavigationContentDescription(this.f9097j);
            }
        }
    }

    public final void c() {
        Drawable drawable;
        int i = this.f9090b;
        if ((i & 2) == 0) {
            drawable = null;
        } else if ((i & 1) == 0 || (drawable = this.f9093e) == null) {
            drawable = this.f9092d;
        }
        this.f9089a.setLogo(drawable);
    }
}
