206 lines
5.2 KiB
Java
206 lines
5.2 KiB
Java
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();
|
|
}
|
|
}
|