package p9;

import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.util.TypedValue;
import androidx.annotation.AttrRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.StyleRes;
import com.google.android.material.internal.q0;
import com.google.android.material.progressindicator.LinearProgressIndicator;

/* JADX INFO: loaded from: classes2.dex */
public final class v extends d {

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

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

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

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

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

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

    @Nullable
    public Integer trackStopIndicatorPadding;

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

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

    public v(@NonNull Context context, @Nullable AttributeSet attributeSet) {
        this(context, attributeSet, x8.c.linearProgressIndicatorStyle);
    }

    @Override // p9.d
    public final boolean c() {
        return super.c() && e() == a();
    }

    @Override // p9.d
    public final void d() {
        super.d();
        if (this.f31913r < 0) {
            throw new IllegalArgumentException("Stop indicator size must be >= 0.");
        }
        if (this.f31910o == 0) {
            if ((a() > 0 || (this.f31917v && e() > 0)) && this.f31794i == 0) {
                throw new IllegalArgumentException("Rounded corners without gap are not supported in contiguous indeterminate animation.");
            }
            if (this.f31790e.length < 3) {
                throw new IllegalArgumentException("Contiguous indeterminate animation must be used with 3 or more indicator colors.");
            }
        }
    }

    public final int e() {
        return !this.f31917v ? a() : this.f31916u ? (int) (this.f31786a * this.f31915t) : this.f31914s;
    }

    public v(@NonNull Context context, @Nullable AttributeSet attributeSet, @AttrRes int i10) {
        this(context, attributeSet, i10, LinearProgressIndicator.R);
    }

    public v(@NonNull Context context, @Nullable AttributeSet attributeSet, @AttrRes int i10, @StyleRes int i11) {
        super(context, attributeSet, i10, i11);
        TypedArray typedArrayC = q0.c(context, attributeSet, x8.m.LinearProgressIndicator, x8.c.linearProgressIndicatorStyle, LinearProgressIndicator.R, new int[0]);
        this.f31910o = typedArrayC.getInt(x8.m.LinearProgressIndicator_indeterminateAnimationType, 1);
        this.f31911p = typedArrayC.getInt(x8.m.LinearProgressIndicator_indicatorDirectionLinear, 0);
        this.f31913r = Math.min(typedArrayC.getDimensionPixelSize(x8.m.LinearProgressIndicator_trackStopIndicatorSize, 0), this.f31786a);
        int i12 = x8.m.LinearProgressIndicator_trackStopIndicatorPadding;
        if (typedArrayC.hasValue(i12)) {
            this.trackStopIndicatorPadding = Integer.valueOf(typedArrayC.getDimensionPixelSize(i12, 0));
        }
        TypedValue typedValuePeekValue = typedArrayC.peekValue(x8.m.LinearProgressIndicator_trackInnerCornerRadius);
        if (typedValuePeekValue != null) {
            int i13 = typedValuePeekValue.type;
            if (i13 == 5) {
                this.f31914s = Math.min(TypedValue.complexToDimensionPixelSize(typedValuePeekValue.data, typedArrayC.getResources().getDisplayMetrics()), this.f31786a / 2);
                this.f31916u = false;
                this.f31917v = true;
            } else if (i13 == 6) {
                this.f31915t = Math.min(typedValuePeekValue.getFraction(1.0f, 1.0f), 0.5f);
                this.f31916u = true;
                this.f31917v = true;
            }
        }
        typedArrayC.recycle();
        d();
        this.f31912q = this.f31911p == 1;
    }
}
