Code with Finding: |
/*
* Decompiled with CFR 0_128.
*
* Could not load the following classes:
* android.content.Context
* android.graphics.Bitmap
* android.graphics.Matrix
* android.graphics.RectF
* android.graphics.drawable.Drawable
* android.os.SystemClock
* android.util.AttributeSet
* android.util.Log
* android.view.MotionEvent
* android.view.View
* android.view.View$OnTouchListener
* android.view.ViewConfiguration
* android.widget.ImageView
* android.widget.ImageView$ScaleType
* com.wallpaper.virgo.GalleryActivity
*/
package com.wallpaper.virgo;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Matrix;
import android.graphics.RectF;
import android.graphics.drawable.Drawable;
import android.os.SystemClock;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewConfiguration;
import android.widget.ImageView;
import com.wallpaper.virgo.GalleryActivity;
public class GalleryActivity$PinchImageView
extends ImageView
implements View.OnTouchListener {
public static final int GROW = 0;
public static final float MAX_SCALE = 4.0f;
public static final float MIN_SCALE = 1.0f;
public static final int SHRINK = 1;
public static final int TOUCH_INTERVAL = 0;
public static final float ZOOM = 1.5f;
float distCur;
float distDelta;
float distPre;
ImageView im;
Matrix mBaseMatrix;
Bitmap mBitmap;
int mHeight;
long mLastGestureTime;
Matrix mResultMatrix;
Matrix mSuppMatrix;
int mTouchSlop;
int mWidth;
float xCur;
float xPre;
float xSec;
float yCur;
float yPre;
float ySec;
public GalleryActivity$PinchImageView(Context context) {
Matrix matrix;
super(context);
this.im = null;
this.mBaseMatrix = matrix = new Matrix();
this.mSuppMatrix = matrix = new Matrix();
this.mResultMatrix = matrix = new Matrix();
this.mBitmap = null;
this.distPre = -1.0f;
this._init();
}
public GalleryActivity$PinchImageView(Context context, AttributeSet attributeSet) {
Matrix matrix;
super(context, attributeSet);
this.im = null;
this.mBaseMatrix = matrix = new Matrix();
this.mSuppMatrix = matrix = new Matrix();
this.mResultMatrix = matrix = new Matrix();
this.mBitmap = null;
this.distPre = -1.0f;
this._init();
}
public GalleryActivity$PinchImageView(ImageView imageView) {
Context context = imageView.getContext();
super(context);
this.im = null;
super();
this.mBaseMatrix = context;
super();
this.mSuppMatrix = context;
super();
this.mResultMatrix = context;
this.mBitmap = null;
this.distPre = -1.0f;
this._init();
this.im = imageView;
context = this.im;
ImageView.ScaleType scaleType = ImageView.ScaleType.MATRIX;
context.setScaleType(scaleType);
this.im.setOnTouchListener((View.OnTouchListener)this);
}
private void _init() {
int n;
boolean bl = true;
this.im = this;
this.mTouchSlop = n = ViewConfiguration.getTouchSlop();
ImageView imageView = this.im;
ImageView.ScaleType scaleType = ImageView.ScaleType.MATRIX;
imageView.setScaleType(scaleType);
this.center(bl, bl);
}
private void getProperBaseMatrix(Matrix matrix) {
float f = 4.0f;
float f2 = 2.0f;
float f3 = this.getWidth();
float f4 = this.getHeight();
float f5 = this.mBitmap.getWidth();
float f6 = this.mBitmap.getHeight();
matrix.reset();
float f7 = Math.min(f3 / f5, f);
float f8 = Math.min(f4 / f6, f);
float f9 = Math.min(f7, f8);
Matrix matrix2 = new Matrix();
float f10 = - (this.mBitmap.getWidth() >> 1);
f = - (this.mBitmap.getHeight() >> 1);
matrix2.preTranslate(f10, f);
f10 = this.getWidth() / 2;
f = this.getHeight() / 2;
matrix2.postTranslate(f10, f);
matrix.postConcat(matrix2);
matrix.postScale(f9, f9);
f10 = f5 * f9;
f10 = (f3 - f10) / f2;
f = f6 * f9;
f = (f4 - f) / f2;
matrix.postTranslate(f10, f);
}
/*
* Enabled aggressive block sorting
*/
public void center(boolean bl, boolean bl2) {
float f = 2.0f;
Bitmap bitmap = this.mBitmap;
if (bitmap == null) {
return;
}
Matrix matrix = this.getImageViewMatrix();
bitmap = this.mBitmap;
int n = bitmap.getWidth();
float f2 = n;
Bitmap bitmap2 = this.mBitmap;
int n2 = bitmap2.getHeight();
float f3 = n2;
RectF rectF = new RectF(0.0f, 0.0f, f2, f3);
matrix.mapRect(rectF);
float f4 = rectF.height();
float f5 = rectF.width();
float f6 = 0.0f;
float f7 = 0.0f;
if (bl2) {
int n3 = this.getHeight();
f2 = n3;
n = (int)(f4 FCMPG f2);
if (n < 0) {
f2 = ((float)n3 - f4) / f;
f3 = rectF.top;
f7 = f2 - f3;
} else {
f2 = rectF.top;
n = (int)(f2 FCMPL 0.0f);
if (n > 0) {
f2 = rectF.top;
f7 = - f2;
} else {
f2 = rectF.bottom;
f3 = n3;
n = (int)(f2 FCMPG f3);
if (n < 0) {
n = this.getHeight();
f2 = n;
f3 = rectF.bottom;
f7 = f2 - f3;
}
}
}
}
if (bl) {
int n4 = this.getWidth();
f2 = n4;
n = (int)(f5 FCMPG f2);
if (n < 0) {
f2 = ((float)n4 - f5) / f;
f3 = rectF.left;
f6 = f2 - f3;
} else {
f2 = rectF.left;
n = (int)(f2 FCMPL 0.0f);
if (n > 0) {
f2 = rectF.left;
f6 = - f2;
} else {
f2 = rectF.right;
f3 = n4;
n = (int)(f2 FCMPG f3);
if (n < 0) {
f2 = n4;
f3 = rectF.right;
f6 = f2 - f3;
}
}
}
}
this.postTranslate(f6, f7);
bitmap = this.getImageViewMatrix();
this.setImageMatrix((Matrix)bitmap);
}
protected Matrix getImageViewMatrix() {
Matrix matrix = this.mResultMatrix;
Matrix matrix2 = this.mBaseMatrix;
matrix.set(matrix2);
matrix = this.mResultMatrix;
matrix2 = this.mSuppMatrix;
matrix.postConcat(matrix2);
return this.mResultMatrix;
}
public float getScale() {
Matrix matrix = this.mSuppMatrix;
return this.getScale(matrix);
}
public float getScale(Matrix matrix) {
float[] arrf = new float[9];
matrix.getValues(arrf);
return arrf[0];
}
protected void onLayout(boolean bl, int n, int n2, int n3, int n4) {
int n5;
super.onLayout(bl, n, n2, n3, n4);
this.mWidth = n5 = n3 - n;
this.mHeight = n5 = n4 - n2;
Bitmap bitmap = this.mBitmap;
if (bitmap != null) {
bitmap = this.mBaseMatrix;
this.getProperBaseMatrix((Matrix)bitmap);
bitmap = this.getImageViewMatrix();
this.setImageMatrix((Matrix)bitmap);
}
}
public boolean onTouch(View view, MotionEvent motionEvent) {
return this.onTouchEvent(motionEvent);
}
/*
* Enabled aggressive block sorting
*/
public boolean onTouchEvent(MotionEvent motionEvent) {
int n = motionEvent.getAction();
int n2 = n & 255;
int n3 = motionEvent.getPointerCount();
String string = GalleryActivity.access$0();
CharSequence charSequence = new CharSequence("PinchImageView onTouchEvent action[");
int n4 = motionEvent.getAction();
charSequence = charSequence.append(n4).append("]").toString();
Log.d((String)string, (String)charSequence);
string = GalleryActivity.access$0();
charSequence = new CharSequence("PinchImageView onTouchEvent pointer count[");
n4 = motionEvent.getPointerCount();
charSequence = charSequence.append(n4);
String string2 = "]";
charSequence = charSequence.append(string2).toString();
Log.d((String)string, (String)charSequence);
switch (n2) {
float f;
case 2: {
this.xCur = f = motionEvent.getX(0);
string = null;
this.yCur = f = motionEvent.getY(0);
n = 1;
f = Float.MIN_VALUE;
if (n3 > n) {
this.xSec = f = motionEvent.getX(1);
this.ySec = f = motionEvent.getY(1);
f = this.xSec;
float f2 = this.xCur;
double d = Math.pow(f - f2, 2.0);
float f3 = this.ySec;
float f4 = this.yCur;
double d2 = f3 -= f4;
double d3 = 2.0;
d2 = Math.pow(d2, d3);
d = Math.sqrt(d + d2);
this.distCur = f = (float)d;
f = this.distPre;
int n5 = -1082130432;
f2 = -1.0f;
n = (int)(f FCMPL f2);
if (n > 0) {
f = this.distCur;
f2 = this.distPre;
f -= f2;
} else {
n = 0;
f = 0.0f;
string = null;
}
this.distDelta = f;
float f5 = this.getScale();
long l = SystemClock.uptimeMillis();
f = Math.abs(this.distDelta);
n = (int)(f FCMPL f2 = (float)(n5 = this.mTouchSlop));
if (n > 0) {
long l2 = 0L;
d = 0.0;
this.mLastGestureTime = l2;
f = this.distDelta;
n5 = 0;
f2 = 0.0f;
charSequence = null;
n = (int)(f FCMPL 0.0f);
int n6 = n > 0 ? 0 : ((n = (int)(f = this.distCur FCMPL f2 = this.distPre)) == 0 ? 2 : 1);
switch (n6) {
case 0: {
this.zoomIn(f5);
}
default: {
break;
}
case 1: {
this.zoomOut(f5);
}
}
this.mLastGestureTime = l;
this.xPre = f = this.xCur;
this.yPre = f = this.yCur;
this.distPre = f = this.distCur;
return (boolean)1;
}
}
this.xPre = f = this.xCur;
this.yPre = f = this.yCur;
this.distPre = f = this.distCur;
}
default: {
return (boolean)0;
}
case 0:
case 1: {
long l;
n = -1082130432;
this.distPre = f = -1.0f;
this.mLastGestureTime = l = SystemClock.uptimeMillis();
}
}
return (boolean)0;
}
public void postTranslate(float f, float f2) {
synchronized (this) {
Matrix matrix = this.mSuppMatrix;
matrix.postTranslate(f, f2);
return;
}
}
public void setImageBitmap(Bitmap bitmap) {
boolean bl = true;
super.setImageBitmap(bitmap);
Drawable drawable = this.getDrawable();
if (drawable != null) {
drawable.setDither(bl);
}
this.mBitmap = bitmap;
this.center(bl, bl);
}
/*
* Enabled force condition propagation
* Lifted jumps to return sites
*/
protected void zoomIn(float f) {
float f2 = 2.0f;
float f3 = 1.5f;
float f4 = 4.0f;
float f5 = f FCMPL f4;
if (f5 > 0) {
do {
return;
break;
} while (true);
}
String string = GalleryActivity.access$0();
StringBuilder stringBuilder = new StringBuilder("zoomIn scale[");
StringBuilder stringBuilder2 = stringBuilder.append(f);
String string2 = "]";
String string3 = stringBuilder2.append(string2).toString();
Log.d((String)string, (String)string3);
string = this.mSuppMatrix;
int n = this.getWidth();
float f6 = (float)n / f2;
int n2 = this.getHeight();
float f7 = (float)n2 / f2;
string.postScale(f3, f3, f6, f7);
string = this.getImageViewMatrix();
this.setImageMatrix((Matrix)string);
}
public void zoomMax() {
this.zoomTo(4.0f);
}
public void zoomMin() {
this.zoomTo(1.0f);
}
/*
* Enabled aggressive block sorting
*/
protected void zoomOut(float f) {
boolean bl = true;
float f2 = 2.0f;
float f3 = 1.0f;
float f4 = f FCMPG f3;
if (f4 < 0) {
return;
}
String string = GalleryActivity.access$0();
StringBuilder stringBuilder = new StringBuilder("zoomOut scale[");
StringBuilder stringBuilder2 = stringBuilder.append(f);
String string2 = "]";
String string3 = stringBuilder2.append(string2).toString();
Log.d((String)string, (String)string3);
float f5 = (float)this.getWidth() / f2;
float f6 = (float)this.getHeight() / f2;
float f7 = 0.6666667f;
string = this.mSuppMatrix;
Matrix matrix = new Matrix((Matrix)string);
matrix.postScale(f7, f7, f5, f6);
float f8 = this.getScale(matrix);
f4 = f8 FCMPG f3;
if (f4 < 0) {
string = this.mSuppMatrix;
string.setScale(f3, f3, f5, f6);
} else {
string = this.mSuppMatrix;
string.postScale(f7, f7, f5, f6);
}
string = this.getImageViewMatrix();
this.setImageMatrix((Matrix)string);
this.center(bl, bl);
}
protected void zoomTo(float f) {
boolean bl = true;
float f2 = 2.0f;
Matrix matrix = this.mSuppMatrix;
float f3 = (float)this.getWidth() / f2;
float f4 = (float)this.getHeight() / f2;
matrix.setScale(f, f, f3, f4);
matrix = this.getImageViewMatrix();
this.setImageMatrix(matrix);
this.center(bl, bl);
}
}
|