CropGestureDetector.smali
.class public Lim/tpelyyftgw/ui/components/crop/CropGestureDetector;
.super Ljava/lang/Object;
.source "CropGestureDetector.java"
# annotations
.annotation system Ldalvik/annotation/MemberClasses;
value = {
Lim/tpelyyftgw/ui/components/crop/CropGestureDetector$CropGestureListener;
}
.end annotation
# static fields
.field private static final INVALID_POINTER_ID:I
# instance fields
.field private mActivePointerId:I
.field private mActivePointerIndex:I
.field private mDetector:Landroid/view/ScaleGestureDetector;
.field private mIsDragging:Z
.field mLastTouchX:F
.field mLastTouchY:F
.field private mListener:Lim/tpelyyftgw/ui/components/crop/CropGestureDetector$CropGestureListener;
.field final mMinimumVelocity:F
.field final mTouchSlop:F
.field private mVelocityTracker:Landroid/view/VelocityTracker;
.field private started:Z
# direct methods
.method static constructor <clinit>()V
.registers 1
const v0, -0x1570
invoke-static {v0}, Lnp/NPFog;->d(I)I
move-result v0
sput v0, Lim/tpelyyftgw/ui/components/crop/CropGestureDetector;->INVALID_POINTER_ID:I
return-void
.end method
.method public constructor <init>(Landroid/content/Context;)V
.registers 5
.param p1, "context" # Landroid/content/Context;
.line 34
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
.line 35
nop
.line 36
invoke-static {p1}, Landroid/view/ViewConfiguration;->get(Landroid/content/Context;)Landroid/view/ViewConfiguration;
move-result-object v0
.line 37
.local v0, "configuration":Landroid/view/ViewConfiguration;
invoke-virtual {v0}, Landroid/view/ViewConfiguration;->getScaledMinimumFlingVelocity()I
move-result v1
int-to-float v1, v1
iput v1, p0, Lim/tpelyyftgw/ui/components/crop/CropGestureDetector;->mMinimumVelocity:F
.line 38
const/high16 v1, 0x3f800000 # 1.0f
invoke-static {v1}, Lim/tpelyyftgw/messenger/AndroidUtilities;->dp(F)I
move-result v1
int-to-float v1, v1
iput v1, p0, Lim/tpelyyftgw/ui/components/crop/CropGestureDetector;->mTouchSlop:F
.line 40
const/4 v1, -0x1
iput v1, p0, Lim/tpelyyftgw/ui/components/crop/CropGestureDetector;->mActivePointerId:I
.line 41
const/4 v1, 0x0
iput v1, p0, Lim/tpelyyftgw/ui/components/crop/CropGestureDetector;->mActivePointerIndex:I
.line 43
new-instance v1, Lim/tpelyyftgw/ui/components/crop/CropGestureDetector$1;
invoke-direct {v1, p0}, Lim/tpelyyftgw/ui/components/crop/CropGestureDetector$1;-><init>(Lim/tpelyyftgw/ui/components/crop/CropGestureDetector;)V
.line 67
.local v1, "mScaleListener":Landroid/view/ScaleGestureDetector$OnScaleGestureListener;
new-instance v2, Landroid/view/ScaleGestureDetector;
invoke-direct {v2, p1, v1}, Landroid/view/ScaleGestureDetector;-><init>(Landroid/content/Context;Landroid/view/ScaleGestureDetector$OnScaleGestureListener;)V
iput-object v2, p0, Lim/tpelyyftgw/ui/components/crop/CropGestureDetector;->mDetector:Landroid/view/ScaleGestureDetector;
.line 68
return-void
.end method
.method static synthetic access$000(Lim/tpelyyftgw/ui/components/crop/CropGestureDetector;)Lim/tpelyyftgw/ui/components/crop/CropGestureDetector$CropGestureListener;
.registers 2
.param p0, "x0" # Lim/tpelyyftgw/ui/components/crop/CropGestureDetector;
.line 12
iget-object v0, p0, Lim/tpelyyftgw/ui/components/crop/CropGestureDetector;->mListener:Lim/tpelyyftgw/ui/components/crop/CropGestureDetector$CropGestureListener;
return-object v0
.end method
# virtual methods
.method getActiveX(Landroid/view/MotionEvent;)F
.registers 4
.param p1, "ev" # Landroid/view/MotionEvent;
.line 72
:try_start_0
iget v0, p0, Lim/tpelyyftgw/ui/components/crop/CropGestureDetector;->mActivePointerIndex:I
invoke-virtual {p1, v0}, Landroid/view/MotionEvent;->getX(I)F
move-result v0
:try_end_6
.catch Ljava/lang/Exception; {:try_start_0 .. :try_end_6} :catch_7
return v0
.line 73
:catch_7
move-exception v0
.line 74
.local v0, "e":Ljava/lang/Exception;
invoke-virtual {p1}, Landroid/view/MotionEvent;->getX()F
move-result v1
return v1
.end method
.method getActiveY(Landroid/view/MotionEvent;)F
.registers 4
.param p1, "ev" # Landroid/view/MotionEvent;
.line 80
:try_start_0
iget v0, p0, Lim/tpelyyftgw/ui/components/crop/CropGestureDetector;->mActivePointerIndex:I
invoke-virtual {p1, v0}, Landroid/view/MotionEvent;->getY(I)F
move-result v0
:try_end_6
.catch Ljava/lang/Exception; {:try_start_0 .. :try_end_6} :catch_7
return v0
.line 81
:catch_7
move-exception v0
.line 82
.local v0, "e":Ljava/lang/Exception;
invoke-virtual {p1}, Landroid/view/MotionEvent;->getY()F
move-result v1
return v1
.end method
.method public isDragging()Z
.registers 2
.line 95
iget-boolean v0, p0, Lim/tpelyyftgw/ui/components/crop/CropGestureDetector;->mIsDragging:Z
return v0
.end method
.method public isScaling()Z
.registers 2
.line 91
iget-object v0, p0, Lim/tpelyyftgw/ui/components/crop/CropGestureDetector;->mDetector:Landroid/view/ScaleGestureDetector;
invoke-virtual {v0}, Landroid/view/ScaleGestureDetector;->isInProgress()Z
move-result v0
return v0
.end method
.method public onTouchEvent(Landroid/view/MotionEvent;)Z
.registers 13
.param p1, "ev" # Landroid/view/MotionEvent;
.line 100
iget-object v0, p0, Lim/tpelyyftgw/ui/components/crop/CropGestureDetector;->mDetector:Landroid/view/ScaleGestureDetector;
invoke-virtual {v0, p1}, Landroid/view/ScaleGestureDetector;->onTouchEvent(Landroid/view/MotionEvent;)Z
.line 102
const/4 v0, 0x0
.line 103
.local v0, "i":I
invoke-virtual {p1}, Landroid/view/MotionEvent;->getAction()I
move-result v1
and-int/lit16 v1, v1, 0xff
const/4 v2, -0x1
const/4 v3, 0x3
const/4 v4, 0x1
const/4 v5, 0x0
if-eqz v1, :cond_47
if-eq v1, v4, :cond_44
if-eq v1, v3, :cond_44
const/4 v6, 0x6
if-eq v1, v6, :cond_1a
goto :goto_4e
.line 112
:cond_1a
const v1, 0xff00
invoke-virtual {p1}, Landroid/view/MotionEvent;->getAction()I
move-result v6
and-int/2addr v1, v6
shr-int/lit8 v1, v1, 0x8
.line 113
.local v1, "pointerIndex":I
invoke-virtual {p1, v1}, Landroid/view/MotionEvent;->getPointerId(I)I
move-result v6
iget v7, p0, Lim/tpelyyftgw/ui/components/crop/CropGestureDetector;->mActivePointerId:I
if-ne v6, v7, :cond_4e
.line 115
if-nez v1, :cond_30
.line 116
const/4 v6, 0x1
.local v6, "newPointerIndex":I
goto :goto_31
.line 118
.end local v6 # "newPointerIndex":I
:cond_30
const/4 v6, 0x0
.line 120
.restart local v6 # "newPointerIndex":I
:goto_31
invoke-virtual {p1, v6}, Landroid/view/MotionEvent;->getPointerId(I)I
move-result v7
iput v7, p0, Lim/tpelyyftgw/ui/components/crop/CropGestureDetector;->mActivePointerId:I
.line 121
invoke-virtual {p1, v6}, Landroid/view/MotionEvent;->getX(I)F
move-result v7
iput v7, p0, Lim/tpelyyftgw/ui/components/crop/CropGestureDetector;->mLastTouchX:F
.line 122
invoke-virtual {p1, v6}, Landroid/view/MotionEvent;->getY(I)F
move-result v7
iput v7, p0, Lim/tpelyyftgw/ui/components/crop/CropGestureDetector;->mLastTouchY:F
.line 123
goto :goto_4e
.line 109
.end local v1 # "pointerIndex":I
.end local v6 # "newPointerIndex":I
:cond_44
iput v2, p0, Lim/tpelyyftgw/ui/components/crop/CropGestureDetector;->mActivePointerId:I
.line 110
goto :goto_4e
.line 105
:cond_47
invoke-virtual {p1, v5}, Landroid/view/MotionEvent;->getPointerId(I)I
move-result v1
iput v1, p0, Lim/tpelyyftgw/ui/components/crop/CropGestureDetector;->mActivePointerId:I
.line 106
nop
.line 127
:cond_4e
:goto_4e
iget v1, p0, Lim/tpelyyftgw/ui/components/crop/CropGestureDetector;->mActivePointerId:I
if-eq v1, v2, :cond_54
.line 128
iget v0, p0, Lim/tpelyyftgw/ui/components/crop/CropGestureDetector;->mActivePointerId:I
.line 130
:cond_54
invoke-virtual {p1, v0}, Landroid/view/MotionEvent;->findPointerIndex(I)I
move-result v1
iput v1, p0, Lim/tpelyyftgw/ui/components/crop/CropGestureDetector;->mActivePointerIndex:I
.line 132
invoke-virtual {p1}, Landroid/view/MotionEvent;->getAction()I
move-result v1
if-eqz v1, :cond_d0
const/4 v2, 0x0
if-eq v1, v4, :cond_79
const/4 v6, 0x2
if-eq v1, v6, :cond_d0
if-eq v1, v3, :cond_6a
goto/16 :goto_12c
.line 173
:cond_6a
iget-object v1, p0, Lim/tpelyyftgw/ui/components/crop/CropGestureDetector;->mVelocityTracker:Landroid/view/VelocityTracker;
if-eqz v1, :cond_73
.line 174
invoke-virtual {v1}, Landroid/view/VelocityTracker;->recycle()V
.line 175
iput-object v2, p0, Lim/tpelyyftgw/ui/components/crop/CropGestureDetector;->mVelocityTracker:Landroid/view/VelocityTracker;
.line 177
:cond_73
iput-boolean v5, p0, Lim/tpelyyftgw/ui/components/crop/CropGestureDetector;->started:Z
.line 178
iput-boolean v5, p0, Lim/tpelyyftgw/ui/components/crop/CropGestureDetector;->mIsDragging:Z
.line 179
goto/16 :goto_12c
.line 183
:cond_79
iget-boolean v1, p0, Lim/tpelyyftgw/ui/components/crop/CropGestureDetector;->mIsDragging:Z
if-eqz v1, :cond_c4
.line 184
iget-object v1, p0, Lim/tpelyyftgw/ui/components/crop/CropGestureDetector;->mVelocityTracker:Landroid/view/VelocityTracker;
if-eqz v1, :cond_c2
.line 185
invoke-virtual {p0, p1}, Lim/tpelyyftgw/ui/components/crop/CropGestureDetector;->getActiveX(Landroid/view/MotionEvent;)F
move-result v1
iput v1, p0, Lim/tpelyyftgw/ui/components/crop/CropGestureDetector;->mLastTouchX:F
.line 186
invoke-virtual {p0, p1}, Lim/tpelyyftgw/ui/components/crop/CropGestureDetector;->getActiveY(Landroid/view/MotionEvent;)F
move-result v1
iput v1, p0, Lim/tpelyyftgw/ui/components/crop/CropGestureDetector;->mLastTouchY:F
.line 189
iget-object v1, p0, Lim/tpelyyftgw/ui/components/crop/CropGestureDetector;->mVelocityTracker:Landroid/view/VelocityTracker;
invoke-virtual {v1, p1}, Landroid/view/VelocityTracker;->addMovement(Landroid/view/MotionEvent;)V
.line 190
iget-object v1, p0, Lim/tpelyyftgw/ui/components/crop/CropGestureDetector;->mVelocityTracker:Landroid/view/VelocityTracker;
const/16 v3, 0x3e8
invoke-virtual {v1, v3}, Landroid/view/VelocityTracker;->computeCurrentVelocity(I)V
.line 192
iget-object v1, p0, Lim/tpelyyftgw/ui/components/crop/CropGestureDetector;->mVelocityTracker:Landroid/view/VelocityTracker;
invoke-virtual {v1}, Landroid/view/VelocityTracker;->getXVelocity()F
move-result v1
.local v1, "vX":F
iget-object v3, p0, Lim/tpelyyftgw/ui/components/crop/CropGestureDetector;->mVelocityTracker:Landroid/view/VelocityTracker;
.line 193
invoke-virtual {v3}, Landroid/view/VelocityTracker;->getYVelocity()F
move-result v3
.line 197
.local v3, "vY":F
invoke-static {v1}, Ljava/lang/Math;->abs(F)F
move-result v6
invoke-static {v3}, Ljava/lang/Math;->abs(F)F
move-result v7
invoke-static {v6, v7}, Ljava/lang/Math;->max(FF)F
move-result v6
iget v7, p0, Lim/tpelyyftgw/ui/components/crop/CropGestureDetector;->mMinimumVelocity:F
cmpl-float v6, v6, v7
if-ltz v6, :cond_c2
.line 198
iget-object v6, p0, Lim/tpelyyftgw/ui/components/crop/CropGestureDetector;->mListener:Lim/tpelyyftgw/ui/components/crop/CropGestureDetector$CropGestureListener;
iget v7, p0, Lim/tpelyyftgw/ui/components/crop/CropGestureDetector;->mLastTouchX:F
iget v8, p0, Lim/tpelyyftgw/ui/components/crop/CropGestureDetector;->mLastTouchY:F
neg-float v9, v1
neg-float v10, v3
invoke-interface {v6, v7, v8, v9, v10}, Lim/tpelyyftgw/ui/components/crop/CropGestureDetector$CropGestureListener;->onFling(FFFF)V
.line 203
.end local v1 # "vX":F
.end local v3 # "vY":F
:cond_c2
iput-boolean v5, p0, Lim/tpelyyftgw/ui/components/crop/CropGestureDetector;->mIsDragging:Z
.line 207
:cond_c4
iget-object v1, p0, Lim/tpelyyftgw/ui/components/crop/CropGestureDetector;->mVelocityTracker:Landroid/view/VelocityTracker;
if-eqz v1, :cond_cd
.line 208
invoke-virtual {v1}, Landroid/view/VelocityTracker;->recycle()V
.line 209
iput-object v2, p0, Lim/tpelyyftgw/ui/components/crop/CropGestureDetector;->mVelocityTracker:Landroid/view/VelocityTracker;
.line 212
:cond_cd
iput-boolean v5, p0, Lim/tpelyyftgw/ui/components/crop/CropGestureDetector;->started:Z
goto :goto_12c
.line 135
:cond_d0
iget-boolean v1, p0, Lim/tpelyyftgw/ui/components/crop/CropGestureDetector;->started:Z
if-nez v1, :cond_f0
.line 136
invoke-static {}, Landroid/view/VelocityTracker;->obtain()Landroid/view/VelocityTracker;
move-result-object v1
iput-object v1, p0, Lim/tpelyyftgw/ui/components/crop/CropGestureDetector;->mVelocityTracker:Landroid/view/VelocityTracker;
.line 137
if-eqz v1, :cond_df
.line 138
invoke-virtual {v1, p1}, Landroid/view/VelocityTracker;->addMovement(Landroid/view/MotionEvent;)V
.line 141
:cond_df
invoke-virtual {p0, p1}, Lim/tpelyyftgw/ui/components/crop/CropGestureDetector;->getActiveX(Landroid/view/MotionEvent;)F
move-result v1
iput v1, p0, Lim/tpelyyftgw/ui/components/crop/CropGestureDetector;->mLastTouchX:F
.line 142
invoke-virtual {p0, p1}, Lim/tpelyyftgw/ui/components/crop/CropGestureDetector;->getActiveY(Landroid/view/MotionEvent;)F
move-result v1
iput v1, p0, Lim/tpelyyftgw/ui/components/crop/CropGestureDetector;->mLastTouchY:F
.line 143
iput-boolean v5, p0, Lim/tpelyyftgw/ui/components/crop/CropGestureDetector;->mIsDragging:Z
.line 145
iput-boolean v4, p0, Lim/tpelyyftgw/ui/components/crop/CropGestureDetector;->started:Z
.line 146
return v4
.line 149
:cond_f0
invoke-virtual {p0, p1}, Lim/tpelyyftgw/ui/components/crop/CropGestureDetector;->getActiveX(Landroid/view/MotionEvent;)F
move-result v1
.line 150
.local v1, "x":F
invoke-virtual {p0, p1}, Lim/tpelyyftgw/ui/components/crop/CropGestureDetector;->getActiveY(Landroid/view/MotionEvent;)F
move-result v2
.line 151
.local v2, "y":F
iget v3, p0, Lim/tpelyyftgw/ui/components/crop/CropGestureDetector;->mLastTouchX:F
sub-float v3, v1, v3
.local v3, "dx":F
iget v6, p0, Lim/tpelyyftgw/ui/components/crop/CropGestureDetector;->mLastTouchY:F
sub-float v6, v2, v6
.line 153
.local v6, "dy":F
iget-boolean v7, p0, Lim/tpelyyftgw/ui/components/crop/CropGestureDetector;->mIsDragging:Z
if-nez v7, :cond_118
.line 156
mul-float v7, v3, v3
mul-float v8, v6, v6
add-float/2addr v7, v8
float-to-double v7, v7
invoke-static {v7, v8}, Ljava/lang/Math;->sqrt(D)D
move-result-wide v7
double-to-float v7, v7
iget v8, p0, Lim/tpelyyftgw/ui/components/crop/CropGestureDetector;->mTouchSlop:F
cmpl-float v7, v7, v8
if-ltz v7, :cond_116
const/4 v5, 0x1
:cond_116
iput-boolean v5, p0, Lim/tpelyyftgw/ui/components/crop/CropGestureDetector;->mIsDragging:Z
.line 159
:cond_118
iget-boolean v5, p0, Lim/tpelyyftgw/ui/components/crop/CropGestureDetector;->mIsDragging:Z
if-eqz v5, :cond_12c
.line 160
iget-object v5, p0, Lim/tpelyyftgw/ui/components/crop/CropGestureDetector;->mListener:Lim/tpelyyftgw/ui/components/crop/CropGestureDetector$CropGestureListener;
invoke-interface {v5, v3, v6}, Lim/tpelyyftgw/ui/components/crop/CropGestureDetector$CropGestureListener;->onDrag(FF)V
.line 161
iput v1, p0, Lim/tpelyyftgw/ui/components/crop/CropGestureDetector;->mLastTouchX:F
.line 162
iput v2, p0, Lim/tpelyyftgw/ui/components/crop/CropGestureDetector;->mLastTouchY:F
.line 164
iget-object v5, p0, Lim/tpelyyftgw/ui/components/crop/CropGestureDetector;->mVelocityTracker:Landroid/view/VelocityTracker;
if-eqz v5, :cond_12c
.line 165
invoke-virtual {v5, p1}, Landroid/view/VelocityTracker;->addMovement(Landroid/view/MotionEvent;)V
.line 217
.end local v1 # "x":F
.end local v2 # "y":F
.end local v3 # "dx":F
.end local v6 # "dy":F
:cond_12c
:goto_12c
return v4
.end method
.method public setOnGestureListener(Lim/tpelyyftgw/ui/components/crop/CropGestureDetector$CropGestureListener;)V
.registers 2
.param p1, "listener" # Lim/tpelyyftgw/ui/components/crop/CropGestureDetector$CropGestureListener;
.line 87
iput-object p1, p0, Lim/tpelyyftgw/ui/components/crop/CropGestureDetector;->mListener:Lim/tpelyyftgw/ui/components/crop/CropGestureDetector$CropGestureListener;
.line 88
return-void
.end method