package androidx.recyclerview.widget;

import android.graphics.Rect;
import java.util.WeakHashMap;

/* JADX INFO: loaded from: classes.dex */
public final class d0 implements Runnable {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final /* synthetic */ n0 f3690a;

    public d0(n0 n0Var) {
        this.f3690a = n0Var;
    }

    /* JADX WARN: Removed duplicated region for block: B:22:0x0078  */
    /* JADX WARN: Removed duplicated region for block: B:34:0x00bf  */
    @Override // java.lang.Runnable
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final void run() {
        int iD;
        int iD2;
        n0 n0Var = this.f3690a;
        if (n0Var.f3792c != null) {
            long jCurrentTimeMillis = System.currentTimeMillis();
            long j10 = n0Var.C;
            long j11 = j10 == Long.MIN_VALUE ? 0L : jCurrentTimeMillis - j10;
            q1 layoutManager = n0Var.f3807r.getLayoutManager();
            if (n0Var.B == null) {
                n0Var.B = new Rect();
            }
            layoutManager.calculateItemDecorationsForChild(n0Var.f3792c.itemView, n0Var.B);
            if (layoutManager.canScrollHorizontally()) {
                int i10 = (int) (n0Var.f3799j + n0Var.f3797h);
                iD = (i10 - n0Var.B.left) - n0Var.f3807r.getPaddingLeft();
                float f10 = n0Var.f3797h;
                if ((f10 >= 0.0f || iD >= 0) && (f10 <= 0.0f || (iD = ((n0Var.f3792c.itemView.getWidth() + i10) + n0Var.B.right) - (n0Var.f3807r.getWidth() - n0Var.f3807r.getPaddingRight())) <= 0)) {
                    iD = 0;
                }
            }
            if (layoutManager.canScrollVertically()) {
                int i11 = (int) (n0Var.f3800k + n0Var.f3798i);
                int paddingTop = (i11 - n0Var.B.top) - n0Var.f3807r.getPaddingTop();
                float f11 = n0Var.f3798i;
                iD2 = ((f11 >= 0.0f || paddingTop >= 0) && (f11 <= 0.0f || (paddingTop = ((n0Var.f3792c.itemView.getHeight() + i11) + n0Var.B.bottom) - (n0Var.f3807r.getHeight() - n0Var.f3807r.getPaddingBottom())) <= 0)) ? 0 : paddingTop;
            }
            if (iD != 0) {
                h0 h0Var = n0Var.f3802m;
                RecyclerView recyclerView = n0Var.f3807r;
                int width = n0Var.f3792c.itemView.getWidth();
                n0Var.f3807r.getWidth();
                iD = h0Var.d(recyclerView, width, iD, j11);
            }
            int i12 = iD;
            if (iD2 != 0) {
                h0 h0Var2 = n0Var.f3802m;
                RecyclerView recyclerView2 = n0Var.f3807r;
                int height = n0Var.f3792c.itemView.getHeight();
                n0Var.f3807r.getHeight();
                iD2 = h0Var2.d(recyclerView2, height, iD2, j11);
            }
            if (i12 == 0 && iD2 == 0) {
                n0Var.C = Long.MIN_VALUE;
                return;
            }
            if (n0Var.C == Long.MIN_VALUE) {
                n0Var.C = jCurrentTimeMillis;
            }
            n0Var.f3807r.scrollBy(i12, iD2);
            j2 j2Var = n0Var.f3792c;
            if (j2Var != null) {
                n0Var.m(j2Var);
            }
            n0Var.f3807r.removeCallbacks(n0Var.f3808s);
            RecyclerView recyclerView3 = n0Var.f3807r;
            WeakHashMap weakHashMap = androidx.core.view.s1.f1815a;
            recyclerView3.postOnAnimation(this);
        }
    }
}
