b.smali

.class public Lio/dcloud/feature/gallery/imageedit/c/j/b;
.super Ljava/lang/Object;

# interfaces
.implements Landroid/view/View$OnTouchListener;


# instance fields
.field private a:Landroid/view/View;

.field private b:Lio/dcloud/feature/gallery/imageedit/view/IMGStickerView;

.field private c:F

.field private d:F

.field private e:D

.field private f:D

.field private g:Landroid/graphics/Matrix;


# direct methods
.method public constructor <init>(Lio/dcloud/feature/gallery/imageedit/view/IMGStickerView;Landroid/view/View;)V
    .registers 4

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

    .line 2
    new-instance v0, Landroid/graphics/Matrix;

    invoke-direct {v0}, Landroid/graphics/Matrix;-><init>()V

    iput-object v0, p0, Lio/dcloud/feature/gallery/imageedit/c/j/b;->g:Landroid/graphics/Matrix;

    .line 5
    iput-object p2, p0, Lio/dcloud/feature/gallery/imageedit/c/j/b;->a:Landroid/view/View;

    .line 6
    iput-object p1, p0, Lio/dcloud/feature/gallery/imageedit/c/j/b;->b:Lio/dcloud/feature/gallery/imageedit/view/IMGStickerView;

    .line 7
    invoke-virtual {p2, p0}, Landroid/view/View;->setOnTouchListener(Landroid/view/View$OnTouchListener;)V

    return-void
.end method

.method private static a(FF)D
    .registers 4

    float-to-double v0, p0

    float-to-double p0, p1

    .line 1
    invoke-static {v0, v1, p0, p1}, Ljava/lang/Math;->atan2(DD)D

    move-result-wide p0

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

    move-result-wide p0

    return-wide p0
.end method

.method private static a(FFFF)D
    .registers 4

    sub-float/2addr p0, p2

    mul-float/2addr p0, p0

    sub-float/2addr p1, p3

    mul-float/2addr p1, p1

    add-float/2addr p0, p1

    float-to-double p0, p0

    .line 2
    invoke-static {p0, p1}, Ljava/lang/Math;->sqrt(D)D

    move-result-wide p0

    return-wide p0
.end method


