what-the-bank/sources/com/pdfview/subsamplincscaleimageview/SubsamplingScaleImageView.java

2343 lines
89 KiB
Java

package com.pdfview.subsamplincscaleimageview;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Point;
import android.graphics.PointF;
import android.graphics.Rect;
import android.graphics.RectF;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Handler;
import android.os.Message;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.util.TypedValue;
import android.view.GestureDetector;
import android.view.MotionEvent;
import android.view.View;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.concurrent.Executor;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
import o.C16679qMG;
import o.InterfaceC14459ftc;
import o.Qgz;
import o.SVZ;
import o.UtM;
import o.VoW;
import o.kcw;
import o.wwB;
import o.xOV;
import org.bouncycastle.crypto.tls.CipherSuite;
/* loaded from: classes3.dex */
public class SubsamplingScaleImageView extends View {
private static final String d = "SubsamplingScaleImageView";
private static Bitmap.Config h;
private boolean A;
private int B;
private boolean C;
private final Handler D;
private boolean E;
private float F;
private boolean G;
private boolean H;
private Matrix I;
private int J;
private int K;
private float L;
private int M;
private int N;
private View.OnLongClickListener O;
private IeS P;
private tOB Q;
private int R;
private int S;
private Rect T;
private Float U;
private int V;
private boolean W;
private PointF aA;
private PointF aB;
private PointF aC;
private boolean aG;
private boolean aa;
private float ab;
private boolean ac;
private PointF ad;
private final float ae;
private PointF af;
private PointF ag;
private boolean ah;
private PointF ai;
private int aj;
private RectF ak;
private int al;
private VoW<? extends InterfaceC14459ftc> am;
private PointF an;
private float ao;
private int ap;
private Rect aq;
private ZqN ar;
private Map<Integer, List<jbe>> as;
private final float[] at;
private float au;
private GestureDetector av;
private Paint aw;
private PointF ax;
private float ay;
private Uri az;
private VoW<? extends xOV> f;
private HBt i;
private Bitmap j;
private Paint k;
private boolean l;
private Paint m;
private boolean n;
/* renamed from: o, reason: collision with root package name */
private boolean f6507o;
private GestureDetector p;
private final float q;
private InterfaceC14459ftc r;
private final ReadWriteLock s;
private Paint t;
private final float[] u;
private int v;
private boolean w;
private int x;
private float y;
private Executor z;
private static final List<Integer> b = Arrays.asList(0, 90, Integer.valueOf(CipherSuite.TLS_DHE_PSK_WITH_NULL_SHA256), 270, -1);
private static final List<Integer> g = Arrays.asList(1, 2, 3);
private static final List<Integer> e = Arrays.asList(2, 1);
private static final List<Integer> a = Arrays.asList(1, 2, 3);
private static final List<Integer> c = Arrays.asList(2, 1, 3, 4);
/* loaded from: classes3.dex */
public interface IeS {
}
/* loaded from: classes3.dex */
public interface Sts {
}
/* loaded from: classes3.dex */
public interface tOB {
}
static /* synthetic */ void e() {
}
static /* synthetic */ void Pd_(SubsamplingScaleImageView subsamplingScaleImageView, Bitmap bitmap) {
synchronized (subsamplingScaleImageView) {
if (subsamplingScaleImageView.j == null && !subsamplingScaleImageView.A) {
Rect rect = subsamplingScaleImageView.T;
subsamplingScaleImageView.j = bitmap;
subsamplingScaleImageView.n = true;
if (subsamplingScaleImageView.i()) {
subsamplingScaleImageView.invalidate();
subsamplingScaleImageView.requestLayout();
}
return;
}
bitmap.recycle();
}
}
static /* synthetic */ void Pe_(SubsamplingScaleImageView subsamplingScaleImageView, Bitmap bitmap, int i) {
synchronized (subsamplingScaleImageView) {
int i2 = subsamplingScaleImageView.ap;
if (i2 > 0 && subsamplingScaleImageView.al > 0 && (i2 != bitmap.getWidth() || subsamplingScaleImageView.al != bitmap.getHeight())) {
subsamplingScaleImageView.b(false);
}
Bitmap bitmap2 = subsamplingScaleImageView.j;
if (bitmap2 != null) {
boolean z = subsamplingScaleImageView.f6507o;
bitmap2.recycle();
}
if (subsamplingScaleImageView.j != null) {
boolean z2 = subsamplingScaleImageView.f6507o;
}
subsamplingScaleImageView.n = false;
subsamplingScaleImageView.f6507o = false;
subsamplingScaleImageView.j = bitmap;
subsamplingScaleImageView.ap = bitmap.getWidth();
subsamplingScaleImageView.al = bitmap.getHeight();
subsamplingScaleImageView.aj = i;
boolean i3 = subsamplingScaleImageView.i();
boolean f = subsamplingScaleImageView.f();
if (!subsamplingScaleImageView.A && f) {
subsamplingScaleImageView.h();
subsamplingScaleImageView.A = true;
IeS ieS = subsamplingScaleImageView.P;
}
if (i3 || f) {
subsamplingScaleImageView.invalidate();
subsamplingScaleImageView.requestLayout();
}
}
}
static /* synthetic */ void a(SubsamplingScaleImageView subsamplingScaleImageView, InterfaceC14459ftc interfaceC14459ftc, int i, int i2, int i3) {
int i4;
int i5;
int i6;
synchronized (subsamplingScaleImageView) {
Integer.valueOf(i);
Integer.valueOf(i2);
Integer.valueOf(subsamplingScaleImageView.R);
int i7 = subsamplingScaleImageView.ap;
if (i7 > 0 && (i6 = subsamplingScaleImageView.al) > 0 && (i7 != i || i6 != i2)) {
subsamplingScaleImageView.b(false);
Bitmap bitmap = subsamplingScaleImageView.j;
if (bitmap != null) {
boolean z = subsamplingScaleImageView.f6507o;
bitmap.recycle();
subsamplingScaleImageView.j = null;
if (subsamplingScaleImageView.P != null) {
boolean z2 = subsamplingScaleImageView.f6507o;
}
subsamplingScaleImageView.n = false;
subsamplingScaleImageView.f6507o = false;
}
}
subsamplingScaleImageView.r = interfaceC14459ftc;
subsamplingScaleImageView.ap = i;
subsamplingScaleImageView.al = i2;
subsamplingScaleImageView.aj = i3;
subsamplingScaleImageView.i();
boolean f = subsamplingScaleImageView.f();
if (!subsamplingScaleImageView.A && f) {
subsamplingScaleImageView.h();
subsamplingScaleImageView.A = true;
IeS ieS = subsamplingScaleImageView.P;
}
if (!f && (i4 = subsamplingScaleImageView.N) > 0 && i4 != Integer.MAX_VALUE && (i5 = subsamplingScaleImageView.J) > 0 && i5 != Integer.MAX_VALUE && subsamplingScaleImageView.getWidth() > 0 && subsamplingScaleImageView.getHeight() > 0) {
subsamplingScaleImageView.Pj_(new Point(subsamplingScaleImageView.N, subsamplingScaleImageView.J));
}
subsamplingScaleImageView.invalidate();
subsamplingScaleImageView.requestLayout();
}
}
static /* synthetic */ int c(SubsamplingScaleImageView subsamplingScaleImageView) {
subsamplingScaleImageView.K = 0;
return 0;
}
static /* synthetic */ boolean f(SubsamplingScaleImageView subsamplingScaleImageView) {
subsamplingScaleImageView.aa = false;
return false;
}
static /* synthetic */ float g(SubsamplingScaleImageView subsamplingScaleImageView) {
subsamplingScaleImageView.ab = -1.0f;
return -1.0f;
}
static /* synthetic */ boolean i(SubsamplingScaleImageView subsamplingScaleImageView) {
subsamplingScaleImageView.E = true;
return true;
}
static /* synthetic */ void m(SubsamplingScaleImageView subsamplingScaleImageView) {
Bitmap bitmap;
synchronized (subsamplingScaleImageView) {
subsamplingScaleImageView.i();
boolean f = subsamplingScaleImageView.f();
if (!subsamplingScaleImageView.A && f) {
subsamplingScaleImageView.h();
subsamplingScaleImageView.A = true;
IeS ieS = subsamplingScaleImageView.P;
}
if (subsamplingScaleImageView.f() && (bitmap = subsamplingScaleImageView.j) != null) {
boolean z = subsamplingScaleImageView.f6507o;
bitmap.recycle();
subsamplingScaleImageView.j = null;
if (subsamplingScaleImageView.P != null) {
boolean z2 = subsamplingScaleImageView.f6507o;
}
subsamplingScaleImageView.n = false;
subsamplingScaleImageView.f6507o = false;
}
subsamplingScaleImageView.invalidate();
}
}
static /* synthetic */ boolean x(SubsamplingScaleImageView subsamplingScaleImageView) {
subsamplingScaleImageView.G = true;
return true;
}
public SubsamplingScaleImageView(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
int resourceId;
String string;
this.C = true;
this.R = 0;
this.F = 2.0f;
this.L = j();
this.S = -1;
this.V = 1;
this.M = 1;
this.N = Integer.MAX_VALUE;
this.J = Integer.MAX_VALUE;
this.z = AsyncTask.THREAD_POOL_EXECUTOR;
this.w = true;
this.W = true;
this.aG = true;
this.ac = true;
this.y = 1.0f;
this.x = 1;
this.v = 500;
this.s = new ReentrantReadWriteLock(true);
this.f = new UtM(wwB.class);
this.am = new UtM(Qgz.class);
this.at = new float[8];
this.u = new float[8];
this.q = getResources().getDisplayMetrics().density;
setMinimumDpi(160);
setDoubleTapZoomDpi(160);
setMinimumTileDpi(320);
c(context);
this.D = new Handler(new Handler.Callback(this) { // from class: com.pdfview.subsamplincscaleimageview.SubsamplingScaleImageView.4
private SubsamplingScaleImageView d;
{
this.d = this;
}
@Override // android.os.Handler.Callback
public final boolean handleMessage(Message message) {
if (message.what == 1 && this.d.O != null) {
SubsamplingScaleImageView.c(this.d);
SubsamplingScaleImageView subsamplingScaleImageView = this.d;
SubsamplingScaleImageView.super.setOnLongClickListener(subsamplingScaleImageView.O);
this.d.performLongClick();
SubsamplingScaleImageView.super.setOnLongClickListener(null);
}
return true;
}
});
if (attributeSet != null) {
TypedArray obtainStyledAttributes = getContext().obtainStyledAttributes(attributeSet, C16679qMG.HBt.SubsamplingScaleImageView);
if (obtainStyledAttributes.hasValue(C16679qMG.HBt.SubsamplingScaleImageView_assetName) && (string = obtainStyledAttributes.getString(C16679qMG.HBt.SubsamplingScaleImageView_assetName)) != null && string.length() > 0) {
SVZ d2 = SVZ.d(string);
d2.d = true;
setImage(d2);
}
if (obtainStyledAttributes.hasValue(C16679qMG.HBt.SubsamplingScaleImageView_src) && (resourceId = obtainStyledAttributes.getResourceId(C16679qMG.HBt.SubsamplingScaleImageView_src, 0)) > 0) {
SVZ a2 = SVZ.a(resourceId);
a2.d = true;
setImage(a2);
}
if (obtainStyledAttributes.hasValue(C16679qMG.HBt.SubsamplingScaleImageView_panEnabled)) {
setPanEnabled(obtainStyledAttributes.getBoolean(C16679qMG.HBt.SubsamplingScaleImageView_panEnabled, true));
}
if (obtainStyledAttributes.hasValue(C16679qMG.HBt.SubsamplingScaleImageView_zoomEnabled)) {
setZoomEnabled(obtainStyledAttributes.getBoolean(C16679qMG.HBt.SubsamplingScaleImageView_zoomEnabled, true));
}
if (obtainStyledAttributes.hasValue(C16679qMG.HBt.SubsamplingScaleImageView_quickScaleEnabled)) {
setQuickScaleEnabled(obtainStyledAttributes.getBoolean(C16679qMG.HBt.SubsamplingScaleImageView_quickScaleEnabled, true));
}
if (obtainStyledAttributes.hasValue(C16679qMG.HBt.SubsamplingScaleImageView_tileBackgroundColor)) {
setTileBackgroundColor(obtainStyledAttributes.getColor(C16679qMG.HBt.SubsamplingScaleImageView_tileBackgroundColor, Color.argb(0, 0, 0, 0)));
}
obtainStyledAttributes.recycle();
}
this.ae = TypedValue.applyDimension(1, 20.0f, context.getResources().getDisplayMetrics());
}
public SubsamplingScaleImageView(Context context) {
this(context, null);
}
public final void setOrientation(int i) {
if (!b.contains(Integer.valueOf(i))) {
throw new IllegalArgumentException("Invalid orientation: ".concat(String.valueOf(i)));
}
this.R = i;
b(false);
invalidate();
requestLayout();
}
public final void setImage(SVZ svz) {
setImage(svz, null, null);
}
public final void setImage(SVZ svz, kcw kcwVar) {
setImage(svz, null, kcwVar);
}
public final void setImage(SVZ svz, SVZ svz2) {
setImage(svz, svz2, null);
}
public final void setImage(SVZ svz, SVZ svz2, kcw kcwVar) {
if (svz == null) {
throw new NullPointerException("imageSource must not be null");
}
b(true);
if (kcwVar != null && kcwVar != null && b.contains(Integer.valueOf(kcwVar.a))) {
this.R = kcwVar.a;
this.U = Float.valueOf(kcwVar.c);
this.ai = new PointF(kcwVar.b, kcwVar.e);
invalidate();
}
if (svz2 != null) {
Bitmap bitmap = svz.a;
int i = svz.b;
throw new IllegalArgumentException("Preview image cannot be used unless dimensions are provided for the main image");
}
Bitmap bitmap2 = svz.a;
Bitmap bitmap3 = svz.a;
this.aq = svz.e;
Uri uri = svz.i;
this.az = uri;
if (uri == null && svz.c != null) {
StringBuilder sb = new StringBuilder("android.resource://");
sb.append(getContext().getPackageName());
sb.append("/");
sb.append(svz.c);
this.az = Uri.parse(sb.toString());
}
if (!svz.d && this.aq == null) {
new RVV(this, getContext(), this.f, this.az, false).executeOnExecutor(this.z, new Void[0]);
} else {
new saX(this, getContext(), this.am, this.az).executeOnExecutor(this.z, new Void[0]);
}
}
private void b(boolean z) {
this.ao = BitmapDescriptorFactory.HUE_RED;
this.au = BitmapDescriptorFactory.HUE_RED;
this.ax = null;
this.aC = null;
this.aB = null;
this.U = Float.valueOf(BitmapDescriptorFactory.HUE_RED);
this.ai = null;
this.an = null;
this.G = false;
this.H = false;
this.E = false;
this.K = 0;
this.B = 0;
this.aA = null;
this.ay = BitmapDescriptorFactory.HUE_RED;
this.ab = BitmapDescriptorFactory.HUE_RED;
this.aa = false;
this.ad = null;
this.ag = null;
this.af = null;
this.i = null;
this.ar = null;
this.I = null;
this.ak = null;
if (z) {
this.az = null;
this.s.writeLock().lock();
try {
InterfaceC14459ftc interfaceC14459ftc = this.r;
if (interfaceC14459ftc != null) {
interfaceC14459ftc.c();
this.r = null;
}
this.s.writeLock().unlock();
Bitmap bitmap = this.j;
if (bitmap != null) {
bitmap.recycle();
}
this.ap = 0;
this.al = 0;
this.aj = 0;
this.aq = null;
this.T = null;
this.ah = false;
this.A = false;
this.j = null;
this.n = false;
this.f6507o = false;
} catch (Throwable th) {
this.s.writeLock().unlock();
throw th;
}
}
Map<Integer, List<jbe>> map = this.as;
if (map != null) {
Iterator<Map.Entry<Integer, List<jbe>>> it = map.entrySet().iterator();
while (it.hasNext()) {
for (jbe jbeVar : it.next().getValue()) {
jbeVar.j = false;
if (jbeVar.c != null) {
jbeVar.c.recycle();
jbeVar.c = null;
}
}
}
this.as = null;
}
c(getContext());
}
/* JADX INFO: Access modifiers changed from: private */
public void c(Context context) {
this.p = new GestureDetector(context, new GestureDetector.SimpleOnGestureListener(this, context) { // from class: com.pdfview.subsamplincscaleimageview.SubsamplingScaleImageView.2
private Context c;
private SubsamplingScaleImageView e;
{
this.e = this;
this.c = context;
}
@Override // android.view.GestureDetector.SimpleOnGestureListener, android.view.GestureDetector.OnGestureListener
public final boolean onFling(MotionEvent motionEvent, MotionEvent motionEvent2, float f, float f2) {
if (this.e.W && this.e.ah && this.e.ax != null && motionEvent != null && motionEvent2 != null && ((Math.abs(motionEvent.getX() - motionEvent2.getX()) > 50.0f || Math.abs(motionEvent.getY() - motionEvent2.getY()) > 50.0f) && ((Math.abs(f) > 500.0f || Math.abs(f2) > 500.0f) && !this.e.G))) {
PointF pointF = new PointF(this.e.ax.x + (f * 0.25f), this.e.ax.y + (f2 * 0.25f));
LWm lWm = new LWm(this.e, new PointF(((this.e.getWidth() / 2) - pointF.x) / this.e.ao, ((this.e.getHeight() / 2) - pointF.y) / this.e.ao), (byte) 0);
if (SubsamplingScaleImageView.e.contains(1)) {
lWm.a = 1;
lWm.d = false;
lWm.c = 3;
lWm.a();
return true;
}
throw new IllegalArgumentException("Unknown easing type: 1");
}
return super.onFling(motionEvent, motionEvent2, f, f2);
}
@Override // android.view.GestureDetector.SimpleOnGestureListener, android.view.GestureDetector.OnDoubleTapListener
public final boolean onSingleTapConfirmed(MotionEvent motionEvent) {
this.e.performClick();
return true;
}
@Override // android.view.GestureDetector.SimpleOnGestureListener, android.view.GestureDetector.OnDoubleTapListener
public final boolean onDoubleTap(MotionEvent motionEvent) {
if (this.e.aG && this.e.ah && this.e.ax != null) {
this.e.c(this.c);
if (this.e.ac) {
this.e.aA = new PointF(motionEvent.getX(), motionEvent.getY());
this.e.aC = new PointF(this.e.ax.x, this.e.ax.y);
SubsamplingScaleImageView subsamplingScaleImageView = this.e;
subsamplingScaleImageView.au = subsamplingScaleImageView.ao;
SubsamplingScaleImageView.i(this.e);
SubsamplingScaleImageView.x(this.e);
SubsamplingScaleImageView.g(this.e);
SubsamplingScaleImageView subsamplingScaleImageView2 = this.e;
PointF pointF = subsamplingScaleImageView2.aA;
subsamplingScaleImageView2.ad = subsamplingScaleImageView2.Po_(pointF.x, pointF.y, new PointF());
this.e.af = new PointF(motionEvent.getX(), motionEvent.getY());
this.e.ag = new PointF(this.e.ad.x, this.e.ad.y);
SubsamplingScaleImageView.f(this.e);
return false;
}
SubsamplingScaleImageView subsamplingScaleImageView3 = this.e;
PointF pointF2 = new PointF(motionEvent.getX(), motionEvent.getY());
subsamplingScaleImageView3.Ph_(subsamplingScaleImageView3.Po_(pointF2.x, pointF2.y, new PointF()), new PointF(motionEvent.getX(), motionEvent.getY()));
return true;
}
return super.onDoubleTapEvent(motionEvent);
}
});
this.av = new GestureDetector(context, new GestureDetector.SimpleOnGestureListener(this) { // from class: com.pdfview.subsamplincscaleimageview.SubsamplingScaleImageView.1
private SubsamplingScaleImageView c;
{
this.c = this;
}
@Override // android.view.GestureDetector.SimpleOnGestureListener, android.view.GestureDetector.OnDoubleTapListener
public final boolean onSingleTapConfirmed(MotionEvent motionEvent) {
this.c.performClick();
return true;
}
});
}
@Override // android.view.View
protected void onSizeChanged(int i, int i2, int i3, int i4) {
new Object[]{Integer.valueOf(i3), Integer.valueOf(i4), Integer.valueOf(i), Integer.valueOf(i2)};
PointF Pm_ = Pm_();
if (!this.ah || Pm_ == null) {
return;
}
this.i = null;
this.U = Float.valueOf(this.ao);
this.ai = Pm_;
}
@Override // android.view.View
protected void onMeasure(int i, int i2) {
int mode = View.MeasureSpec.getMode(i);
int mode2 = View.MeasureSpec.getMode(i2);
int size = View.MeasureSpec.getSize(i);
int size2 = View.MeasureSpec.getSize(i2);
boolean z = mode != 1073741824;
boolean z2 = mode2 != 1073741824;
if (this.ap > 0 && this.al > 0) {
if (z && z2) {
size = n();
size2 = o();
} else if (z2) {
size2 = (int) ((o() / n()) * size);
} else if (z) {
size = (int) ((n() / o()) * size2);
}
}
setMeasuredDimension(Math.max(size, getSuggestedMinimumWidth()), Math.max(size2, getSuggestedMinimumHeight()));
}
/* JADX INFO: Access modifiers changed from: private */
public void Ph_(PointF pointF, PointF pointF2) {
if (!this.W) {
PointF pointF3 = this.an;
if (pointF3 != null) {
pointF.x = pointF3.x;
pointF.y = this.an.y;
} else {
int i = this.R;
if (i == -1) {
i = this.aj;
}
pointF.x = ((i == 90 || i == 270) ? this.al : this.ap) / 2;
int i2 = this.R;
if (i2 == -1) {
i2 = this.aj;
}
pointF.y = ((i2 == 90 || i2 == 270) ? this.ap : this.al) / 2;
}
}
float min = Math.min(this.F, this.y);
float f = this.ao;
byte b2 = 0;
boolean z = ((double) f) <= ((double) min) * 0.9d || f == this.L;
if (!z) {
min = j();
}
float f2 = min;
int i3 = this.x;
if (i3 == 3) {
setScaleAndCenter(f2, pointF);
} else if (i3 == 2 || !z || !this.W) {
LWm lWm = new LWm(this, f2, pointF, b2);
lWm.e = false;
lWm.b = this.v;
lWm.c = 4;
lWm.a();
} else if (i3 == 1) {
LWm lWm2 = new LWm(this, f2, pointF, pointF2, (byte) 0);
lWm2.e = false;
lWm2.b = this.v;
lWm2.c = 4;
lWm2.a();
}
invalidate();
}
@Override // android.view.View
protected void onDraw(Canvas canvas) {
float f;
super.onDraw(canvas);
if (this.m == null) {
Paint paint = new Paint();
this.m = paint;
paint.setAntiAlias(true);
this.m.setFilterBitmap(true);
this.m.setDither(true);
}
if ((this.t == null || this.k == null) && this.l) {
Paint paint2 = new Paint();
this.t = paint2;
paint2.setTextSize((int) (this.q * 12.0f));
this.t.setColor(-65281);
this.t.setStyle(Paint.Style.FILL);
Paint paint3 = new Paint();
this.k = paint3;
paint3.setColor(-65281);
this.k.setStyle(Paint.Style.STROKE);
this.k.setStrokeWidth((int) this.q);
}
if (this.ap == 0 || this.al == 0 || getWidth() == 0 || getHeight() == 0) {
return;
}
if (this.as == null && this.r != null) {
Pj_(new Point(Math.min(canvas.getMaximumBitmapWidth(), this.N), Math.min(canvas.getMaximumBitmapHeight(), this.J)));
}
if (i()) {
h();
HBt hBt = this.i;
boolean z = false;
if (hBt != null && hBt.f6508o != null) {
if (this.aB == null) {
this.aB = new PointF(BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED);
}
this.aB.set(this.ax);
long currentTimeMillis = System.currentTimeMillis() - this.i.k;
boolean z2 = currentTimeMillis > this.i.a;
long min = Math.min(currentTimeMillis, this.i.a);
this.ao = d(this.i.d, min, this.i.j, this.i.f - this.i.j, this.i.a);
float d2 = d(this.i.d, min, this.i.f6508o.x, this.i.n.x - this.i.f6508o.x, this.i.a);
float d3 = d(this.i.d, min, this.i.f6508o.y, this.i.n.y - this.i.f6508o.y, this.i.a);
PointF pointF = this.ax;
float f2 = pointF.x;
float f3 = this.i.i.x;
PointF pointF2 = this.ax;
pointF.x = f2 - ((pointF2 == null ? Float.NaN : (f3 * this.ao) + pointF2.x) - d2);
PointF pointF3 = this.ax;
float f4 = pointF3.y;
float f5 = this.i.i.y;
PointF pointF4 = this.ax;
pointF3.y = f4 - ((pointF4 == null ? Float.NaN : (f5 * this.ao) + pointF4.y) - d3);
e(z2 || this.i.j == this.i.f);
PointF pointF5 = this.aB;
int i = this.i.c;
Pk_(pointF5);
a(z2);
if (z2) {
Sts sts = this.i.e;
this.i = null;
}
invalidate();
}
int i2 = -1;
if (this.as == null || !f()) {
if (this.j != null) {
float f6 = this.ao;
if (this.n) {
f6 *= this.ap / r2.getWidth();
f = this.ao * (this.al / this.j.getHeight());
} else {
f = f6;
}
if (this.I == null) {
this.I = new Matrix();
}
this.I.reset();
this.I.postScale(f6, f);
Matrix matrix = this.I;
int i3 = this.R;
if (i3 == -1) {
i3 = this.aj;
}
matrix.postRotate(i3);
this.I.postTranslate(this.ax.x, this.ax.y);
int i4 = this.R;
if ((i4 == -1 ? this.aj : i4) == 180) {
Matrix matrix2 = this.I;
float f7 = this.ao;
matrix2.postTranslate(this.ap * f7, f7 * this.al);
} else if ((i4 == -1 ? this.aj : i4) == 90) {
this.I.postTranslate(this.ao * this.al, BitmapDescriptorFactory.HUE_RED);
} else {
if (i4 == -1) {
i4 = this.aj;
}
if (i4 == 270) {
this.I.postTranslate(BitmapDescriptorFactory.HUE_RED, this.ao * this.ap);
}
}
if (this.aw != null) {
if (this.ak == null) {
this.ak = new RectF();
}
this.ak.set(BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED, this.n ? this.j.getWidth() : this.ap, this.n ? this.j.getHeight() : this.al);
this.I.mapRect(this.ak);
canvas.drawRect(this.ak, this.aw);
}
canvas.drawBitmap(this.j, this.I, this.m);
}
} else {
int min2 = Math.min(this.B, e(this.ao));
for (Map.Entry<Integer, List<jbe>> entry : this.as.entrySet()) {
if (entry.getKey().intValue() == min2) {
for (jbe jbeVar : entry.getValue()) {
if (jbeVar.j && (jbeVar.a || jbeVar.c == null)) {
z = true;
}
}
}
}
for (Map.Entry<Integer, List<jbe>> entry2 : this.as.entrySet()) {
if (entry2.getKey().intValue() == min2 || z) {
for (jbe jbeVar2 : entry2.getValue()) {
Rect rect = jbeVar2.d;
Rect rect2 = jbeVar2.i;
float f8 = rect.left;
PointF pointF6 = this.ax;
int i5 = (int) (pointF6 == null ? Float.NaN : (f8 * this.ao) + pointF6.x);
float f9 = rect.top;
PointF pointF7 = this.ax;
int i6 = (int) (pointF7 == null ? Float.NaN : (f9 * this.ao) + pointF7.y);
float f10 = rect.right;
PointF pointF8 = this.ax;
int i7 = (int) (pointF8 == null ? Float.NaN : (f10 * this.ao) + pointF8.x);
float f11 = rect.bottom;
PointF pointF9 = this.ax;
rect2.set(i5, i6, i7, (int) (pointF9 == null ? Float.NaN : (f11 * this.ao) + pointF9.y));
if (!jbeVar2.a && jbeVar2.c != null) {
if (this.aw != null) {
canvas.drawRect(jbeVar2.i, this.aw);
}
if (this.I == null) {
this.I = new Matrix();
}
this.I.reset();
c(this.at, BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED, jbeVar2.c.getWidth(), BitmapDescriptorFactory.HUE_RED, jbeVar2.c.getWidth(), jbeVar2.c.getHeight(), BitmapDescriptorFactory.HUE_RED, jbeVar2.c.getHeight());
int i8 = this.R;
if ((i8 == i2 ? this.aj : i8) == 0) {
c(this.u, jbeVar2.i.left, jbeVar2.i.top, jbeVar2.i.right, jbeVar2.i.top, jbeVar2.i.right, jbeVar2.i.bottom, jbeVar2.i.left, jbeVar2.i.bottom);
} else if ((i8 == i2 ? this.aj : i8) == 90) {
c(this.u, jbeVar2.i.right, jbeVar2.i.top, jbeVar2.i.right, jbeVar2.i.bottom, jbeVar2.i.left, jbeVar2.i.bottom, jbeVar2.i.left, jbeVar2.i.top);
} else if ((i8 == -1 ? this.aj : i8) == 180) {
c(this.u, jbeVar2.i.right, jbeVar2.i.bottom, jbeVar2.i.left, jbeVar2.i.bottom, jbeVar2.i.left, jbeVar2.i.top, jbeVar2.i.right, jbeVar2.i.top);
} else {
if (i8 == -1) {
i8 = this.aj;
}
if (i8 == 270) {
c(this.u, jbeVar2.i.left, jbeVar2.i.bottom, jbeVar2.i.left, jbeVar2.i.top, jbeVar2.i.right, jbeVar2.i.top, jbeVar2.i.right, jbeVar2.i.bottom);
}
}
this.I.setPolyToPoly(this.at, 0, this.u, 0, 4);
canvas.drawBitmap(jbeVar2.c, this.I, this.m);
if (this.l) {
canvas.drawRect(jbeVar2.i, this.k);
}
} else if (jbeVar2.a && this.l) {
canvas.drawText("LOADING", jbeVar2.i.left + ((int) (this.q * 5.0f)), jbeVar2.i.top + ((int) (this.q * 35.0f)), this.t);
}
if (jbeVar2.j && this.l) {
StringBuilder sb = new StringBuilder("ISS ");
sb.append(jbeVar2.e);
sb.append(" RECT ");
sb.append(jbeVar2.d.top);
sb.append(",");
sb.append(jbeVar2.d.left);
sb.append(",");
sb.append(jbeVar2.d.bottom);
sb.append(",");
sb.append(jbeVar2.d.right);
canvas.drawText(sb.toString(), jbeVar2.i.left + ((int) (this.q * 5.0f)), jbeVar2.i.top + ((int) (this.q * 15.0f)), this.t);
}
i2 = -1;
}
}
i2 = -1;
}
}
if (this.l) {
StringBuilder sb2 = new StringBuilder("Scale: ");
sb2.append(String.format(Locale.ENGLISH, "%.2f", Float.valueOf(this.ao)));
sb2.append(" (");
sb2.append(String.format(Locale.ENGLISH, "%.2f", Float.valueOf(j())));
sb2.append(" - ");
sb2.append(String.format(Locale.ENGLISH, "%.2f", Float.valueOf(this.F)));
sb2.append(")");
String obj = sb2.toString();
float f12 = this.q;
canvas.drawText(obj, (int) (f12 * 5.0f), (int) (f12 * 15.0f), this.t);
StringBuilder sb3 = new StringBuilder("Translate: ");
sb3.append(String.format(Locale.ENGLISH, "%.2f", Float.valueOf(this.ax.x)));
sb3.append(":");
sb3.append(String.format(Locale.ENGLISH, "%.2f", Float.valueOf(this.ax.y)));
String obj2 = sb3.toString();
float f13 = this.q;
canvas.drawText(obj2, (int) (f13 * 5.0f), (int) (f13 * 30.0f), this.t);
PointF Pm_ = Pm_();
StringBuilder sb4 = new StringBuilder("Source center: ");
sb4.append(String.format(Locale.ENGLISH, "%.2f", Float.valueOf(Pm_.x)));
sb4.append(":");
sb4.append(String.format(Locale.ENGLISH, "%.2f", Float.valueOf(Pm_.y)));
String obj3 = sb4.toString();
float f14 = this.q;
canvas.drawText(obj3, (int) (f14 * 5.0f), (int) (f14 * 45.0f), this.t);
HBt hBt2 = this.i;
if (hBt2 != null) {
PointF pointF10 = hBt2.g;
float f15 = pointF10.x;
float f16 = pointF10.y;
PointF pointF11 = new PointF();
PointF pointF12 = this.ax;
if (pointF12 == null) {
pointF11 = null;
} else {
float f17 = pointF12 == null ? Float.NaN : (f15 * this.ao) + pointF12.x;
PointF pointF13 = this.ax;
pointF11.set(f17, pointF13 == null ? Float.NaN : (f16 * this.ao) + pointF13.y);
}
PointF pointF14 = this.i.h;
float f18 = pointF14.x;
float f19 = pointF14.y;
PointF pointF15 = new PointF();
PointF pointF16 = this.ax;
if (pointF16 == null) {
pointF15 = null;
} else {
float f20 = pointF16 == null ? Float.NaN : (f18 * this.ao) + pointF16.x;
PointF pointF17 = this.ax;
pointF15.set(f20, pointF17 == null ? Float.NaN : (f19 * this.ao) + pointF17.y);
}
PointF pointF18 = this.i.i;
float f21 = pointF18.x;
float f22 = pointF18.y;
PointF pointF19 = new PointF();
PointF pointF20 = this.ax;
if (pointF20 == null) {
pointF19 = null;
} else {
float f23 = pointF20 == null ? Float.NaN : (f21 * this.ao) + pointF20.x;
PointF pointF21 = this.ax;
pointF19.set(f23, pointF21 == null ? Float.NaN : (f22 * this.ao) + pointF21.y);
}
canvas.drawCircle(pointF11.x, pointF11.y, (int) (this.q * 10.0f), this.k);
this.k.setColor(-65536);
canvas.drawCircle(pointF15.x, pointF15.y, (int) (this.q * 20.0f), this.k);
this.k.setColor(-16776961);
canvas.drawCircle(pointF19.x, pointF19.y, (int) (this.q * 25.0f), this.k);
this.k.setColor(-16711681);
canvas.drawCircle(getWidth() / 2, getHeight() / 2, (int) (this.q * 30.0f), this.k);
}
if (this.aA != null) {
this.k.setColor(-65536);
canvas.drawCircle(this.aA.x, this.aA.y, (int) (this.q * 20.0f), this.k);
}
if (this.ad != null) {
this.k.setColor(-16776961);
float f24 = this.ad.x;
PointF pointF22 = this.ax;
float f25 = pointF22 == null ? Float.NaN : (f24 * this.ao) + pointF22.x;
float f26 = this.ad.y;
PointF pointF23 = this.ax;
canvas.drawCircle(f25, pointF23 == null ? Float.NaN : (f26 * this.ao) + pointF23.y, (int) (this.q * 35.0f), this.k);
}
if (this.af != null && this.E) {
this.k.setColor(-16711681);
canvas.drawCircle(this.af.x, this.af.y, (int) (this.q * 30.0f), this.k);
}
this.k.setColor(-65281);
}
}
}
private static void c(float[] fArr, float f, float f2, float f3, float f4, float f5, float f6, float f7, float f8) {
fArr[0] = f;
fArr[1] = f2;
fArr[2] = f3;
fArr[3] = f4;
fArr[4] = f5;
fArr[5] = f6;
fArr[6] = f7;
fArr[7] = f8;
}
private boolean f() {
boolean z = true;
if (!this.C || (this.j != null && !this.n)) {
return true;
}
Map<Integer, List<jbe>> map = this.as;
if (map == null) {
return false;
}
for (Map.Entry<Integer, List<jbe>> entry : map.entrySet()) {
if (entry.getKey().intValue() == this.B) {
for (jbe jbeVar : entry.getValue()) {
if (jbeVar.a || jbeVar.c == null) {
z = false;
}
}
}
}
return z;
}
private boolean i() {
boolean z = getWidth() > 0 && getHeight() > 0 && this.ap > 0 && this.al > 0 && (this.j != null || f());
if (!this.ah && z) {
h();
this.ah = true;
}
return z;
}
/* JADX WARN: Multi-variable type inference failed */
private void Pj_(Point point) {
int i;
int i2;
synchronized (this) {
Integer.valueOf(point.x);
Integer.valueOf(point.y);
byte b2 = 0;
ZqN zqN = new ZqN(BitmapDescriptorFactory.HUE_RED, new PointF(BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED), b2);
this.ar = zqN;
int i3 = 1;
e(true, zqN);
int e2 = e(this.ar.c);
this.B = e2;
if (e2 > 1) {
this.B = e2 / 2;
}
int i4 = 270;
int i5 = 90;
int i6 = -1;
if (this.B == 1 && this.aq == null) {
int i7 = this.R;
if (i7 == -1) {
i7 = this.aj;
}
if (((i7 == 90 || i7 == 270) ? this.al : this.ap) < point.x) {
int i8 = this.R;
if (i8 == -1) {
i8 = this.aj;
}
if (((i8 == 90 || i8 == 270) ? this.ap : this.al) < point.y) {
this.r.c();
this.r = null;
new RVV(this, getContext(), this.f, this.az, false).executeOnExecutor(this.z, new Void[0]);
}
}
}
int i9 = point.x;
int i10 = point.y;
Integer.valueOf(i9);
Integer.valueOf(i10);
this.as = new LinkedHashMap();
int i11 = this.B;
int i12 = 1;
int i13 = 1;
while (true) {
int i14 = this.R;
int i15 = i14 == i6 ? this.aj : i14;
int i16 = ((i15 == i5 || i15 == i4) ? this.al : this.ap) / i12;
if (i14 == i6) {
i14 = this.aj;
}
int i17 = ((i14 == i5 || i14 == i4) ? this.ap : this.al) / i13;
int i18 = i16 / i11;
int i19 = i17 / i11;
while (true) {
if (i18 + i12 + i3 > point.x || (i18 > getWidth() * 1.25d && i11 < this.B)) {
byte b3 = b2;
i12++;
int i20 = this.R;
i6 = -1;
if (i20 == -1) {
i20 = this.aj;
}
int i21 = ((i20 == 90 || i20 == 270) ? this.al : this.ap) / i12;
i18 = i21 / i11;
b2 = b3;
i16 = i21;
}
}
while (true) {
if (i19 + i13 + i3 > point.y || (i19 > getHeight() * 1.25d && i11 < this.B)) {
byte b4 = b2;
i13++;
int i22 = this.R;
if (i22 == -1) {
i22 = this.aj;
}
i17 = ((i22 == 90 || i22 == 270) ? this.ap : this.al) / i13;
i19 = i17 / i11;
b2 = b4;
i6 = -1;
}
}
ArrayList arrayList = new ArrayList(i12 * i13);
int i23 = b2;
while (i23 < i12) {
int i24 = b2;
while (i24 < i13) {
jbe jbeVar = new jbe(b2);
jbeVar.e = i11;
jbeVar.j = i11 == this.B ? i3 : b2;
if (i23 == i12 - 1) {
int i25 = this.R;
if (i25 == i6) {
i25 = this.aj;
}
i = (i25 == 90 || i25 == 270) ? this.al : this.ap;
} else {
i = (i23 + 1) * i16;
}
if (i24 == i13 - 1) {
int i26 = this.R;
if (i26 == i6) {
i26 = this.aj;
}
i2 = (i26 == 90 || i26 == 270) ? this.ap : this.al;
} else {
i2 = (i24 + 1) * i17;
}
jbeVar.d = new Rect(i23 * i16, i24 * i17, i, i2);
jbeVar.i = new Rect(0, 0, 0, 0);
jbeVar.b = new Rect(jbeVar.d);
arrayList.add(jbeVar);
i24++;
i3 = 1;
i6 = -1;
b2 = 0;
}
i23++;
i3 = 1;
i6 = -1;
b2 = 0;
}
this.as.put(Integer.valueOf(i11), arrayList);
if (i11 == 1) {
break;
}
i11 /= 2;
i3 = 1;
i4 = 270;
i5 = 90;
i6 = -1;
b2 = 0;
}
List<jbe> list = this.as.get(Integer.valueOf(this.B));
if (this.C) {
Iterator<jbe> it = list.iterator();
while (it.hasNext()) {
new ojQ(this, this.r, it.next()).executeOnExecutor(this.z, new Void[0]);
}
a(true);
} else {
new ojQ(this, this.r, list.get(0)).executeOnExecutor(this.z, new Void[0]);
}
}
}
private void a(boolean z) {
if (this.r == null || this.as == null) {
return;
}
int min = Math.min(this.B, e(this.ao));
Iterator<Map.Entry<Integer, List<jbe>>> it = this.as.entrySet().iterator();
while (it.hasNext()) {
for (jbe jbeVar : it.next().getValue()) {
if (jbeVar.e < min || (jbeVar.e > min && jbeVar.e != this.B)) {
jbeVar.j = false;
if (jbeVar.c != null) {
jbeVar.c.recycle();
jbeVar.c = null;
}
}
if (jbeVar.e == min) {
if (!b(jbeVar)) {
if (jbeVar.e != this.B || !this.C) {
jbeVar.j = false;
if (jbeVar.c != null) {
jbeVar.c.recycle();
jbeVar.c = null;
}
}
} else {
jbeVar.j = true;
if (!jbeVar.a && jbeVar.c == null && z) {
new ojQ(this, this.r, jbeVar).executeOnExecutor(this.z, new Void[0]);
}
}
} else if (jbeVar.e == this.B) {
jbeVar.j = true;
}
}
}
}
private boolean b(jbe jbeVar) {
PointF pointF = this.ax;
float f = pointF == null ? Float.NaN : (BitmapDescriptorFactory.HUE_RED - pointF.x) / this.ao;
float width = getWidth();
PointF pointF2 = this.ax;
float f2 = pointF2 == null ? Float.NaN : (width - pointF2.x) / this.ao;
PointF pointF3 = this.ax;
float f3 = pointF3 == null ? Float.NaN : (BitmapDescriptorFactory.HUE_RED - pointF3.y) / this.ao;
float height = getHeight();
PointF pointF4 = this.ax;
return f <= ((float) jbeVar.d.right) && ((float) jbeVar.d.left) <= f2 && f3 <= ((float) jbeVar.d.bottom) && ((float) jbeVar.d.top) <= (pointF4 != null ? (height - pointF4.y) / this.ao : Float.NaN);
}
private void h() {
Float f;
if (getWidth() == 0 || getHeight() == 0 || this.ap <= 0 || this.al <= 0) {
return;
}
if (this.ai != null && (f = this.U) != null) {
this.ao = f.floatValue();
if (this.ax == null) {
this.ax = new PointF();
}
this.ax.x = (getWidth() / 2) - (this.ao * this.ai.x);
this.ax.y = (getHeight() / 2) - (this.ao * this.ai.y);
this.ai = null;
this.U = null;
e(true);
a(true);
}
e(false);
}
/* JADX WARN: Removed duplicated region for block: B:37:0x009e A[LOOP:0: B:35:0x009a->B:37:0x009e, LOOP_END] */
/* JADX WARN: Removed duplicated region for block: B:38:0x00a0 A[SYNTHETIC] */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
private int e(float r8) {
/*
r7 = this;
int r0 = r7.S
if (r0 <= 0) goto L19
android.content.res.Resources r0 = r7.getResources()
android.util.DisplayMetrics r0 = r0.getDisplayMetrics()
float r1 = r0.xdpi
float r0 = r0.ydpi
float r1 = r1 + r0
r0 = 1073741824(0x40000000, float:2.0)
float r1 = r1 / r0
int r0 = r7.S
float r0 = (float) r0
float r0 = r0 / r1
float r8 = r8 * r0
L19:
int r0 = r7.R
r1 = -1
if (r0 != r1) goto L21
int r2 = r7.aj
goto L22
L21:
r2 = r0
L22:
r3 = 270(0x10e, float:3.78E-43)
r4 = 90
if (r2 == r4) goto L2d
if (r2 == r3) goto L2d
int r2 = r7.ap
goto L2f
L2d:
int r2 = r7.al
L2f:
float r2 = (float) r2
float r2 = r2 * r8
int r2 = (int) r2
if (r0 != r1) goto L37
int r5 = r7.aj
goto L38
L37:
r5 = r0
L38:
if (r5 == r4) goto L3f
if (r5 == r3) goto L3f
int r5 = r7.al
goto L41
L3f:
int r5 = r7.ap
L41:
float r5 = (float) r5
float r5 = r5 * r8
int r8 = (int) r5
if (r2 == 0) goto La1
if (r8 == 0) goto La1
if (r0 != r1) goto L4d
int r5 = r7.aj
goto L4e
L4d:
r5 = r0
L4e:
if (r5 == r4) goto L55
if (r5 == r3) goto L55
int r5 = r7.al
goto L57
L55:
int r5 = r7.ap
L57:
r6 = 1
if (r5 > r8) goto L6d
if (r0 != r1) goto L5f
int r5 = r7.aj
goto L60
L5f:
r5 = r0
L60:
if (r5 == r4) goto L67
if (r5 == r3) goto L67
int r5 = r7.ap
goto L69
L67:
int r5 = r7.al
L69:
if (r5 > r2) goto L6d
r8 = r6
goto L9a
L6d:
if (r0 != r1) goto L71
int r0 = r7.aj
L71:
if (r0 == r4) goto L78
if (r0 == r3) goto L78
int r0 = r7.al
goto L7a
L78:
int r0 = r7.ap
L7a:
float r0 = (float) r0
float r8 = (float) r8
float r0 = r0 / r8
int r8 = java.lang.Math.round(r0)
int r0 = r7.R
if (r0 != r1) goto L87
int r0 = r7.aj
L87:
if (r0 == r4) goto L8e
if (r0 == r3) goto L8e
int r0 = r7.ap
goto L90
L8e:
int r0 = r7.al
L90:
float r0 = (float) r0
float r1 = (float) r2
float r0 = r0 / r1
int r0 = java.lang.Math.round(r0)
if (r8 < r0) goto L9a
r8 = r0
L9a:
int r0 = r6 << 1
if (r0 >= r8) goto La0
r6 = r0
goto L9a
La0:
return r6
La1:
r8 = 32
return r8
*/
throw new UnsupportedOperationException("Method not decompiled: com.pdfview.subsamplincscaleimageview.SubsamplingScaleImageView.e(float):int");
}
private void e(boolean z) {
boolean z2;
PointF pointF = this.ax;
byte b2 = 0;
float f = BitmapDescriptorFactory.HUE_RED;
if (pointF == null) {
this.ax = new PointF(BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED);
z2 = true;
} else {
z2 = false;
}
if (this.ar == null) {
this.ar = new ZqN(f, new PointF(BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED), b2);
}
this.ar.c = this.ao;
this.ar.e.set(this.ax);
e(z, this.ar);
this.ao = this.ar.c;
this.ax.set(this.ar.e);
if (!z2 || this.M == 4) {
return;
}
PointF pointF2 = this.ax;
int i = this.R;
int i2 = i == -1 ? this.aj : i;
float f2 = ((i2 == 90 || i2 == 270) ? this.al : this.ap) / 2;
if (i == -1) {
i = this.aj;
}
pointF2.set(Pl_(f2, ((i == 90 || i == 270) ? this.ap : this.al) / 2, this.ao));
}
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes3.dex */
public static class saX extends AsyncTask<Void, Void, int[]> {
private final Uri a;
private InterfaceC14459ftc b;
private Exception c;
private final WeakReference<Context> d;
private final WeakReference<VoW<? extends InterfaceC14459ftc>> e;
private final WeakReference<SubsamplingScaleImageView> f;
@Override // android.os.AsyncTask
protected final /* synthetic */ int[] doInBackground(Void[] voidArr) {
return b();
}
@Override // android.os.AsyncTask
protected final /* synthetic */ void onPostExecute(int[] iArr) {
int[] iArr2 = iArr;
SubsamplingScaleImageView subsamplingScaleImageView = this.f.get();
if (subsamplingScaleImageView != null) {
InterfaceC14459ftc interfaceC14459ftc = this.b;
if (interfaceC14459ftc == null || iArr2 == null || iArr2.length != 3) {
if (this.c == null || subsamplingScaleImageView.P == null) {
return;
}
IeS unused = subsamplingScaleImageView.P;
return;
}
SubsamplingScaleImageView.a(subsamplingScaleImageView, interfaceC14459ftc, iArr2[0], iArr2[1], iArr2[2]);
}
}
saX(SubsamplingScaleImageView subsamplingScaleImageView, Context context, VoW<? extends InterfaceC14459ftc> voW, Uri uri) {
this.f = new WeakReference<>(subsamplingScaleImageView);
this.d = new WeakReference<>(context);
this.e = new WeakReference<>(voW);
this.a = uri;
}
private int[] b() {
try {
String obj = this.a.toString();
Context context = this.d.get();
VoW<? extends InterfaceC14459ftc> voW = this.e.get();
SubsamplingScaleImageView subsamplingScaleImageView = this.f.get();
if (context == null || voW == null || subsamplingScaleImageView == null) {
return null;
}
SubsamplingScaleImageView.e();
InterfaceC14459ftc c = voW.c();
this.b = c;
Point Pv_ = c.Pv_(context, this.a);
int i = Pv_.x;
int i2 = Pv_.y;
int e = SubsamplingScaleImageView.e(context, obj);
if (subsamplingScaleImageView.aq != null) {
subsamplingScaleImageView.aq.left = Math.max(0, subsamplingScaleImageView.aq.left);
subsamplingScaleImageView.aq.top = Math.max(0, subsamplingScaleImageView.aq.top);
subsamplingScaleImageView.aq.right = Math.min(i, subsamplingScaleImageView.aq.right);
subsamplingScaleImageView.aq.bottom = Math.min(i2, subsamplingScaleImageView.aq.bottom);
i = subsamplingScaleImageView.aq.width();
i2 = subsamplingScaleImageView.aq.height();
}
return new int[]{i, i2, e};
} catch (Exception e2) {
String unused = SubsamplingScaleImageView.d;
this.c = e2;
return null;
}
}
}
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes3.dex */
public static class ojQ extends AsyncTask<Void, Void, Bitmap> {
private final WeakReference<jbe> a;
private final WeakReference<InterfaceC14459ftc> b;
private final WeakReference<SubsamplingScaleImageView> d;
private Exception e;
@Override // android.os.AsyncTask
protected final /* synthetic */ Bitmap doInBackground(Void[] voidArr) {
return Pp_();
}
@Override // android.os.AsyncTask
protected final /* synthetic */ void onPostExecute(Bitmap bitmap) {
Bitmap bitmap2 = bitmap;
SubsamplingScaleImageView subsamplingScaleImageView = this.d.get();
jbe jbeVar = this.a.get();
if (subsamplingScaleImageView == null || jbeVar == null) {
return;
}
if (bitmap2 == null) {
if (this.e == null || subsamplingScaleImageView.P == null) {
return;
}
IeS unused = subsamplingScaleImageView.P;
return;
}
jbeVar.c = bitmap2;
jbeVar.a = false;
SubsamplingScaleImageView.m(subsamplingScaleImageView);
}
ojQ(SubsamplingScaleImageView subsamplingScaleImageView, InterfaceC14459ftc interfaceC14459ftc, jbe jbeVar) {
this.d = new WeakReference<>(subsamplingScaleImageView);
this.b = new WeakReference<>(interfaceC14459ftc);
this.a = new WeakReference<>(jbeVar);
jbeVar.a = true;
}
private Bitmap Pp_() {
try {
SubsamplingScaleImageView subsamplingScaleImageView = this.d.get();
InterfaceC14459ftc interfaceC14459ftc = this.b.get();
jbe jbeVar = this.a.get();
if (interfaceC14459ftc == null || jbeVar == null || subsamplingScaleImageView == null || !interfaceC14459ftc.a() || !jbeVar.j) {
if (jbeVar == null) {
return null;
}
jbeVar.a = false;
return null;
}
Rect rect = jbeVar.d;
Integer.valueOf(jbeVar.e);
SubsamplingScaleImageView.e();
subsamplingScaleImageView.s.readLock().lock();
try {
if (interfaceC14459ftc.a()) {
SubsamplingScaleImageView.Pc_(subsamplingScaleImageView, jbeVar.d, jbeVar.b);
if (subsamplingScaleImageView.aq != null) {
jbeVar.b.offset(subsamplingScaleImageView.aq.left, subsamplingScaleImageView.aq.top);
}
return interfaceC14459ftc.Pu_(jbeVar.b, jbeVar.e);
}
jbeVar.a = false;
subsamplingScaleImageView.s.readLock().unlock();
return null;
} finally {
subsamplingScaleImageView.s.readLock().unlock();
}
} catch (Exception e) {
String unused = SubsamplingScaleImageView.d;
this.e = e;
return null;
} catch (OutOfMemoryError e2) {
String unused2 = SubsamplingScaleImageView.d;
this.e = new RuntimeException(e2);
return null;
}
}
}
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes3.dex */
public static class RVV extends AsyncTask<Void, Void, Integer> {
private final WeakReference<VoW<? extends xOV>> a;
private final WeakReference<Context> b;
private final boolean c = false;
private Bitmap d;
private Exception e;
private final WeakReference<SubsamplingScaleImageView> f;
private final Uri g;
@Override // android.os.AsyncTask
protected final /* synthetic */ Integer doInBackground(Void[] voidArr) {
return c();
}
@Override // android.os.AsyncTask
protected final /* synthetic */ void onPostExecute(Integer num) {
Integer num2 = num;
SubsamplingScaleImageView subsamplingScaleImageView = this.f.get();
if (subsamplingScaleImageView != null) {
Bitmap bitmap = this.d;
if (bitmap != null && num2 != null) {
if (this.c) {
SubsamplingScaleImageView.Pd_(subsamplingScaleImageView, bitmap);
return;
} else {
SubsamplingScaleImageView.Pe_(subsamplingScaleImageView, bitmap, num2.intValue());
return;
}
}
if (this.e == null || subsamplingScaleImageView.P == null) {
return;
}
if (this.c) {
IeS unused = subsamplingScaleImageView.P;
} else {
IeS unused2 = subsamplingScaleImageView.P;
}
}
}
RVV(SubsamplingScaleImageView subsamplingScaleImageView, Context context, VoW<? extends xOV> voW, Uri uri, boolean z) {
this.f = new WeakReference<>(subsamplingScaleImageView);
this.b = new WeakReference<>(context);
this.a = new WeakReference<>(voW);
this.g = uri;
}
private Integer c() {
try {
String obj = this.g.toString();
Context context = this.b.get();
VoW<? extends xOV> voW = this.a.get();
SubsamplingScaleImageView subsamplingScaleImageView = this.f.get();
if (context == null || voW == null || subsamplingScaleImageView == null) {
return null;
}
SubsamplingScaleImageView.e();
this.d = voW.c().Pt_(context, this.g);
return Integer.valueOf(SubsamplingScaleImageView.e(context, obj));
} catch (Exception e) {
String unused = SubsamplingScaleImageView.d;
this.e = e;
return null;
} catch (OutOfMemoryError e2) {
String unused2 = SubsamplingScaleImageView.d;
this.e = new RuntimeException(e2);
return null;
}
}
}
/* JADX INFO: Access modifiers changed from: private */
/* JADX WARN: Code restructure failed: missing block: B:13:0x0035, code lost:
if (r2 != null) goto L20;
*/
/* JADX WARN: Code restructure failed: missing block: B:14:0x0044, code lost:
return r1;
*/
/* JADX WARN: Code restructure failed: missing block: B:16:0x0041, code lost:
r2.close();
*/
/* JADX WARN: Code restructure failed: missing block: B:17:0x003f, code lost:
if (r2 != null) goto L20;
*/
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public static int e(android.content.Context r9, java.lang.String r10) {
/*
r0 = 1
r1 = 0
r2 = 0
java.lang.String[] r5 = new java.lang.String[r0] // Catch: java.lang.Throwable -> L38 java.lang.Exception -> L3f
java.lang.String r0 = "orientation"
r5[r1] = r0 // Catch: java.lang.Throwable -> L38 java.lang.Exception -> L3f
android.content.ContentResolver r3 = r9.getContentResolver() // Catch: java.lang.Throwable -> L38 java.lang.Exception -> L3f
android.net.Uri r4 = android.net.Uri.parse(r10) // Catch: java.lang.Throwable -> L38 java.lang.Exception -> L3f
r6 = 0
r7 = 0
r8 = 0
android.database.Cursor r2 = r3.query(r4, r5, r6, r7, r8) // Catch: java.lang.Throwable -> L38 java.lang.Exception -> L3f
if (r2 == 0) goto L35
boolean r9 = r2.moveToFirst() // Catch: java.lang.Throwable -> L38 java.lang.Exception -> L3f
if (r9 == 0) goto L35
int r9 = r2.getInt(r1) // Catch: java.lang.Throwable -> L38 java.lang.Exception -> L3f
java.util.List<java.lang.Integer> r10 = com.pdfview.subsamplincscaleimageview.SubsamplingScaleImageView.b // Catch: java.lang.Throwable -> L38 java.lang.Exception -> L3f
java.lang.Integer r0 = java.lang.Integer.valueOf(r9) // Catch: java.lang.Throwable -> L38 java.lang.Exception -> L3f
boolean r10 = r10.contains(r0) // Catch: java.lang.Throwable -> L38 java.lang.Exception -> L3f
if (r10 == 0) goto L35
r10 = -1
if (r9 != r10) goto L34
goto L35
L34:
r1 = r9
L35:
if (r2 == 0) goto L44
goto L41
L38:
r9 = move-exception
if (r2 == 0) goto L3e
r2.close()
L3e:
throw r9
L3f:
if (r2 == 0) goto L44
L41:
r2.close()
L44:
return r1
*/
throw new UnsupportedOperationException("Method not decompiled: com.pdfview.subsamplincscaleimageview.SubsamplingScaleImageView.e(android.content.Context, java.lang.String):int");
}
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes3.dex */
public static class jbe {
boolean a;
Rect b;
Bitmap c;
Rect d;
int e;
Rect i;
boolean j;
private jbe() {
}
/* synthetic */ jbe(byte b) {
this();
}
}
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes3.dex */
public static class HBt {
long a;
boolean b;
int c;
int d;
Sts e;
float f;
PointF g;
PointF h;
PointF i;
float j;
long k;
PointF n;
/* renamed from: o, reason: collision with root package name */
PointF f6508o;
private HBt() {
this.a = 500L;
this.b = true;
this.d = 2;
this.c = 1;
this.k = System.currentTimeMillis();
}
/* synthetic */ HBt(byte b) {
this();
}
}
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes3.dex */
public static class ZqN {
float c;
final PointF e;
/* synthetic */ ZqN(float f, PointF pointF, byte b) {
this(f, pointF);
}
private ZqN(float f, PointF pointF) {
this.c = f;
this.e = pointF;
}
}
public final void g() {
b(true);
this.m = null;
this.t = null;
this.k = null;
this.aw = null;
}
public final PointF Pn_(float f, float f2, PointF pointF) {
PointF pointF2 = this.ax;
if (pointF2 == null) {
return null;
}
float f3 = pointF2 == null ? Float.NaN : (f * this.ao) + pointF2.x;
PointF pointF3 = this.ax;
pointF.set(f3, pointF3 != null ? (f2 * this.ao) + pointF3.y : Float.NaN);
return pointF;
}
private PointF Pl_(float f, float f2, float f3) {
int paddingLeft = getPaddingLeft();
int width = ((getWidth() - getPaddingRight()) - getPaddingLeft()) / 2;
int paddingTop = getPaddingTop();
int height = ((getHeight() - getPaddingBottom()) - getPaddingTop()) / 2;
if (this.ar == null) {
this.ar = new ZqN(BitmapDescriptorFactory.HUE_RED, new PointF(BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED), (byte) 0);
}
this.ar.c = f3;
this.ar.e.set((paddingLeft + width) - (f * f3), (paddingTop + height) - (f2 * f3));
e(true, this.ar);
return this.ar.e;
}
private float j() {
int paddingBottom = getPaddingBottom() + getPaddingTop();
int paddingLeft = getPaddingLeft() + getPaddingRight();
int i = this.M;
if (i == 2 || i == 4) {
float width = getWidth() - paddingLeft;
int i2 = this.R;
if (i2 == -1) {
i2 = this.aj;
}
float f = width / ((i2 == 90 || i2 == 270) ? this.al : this.ap);
float height = getHeight() - paddingBottom;
int i3 = this.R;
if (i3 == -1) {
i3 = this.aj;
}
return Math.max(f, height / ((i3 == 90 || i3 == 270) ? this.ap : this.al));
}
if (i == 3) {
float f2 = this.L;
if (f2 > BitmapDescriptorFactory.HUE_RED) {
return f2;
}
}
float width2 = getWidth() - paddingLeft;
int i4 = this.R;
if (i4 == -1) {
i4 = this.aj;
}
float f3 = width2 / ((i4 == 90 || i4 == 270) ? this.al : this.ap);
float height2 = getHeight() - paddingBottom;
int i5 = this.R;
if (i5 == -1) {
i5 = this.aj;
}
return Math.min(f3, height2 / ((i5 == 90 || i5 == 270) ? this.ap : this.al));
}
private static float d(int i, long j, float f, float f2, long j2) {
float f3;
if (i == 1) {
float f4 = ((float) j) / ((float) j2);
return ((-f2) * f4 * (f4 - 2.0f)) + f;
}
if (i != 2) {
throw new IllegalStateException("Unexpected easing type: ".concat(String.valueOf(i)));
}
float f5 = ((float) j) / (((float) j2) / 2.0f);
if (f5 < 1.0f) {
f3 = (f2 / 2.0f) * f5;
} else {
float f6 = f5 - 1.0f;
f3 = (-f2) / 2.0f;
f5 = (f6 * (f6 - 2.0f)) - 1.0f;
}
return (f3 * f5) + f;
}
public final void setRegionDecoderClass(Class<? extends InterfaceC14459ftc> cls) {
if (cls == null) {
throw new IllegalArgumentException("Decoder class cannot be set to null");
}
this.am = new UtM(cls);
}
public final void setRegionDecoderFactory(VoW<? extends InterfaceC14459ftc> voW) {
if (voW == null) {
throw new IllegalArgumentException("Decoder factory cannot be set to null");
}
this.am = voW;
}
public final void setBitmapDecoderClass(Class<? extends xOV> cls) {
if (cls == null) {
throw new IllegalArgumentException("Decoder class cannot be set to null");
}
this.f = new UtM(cls);
}
public final void setBitmapDecoderFactory(VoW<? extends xOV> voW) {
if (voW == null) {
throw new IllegalArgumentException("Decoder factory cannot be set to null");
}
this.f = voW;
}
public final void setPanLimit(int i) {
if (!a.contains(Integer.valueOf(i))) {
throw new IllegalArgumentException("Invalid pan limit: ".concat(String.valueOf(i)));
}
this.V = i;
if (this.ah) {
e(true);
invalidate();
}
}
public final void setMinimumScaleType(int i) {
if (!c.contains(Integer.valueOf(i))) {
throw new IllegalArgumentException("Invalid scale type: ".concat(String.valueOf(i)));
}
this.M = i;
if (this.ah) {
e(true);
invalidate();
}
}
public final void setMinimumDpi(int i) {
DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
setMaxScale(((displayMetrics.xdpi + displayMetrics.ydpi) / 2.0f) / i);
}
public final void setMaximumDpi(int i) {
DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
setMinScale(((displayMetrics.xdpi + displayMetrics.ydpi) / 2.0f) / i);
}
public void setMinimumTileDpi(int i) {
DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
this.S = (int) Math.min((displayMetrics.xdpi + displayMetrics.ydpi) / 2.0f, i);
if (this.ah) {
b(false);
invalidate();
}
}
public final PointF Pm_() {
float width = getWidth() / 2;
float height = getHeight() / 2;
PointF pointF = new PointF();
PointF pointF2 = this.ax;
if (pointF2 == null) {
return null;
}
float f = pointF2 == null ? Float.NaN : (width - pointF2.x) / this.ao;
PointF pointF3 = this.ax;
pointF.set(f, pointF3 != null ? (height - pointF3.y) / this.ao : Float.NaN);
return pointF;
}
public final void setScaleAndCenter(float f, PointF pointF) {
this.i = null;
this.U = Float.valueOf(f);
this.ai = pointF;
this.an = pointF;
invalidate();
}
public final void setPanEnabled(boolean z) {
PointF pointF;
this.W = z;
if (z || (pointF = this.ax) == null) {
return;
}
pointF.x = (getWidth() / 2) - (this.ao * (n() / 2));
this.ax.y = (getHeight() / 2) - (this.ao * (o() / 2));
if (this.ah) {
a(true);
invalidate();
}
}
public final void setTileBackgroundColor(int i) {
if (Color.alpha(i) == 0) {
this.aw = null;
} else {
Paint paint = new Paint();
this.aw = paint;
paint.setStyle(Paint.Style.FILL);
this.aw.setColor(i);
}
invalidate();
}
public final void setDoubleTapZoomDpi(int i) {
DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
setDoubleTapZoomScale(((displayMetrics.xdpi + displayMetrics.ydpi) / 2.0f) / i);
}
public final void setDoubleTapZoomStyle(int i) {
if (!g.contains(Integer.valueOf(i))) {
throw new IllegalArgumentException("Invalid zoom style: ".concat(String.valueOf(i)));
}
this.x = i;
}
public final void setDoubleTapZoomDuration(int i) {
this.v = Math.max(0, i);
}
public void setExecutor(Executor executor) {
if (executor == null) {
throw new NullPointerException("Executor must not be null");
}
this.z = executor;
}
private void Pk_(PointF pointF) {
if (this.Q == null || this.ax.equals(pointF)) {
return;
}
float width = getWidth() / 2;
float height = getHeight() / 2;
PointF pointF2 = new PointF();
PointF pointF3 = this.ax;
if (pointF3 != null) {
float f = pointF3 == null ? Float.NaN : (width - pointF3.x) / this.ao;
PointF pointF4 = this.ax;
pointF2.set(f, pointF4 != null ? (height - pointF4.y) / this.ao : Float.NaN);
}
}
/* loaded from: classes3.dex */
public final class LWm {
int a;
long b;
int c;
boolean d;
boolean e;
private Sts f;
private final PointF g;
private final PointF h;
private SubsamplingScaleImageView i;
private final float j;
/* synthetic */ LWm(SubsamplingScaleImageView subsamplingScaleImageView, float f, PointF pointF, byte b) {
this(subsamplingScaleImageView, f, pointF);
}
/* synthetic */ LWm(SubsamplingScaleImageView subsamplingScaleImageView, float f, PointF pointF, PointF pointF2, byte b) {
this(subsamplingScaleImageView, f, pointF, pointF2);
}
/* synthetic */ LWm(SubsamplingScaleImageView subsamplingScaleImageView, PointF pointF, byte b) {
this(subsamplingScaleImageView, pointF);
}
private LWm(SubsamplingScaleImageView subsamplingScaleImageView, PointF pointF) {
this.i = subsamplingScaleImageView;
this.b = 500L;
this.a = 2;
this.c = 1;
this.e = true;
this.d = true;
this.j = subsamplingScaleImageView.ao;
this.h = pointF;
this.g = null;
}
private LWm(SubsamplingScaleImageView subsamplingScaleImageView, float f, PointF pointF) {
this.i = subsamplingScaleImageView;
this.b = 500L;
this.a = 2;
this.c = 1;
this.e = true;
this.d = true;
this.j = f;
this.h = pointF;
this.g = null;
}
private LWm(SubsamplingScaleImageView subsamplingScaleImageView, float f, PointF pointF, PointF pointF2) {
this.i = subsamplingScaleImageView;
this.b = 500L;
this.a = 2;
this.c = 1;
this.e = true;
this.d = true;
this.j = f;
this.h = pointF;
this.g = pointF2;
}
public final void a() {
if (this.i.i != null) {
Sts sts = this.i.i.e;
}
int paddingLeft = this.i.getPaddingLeft();
int width = ((this.i.getWidth() - this.i.getPaddingRight()) - this.i.getPaddingLeft()) / 2;
int paddingTop = this.i.getPaddingTop();
int height = ((this.i.getHeight() - this.i.getPaddingBottom()) - this.i.getPaddingTop()) / 2;
float b = SubsamplingScaleImageView.b(this.i, this.j);
PointF Pf_ = this.d ? SubsamplingScaleImageView.Pf_(this.i, this.h.x, this.h.y, b, new PointF()) : this.h;
byte b2 = 0;
this.i.i = new HBt(b2);
this.i.i.j = this.i.ao;
this.i.i.f = b;
this.i.i.k = System.currentTimeMillis();
this.i.i.h = Pf_;
this.i.i.g = this.i.Pm_();
this.i.i.i = Pf_;
this.i.i.f6508o = this.i.Pn_(Pf_.x, Pf_.y, new PointF());
this.i.i.n = new PointF(paddingLeft + width, paddingTop + height);
this.i.i.a = this.b;
this.i.i.b = this.e;
this.i.i.d = this.a;
this.i.i.c = this.c;
this.i.i.k = System.currentTimeMillis();
this.i.i.e = null;
PointF pointF = this.g;
if (pointF != null) {
float f = pointF.x - (this.i.i.g.x * b);
float f2 = this.g.y - (this.i.i.g.y * b);
ZqN zqN = new ZqN(b, new PointF(f, f2), b2);
this.i.e(true, zqN);
this.i.i.n = new PointF(this.g.x + (zqN.e.x - f), this.g.y + (zqN.e.y - f2));
}
this.i.invalidate();
}
}
static /* synthetic */ void Pc_(SubsamplingScaleImageView subsamplingScaleImageView, Rect rect, Rect rect2) {
int i = subsamplingScaleImageView.R;
if ((i == -1 ? subsamplingScaleImageView.aj : i) == 0) {
rect2.set(rect);
return;
}
if ((i == -1 ? subsamplingScaleImageView.aj : i) == 90) {
rect2.set(rect.top, subsamplingScaleImageView.al - rect.right, rect.bottom, subsamplingScaleImageView.al - rect.left);
return;
}
if (i == -1) {
i = subsamplingScaleImageView.aj;
}
if (i == 180) {
rect2.set(subsamplingScaleImageView.ap - rect.right, subsamplingScaleImageView.al - rect.bottom, subsamplingScaleImageView.ap - rect.left, subsamplingScaleImageView.al - rect.top);
} else {
rect2.set(subsamplingScaleImageView.ap - rect.bottom, rect.left, subsamplingScaleImageView.ap - rect.top, rect.right);
}
}
static /* synthetic */ float b(SubsamplingScaleImageView subsamplingScaleImageView, float f) {
return Math.min(subsamplingScaleImageView.F, Math.max(subsamplingScaleImageView.j(), f));
}
static /* synthetic */ PointF Pf_(SubsamplingScaleImageView subsamplingScaleImageView, float f, float f2, float f3, PointF pointF) {
PointF Pl_ = subsamplingScaleImageView.Pl_(f, f2, f3);
pointF.set(((subsamplingScaleImageView.getPaddingLeft() + (((subsamplingScaleImageView.getWidth() - subsamplingScaleImageView.getPaddingRight()) - subsamplingScaleImageView.getPaddingLeft()) / 2)) - Pl_.x) / f3, ((subsamplingScaleImageView.getPaddingTop() + (((subsamplingScaleImageView.getHeight() - subsamplingScaleImageView.getPaddingBottom()) - subsamplingScaleImageView.getPaddingTop()) / 2)) - Pl_.y) / f3);
return pointF;
}
/* JADX INFO: Access modifiers changed from: private */
public void e(boolean z, ZqN zqN) {
float max;
int max2;
float max3;
if (this.V == 2 && this.ah) {
z = false;
}
PointF pointF = zqN.e;
float min = Math.min(this.F, Math.max(j(), zqN.c));
int i = this.R;
int i2 = i == -1 ? this.aj : i;
float f = ((i2 == 90 || i2 == 270) ? this.al : this.ap) * min;
if (i == -1) {
i = this.aj;
}
float f2 = ((i == 90 || i == 270) ? this.ap : this.al) * min;
if (this.V == 3 && this.ah) {
pointF.x = Math.max(pointF.x, (getWidth() / 2) - f);
pointF.y = Math.max(pointF.y, (getHeight() / 2) - f2);
} else if (z) {
pointF.x = Math.max(pointF.x, getWidth() - f);
pointF.y = Math.max(pointF.y, getHeight() - f2);
} else {
pointF.x = Math.max(pointF.x, -f);
pointF.y = Math.max(pointF.y, -f2);
}
float paddingLeft = (getPaddingLeft() > 0 || getPaddingRight() > 0) ? getPaddingLeft() / (getPaddingLeft() + getPaddingRight()) : 0.5f;
float paddingTop = (getPaddingTop() > 0 || getPaddingBottom() > 0) ? getPaddingTop() / (getPaddingTop() + getPaddingBottom()) : 0.5f;
if (this.V == 3 && this.ah) {
max = Math.max(0, getWidth() / 2);
max2 = Math.max(0, getHeight() / 2);
} else {
if (z) {
max = Math.max(BitmapDescriptorFactory.HUE_RED, (getWidth() - f) * paddingLeft);
max3 = Math.max(BitmapDescriptorFactory.HUE_RED, (getHeight() - f2) * paddingTop);
pointF.x = Math.min(pointF.x, max);
pointF.y = Math.min(pointF.y, max3);
zqN.c = min;
}
max = Math.max(0, getWidth());
max2 = Math.max(0, getHeight());
}
max3 = max2;
pointF.x = Math.min(pointF.x, max);
pointF.y = Math.min(pointF.y, max3);
zqN.c = min;
}
private int o() {
int i = this.R;
if (i == -1) {
i = this.aj;
}
return (i == 90 || i == 270) ? this.ap : this.al;
}
private int n() {
int i = this.R;
if (i == -1) {
i = this.aj;
}
return (i == 90 || i == 270) ? this.al : this.ap;
}
/* JADX WARN: Code restructure failed: missing block: B:117:0x01ca, code lost:
if ((r3 * ((r7 == 90 || r7 == 270) ? r17.al : r17.ap)) >= getWidth()) goto L87;
*/
/* JADX WARN: Code restructure failed: missing block: B:183:0x0339, code lost:
if ((r4 * ((r7 == 90 || r7 == 270) ? r17.ap : r17.al)) < getHeight()) goto L180;
*/
/* JADX WARN: Code restructure failed: missing block: B:185:0x037d, code lost:
e(true);
r3 = r17.aA;
r4 = r17.ad;
r5 = r4.x;
r4 = r4.y;
r7 = new android.graphics.PointF();
r8 = r17.ax;
*/
/* JADX WARN: Code restructure failed: missing block: B:186:0x038f, code lost:
if (r8 != null) goto L206;
*/
/* JADX WARN: Code restructure failed: missing block: B:187:0x0392, code lost:
r2 = Float.NaN;
*/
/* JADX WARN: Code restructure failed: missing block: B:188:0x0394, code lost:
if (r8 != null) goto L209;
*/
/* JADX WARN: Code restructure failed: missing block: B:189:0x0396, code lost:
r5 = Float.NaN;
*/
/* JADX WARN: Code restructure failed: missing block: B:190:0x039e, code lost:
r8 = r17.ax;
*/
/* JADX WARN: Code restructure failed: missing block: B:191:0x03a0, code lost:
if (r8 != null) goto L213;
*/
/* JADX WARN: Code restructure failed: missing block: B:192:0x03a3, code lost:
r2 = r8.y + (r4 * r17.ao);
*/
/* JADX WARN: Code restructure failed: missing block: B:193:0x03a9, code lost:
r7.set(r5, r2);
r2 = r7;
*/
/* JADX WARN: Code restructure failed: missing block: B:194:0x0398, code lost:
r5 = (r5 * r17.ao) + r8.x;
*/
/* JADX WARN: Code restructure failed: missing block: B:195:0x03ad, code lost:
r3.set(r2);
r17.aC.set(r17.ax);
r17.au = r17.ao;
*/
/* JADX WARN: Code restructure failed: missing block: B:216:0x037a, code lost:
if ((r4 * ((r7 == 90 || r7 == 270) ? r17.al : r17.ap)) >= getWidth()) goto L179;
*/
/* JADX WARN: Code restructure failed: missing block: B:47:0x0088, code lost:
if (r7 != 262) goto L297;
*/
/* JADX WARN: Code restructure failed: missing block: B:93:0x0189, code lost:
if ((r3 * ((r9 == 90 || r9 == 270) ? r17.ap : r17.al)) < getHeight()) goto L88;
*/
/* JADX WARN: Code restructure failed: missing block: B:95:0x01cd, code lost:
e(true);
r17.aA.set(r4, r6);
r17.aC.set(r17.ax);
r17.au = r17.ao;
r17.ay = r2;
*/
/* JADX WARN: Multi-variable type inference failed */
/* JADX WARN: Removed duplicated region for block: B:51:0x0655 */
/* JADX WARN: Type inference failed for: r2v26 */
/* JADX WARN: Type inference failed for: r2v27, types: [int, boolean] */
/* JADX WARN: Type inference failed for: r2v28 */
@Override // android.view.View
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public boolean onTouchEvent(android.view.MotionEvent r18) {
/*
Method dump skipped, instructions count: 1629
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: com.pdfview.subsamplincscaleimageview.SubsamplingScaleImageView.onTouchEvent(android.view.MotionEvent):boolean");
}
public final PointF Po_(float f, float f2, PointF pointF) {
PointF pointF2 = this.ax;
if (pointF2 == null) {
return null;
}
float f3 = pointF2 == null ? Float.NaN : (f - pointF2.x) / this.ao;
PointF pointF3 = this.ax;
pointF.set(f3, pointF3 != null ? (f2 - pointF3.y) / this.ao : Float.NaN);
return pointF;
}
public final void setZoomEnabled(boolean z) {
this.aG = z;
}
public final void setQuickScaleEnabled(boolean z) {
this.ac = z;
}
public void setOnStateChangedListener(tOB tob) {
this.Q = tob;
}
@Override // android.view.View
public void setOnLongClickListener(View.OnLongClickListener onLongClickListener) {
this.O = onLongClickListener;
}
public void setOnImageEventListener(IeS ieS) {
this.P = ieS;
}
public final void setMinScale(float f) {
this.L = f;
}
public void setMaxTileSize(int i, int i2) {
this.N = i;
this.J = i2;
}
public void setMaxTileSize(int i) {
this.N = i;
this.J = i;
}
public final void setMaxScale(float f) {
this.F = f;
}
public final void setHasBaseLayerTiles(boolean z) {
this.C = z;
}
public void setEagerLoadingEnabled(boolean z) {
this.w = z;
}
public final void setDoubleTapZoomScale(float f) {
this.y = f;
}
public final void setDebug(boolean z) {
this.l = z;
}
public static void setPreferredBitmapConfig(Bitmap.Config config) {
h = config;
}
public static Bitmap.Config Pi_() {
return h;
}
}