50度灰 v5.8.2版本的 MD5 值为:9fe3d350fdc75fa1a3ec45509fa0107e
以下内容为反编译后的 SubsamplingScaleImageView.java 源代码,内容仅作参考
package com.luck.picture.lib.widget.longimage;
import android.content.Context;
import android.content.res.TypedArray;
import android.database.Cursor;
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.media.ExifInterface;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Handler;
import android.os.Message;
import android.support.annotation.AnyThread;
import android.support.annotation.NonNull;
import android.support.v4.internal.view.SupportMenu;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.util.Log;
import android.util.TypedValue;
import android.view.GestureDetector;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewParent;
import com.alibaba.fastjson.asm.Opcodes;
import com.luck.picture.lib.R;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.Executor;
public class SubsamplingScaleImageView extends View {
public static final int E = 180;
public static final int F = 270;
public static final int H = 1;
public static final int I = 2;
public static final int J = 3;
public static final int L = 1;
public static final int M = 2;
public static final int O = 1;
public static final int P = 2;
public static final int Q = 3;
public static final int S = 1;
public static final int T = 2;
public static final int U = 3;
public static final int W = 1;
public static final int a0 = 2;
public static final int f4392b = -1;
public static final int b0 = 3;
public static final int f4393c = 0;
public static final int c0 = 4;
private static final int e0 = 1;
public static final int s = 90;
private int A0;
private float B0;
private float C0;
private PointF D0;
private PointF E0;
private PointF F0;
private Float G0;
private PointF H0;
private PointF I0;
private int J0;
private int K0;
private int L0;
private Rect M0;
private Rect N0;
private boolean O0;
private boolean P0;
private boolean Q0;
private int R0;
private GestureDetector S0;
private com.luck.picture.lib.widget.longimage.d T0;
private final Object U0;
private com.luck.picture.lib.widget.longimage.b<? extends com.luck.picture.lib.widget.longimage.c> V0;
private com.luck.picture.lib.widget.longimage.b<? extends com.luck.picture.lib.widget.longimage.d> W0;
private PointF X0;
private float Y0;
private final float Z0;
private float a1;
private boolean b1;
private PointF c1;
private PointF d1;
private PointF e1;
private Bitmap f0;
private c f1;
private boolean g0;
private boolean g1;
private boolean h0;
private boolean h1;
private Uri i0;
private j i1;
private int j0;
private k j1;
private Map<Integer, List<m>> k0;
private View.OnLongClickListener k1;
private boolean l0;
private Handler l1;
private int m0;
private Paint m1;
private float n0;
private Paint n1;
private float o0;
private Paint o1;
private int p0;
private l p1;
private int q0;
private Matrix q1;
private int r0;
private RectF r1;
private int s0;
private float[] s1;
private int t0;
private float[] t1;
private boolean u0;
private float u1;
private boolean v0;
private boolean w0;
private boolean x0;
private float y0;
private int z0;
private static final String f4391a = SubsamplingScaleImageView.class.getSimpleName();
private static final List<Integer> G = Arrays.asList(0, 90, 180, 270, -1);
private static final List<Integer> K = Arrays.asList(1, 2, 3);
private static final List<Integer> N = Arrays.asList(2, 1);
private static final List<Integer> R = Arrays.asList(1, 2, 3);
private static final List<Integer> V = Arrays.asList(2, 1, 3);
public static int d0 = Integer.MAX_VALUE;
public class a implements Handler.Callback {
a() {
}
@Override
public boolean handleMessage(Message message) {
if (message.what == 1 && SubsamplingScaleImageView.this.k1 != null) {
SubsamplingScaleImageView.this.R0 = 0;
SubsamplingScaleImageView subsamplingScaleImageView = SubsamplingScaleImageView.this;
SubsamplingScaleImageView.super.setOnLongClickListener(subsamplingScaleImageView.k1);
SubsamplingScaleImageView.this.performLongClick();
SubsamplingScaleImageView.super.setOnLongClickListener(null);
}
return true;
}
}
public class b extends GestureDetector.SimpleOnGestureListener {
final Context f4395a;
b(Context context) {
this.f4395a = context;
}
@Override
public boolean onDoubleTap(MotionEvent motionEvent) {
if (SubsamplingScaleImageView.this.w0 && SubsamplingScaleImageView.this.g1 && SubsamplingScaleImageView.this.D0 != null) {
SubsamplingScaleImageView.this.setGestureDetector(this.f4395a);
if (SubsamplingScaleImageView.this.x0) {
SubsamplingScaleImageView.this.X0 = new PointF(motionEvent.getX(), motionEvent.getY());
SubsamplingScaleImageView.this.E0 = new PointF(SubsamplingScaleImageView.this.D0.x, SubsamplingScaleImageView.this.D0.y);
SubsamplingScaleImageView subsamplingScaleImageView = SubsamplingScaleImageView.this;
subsamplingScaleImageView.C0 = subsamplingScaleImageView.B0;
SubsamplingScaleImageView.this.Q0 = true;
SubsamplingScaleImageView.this.O0 = true;
SubsamplingScaleImageView.this.a1 = -1.0f;
SubsamplingScaleImageView subsamplingScaleImageView2 = SubsamplingScaleImageView.this;
subsamplingScaleImageView2.d1 = subsamplingScaleImageView2.d1(subsamplingScaleImageView2.X0);
SubsamplingScaleImageView.this.e1 = new PointF(motionEvent.getX(), motionEvent.getY());
SubsamplingScaleImageView.this.c1 = new PointF(SubsamplingScaleImageView.this.d1.x, SubsamplingScaleImageView.this.d1.y);
SubsamplingScaleImageView.this.b1 = false;
return false;
}
SubsamplingScaleImageView subsamplingScaleImageView3 = SubsamplingScaleImageView.this;
subsamplingScaleImageView3.Z(subsamplingScaleImageView3.d1(new PointF(motionEvent.getX(), motionEvent.getY())), new PointF(motionEvent.getX(), motionEvent.getY()));
return true;
}
return super.onDoubleTapEvent(motionEvent);
}
@Override
public boolean onFling(MotionEvent motionEvent, MotionEvent motionEvent2, float f2, float f3) {
if (SubsamplingScaleImageView.this.v0 && SubsamplingScaleImageView.this.g1 && SubsamplingScaleImageView.this.D0 != null && motionEvent != null && motionEvent2 != null && ((Math.abs(motionEvent.getX() - motionEvent2.getX()) > 50.0f || Math.abs(motionEvent.getY() - motionEvent2.getY()) > 50.0f) && ((Math.abs(f2) > 500.0f || Math.abs(f3) > 500.0f) && !SubsamplingScaleImageView.this.O0))) {
PointF pointF = new PointF(SubsamplingScaleImageView.this.D0.x + (f2 * 0.25f), SubsamplingScaleImageView.this.D0.y + (f3 * 0.25f));
new d(SubsamplingScaleImageView.this, new PointF(((SubsamplingScaleImageView.this.getWidth() / 2) - pointF.x) / SubsamplingScaleImageView.this.B0, ((SubsamplingScaleImageView.this.getHeight() / 2) - pointF.y) / SubsamplingScaleImageView.this.B0), (a) null).e(1).i(false).h(3).c();
return true;
}
return super.onFling(motionEvent, motionEvent2, f2, f3);
}
@Override
public boolean onSingleTapConfirmed(MotionEvent motionEvent) {
SubsamplingScaleImageView.this.performClick();
return true;
}
}
public final class d {
private final float f4404a;
private final PointF f4405b;
private final PointF f4406c;
private long f4407d;
private int f4408e;
private int f4409f;
private boolean f4410g;
private boolean h;
private i i;
d(SubsamplingScaleImageView subsamplingScaleImageView, float f2, PointF pointF, PointF pointF2, a aVar) {
this(f2, pointF, pointF2);
}
public d h(int i) {
this.f4409f = i;
return this;
}
public d i(boolean z) {
this.h = z;
return this;
}
public void c() {
PointF pointF;
if (SubsamplingScaleImageView.this.f1 != null && SubsamplingScaleImageView.this.f1.m != null) {
try {
SubsamplingScaleImageView.this.f1.m.onInterruptedByNewAnim();
} catch (Exception e2) {
Log.w(SubsamplingScaleImageView.f4391a, "Error thrown by animation listener", e2);
}
}
int paddingLeft = SubsamplingScaleImageView.this.getPaddingLeft() + (((SubsamplingScaleImageView.this.getWidth() - SubsamplingScaleImageView.this.getPaddingRight()) - SubsamplingScaleImageView.this.getPaddingLeft()) / 2);
int paddingTop = SubsamplingScaleImageView.this.getPaddingTop() + (((SubsamplingScaleImageView.this.getHeight() - SubsamplingScaleImageView.this.getPaddingBottom()) - SubsamplingScaleImageView.this.getPaddingTop()) / 2);
float t0 = SubsamplingScaleImageView.this.t0(this.f4404a);
if (this.h) {
SubsamplingScaleImageView subsamplingScaleImageView = SubsamplingScaleImageView.this;
PointF pointF2 = this.f4405b;
pointF = subsamplingScaleImageView.s0(pointF2.x, pointF2.y, t0, new PointF());
} else {
pointF = this.f4405b;
}
SubsamplingScaleImageView.this.f1 = new c(null);
SubsamplingScaleImageView.this.f1.f4397a = SubsamplingScaleImageView.this.B0;
SubsamplingScaleImageView.this.f1.f4398b = t0;
SubsamplingScaleImageView.this.f1.l = System.currentTimeMillis();
SubsamplingScaleImageView.this.f1.f4401e = pointF;
SubsamplingScaleImageView.this.f1.f4399c = SubsamplingScaleImageView.this.getCenter();
SubsamplingScaleImageView.this.f1.f4400d = pointF;
SubsamplingScaleImageView.this.f1.f4402f = SubsamplingScaleImageView.this.U0(pointF);
SubsamplingScaleImageView.this.f1.f4403g = new PointF(paddingLeft, paddingTop);
SubsamplingScaleImageView.this.f1.h = this.f4407d;
SubsamplingScaleImageView.this.f1.i = this.f4410g;
SubsamplingScaleImageView.this.f1.j = this.f4408e;
SubsamplingScaleImageView.this.f1.k = this.f4409f;
SubsamplingScaleImageView.this.f1.l = System.currentTimeMillis();
SubsamplingScaleImageView.this.f1.m = this.i;
PointF pointF3 = this.f4406c;
if (pointF3 != null) {
float f2 = pointF3.x - (SubsamplingScaleImageView.this.f1.f4399c.x * t0);
float f3 = this.f4406c.y - (SubsamplingScaleImageView.this.f1.f4399c.y * t0);
l lVar = new l(t0, new PointF(f2, f3), null);
SubsamplingScaleImageView.this.g0(true, lVar);
SubsamplingScaleImageView.this.f1.f4403g = new PointF(this.f4406c.x + (lVar.f4419b.x - f2), this.f4406c.y + (lVar.f4419b.y - f3));
}
SubsamplingScaleImageView.this.invalidate();
}
public d d(long j) {
this.f4407d = j;
return this;
}
public d e(int i) {
if (SubsamplingScaleImageView.N.contains(Integer.valueOf(i))) {
this.f4408e = i;
return this;
}
throw new IllegalArgumentException("Unknown easing type: " + i);
}
public d f(boolean z) {
this.f4410g = z;
return this;
}
public d g(i iVar) {
this.i = iVar;
return this;
}
d(SubsamplingScaleImageView subsamplingScaleImageView, float f2, PointF pointF, a aVar) {
this(f2, pointF);
}
d(SubsamplingScaleImageView subsamplingScaleImageView, float f2, a aVar) {
this(f2);
}
d(SubsamplingScaleImageView subsamplingScaleImageView, PointF pointF, a aVar) {
this(pointF);
}
private d(PointF pointF) {
this.f4407d = 500L;
this.f4408e = 2;
this.f4409f = 1;
this.f4410g = true;
this.h = true;
this.f4404a = SubsamplingScaleImageView.this.B0;
this.f4405b = pointF;
this.f4406c = null;
}
private d(float f2) {
this.f4407d = 500L;
this.f4408e = 2;
this.f4409f = 1;
this.f4410g = true;
this.h = true;
this.f4404a = f2;
this.f4405b = SubsamplingScaleImageView.this.getCenter();
this.f4406c = null;
}
private d(float f2, PointF pointF) {
this.f4407d = 500L;
this.f4408e = 2;
this.f4409f = 1;
this.f4410g = true;
this.h = true;
this.f4404a = f2;
this.f4405b = pointF;
this.f4406c = null;
}
private d(float f2, PointF pointF, PointF pointF2) {
this.f4407d = 500L;
this.f4408e = 2;
this.f4409f = 1;
this.f4410g = true;
this.h = true;
this.f4404a = f2;
this.f4405b = pointF;
this.f4406c = pointF2;
}
}
public static class e extends AsyncTask<Void, Void, Integer> {
private final WeakReference<SubsamplingScaleImageView> f4411a;
private final WeakReference<Context> f4412b;
private final WeakReference<com.luck.picture.lib.widget.longimage.b<? extends com.luck.picture.lib.widget.longimage.c>> f4413c;
private final Uri f4414d;
private final boolean f4415e;
private Bitmap f4416f;
private Exception f4417g;
e(SubsamplingScaleImageView subsamplingScaleImageView, Context context, com.luck.picture.lib.widget.longimage.b<? extends com.luck.picture.lib.widget.longimage.c> bVar, Uri uri, boolean z) {
this.f4411a = new WeakReference<>(subsamplingScaleImageView);
this.f4412b = new WeakReference<>(context);
this.f4413c = new WeakReference<>(bVar);
this.f4414d = uri;
this.f4415e = z;
}
@Override
public Integer doInBackground(Void... voidArr) {
try {
String uri = this.f4414d.toString();
Context context = this.f4412b.get();
com.luck.picture.lib.widget.longimage.b<? extends com.luck.picture.lib.widget.longimage.c> bVar = this.f4413c.get();
SubsamplingScaleImageView subsamplingScaleImageView = this.f4411a.get();
if (context == null || bVar == null || subsamplingScaleImageView == null) {
return null;
}
subsamplingScaleImageView.X("BitmapLoadTask.doInBackground", new Object[0]);
this.f4416f = bVar.make().decode(context, this.f4414d);
return Integer.valueOf(subsamplingScaleImageView.h0(context, uri));
} catch (Exception e2) {
Log.e(SubsamplingScaleImageView.f4391a, "Failed to load bitmap", e2);
this.f4417g = e2;
return null;
} catch (OutOfMemoryError e3) {
Log.e(SubsamplingScaleImageView.f4391a, "Failed to load bitmap - OutOfMemoryError", e3);
this.f4417g = new RuntimeException(e3);
return null;
}
}
@Override
public void onPostExecute(Integer num) {
SubsamplingScaleImageView subsamplingScaleImageView = this.f4411a.get();
if (subsamplingScaleImageView != null) {
Bitmap bitmap = this.f4416f;
if (bitmap != null && num != null) {
if (this.f4415e) {
subsamplingScaleImageView.x0(bitmap);
} else {
subsamplingScaleImageView.w0(bitmap, num.intValue(), false);
}
} else if (this.f4417g == null || subsamplingScaleImageView.i1 == null) {
} else {
if (this.f4415e) {
subsamplingScaleImageView.i1.onPreviewLoadError(this.f4417g);
} else {
subsamplingScaleImageView.i1.onImageLoadError(this.f4417g);
}
}
}
}
}
public static class f implements i {
@Override
public void onComplete() {
}
@Override
public void onInterruptedByNewAnim() {
}
@Override
public void onInterruptedByUser() {
}
}
public static class g implements j {
@Override
public void onImageLoadError(Exception exc) {
}
@Override
public void onImageLoaded() {
}
@Override
public void onPreviewLoadError(Exception exc) {
}
@Override
public void onPreviewReleased() {
}
@Override
public void onReady() {
}
@Override
public void onTileLoadError(Exception exc) {
}
}
public static class h implements k {
@Override
public void onCenterChanged(PointF pointF, int i) {
}
@Override
public void onScaleChanged(float f2, int i) {
}
}
public interface i {
void onComplete();
void onInterruptedByNewAnim();
void onInterruptedByUser();
}
public interface j {
void onImageLoadError(Exception exc);
void onImageLoaded();
void onPreviewLoadError(Exception exc);
void onPreviewReleased();
void onReady();
void onTileLoadError(Exception exc);
}
public interface k {
void onCenterChanged(PointF pointF, int i);
void onScaleChanged(float f2, int i);
}
public static class l {
private float f4418a;
private PointF f4419b;
l(float f2, PointF pointF, a aVar) {
this(f2, pointF);
}
private l(float f2, PointF pointF) {
this.f4418a = f2;
this.f4419b = pointF;
}
}
public static class m {
private Rect f4420a;
private int f4421b;
private Bitmap f4422c;
private boolean f4423d;
private boolean f4424e;
private Rect f4425f;
private Rect f4426g;
private m() {
}
m(a aVar) {
this();
}
}
public static class n extends AsyncTask<Void, Void, Bitmap> {
private final WeakReference<SubsamplingScaleImageView> f4427a;
private final WeakReference<com.luck.picture.lib.widget.longimage.d> f4428b;
private final WeakReference<m> f4429c;
private Exception f4430d;
n(SubsamplingScaleImageView subsamplingScaleImageView, com.luck.picture.lib.widget.longimage.d dVar, m mVar) {
this.f4427a = new WeakReference<>(subsamplingScaleImageView);
this.f4428b = new WeakReference<>(dVar);
this.f4429c = new WeakReference<>(mVar);
mVar.f4423d = true;
}
@Override
public Bitmap doInBackground(Void... voidArr) {
Bitmap decodeRegion;
try {
SubsamplingScaleImageView subsamplingScaleImageView = this.f4427a.get();
com.luck.picture.lib.widget.longimage.d dVar = this.f4428b.get();
m mVar = this.f4429c.get();
if (dVar == null || mVar == null || subsamplingScaleImageView == null || !dVar.isReady() || !mVar.f4424e) {
if (mVar != null) {
mVar.f4423d = false;
return null;
}
return null;
}
subsamplingScaleImageView.X("TileLoadTask.doInBackground, tile.sRect=%s, tile.sampleSize=%d", mVar.f4420a, Integer.valueOf(mVar.f4421b));
synchronized (subsamplingScaleImageView.U0) {
subsamplingScaleImageView.e0(mVar.f4420a, mVar.f4426g);
if (subsamplingScaleImageView.M0 != null) {
mVar.f4426g.offset(subsamplingScaleImageView.M0.left, subsamplingScaleImageView.M0.top);
}
decodeRegion = dVar.decodeRegion(mVar.f4426g, mVar.f4421b);
}
return decodeRegion;
} catch (Exception e2) {
Log.e(SubsamplingScaleImageView.f4391a, "Failed to decode tile", e2);
this.f4430d = e2;
return null;
} catch (OutOfMemoryError e3) {
Log.e(SubsamplingScaleImageView.f4391a, "Failed to decode tile - OutOfMemoryError", e3);
this.f4430d = new RuntimeException(e3);
return null;
}
}
@Override
public void onPostExecute(Bitmap bitmap) {
SubsamplingScaleImageView subsamplingScaleImageView = this.f4427a.get();
m mVar = this.f4429c.get();
if (subsamplingScaleImageView == null || mVar == null) {
return;
}
if (bitmap != null) {
mVar.f4422c = bitmap;
mVar.f4423d = false;
subsamplingScaleImageView.z0();
} else if (this.f4430d == null || subsamplingScaleImageView.i1 == null) {
} else {
subsamplingScaleImageView.i1.onTileLoadError(this.f4430d);
}
}
}
public static class o extends AsyncTask<Void, Void, int[]> {
private final WeakReference<SubsamplingScaleImageView> f4431a;
private final WeakReference<Context> f4432b;
private final WeakReference<com.luck.picture.lib.widget.longimage.b<? extends com.luck.picture.lib.widget.longimage.d>> f4433c;
private final Uri f4434d;
private com.luck.picture.lib.widget.longimage.d f4435e;
private Exception f4436f;
o(SubsamplingScaleImageView subsamplingScaleImageView, Context context, com.luck.picture.lib.widget.longimage.b<? extends com.luck.picture.lib.widget.longimage.d> bVar, Uri uri) {
this.f4431a = new WeakReference<>(subsamplingScaleImageView);
this.f4432b = new WeakReference<>(context);
this.f4433c = new WeakReference<>(bVar);
this.f4434d = uri;
}
@Override
public int[] doInBackground(Void... voidArr) {
try {
String uri = this.f4434d.toString();
Context context = this.f4432b.get();
com.luck.picture.lib.widget.longimage.b<? extends com.luck.picture.lib.widget.longimage.d> bVar = this.f4433c.get();
SubsamplingScaleImageView subsamplingScaleImageView = this.f4431a.get();
if (context == null || bVar == null || subsamplingScaleImageView == null) {
return null;
}
subsamplingScaleImageView.X("TilesInitTask.doInBackground", new Object[0]);
com.luck.picture.lib.widget.longimage.d make = bVar.make();
this.f4435e = make;
Point init = make.init(context, this.f4434d);
int i = init.x;
int i2 = init.y;
int h0 = subsamplingScaleImageView.h0(context, uri);
if (subsamplingScaleImageView.M0 != null) {
i = subsamplingScaleImageView.M0.width();
i2 = subsamplingScaleImageView.M0.height();
}
return new int[]{i, i2, h0};
} catch (Exception e2) {
Log.e(SubsamplingScaleImageView.f4391a, "Failed to initialise bitmap decoder", e2);
this.f4436f = e2;
return null;
}
}
@Override
public void onPostExecute(int[] iArr) {
SubsamplingScaleImageView subsamplingScaleImageView = this.f4431a.get();
if (subsamplingScaleImageView != null) {
com.luck.picture.lib.widget.longimage.d dVar = this.f4435e;
if (dVar != null && iArr != null && iArr.length == 3) {
subsamplingScaleImageView.A0(dVar, iArr[0], iArr[1], iArr[2]);
} else if (this.f4436f == null || subsamplingScaleImageView.i1 == null) {
} else {
subsamplingScaleImageView.i1.onImageLoadError(this.f4436f);
}
}
}
}
public SubsamplingScaleImageView(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
int resourceId;
String string;
this.m0 = 0;
this.n0 = 2.0f;
this.o0 = u0();
this.p0 = -1;
this.q0 = 1;
this.r0 = 1;
int i2 = d0;
this.s0 = i2;
this.t0 = i2;
this.v0 = true;
this.w0 = true;
this.x0 = true;
this.y0 = 1.0f;
this.z0 = 1;
this.A0 = 500;
this.U0 = new Object();
this.V0 = new com.luck.picture.lib.widget.longimage.a(com.luck.picture.lib.widget.longimage.f.class);
this.W0 = new com.luck.picture.lib.widget.longimage.a(com.luck.picture.lib.widget.longimage.g.class);
this.s1 = new float[8];
this.t1 = new float[8];
this.u1 = getResources().getDisplayMetrics().density;
setMinimumDpi(Opcodes.IF_ICMPNE);
setDoubleTapZoomDpi(Opcodes.IF_ICMPNE);
setGestureDetector(context);
this.l1 = new Handler(new a());
if (attributeSet != null) {
TypedArray obtainStyledAttributes = getContext().obtainStyledAttributes(attributeSet, R.styleable.SubsamplingScaleImageView);
int i3 = R.styleable.SubsamplingScaleImageView_assetName;
if (obtainStyledAttributes.hasValue(i3) && (string = obtainStyledAttributes.getString(i3)) != null && string.length() > 0) {
setImage(com.luck.picture.lib.widget.longimage.e.a(string).r());
}
int i4 = R.styleable.SubsamplingScaleImageView_src;
if (obtainStyledAttributes.hasValue(i4) && (resourceId = obtainStyledAttributes.getResourceId(i4, 0)) > 0) {
setImage(com.luck.picture.lib.widget.longimage.e.n(resourceId).r());
}
int i5 = R.styleable.SubsamplingScaleImageView_panEnabled;
if (obtainStyledAttributes.hasValue(i5)) {
setPanEnabled(obtainStyledAttributes.getBoolean(i5, true));
}
int i6 = R.styleable.SubsamplingScaleImageView_zoomEnabled;
if (obtainStyledAttributes.hasValue(i6)) {
setZoomEnabled(obtainStyledAttributes.getBoolean(i6, true));
}
int i7 = R.styleable.SubsamplingScaleImageView_quickScaleEnabled;
if (obtainStyledAttributes.hasValue(i7)) {
setQuickScaleEnabled(obtainStyledAttributes.getBoolean(i7, true));
}
int i8 = R.styleable.SubsamplingScaleImageView_tileBackgroundColor;
if (obtainStyledAttributes.hasValue(i8)) {
setTileBackgroundColor(obtainStyledAttributes.getColor(i8, Color.argb(0, 0, 0, 0)));
}
obtainStyledAttributes.recycle();
}
this.Z0 = TypedValue.applyDimension(1, 20.0f, context.getResources().getDisplayMetrics());
}
public synchronized void A0(com.luck.picture.lib.widget.longimage.d dVar, int i2, int i3, int i4) {
int i5;
int i6;
int i7;
int i8;
X("onTilesInited sWidth=%d, sHeight=%d, sOrientation=%d", Integer.valueOf(i2), Integer.valueOf(i3), Integer.valueOf(this.m0));
int i9 = this.J0;
if (i9 > 0 && (i8 = this.K0) > 0 && (i9 != i2 || i8 != i3)) {
G0(false);
Bitmap bitmap = this.f0;
if (bitmap != null) {
if (!this.h0) {
bitmap.recycle();
}
this.f0 = null;
j jVar = this.i1;
if (jVar != null && this.h0) {
jVar.onPreviewReleased();
}
this.g0 = false;
this.h0 = false;
}
}
this.T0 = dVar;
this.J0 = i2;
this.K0 = i3;
this.L0 = i4;
V();
if (!U() && (i5 = this.s0) > 0 && i5 != (i6 = d0) && (i7 = this.t0) > 0 && i7 != i6 && getWidth() > 0 && getHeight() > 0) {
k0(new Point(this.s0, this.t0));
}
invalidate();
requestLayout();
}
private boolean B0(@NonNull MotionEvent motionEvent) {
boolean z;
boolean z2;
int pointerCount = motionEvent.getPointerCount();
int action = motionEvent.getAction();
if (action != 0) {
if (action != 1) {
if (action == 2) {
if (this.R0 > 0) {
if (pointerCount >= 2) {
float Y = Y(motionEvent.getX(0), motionEvent.getX(1), motionEvent.getY(0), motionEvent.getY(1));
float x = (motionEvent.getX(0) + motionEvent.getX(1)) / 2.0f;
float y = (motionEvent.getY(0) + motionEvent.getY(1)) / 2.0f;
if (this.w0) {
PointF pointF = this.X0;
if (Y(pointF.x, x, pointF.y, y) > 5.0f || Math.abs(Y - this.Y0) > 5.0f || this.P0) {
this.O0 = true;
this.P0 = true;
double d2 = this.B0;
float min = Math.min(this.n0, (Y / this.Y0) * this.C0);
this.B0 = min;
if (min <= u0()) {
this.Y0 = Y;
this.C0 = u0();
this.X0.set(x, y);
this.E0.set(this.D0);
} else if (this.v0) {
PointF pointF2 = this.X0;
float f2 = pointF2.x;
PointF pointF3 = this.E0;
float f3 = f2 - pointF3.x;
float f4 = pointF2.y - pointF3.y;
float f5 = this.B0;
float f6 = this.C0;
float f7 = f4 * (f5 / f6);
PointF pointF4 = this.D0;
pointF4.x = x - (f3 * (f5 / f6));
pointF4.y = y - f7;
double J0 = J0();
Double.isNaN(d2);
Double.isNaN(J0);
if (J0 * d2 >= getHeight() || this.B0 * J0() < getHeight()) {
double K0 = K0();
Double.isNaN(d2);
Double.isNaN(K0);
if (d2 * K0 < getWidth()) {
}
}
f0(true);
this.X0.set(x, y);
this.E0.set(this.D0);
this.C0 = this.B0;
this.Y0 = Y;
} else if (this.I0 != null) {
this.D0.x = (getWidth() / 2) - (this.B0 * this.I0.x);
this.D0.y = (getHeight() / 2) - (this.B0 * this.I0.y);
} else {
this.D0.x = (getWidth() / 2) - (this.B0 * (K0() / 2));
this.D0.y = (getHeight() / 2) - (this.B0 * (J0() / 2));
}
f0(true);
E0(false);
z2 = true;
}
}
} else {
if (this.Q0) {
float abs = (Math.abs(this.e1.y - motionEvent.getY()) * 2.0f) + this.Z0;
if (this.a1 == -1.0f) {
this.a1 = abs;
}
float y2 = motionEvent.getY();
PointF pointF5 = this.c1;
boolean z3 = y2 > pointF5.y;
pointF5.set(0.0f, motionEvent.getY());
float abs2 = Math.abs(1.0f - (abs / this.a1)) * 0.5f;
if (abs2 > 0.03f || this.b1) {
this.b1 = true;
float f8 = this.a1 > 0.0f ? z3 ? abs2 + 1.0f : 1.0f - abs2 : 1.0f;
double d3 = this.B0;
float max = Math.max(u0(), Math.min(this.n0, this.B0 * f8));
this.B0 = max;
if (this.v0) {
PointF pointF6 = this.X0;
float f9 = pointF6.x;
PointF pointF7 = this.E0;
float f10 = pointF6.y;
float f11 = this.C0;
float f12 = (f10 - pointF7.y) * (max / f11);
PointF pointF8 = this.D0;
pointF8.x = f9 - ((f9 - pointF7.x) * (max / f11));
pointF8.y = f10 - f12;
double J02 = J0();
Double.isNaN(d3);
Double.isNaN(J02);
if (J02 * d3 >= getHeight() || this.B0 * J0() < getHeight()) {
double K02 = K0();
Double.isNaN(d3);
Double.isNaN(K02);
if (d3 * K02 < getWidth()) {
}
}
f0(true);
this.X0.set(U0(this.d1));
this.E0.set(this.D0);
this.C0 = this.B0;
abs = 0.0f;
} else if (this.I0 != null) {
this.D0.x = (getWidth() / 2) - (this.B0 * this.I0.x);
this.D0.y = (getHeight() / 2) - (this.B0 * this.I0.y);
} else {
this.D0.x = (getWidth() / 2) - (this.B0 * (K0() / 2));
this.D0.y = (getHeight() / 2) - (this.B0 * (J0() / 2));
}
}
this.a1 = abs;
f0(true);
E0(false);
} else if (!this.O0) {
float abs3 = Math.abs(motionEvent.getX() - this.X0.x);
float abs4 = Math.abs(motionEvent.getY() - this.X0.y);
float f13 = this.u1 * 5.0f;
if (abs3 > f13 || abs4 > f13 || this.P0) {
this.D0.x = this.E0.x + (motionEvent.getX() - this.X0.x);
this.D0.y = this.E0.y + (motionEvent.getY() - this.X0.y);
PointF pointF9 = this.D0;
float f14 = pointF9.x;
float f15 = pointF9.y;
f0(true);
PointF pointF10 = this.D0;
boolean z4 = f14 != pointF10.x;
float f16 = pointF10.y;
boolean z5 = f15 != f16;
boolean z6 = z4 && abs3 > abs4 && !this.P0;
boolean z7 = z5 && abs4 > abs3 && !this.P0;
boolean z8 = f15 == f16 && abs4 > 3.0f * f13;
if (!z6 && !z7 && (!z4 || !z5 || z8 || this.P0)) {
this.P0 = true;
} else if (abs3 > f13 || abs4 > f13) {
this.R0 = 0;
this.l1.removeMessages(1);
F0(false);
}
if (!this.v0) {
PointF pointF11 = this.D0;
PointF pointF12 = this.E0;
pointF11.x = pointF12.x;
pointF11.y = pointF12.y;
F0(false);
}
E0(false);
}
}
z2 = true;
}
if (z2) {
this.l1.removeMessages(1);
invalidate();
return true;
}
}
z2 = false;
if (z2) {
}
} else if (action != 5) {
if (action != 6) {
if (action != 261) {
}
}
}
return false;
}
this.l1.removeMessages(1);
if (this.Q0) {
this.Q0 = false;
if (!this.b1) {
Z(this.d1, this.X0);
}
}
if (this.R0 <= 0 || !((z = this.O0) || this.P0)) {
if (pointerCount == 1) {
this.O0 = false;
this.P0 = false;
this.R0 = 0;
}
return true;
}
if (z && pointerCount == 2) {
this.P0 = true;
PointF pointF13 = this.E0;
PointF pointF14 = this.D0;
pointF13.set(pointF14.x, pointF14.y);
if (motionEvent.getActionIndex() == 1) {
this.X0.set(motionEvent.getX(0), motionEvent.getY(0));
} else {
this.X0.set(motionEvent.getX(1), motionEvent.getY(1));
}
}
if (pointerCount < 3) {
this.O0 = false;
}
if (pointerCount < 2) {
this.P0 = false;
this.R0 = 0;
}
E0(true);
return true;
}
this.f1 = null;
F0(true);
this.R0 = Math.max(this.R0, pointerCount);
if (pointerCount >= 2) {
if (this.w0) {
float Y2 = Y(motionEvent.getX(0), motionEvent.getX(1), motionEvent.getY(0), motionEvent.getY(1));
this.C0 = this.B0;
this.Y0 = Y2;
PointF pointF15 = this.E0;
PointF pointF16 = this.D0;
pointF15.set(pointF16.x, pointF16.y);
this.X0.set((motionEvent.getX(0) + motionEvent.getX(1)) / 2.0f, (motionEvent.getY(0) + motionEvent.getY(1)) / 2.0f);
} else {
this.R0 = 0;
}
this.l1.removeMessages(1);
} else if (!this.Q0) {
PointF pointF17 = this.E0;
PointF pointF18 = this.D0;
pointF17.set(pointF18.x, pointF18.y);
this.X0.set(motionEvent.getX(), motionEvent.getY());
this.l1.sendEmptyMessageDelayed(1, 600L);
}
return true;
}
private void C0() {
Float f2;
if (getWidth() == 0 || getHeight() == 0 || this.J0 <= 0 || this.K0 <= 0) {
return;
}
if (this.H0 != null && (f2 = this.G0) != null) {
this.B0 = f2.floatValue();
if (this.D0 == null) {
this.D0 = new PointF();
}
this.D0.x = (getWidth() / 2) - (this.B0 * this.H0.x);
this.D0.y = (getHeight() / 2) - (this.B0 * this.H0.y);
this.H0 = null;
this.G0 = null;
f0(true);
E0(true);
}
f0(false);
}
private void E0(boolean z) {
if (this.T0 == null || this.k0 == null) {
return;
}
int min = Math.min(this.j0, T(this.B0));
for (Map.Entry<Integer, List<m>> entry : this.k0.entrySet()) {
for (m mVar : entry.getValue()) {
if (mVar.f4421b < min || (mVar.f4421b > min && mVar.f4421b != this.j0)) {
mVar.f4424e = false;
if (mVar.f4422c != null) {
mVar.f4422c.recycle();
mVar.f4422c = null;
}
}
if (mVar.f4421b != min) {
if (mVar.f4421b == this.j0) {
mVar.f4424e = true;
}
} else if (Z0(mVar)) {
mVar.f4424e = true;
if (!mVar.f4423d && mVar.f4422c == null && z) {
d0(new n(this, this.T0, mVar));
}
} else if (mVar.f4421b != this.j0) {
mVar.f4424e = false;
if (mVar.f4422c != null) {
mVar.f4422c.recycle();
mVar.f4422c = null;
}
}
}
}
}
private void F0(boolean z) {
ViewParent parent = getParent();
if (parent != null) {
parent.requestDisallowInterceptTouchEvent(z);
}
}
private void G0(boolean z) {
j jVar;
X("reset newImage=" + z, new Object[0]);
this.B0 = 0.0f;
this.C0 = 0.0f;
this.D0 = null;
this.E0 = null;
this.F0 = null;
this.G0 = Float.valueOf(0.0f);
this.H0 = null;
this.I0 = null;
this.O0 = false;
this.P0 = false;
this.Q0 = false;
this.R0 = 0;
this.j0 = 0;
this.X0 = null;
this.Y0 = 0.0f;
this.a1 = 0.0f;
this.b1 = false;
this.d1 = null;
this.c1 = null;
this.e1 = null;
this.f1 = null;
this.p1 = null;
this.q1 = null;
this.r1 = null;
if (z) {
this.i0 = null;
if (this.T0 != null) {
synchronized (this.U0) {
this.T0.recycle();
this.T0 = null;
}
}
Bitmap bitmap = this.f0;
if (bitmap != null && !this.h0) {
bitmap.recycle();
}
if (this.f0 != null && this.h0 && (jVar = this.i1) != null) {
jVar.onPreviewReleased();
}
this.J0 = 0;
this.K0 = 0;
this.L0 = 0;
this.M0 = null;
this.N0 = null;
this.g1 = false;
this.h1 = false;
this.f0 = null;
this.g0 = false;
this.h0 = false;
}
Map<Integer, List<m>> map = this.k0;
if (map != null) {
for (Map.Entry<Integer, List<m>> entry : map.entrySet()) {
for (m mVar : entry.getValue()) {
mVar.f4424e = false;
if (mVar.f4422c != null) {
mVar.f4422c.recycle();
mVar.f4422c = null;
}
}
}
this.k0 = null;
}
setGestureDetector(getContext());
}
private void I0(ImageViewState imageViewState) {
if (imageViewState == null || imageViewState.getCenter() == null || !G.contains(Integer.valueOf(imageViewState.getOrientation()))) {
return;
}
this.m0 = imageViewState.getOrientation();
this.G0 = Float.valueOf(imageViewState.getScale());
this.H0 = imageViewState.getCenter();
invalidate();
}
private int J0() {
int requiredRotation = getRequiredRotation();
if (requiredRotation != 90 && requiredRotation != 270) {
return this.K0;
}
return this.J0;
}
private int K0() {
int requiredRotation = getRequiredRotation();
if (requiredRotation != 90 && requiredRotation != 270) {
return this.J0;
}
return this.K0;
}
private void L0(float f2, PointF pointF, int i2) {
k kVar = this.j1;
if (kVar != null) {
float f3 = this.B0;
if (f3 != f2) {
kVar.onScaleChanged(f3, i2);
}
if (this.D0.equals(pointF)) {
return;
}
this.j1.onCenterChanged(getCenter(), i2);
}
}
private void P0(float[] fArr, float f2, float f3, float f4, float f5, float f6, float f7, float f8, float f9) {
fArr[0] = f2;
fArr[1] = f3;
fArr[2] = f4;
fArr[3] = f5;
fArr[4] = f6;
fArr[5] = f7;
fArr[6] = f8;
fArr[7] = f9;
}
private int T(float f2) {
int round;
if (this.p0 > 0) {
DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
f2 *= this.p0 / ((displayMetrics.xdpi + displayMetrics.ydpi) / 2.0f);
}
int K0 = (int) (K0() * f2);
int J0 = (int) (J0() * f2);
if (K0 == 0 || J0 == 0) {
return 32;
}
int i2 = 1;
if (J0() > J0 || K0() > K0) {
round = Math.round(J0() / J0);
int round2 = Math.round(K0() / K0);
if (round >= round2) {
round = round2;
}
} else {
round = 1;
}
while (true) {
int i3 = i2 * 2;
if (i3 >= round) {
return i2;
}
i2 = i3;
}
}
private boolean U() {
boolean m0 = m0();
if (!this.h1 && m0) {
C0();
this.h1 = true;
v0();
j jVar = this.i1;
if (jVar != null) {
jVar.onImageLoaded();
}
}
return m0;
}
private boolean V() {
boolean z = getWidth() > 0 && getHeight() > 0 && this.J0 > 0 && this.K0 > 0 && (this.f0 != null || m0());
if (!this.g1 && z) {
C0();
this.g1 = true;
y0();
j jVar = this.i1;
if (jVar != null) {
jVar.onReady();
}
}
return z;
}
private void W() {
if (this.m1 == null) {
Paint paint = new Paint();
this.m1 = paint;
paint.setAntiAlias(true);
this.m1.setFilterBitmap(true);
this.m1.setDither(true);
}
if (this.n1 == null && this.l0) {
Paint paint2 = new Paint();
this.n1 = paint2;
paint2.setTextSize(18.0f);
this.n1.setColor(-65281);
this.n1.setStyle(Paint.Style.STROKE);
}
}
private Rect W0(Rect rect, Rect rect2) {
rect2.set((int) X0(rect.left), (int) Y0(rect.top), (int) X0(rect.right), (int) Y0(rect.bottom));
return rect2;
}
@AnyThread
public void X(String str, Object... objArr) {
if (this.l0) {
Log.d(f4391a, String.format(str, objArr));
}
}
private float X0(float f2) {
PointF pointF = this.D0;
if (pointF == null) {
return Float.NaN;
}
return (f2 * this.B0) + pointF.x;
}
private float Y(float f2, float f3, float f4, float f5) {
float f6 = f2 - f3;
float f7 = f4 - f5;
return (float) Math.sqrt((f6 * f6) + (f7 * f7));
}
private float Y0(float f2) {
PointF pointF = this.D0;
if (pointF == null) {
return Float.NaN;
}
return (f2 * this.B0) + pointF.y;
}
public void Z(PointF pointF, PointF pointF2) {
if (!this.v0) {
PointF pointF3 = this.I0;
if (pointF3 != null) {
pointF.x = pointF3.x;
pointF.y = pointF3.y;
} else {
pointF.x = K0() / 2;
pointF.y = J0() / 2;
}
}
float min = Math.min(this.n0, this.y0);
double d2 = min;
Double.isNaN(d2);
boolean z = ((double) this.B0) <= d2 * 0.9d;
if (!z) {
min = u0();
}
float f2 = min;
int i2 = this.z0;
if (i2 == 3) {
R0(f2, pointF);
} else if (i2 == 2 || !z || !this.v0) {
new d(this, f2, pointF, (a) null).f(false).d(this.A0).h(4).c();
} else if (i2 == 1) {
new d(this, f2, pointF, pointF2, null).f(false).d(this.A0).h(4).c();
}
invalidate();
}
private boolean Z0(m mVar) {
return f1(0.0f) <= ((float) mVar.f4420a.right) && ((float) mVar.f4420a.left) <= f1((float) getWidth()) && g1(0.0f) <= ((float) mVar.f4420a.bottom) && ((float) mVar.f4420a.top) <= g1((float) getHeight());
}
private float a0(int i2, long j2, float f2, float f3, long j3) {
if (i2 != 1) {
if (i2 == 2) {
return b0(j2, f2, f3, j3);
}
throw new IllegalStateException("Unexpected easing type: " + i2);
}
return c0(j2, f2, f3, j3);
}
private PointF a1(float f2, float f3, float f4) {
int paddingLeft = getPaddingLeft() + (((getWidth() - getPaddingRight()) - getPaddingLeft()) / 2);
int paddingTop = getPaddingTop() + (((getHeight() - getPaddingBottom()) - getPaddingTop()) / 2);
if (this.p1 == null) {
this.p1 = new l(0.0f, new PointF(0.0f, 0.0f), null);
}
this.p1.f4418a = f4;
this.p1.f4419b.set(paddingLeft - (f2 * f4), paddingTop - (f3 * f4));
g0(true, this.p1);
return this.p1.f4419b;
}
private float b0(long j2, float f2, float f3, long j3) {
float f4;
float f5 = ((float) j2) / (((float) j3) / 2.0f);
if (f5 < 1.0f) {
f4 = (f3 / 2.0f) * f5;
} else {
float f6 = f5 - 1.0f;
f4 = (-f3) / 2.0f;
f5 = (f6 * (f6 - 2.0f)) - 1.0f;
}
return (f4 * f5) + f2;
}
private float c0(long j2, float f2, float f3, long j3) {
float f4 = ((float) j2) / ((float) j3);
return ((-f3) * f4 * (f4 - 2.0f)) + f2;
}
private void d0(AsyncTask<Void, Void, ?> asyncTask) {
if (this.u0 && Build.VERSION.SDK_INT >= 11) {
try {
AsyncTask.class.getMethod("executeOnExecutor", Executor.class, Object[].class).invoke(asyncTask, (Executor) AsyncTask.class.getField("THREAD_POOL_EXECUTOR").get(null), null);
return;
} catch (Exception e2) {
Log.i(f4391a, "Failed to execute AsyncTask on thread pool executor, falling back to single threaded executor", e2);
}
}
asyncTask.execute(new Void[0]);
}
@AnyThread
public void e0(Rect rect, Rect rect2) {
if (getRequiredRotation() == 0) {
rect2.set(rect);
} else if (getRequiredRotation() == 90) {
int i2 = rect.top;
int i3 = this.K0;
rect2.set(i2, i3 - rect.right, rect.bottom, i3 - rect.left);
} else if (getRequiredRotation() == 180) {
int i4 = this.J0;
int i5 = this.K0;
rect2.set(i4 - rect.right, i5 - rect.bottom, i4 - rect.left, i5 - rect.top);
} else {
int i6 = this.J0;
rect2.set(i6 - rect.bottom, rect.left, i6 - rect.top, rect.right);
}
}
private void f0(boolean z) {
boolean z2;
if (this.D0 == null) {
z2 = true;
this.D0 = new PointF(0.0f, 0.0f);
} else {
z2 = false;
}
if (this.p1 == null) {
this.p1 = new l(0.0f, new PointF(0.0f, 0.0f), null);
}
this.p1.f4418a = this.B0;
this.p1.f4419b.set(this.D0);
g0(z, this.p1);
this.B0 = this.p1.f4418a;
this.D0.set(this.p1.f4419b);
if (z2) {
this.D0.set(a1(K0() / 2, J0() / 2, this.B0));
}
}
private float f1(float f2) {
PointF pointF = this.D0;
if (pointF == null) {
return Float.NaN;
}
return (f2 - pointF.x) / this.B0;
}
public void g0(boolean z, l lVar) {
float max;
int max2;
float max3;
if (this.q0 == 2 && q0()) {
z = false;
}
PointF pointF = lVar.f4419b;
float t0 = t0(lVar.f4418a);
float K0 = K0() * t0;
float J0 = J0() * t0;
if (this.q0 == 3 && q0()) {
pointF.x = Math.max(pointF.x, (getWidth() / 2) - K0);
pointF.y = Math.max(pointF.y, (getHeight() / 2) - J0);
} else if (z) {
pointF.x = Math.max(pointF.x, getWidth() - K0);
pointF.y = Math.max(pointF.y, getHeight() - J0);
} else {
pointF.x = Math.max(pointF.x, -K0);
pointF.y = Math.max(pointF.y, -J0);
}
float f2 = 0.5f;
float paddingLeft = (getPaddingLeft() > 0 || getPaddingRight() > 0) ? getPaddingLeft() / (getPaddingLeft() + getPaddingRight()) : 0.5f;
if (getPaddingTop() > 0 || getPaddingBottom() > 0) {
f2 = getPaddingTop() / (getPaddingTop() + getPaddingBottom());
}
if (this.q0 == 3 && q0()) {
max = Math.max(0, getWidth() / 2);
max2 = Math.max(0, getHeight() / 2);
} else if (z) {
max = Math.max(0.0f, (getWidth() - K0) * paddingLeft);
max3 = Math.max(0.0f, (getHeight() - J0) * f2);
pointF.x = Math.min(pointF.x, max);
pointF.y = Math.min(pointF.y, max3);
lVar.f4418a = t0;
} else {
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);
lVar.f4418a = t0;
}
private float g1(float f2) {
PointF pointF = this.D0;
if (pointF == null) {
return Float.NaN;
}
return (f2 - pointF.y) / this.B0;
}
@AnyThread
private int getRequiredRotation() {
int i2 = this.m0;
return i2 == -1 ? this.L0 : i2;
}
@AnyThread
public int h0(Context context, String str) {
int i2 = 0;
if (str.startsWith("content")) {
Cursor cursor = null;
try {
try {
cursor = context.getContentResolver().query(Uri.parse(str), new String[]{"orientation"}, null, null, null);
if (cursor != null && cursor.moveToFirst()) {
int i3 = cursor.getInt(0);
if (!G.contains(Integer.valueOf(i3)) || i3 == -1) {
String str2 = f4391a;
Log.w(str2, "Unsupported orientation: " + i3);
} else {
i2 = i3;
}
}
if (cursor == null) {
return i2;
}
} catch (Exception unused) {
Log.w(f4391a, "Could not get orientation of image from media store");
if (cursor == null) {
return 0;
}
}
cursor.close();
return i2;
} catch (Throwable th) {
if (cursor != null) {
cursor.close();
}
throw th;
}
} else if (!str.startsWith("file:///") || str.startsWith("file:///android_asset/")) {
return 0;
} else {
try {
int attributeInt = new ExifInterface(str.substring(7)).getAttributeInt(android.support.media.ExifInterface.TAG_ORIENTATION, 1);
if (attributeInt != 1 && attributeInt != 0) {
if (attributeInt == 6) {
return 90;
}
if (attributeInt == 3) {
return 180;
}
if (attributeInt == 8) {
return 270;
}
String str3 = f4391a;
Log.w(str3, "Unsupported EXIF orientation: " + attributeInt);
return 0;
}
return 0;
} catch (Exception unused2) {
Log.w(f4391a, "Could not get EXIF orientation of image");
return 0;
}
}
}
private Point i0(Canvas canvas) {
int i2;
int intValue;
int i3 = 2048;
if (Build.VERSION.SDK_INT >= 14) {
try {
i2 = ((Integer) Canvas.class.getMethod("getMaximumBitmapWidth", new Class[0]).invoke(canvas, new Object[0])).intValue();
try {
intValue = ((Integer) Canvas.class.getMethod("getMaximumBitmapHeight", new Class[0]).invoke(canvas, new Object[0])).intValue();
i3 = i2;
} catch (Exception unused) {
i3 = i2;
intValue = 2048;
return new Point(Math.min(i3, this.s0), Math.min(intValue, this.t0));
}
} catch (Exception unused2) {
i2 = 2048;
}
return new Point(Math.min(i3, this.s0), Math.min(intValue, this.t0));
}
intValue = 2048;
return new Point(Math.min(i3, this.s0), Math.min(intValue, this.t0));
}
private synchronized void k0(Point point) {
X("initialiseBaseLayer maxTileDimensions=%dx%d", Integer.valueOf(point.x), Integer.valueOf(point.y));
l lVar = new l(0.0f, new PointF(0.0f, 0.0f), null);
this.p1 = lVar;
g0(true, lVar);
int T2 = T(this.p1.f4418a);
this.j0 = T2;
if (T2 > 1) {
this.j0 = T2 / 2;
}
if (this.j0 == 1 && this.M0 == null && K0() < point.x && J0() < point.y) {
this.T0.recycle();
this.T0 = null;
d0(new e(this, getContext(), this.V0, this.i0, false));
} else {
l0(point);
for (m mVar : this.k0.get(Integer.valueOf(this.j0))) {
d0(new n(this, this.T0, mVar));
}
E0(true);
}
}
private void l0(Point point) {
int i2 = 1;
X("initialiseTileMap maxTileDimensions=%dx%d", Integer.valueOf(point.x), Integer.valueOf(point.y));
this.k0 = new LinkedHashMap();
int i3 = this.j0;
int i4 = 1;
int i5 = 1;
while (true) {
int K0 = K0() / i4;
int J0 = J0() / i5;
int i6 = K0 / i3;
int i7 = J0 / i3;
while (true) {
if (i6 + i4 + i2 <= point.x) {
double d2 = i6;
double width = getWidth();
Double.isNaN(width);
if (d2 <= width * 1.25d || i3 >= this.j0) {
break;
}
}
i4++;
K0 = K0() / i4;
i6 = K0 / i3;
i2 = 1;
}
while (true) {
if (i7 + i5 + i2 <= point.y) {
double height = getHeight();
Double.isNaN(height);
if (i7 <= height * 1.25d || i3 >= this.j0) {
break;
}
}
i5++;
J0 = J0() / i5;
i7 = J0 / i3;
i2 = 1;
}
ArrayList arrayList = new ArrayList(i4 * i5);
int i8 = 0;
while (i8 < i4) {
int i9 = 0;
while (i9 < i5) {
m mVar = new m(null);
mVar.f4421b = i3;
mVar.f4424e = i3 == this.j0;
mVar.f4420a = new Rect(i8 * K0, i9 * J0, i8 == i4 + (-1) ? K0() : (i8 + 1) * K0, i9 == i5 + (-1) ? J0() : (i9 + 1) * J0);
mVar.f4425f = new Rect(0, 0, 0, 0);
mVar.f4426g = new Rect(mVar.f4420a);
arrayList.add(mVar);
i9++;
}
i8++;
}
this.k0.put(Integer.valueOf(i3), arrayList);
if (i3 == 1) {
return;
}
i3 /= 2;
i2 = 1;
}
}
private boolean m0() {
boolean z = true;
if (this.f0 == null || this.g0) {
Map<Integer, List<m>> map = this.k0;
if (map != null) {
for (Map.Entry<Integer, List<m>> entry : map.entrySet()) {
if (entry.getKey().intValue() == this.j0) {
for (m mVar : entry.getValue()) {
if (mVar.f4423d || mVar.f4422c == null) {
z = false;
}
}
}
}
return z;
}
return false;
}
return true;
}
public PointF s0(float f2, float f3, float f4, PointF pointF) {
PointF a1 = a1(f2, f3, f4);
pointF.set(((getPaddingLeft() + (((getWidth() - getPaddingRight()) - getPaddingLeft()) / 2)) - a1.x) / f4, ((getPaddingTop() + (((getHeight() - getPaddingBottom()) - getPaddingTop()) / 2)) - a1.y) / f4);
return pointF;
}
public void setGestureDetector(Context context) {
this.S0 = new GestureDetector(context, new b(context));
}
public float t0(float f2) {
return Math.min(this.n0, Math.max(u0(), f2));
}
private float u0() {
int paddingBottom = getPaddingBottom() + getPaddingTop();
int paddingLeft = getPaddingLeft() + getPaddingRight();
int i2 = this.r0;
if (i2 == 2) {
return Math.max((getWidth() - paddingLeft) / K0(), (getHeight() - paddingBottom) / J0());
}
if (i2 == 3) {
float f2 = this.o0;
if (f2 > 0.0f) {
return f2;
}
}
return Math.min((getWidth() - paddingLeft) / K0(), (getHeight() - paddingBottom) / J0());
}
public synchronized void w0(Bitmap bitmap, int i2, boolean z) {
j jVar;
X("onImageLoaded", new Object[0]);
int i3 = this.J0;
if (i3 > 0 && this.K0 > 0 && (i3 != bitmap.getWidth() || this.K0 != bitmap.getHeight())) {
G0(false);
}
Bitmap bitmap2 = this.f0;
if (bitmap2 != null && !this.h0) {
bitmap2.recycle();
}
if (this.f0 != null && this.h0 && (jVar = this.i1) != null) {
jVar.onPreviewReleased();
}
this.g0 = false;
this.h0 = z;
this.f0 = bitmap;
this.J0 = bitmap.getWidth();
this.K0 = bitmap.getHeight();
this.L0 = i2;
boolean V2 = V();
boolean U2 = U();
if (V2 || U2) {
invalidate();
requestLayout();
}
}
public synchronized void x0(Bitmap bitmap) {
X("onPreviewLoaded", new Object[0]);
if (this.f0 == null && !this.h1) {
Rect rect = this.N0;
if (rect != null) {
this.f0 = Bitmap.createBitmap(bitmap, rect.left, rect.top, rect.width(), this.N0.height());
} else {
this.f0 = bitmap;
}
this.g0 = true;
if (V()) {
invalidate();
requestLayout();
}
return;
}
bitmap.recycle();
}
public synchronized void z0() {
Bitmap bitmap;
X("onTileLoaded", new Object[0]);
V();
U();
if (m0() && (bitmap = this.f0) != null) {
if (!this.h0) {
bitmap.recycle();
}
this.f0 = null;
j jVar = this.i1;
if (jVar != null && this.h0) {
jVar.onPreviewReleased();
}
this.g0 = false;
this.h0 = false;
}
invalidate();
}
public void D0() {
G0(true);
this.m1 = null;
this.n1 = null;
this.o1 = null;
}
public final void H0() {
this.f1 = null;
this.G0 = Float.valueOf(t0(0.0f));
if (q0()) {
this.H0 = new PointF(K0() / 2, J0() / 2);
} else {
this.H0 = new PointF(0.0f, 0.0f);
}
invalidate();
}
public final void M0(com.luck.picture.lib.widget.longimage.e eVar, com.luck.picture.lib.widget.longimage.e eVar2) {
N0(eVar, eVar2, null);
}
public final void N0(com.luck.picture.lib.widget.longimage.e eVar, com.luck.picture.lib.widget.longimage.e eVar2, ImageViewState imageViewState) {
Objects.requireNonNull(eVar, "imageSource must not be null");
G0(true);
if (imageViewState != null) {
I0(imageViewState);
}
if (eVar2 != null) {
if (eVar.e() == null) {
if (eVar.i() > 0 && eVar.g() > 0) {
this.J0 = eVar.i();
this.K0 = eVar.g();
this.N0 = eVar2.h();
if (eVar2.e() != null) {
this.h0 = eVar2.l();
x0(eVar2.e());
} else {
Uri k2 = eVar2.k();
if (k2 == null && eVar2.f() != null) {
k2 = Uri.parse("android.resource://" + getContext().getPackageName() + "/" + eVar2.f());
}
d0(new e(this, getContext(), this.V0, k2, true));
}
} else {
throw new IllegalArgumentException("Preview image cannot be used unless dimensions are provided for the main image");
}
} else {
throw new IllegalArgumentException("Preview image cannot be used when a bitmap is provided for the main image");
}
}
if (eVar.e() != null && eVar.h() != null) {
w0(Bitmap.createBitmap(eVar.e(), eVar.h().left, eVar.h().top, eVar.h().width(), eVar.h().height()), 0, false);
} else if (eVar.e() != null) {
w0(eVar.e(), 0, eVar.l());
} else {
this.M0 = eVar.h();
Uri k3 = eVar.k();
this.i0 = k3;
if (k3 == null && eVar.f() != null) {
this.i0 = Uri.parse("android.resource://" + getContext().getPackageName() + "/" + eVar.f());
}
if (!eVar.j() && this.M0 == null) {
d0(new e(this, getContext(), this.V0, this.i0, false));
} else {
d0(new o(this, getContext(), this.W0, this.i0));
}
}
}
public final void O0(com.luck.picture.lib.widget.longimage.e eVar, ImageViewState imageViewState) {
N0(eVar, null, imageViewState);
}
public d Q(PointF pointF) {
if (q0()) {
return new d(this, pointF, (a) null);
}
return null;
}
public void Q0(int i2, int i3) {
this.s0 = i2;
this.t0 = i3;
}
public d R(float f2) {
if (q0()) {
return new d(this, f2, (a) null);
}
return null;
}
public final void R0(float f2, PointF pointF) {
this.f1 = null;
this.G0 = Float.valueOf(f2);
this.H0 = pointF;
this.I0 = pointF;
invalidate();
}
public d S(float f2, PointF pointF) {
if (q0()) {
return new d(this, f2, pointF, (a) null);
}
return null;
}
public final PointF S0(float f2, float f3) {
return T0(f2, f3, new PointF());
}
public final PointF T0(float f2, float f3, PointF pointF) {
if (this.D0 == null) {
return null;
}
pointF.set(X0(f2), Y0(f3));
return pointF;
}
public final PointF U0(PointF pointF) {
return T0(pointF.x, pointF.y, new PointF());
}
public final PointF V0(PointF pointF, PointF pointF2) {
return T0(pointF.x, pointF.y, pointF2);
}
public final PointF b1(float f2, float f3) {
return c1(f2, f3, new PointF());
}
public final PointF c1(float f2, float f3, PointF pointF) {
if (this.D0 == null) {
return null;
}
pointF.set(f1(f2), g1(f3));
return pointF;
}
public final PointF d1(PointF pointF) {
return c1(pointF.x, pointF.y, new PointF());
}
public final PointF e1(PointF pointF, PointF pointF2) {
return c1(pointF.x, pointF.y, pointF2);
}
public final int getAppliedOrientation() {
return getRequiredRotation();
}
public final PointF getCenter() {
return b1(getWidth() / 2, getHeight() / 2);
}
public float getMaxScale() {
return this.n0;
}
public final float getMinScale() {
return u0();
}
public final int getOrientation() {
return this.m0;
}
public final int getSHeight() {
return this.K0;
}
public final int getSWidth() {
return this.J0;
}
public final float getScale() {
return this.B0;
}
public final ImageViewState getState() {
if (this.D0 == null || this.J0 <= 0 || this.K0 <= 0) {
return null;
}
return new ImageViewState(getScale(), getCenter(), getOrientation());
}
public boolean j0() {
return (this.i0 == null && this.f0 == null) ? false : true;
}
public final boolean n0() {
return this.h1;
}
public final boolean o0() {
return this.v0;
}
@Override
protected void onDraw(Canvas canvas) {
Bitmap bitmap;
float f2;
Locale locale;
super.onDraw(canvas);
W();
if (this.J0 == 0 || this.K0 == 0 || getWidth() == 0 || getHeight() == 0) {
return;
}
if (this.k0 == null && this.T0 != null) {
k0(i0(canvas));
}
if (V()) {
C0();
if (this.f1 != null) {
float f3 = this.B0;
if (this.F0 == null) {
this.F0 = new PointF(0.0f, 0.0f);
}
this.F0.set(this.D0);
long currentTimeMillis = System.currentTimeMillis() - this.f1.l;
boolean z = currentTimeMillis > this.f1.h;
long min = Math.min(currentTimeMillis, this.f1.h);
this.B0 = a0(this.f1.j, min, this.f1.f4397a, this.f1.f4398b - this.f1.f4397a, this.f1.h);
float a02 = a0(this.f1.j, min, this.f1.f4402f.x, this.f1.f4403g.x - this.f1.f4402f.x, this.f1.h);
float a03 = a0(this.f1.j, min, this.f1.f4402f.y, this.f1.f4403g.y - this.f1.f4402f.y, this.f1.h);
this.D0.x -= X0(this.f1.f4400d.x) - a02;
this.D0.y -= Y0(this.f1.f4400d.y) - a03;
f0(z || this.f1.f4397a == this.f1.f4398b);
L0(f3, this.F0, this.f1.k);
E0(z);
if (z) {
if (this.f1.m != null) {
try {
this.f1.m.onComplete();
} catch (Exception e2) {
Log.w(f4391a, "Error thrown by animation listener", e2);
}
}
this.f1 = null;
}
invalidate();
}
if (this.k0 != null && m0()) {
int min2 = Math.min(this.j0, T(this.B0));
boolean z2 = false;
for (Map.Entry<Integer, List<m>> entry : this.k0.entrySet()) {
if (entry.getKey().intValue() == min2) {
for (m mVar : entry.getValue()) {
if (mVar.f4424e && (mVar.f4423d || mVar.f4422c == null)) {
z2 = true;
}
}
}
}
for (Map.Entry<Integer, List<m>> entry2 : this.k0.entrySet()) {
if (entry2.getKey().intValue() == min2 || z2) {
for (m mVar2 : entry2.getValue()) {
W0(mVar2.f4420a, mVar2.f4425f);
if (mVar2.f4423d || mVar2.f4422c == null) {
if (mVar2.f4423d && this.l0) {
canvas.drawText("LOADING", mVar2.f4425f.left + 5, mVar2.f4425f.top + 35, this.n1);
}
} else {
if (this.o1 != null) {
canvas.drawRect(mVar2.f4425f, this.o1);
}
if (this.q1 == null) {
this.q1 = new Matrix();
}
this.q1.reset();
P0(this.s1, 0.0f, 0.0f, mVar2.f4422c.getWidth(), 0.0f, mVar2.f4422c.getWidth(), mVar2.f4422c.getHeight(), 0.0f, mVar2.f4422c.getHeight());
if (getRequiredRotation() == 0) {
P0(this.t1, mVar2.f4425f.left, mVar2.f4425f.top, mVar2.f4425f.right, mVar2.f4425f.top, mVar2.f4425f.right, mVar2.f4425f.bottom, mVar2.f4425f.left, mVar2.f4425f.bottom);
} else if (getRequiredRotation() == 90) {
P0(this.t1, mVar2.f4425f.right, mVar2.f4425f.top, mVar2.f4425f.right, mVar2.f4425f.bottom, mVar2.f4425f.left, mVar2.f4425f.bottom, mVar2.f4425f.left, mVar2.f4425f.top);
} else if (getRequiredRotation() == 180) {
P0(this.t1, mVar2.f4425f.right, mVar2.f4425f.bottom, mVar2.f4425f.left, mVar2.f4425f.bottom, mVar2.f4425f.left, mVar2.f4425f.top, mVar2.f4425f.right, mVar2.f4425f.top);
} else if (getRequiredRotation() == 270) {
P0(this.t1, mVar2.f4425f.left, mVar2.f4425f.bottom, mVar2.f4425f.left, mVar2.f4425f.top, mVar2.f4425f.right, mVar2.f4425f.top, mVar2.f4425f.right, mVar2.f4425f.bottom);
}
this.q1.setPolyToPoly(this.s1, 0, this.t1, 0, 4);
canvas.drawBitmap(mVar2.f4422c, this.q1, this.m1);
if (this.l0) {
canvas.drawRect(mVar2.f4425f, this.n1);
}
}
if (mVar2.f4424e && this.l0) {
canvas.drawText("ISS " + mVar2.f4421b + " RECT " + mVar2.f4420a.top + "," + mVar2.f4420a.left + "," + mVar2.f4420a.bottom + "," + mVar2.f4420a.right, mVar2.f4425f.left + 5, mVar2.f4425f.top + 15, this.n1);
}
}
}
}
} else {
if (this.f0 != null) {
float f4 = this.B0;
if (this.g0) {
f4 *= this.J0 / bitmap.getWidth();
f2 = this.B0 * (this.K0 / this.f0.getHeight());
} else {
f2 = f4;
}
if (this.q1 == null) {
this.q1 = new Matrix();
}
this.q1.reset();
this.q1.postScale(f4, f2);
this.q1.postRotate(getRequiredRotation());
Matrix matrix = this.q1;
PointF pointF = this.D0;
matrix.postTranslate(pointF.x, pointF.y);
if (getRequiredRotation() == 180) {
Matrix matrix2 = this.q1;
float f5 = this.B0;
matrix2.postTranslate(this.J0 * f5, f5 * this.K0);
} else if (getRequiredRotation() == 90) {
this.q1.postTranslate(this.B0 * this.K0, 0.0f);
} else if (getRequiredRotation() == 270) {
this.q1.postTranslate(0.0f, this.B0 * this.J0);
}
if (this.o1 != null) {
if (this.r1 == null) {
this.r1 = new RectF();
}
this.r1.set(0.0f, 0.0f, this.g0 ? this.f0.getWidth() : this.J0, this.g0 ? this.f0.getHeight() : this.K0);
this.q1.mapRect(this.r1);
canvas.drawRect(this.r1, this.o1);
}
canvas.drawBitmap(this.f0, this.q1, this.m1);
}
}
if (this.l0) {
StringBuilder sb = new StringBuilder();
sb.append("Scale: ");
sb.append(String.format(Locale.ENGLISH, "%.2f", Float.valueOf(this.B0)));
canvas.drawText(sb.toString(), 5.0f, 15.0f, this.n1);
canvas.drawText("Translate: " + String.format(locale, "%.2f", Float.valueOf(this.D0.x)) + ":" + String.format(locale, "%.2f", Float.valueOf(this.D0.y)), 5.0f, 35.0f, this.n1);
PointF center = getCenter();
canvas.drawText("Source center: " + String.format(locale, "%.2f", Float.valueOf(center.x)) + ":" + String.format(locale, "%.2f", Float.valueOf(center.y)), 5.0f, 55.0f, this.n1);
this.n1.setStrokeWidth(2.0f);
c cVar = this.f1;
if (cVar != null) {
PointF U0 = U0(cVar.f4399c);
PointF U02 = U0(this.f1.f4401e);
PointF U03 = U0(this.f1.f4400d);
canvas.drawCircle(U0.x, U0.y, 10.0f, this.n1);
this.n1.setColor(SupportMenu.CATEGORY_MASK);
canvas.drawCircle(U02.x, U02.y, 20.0f, this.n1);
this.n1.setColor(-16776961);
canvas.drawCircle(U03.x, U03.y, 25.0f, this.n1);
this.n1.setColor(-16711681);
canvas.drawCircle(getWidth() / 2, getHeight() / 2, 30.0f, this.n1);
}
if (this.X0 != null) {
this.n1.setColor(SupportMenu.CATEGORY_MASK);
PointF pointF2 = this.X0;
canvas.drawCircle(pointF2.x, pointF2.y, 20.0f, this.n1);
}
if (this.d1 != null) {
this.n1.setColor(-16776961);
canvas.drawCircle(X0(this.d1.x), Y0(this.d1.y), 35.0f, this.n1);
}
if (this.e1 != null) {
this.n1.setColor(-16711681);
PointF pointF3 = this.e1;
canvas.drawCircle(pointF3.x, pointF3.y, 30.0f, this.n1);
}
this.n1.setColor(-65281);
this.n1.setStrokeWidth(1.0f);
}
}
}
@Override
protected void onMeasure(int i2, int i3) {
int mode = View.MeasureSpec.getMode(i2);
int mode2 = View.MeasureSpec.getMode(i3);
int size = View.MeasureSpec.getSize(i2);
int size2 = View.MeasureSpec.getSize(i3);
boolean z = mode != 1073741824;
boolean z2 = mode2 != 1073741824;
if (this.J0 > 0 && this.K0 > 0) {
if (z && z2) {
size = K0();
size2 = J0();
} else if (z2) {
double J0 = J0();
double K0 = K0();
Double.isNaN(J0);
Double.isNaN(K0);
double d2 = J0 / K0;
double d3 = size;
Double.isNaN(d3);
size2 = (int) (d2 * d3);
} else if (z) {
double K02 = K0();
double J02 = J0();
Double.isNaN(K02);
Double.isNaN(J02);
double d4 = K02 / J02;
double d5 = size2;
Double.isNaN(d5);
size = (int) (d4 * d5);
}
}
setMeasuredDimension(Math.max(size, getSuggestedMinimumWidth()), Math.max(size2, getSuggestedMinimumHeight()));
}
@Override
protected void onSizeChanged(int i2, int i3, int i4, int i5) {
X("onSizeChanged %dx%d -> %dx%d", Integer.valueOf(i4), Integer.valueOf(i5), Integer.valueOf(i2), Integer.valueOf(i3));
PointF center = getCenter();
if (!this.g1 || center == null) {
return;
}
this.f1 = null;
this.G0 = Float.valueOf(this.B0);
this.H0 = center;
}
@Override
public boolean onTouchEvent(@NonNull MotionEvent motionEvent) {
GestureDetector gestureDetector;
c cVar = this.f1;
if (cVar != null && !cVar.i) {
F0(true);
return true;
}
c cVar2 = this.f1;
if (cVar2 != null && cVar2.m != null) {
try {
this.f1.m.onInterruptedByUser();
} catch (Exception e2) {
Log.w(f4391a, "Error thrown by animation listener", e2);
}
}
this.f1 = null;
if (this.D0 == null) {
return true;
}
if (!this.Q0 && ((gestureDetector = this.S0) == null || gestureDetector.onTouchEvent(motionEvent))) {
this.O0 = false;
this.P0 = false;
this.R0 = 0;
return true;
}
if (this.E0 == null) {
this.E0 = new PointF(0.0f, 0.0f);
}
if (this.F0 == null) {
this.F0 = new PointF(0.0f, 0.0f);
}
if (this.X0 == null) {
this.X0 = new PointF(0.0f, 0.0f);
}
float f2 = this.B0;
this.F0.set(this.D0);
boolean B0 = B0(motionEvent);
L0(f2, this.F0, 2);
return B0 || super.onTouchEvent(motionEvent);
}
public final boolean p0() {
return this.x0;
}
public final boolean q0() {
return this.g1;
}
public final boolean r0() {
return this.w0;
}
public final void setBitmapDecoderClass(Class<? extends com.luck.picture.lib.widget.longimage.c> cls) {
if (cls != null) {
this.V0 = new com.luck.picture.lib.widget.longimage.a(cls);
return;
}
throw new IllegalArgumentException("Decoder class cannot be set to null");
}
public final void setBitmapDecoderFactory(com.luck.picture.lib.widget.longimage.b<? extends com.luck.picture.lib.widget.longimage.c> bVar) {
if (bVar != null) {
this.V0 = bVar;
return;
}
throw new IllegalArgumentException("Decoder factory cannot be set to null");
}
public final void setDebug(boolean z) {
this.l0 = z;
}
public final void setDoubleTapZoomDpi(int i2) {
DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
setDoubleTapZoomScale(((displayMetrics.xdpi + displayMetrics.ydpi) / 2.0f) / i2);
}
public final void setDoubleTapZoomDuration(int i2) {
this.A0 = Math.max(0, i2);
}
public final void setDoubleTapZoomScale(float f2) {
this.y0 = f2;
}
public final void setDoubleTapZoomStyle(int i2) {
if (K.contains(Integer.valueOf(i2))) {
this.z0 = i2;
return;
}
throw new IllegalArgumentException("Invalid zoom style: " + i2);
}
public final void setImage(com.luck.picture.lib.widget.longimage.e eVar) {
N0(eVar, null, null);
}
public final void setMaxScale(float f2) {
this.n0 = f2;
}
public void setMaxTileSize(int i2) {
this.s0 = i2;
this.t0 = i2;
}
public final void setMaximumDpi(int i2) {
DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
setMinScale(((displayMetrics.xdpi + displayMetrics.ydpi) / 2.0f) / i2);
}
public final void setMinScale(float f2) {
this.o0 = f2;
}
public final void setMinimumDpi(int i2) {
DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
setMaxScale(((displayMetrics.xdpi + displayMetrics.ydpi) / 2.0f) / i2);
}
public final void setMinimumScaleType(int i2) {
if (V.contains(Integer.valueOf(i2))) {
this.r0 = i2;
if (q0()) {
f0(true);
invalidate();
return;
}
return;
}
throw new IllegalArgumentException("Invalid scale type: " + i2);
}
public void setMinimumTileDpi(int i2) {
DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
this.p0 = (int) Math.min((displayMetrics.xdpi + displayMetrics.ydpi) / 2.0f, i2);
if (q0()) {
G0(false);
invalidate();
}
}
public void setOnImageEventListener(j jVar) {
this.i1 = jVar;
}
@Override
public void setOnLongClickListener(View.OnLongClickListener onLongClickListener) {
this.k1 = onLongClickListener;
}
public void setOnStateChangedListener(k kVar) {
this.j1 = kVar;
}
public final void setOrientation(int i2) {
if (G.contains(Integer.valueOf(i2))) {
this.m0 = i2;
G0(false);
invalidate();
requestLayout();
return;
}
throw new IllegalArgumentException("Invalid orientation: " + i2);
}
public final void setPanEnabled(boolean z) {
PointF pointF;
this.v0 = z;
if (z || (pointF = this.D0) == null) {
return;
}
pointF.x = (getWidth() / 2) - (this.B0 * (K0() / 2));
this.D0.y = (getHeight() / 2) - (this.B0 * (J0() / 2));
if (q0()) {
E0(true);
invalidate();
}
}
public final void setPanLimit(int i2) {
if (R.contains(Integer.valueOf(i2))) {
this.q0 = i2;
if (q0()) {
f0(true);
invalidate();
return;
}
return;
}
throw new IllegalArgumentException("Invalid pan limit: " + i2);
}
public void setParallelLoadingEnabled(boolean z) {
this.u0 = z;
}
public final void setQuickScaleEnabled(boolean z) {
this.x0 = z;
}
public final void setRegionDecoderClass(Class<? extends com.luck.picture.lib.widget.longimage.d> cls) {
if (cls != null) {
this.W0 = new com.luck.picture.lib.widget.longimage.a(cls);
return;
}
throw new IllegalArgumentException("Decoder class cannot be set to null");
}
public final void setRegionDecoderFactory(com.luck.picture.lib.widget.longimage.b<? extends com.luck.picture.lib.widget.longimage.d> bVar) {
if (bVar != null) {
this.W0 = bVar;
return;
}
throw new IllegalArgumentException("Decoder factory cannot be set to null");
}
public final void setTileBackgroundColor(int i2) {
if (Color.alpha(i2) == 0) {
this.o1 = null;
} else {
Paint paint = new Paint();
this.o1 = paint;
paint.setStyle(Paint.Style.FILL);
this.o1.setColor(i2);
}
invalidate();
}
public final void setZoomEnabled(boolean z) {
this.w0 = z;
}
protected void v0() {
}
protected void y0() {
}
public static class c {
private float f4397a;
private float f4398b;
private PointF f4399c;
private PointF f4400d;
private PointF f4401e;
private PointF f4402f;
private PointF f4403g;
private long h;
private boolean i;
private int j;
private int k;
private long l;
private i m;
private c() {
this.h = 500L;
this.i = true;
this.j = 2;
this.k = 1;
this.l = System.currentTimeMillis();
}
c(a aVar) {
this();
}
}
public SubsamplingScaleImageView(Context context) {
this(context, null);
}
}