package com.google.android.material.navigation;

import android.R;
import android.animation.ValueAnimator;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.TypedArray;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.RippleDrawable;
import android.os.Build;
import android.text.TextUtils;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.accessibility.AccessibilityNodeInfo;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.DimenRes;
import androidx.annotation.DrawableRes;
import androidx.annotation.LayoutRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.Px;
import androidx.annotation.RestrictTo;
import androidx.annotation.StyleRes;
import com.google.android.gms.measurement.internal.d0;
import com.google.android.material.internal.BaselineLayout;
import l.y3;

/* JADX INFO: loaded from: classes2.dex */
@RestrictTo({RestrictTo.Scope.f556b})
public abstract class NavigationBarItemView extends FrameLayout implements h {
    public static final int[] F0 = {R.attr.state_checked};
    public static final d0 G0 = new d0();
    public static final e H0 = new e();
    public boolean A0;
    public boolean B0;
    public boolean C0;
    public boolean D0;
    public Rect E0;
    public boolean Q;
    public final LinearLayout R;
    public final LinearLayout S;
    public final View T;
    public final FrameLayout U;
    public final ImageView V;
    public final BaselineLayout W;

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

    /* JADX INFO: renamed from: a0, reason: collision with root package name */
    public final TextView f22854a0;

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

    /* JADX INFO: renamed from: b0, reason: collision with root package name */
    public final TextView f22856b0;

    @Nullable
    private z8.a badgeDrawable;

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

    /* JADX INFO: renamed from: c0, reason: collision with root package name */
    public final BaselineLayout f22858c0;

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

    /* JADX INFO: renamed from: d0, reason: collision with root package name */
    public final TextView f22860d0;

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

    /* JADX INFO: renamed from: e0, reason: collision with root package name */
    public final TextView f22862e0;

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

    /* JADX INFO: renamed from: f0, reason: collision with root package name */
    public BaselineLayout f22864f0;

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

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

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    public float f22867h;

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

    /* JADX INFO: renamed from: i, reason: collision with root package name */
    public float f22869i;

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

    @Nullable
    private ColorStateList iconTint;

    @Nullable
    Drawable itemBackground;

    @Nullable
    private k.r itemData;

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

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

    /* JADX INFO: renamed from: k, reason: collision with root package name */
    public float f22873k;

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

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

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

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

    /* JADX INFO: renamed from: m0, reason: collision with root package name */
    public ValueAnimator f22878m0;

    /* JADX INFO: renamed from: n0, reason: collision with root package name */
    public d0 f22879n0;

    /* JADX INFO: renamed from: o0, reason: collision with root package name */
    public float f22880o0;

    @Nullable
    private Drawable originalIconDrawable;

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

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

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

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

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

    @Nullable
    private ColorStateList textColor;

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

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

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

    @Nullable
    private Drawable wrappedIconDrawable;

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

    /* JADX INFO: renamed from: y0, reason: collision with root package name */
    public int f22890y0;
    public int z0;

