RotationGestureDetector.smali

.class public Lim/tpelyyftgw/ui/components/paint/views/RotationGestureDetector;
.super Ljava/lang/Object;
.source "RotationGestureDetector.java"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lim/tpelyyftgw/ui/components/paint/views/RotationGestureDetector$OnRotationGestureListener;
    }
.end annotation


# instance fields
.field private angle:F

.field private fX:F

.field private fY:F

.field private mListener:Lim/tpelyyftgw/ui/components/paint/views/RotationGestureDetector$OnRotationGestureListener;

.field private sX:F

.field private sY:F

.field private startAngle:F


# direct methods
.method static constructor <clinit>()V
    .registers 1

    return-void
.end method

.method public constructor <init>(Lim/tpelyyftgw/ui/components/paint/views/RotationGestureDetector$OnRotationGestureListener;)V
    .registers 2
    .param p1, "listener"    # Lim/tpelyyftgw/ui/components/paint/views/RotationGestureDetector$OnRotationGestureListener;

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

    .line 28
    iput-object p1, p0, Lim/tpelyyftgw/ui/components/paint/views/RotationGestureDetector;->mListener:Lim/tpelyyftgw/ui/components/paint/views/RotationGestureDetector$OnRotationGestureListener;

    .line 29
    return-void
.end method

.method private angleBetweenLines(FFFFFFFF)F
    .registers 14
    .param p1, "fX"    # F
    .param p2, "fY"    # F
    .param p3, "sX"    # F
    .param p4, "sY"    # F
    .param p5, "nfX"    # F
    .param p6, "nfY"    # F
    .param p7, "nsX"    # F
    .param p8, "nsY"    # F

    .line 84
    sub-float v0, p2, p4

    float-to-double v0, v0

    sub-float v2, p1, p3

    float-to-double v2, v2

    invoke-static {v0, v1, v2, v3}, Ljava/lang/Math;->atan2(DD)D

    move-result-wide v0

    double-to-float v0, v0

    .line 85
    .local v0, "angle1":F
    sub-float v1, p6, p8

    float-to-double v1, v1

    sub-float v3, p5, p7

    float-to-double v3, v3

    invoke-static {v1, v2, v3, v4}, Ljava/lang/Math;->atan2(DD)D

    move-result-wide v1

    double-to-float v1, v1

    .line 86
    .local v1, "angle2":F
    sub-float v2, v0, v1

    float-to-double v2, v2

    invoke-static {v2, v3}, Ljava/lang/Math;->toDegrees(D)D

    move-result-wide v2

    double-to-float v2, v2

    const/high16 v3, 0x43b40000    # 360.0f

    rem-float/2addr v2, v3

    .line 87
    .local v2, "angle":F
    const/high16 v4, -0x3ccc0000    # -180.0f

    cmpg-float v4, v2, v4

    if-gez v4, :cond_28

    .line 88
    add-float/2addr v2, v3

    .line 90
    :cond_28
    const/high16 v4, 0x43340000    # 180.0f

    cmpl-float v4, v2, v4

    if-lez v4, :cond_2f

    .line 91
    sub-float/2addr v2, v3

    .line 93
    :cond_2f
    return v2
.end method


# virtual methods
.method public getAngle()F
    .registers 2

    .line 20
    iget v0, p0, Lim/tpelyyftgw/ui/components/paint/views/RotationGestureDetector;->angle:F

    return v0
.end method

.method public getStartAngle()F
    .registers 2

    .line 24
    iget v0, p0, Lim/tpelyyftgw/ui/components/paint/views/RotationGestureDetector;->startAngle:F

    return v0
.end method

