package androidx.recyclerview.widget;

import android.view.View;
import java.util.List;

/* JADX INFO: loaded from: classes.dex */
public final class r0 {

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

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

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

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

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

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

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

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

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

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

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

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

    public final void a(View view) {
        int viewLayoutPosition;
        int size = this.f3881k.size();
        View view2 = null;
        int i10 = Integer.MAX_VALUE;
        for (int i11 = 0; i11 < size; i11++) {
            View view3 = ((j2) this.f3881k.get(i11)).itemView;
            r1 r1Var = (r1) view3.getLayoutParams();
            if (view3 != view && !r1Var.isItemRemoved() && (viewLayoutPosition = (r1Var.getViewLayoutPosition() - this.f3874d) * this.f3875e) >= 0 && viewLayoutPosition < i10) {
                view2 = view3;
                if (viewLayoutPosition == 0) {
                    break;
                } else {
                    i10 = viewLayoutPosition;
                }
            }
        }
        if (view2 == null) {
            this.f3874d = -1;
        } else {
            this.f3874d = ((r1) view2.getLayoutParams()).getViewLayoutPosition();
        }
    }

    public final View b(y1 y1Var) {
        List list = this.f3881k;
        if (list == null) {
            View viewD = y1Var.d(this.f3874d);
            this.f3874d += this.f3875e;
            return viewD;
        }
        int size = list.size();
        for (int i10 = 0; i10 < size; i10++) {
            View view = ((j2) this.f3881k.get(i10)).itemView;
            r1 r1Var = (r1) view.getLayoutParams();
            if (!r1Var.isItemRemoved() && this.f3874d == r1Var.getViewLayoutPosition()) {
                a(view);
                return view;
            }
        }
        return null;
    }
}