    public NavigationBarItemView(@NonNull Context context) {
        super(context);
        this.f22853a = false;
        this.f22866g0 = -1;
        this.f22868h0 = 0;
        this.f22870i0 = 0;
        this.f22872j0 = 0;
        this.f22874k0 = 0;
        this.f22876l0 = false;
        this.f22879n0 = G0;
        this.f22880o0 = 0.0f;
        this.f22881p0 = false;
        this.f22882q0 = 0;
        this.f22883r0 = 0;
        this.f22884s0 = -2;
        this.f22885t0 = 0;
        this.f22886u0 = false;
        this.f22887v0 = 0;
        this.f22888w0 = 0;
        this.f22890y0 = 0;
        this.z0 = 49;
        this.A0 = false;
        this.B0 = false;
        this.C0 = false;
        this.D0 = false;
        this.E0 = new Rect();
        LayoutInflater.from(context).inflate(getItemLayoutResId(), (ViewGroup) this, true);
        this.R = (LinearLayout) findViewById(x8.g.navigation_bar_item_content_container);
        LinearLayout linearLayout = (LinearLayout) findViewById(x8.g.navigation_bar_item_inner_content_container);
        this.S = linearLayout;
        this.T = findViewById(x8.g.navigation_bar_item_active_indicator_view);
        this.U = (FrameLayout) findViewById(x8.g.navigation_bar_item_icon_container);
        this.V = (ImageView) findViewById(x8.g.navigation_bar_item_icon_view);
        BaselineLayout baselineLayout = (BaselineLayout) findViewById(x8.g.navigation_bar_item_labels_group);
        this.W = baselineLayout;
        TextView textView = (TextView) findViewById(x8.g.navigation_bar_item_small_label_view);
        this.f22854a0 = textView;
        TextView textView2 = (TextView) findViewById(x8.g.navigation_bar_item_large_label_view);
        this.f22856b0 = textView2;
        float dimension = getResources().getDimension(x8.e.default_navigation_text_size);
        float dimension2 = getResources().getDimension(x8.e.default_navigation_active_text_size);
        BaselineLayout baselineLayout2 = new BaselineLayout(getContext());
        this.f22858c0 = baselineLayout2;
        baselineLayout2.setVisibility(8);
        this.f22858c0.setDuplicateParentStateEnabled(true);
        this.f22858c0.setMeasurePaddingFromBaseline(this.C0);
        TextView textView3 = new TextView(getContext());
        this.f22860d0 = textView3;
        textView3.setMaxLines(1);
        TextView textView4 = this.f22860d0;
        TextUtils.TruncateAt truncateAt = TextUtils.TruncateAt.END;
        textView4.setEllipsize(truncateAt);
        this.f22860d0.setDuplicateParentStateEnabled(true);
        this.f22860d0.setIncludeFontPadding(false);
        this.f22860d0.setGravity(16);
        this.f22860d0.setTextSize(dimension);
        TextView textView5 = new TextView(getContext());
        this.f22862e0 = textView5;
        textView5.setMaxLines(1);
        this.f22862e0.setEllipsize(truncateAt);
        this.f22862e0.setDuplicateParentStateEnabled(true);
        this.f22862e0.setVisibility(4);
        this.f22862e0.setIncludeFontPadding(false);
        this.f22862e0.setGravity(16);
        this.f22862e0.setTextSize(dimension2);
        this.f22858c0.addView(this.f22860d0);
        this.f22858c0.addView(this.f22862e0);
        this.f22864f0 = baselineLayout;
        setBackgroundResource(getItemBackgroundResId());
        this.f22857c = getResources().getDimensionPixelSize(getItemDefaultMarginResId());
        this.f22859d = baselineLayout.getPaddingBottom();
        this.f22861e = 0;
        this.f22863f = 0;
        textView.setImportantForAccessibility(2);
        textView2.setImportantForAccessibility(2);
        this.f22860d0.setImportantForAccessibility(2);
        this.f22862e0.setImportantForAccessibility(2);
        setFocusable(true);
        b();
        this.f22885t0 = getResources().getDimensionPixelSize(x8.e.m3_navigation_item_expanded_active_indicator_height_default);
        linearLayout.addOnLayoutChangeListener(new c(this, 0));
    }