# virtual methods
.method public onTouch(Landroid/view/View;Landroid/view/MotionEvent;)Z
    .registers 13

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

    move-result p1

    const-string v0, "X=%f,Y=%f"

    const-string v1, "IMGStickerAdjustHelper"

    const/4 v2, 0x2

    const/4 v3, 0x0

    const/4 v4, 0x0

    const/4 v5, 0x1

    if-eqz p1, :cond_90

    if-eq p1, v2, :cond_11

    return v3

    :cond_11
    new-array p1, v2, [F

    .line 30
    invoke-virtual {p2}, Landroid/view/MotionEvent;->getX()F

    move-result v6

    aput v6, p1, v3

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

    move-result p2

    aput p2, p1, v5

    .line 32
    iget-object p2, p0, Lio/dcloud/feature/gallery/imageedit/c/j/b;->a:Landroid/view/View;

    invoke-virtual {p2}, Landroid/view/View;->getX()F

    move-result p2

    aget v6, p1, v3

    add-float/2addr p2, v6

    iget-object v6, p0, Lio/dcloud/feature/gallery/imageedit/c/j/b;->b:Lio/dcloud/feature/gallery/imageedit/view/IMGStickerView;

    invoke-virtual {v6}, Landroid/view/ViewGroup;->getPivotX()F

    move-result v6

    sub-float/2addr p2, v6

    .line 34
    iget-object v6, p0, Lio/dcloud/feature/gallery/imageedit/c/j/b;->a:Landroid/view/View;

    invoke-virtual {v6}, Landroid/view/View;->getY()F

    move-result v6

    aget p1, p1, v5

    add-float/2addr v6, p1

    iget-object p1, p0, Lio/dcloud/feature/gallery/imageedit/c/j/b;->b:Lio/dcloud/feature/gallery/imageedit/view/IMGStickerView;

    invoke-virtual {p1}, Landroid/view/ViewGroup;->getPivotY()F

    move-result p1

    sub-float/2addr v6, p1

    new-array p1, v2, [Ljava/lang/Object;

    .line 36
    invoke-static {p2}, Ljava/lang/Float;->valueOf(F)Ljava/lang/Float;

    move-result-object v2

    aput-object v2, p1, v3

    invoke-static {v6}, Ljava/lang/Float;->valueOf(F)Ljava/lang/Float;

    move-result-object v2

    aput-object v2, p1, v5

    invoke-static {v0, p1}, Lio/dcloud/common/util/StringUtil;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    move-result-object p1

    invoke-static {v1, p1}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 38
    invoke-static {v4, v4, p2, v6}, Lio/dcloud/feature/gallery/imageedit/c/j/b;->a(FFFF)D

    move-result-wide v2

    .line 40
    invoke-static {v6, p2}, Lio/dcloud/feature/gallery/imageedit/c/j/b;->a(FF)D

    move-result-wide p1

    .line 42
    iget-wide v6, p0, Lio/dcloud/feature/gallery/imageedit/c/j/b;->e:D

    div-double v6, v2, v6

    double-to-float v0, v6

    .line 45
    iget-object v4, p0, Lio/dcloud/feature/gallery/imageedit/c/j/b;->b:Lio/dcloud/feature/gallery/imageedit/view/IMGStickerView;

    invoke-virtual {v4, v0}, Lio/dcloud/feature/gallery/imageedit/view/IMGStickerView;->a(F)V

    .line 47
    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    const-string v4, "    D   = "

    invoke-virtual {v0, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    iget-wide v6, p0, Lio/dcloud/feature/gallery/imageedit/c/j/b;->f:D

    sub-double v6, p1, v6

    invoke-virtual {v0, v6, v7}, Ljava/lang/StringBuilder;->append(D)Ljava/lang/StringBuilder;

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-static {v1, v0}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 49
    iget-object v0, p0, Lio/dcloud/feature/gallery/imageedit/c/j/b;->b:Lio/dcloud/feature/gallery/imageedit/view/IMGStickerView;

    invoke-virtual {v0}, Landroid/view/ViewGroup;->getRotation()F

    move-result v1

    float-to-double v6, v1

    add-double/2addr v6, p1

    iget-wide p1, p0, Lio/dcloud/feature/gallery/imageedit/c/j/b;->f:D

    sub-double/2addr v6, p1

    double-to-float p1, v6

    invoke-virtual {v0, p1}, Landroid/view/ViewGroup;->setRotation(F)V

    .line 51
    iput-wide v2, p0, Lio/dcloud/feature/gallery/imageedit/c/j/b;->e:D

    return v5

    .line 52
    :cond_90
    invoke-virtual {p2}, Landroid/view/MotionEvent;->getX()F

    move-result p1

    .line 54
    invoke-virtual {p2}, Landroid/view/MotionEvent;->getY()F

    move-result p2

    .line 56
    iput v4, p0, Lio/dcloud/feature/gallery/imageedit/c/j/b;->d:F

    iput v4, p0, Lio/dcloud/feature/gallery/imageedit/c/j/b;->c:F

    .line 58
    iget-object v6, p0, Lio/dcloud/feature/gallery/imageedit/c/j/b;->a:Landroid/view/View;

    invoke-virtual {v6}, Landroid/view/View;->getX()F

    move-result v6

    add-float/2addr v6, p1

    iget-object v7, p0, Lio/dcloud/feature/gallery/imageedit/c/j/b;->b:Lio/dcloud/feature/gallery/imageedit/view/IMGStickerView;

    invoke-virtual {v7}, Landroid/view/ViewGroup;->getPivotX()F

    move-result v7

    sub-float/2addr v6, v7

    .line 60
    iget-object v7, p0, Lio/dcloud/feature/gallery/imageedit/c/j/b;->a:Landroid/view/View;

    invoke-virtual {v7}, Landroid/view/View;->getY()F

    move-result v7

    add-float/2addr v7, p2

    iget-object v8, p0, Lio/dcloud/feature/gallery/imageedit/c/j/b;->b:Lio/dcloud/feature/gallery/imageedit/view/IMGStickerView;

    invoke-virtual {v8}, Landroid/view/ViewGroup;->getPivotY()F

    move-result v8

    sub-float/2addr v7, v8

    new-array v2, v2, [Ljava/lang/Object;

    .line 62
    invoke-static {v6}, Ljava/lang/Float;->valueOf(F)Ljava/lang/Float;

    move-result-object v8

    aput-object v8, v2, v3

    invoke-static {v7}, Ljava/lang/Float;->valueOf(F)Ljava/lang/Float;

    move-result-object v8

    aput-object v8, v2, v5

    invoke-static {v0, v2}, Lio/dcloud/common/util/StringUtil;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v0

    invoke-static {v1, v0}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 64
    invoke-static {v4, v4, v6, v7}, Lio/dcloud/feature/gallery/imageedit/c/j/b;->a(FFFF)D

    move-result-wide v8

    iput-wide v8, p0, Lio/dcloud/feature/gallery/imageedit/c/j/b;->e:D

    .line 66
    invoke-static {v7, v6}, Lio/dcloud/feature/gallery/imageedit/c/j/b;->a(FF)D

    move-result-wide v8

    iput-wide v8, p0, Lio/dcloud/feature/gallery/imageedit/c/j/b;->f:D

    .line 68
    iget-object v0, p0, Lio/dcloud/feature/gallery/imageedit/c/j/b;->g:Landroid/graphics/Matrix;

    sub-float p1, v6, p1

    sub-float p2, v7, p2

    invoke-virtual {v0, p1, p2}, Landroid/graphics/Matrix;->setTranslate(FF)V

    new-array p1, v5, [Ljava/lang/Object;

    .line 70
    invoke-static {v7, v6}, Lio/dcloud/feature/gallery/imageedit/c/j/b;->a(FF)D

    move-result-wide v8

    invoke-static {v8, v9}, Ljava/lang/Double;->valueOf(D)Ljava/lang/Double;

    move-result-object p2

    aput-object p2, p1, v3

    const-string p2, "degrees=%f"

    invoke-static {p2, p1}, Lio/dcloud/common/util/StringUtil;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    move-result-object p1

    invoke-static {v1, p1}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 72
    iget-object p1, p0, Lio/dcloud/feature/gallery/imageedit/c/j/b;->g:Landroid/graphics/Matrix;

    invoke-static {v7, v6}, Lio/dcloud/feature/gallery/imageedit/c/j/b;->a(FF)D

    move-result-wide v0

    neg-double v0, v0

    double-to-float p2, v0

    iget v0, p0, Lio/dcloud/feature/gallery/imageedit/c/j/b;->c:F

    iget v1, p0, Lio/dcloud/feature/gallery/imageedit/c/j/b;->d:F

    invoke-virtual {p1, p2, v0, v1}, Landroid/graphics/Matrix;->postRotate(FFF)Z

    return v5
.end method