package o; import android.graphics.Canvas; import android.widget.EdgeEffect; import androidx.core.view.ViewCompat; import androidx.recyclerview.widget.RecyclerView; import com.google.android.gms.maps.model.BitmapDescriptorFactory; /* loaded from: classes2.dex */ public abstract class EKR extends RecyclerView.ZqN { EdgeEffect a; public RecyclerView b; int c; int d; EdgeEffect e; public boolean i; protected abstract int b(int i); public EKR(RecyclerView recyclerView) { this.b = recyclerView; } @Override // androidx.recyclerview.widget.RecyclerView.ZqN public final void NS_(Canvas canvas, RecyclerView recyclerView, RecyclerView.AcL acL) { EdgeEffect edgeEffect = this.e; boolean NO_ = edgeEffect != null ? NO_(canvas, recyclerView, this.c, edgeEffect) : false; EdgeEffect edgeEffect2 = this.a; if (edgeEffect2 != null) { NO_ |= NO_(canvas, recyclerView, this.d, edgeEffect2); } if (NO_) { ViewCompat.N(recyclerView); } } private static boolean NO_(Canvas canvas, RecyclerView recyclerView, int i, EdgeEffect edgeEffect) { boolean z = false; if (edgeEffect.isFinished()) { return false; } int save = canvas.save(); RecyclerView recyclerView2 = recyclerView.x.s; if (recyclerView2 != null && recyclerView2.m) { z = true; } if (i == 0) { canvas.rotate(-90.0f); if (z) { canvas.translate((-recyclerView.getHeight()) + recyclerView.getPaddingTop(), recyclerView.getPaddingLeft()); } else { canvas.translate(-recyclerView.getHeight(), BitmapDescriptorFactory.HUE_RED); } } else if (i != 1) { if (i == 2) { canvas.rotate(90.0f); if (z) { canvas.translate(recyclerView.getPaddingTop(), (-recyclerView.getWidth()) + recyclerView.getPaddingRight()); } else { canvas.translate(BitmapDescriptorFactory.HUE_RED, -recyclerView.getWidth()); } } else if (i == 3) { canvas.rotate(180.0f); if (z) { canvas.translate((-recyclerView.getWidth()) + recyclerView.getPaddingRight(), (-recyclerView.getHeight()) + recyclerView.getPaddingBottom()); } else { canvas.translate(-recyclerView.getWidth(), -recyclerView.getHeight()); } } } else if (z) { canvas.translate(recyclerView.getPaddingLeft(), recyclerView.getPaddingTop()); } boolean draw = edgeEffect.draw(canvas); canvas.restoreToCount(save); return draw; } public final void d() { if (this.i) { return; } this.c = b(0); this.d = b(1); this.b.d(this, -1); this.i = true; } public final void a() { boolean z; EdgeEffect edgeEffect = this.e; if (edgeEffect != null) { edgeEffect.onRelease(); z = this.e.isFinished(); } else { z = false; } EdgeEffect edgeEffect2 = this.a; if (edgeEffect2 != null) { edgeEffect2.onRelease(); z |= this.a.isFinished(); } if (z) { ViewCompat.N(this.b); } } /* JADX INFO: Access modifiers changed from: package-private */ public static void NP_(RecyclerView recyclerView, EdgeEffect edgeEffect, int i) { int measuredWidth = recyclerView.getMeasuredWidth(); int measuredHeight = recyclerView.getMeasuredHeight(); RecyclerView recyclerView2 = recyclerView.x.s; if (recyclerView2 != null && recyclerView2.m) { measuredWidth -= recyclerView.getPaddingLeft() + recyclerView.getPaddingRight(); measuredHeight -= recyclerView.getPaddingTop() + recyclerView.getPaddingBottom(); } int max = Math.max(0, measuredWidth); int max2 = Math.max(0, measuredHeight); if (i == 0 || i == 2) { max = max2; max2 = max; } edgeEffect.setSize(max, max2); } }