b.smali

.class final Lcom/github/chrisbanes/photoview/b;
.super Ljava/lang/Object;
.source "SourceFile"


# instance fields
.field final a:Landroid/view/ScaleGestureDetector;

.field b:Z

.field c:Lcom/github/chrisbanes/photoview/c;

.field private d:I

.field private e:I

.field private f:Landroid/view/VelocityTracker;

.field private g:F

.field private h:F

.field private final i:F

.field private final j:F


# direct methods
.method constructor <init>(Landroid/content/Context;Lcom/github/chrisbanes/photoview/c;)V
    .registers 5

    .line 43
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    const/4 v0, -0x1

    .line 31
    iput v0, p0, Lcom/github/chrisbanes/photoview/b;->d:I

    const/4 v0, 0x0

    .line 32
    iput v0, p0, Lcom/github/chrisbanes/photoview/b;->e:I

    .line 45
    invoke-static {p1}, Landroid/view/ViewConfiguration;->get(Landroid/content/Context;)Landroid/view/ViewConfiguration;

    move-result-object v0

    .line 46
    invoke-virtual {v0}, Landroid/view/ViewConfiguration;->getScaledMinimumFlingVelocity()I

    move-result v1

    int-to-float v1, v1

    iput v1, p0, Lcom/github/chrisbanes/photoview/b;->j:F

    .line 47
    invoke-virtual {v0}, Landroid/view/ViewConfiguration;->getScaledTouchSlop()I

    move-result v0

    int-to-float v0, v0

    iput v0, p0, Lcom/github/chrisbanes/photoview/b;->i:F

    .line 49
    iput-object p2, p0, Lcom/github/chrisbanes/photoview/b;->c:Lcom/github/chrisbanes/photoview/c;

    .line 50
    new-instance p2, Lcom/github/chrisbanes/photoview/b$1;

    invoke-direct {p2, p0}, Lcom/github/chrisbanes/photoview/b$1;-><init>(Lcom/github/chrisbanes/photoview/b;)V

    .line 74
    new-instance v0, Landroid/view/ScaleGestureDetector;

    invoke-direct {v0, p1, p2}, Landroid/view/ScaleGestureDetector;-><init>(Landroid/content/Context;Landroid/view/ScaleGestureDetector$OnScaleGestureListener;)V

    iput-object v0, p0, Lcom/github/chrisbanes/photoview/b;->a:Landroid/view/ScaleGestureDetector;

    return-void
.end method

.method private b(Landroid/view/MotionEvent;)F
    .registers 3

    .line 79
    :try_start_0
    iget v0, p0, Lcom/github/chrisbanes/photoview/b;->e:I

    invoke-virtual {p1, v0}, Landroid/view/MotionEvent;->getX(I)F

    move-result p1
    :try_end_6
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_6} :catch_7

    return p1

    .line 81
    :catch_7
    invoke-virtual {p1}, Landroid/view/MotionEvent;->getX()F

    move-result p1

    return p1
.end method

.method private c(Landroid/view/MotionEvent;)F
    .registers 3

    .line 87
    :try_start_0
    iget v0, p0, Lcom/github/chrisbanes/photoview/b;->e:I

    invoke-virtual {p1, v0}, Landroid/view/MotionEvent;->getY(I)F

    move-result p1
    :try_end_6
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_6} :catch_7

    return p1

    .line 89
    :catch_7
    invoke-virtual {p1}, Landroid/view/MotionEvent;->getY()F

    move-result p1

    return p1
.end method


