package androidx.constraintlayout.helper.widget;

import a0.b0;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import androidx.constraintlayout.motion.widget.MotionHelper;
import androidx.constraintlayout.motion.widget.MotionLayout;
import androidx.constraintlayout.motion.widget.c;
import androidx.constraintlayout.widget.s;
import java.util.ArrayList;

/* JADX INFO: loaded from: classes.dex */
public class Carousel extends MotionHelper {
    public final ArrayList Q;
    public int R;
    public MotionLayout S;
    public int T;
    public boolean U;
    public int V;
    public int W;

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

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

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

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

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

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

    public Carousel(Context context) {
        super(context);
        this.Q = new ArrayList();
        this.R = 0;
        this.T = -1;
        this.U = false;
        this.V = -1;
        this.W = -1;
        this.f1055a0 = -1;
        this.f1056b0 = -1;
        this.f1057c0 = 0.9f;
        this.f1058d0 = 4;
        this.f1059e0 = 1;
        this.f1060f0 = 2.0f;
    }

    @Override // androidx.constraintlayout.motion.widget.MotionHelper, a0.x
    public final void a(int i10) {
        int i11 = this.R;
        if (i10 == this.f1056b0) {
            this.R = i11 + 1;
        } else if (i10 == this.f1055a0) {
            this.R = i11 - 1;
        }
        if (!this.U) {
            throw null;
        }
        throw null;
    }

    @Override // androidx.constraintlayout.motion.widget.MotionHelper, a0.x
    public final void b() {
    }

    public int getCount() {
        return 0;
    }

    public int getCurrentIndex() {
        return this.R;
    }

    @Override // androidx.constraintlayout.widget.ConstraintHelper, android.view.View
    public final void onAttachedToWindow() {
        c cVar;
        c cVar2;
        super.onAttachedToWindow();
        if (getParent() instanceof MotionLayout) {
            MotionLayout motionLayout = (MotionLayout) getParent();
            ArrayList arrayList = this.Q;
            arrayList.clear();
            for (int i10 = 0; i10 < this.f1268b; i10++) {
                arrayList.add(motionLayout.getViewById(this.f1267a[i10]));
            }
            this.S = motionLayout;
            if (this.f1059e0 == 2) {
                b0 b0VarN = motionLayout.n(this.W);
                if (b0VarN != null && (cVar2 = b0VarN.f19l) != null) {
                    cVar2.f1155c = 5;
                }
                b0 b0VarN2 = this.S.n(this.V);
                if (b0VarN2 == null || (cVar = b0VarN2.f19l) == null) {
                    return;
                }
                cVar.f1155c = 5;
            }
        }
    }

    @Override // android.view.View
    public final void onDetachedFromWindow() {
        super.onDetachedFromWindow();
        this.Q.clear();
    }

    public void setAdapter(y.c cVar) {
    }

    public void setInfinite(boolean z10) {
        this.U = z10;
    }

    public final void t(Context context, AttributeSet attributeSet) {
        if (attributeSet != null) {
            TypedArray typedArrayObtainStyledAttributes = context.obtainStyledAttributes(attributeSet, s.Carousel);
            int indexCount = typedArrayObtainStyledAttributes.getIndexCount();
            for (int i10 = 0; i10 < indexCount; i10++) {
                int index = typedArrayObtainStyledAttributes.getIndex(i10);
                if (index == s.Carousel_carousel_firstView) {
                    this.T = typedArrayObtainStyledAttributes.getResourceId(index, this.T);
                } else if (index == s.Carousel_carousel_backwardTransition) {
                    this.V = typedArrayObtainStyledAttributes.getResourceId(index, this.V);
                } else if (index == s.Carousel_carousel_forwardTransition) {
                    this.W = typedArrayObtainStyledAttributes.getResourceId(index, this.W);
                } else if (index == s.Carousel_carousel_emptyViewsBehavior) {
                    this.f1058d0 = typedArrayObtainStyledAttributes.getInt(index, this.f1058d0);
                } else if (index == s.Carousel_carousel_previousState) {
                    this.f1055a0 = typedArrayObtainStyledAttributes.getResourceId(index, this.f1055a0);
                } else if (index == s.Carousel_carousel_nextState) {
                    this.f1056b0 = typedArrayObtainStyledAttributes.getResourceId(index, this.f1056b0);
                } else if (index == s.Carousel_carousel_touchUp_dampeningFactor) {
                    this.f1057c0 = typedArrayObtainStyledAttributes.getFloat(index, this.f1057c0);
                } else if (index == s.Carousel_carousel_touchUpMode) {
                    this.f1059e0 = typedArrayObtainStyledAttributes.getInt(index, this.f1059e0);
                } else if (index == s.Carousel_carousel_touchUp_velocityThreshold) {
                    this.f1060f0 = typedArrayObtainStyledAttributes.getFloat(index, this.f1060f0);
                } else if (index == s.Carousel_carousel_infinite) {
                    this.U = typedArrayObtainStyledAttributes.getBoolean(index, this.U);
                }
            }
            typedArrayObtainStyledAttributes.recycle();
        }
    }

    public Carousel(Context context, AttributeSet attributeSet) {
        super(context, attributeSet);
        this.Q = new ArrayList();
        this.R = 0;
        this.T = -1;
        this.U = false;
        this.V = -1;
        this.W = -1;
        this.f1055a0 = -1;
        this.f1056b0 = -1;
        this.f1057c0 = 0.9f;
        this.f1058d0 = 4;
        this.f1059e0 = 1;
        this.f1060f0 = 2.0f;
        t(context, attributeSet);
    }

    public Carousel(Context context, AttributeSet attributeSet, int i10) {
        super(context, attributeSet, i10);
        this.Q = new ArrayList();
        this.R = 0;
        this.T = -1;
        this.U = false;
        this.V = -1;
        this.W = -1;
        this.f1055a0 = -1;
        this.f1056b0 = -1;
        this.f1057c0 = 0.9f;
        this.f1058d0 = 4;
        this.f1059e0 = 1;
        this.f1060f0 = 2.0f;
        t(context, attributeSet);
    }
}
