package o; import android.graphics.Point; import android.graphics.PointF; import android.graphics.RectF; import android.view.GestureDetector; import android.view.MotionEvent; import android.view.ScaleGestureDetector; import android.view.View; import com.github.barteksc.pdfviewer.PDFView; import com.google.android.gms.maps.model.BitmapDescriptorFactory; import com.shockwave.pdfium.PdfiumCore; import java.util.Iterator; import o.C12960fMh; /* loaded from: classes.dex */ public final class xFW implements GestureDetector.OnGestureListener, GestureDetector.OnDoubleTapListener, ScaleGestureDetector.OnScaleGestureListener, View.OnTouchListener { private C1641aJz a; private GestureDetector b; private PDFView c; private ScaleGestureDetector d; private boolean h = false; private boolean f = false; public boolean e = false; @Override // android.view.GestureDetector.OnDoubleTapListener public final boolean onDoubleTapEvent(MotionEvent motionEvent) { return false; } @Override // android.view.GestureDetector.OnGestureListener public final void onShowPress(MotionEvent motionEvent) { } @Override // android.view.GestureDetector.OnGestureListener public final boolean onSingleTapUp(MotionEvent motionEvent) { return false; } public xFW(PDFView pDFView, C1641aJz c1641aJz) { this.c = pDFView; this.a = c1641aJz; this.b = new GestureDetector(pDFView.getContext(), this); this.d = new ScaleGestureDetector(pDFView.getContext(), this); pDFView.setOnTouchListener(this); } @Override // android.view.GestureDetector.OnDoubleTapListener public final boolean onSingleTapConfirmed(MotionEvent motionEvent) { C12957fMe c12957fMe; int b; int i; xFW xfw = this; jPn jpn = xfw.c.g.n; float x = motionEvent.getX(); float y = motionEvent.getY(); msi msiVar = xfw.c.y; if (msiVar != null) { float f = (-xfw.c.j) + x; float f2 = (-xfw.c.i) + y; int b2 = msiVar.b(xfw.c.H ? f2 : f, xfw.c.I); float f3 = xfw.c.I; int a = msiVar.a(b2); float f4 = BitmapDescriptorFactory.HUE_RED; if (a < 0) { c12957fMe = new C12957fMe(BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED); } else { c12957fMe = msiVar.g.get(b2); } C12957fMe c12957fMe2 = new C12957fMe(c12957fMe.a * f3, c12957fMe.b * f3); if (xfw.c.H) { i = (int) msiVar.b(b2, xfw.c.I); float f5 = xfw.c.I; if (msiVar.a(b2) >= 0) { f4 = msiVar.j.get(b2).floatValue() * f5; } b = (int) f4; } else { b = (int) msiVar.b(b2, xfw.c.I); float f6 = xfw.c.I; if (msiVar.a(b2) >= 0) { f4 = msiVar.j.get(b2).floatValue() * f6; } i = (int) f4; } Iterator it = msiVar.i.a(msiVar.h, msiVar.a(b2)).iterator(); while (it.hasNext()) { C12960fMh.IeS next = it.next(); int i2 = (int) c12957fMe2.a; int i3 = (int) c12957fMe2.b; RectF rectF = next.a; int a2 = msiVar.a(b2); PdfiumCore pdfiumCore = msiVar.i; int i4 = b2; C12960fMh c12960fMh = msiVar.h; msi msiVar2 = msiVar; Iterator it2 = it; C12957fMe c12957fMe3 = c12957fMe2; float f7 = x; float f8 = y; Point aAN_ = pdfiumCore.aAN_(c12960fMh, a2, i, b, i2, i3, rectF.left, rectF.top); Point aAN_2 = pdfiumCore.aAN_(c12960fMh, a2, i, b, i2, i3, rectF.right, rectF.bottom); RectF rectF2 = new RectF(aAN_.x, aAN_.y, aAN_2.x, aAN_2.y); rectF2.sort(); if (rectF2.contains(f, f2)) { xfw = this; Gyh gyh = xfw.c.g; Nxz nxz = new Nxz(f7, f8, f, f2, rectF2, next); ZAW zaw = gyh.c; if (zaw != null) { zaw.a(nxz); } xfw.c.performClick(); return true; } xfw = this; b2 = i4; msiVar = msiVar2; c12957fMe2 = c12957fMe3; it = it2; x = f7; y = f8; } } uFI ufi = xfw.c.D; xfw.c.performClick(); return true; } @Override // android.view.GestureDetector.OnGestureListener public final boolean onDown(MotionEvent motionEvent) { C1641aJz c1641aJz = this.a; c1641aJz.c = false; c1641aJz.b.forceFinished(true); return true; } @Override // android.view.GestureDetector.OnGestureListener public final void onLongPress(MotionEvent motionEvent) { Gyh gyh = this.c.g; } @Override // android.view.ScaleGestureDetector.OnScaleGestureListener public final boolean onScale(ScaleGestureDetector scaleGestureDetector) { float scaleFactor = scaleGestureDetector.getScaleFactor(); float f = this.c.I * scaleFactor; float min = Math.min(1.0f, this.c.r); float min2 = Math.min(10.0f, this.c.p); if (f < min) { scaleFactor = min / this.c.I; } else if (f > min2) { scaleFactor = min2 / this.c.I; } PDFView pDFView = this.c; pDFView.Gr_(pDFView.I * scaleFactor, new PointF(scaleGestureDetector.getFocusX(), scaleGestureDetector.getFocusY())); return true; } @Override // android.view.ScaleGestureDetector.OnScaleGestureListener public final void onScaleEnd(ScaleGestureDetector scaleGestureDetector) { this.c.c(); uFI ufi = this.c.D; this.f = false; } @Override // android.view.View.OnTouchListener public final boolean onTouch(View view, MotionEvent motionEvent) { if (!this.e) { return false; } boolean z = this.b.onTouchEvent(motionEvent) || this.d.onTouchEvent(motionEvent); if (motionEvent.getAction() == 1 && this.h) { this.h = false; this.c.c(); uFI ufi = this.c.D; C1641aJz c1641aJz = this.a; if (!c1641aJz.c && !c1641aJz.d) { this.c.e(); } } return z; } @Override // android.view.GestureDetector.OnDoubleTapListener public final boolean onDoubleTap(MotionEvent motionEvent) { if (!this.c.k) { return false; } if (this.c.I < this.c.t) { PDFView pDFView = this.c; pDFView.d.e(motionEvent.getX(), motionEvent.getY(), pDFView.I, this.c.t); return true; } if (this.c.I < this.c.p) { PDFView pDFView2 = this.c; pDFView2.d.e(motionEvent.getX(), motionEvent.getY(), pDFView2.I, this.c.p); return true; } PDFView pDFView3 = this.c; pDFView3.d.e(pDFView3.getWidth() / 2, pDFView3.getHeight() / 2, pDFView3.I, pDFView3.r); return true; } /* JADX WARN: Code restructure failed: missing block: B:21:0x006c, code lost: if (r7 < (r8 - r3.getHeight())) goto L31; */ /* JADX WARN: Code restructure failed: missing block: B:22:0x0081, code lost: r12 = (int) r22.c.j; r13 = (int) r22.c.i; r3 = r22.c.y; r4 = r22.c.f; r6 = r22.c.I; */ /* JADX WARN: Code restructure failed: missing block: B:23:0x009b, code lost: if (r3.a(r4) >= 0) goto L34; */ /* JADX WARN: Code restructure failed: missing block: B:24:0x009d, code lost: r4 = 0.0f; */ /* JADX WARN: Code restructure failed: missing block: B:25:0x00ac, code lost: r4 = -r4; r6 = r22.c.f; r7 = r22.c.I; */ /* JADX WARN: Code restructure failed: missing block: B:26:0x00b9, code lost: if (r3.a(r6) >= 0) goto L38; */ /* JADX WARN: Code restructure failed: missing block: B:27:0x00bb, code lost: r6 = new o.C12957fMe(com.google.android.gms.maps.model.BitmapDescriptorFactory.HUE_RED, com.google.android.gms.maps.model.BitmapDescriptorFactory.HUE_RED); */ /* JADX WARN: Code restructure failed: missing block: B:29:0x00cb, code lost: if (r3.c == false) goto L42; */ /* JADX WARN: Code restructure failed: missing block: B:30:0x00cd, code lost: r6 = r6.b; */ /* JADX WARN: Code restructure failed: missing block: B:31:0x00d2, code lost: r6 = r4 - (r6 * r7); */ /* JADX WARN: Code restructure failed: missing block: B:32:0x00d9, code lost: if (r22.c.H == false) goto L50; */ /* JADX WARN: Code restructure failed: missing block: B:33:0x00db, code lost: r7 = r22.c; */ /* JADX WARN: Code restructure failed: missing block: B:34:0x00df, code lost: if (r3.c == false) goto L48; */ /* JADX WARN: Code restructure failed: missing block: B:35:0x00e1, code lost: r3 = r3.d; */ /* JADX WARN: Code restructure failed: missing block: B:36:0x00e6, code lost: r3 = -((r3.a * r7.I) - r22.c.getWidth()); r6 = r6 + r22.c.getHeight(); */ /* JADX WARN: Code restructure failed: missing block: B:37:0x0128, code lost: r22.a.e(r12, r13, (int) r25, (int) r26, (int) r3, (int) r10, (int) r6, (int) r4); */ /* JADX WARN: Code restructure failed: missing block: B:39:0x00e4, code lost: r3 = r3.e; */ /* JADX WARN: Code restructure failed: missing block: B:40:0x00fd, code lost: r7 = r22.c.getWidth(); r8 = r22.c; */ /* JADX WARN: Code restructure failed: missing block: B:41:0x0108, code lost: if (r3.c == false) goto L53; */ /* JADX WARN: Code restructure failed: missing block: B:42:0x010a, code lost: r3 = r3.d; */ /* JADX WARN: Code restructure failed: missing block: B:43:0x010f, code lost: r6 = r6 + r7; r6 = -((r3.b * r8.I) - r22.c.getHeight()); r3 = r6; r10 = r4; r4 = 0.0f; */ /* JADX WARN: Code restructure failed: missing block: B:44:0x010d, code lost: r3 = r3.e; */ /* JADX WARN: Code restructure failed: missing block: B:45:0x00d0, code lost: r6 = r6.a; */ /* JADX WARN: Code restructure failed: missing block: B:46:0x00c1, code lost: r6 = r3.g.get(r6); */ /* JADX WARN: Code restructure failed: missing block: B:47:0x009f, code lost: r4 = r3.j.get(r4).floatValue() * r6; */ /* JADX WARN: Code restructure failed: missing block: B:78:0x007d, code lost: if (r7 < (r8 - r3.getWidth())) goto L31; */ /* JADX WARN: Removed duplicated region for block: B:54:0x015c */ /* JADX WARN: Removed duplicated region for block: B:59:0x016e */ /* JADX WARN: Removed duplicated region for block: B:62:0x01a0 */ /* JADX WARN: Removed duplicated region for block: B:65:0x01c3 */ /* JADX WARN: Removed duplicated region for block: B:67:0x01cb */ /* JADX WARN: Removed duplicated region for block: B:68:0x01a2 */ /* JADX WARN: Removed duplicated region for block: B:69:0x0177 */ /* JADX WARN: Removed duplicated region for block: B:71:0x0161 */ @Override // android.view.GestureDetector.OnGestureListener /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ public final boolean onFling(android.view.MotionEvent r23, android.view.MotionEvent r24, float r25, float r26) { /* Method dump skipped, instructions count: 581 To view this dump add '--comments-level debug' option */ throw new UnsupportedOperationException("Method not decompiled: o.xFW.onFling(android.view.MotionEvent, android.view.MotionEvent, float, float):boolean"); } @Override // android.view.GestureDetector.OnGestureListener public final boolean onScroll(MotionEvent motionEvent, MotionEvent motionEvent2, float f, float f2) { this.h = true; PDFView pDFView = this.c; if (pDFView.I != pDFView.r || this.c.l) { PDFView pDFView2 = this.c; pDFView2.e(pDFView2.j + (-f), pDFView2.i + (-f2), true); } if (!this.f) { this.c.d(); } else { boolean z = this.c.v; } return true; } @Override // android.view.ScaleGestureDetector.OnScaleGestureListener public final boolean onScaleBegin(ScaleGestureDetector scaleGestureDetector) { this.f = true; return true; } }