CrackMe.apk
Download file
package androidx.core.widget;
import android.content.res.Resources;
import android.os.SystemClock;
import android.util.DisplayMetrics;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.AnimationUtils;
import android.view.animation.Interpolator;
import androidx.core.view.ViewCompat;
public abstract class AutoScrollHelper implements View.OnTouchListener {
private static final int DEFAULT_ACTIVATION_DELAY = ViewConfiguration.getTapTimeout();
private static final int DEFAULT_EDGE_TYPE = 1;
private static final float DEFAULT_MAXIMUM_EDGE = Float.MAX_VALUE;
private static final int DEFAULT_MAXIMUM_VELOCITY_DIPS = 1575;
private static final int DEFAULT_MINIMUM_VELOCITY_DIPS = 315;
private static final int DEFAULT_RAMP_DOWN_DURATION = 500;
private static final int DEFAULT_RAMP_UP_DURATION = 500;
private static final float DEFAULT_RELATIVE_EDGE = 0.2f;
private static final float DEFAULT_RELATIVE_VELOCITY = 1.0f;
public static final int EDGE_TYPE_INSIDE = 0;
public static final int EDGE_TYPE_INSIDE_EXTEND = 1;
public static final int EDGE_TYPE_OUTSIDE = 2;
private static final int HORIZONTAL = 0;
public static final float NO_MAX = Float.MAX_VALUE;
public static final float NO_MIN = 0.0f;
public static final float RELATIVE_UNSPECIFIED = 0.0f;
private static final int VERTICAL = 1;
private int mActivationDelay;
private boolean mAlreadyDelayed;
boolean mAnimating;
private final Interpolator mEdgeInterpolator = new AccelerateInterpolator();
private int mEdgeType;
private boolean mEnabled;
private boolean mExclusive;
private float[] mMaximumEdges = {Float.MAX_VALUE, Float.MAX_VALUE};
private float[] mMaximumVelocity = {Float.MAX_VALUE, Float.MAX_VALUE};
private float[] mMinimumVelocity = {0.0f, 0.0f};
boolean mNeedsCancel;
boolean mNeedsReset;
private float[] mRelativeEdges = {0.0f, 0.0f};
private float[] mRelativeVelocity = {0.0f, 0.0f};
private Runnable mRunnable;
final ClampedScroller mScroller = new ClampedScroller();
final View mTarget;
static float constrain(float f, float f2, float f3) {
return f > f3 ? f3 : f < f2 ? f2 : f;
}
static int constrain(int i, int i2, int i3) {
return i > i3 ? i3 : i < i2 ? i2 : i;
}
public abstract boolean canTargetScrollHorizontally(int i);
public abstract boolean canTargetScrollVertically(int i);
public abstract void scrollTargetBy(int i, int i2);
public AutoScrollHelper(View view) {
this.mTarget = view;
DisplayMetrics displayMetrics = Resources.getSystem().getDisplayMetrics();
float f = (float) ((int) ((displayMetrics.density * 1575.0f) + 0.5f));
setMaximumVelocity(f, f);
float f2 = (float) ((int) ((displayMetrics.density * 315.0f) + 0.5f));
setMinimumVelocity(f2, f2);
setEdgeType(1);
setMaximumEdges(Float.MAX_VALUE, Float.MAX_VALUE);
setRelativeEdges(DEFAULT_RELATIVE_EDGE, DEFAULT_RELATIVE_EDGE);
setRelativeVelocity(1.0f, 1.0f);
setActivationDelay(DEFAULT_ACTIVATION_DELAY);
setRampUpDuration(500);
setRampDownDuration(500);
}
public AutoScrollHelper setEnabled(boolean z) {
if (this.mEnabled && !z) {
requestStop();
}
this.mEnabled = z;
return this;
}
public boolean isEnabled() {
return this.mEnabled;
}
public AutoScrollHelper setExclusive(boolean z) {
this.mExclusive = z;
return this;
}
public boolean isExclusive() {
return this.mExclusive;
}
public AutoScrollHelper setMaximumVelocity(float f, float f2) {
float[] fArr = this.mMaximumVelocity;
fArr[0] = f / 1000.0f;
fArr[1] = f2 / 1000.0f;
return this;
}
public AutoScrollHelper setMinimumVelocity(float f, float f2) {
float[] fArr = this.mMinimumVelocity;
fArr[0] = f / 1000.0f;
fArr[1] = f2 / 1000.0f;
return this;
}
public AutoScrollHelper setRelativeVelocity(float f, float f2) {
float[] fArr = this.mRelativeVelocity;
fArr[0] = f / 1000.0f;
fArr[1] = f2 / 1000.0f;
return this;
}
public AutoScrollHelper setEdgeType(int i) {
this.mEdgeType = i;
return this;
}
public AutoScrollHelper setRelativeEdges(float f, float f2) {
float[] fArr = this.mRelativeEdges;
fArr[0] = f;
fArr[1] = f2;
return this;
}
public AutoScrollHelper setMaximumEdges(float f, float f2) {
float[] fArr = this.mMaximumEdges;
fArr[0] = f;
fArr[1] = f2;
return this;
}
public AutoScrollHelper setActivationDelay(int i) {
this.mActivationDelay = i;
return this;
}
public AutoScrollHelper setRampUpDuration(int i) {
this.mScroller.setRampUpDuration(i);
return this;
}
public AutoScrollHelper setRampDownDuration(int i) {
this.mScroller.setRampDownDuration(i);
return this;
}
/* JADX WARNING: Code restructure failed: missing block: B:9:0x0013, code lost:
if (r0 != 3) goto L_0x0058;
*/
/* JADX WARNING: Removed duplicated region for block: B:21:0x0060 A[ORIG_RETURN, RETURN, SYNTHETIC] */
/* JADX WARNING: Removed duplicated region for block: B:23:? A[RETURN, SYNTHETIC] */
/* Code decompiled incorrectly, please refer to instructions dump. */
public boolean onTouch(android.view.View r6, android.view.MotionEvent r7) {
/*
r5 = this;
boolean r0 = r5.mEnabled
r1 = 0
if (r0 != 0) goto L_0x0006
return r1
L_0x0006:
int r0 = r7.getActionMasked()
r2 = 1
if (r0 == 0) goto L_0x001a
if (r0 == r2) goto L_0x0016
r3 = 2
if (r0 == r3) goto L_0x001e
r6 = 3
if (r0 == r6) goto L_0x0016
goto L_0x0058
L_0x0016:
r5.requestStop()
goto L_0x0058
L_0x001a:
r5.mNeedsCancel = r2
r5.mAlreadyDelayed = r1
L_0x001e:
float r0 = r7.getX()
int r3 = r6.getWidth()
float r3 = (float) r3
android.view.View r4 = r5.mTarget
int r4 = r4.getWidth()
float r4 = (float) r4
float r0 = r5.computeTargetVelocity(r1, r0, r3, r4)
float r7 = r7.getY()
int r6 = r6.getHeight()
float r6 = (float) r6
android.view.View r3 = r5.mTarget
int r3 = r3.getHeight()
float r3 = (float) r3
float r6 = r5.computeTargetVelocity(r2, r7, r6, r3)
androidx.core.widget.AutoScrollHelper$ClampedScroller r7 = r5.mScroller
r7.setTargetVelocity(r0, r6)
boolean r6 = r5.mAnimating
if (r6 != 0) goto L_0x0058
boolean r6 = r5.shouldAnimate()
if (r6 == 0) goto L_0x0058
r5.startAnimating()
L_0x0058:
boolean r6 = r5.mExclusive
if (r6 == 0) goto L_0x0061
boolean r6 = r5.mAnimating
if (r6 == 0) goto L_0x0061
r1 = 1
L_0x0061:
return r1
*/
throw new UnsupportedOperationException("Method not decompiled: androidx.core.widget.AutoScrollHelper.onTouch(android.view.View, android.view.MotionEvent):boolean");
}
/* access modifiers changed from: package-private */
public boolean shouldAnimate() {
ClampedScroller clampedScroller = this.mScroller;
int verticalDirection = clampedScroller.getVerticalDirection();
int horizontalDirection = clampedScroller.getHorizontalDirection();
return (verticalDirection != 0 && canTargetScrollVertically(verticalDirection)) || (horizontalDirection != 0 && canTargetScrollHorizontally(horizontalDirection));
}
private void startAnimating() {
int i;
if (this.mRunnable == null) {
this.mRunnable = new ScrollAnimationRunnable();
}
this.mAnimating = true;
this.mNeedsReset = true;
if (this.mAlreadyDelayed || (i = this.mActivationDelay) <= 0) {
this.mRunnable.run();
} else {
ViewCompat.postOnAnimationDelayed(this.mTarget, this.mRunnable, (long) i);
}
this.mAlreadyDelayed = true;
}
private void requestStop() {
if (this.mNeedsReset) {
this.mAnimating = false;
} else {
this.mScroller.requestStop();
}
}
private float computeTargetVelocity(int i, float f, float f2, float f3) {
float edgeValue = getEdgeValue(this.mRelativeEdges[i], f2, this.mMaximumEdges[i], f);
int i2 = (edgeValue > 0.0f ? 1 : (edgeValue == 0.0f ? 0 : -1));
if (i2 == 0) {
return 0.0f;
}
float f4 = this.mRelativeVelocity[i];
float f5 = this.mMinimumVelocity[i];
float f6 = this.mMaximumVelocity[i];
float f7 = f4 * f3;
if (i2 > 0) {
return constrain(edgeValue * f7, f5, f6);
}
return -constrain((-edgeValue) * f7, f5, f6);
}
private float getEdgeValue(float f, float f2, float f3, float f4) {
float f5;
float constrain = constrain(f * f2, 0.0f, f3);
float constrainEdgeValue = constrainEdgeValue(f2 - f4, constrain) - constrainEdgeValue(f4, constrain);
if (constrainEdgeValue < 0.0f) {
f5 = -this.mEdgeInterpolator.getInterpolation(-constrainEdgeValue);
} else if (constrainEdgeValue <= 0.0f) {
return 0.0f;
} else {
f5 = this.mEdgeInterpolator.getInterpolation(constrainEdgeValue);
}
return constrain(f5, -1.0f, 1.0f);
}
private float constrainEdgeValue(float f, float f2) {
if (f2 == 0.0f) {
return 0.0f;
}
int i = this.mEdgeType;
if (i == 0 || i == 1) {
if (f < f2) {
if (f >= 0.0f) {
return 1.0f - (f / f2);
}
return (!this.mAnimating || i != 1) ? 0.0f : 1.0f;
}
} else if (i == 2 && f < 0.0f) {
return f / (-f2);
}
}
/* access modifiers changed from: package-private */
public void cancelTargetTouch() {
long uptimeMillis = SystemClock.uptimeMillis();
MotionEvent obtain = MotionEvent.obtain(uptimeMillis, uptimeMillis, 3, 0.0f, 0.0f, 0);
this.mTarget.onTouchEvent(obtain);
obtain.recycle();
}
private class ScrollAnimationRunnable implements Runnable {
ScrollAnimationRunnable() {
}
public void run() {
if (AutoScrollHelper.this.mAnimating) {
if (AutoScrollHelper.this.mNeedsReset) {
AutoScrollHelper.this.mNeedsReset = false;
AutoScrollHelper.this.mScroller.start();
}
ClampedScroller clampedScroller = AutoScrollHelper.this.mScroller;
if (clampedScroller.isFinished() || !AutoScrollHelper.this.shouldAnimate()) {
AutoScrollHelper.this.mAnimating = false;
return;
}
if (AutoScrollHelper.this.mNeedsCancel) {
AutoScrollHelper.this.mNeedsCancel = false;
AutoScrollHelper.this.cancelTargetTouch();
}
clampedScroller.computeScrollDelta();
AutoScrollHelper.this.scrollTargetBy(clampedScroller.getDeltaX(), clampedScroller.getDeltaY());
ViewCompat.postOnAnimation(AutoScrollHelper.this.mTarget, this);
}
}
}
private static class ClampedScroller {
private long mDeltaTime = 0;
private int mDeltaX = 0;
private int mDeltaY = 0;
private int mEffectiveRampDown;
private int mRampDownDuration;
private int mRampUpDuration;
private long mStartTime = Long.MIN_VALUE;
private long mStopTime = -1;
private float mStopValue;
private float mTargetVelocityX;
private float mTargetVelocityY;
private float interpolateValue(float f) {
return (-4.0f * f * f) + (f * 4.0f);
}
ClampedScroller() {
}
public void setRampUpDuration(int i) {
this.mRampUpDuration = i;
}
public void setRampDownDuration(int i) {
this.mRampDownDuration = i;
}
public void start() {
long currentAnimationTimeMillis = AnimationUtils.currentAnimationTimeMillis();
this.mStartTime = currentAnimationTimeMillis;
this.mStopTime = -1;
this.mDeltaTime = currentAnimationTimeMillis;
this.mStopValue = 0.5f;
this.mDeltaX = 0;
this.mDeltaY = 0;
}
public void requestStop() {
long currentAnimationTimeMillis = AnimationUtils.currentAnimationTimeMillis();
this.mEffectiveRampDown = AutoScrollHelper.constrain((int) (currentAnimationTimeMillis - this.mStartTime), 0, this.mRampDownDuration);
this.mStopValue = getValueAt(currentAnimationTimeMillis);
this.mStopTime = currentAnimationTimeMillis;
}
public boolean isFinished() {
return this.mStopTime > 0 && AnimationUtils.currentAnimationTimeMillis() > this.mStopTime + ((long) this.mEffectiveRampDown);
}
private float getValueAt(long j) {
long j2 = this.mStartTime;
if (j < j2) {
return 0.0f;
}
long j3 = this.mStopTime;
if (j3 < 0 || j < j3) {
return AutoScrollHelper.constrain(((float) (j - j2)) / ((float) this.mRampUpDuration), 0.0f, 1.0f) * 0.5f;
}
float f = this.mStopValue;
return (1.0f - f) + (f * AutoScrollHelper.constrain(((float) (j - j3)) / ((float) this.mEffectiveRampDown), 0.0f, 1.0f));
}
public void computeScrollDelta() {
if (this.mDeltaTime != 0) {
long currentAnimationTimeMillis = AnimationUtils.currentAnimationTimeMillis();
float interpolateValue = interpolateValue(getValueAt(currentAnimationTimeMillis));
this.mDeltaTime = currentAnimationTimeMillis;
float f = ((float) (currentAnimationTimeMillis - this.mDeltaTime)) * interpolateValue;
this.mDeltaX = (int) (this.mTargetVelocityX * f);
this.mDeltaY = (int) (f * this.mTargetVelocityY);
return;
}
throw new RuntimeException("Cannot compute scroll delta before calling start()");
}
public void setTargetVelocity(float f, float f2) {
this.mTargetVelocityX = f;
this.mTargetVelocityY = f2;
}
public int getHorizontalDirection() {
float f = this.mTargetVelocityX;
return (int) (f / Math.abs(f));
}
public int getVerticalDirection() {
float f = this.mTargetVelocityY;
return (int) (f / Math.abs(f));
}
public int getDeltaX() {
return this.mDeltaX;
}
public int getDeltaY() {
return this.mDeltaY;
}
}
}
Download file