.method public onTouchEvent(Landroid/view/MotionEvent;)Z
    .registers 16
    .param p1, "event"    # Landroid/view/MotionEvent;

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

    move-result v0

    const/4 v1, 0x2

    const/4 v2, 0x0

    if-eq v0, v1, :cond_9

    .line 33
    return v2

    .line 35
    :cond_9
    invoke-virtual {p1}, Landroid/view/MotionEvent;->getActionMasked()I

    move-result v0

    const/4 v3, 0x1

    if-eqz v0, :cond_6c

    const/high16 v4, 0x7fc00000    # Float.NaN

    if-eq v0, v3, :cond_69

    if-eq v0, v1, :cond_2a

    const/4 v1, 0x3

    if-eq v0, v1, :cond_69

    const/4 v1, 0x5

    if-eq v0, v1, :cond_6c

    const/4 v1, 0x6

    if-eq v0, v1, :cond_20

    goto :goto_85

    .line 72
    :cond_20
    iput v4, p0, Lim/tpelyyftgw/ui/components/paint/views/RotationGestureDetector;->startAngle:F

    .line 74
    iget-object v0, p0, Lim/tpelyyftgw/ui/components/paint/views/RotationGestureDetector;->mListener:Lim/tpelyyftgw/ui/components/paint/views/RotationGestureDetector$OnRotationGestureListener;

    if-eqz v0, :cond_85

    .line 75
    invoke-interface {v0, p0}, Lim/tpelyyftgw/ui/components/paint/views/RotationGestureDetector$OnRotationGestureListener;->onRotationEnd(Lim/tpelyyftgw/ui/components/paint/views/RotationGestureDetector;)V

    goto :goto_85

    .line 47
    :cond_2a
    invoke-virtual {p1, v2}, Landroid/view/MotionEvent;->getX(I)F

    move-result v0

    .line 48
    .local v0, "nsX":F
    invoke-virtual {p1, v2}, Landroid/view/MotionEvent;->getY(I)F

    move-result v1

    .line 49
    .local v1, "nsY":F
    invoke-virtual {p1, v3}, Landroid/view/MotionEvent;->getX(I)F

    move-result v2

    .line 50
    .local v2, "nfX":F
    invoke-virtual {p1, v3}, Landroid/view/MotionEvent;->getY(I)F

    move-result v13

    .line 52
    .local v13, "nfY":F
    iget v5, p0, Lim/tpelyyftgw/ui/components/paint/views/RotationGestureDetector;->fX:F

    iget v6, p0, Lim/tpelyyftgw/ui/components/paint/views/RotationGestureDetector;->fY:F

    iget v7, p0, Lim/tpelyyftgw/ui/components/paint/views/RotationGestureDetector;->sX:F

    iget v8, p0, Lim/tpelyyftgw/ui/components/paint/views/RotationGestureDetector;->sY:F

    move-object v4, p0

    move v9, v2

    move v10, v13

    move v11, v0

    move v12, v1

    invoke-direct/range {v4 .. v12}, Lim/tpelyyftgw/ui/components/paint/views/RotationGestureDetector;->angleBetweenLines(FFFFFFFF)F

    move-result v4

    iput v4, p0, Lim/tpelyyftgw/ui/components/paint/views/RotationGestureDetector;->angle:F

    .line 54
    iget-object v4, p0, Lim/tpelyyftgw/ui/components/paint/views/RotationGestureDetector;->mListener:Lim/tpelyyftgw/ui/components/paint/views/RotationGestureDetector$OnRotationGestureListener;

    if-eqz v4, :cond_68

    .line 55
    iget v4, p0, Lim/tpelyyftgw/ui/components/paint/views/RotationGestureDetector;->startAngle:F

    invoke-static {v4}, Ljava/lang/Float;->isNaN(F)Z

    move-result v4

    if-eqz v4, :cond_63

    .line 56
    iget v4, p0, Lim/tpelyyftgw/ui/components/paint/views/RotationGestureDetector;->angle:F

    iput v4, p0, Lim/tpelyyftgw/ui/components/paint/views/RotationGestureDetector;->startAngle:F

    .line 57
    iget-object v4, p0, Lim/tpelyyftgw/ui/components/paint/views/RotationGestureDetector;->mListener:Lim/tpelyyftgw/ui/components/paint/views/RotationGestureDetector$OnRotationGestureListener;

    invoke-interface {v4, p0}, Lim/tpelyyftgw/ui/components/paint/views/RotationGestureDetector$OnRotationGestureListener;->onRotationBegin(Lim/tpelyyftgw/ui/components/paint/views/RotationGestureDetector;)V

    goto :goto_68

    .line 59
    :cond_63
    iget-object v4, p0, Lim/tpelyyftgw/ui/components/paint/views/RotationGestureDetector;->mListener:Lim/tpelyyftgw/ui/components/paint/views/RotationGestureDetector$OnRotationGestureListener;

    invoke-interface {v4, p0}, Lim/tpelyyftgw/ui/components/paint/views/RotationGestureDetector$OnRotationGestureListener;->onRotation(Lim/tpelyyftgw/ui/components/paint/views/RotationGestureDetector;)V

    .line 63
    .end local v0    # "nsX":F
    .end local v1    # "nsY":F
    .end local v2    # "nfX":F
    .end local v13    # "nfY":F
    :cond_68
    :goto_68
    goto :goto_85

    .line 67
    :cond_69
    iput v4, p0, Lim/tpelyyftgw/ui/components/paint/views/RotationGestureDetector;->startAngle:F

    .line 69
    goto :goto_85

    .line 38
    :cond_6c
    invoke-virtual {p1, v2}, Landroid/view/MotionEvent;->getX(I)F

    move-result v0

    iput v0, p0, Lim/tpelyyftgw/ui/components/paint/views/RotationGestureDetector;->sX:F

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

    move-result v0

    iput v0, p0, Lim/tpelyyftgw/ui/components/paint/views/RotationGestureDetector;->sY:F

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

    move-result v0

    iput v0, p0, Lim/tpelyyftgw/ui/components/paint/views/RotationGestureDetector;->fX:F

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

    move-result v0

    iput v0, p0, Lim/tpelyyftgw/ui/components/paint/views/RotationGestureDetector;->fY:F

    .line 43
    nop

    .line 80
    :cond_85
    :goto_85
    return v3
.end method