# virtual methods
.method public final a(Landroid/view/MotionEvent;)Z
    .registers 14

    const/4 v0, 0x1

    .line 103
    :try_start_1
    iget-object v1, p0, Lcom/github/chrisbanes/photoview/b;->a:Landroid/view/ScaleGestureDetector;

    invoke-virtual {v1, p1}, Landroid/view/ScaleGestureDetector;->onTouchEvent(Landroid/view/MotionEvent;)Z

    .line 1112
    invoke-virtual {p1}, Landroid/view/MotionEvent;->getAction()I

    move-result v1

    and-int/lit16 v1, v1, 0xff

    const/4 v2, -0x1

    const/4 v3, 0x0

    if-eqz v1, :cond_ec

    const/4 v4, 0x0

    if-eq v1, v0, :cond_99

    const/4 v5, 0x2

    if-eq v1, v5, :cond_58

    const/4 v5, 0x3

    if-eq v1, v5, :cond_49

    const/4 v4, 0x6

    if-eq v1, v4, :cond_1e

    goto/16 :goto_10b

    .line 1185
    :cond_1e
    invoke-virtual {p1}, Landroid/view/MotionEvent;->getAction()I

    move-result v1

    const v4, 0xff00

    and-int/2addr v1, v4

    shr-int/lit8 v1, v1, 0x8

    .line 1186
    invoke-virtual {p1, v1}, Landroid/view/MotionEvent;->getPointerId(I)I

    move-result v4

    .line 1187
    iget v5, p0, Lcom/github/chrisbanes/photoview/b;->d:I

    if-ne v4, v5, :cond_10b

    if-nez v1, :cond_34

    const/4 v1, 0x1

    goto :goto_35

    :cond_34
    const/4 v1, 0x0

    .line 1191
    :goto_35
    invoke-virtual {p1, v1}, Landroid/view/MotionEvent;->getPointerId(I)I

    move-result v4

    iput v4, p0, Lcom/github/chrisbanes/photoview/b;->d:I

    .line 1192
    invoke-virtual {p1, v1}, Landroid/view/MotionEvent;->getX(I)F

    move-result v4

    iput v4, p0, Lcom/github/chrisbanes/photoview/b;->g:F

    .line 1193
    invoke-virtual {p1, v1}, Landroid/view/MotionEvent;->getY(I)F

    move-result v1

    iput v1, p0, Lcom/github/chrisbanes/photoview/b;->h:F

    goto/16 :goto_10b

    .line 1148
    :cond_49
    iput v2, p0, Lcom/github/chrisbanes/photoview/b;->d:I

    .line 1150
    iget-object v1, p0, Lcom/github/chrisbanes/photoview/b;->f:Landroid/view/VelocityTracker;

    if-eqz v1, :cond_10b

    .line 1151
    iget-object v1, p0, Lcom/github/chrisbanes/photoview/b;->f:Landroid/view/VelocityTracker;

    invoke-virtual {v1}, Landroid/view/VelocityTracker;->recycle()V

    .line 1152
    iput-object v4, p0, Lcom/github/chrisbanes/photoview/b;->f:Landroid/view/VelocityTracker;

    goto/16 :goto_10b

    .line 1127
    :cond_58
    invoke-direct {p0, p1}, Lcom/github/chrisbanes/photoview/b;->b(Landroid/view/MotionEvent;)F

    move-result v1

    .line 1128
    invoke-direct {p0, p1}, Lcom/github/chrisbanes/photoview/b;->c(Landroid/view/MotionEvent;)F

    move-result v4

    .line 1129
    iget v5, p0, Lcom/github/chrisbanes/photoview/b;->g:F

    sub-float v5, v1, v5

    iget v6, p0, Lcom/github/chrisbanes/photoview/b;->h:F

    sub-float v6, v4, v6

    .line 1131
    iget-boolean v7, p0, Lcom/github/chrisbanes/photoview/b;->b:Z

    if-nez v7, :cond_82

    mul-float v7, v5, v5

    mul-float v8, v6, v6

    add-float/2addr v7, v8

    float-to-double v7, v7

    .line 1134
    invoke-static {v7, v8}, Ljava/lang/Math;->sqrt(D)D

    move-result-wide v7

    iget v9, p0, Lcom/github/chrisbanes/photoview/b;->i:F

    float-to-double v9, v9

    cmpl-double v11, v7, v9

    if-ltz v11, :cond_7f

    const/4 v7, 0x1

    goto :goto_80

    :cond_7f
    const/4 v7, 0x0

    :goto_80
    iput-boolean v7, p0, Lcom/github/chrisbanes/photoview/b;->b:Z

    .line 1137
    :cond_82
    iget-boolean v7, p0, Lcom/github/chrisbanes/photoview/b;->b:Z

    if-eqz v7, :cond_10b

    .line 1138
    iget-object v7, p0, Lcom/github/chrisbanes/photoview/b;->c:Lcom/github/chrisbanes/photoview/c;

    invoke-interface {v7, v5, v6}, Lcom/github/chrisbanes/photoview/c;->a(FF)V

    .line 1139
    iput v1, p0, Lcom/github/chrisbanes/photoview/b;->g:F

    .line 1140
    iput v4, p0, Lcom/github/chrisbanes/photoview/b;->h:F

    .line 1142
    iget-object v1, p0, Lcom/github/chrisbanes/photoview/b;->f:Landroid/view/VelocityTracker;

    if-eqz v1, :cond_10b

    .line 1143
    iget-object v1, p0, Lcom/github/chrisbanes/photoview/b;->f:Landroid/view/VelocityTracker;

    invoke-virtual {v1, p1}, Landroid/view/VelocityTracker;->addMovement(Landroid/view/MotionEvent;)V

    goto :goto_10b

    .line 1156
    :cond_99
    iput v2, p0, Lcom/github/chrisbanes/photoview/b;->d:I

    .line 1157
    iget-boolean v1, p0, Lcom/github/chrisbanes/photoview/b;->b:Z

    if-eqz v1, :cond_e0

    .line 1158
    iget-object v1, p0, Lcom/github/chrisbanes/photoview/b;->f:Landroid/view/VelocityTracker;

    if-eqz v1, :cond_e0

    .line 1159
    invoke-direct {p0, p1}, Lcom/github/chrisbanes/photoview/b;->b(Landroid/view/MotionEvent;)F

    move-result v1

    iput v1, p0, Lcom/github/chrisbanes/photoview/b;->g:F

    .line 1160
    invoke-direct {p0, p1}, Lcom/github/chrisbanes/photoview/b;->c(Landroid/view/MotionEvent;)F

    move-result v1

    iput v1, p0, Lcom/github/chrisbanes/photoview/b;->h:F

    .line 1163
    iget-object v1, p0, Lcom/github/chrisbanes/photoview/b;->f:Landroid/view/VelocityTracker;

    invoke-virtual {v1, p1}, Landroid/view/VelocityTracker;->addMovement(Landroid/view/MotionEvent;)V

    .line 1164
    iget-object v1, p0, Lcom/github/chrisbanes/photoview/b;->f:Landroid/view/VelocityTracker;

    const/16 v5, 0x3e8

    invoke-virtual {v1, v5}, Landroid/view/VelocityTracker;->computeCurrentVelocity(I)V

    .line 1166
    iget-object v1, p0, Lcom/github/chrisbanes/photoview/b;->f:Landroid/view/VelocityTracker;

    invoke-virtual {v1}, Landroid/view/VelocityTracker;->getXVelocity()F

    move-result v1

    iget-object v5, p0, Lcom/github/chrisbanes/photoview/b;->f:Landroid/view/VelocityTracker;

    .line 1167
    invoke-virtual {v5}, Landroid/view/VelocityTracker;->getYVelocity()F

    move-result v5

    .line 1171
    invoke-static {v1}, Ljava/lang/Math;->abs(F)F

    move-result v6

    invoke-static {v5}, 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, Lcom/github/chrisbanes/photoview/b;->j:F

    cmpl-float v6, v6, v7

    if-ltz v6, :cond_e0

    .line 1172
    iget-object v6, p0, Lcom/github/chrisbanes/photoview/b;->c:Lcom/github/chrisbanes/photoview/c;

    neg-float v1, v1

    neg-float v5, v5

    invoke-interface {v6, v1, v5}, Lcom/github/chrisbanes/photoview/c;->b(FF)V

    .line 1179
    :cond_e0
    iget-object v1, p0, Lcom/github/chrisbanes/photoview/b;->f:Landroid/view/VelocityTracker;

    if-eqz v1, :cond_10b

    .line 1180
    iget-object v1, p0, Lcom/github/chrisbanes/photoview/b;->f:Landroid/view/VelocityTracker;

    invoke-virtual {v1}, Landroid/view/VelocityTracker;->recycle()V

    .line 1181
    iput-object v4, p0, Lcom/github/chrisbanes/photoview/b;->f:Landroid/view/VelocityTracker;

    goto :goto_10b

    .line 1115
    :cond_ec
    invoke-virtual {p1, v3}, Landroid/view/MotionEvent;->getPointerId(I)I

    move-result v1

    iput v1, p0, Lcom/github/chrisbanes/photoview/b;->d:I

    .line 1117
    invoke-static {}, Landroid/view/VelocityTracker;->obtain()Landroid/view/VelocityTracker;

    move-result-object v1

    iput-object v1, p0, Lcom/github/chrisbanes/photoview/b;->f:Landroid/view/VelocityTracker;

    if-eqz v1, :cond_fd

    .line 1119
    invoke-virtual {v1, p1}, Landroid/view/VelocityTracker;->addMovement(Landroid/view/MotionEvent;)V

    .line 1122
    :cond_fd
    invoke-direct {p0, p1}, Lcom/github/chrisbanes/photoview/b;->b(Landroid/view/MotionEvent;)F

    move-result v1

    iput v1, p0, Lcom/github/chrisbanes/photoview/b;->g:F

    .line 1123
    invoke-direct {p0, p1}, Lcom/github/chrisbanes/photoview/b;->c(Landroid/view/MotionEvent;)F

    move-result v1

    iput v1, p0, Lcom/github/chrisbanes/photoview/b;->h:F

    .line 1124
    iput-boolean v3, p0, Lcom/github/chrisbanes/photoview/b;->b:Z

    .line 1198
    :cond_10b
    :goto_10b
    iget v1, p0, Lcom/github/chrisbanes/photoview/b;->d:I

    if-eq v1, v2, :cond_111

    iget v3, p0, Lcom/github/chrisbanes/photoview/b;->d:I

    .line 1199
    :cond_111
    invoke-virtual {p1, v3}, Landroid/view/MotionEvent;->findPointerIndex(I)I

    move-result p1

    iput p1, p0, Lcom/github/chrisbanes/photoview/b;->e:I
    :try_end_117
    .catch Ljava/lang/IllegalArgumentException; {:try_start_1 .. :try_end_117} :catch_117

    :catch_117
    return v0
.end method