package com.google.android.material.progressindicator;

import M.J;
import O3.f;
import android.content.Context;
import android.util.AttributeSet;
import java.lang.reflect.Field;
import t3.AbstractC1541d;
import t3.C1543f;
import t3.C1547j;
import t3.C1548k;
import t3.C1549l;
import t3.C1550m;
import t3.C1551n;

/* JADX INFO: loaded from: classes.dex */
public final class LinearProgressIndicator extends AbstractC1541d {
    public LinearProgressIndicator(Context context, AttributeSet attributeSet) {
        super(context, attributeSet);
        Context context2 = getContext();
        C1551n c1551n = this.f16964q;
        C1548k c1548k = new C1548k(c1551n);
        f c1549l = c1551n.f17021g == 0 ? new C1549l(c1551n) : new C1550m(context2, c1551n);
        C1547j c1547j = new C1547j(context2, c1551n);
        c1547j.f16994B = c1548k;
        c1548k.f16993b = c1547j;
        c1547j.f16995C = c1549l;
        c1549l.f5147a = c1547j;
        setIndeterminateDrawable(c1547j);
        setProgressDrawable(new C1543f(getContext(), c1551n, new C1548k(c1551n)));
    }

    @Override // t3.AbstractC1541d
    public final void a(int i) {
        C1551n c1551n = this.f16964q;
        if (c1551n != null && c1551n.f17021g == 0 && isIndeterminate()) {
            return;
        }
        super.a(i);
    }

    public int getIndeterminateAnimationType() {
        return this.f16964q.f17021g;
    }

    public int getIndicatorDirection() {
        return this.f16964q.f17022h;
    }

    @Override // android.view.View
    public final void onLayout(boolean z8, int i, int i5, int i8, int i9) {
        super.onLayout(z8, i, i5, i8, i9);
        C1551n c1551n = this.f16964q;
        boolean z9 = true;
        if (c1551n.f17022h != 1) {
            Field field = J.f4065a;
            if ((getLayoutDirection() != 1 || c1551n.f17022h != 2) && (getLayoutDirection() != 0 || c1551n.f17022h != 3)) {
                z9 = false;
            }
        }
        c1551n.i = z9;
    }

    @Override // android.widget.ProgressBar, android.view.View
    public final void onSizeChanged(int i, int i5, int i8, int i9) {
        int paddingRight = i - (getPaddingRight() + getPaddingLeft());
        int paddingBottom = i5 - (getPaddingBottom() + getPaddingTop());
        C1547j indeterminateDrawable = getIndeterminateDrawable();
        if (indeterminateDrawable != null) {
            indeterminateDrawable.setBounds(0, 0, paddingRight, paddingBottom);
        }
        C1543f progressDrawable = getProgressDrawable();
        if (progressDrawable != null) {
            progressDrawable.setBounds(0, 0, paddingRight, paddingBottom);
        }
    }

    public void setIndeterminateAnimationType(int i) {
        C1551n c1551n = this.f16964q;
        if (c1551n.f17021g == i) {
            return;
        }
        if (b() && isIndeterminate()) {
            throw new IllegalStateException("Cannot change indeterminate animation type while the progress indicator is show in indeterminate mode.");
        }
        c1551n.f17021g = i;
        c1551n.a();
        if (i == 0) {
            C1547j indeterminateDrawable = getIndeterminateDrawable();
            C1549l c1549l = new C1549l(c1551n);
            indeterminateDrawable.f16995C = c1549l;
            c1549l.f5147a = indeterminateDrawable;
        } else {
            C1547j indeterminateDrawable2 = getIndeterminateDrawable();
            C1550m c1550m = new C1550m(getContext(), c1551n);
            indeterminateDrawable2.f16995C = c1550m;
            c1550m.f5147a = indeterminateDrawable2;
        }
        invalidate();
    }

    @Override // t3.AbstractC1541d
    public void setIndicatorColor(int... iArr) {
        super.setIndicatorColor(iArr);
        this.f16964q.a();
    }

    public void setIndicatorDirection(int i) {
        C1551n c1551n = this.f16964q;
        c1551n.f17022h = i;
        boolean z8 = true;
        if (i != 1) {
            Field field = J.f4065a;
            if ((getLayoutDirection() != 1 || c1551n.f17022h != 2) && (getLayoutDirection() != 0 || i != 3)) {
                z8 = false;
            }
        }
        c1551n.i = z8;
        invalidate();
    }

    @Override // t3.AbstractC1541d
    public void setTrackCornerRadius(int i) {
        super.setTrackCornerRadius(i);
        this.f16964q.a();
        invalidate();
    }
}
