Initial commit
This commit is contained in:
21
sources/com/github/chrisbanes/photoview/Compat.java
Normal file
21
sources/com/github/chrisbanes/photoview/Compat.java
Normal file
@@ -0,0 +1,21 @@
|
||||
package com.github.chrisbanes.photoview;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.os.Build;
|
||||
import android.view.View;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class Compat {
|
||||
public static void a(View view, Runnable runnable) {
|
||||
if (Build.VERSION.SDK_INT >= 16) {
|
||||
b(view, runnable);
|
||||
} else {
|
||||
view.postDelayed(runnable, 16L);
|
||||
}
|
||||
}
|
||||
|
||||
@TargetApi(16)
|
||||
private static void b(View view, Runnable runnable) {
|
||||
view.postOnAnimation(runnable);
|
||||
}
|
||||
}
|
@@ -0,0 +1,152 @@
|
||||
package com.github.chrisbanes.photoview;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.ScaleGestureDetector;
|
||||
import android.view.VelocityTracker;
|
||||
import android.view.ViewConfiguration;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class CustomGestureDetector {
|
||||
private int a = -1;
|
||||
private int b = 0;
|
||||
private final ScaleGestureDetector c;
|
||||
private VelocityTracker d;
|
||||
private boolean e;
|
||||
private float f;
|
||||
private float g;
|
||||
private final float h;
|
||||
private final float i;
|
||||
private OnGestureListener j;
|
||||
|
||||
CustomGestureDetector(Context context, OnGestureListener onGestureListener) {
|
||||
ViewConfiguration viewConfiguration = ViewConfiguration.get(context);
|
||||
this.i = viewConfiguration.getScaledMinimumFlingVelocity();
|
||||
this.h = viewConfiguration.getScaledTouchSlop();
|
||||
this.j = onGestureListener;
|
||||
this.c = new ScaleGestureDetector(context, new ScaleGestureDetector.OnScaleGestureListener() { // from class: com.github.chrisbanes.photoview.CustomGestureDetector.1
|
||||
@Override // android.view.ScaleGestureDetector.OnScaleGestureListener
|
||||
public boolean onScale(ScaleGestureDetector scaleGestureDetector) {
|
||||
float scaleFactor = scaleGestureDetector.getScaleFactor();
|
||||
if (Float.isNaN(scaleFactor) || Float.isInfinite(scaleFactor)) {
|
||||
return false;
|
||||
}
|
||||
CustomGestureDetector.this.j.a(scaleFactor, scaleGestureDetector.getFocusX(), scaleGestureDetector.getFocusY());
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // android.view.ScaleGestureDetector.OnScaleGestureListener
|
||||
public boolean onScaleBegin(ScaleGestureDetector scaleGestureDetector) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // android.view.ScaleGestureDetector.OnScaleGestureListener
|
||||
public void onScaleEnd(ScaleGestureDetector scaleGestureDetector) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private float b(MotionEvent motionEvent) {
|
||||
try {
|
||||
return motionEvent.getX(this.b);
|
||||
} catch (Exception unused) {
|
||||
return motionEvent.getX();
|
||||
}
|
||||
}
|
||||
|
||||
private float c(MotionEvent motionEvent) {
|
||||
try {
|
||||
return motionEvent.getY(this.b);
|
||||
} catch (Exception unused) {
|
||||
return motionEvent.getY();
|
||||
}
|
||||
}
|
||||
|
||||
private boolean d(MotionEvent motionEvent) {
|
||||
int action = motionEvent.getAction() & 255;
|
||||
if (action == 0) {
|
||||
this.a = motionEvent.getPointerId(0);
|
||||
this.d = VelocityTracker.obtain();
|
||||
VelocityTracker velocityTracker = this.d;
|
||||
if (velocityTracker != null) {
|
||||
velocityTracker.addMovement(motionEvent);
|
||||
}
|
||||
this.f = b(motionEvent);
|
||||
this.g = c(motionEvent);
|
||||
this.e = false;
|
||||
} else if (action == 1) {
|
||||
this.a = -1;
|
||||
if (this.e && this.d != null) {
|
||||
this.f = b(motionEvent);
|
||||
this.g = c(motionEvent);
|
||||
this.d.addMovement(motionEvent);
|
||||
this.d.computeCurrentVelocity(1000);
|
||||
float xVelocity = this.d.getXVelocity();
|
||||
float yVelocity = this.d.getYVelocity();
|
||||
if (Math.max(Math.abs(xVelocity), Math.abs(yVelocity)) >= this.i) {
|
||||
this.j.a(this.f, this.g, -xVelocity, -yVelocity);
|
||||
}
|
||||
}
|
||||
VelocityTracker velocityTracker2 = this.d;
|
||||
if (velocityTracker2 != null) {
|
||||
velocityTracker2.recycle();
|
||||
this.d = null;
|
||||
}
|
||||
} else if (action == 2) {
|
||||
float b = b(motionEvent);
|
||||
float c = c(motionEvent);
|
||||
float f = b - this.f;
|
||||
float f2 = c - this.g;
|
||||
if (!this.e) {
|
||||
this.e = Math.sqrt((double) ((f * f) + (f2 * f2))) >= ((double) this.h);
|
||||
}
|
||||
if (this.e) {
|
||||
this.j.a(f, f2);
|
||||
this.f = b;
|
||||
this.g = c;
|
||||
VelocityTracker velocityTracker3 = this.d;
|
||||
if (velocityTracker3 != null) {
|
||||
velocityTracker3.addMovement(motionEvent);
|
||||
}
|
||||
}
|
||||
} else if (action == 3) {
|
||||
this.a = -1;
|
||||
VelocityTracker velocityTracker4 = this.d;
|
||||
if (velocityTracker4 != null) {
|
||||
velocityTracker4.recycle();
|
||||
this.d = null;
|
||||
}
|
||||
} else if (action == 6) {
|
||||
int a = Util.a(motionEvent.getAction());
|
||||
if (motionEvent.getPointerId(a) == this.a) {
|
||||
int i = a == 0 ? 1 : 0;
|
||||
this.a = motionEvent.getPointerId(i);
|
||||
this.f = motionEvent.getX(i);
|
||||
this.g = motionEvent.getY(i);
|
||||
}
|
||||
}
|
||||
int i2 = this.a;
|
||||
if (i2 == -1) {
|
||||
i2 = 0;
|
||||
}
|
||||
this.b = motionEvent.findPointerIndex(i2);
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean a() {
|
||||
return this.e;
|
||||
}
|
||||
|
||||
public boolean a(MotionEvent motionEvent) {
|
||||
try {
|
||||
this.c.onTouchEvent(motionEvent);
|
||||
return d(motionEvent);
|
||||
} catch (IllegalArgumentException unused) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean b() {
|
||||
return this.c.isInProgress();
|
||||
}
|
||||
}
|
@@ -0,0 +1,10 @@
|
||||
package com.github.chrisbanes.photoview;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
interface OnGestureListener {
|
||||
void a(float f, float f2);
|
||||
|
||||
void a(float f, float f2, float f3);
|
||||
|
||||
void a(float f, float f2, float f3, float f4);
|
||||
}
|
@@ -0,0 +1,8 @@
|
||||
package com.github.chrisbanes.photoview;
|
||||
|
||||
import android.graphics.RectF;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface OnMatrixChangedListener {
|
||||
void a(RectF rectF);
|
||||
}
|
@@ -0,0 +1,8 @@
|
||||
package com.github.chrisbanes.photoview;
|
||||
|
||||
import android.widget.ImageView;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface OnOutsidePhotoTapListener {
|
||||
void a(ImageView imageView);
|
||||
}
|
@@ -0,0 +1,8 @@
|
||||
package com.github.chrisbanes.photoview;
|
||||
|
||||
import android.widget.ImageView;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface OnPhotoTapListener {
|
||||
void a(ImageView imageView, float f, float f2);
|
||||
}
|
@@ -0,0 +1,6 @@
|
||||
package com.github.chrisbanes.photoview;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface OnScaleChangedListener {
|
||||
void a(float f, float f2, float f3);
|
||||
}
|
@@ -0,0 +1,8 @@
|
||||
package com.github.chrisbanes.photoview;
|
||||
|
||||
import android.view.MotionEvent;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface OnSingleFlingListener {
|
||||
boolean onFling(MotionEvent motionEvent, MotionEvent motionEvent2, float f, float f2);
|
||||
}
|
@@ -0,0 +1,6 @@
|
||||
package com.github.chrisbanes.photoview;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface OnViewDragListener {
|
||||
void a(float f, float f2);
|
||||
}
|
@@ -0,0 +1,8 @@
|
||||
package com.github.chrisbanes.photoview;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface OnViewTapListener {
|
||||
void a(View view, float f, float f2);
|
||||
}
|
@@ -0,0 +1,8 @@
|
||||
package com.github.chrisbanes.photoview;
|
||||
|
||||
import android.view.MotionEvent;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface OnViewTouchListener {
|
||||
void a(MotionEvent motionEvent);
|
||||
}
|
205
sources/com/github/chrisbanes/photoview/PhotoView.java
Normal file
205
sources/com/github/chrisbanes/photoview/PhotoView.java
Normal file
@@ -0,0 +1,205 @@
|
||||
package com.github.chrisbanes.photoview;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.Context;
|
||||
import android.graphics.Matrix;
|
||||
import android.graphics.RectF;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.GestureDetector;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class PhotoView extends ImageView {
|
||||
private PhotoViewAttacher a;
|
||||
private ImageView.ScaleType b;
|
||||
|
||||
public PhotoView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
private void a() {
|
||||
this.a = new PhotoViewAttacher(this);
|
||||
super.setScaleType(ImageView.ScaleType.MATRIX);
|
||||
ImageView.ScaleType scaleType = this.b;
|
||||
if (scaleType != null) {
|
||||
setScaleType(scaleType);
|
||||
this.b = null;
|
||||
}
|
||||
}
|
||||
|
||||
public PhotoViewAttacher getAttacher() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
public RectF getDisplayRect() {
|
||||
return this.a.a();
|
||||
}
|
||||
|
||||
@Override // android.widget.ImageView
|
||||
public Matrix getImageMatrix() {
|
||||
return this.a.b();
|
||||
}
|
||||
|
||||
public float getMaximumScale() {
|
||||
return this.a.c();
|
||||
}
|
||||
|
||||
public float getMediumScale() {
|
||||
return this.a.d();
|
||||
}
|
||||
|
||||
public float getMinimumScale() {
|
||||
return this.a.e();
|
||||
}
|
||||
|
||||
public float getScale() {
|
||||
return this.a.f();
|
||||
}
|
||||
|
||||
@Override // android.widget.ImageView
|
||||
public ImageView.ScaleType getScaleType() {
|
||||
return this.a.g();
|
||||
}
|
||||
|
||||
public void setAllowParentInterceptOnEdge(boolean z) {
|
||||
this.a.a(z);
|
||||
}
|
||||
|
||||
@Override // android.widget.ImageView
|
||||
protected boolean setFrame(int i, int i2, int i3, int i4) {
|
||||
boolean frame = super.setFrame(i, i2, i3, i4);
|
||||
if (frame) {
|
||||
this.a.h();
|
||||
}
|
||||
return frame;
|
||||
}
|
||||
|
||||
@Override // android.widget.ImageView
|
||||
public void setImageDrawable(Drawable drawable) {
|
||||
super.setImageDrawable(drawable);
|
||||
PhotoViewAttacher photoViewAttacher = this.a;
|
||||
if (photoViewAttacher != null) {
|
||||
photoViewAttacher.h();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.ImageView
|
||||
public void setImageResource(int i) {
|
||||
super.setImageResource(i);
|
||||
PhotoViewAttacher photoViewAttacher = this.a;
|
||||
if (photoViewAttacher != null) {
|
||||
photoViewAttacher.h();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.ImageView
|
||||
public void setImageURI(Uri uri) {
|
||||
super.setImageURI(uri);
|
||||
PhotoViewAttacher photoViewAttacher = this.a;
|
||||
if (photoViewAttacher != null) {
|
||||
photoViewAttacher.h();
|
||||
}
|
||||
}
|
||||
|
||||
public void setMaximumScale(float f) {
|
||||
this.a.a(f);
|
||||
}
|
||||
|
||||
public void setMediumScale(float f) {
|
||||
this.a.b(f);
|
||||
}
|
||||
|
||||
public void setMinimumScale(float f) {
|
||||
this.a.c(f);
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setOnClickListener(View.OnClickListener onClickListener) {
|
||||
this.a.a(onClickListener);
|
||||
}
|
||||
|
||||
public void setOnDoubleTapListener(GestureDetector.OnDoubleTapListener onDoubleTapListener) {
|
||||
this.a.a(onDoubleTapListener);
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setOnLongClickListener(View.OnLongClickListener onLongClickListener) {
|
||||
this.a.a(onLongClickListener);
|
||||
}
|
||||
|
||||
public void setOnMatrixChangeListener(OnMatrixChangedListener onMatrixChangedListener) {
|
||||
this.a.a(onMatrixChangedListener);
|
||||
}
|
||||
|
||||
public void setOnOutsidePhotoTapListener(OnOutsidePhotoTapListener onOutsidePhotoTapListener) {
|
||||
this.a.a(onOutsidePhotoTapListener);
|
||||
}
|
||||
|
||||
public void setOnPhotoTapListener(OnPhotoTapListener onPhotoTapListener) {
|
||||
this.a.a(onPhotoTapListener);
|
||||
}
|
||||
|
||||
public void setOnScaleChangeListener(OnScaleChangedListener onScaleChangedListener) {
|
||||
this.a.a(onScaleChangedListener);
|
||||
}
|
||||
|
||||
public void setOnSingleFlingListener(OnSingleFlingListener onSingleFlingListener) {
|
||||
this.a.a(onSingleFlingListener);
|
||||
}
|
||||
|
||||
public void setOnViewDragListener(OnViewDragListener onViewDragListener) {
|
||||
this.a.a(onViewDragListener);
|
||||
}
|
||||
|
||||
public void setOnViewTapListener(OnViewTapListener onViewTapListener) {
|
||||
this.a.a(onViewTapListener);
|
||||
}
|
||||
|
||||
public void setRotationBy(float f) {
|
||||
this.a.d(f);
|
||||
}
|
||||
|
||||
public void setRotationTo(float f) {
|
||||
this.a.e(f);
|
||||
}
|
||||
|
||||
public void setScale(float f) {
|
||||
this.a.f(f);
|
||||
}
|
||||
|
||||
@Override // android.widget.ImageView
|
||||
public void setScaleType(ImageView.ScaleType scaleType) {
|
||||
PhotoViewAttacher photoViewAttacher = this.a;
|
||||
if (photoViewAttacher == null) {
|
||||
this.b = scaleType;
|
||||
} else {
|
||||
photoViewAttacher.a(scaleType);
|
||||
}
|
||||
}
|
||||
|
||||
public void setZoomTransitionDuration(int i) {
|
||||
this.a.a(i);
|
||||
}
|
||||
|
||||
public void setZoomable(boolean z) {
|
||||
this.a.b(z);
|
||||
}
|
||||
|
||||
public PhotoView(Context context, AttributeSet attributeSet) {
|
||||
this(context, attributeSet, 0);
|
||||
}
|
||||
|
||||
public PhotoView(Context context, AttributeSet attributeSet, int i) {
|
||||
super(context, attributeSet, i);
|
||||
a();
|
||||
}
|
||||
|
||||
@TargetApi(21)
|
||||
public PhotoView(Context context, AttributeSet attributeSet, int i, int i2) {
|
||||
super(context, attributeSet, i, i2);
|
||||
a();
|
||||
}
|
||||
}
|
784
sources/com/github/chrisbanes/photoview/PhotoViewAttacher.java
Normal file
784
sources/com/github/chrisbanes/photoview/PhotoViewAttacher.java
Normal file
@@ -0,0 +1,784 @@
|
||||
package com.github.chrisbanes.photoview;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Matrix;
|
||||
import android.graphics.RectF;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.view.GestureDetector;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewParent;
|
||||
import android.view.animation.AccelerateDecelerateInterpolator;
|
||||
import android.view.animation.Interpolator;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.OverScroller;
|
||||
import androidx.core.view.MotionEventCompat;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class PhotoViewAttacher implements View.OnTouchListener, View.OnLayoutChangeListener, View.OnGenericMotionListener {
|
||||
private static float H = 3.0f;
|
||||
private static float I = 1.75f;
|
||||
private static float J = 1.0f;
|
||||
private static int K = 200;
|
||||
private static int L = 1;
|
||||
private FlingRunnable A;
|
||||
private float C;
|
||||
private ImageView h;
|
||||
private GestureDetector i;
|
||||
private CustomGestureDetector j;
|
||||
private OnMatrixChangedListener p;
|
||||
private OnPhotoTapListener q;
|
||||
private OnOutsidePhotoTapListener r;
|
||||
private OnViewTapListener s;
|
||||
private View.OnClickListener t;
|
||||
private View.OnLongClickListener u;
|
||||
private OnScaleChangedListener v;
|
||||
private OnSingleFlingListener x;
|
||||
private OnViewDragListener y;
|
||||
private OnViewTouchListener z;
|
||||
private Interpolator a = new AccelerateDecelerateInterpolator();
|
||||
private int b = K;
|
||||
private float c = J;
|
||||
private float d = I;
|
||||
private float e = H;
|
||||
private boolean f = true;
|
||||
private boolean g = false;
|
||||
private final Matrix k = new Matrix();
|
||||
private final Matrix l = new Matrix();
|
||||
private final Matrix m = new Matrix();
|
||||
private final RectF n = new RectF();
|
||||
private final float[] o = new float[9];
|
||||
private int B = 2;
|
||||
private boolean D = true;
|
||||
private ImageView.ScaleType E = ImageView.ScaleType.FIT_CENTER;
|
||||
private float F = 0.75f;
|
||||
private OnGestureListener G = new OnGestureListener() { // from class: com.github.chrisbanes.photoview.PhotoViewAttacher.1
|
||||
@Override // com.github.chrisbanes.photoview.OnGestureListener
|
||||
public void a(float f, float f2) {
|
||||
if (PhotoViewAttacher.this.j.b()) {
|
||||
return;
|
||||
}
|
||||
if (PhotoViewAttacher.this.y != null) {
|
||||
PhotoViewAttacher.this.y.a(f, f2);
|
||||
}
|
||||
PhotoViewAttacher.this.m.postTranslate(f, f2);
|
||||
PhotoViewAttacher.this.l();
|
||||
ViewParent parent = PhotoViewAttacher.this.h.getParent();
|
||||
if (!PhotoViewAttacher.this.f || PhotoViewAttacher.this.j.b() || PhotoViewAttacher.this.g) {
|
||||
if (parent != null) {
|
||||
parent.requestDisallowInterceptTouchEvent(true);
|
||||
}
|
||||
} else if ((PhotoViewAttacher.this.B == 2 || ((PhotoViewAttacher.this.B == 0 && f >= 1.0f) || (PhotoViewAttacher.this.B == 1 && f <= -1.0f))) && parent != null) {
|
||||
parent.requestDisallowInterceptTouchEvent(false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.github.chrisbanes.photoview.OnGestureListener
|
||||
public void a(float f, float f2, float f3, float f4) {
|
||||
PhotoViewAttacher photoViewAttacher = PhotoViewAttacher.this;
|
||||
photoViewAttacher.A = photoViewAttacher.new FlingRunnable(photoViewAttacher.h.getContext());
|
||||
FlingRunnable flingRunnable = PhotoViewAttacher.this.A;
|
||||
PhotoViewAttacher photoViewAttacher2 = PhotoViewAttacher.this;
|
||||
int b = photoViewAttacher2.b(photoViewAttacher2.h);
|
||||
PhotoViewAttacher photoViewAttacher3 = PhotoViewAttacher.this;
|
||||
flingRunnable.a(b, photoViewAttacher3.a(photoViewAttacher3.h), (int) f3, (int) f4);
|
||||
PhotoViewAttacher.this.h.post(PhotoViewAttacher.this.A);
|
||||
}
|
||||
|
||||
@Override // com.github.chrisbanes.photoview.OnGestureListener
|
||||
public void a(float f, float f2, float f3) {
|
||||
if (PhotoViewAttacher.this.f() < PhotoViewAttacher.this.e || f < 1.0f) {
|
||||
if (PhotoViewAttacher.this.f() > PhotoViewAttacher.this.c || f > 1.0f) {
|
||||
if (PhotoViewAttacher.this.v != null) {
|
||||
PhotoViewAttacher.this.v.a(f, f2, f3);
|
||||
}
|
||||
PhotoViewAttacher.this.m.postScale(f, f, f2, f3);
|
||||
PhotoViewAttacher.this.l();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/* renamed from: com.github.chrisbanes.photoview.PhotoViewAttacher$4, reason: invalid class name */
|
||||
static /* synthetic */ class AnonymousClass4 {
|
||||
static final /* synthetic */ int[] a = new int[ImageView.ScaleType.values().length];
|
||||
|
||||
static {
|
||||
try {
|
||||
a[ImageView.ScaleType.FIT_CENTER.ordinal()] = 1;
|
||||
} catch (NoSuchFieldError unused) {
|
||||
}
|
||||
try {
|
||||
a[ImageView.ScaleType.FIT_START.ordinal()] = 2;
|
||||
} catch (NoSuchFieldError unused2) {
|
||||
}
|
||||
try {
|
||||
a[ImageView.ScaleType.FIT_END.ordinal()] = 3;
|
||||
} catch (NoSuchFieldError unused3) {
|
||||
}
|
||||
try {
|
||||
a[ImageView.ScaleType.FIT_XY.ordinal()] = 4;
|
||||
} catch (NoSuchFieldError unused4) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class AnimatedZoomRunnable implements Runnable {
|
||||
private final float a;
|
||||
private final float b;
|
||||
private final long c = System.currentTimeMillis();
|
||||
private final float d;
|
||||
private final float e;
|
||||
|
||||
public AnimatedZoomRunnable(float f, float f2, float f3, float f4) {
|
||||
this.a = f3;
|
||||
this.b = f4;
|
||||
this.d = f;
|
||||
this.e = f2;
|
||||
}
|
||||
|
||||
private float a() {
|
||||
return PhotoViewAttacher.this.a.getInterpolation(Math.min(1.0f, ((System.currentTimeMillis() - this.c) * 1.0f) / PhotoViewAttacher.this.b));
|
||||
}
|
||||
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
float a = a();
|
||||
float f = this.d;
|
||||
PhotoViewAttacher.this.G.a((f + ((this.e - f) * a)) / PhotoViewAttacher.this.f(), this.a, this.b);
|
||||
if (a < 1.0f) {
|
||||
Compat.a(PhotoViewAttacher.this.h, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class FlingRunnable implements Runnable {
|
||||
private final OverScroller a;
|
||||
private int b;
|
||||
private int c;
|
||||
|
||||
public FlingRunnable(Context context) {
|
||||
this.a = new OverScroller(context);
|
||||
}
|
||||
|
||||
public void a() {
|
||||
this.a.forceFinished(true);
|
||||
}
|
||||
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
if (!this.a.isFinished() && this.a.computeScrollOffset()) {
|
||||
int currX = this.a.getCurrX();
|
||||
int currY = this.a.getCurrY();
|
||||
PhotoViewAttacher.this.m.postTranslate(this.b - currX, this.c - currY);
|
||||
PhotoViewAttacher.this.l();
|
||||
this.b = currX;
|
||||
this.c = currY;
|
||||
Compat.a(PhotoViewAttacher.this.h, this);
|
||||
}
|
||||
}
|
||||
|
||||
public void a(int i, int i2, int i3, int i4) {
|
||||
int i5;
|
||||
int i6;
|
||||
int i7;
|
||||
int i8;
|
||||
RectF a = PhotoViewAttacher.this.a();
|
||||
if (a == null) {
|
||||
return;
|
||||
}
|
||||
int round = Math.round(-a.left);
|
||||
float f = i;
|
||||
if (f < a.width()) {
|
||||
i6 = Math.round(a.width() - f);
|
||||
i5 = 0;
|
||||
} else {
|
||||
i5 = round;
|
||||
i6 = i5;
|
||||
}
|
||||
int round2 = Math.round(-a.top);
|
||||
float f2 = i2;
|
||||
if (f2 < a.height()) {
|
||||
i8 = Math.round(a.height() - f2);
|
||||
i7 = 0;
|
||||
} else {
|
||||
i7 = round2;
|
||||
i8 = i7;
|
||||
}
|
||||
this.b = round;
|
||||
this.c = round2;
|
||||
if (round == i6 && round2 == i8) {
|
||||
return;
|
||||
}
|
||||
this.a.fling(round, round2, i3, i4, i5, i6, i7, i8, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public PhotoViewAttacher(ImageView imageView) {
|
||||
this.h = imageView;
|
||||
imageView.setOnTouchListener(this);
|
||||
imageView.addOnLayoutChangeListener(this);
|
||||
imageView.setOnGenericMotionListener(this);
|
||||
if (imageView.isInEditMode()) {
|
||||
return;
|
||||
}
|
||||
this.C = 0.0f;
|
||||
this.j = new CustomGestureDetector(imageView.getContext(), this.G);
|
||||
this.i = new GestureDetector(imageView.getContext(), new GestureDetector.SimpleOnGestureListener() { // from class: com.github.chrisbanes.photoview.PhotoViewAttacher.2
|
||||
@Override // android.view.GestureDetector.SimpleOnGestureListener, android.view.GestureDetector.OnGestureListener
|
||||
public boolean onFling(MotionEvent motionEvent, MotionEvent motionEvent2, float f, float f2) {
|
||||
if (PhotoViewAttacher.this.x == null || PhotoViewAttacher.this.f() > PhotoViewAttacher.J || MotionEventCompat.b(motionEvent) > PhotoViewAttacher.L || MotionEventCompat.b(motionEvent2) > PhotoViewAttacher.L) {
|
||||
return false;
|
||||
}
|
||||
return PhotoViewAttacher.this.x.onFling(motionEvent, motionEvent2, f, f2);
|
||||
}
|
||||
|
||||
@Override // android.view.GestureDetector.SimpleOnGestureListener, android.view.GestureDetector.OnGestureListener
|
||||
public void onLongPress(MotionEvent motionEvent) {
|
||||
if (PhotoViewAttacher.this.u != null) {
|
||||
PhotoViewAttacher.this.u.onLongClick(PhotoViewAttacher.this.h);
|
||||
}
|
||||
}
|
||||
});
|
||||
this.i.setOnDoubleTapListener(new GestureDetector.OnDoubleTapListener() { // from class: com.github.chrisbanes.photoview.PhotoViewAttacher.3
|
||||
@Override // android.view.GestureDetector.OnDoubleTapListener
|
||||
public boolean onDoubleTap(MotionEvent motionEvent) {
|
||||
try {
|
||||
float f = PhotoViewAttacher.this.f();
|
||||
float x = motionEvent.getX();
|
||||
float y = motionEvent.getY();
|
||||
if (f < PhotoViewAttacher.this.d()) {
|
||||
PhotoViewAttacher.this.a(PhotoViewAttacher.this.d(), x, y, true);
|
||||
} else if (f < PhotoViewAttacher.this.d() || f >= PhotoViewAttacher.this.c()) {
|
||||
PhotoViewAttacher.this.a(PhotoViewAttacher.this.e(), x, y, true);
|
||||
} else {
|
||||
PhotoViewAttacher.this.a(PhotoViewAttacher.this.c(), x, y, true);
|
||||
}
|
||||
} catch (ArrayIndexOutOfBoundsException unused) {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // android.view.GestureDetector.OnDoubleTapListener
|
||||
public boolean onDoubleTapEvent(MotionEvent motionEvent) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // android.view.GestureDetector.OnDoubleTapListener
|
||||
public boolean onSingleTapConfirmed(MotionEvent motionEvent) {
|
||||
if (PhotoViewAttacher.this.t != null) {
|
||||
PhotoViewAttacher.this.t.onClick(PhotoViewAttacher.this.h);
|
||||
}
|
||||
RectF a = PhotoViewAttacher.this.a();
|
||||
float x = motionEvent.getX();
|
||||
float y = motionEvent.getY();
|
||||
if (PhotoViewAttacher.this.s != null) {
|
||||
PhotoViewAttacher.this.s.a(PhotoViewAttacher.this.h, x, y);
|
||||
}
|
||||
if (a == null) {
|
||||
return false;
|
||||
}
|
||||
if (!a.contains(x, y)) {
|
||||
if (PhotoViewAttacher.this.r == null) {
|
||||
return false;
|
||||
}
|
||||
PhotoViewAttacher.this.r.a(PhotoViewAttacher.this.h);
|
||||
return false;
|
||||
}
|
||||
float width = (x - a.left) / a.width();
|
||||
float height = (y - a.top) / a.height();
|
||||
if (PhotoViewAttacher.this.q == null) {
|
||||
return true;
|
||||
}
|
||||
PhotoViewAttacher.this.q.a(PhotoViewAttacher.this.h, width, height);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override // android.view.View.OnGenericMotionListener
|
||||
public boolean onGenericMotion(View view, MotionEvent motionEvent) {
|
||||
if ((motionEvent.getSource() & 2) == 0) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
if (motionEvent.getAction() == 8) {
|
||||
float f = f();
|
||||
float x = motionEvent.getX();
|
||||
float y = motionEvent.getY();
|
||||
if (motionEvent.getAxisValue(9) < 0.0f) {
|
||||
if (f != e()) {
|
||||
if (f - this.F <= e()) {
|
||||
a(e(), x, y, true);
|
||||
} else {
|
||||
a(f - this.F, x, y, true);
|
||||
}
|
||||
}
|
||||
} else if (f != c()) {
|
||||
if (this.F + f >= c()) {
|
||||
a(c(), x, y, true);
|
||||
} else {
|
||||
a(f + this.F, x, y, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
} catch (ArrayIndexOutOfBoundsException unused) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.View.OnLayoutChangeListener
|
||||
public void onLayoutChange(View view, int i, int i2, int i3, int i4, int i5, int i6, int i7, int i8) {
|
||||
if (i == i5 && i2 == i6 && i3 == i7 && i4 == i8) {
|
||||
return;
|
||||
}
|
||||
a(this.h.getDrawable());
|
||||
}
|
||||
|
||||
/* JADX WARN: Removed duplicated region for block: B:16:0x0086 */
|
||||
/* JADX WARN: Removed duplicated region for block: B:39:0x00b9 */
|
||||
@Override // android.view.View.OnTouchListener
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
||||
*/
|
||||
public boolean onTouch(android.view.View r11, android.view.MotionEvent r12) {
|
||||
/*
|
||||
r10 = this;
|
||||
com.github.chrisbanes.photoview.OnViewTouchListener r0 = r10.z
|
||||
if (r0 == 0) goto L7
|
||||
r0.a(r12)
|
||||
L7:
|
||||
boolean r0 = r10.D
|
||||
r1 = 0
|
||||
r2 = 1
|
||||
if (r0 == 0) goto Lc5
|
||||
r0 = r11
|
||||
android.widget.ImageView r0 = (android.widget.ImageView) r0
|
||||
boolean r0 = com.github.chrisbanes.photoview.Util.a(r0)
|
||||
if (r0 == 0) goto Lc5
|
||||
int r0 = r12.getAction()
|
||||
if (r0 == 0) goto L75
|
||||
if (r0 == r2) goto L22
|
||||
r3 = 3
|
||||
if (r0 == r3) goto L22
|
||||
goto L81
|
||||
L22:
|
||||
float r0 = r10.f()
|
||||
float r3 = r10.c
|
||||
int r0 = (r0 > r3 ? 1 : (r0 == r3 ? 0 : -1))
|
||||
if (r0 >= 0) goto L4b
|
||||
android.graphics.RectF r0 = r10.a()
|
||||
if (r0 == 0) goto L81
|
||||
com.github.chrisbanes.photoview.PhotoViewAttacher$AnimatedZoomRunnable r9 = new com.github.chrisbanes.photoview.PhotoViewAttacher$AnimatedZoomRunnable
|
||||
float r5 = r10.f()
|
||||
float r6 = r10.c
|
||||
float r7 = r0.centerX()
|
||||
float r8 = r0.centerY()
|
||||
r3 = r9
|
||||
r4 = r10
|
||||
r3.<init>(r5, r6, r7, r8)
|
||||
r11.post(r9)
|
||||
goto L73
|
||||
L4b:
|
||||
float r0 = r10.f()
|
||||
float r3 = r10.e
|
||||
int r0 = (r0 > r3 ? 1 : (r0 == r3 ? 0 : -1))
|
||||
if (r0 <= 0) goto L81
|
||||
android.graphics.RectF r0 = r10.a()
|
||||
if (r0 == 0) goto L81
|
||||
com.github.chrisbanes.photoview.PhotoViewAttacher$AnimatedZoomRunnable r9 = new com.github.chrisbanes.photoview.PhotoViewAttacher$AnimatedZoomRunnable
|
||||
float r5 = r10.f()
|
||||
float r6 = r10.e
|
||||
float r7 = r0.centerX()
|
||||
float r8 = r0.centerY()
|
||||
r3 = r9
|
||||
r4 = r10
|
||||
r3.<init>(r5, r6, r7, r8)
|
||||
r11.post(r9)
|
||||
L73:
|
||||
r11 = 1
|
||||
goto L82
|
||||
L75:
|
||||
android.view.ViewParent r11 = r11.getParent()
|
||||
if (r11 == 0) goto L7e
|
||||
r11.requestDisallowInterceptTouchEvent(r2)
|
||||
L7e:
|
||||
r10.k()
|
||||
L81:
|
||||
r11 = 0
|
||||
L82:
|
||||
com.github.chrisbanes.photoview.CustomGestureDetector r0 = r10.j
|
||||
if (r0 == 0) goto Lb9
|
||||
boolean r11 = r0.b()
|
||||
com.github.chrisbanes.photoview.CustomGestureDetector r0 = r10.j
|
||||
boolean r0 = r0.a()
|
||||
com.github.chrisbanes.photoview.CustomGestureDetector r3 = r10.j
|
||||
boolean r3 = r3.a(r12)
|
||||
if (r11 != 0) goto La2
|
||||
com.github.chrisbanes.photoview.CustomGestureDetector r11 = r10.j
|
||||
boolean r11 = r11.b()
|
||||
if (r11 != 0) goto La2
|
||||
r11 = 1
|
||||
goto La3
|
||||
La2:
|
||||
r11 = 0
|
||||
La3:
|
||||
if (r0 != 0) goto Laf
|
||||
com.github.chrisbanes.photoview.CustomGestureDetector r0 = r10.j
|
||||
boolean r0 = r0.a()
|
||||
if (r0 != 0) goto Laf
|
||||
r0 = 1
|
||||
goto Lb0
|
||||
Laf:
|
||||
r0 = 0
|
||||
Lb0:
|
||||
if (r11 == 0) goto Lb5
|
||||
if (r0 == 0) goto Lb5
|
||||
r1 = 1
|
||||
Lb5:
|
||||
r10.g = r1
|
||||
r1 = r3
|
||||
goto Lba
|
||||
Lb9:
|
||||
r1 = r11
|
||||
Lba:
|
||||
android.view.GestureDetector r11 = r10.i
|
||||
if (r11 == 0) goto Lc5
|
||||
boolean r11 = r11.onTouchEvent(r12)
|
||||
if (r11 == 0) goto Lc5
|
||||
r1 = 1
|
||||
Lc5:
|
||||
return r1
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: com.github.chrisbanes.photoview.PhotoViewAttacher.onTouch(android.view.View, android.view.MotionEvent):boolean");
|
||||
}
|
||||
|
||||
private void k() {
|
||||
FlingRunnable flingRunnable = this.A;
|
||||
if (flingRunnable != null) {
|
||||
flingRunnable.a();
|
||||
this.A = null;
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public void l() {
|
||||
if (m()) {
|
||||
b(n());
|
||||
}
|
||||
}
|
||||
|
||||
private boolean m() {
|
||||
float f;
|
||||
float f2;
|
||||
float f3;
|
||||
float f4;
|
||||
float f5;
|
||||
RectF a = a(n());
|
||||
if (a == null) {
|
||||
return false;
|
||||
}
|
||||
float height = a.height();
|
||||
float width = a.width();
|
||||
float a2 = a(this.h);
|
||||
float f6 = 0.0f;
|
||||
if (height <= a2) {
|
||||
int i = AnonymousClass4.a[this.E.ordinal()];
|
||||
if (i != 2) {
|
||||
if (i != 3) {
|
||||
a2 = (a2 - height) / 2.0f;
|
||||
f2 = a.top;
|
||||
} else {
|
||||
a2 -= height;
|
||||
f2 = a.top;
|
||||
}
|
||||
f3 = a2 - f2;
|
||||
} else {
|
||||
f = a.top;
|
||||
f3 = -f;
|
||||
}
|
||||
} else {
|
||||
f = a.top;
|
||||
if (f <= 0.0f) {
|
||||
f2 = a.bottom;
|
||||
if (f2 >= a2) {
|
||||
f3 = 0.0f;
|
||||
}
|
||||
f3 = a2 - f2;
|
||||
}
|
||||
f3 = -f;
|
||||
}
|
||||
float b = b(this.h);
|
||||
if (width <= b) {
|
||||
int i2 = AnonymousClass4.a[this.E.ordinal()];
|
||||
if (i2 != 2) {
|
||||
if (i2 != 3) {
|
||||
f4 = (b - width) / 2.0f;
|
||||
f5 = a.left;
|
||||
} else {
|
||||
f4 = b - width;
|
||||
f5 = a.left;
|
||||
}
|
||||
f6 = f4 - f5;
|
||||
} else {
|
||||
f6 = -a.left;
|
||||
}
|
||||
this.B = 2;
|
||||
} else {
|
||||
float f7 = a.left;
|
||||
if (f7 > 0.0f) {
|
||||
this.B = 0;
|
||||
f6 = -f7;
|
||||
} else {
|
||||
float f8 = a.right;
|
||||
if (f8 < b) {
|
||||
f6 = b - f8;
|
||||
this.B = 1;
|
||||
} else {
|
||||
this.B = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
this.m.postTranslate(f6, f3);
|
||||
return true;
|
||||
}
|
||||
|
||||
private Matrix n() {
|
||||
this.l.set(this.k);
|
||||
this.l.postConcat(this.m);
|
||||
return this.l;
|
||||
}
|
||||
|
||||
private void o() {
|
||||
this.m.reset();
|
||||
d(this.C);
|
||||
b(n());
|
||||
m();
|
||||
}
|
||||
|
||||
public float c() {
|
||||
return this.e;
|
||||
}
|
||||
|
||||
public void d(float f) {
|
||||
this.m.postRotate(f % 360.0f);
|
||||
l();
|
||||
}
|
||||
|
||||
public void e(float f) {
|
||||
this.m.setRotate(f % 360.0f);
|
||||
l();
|
||||
}
|
||||
|
||||
public float f() {
|
||||
return (float) Math.sqrt(((float) Math.pow(a(this.m, 0), 2.0d)) + ((float) Math.pow(a(this.m, 3), 2.0d)));
|
||||
}
|
||||
|
||||
public ImageView.ScaleType g() {
|
||||
return this.E;
|
||||
}
|
||||
|
||||
public void h() {
|
||||
if (this.D) {
|
||||
a(this.h.getDrawable());
|
||||
} else {
|
||||
o();
|
||||
}
|
||||
}
|
||||
|
||||
public void b(float f) {
|
||||
Util.a(this.c, f, this.e);
|
||||
this.d = f;
|
||||
}
|
||||
|
||||
public void c(float f) {
|
||||
Util.a(f, this.d, this.e);
|
||||
this.c = f;
|
||||
}
|
||||
|
||||
public void f(float f) {
|
||||
a(f, false);
|
||||
}
|
||||
|
||||
public void a(GestureDetector.OnDoubleTapListener onDoubleTapListener) {
|
||||
this.i.setOnDoubleTapListener(onDoubleTapListener);
|
||||
}
|
||||
|
||||
public float d() {
|
||||
return this.d;
|
||||
}
|
||||
|
||||
public float e() {
|
||||
return this.c;
|
||||
}
|
||||
|
||||
public void a(OnScaleChangedListener onScaleChangedListener) {
|
||||
this.v = onScaleChangedListener;
|
||||
}
|
||||
|
||||
public void b(boolean z) {
|
||||
this.D = z;
|
||||
h();
|
||||
}
|
||||
|
||||
public void a(OnSingleFlingListener onSingleFlingListener) {
|
||||
this.x = onSingleFlingListener;
|
||||
}
|
||||
|
||||
public RectF a() {
|
||||
m();
|
||||
return a(n());
|
||||
}
|
||||
|
||||
public Matrix b() {
|
||||
return this.l;
|
||||
}
|
||||
|
||||
private void b(Matrix matrix) {
|
||||
RectF a;
|
||||
this.h.setImageMatrix(matrix);
|
||||
if (this.p == null || (a = a(matrix)) == null) {
|
||||
return;
|
||||
}
|
||||
this.p.a(a);
|
||||
}
|
||||
|
||||
public void a(boolean z) {
|
||||
this.f = z;
|
||||
}
|
||||
|
||||
public void a(float f) {
|
||||
Util.a(this.c, this.d, f);
|
||||
this.e = f;
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public int b(ImageView imageView) {
|
||||
return (imageView.getWidth() - imageView.getPaddingLeft()) - imageView.getPaddingRight();
|
||||
}
|
||||
|
||||
public void a(View.OnLongClickListener onLongClickListener) {
|
||||
this.u = onLongClickListener;
|
||||
}
|
||||
|
||||
public void a(View.OnClickListener onClickListener) {
|
||||
this.t = onClickListener;
|
||||
}
|
||||
|
||||
public void a(OnMatrixChangedListener onMatrixChangedListener) {
|
||||
this.p = onMatrixChangedListener;
|
||||
}
|
||||
|
||||
public void a(OnPhotoTapListener onPhotoTapListener) {
|
||||
this.q = onPhotoTapListener;
|
||||
}
|
||||
|
||||
public void a(OnOutsidePhotoTapListener onOutsidePhotoTapListener) {
|
||||
this.r = onOutsidePhotoTapListener;
|
||||
}
|
||||
|
||||
public void a(OnViewTapListener onViewTapListener) {
|
||||
this.s = onViewTapListener;
|
||||
}
|
||||
|
||||
public void a(OnViewDragListener onViewDragListener) {
|
||||
this.y = onViewDragListener;
|
||||
}
|
||||
|
||||
public void a(OnViewTouchListener onViewTouchListener) {
|
||||
this.z = onViewTouchListener;
|
||||
}
|
||||
|
||||
public void a(float f, boolean z) {
|
||||
a(f, this.h.getRight() / 2, this.h.getBottom() / 2, z);
|
||||
}
|
||||
|
||||
public void a(float f, float f2, float f3, boolean z) {
|
||||
if (f < this.c || f > this.e) {
|
||||
throw new IllegalArgumentException("Scale must be within the range of minScale and maxScale");
|
||||
}
|
||||
if (z) {
|
||||
this.h.post(new AnimatedZoomRunnable(f(), f, f2, f3));
|
||||
} else {
|
||||
this.m.setScale(f, f, f2, f3);
|
||||
l();
|
||||
}
|
||||
}
|
||||
|
||||
public void a(ImageView.ScaleType scaleType) {
|
||||
if (!Util.a(scaleType) || scaleType == this.E) {
|
||||
return;
|
||||
}
|
||||
this.E = scaleType;
|
||||
h();
|
||||
}
|
||||
|
||||
public void a(int i) {
|
||||
this.b = i;
|
||||
}
|
||||
|
||||
private float a(Matrix matrix, int i) {
|
||||
matrix.getValues(this.o);
|
||||
return this.o[i];
|
||||
}
|
||||
|
||||
private RectF a(Matrix matrix) {
|
||||
if (this.h.getDrawable() == null) {
|
||||
return null;
|
||||
}
|
||||
this.n.set(0.0f, 0.0f, r0.getIntrinsicWidth(), r0.getIntrinsicHeight());
|
||||
matrix.mapRect(this.n);
|
||||
return this.n;
|
||||
}
|
||||
|
||||
private void a(Drawable drawable) {
|
||||
if (drawable == null) {
|
||||
return;
|
||||
}
|
||||
float b = b(this.h);
|
||||
float a = a(this.h);
|
||||
int intrinsicWidth = drawable.getIntrinsicWidth();
|
||||
int intrinsicHeight = drawable.getIntrinsicHeight();
|
||||
this.k.reset();
|
||||
float f = intrinsicWidth;
|
||||
float f2 = b / f;
|
||||
float f3 = intrinsicHeight;
|
||||
float f4 = a / f3;
|
||||
ImageView.ScaleType scaleType = this.E;
|
||||
if (scaleType == ImageView.ScaleType.CENTER) {
|
||||
this.k.postTranslate((b - f) / 2.0f, (a - f3) / 2.0f);
|
||||
} else if (scaleType == ImageView.ScaleType.CENTER_CROP) {
|
||||
float max = Math.max(f2, f4);
|
||||
this.k.postScale(max, max);
|
||||
this.k.postTranslate((b - (f * max)) / 2.0f, (a - (f3 * max)) / 2.0f);
|
||||
} else if (scaleType == ImageView.ScaleType.CENTER_INSIDE) {
|
||||
float min = Math.min(1.0f, Math.min(f2, f4));
|
||||
this.k.postScale(min, min);
|
||||
this.k.postTranslate((b - (f * min)) / 2.0f, (a - (f3 * min)) / 2.0f);
|
||||
} else {
|
||||
RectF rectF = new RectF(0.0f, 0.0f, f, f3);
|
||||
RectF rectF2 = new RectF(0.0f, 0.0f, b, a);
|
||||
if (((int) this.C) % 180 != 0) {
|
||||
rectF = new RectF(0.0f, 0.0f, f3, f);
|
||||
}
|
||||
int i = AnonymousClass4.a[this.E.ordinal()];
|
||||
if (i == 1) {
|
||||
this.k.setRectToRect(rectF, rectF2, Matrix.ScaleToFit.CENTER);
|
||||
} else if (i == 2) {
|
||||
this.k.setRectToRect(rectF, rectF2, Matrix.ScaleToFit.START);
|
||||
} else if (i == 3) {
|
||||
this.k.setRectToRect(rectF, rectF2, Matrix.ScaleToFit.END);
|
||||
} else if (i == 4) {
|
||||
this.k.setRectToRect(rectF, rectF2, Matrix.ScaleToFit.FILL);
|
||||
}
|
||||
}
|
||||
o();
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public int a(ImageView imageView) {
|
||||
return (imageView.getHeight() - imageView.getPaddingTop()) - imageView.getPaddingBottom();
|
||||
}
|
||||
}
|
46
sources/com/github/chrisbanes/photoview/Util.java
Normal file
46
sources/com/github/chrisbanes/photoview/Util.java
Normal file
@@ -0,0 +1,46 @@
|
||||
package com.github.chrisbanes.photoview;
|
||||
|
||||
import android.widget.ImageView;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class Util {
|
||||
|
||||
/* renamed from: com.github.chrisbanes.photoview.Util$1, reason: invalid class name */
|
||||
static /* synthetic */ class AnonymousClass1 {
|
||||
static final /* synthetic */ int[] a = new int[ImageView.ScaleType.values().length];
|
||||
|
||||
static {
|
||||
try {
|
||||
a[ImageView.ScaleType.MATRIX.ordinal()] = 1;
|
||||
} catch (NoSuchFieldError unused) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int a(int i) {
|
||||
return (i & 65280) >> 8;
|
||||
}
|
||||
|
||||
static void a(float f, float f2, float f3) {
|
||||
if (f >= f2) {
|
||||
throw new IllegalArgumentException("Minimum zoom has to be less than Medium zoom. Call setMinimumZoom() with a more appropriate value");
|
||||
}
|
||||
if (f2 >= f3) {
|
||||
throw new IllegalArgumentException("Medium zoom has to be less than Maximum zoom. Call setMaximumZoom() with a more appropriate value");
|
||||
}
|
||||
}
|
||||
|
||||
static boolean a(ImageView imageView) {
|
||||
return imageView.getDrawable() != null;
|
||||
}
|
||||
|
||||
static boolean a(ImageView.ScaleType scaleType) {
|
||||
if (scaleType == null) {
|
||||
return false;
|
||||
}
|
||||
if (AnonymousClass1.a[scaleType.ordinal()] != 1) {
|
||||
return true;
|
||||
}
|
||||
throw new IllegalStateException("Matrix scale type is not supported");
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user