    public static void a(NavigationBarItemView navigationBarItemView, int i10, int i11, int i12, int i13) {
        z8.a aVar;
        ImageView imageView = navigationBarItemView.V;
        if (imageView.getVisibility() == 0 && (aVar = navigationBarItemView.badgeDrawable) != null) {
            z8.e.setBadgeDrawableBounds(aVar, imageView, null);
        }
        FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) navigationBarItemView.S.getLayoutParams();
        int i14 = (i12 - i10) + layoutParams.rightMargin + layoutParams.leftMargin;
        int i15 = (i13 - i11) + layoutParams.topMargin + layoutParams.bottomMargin;
        boolean z10 = true;
        if (navigationBarItemView.f22889x0 == 1 && navigationBarItemView.f22884s0 == -2) {
            View view = navigationBarItemView.T;
            FrameLayout.LayoutParams layoutParams2 = (FrameLayout.LayoutParams) view.getLayoutParams();
            if (navigationBarItemView.f22884s0 != -2 || view.getMeasuredWidth() == i14) {
                z10 = false;
            } else {
                layoutParams2.width = Math.max(i14, Math.min(navigationBarItemView.f22882q0, navigationBarItemView.getMeasuredWidth() - (navigationBarItemView.f22887v0 * 2)));
            }
            if (view.getMeasuredHeight() < i15) {
                layoutParams2.height = i15;
            } else if (!z10) {
                return;
            }
            view.setLayoutParams(layoutParams2);
        }
    }

    private int getItemVisiblePosition() {
        ViewGroup viewGroup = (ViewGroup) getParent();
        int iIndexOfChild = viewGroup.indexOfChild(this);
        int i10 = 0;
        for (int i11 = 0; i11 < iIndexOfChild; i11++) {
            View childAt = viewGroup.getChildAt(i11);
            if ((childAt instanceof NavigationBarItemView) && childAt.getVisibility() == 0) {
                i10++;
            }
        }
        return i10;
    }

    private int getSuggestedIconWidth() {
        z8.a aVar = this.badgeDrawable;
        int minimumWidth = aVar == null ? 0 : aVar.getMinimumWidth() - this.badgeDrawable.f37076e.f37102b.W.intValue();
        LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) this.U.getLayoutParams();
        return Math.max(minimumWidth, layoutParams.rightMargin) + this.V.getMeasuredWidth() + Math.max(minimumWidth, layoutParams.leftMargin);
    }

    public static void k(int i10, int i11, int i12, LinearLayout linearLayout) {
        FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) linearLayout.getLayoutParams();
        layoutParams.topMargin = i10;
        layoutParams.bottomMargin = i11;
        layoutParams.gravity = i12;
        linearLayout.setLayoutParams(layoutParams);
    }

    private void setLabelPivots(TextView textView) {
        textView.setPivotX(textView.getWidth() / 2);
        textView.setPivotY(textView.getBaseline());
    }

    private void tryAttachBadgeToAnchor(@Nullable View view) {
        if (this.badgeDrawable == null || view == null) {
            return;
        }
        setClipChildren(false);
        setClipToPadding(false);
        z8.e.attachBadgeDrawable(this.badgeDrawable, view, null);
    }

    private void tryRemoveBadgeFromAnchor(@Nullable View view) {
        if (this.badgeDrawable != null) {
            if (view != null) {
                setClipChildren(true);
                setClipToPadding(true);
                z8.e.detachBadgeDrawable(this.badgeDrawable, view);
            }
            this.badgeDrawable = null;
        }
    }

    private void updateActiveLabelTextAppearance(@Nullable TextView textView, @StyleRes int i10) {
        if (textView == null) {
            return;
        }
        j(textView, i10);
        b();
        textView.setMinimumHeight(q9.d.b(textView.getContext(), i10));
        ColorStateList colorStateList = this.textColor;
        if (colorStateList != null) {
            textView.setTextColor(colorStateList);
        }
        TextView textView2 = this.f22856b0;
        textView2.setTypeface(textView2.getTypeface(), this.f22876l0 ? 1 : 0);
        TextView textView3 = this.f22862e0;
        textView3.setTypeface(textView3.getTypeface(), this.f22876l0 ? 1 : 0);
    }

    private void updateInactiveLabelTextAppearance(@Nullable TextView textView, @StyleRes int i10) {
        if (textView == null) {
            return;
        }
        j(textView, i10);
        b();
        textView.setMinimumHeight(q9.d.b(textView.getContext(), i10));
        ColorStateList colorStateList = this.textColor;
        if (colorStateList != null) {
            textView.setTextColor(colorStateList);
        }
    }

    public final void b() {
        float textSize = this.f22854a0.getTextSize();
        float textSize2 = this.f22856b0.getTextSize();
        this.f22865g = textSize - textSize2;
        this.f22867h = (textSize2 * 1.0f) / textSize;
        this.f22869i = (textSize * 1.0f) / textSize2;
        float textSize3 = this.f22860d0.getTextSize();
        float textSize4 = this.f22862e0.getTextSize();
        this.f22871j = textSize3 - textSize4;
        this.f22873k = (textSize4 * 1.0f) / textSize3;
        this.f22875l = (textSize3 * 1.0f) / textSize4;
    }

    @Override // k.c0
    public final void c(k.r rVar) {
        this.itemData = rVar;
        setCheckable(rVar.isCheckable());
        setChecked(rVar.isChecked());
        setEnabled(rVar.isEnabled());
        setIcon(rVar.getIcon());
        setTitle(rVar.f28912e);
        setId(rVar.f28908a);
        if (!TextUtils.isEmpty(rVar.f28924q)) {
            setContentDescription(rVar.f28924q);
        }
        y3.setTooltipText(this, !TextUtils.isEmpty(rVar.f28925r) ? rVar.f28925r : rVar.f28912e);
        m();
        this.f22853a = true;
    }

    public final void d() {
        tryRemoveBadgeFromAnchor(this.V);
        this.itemData = null;
        this.f22880o0 = 0.0f;
        this.f22853a = false;
    }

    @Override // android.view.ViewGroup, android.view.View
    public final boolean dispatchTouchEvent(MotionEvent motionEvent) {
        if (this.f22881p0) {
            this.U.dispatchTouchEvent(motionEvent);
        }
        return super.dispatchTouchEvent(motionEvent);
    }

    public final void e() {
        Drawable rippleDrawable = this.itemBackground;
        RippleDrawable rippleDrawable2 = null;
        boolean z10 = true;
        if (this.f22855b != null) {
            Drawable activeIndicatorDrawable = getActiveIndicatorDrawable();
            if (this.f22881p0 && getActiveIndicatorDrawable() != null && activeIndicatorDrawable != null) {
                rippleDrawable2 = new RippleDrawable(r9.a.sanitizeRippleDrawableColor(this.f22855b), null, activeIndicatorDrawable);
                z10 = false;
            } else if (rippleDrawable == null) {
                rippleDrawable = new RippleDrawable(r9.a.convertToRippleDrawableColor(this.f22855b), null, null);
            }
        }
        FrameLayout frameLayout = this.U;
        frameLayout.setPadding(0, 0, 0, 0);
        frameLayout.setForeground(rippleDrawable2);
        setBackground(rippleDrawable);
        if (Build.VERSION.SDK_INT >= 26) {
            setDefaultFocusHighlightEnabled(z10);
        }
    }

    public final void f(float f10, float f11) {
        d0 d0Var = this.f22879n0;
        d0Var.getClass();
        float fA = y8.a.a(0.4f, 1.0f, f10);
        View view = this.T;
        view.setScaleX(fA);
        view.setScaleY(d0Var.a(f10));
        view.setAlpha(y8.a.b(0.0f, 1.0f, f11 == 0.0f ? 0.8f : 0.0f, f11 == 0.0f ? 1.0f : 0.2f, f10));
        this.f22880o0 = f10;
    }

    public final void g() {
        int i10 = this.V.getLayoutParams().width > 0 ? this.f22863f : 0;
        LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) this.f22858c0.getLayoutParams();
        if (layoutParams != null) {
            layoutParams.rightMargin = getLayoutDirection() == 1 ? i10 : 0;
            layoutParams.leftMargin = getLayoutDirection() != 1 ? i10 : 0;
        }
    }

    @Nullable
    public Drawable getActiveIndicatorDrawable() {
        return this.T.getBackground();
    }

    @Nullable
    public z8.a getBadge() {
        return this.badgeDrawable;
    }

    @NonNull
    public BaselineLayout getExpandedLabelGroup() {
        return this.f22858c0;
    }

    @DrawableRes
    public int getItemBackgroundResId() {
        return x8.f.mtrl_navigation_bar_item_background;
    }

    @Override // k.c0
    @Nullable
    public k.r getItemData() {
        return this.itemData;
    }

    @DimenRes
    public int getItemDefaultMarginResId() {
        return x8.e.mtrl_navigation_bar_item_default_margin;
    }

    @LayoutRes
    public abstract int getItemLayoutResId();

    public int getItemPosition() {
        return this.f22866g0;
    }

    @NonNull
    public BaselineLayout getLabelGroup() {
        return this.W;
    }

    @Override // android.view.View
    public int getSuggestedMinimumHeight() {
        LinearLayout linearLayout = this.R;
        FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) linearLayout.getLayoutParams();
        return linearLayout.getMeasuredHeight() + layoutParams.topMargin + layoutParams.bottomMargin;
    }

    @Override // android.view.View
    public int getSuggestedMinimumWidth() {
        if (this.f22889x0 == 1) {
            LinearLayout linearLayout = this.S;
            FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) linearLayout.getLayoutParams();
            return linearLayout.getMeasuredWidth() + layoutParams.leftMargin + layoutParams.rightMargin;
        }
        BaselineLayout baselineLayout = this.W;
        LinearLayout.LayoutParams layoutParams2 = (LinearLayout.LayoutParams) baselineLayout.getLayoutParams();
        return Math.max(getSuggestedIconWidth(), baselineLayout.getMeasuredWidth() + layoutParams2.leftMargin + layoutParams2.rightMargin);
    }

    public final void h(TextView textView, TextView textView2, float f10, float f11) {
        k(this.f22889x0 == 0 ? (int) (this.f22857c + f11) : 0, 0, this.z0, this.R);
        int i10 = this.f22889x0;
        k(i10 == 0 ? 0 : this.E0.top, i10 == 0 ? 0 : this.E0.bottom, i10 == 0 ? 17 : 8388627, this.S);
        int i11 = this.f22859d;
        BaselineLayout baselineLayout = this.W;
        baselineLayout.setPadding(baselineLayout.getPaddingLeft(), baselineLayout.getPaddingTop(), baselineLayout.getPaddingRight(), i11);
        this.f22864f0.setVisibility(0);
        textView.setScaleX(1.0f);
        textView.setScaleY(1.0f);
        textView.setVisibility(0);
        textView2.setScaleX(f10);
        textView2.setScaleY(f10);
        textView2.setVisibility(4);
    }

    public final void i() {
        int i10 = this.f22857c;
        k(i10, i10, this.f22889x0 == 0 ? 17 : this.z0, this.R);
        k(0, 0, 17, this.S);
        BaselineLayout baselineLayout = this.W;
        baselineLayout.setPadding(baselineLayout.getPaddingLeft(), baselineLayout.getPaddingTop(), baselineLayout.getPaddingRight(), 0);
        this.f22864f0.setVisibility(8);
    }

    /* JADX WARN: Removed duplicated region for block: B:7:0x0012  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final void j(TextView textView, int i10) {
        int iRound;
        if (this.D0) {
            textView.setTextAppearance(i10);
            return;
        }
        textView.setTextAppearance(i10);
        Context context = textView.getContext();
        if (i10 == 0) {
            iRound = 0;
        } else {
            TypedArray typedArrayObtainStyledAttributes = context.obtainStyledAttributes(i10, d.j.TextAppearance);
            TypedValue typedValue = new TypedValue();
            boolean value = typedArrayObtainStyledAttributes.getValue(d.j.TextAppearance_android_textSize, typedValue);
            typedArrayObtainStyledAttributes.recycle();
            if (value) {
                iRound = typedValue.getComplexUnit() == 2 ? Math.round(TypedValue.complexToFloat(typedValue.data) * context.getResources().getDisplayMetrics().density) : TypedValue.complexToDimensionPixelSize(typedValue.data, context.getResources().getDisplayMetrics());
            }
        }
        if (iRound != 0) {
            textView.setTextSize(0, iRound);
        }
    }

    public final void l(int i10) {
        if (i10 > 0 || getVisibility() != 0) {
            int iMin = Math.min(this.f22882q0, i10 - (this.f22887v0 * 2));
            int iMax = this.f22883r0;
            if (this.f22889x0 == 1) {
                int measuredWidth = i10 - (this.f22888w0 * 2);
                int i11 = this.f22884s0;
                if (i11 != -1) {
                    measuredWidth = i11 == -2 ? this.R.getMeasuredWidth() : Math.min(i11, measuredWidth);
                }
                iMin = measuredWidth;
                iMax = Math.max(this.f22885t0, this.S.getMeasuredHeight());
            }
            View view = this.T;
            FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) view.getLayoutParams();
            if (this.f22886u0 && this.f22877m == 2) {
                iMax = iMin;
            }
            layoutParams.height = iMax;
            layoutParams.width = Math.max(0, iMin);
            view.setLayoutParams(layoutParams);
        }
    }

    public final void m() {
        k.r rVar = this.itemData;
        if (rVar != null) {
            setVisibility((!rVar.isVisible() || (!this.A0 && this.B0)) ? 8 : 0);
        }
    }

    @Override // android.view.ViewGroup, android.view.View
    public final int[] onCreateDrawableState(int i10) {
        int[] iArrOnCreateDrawableState = super.onCreateDrawableState(i10 + 1);
        k.r rVar = this.itemData;
        if (rVar != null && rVar.isCheckable() && this.itemData.isChecked()) {
            View.mergeDrawableStates(iArrOnCreateDrawableState, F0);
        }
        return iArrOnCreateDrawableState;
    }

    @Override // android.view.View
    public final void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo accessibilityNodeInfo) {
        super.onInitializeAccessibilityNodeInfo(accessibilityNodeInfo);
        z8.a aVar = this.badgeDrawable;
        if (aVar != null && aVar.isVisible()) {
            k.r rVar = this.itemData;
            CharSequence charSequence = rVar.f28912e;
            if (!TextUtils.isEmpty(rVar.f28924q)) {
                charSequence = this.itemData.f28924q;
            }
            accessibilityNodeInfo.setContentDescription(((Object) charSequence) + ", " + ((Object) this.badgeDrawable.getContentDescription()));
        }
        q0.f fVar = new q0.f(accessibilityNodeInfo);
        fVar.l(q0.d.a(0, 1, getItemVisiblePosition(), 1, false, isSelected()));
        if (isSelected()) {
            accessibilityNodeInfo.setClickable(false);
            fVar.h(q0.c.f32061g);
        }
        fVar.setRoleDescription(getResources().getString(x8.k.item_view_role_description));
    }

    @Override // android.view.View
    public final void onSizeChanged(int i10, int i11, int i12, int i13) {
        super.onSizeChanged(i10, i11, i12, i13);
        post(new y3.s(i10, 4, this));
    }

    public void setActiveIndicatorDrawable(@Nullable Drawable drawable) {
        this.T.setBackground(drawable);
        e();
    }

    public void setActiveIndicatorEnabled(boolean z10) {
        this.f22881p0 = z10;
        e();
        this.T.setVisibility(z10 ? 0 : 8);
        requestLayout();
    }

    public void setActiveIndicatorExpandedHeight(int i10) {
        this.f22885t0 = i10;
        l(getWidth());
    }

    public void setActiveIndicatorExpandedMarginHorizontal(@Px int i10) {
        this.f22888w0 = i10;
        if (this.f22889x0 == 1) {
            setPadding(i10, 0, i10, 0);
        }
        l(getWidth());
    }

    public void setActiveIndicatorExpandedPadding(@NonNull Rect rect) {
        this.E0 = rect;
    }

    public void setActiveIndicatorExpandedWidth(int i10) {
        this.f22884s0 = i10;
        l(getWidth());
    }

    public void setActiveIndicatorHeight(int i10) {
        this.f22883r0 = i10;
        l(getWidth());
    }

    public void setActiveIndicatorLabelPadding(int i10) {
        if (this.f22861e != i10) {
            this.f22861e = i10;
            ((LinearLayout.LayoutParams) this.W.getLayoutParams()).topMargin = i10;
            if (this.f22858c0.getLayoutParams() != null) {
                LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) this.f22858c0.getLayoutParams();
                layoutParams.rightMargin = getLayoutDirection() == 1 ? i10 : 0;
                if (getLayoutDirection() == 1) {
                    i10 = 0;
                }
                layoutParams.leftMargin = i10;
                requestLayout();
            }
        }
    }

    public void setActiveIndicatorMarginHorizontal(@Px int i10) {
        this.f22887v0 = i10;
        l(getWidth());
    }

    public void setActiveIndicatorResizeable(boolean z10) {
        this.f22886u0 = z10;
    }

    public void setActiveIndicatorWidth(int i10) {
        this.f22882q0 = i10;
        l(getWidth());
    }

    public void setBadge(@NonNull z8.a aVar) {
        z8.a aVar2 = this.badgeDrawable;
        if (aVar2 == aVar) {
            return;
        }
        boolean z10 = aVar2 != null;
        ImageView imageView = this.V;
        if (z10 && imageView != null) {
            tryRemoveBadgeFromAnchor(imageView);
        }
        this.badgeDrawable = aVar;
        int i10 = this.f22890y0;
        z8.c cVar = aVar.f37076e;
        if (cVar.f37112l != i10) {
            cVar.f37112l = i10;
            aVar.h();
        }
        if (imageView != null) {
            tryAttachBadgeToAnchor(imageView);
        }
    }

    public void setCheckable(boolean z10) {
        refreshDrawableState();
    }

    public void setChecked(boolean z10) {
        TextView textView = this.f22856b0;
        setLabelPivots(textView);
        TextView textView2 = this.f22854a0;
        setLabelPivots(textView2);
        setLabelPivots(this.f22862e0);
        setLabelPivots(this.f22860d0);
        float f10 = z10 ? 1.0f : 0.0f;
        if (this.f22881p0 && this.f22853a && isAttachedToWindow()) {
            ValueAnimator valueAnimator = this.f22878m0;
            if (valueAnimator != null) {
                valueAnimator.cancel();
                this.f22878m0 = null;
            }
            ValueAnimator valueAnimatorOfFloat = ValueAnimator.ofFloat(this.f22880o0, f10);
            this.f22878m0 = valueAnimatorOfFloat;
            valueAnimatorOfFloat.addUpdateListener(new d(this, f10));
            this.f22878m0.setInterpolator(com.bumptech.glide.f.p(getContext(), x8.c.motionEasingEmphasizedInterpolator, y8.a.f36865b));
            this.f22878m0.setDuration(com.bumptech.glide.f.o(getContext(), x8.c.motionDurationLong2, getResources().getInteger(x8.h.material_motion_duration_long_1)));
            this.f22878m0.start();
        } else {
            f(f10, f10);
        }
        float f11 = this.f22865g;
        float f12 = this.f22867h;
        float f13 = this.f22869i;
        if (this.f22889x0 == 1) {
            textView = this.f22862e0;
            textView2 = this.f22860d0;
            f11 = this.f22871j;
            f12 = this.f22873k;
            f13 = this.f22875l;
        }
        int i10 = this.f22877m;
        if (i10 != -1) {
            if (i10 != 0) {
                if (i10 != 1) {
                    if (i10 == 2) {
                        i();
                    }
                } else if (z10) {
                    h(textView, textView2, f12, f11);
                } else {
                    h(textView2, textView, f13, 0.0f);
                }
            } else if (z10) {
                h(textView, textView2, f12, 0.0f);
            } else {
                i();
            }
        } else if (this.Q) {
            if (z10) {
                h(textView, textView2, f12, 0.0f);
            } else {
                i();
            }
        } else if (z10) {
            h(textView, textView2, f12, f11);
        } else {
            h(textView2, textView, f13, 0.0f);
        }
        refreshDrawableState();
        setSelected(z10);
    }

    @Override // android.view.View
    public void setEnabled(boolean z10) {
        super.setEnabled(z10);
        this.f22854a0.setEnabled(z10);
        this.f22856b0.setEnabled(z10);
        this.f22860d0.setEnabled(z10);
        this.f22862e0.setEnabled(z10);
        this.V.setEnabled(z10);
    }

    @Override // com.google.android.material.navigation.h
    public void setExpanded(boolean z10) {
        this.A0 = z10;
        m();
    }

    public void setHorizontalTextAppearanceActive(@StyleRes int i10) {
        this.f22872j0 = i10;
        TextView textView = this.f22862e0;
        if (i10 == 0) {
            i10 = this.f22868h0;
        }
        updateActiveLabelTextAppearance(textView, i10);
    }

    public void setHorizontalTextAppearanceInactive(@StyleRes int i10) {
        this.f22874k0 = i10;
        TextView textView = this.f22860d0;
        if (i10 == 0) {
            i10 = this.f22870i0;
        }
        updateInactiveLabelTextAppearance(textView, i10);
    }

    public void setIcon(@Nullable Drawable drawable) {
        if (drawable == this.originalIconDrawable) {
            return;
        }
        this.originalIconDrawable = drawable;
        if (drawable != null) {
            Drawable.ConstantState constantState = drawable.getConstantState();
            if (constantState != null) {
                drawable = constantState.newDrawable();
            }
            drawable = drawable.mutate();
            this.wrappedIconDrawable = drawable;
            ColorStateList colorStateList = this.iconTint;
            if (colorStateList != null) {
                drawable.setTintList(colorStateList);
            }
        }
        this.V.setImageDrawable(drawable);
    }

    public void setIconLabelHorizontalSpacing(int i10) {
        if (this.f22863f != i10) {
            this.f22863f = i10;
            g();
            requestLayout();
        }
    }

    public void setIconSize(int i10) {
        ImageView imageView = this.V;
        LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) imageView.getLayoutParams();
        layoutParams.width = i10;
        layoutParams.height = i10;
        imageView.setLayoutParams(layoutParams);
        g();
    }

    public void setIconTintList(@Nullable ColorStateList colorStateList) {
        Drawable drawable;
        this.iconTint = colorStateList;
        if (this.itemData == null || (drawable = this.wrappedIconDrawable) == null) {
            return;
        }
        drawable.setTintList(colorStateList);
        this.wrappedIconDrawable.invalidateSelf();
    }

    public void setItemBackground(int i10) {
        setItemBackground(i10 == 0 ? null : getContext().getDrawable(i10));
    }

    public void setItemGravity(int i10) {
        this.z0 = i10;
        requestLayout();
    }

    public void setItemIconGravity(int i10) {
        int i11;
        int i12;
        int i13;
        int i14;
        int i15;
        int i16;
        if (this.f22889x0 != i10) {
            this.f22889x0 = i10;
            this.f22890y0 = 0;
            BaselineLayout baselineLayout = this.W;
            this.f22864f0 = baselineLayout;
            LinearLayout linearLayout = this.S;
            int i17 = 8;
            if (i10 == 1) {
                if (this.f22858c0.getParent() == null) {
                    LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(-2, -2);
                    layoutParams.gravity = 17;
                    linearLayout.addView(this.f22858c0, layoutParams);
                    g();
                }
                Rect rect = this.E0;
                int i18 = rect.left;
                int i19 = rect.right;
                int i20 = rect.top;
                i11 = rect.bottom;
                this.f22890y0 = 1;
                int i21 = this.f22888w0;
                this.f22864f0 = this.f22858c0;
                i15 = i20;
                i14 = i19;
                i13 = i18;
                i12 = i21;
                i16 = 0;
            } else {
                i11 = 0;
                i12 = 0;
                i13 = 0;
                i14 = 0;
                i15 = 0;
                i16 = 8;
                i17 = 0;
            }
            baselineLayout.setVisibility(i17);
            this.f22858c0.setVisibility(i16);
            ((FrameLayout.LayoutParams) this.R.getLayoutParams()).gravity = this.z0;
            FrameLayout.LayoutParams layoutParams2 = (FrameLayout.LayoutParams) linearLayout.getLayoutParams();
            layoutParams2.leftMargin = i13;
            layoutParams2.rightMargin = i14;
            layoutParams2.topMargin = i15;
            layoutParams2.bottomMargin = i11;
            setPadding(i12, 0, i12, 0);
            l(getWidth());
            e();
        }
    }

    public void setItemPaddingBottom(int i10) {
        if (this.f22859d != i10) {
            this.f22859d = i10;
            k.r rVar = this.itemData;
            if (rVar != null) {
                setChecked(rVar.isChecked());
            }
        }
    }

    public void setItemPaddingTop(int i10) {
        if (this.f22857c != i10) {
            this.f22857c = i10;
            k.r rVar = this.itemData;
            if (rVar != null) {
                setChecked(rVar.isChecked());
            }
        }
    }

    public void setItemPosition(int i10) {
        this.f22866g0 = i10;
    }

    public void setItemRippleColor(@Nullable ColorStateList colorStateList) {
        this.f22855b = colorStateList;
        e();
    }

    public void setLabelFontScalingEnabled(boolean z10) {
        this.D0 = z10;
        setTextAppearanceActive(this.f22868h0);
        setTextAppearanceInactive(this.f22870i0);
        setHorizontalTextAppearanceActive(this.f22872j0);
        setHorizontalTextAppearanceInactive(this.f22874k0);
    }

    public void setLabelMaxLines(int i10) {
        TextView textView = this.f22854a0;
        textView.setMaxLines(i10);
        TextView textView2 = this.f22856b0;
        textView2.setMaxLines(i10);
        this.f22860d0.setMaxLines(i10);
        this.f22862e0.setMaxLines(i10);
        if (Build.VERSION.SDK_INT > 34) {
            textView.setGravity(17);
            textView2.setGravity(17);
        } else if (i10 > 1) {
            textView.setEllipsize(null);
            textView2.setEllipsize(null);
            textView.setGravity(17);
            textView2.setGravity(17);
        } else {
            textView.setGravity(16);
            textView2.setGravity(16);
        }
        requestLayout();
    }

    public void setLabelVisibilityMode(int i10) {
        if (this.f22877m != i10) {
            this.f22877m = i10;
            if (this.f22886u0 && i10 == 2) {
                this.f22879n0 = H0;
            } else {
                this.f22879n0 = G0;
            }
            l(getWidth());
            k.r rVar = this.itemData;
            if (rVar != null) {
                setChecked(rVar.isChecked());
            }
        }
    }

    public void setMeasureBottomPaddingFromLabelBaseline(boolean z10) {
        this.C0 = z10;
        this.W.setMeasurePaddingFromBaseline(z10);
        this.f22854a0.setIncludeFontPadding(z10);
        this.f22856b0.setIncludeFontPadding(z10);
        this.f22858c0.setMeasurePaddingFromBaseline(z10);
        this.f22860d0.setIncludeFontPadding(z10);
        this.f22862e0.setIncludeFontPadding(z10);
        requestLayout();
    }

    @Override // com.google.android.material.navigation.h
    public void setOnlyShowWhenExpanded(boolean z10) {
        this.B0 = z10;
        m();
    }

    public void setShifting(boolean z10) {
        if (this.Q != z10) {
            this.Q = z10;
            k.r rVar = this.itemData;
            if (rVar != null) {
                setChecked(rVar.isChecked());
            }
        }
    }

    public void setShortcut(boolean z10, char c6) {
    }

    public void setTextAppearanceActive(@StyleRes int i10) {
        this.f22868h0 = i10;
        updateActiveLabelTextAppearance(this.f22856b0, i10);
    }

    public void setTextAppearanceActiveBoldEnabled(boolean z10) {
        this.f22876l0 = z10;
        setTextAppearanceActive(this.f22868h0);
        setHorizontalTextAppearanceActive(this.f22872j0);
        TextView textView = this.f22856b0;
        textView.setTypeface(textView.getTypeface(), this.f22876l0 ? 1 : 0);
        TextView textView2 = this.f22862e0;
        textView2.setTypeface(textView2.getTypeface(), this.f22876l0 ? 1 : 0);
    }

    public void setTextAppearanceInactive(@StyleRes int i10) {
        this.f22870i0 = i10;
        updateInactiveLabelTextAppearance(this.f22854a0, i10);
    }

    public void setTextColor(@Nullable ColorStateList colorStateList) {
        this.textColor = colorStateList;
        if (colorStateList != null) {
            this.f22854a0.setTextColor(colorStateList);
            this.f22856b0.setTextColor(colorStateList);
            this.f22860d0.setTextColor(colorStateList);
            this.f22862e0.setTextColor(colorStateList);
        }
    }

    public void setTitle(@Nullable CharSequence charSequence) {
        this.f22854a0.setText(charSequence);
        this.f22856b0.setText(charSequence);
        this.f22860d0.setText(charSequence);
        this.f22862e0.setText(charSequence);
        k.r rVar = this.itemData;
        if (rVar == null || TextUtils.isEmpty(rVar.f28924q)) {
            setContentDescription(charSequence);
        }
        k.r rVar2 = this.itemData;
        if (rVar2 != null && !TextUtils.isEmpty(rVar2.f28925r)) {
            charSequence = this.itemData.f28925r;
        }
        y3.setTooltipText(this, charSequence);
    }

    public void setItemBackground(@Nullable Drawable drawable) {
        if (drawable != null && drawable.getConstantState() != null) {
            drawable = drawable.getConstantState().newDrawable().mutate();
        }
        this.itemBackground = drawable;
        e();
    }
}
