.class public Lcom/moji/crop/CropImageView;
.super Lcom/moji/crop/ImageViewTouchBase;
.source "CropImageView.java"


# instance fields
.field a:Ljava/util/ArrayList;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/ArrayList<",
            "Lcom/moji/crop/HighlightView;",
            ">;"
        }
    .end annotation
.end field

.field b:Lcom/moji/crop/HighlightView;

.field c:Landroid/content/Context;

.field private k:F

.field private l:F

.field private m:I

.field private n:I


# direct methods
.method public constructor <init>(Landroid/content/Context;)V
    .locals 0

    .line 24
    invoke-direct {p0, p1}, Lcom/moji/crop/ImageViewTouchBase;-><init>(Landroid/content/Context;)V

    .line 14
    new-instance p1, Ljava/util/ArrayList;

    invoke-direct {p1}, Ljava/util/ArrayList;-><init>()V

    iput-object p1, p0, Lcom/moji/crop/CropImageView;->a:Ljava/util/ArrayList;

    return-void
.end method

.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
    .locals 0

    .line 28
    invoke-direct {p0, p1, p2}, Lcom/moji/crop/ImageViewTouchBase;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;)V

    .line 14
    new-instance p1, Ljava/util/ArrayList;

    invoke-direct {p1}, Ljava/util/ArrayList;-><init>()V

    iput-object p1, p0, Lcom/moji/crop/CropImageView;->a:Ljava/util/ArrayList;

    return-void
.end method

.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V
    .locals 0

    .line 32
    invoke-direct {p0, p1, p2, p3}, Lcom/moji/crop/ImageViewTouchBase;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V

    .line 14
    new-instance p1, Ljava/util/ArrayList;

    invoke-direct {p1}, Ljava/util/ArrayList;-><init>()V

    iput-object p1, p0, Lcom/moji/crop/CropImageView;->a:Ljava/util/ArrayList;

    return-void
.end method

.method private b(Lcom/moji/crop/HighlightView;)V
    .locals 5

    .line 140
    iget-object p1, p1, Lcom/moji/crop/HighlightView;->b:Landroid/graphics/Rect;

    .line 142
    invoke-virtual {p0}, Lcom/moji/crop/CropImageView;->getLeft()I

    move-result v0

    iget v1, p1, Landroid/graphics/Rect;->left:I

    sub-int/2addr v0, v1

    const/4 v1, 0x0

    invoke-static {v1, v0}, Ljava/lang/Math;->max(II)I

    move-result v0

    .line 143
    invoke-virtual {p0}, Lcom/moji/crop/CropImageView;->getRight()I

    move-result v2

    iget v3, p1, Landroid/graphics/Rect;->right:I

    sub-int/2addr v2, v3

    invoke-static {v1, v2}, Ljava/lang/Math;->min(II)I

    move-result v2

    .line 145
    invoke-virtual {p0}, Lcom/moji/crop/CropImageView;->getTop()I

    move-result v3

    iget v4, p1, Landroid/graphics/Rect;->top:I

    sub-int/2addr v3, v4

    invoke-static {v1, v3}, Ljava/lang/Math;->max(II)I

    move-result v3

    .line 146
    invoke-virtual {p0}, Lcom/moji/crop/CropImageView;->getBottom()I

    move-result v4

    iget p1, p1, Landroid/graphics/Rect;->bottom:I

    sub-int/2addr v4, p1

    invoke-static {v1, v4}, Ljava/lang/Math;->min(II)I

    move-result p1

    if-eqz v0, :cond_0

    goto :goto_0

    :cond_0
    move v0, v2

    :goto_0
    if-eqz v3, :cond_1

    move p1, v3

    :cond_1
    if-nez v0, :cond_2

    if-eqz p1, :cond_3

    :cond_2
    int-to-float v0, v0

    int-to-float p1, p1

    .line 152
    invoke-virtual {p0, v0, p1}, Lcom/moji/crop/CropImageView;->b(FF)V

    :cond_3
    return-void
.end method

.method private c(Lcom/moji/crop/HighlightView;)V
    .locals 6

    .line 159
    iget-object v0, p1, Lcom/moji/crop/HighlightView;->b:Landroid/graphics/Rect;

    .line 161
    invoke-virtual {v0}, Landroid/graphics/Rect;->width()I

    move-result v1

    int-to-float v1, v1

    .line 162
    invoke-virtual {v0}, Landroid/graphics/Rect;->height()I

    move-result v0

    int-to-float v0, v0

    .line 164
    invoke-virtual {p0}, Lcom/moji/crop/CropImageView;->getWidth()I

    move-result v2

    int-to-float v2, v2

    .line 165
    invoke-virtual {p0}, Lcom/moji/crop/CropImageView;->getHeight()I

    move-result v3

    int-to-float v3, v3

    div-float/2addr v2, v1

    const v1, 0x3f19999a    # 0.6f

    mul-float v2, v2, v1

    div-float/2addr v3, v0

    mul-float v3, v3, v1

    .line 170
    invoke-static {v2, v3}, Ljava/lang/Math;->min(FF)F

    move-result v0

    .line 171
    invoke-virtual {p0}, Lcom/moji/crop/CropImageView;->getScale()F

    move-result v1

    mul-float v0, v0, v1

    const/high16 v1, 0x3f800000    # 1.0f

    .line 172
    invoke-static {v1, v0}, Ljava/lang/Math;->max(FF)F

    move-result v0

    .line 174
    invoke-virtual {p0}, Lcom/moji/crop/CropImageView;->getScale()F

    move-result v1

    sub-float v1, v0, v1

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

    move-result v1

    div-float/2addr v1, v0

    float-to-double v1, v1

    const-wide v3, 0x3fb999999999999aL    # 0.1

    cmpl-double v5, v1, v3

    if-lez v5, :cond_0

    const/4 v1, 0x2

    .line 175
    new-array v1, v1, [F

    iget-object v2, p1, Lcom/moji/crop/HighlightView;->a:Landroid/graphics/RectF;

    invoke-virtual {v2}, Landroid/graphics/RectF;->centerX()F

    move-result v2

    const/4 v3, 0x0

    aput v2, v1, v3

    iget-object v2, p1, Lcom/moji/crop/HighlightView;->a:Landroid/graphics/RectF;

    invoke-virtual {v2}, Landroid/graphics/RectF;->centerY()F

    move-result v2

    const/4 v4, 0x1

    aput v2, v1, v4

    .line 176
    invoke-virtual {p0}, Lcom/moji/crop/CropImageView;->getUnrotatedMatrix()Landroid/graphics/Matrix;

    move-result-object v2

    invoke-virtual {v2, v1}, Landroid/graphics/Matrix;->mapPoints([F)V

    .line 177
    aget v2, v1, v3

    aget v1, v1, v4

    const/high16 v3, 0x43960000    # 300.0f

    invoke-virtual {p0, v0, v2, v1, v3}, Lcom/moji/crop/CropImageView;->a(FFFF)V

    .line 180
    :cond_0
    invoke-direct {p0, p1}, Lcom/moji/crop/CropImageView;->b(Lcom/moji/crop/HighlightView;)V

    return-void
.end method


# virtual methods
.method public bridge synthetic a()V
    .locals 0

    .line 12
    invoke-super {p0}, Lcom/moji/crop/ImageViewTouchBase;->a()V

    return-void
.end method

.method protected a(FF)V
    .locals 3

    .line 79
    invoke-super {p0, p1, p2}, Lcom/moji/crop/ImageViewTouchBase;->a(FF)V

    .line 80
    iget-object v0, p0, Lcom/moji/crop/CropImageView;->a:Ljava/util/ArrayList;

    invoke-virtual {v0}, Ljava/util/ArrayList;->iterator()Ljava/util/Iterator;

    move-result-object v0

    :goto_0
    invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z

    move-result v1

    if-eqz v1, :cond_0

    invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Lcom/moji/crop/HighlightView;

    .line 81
    iget-object v2, v1, Lcom/moji/crop/HighlightView;->c:Landroid/graphics/Matrix;

    invoke-virtual {v2, p1, p2}, Landroid/graphics/Matrix;->postTranslate(FF)Z

    .line 82
    invoke-virtual {v1}, Lcom/moji/crop/HighlightView;->a()V

    goto :goto_0

    :cond_0
    return-void
.end method

.method protected a(FFF)V
    .locals 1

    .line 52
    invoke-super {p0, p1, p2, p3}, Lcom/moji/crop/ImageViewTouchBase;->a(FFF)V

    .line 53
    iget-object p1, p0, Lcom/moji/crop/CropImageView;->a:Ljava/util/ArrayList;

    invoke-virtual {p1}, Ljava/util/ArrayList;->iterator()Ljava/util/Iterator;

    move-result-object p1

    :goto_0
    invoke-interface {p1}, Ljava/util/Iterator;->hasNext()Z

    move-result p2

    if-eqz p2, :cond_0

    invoke-interface {p1}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object p2

    check-cast p2, Lcom/moji/crop/HighlightView;

    .line 54
    iget-object p3, p2, Lcom/moji/crop/HighlightView;->c:Landroid/graphics/Matrix;

    invoke-virtual {p0}, Lcom/moji/crop/CropImageView;->getUnrotatedMatrix()Landroid/graphics/Matrix;

    move-result-object v0

    invoke-virtual {p3, v0}, Landroid/graphics/Matrix;->set(Landroid/graphics/Matrix;)V

    .line 55
    invoke-virtual {p2}, Lcom/moji/crop/HighlightView;->a()V

    goto :goto_0

    :cond_0
    return-void
.end method

.method public bridge synthetic a(Landroid/graphics/Bitmap;Z)V
    .locals 0

    .line 12
    invoke-super {p0, p1, p2}, Lcom/moji/crop/ImageViewTouchBase;->a(Landroid/graphics/Bitmap;Z)V

    return-void
.end method

.method public a(Lcom/moji/crop/HighlightView;)V
    .locals 1

    .line 192
    iget-object v0, p0, Lcom/moji/crop/CropImageView;->a:Ljava/util/ArrayList;

    invoke-virtual {v0, p1}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

    .line 193
    invoke-virtual {p0}, Lcom/moji/crop/CropImageView;->invalidate()V

    return-void
.end method

.method public bridge synthetic a(Lcom/moji/crop/RotateBitmap;Z)V
    .locals 0

    .line 12
    invoke-super {p0, p1, p2}, Lcom/moji/crop/ImageViewTouchBase;->a(Lcom/moji/crop/RotateBitmap;Z)V

    return-void
.end method

.method public bridge synthetic getUnrotatedMatrix()Landroid/graphics/Matrix;
    .locals 1

    .line 12
    invoke-super {p0}, Lcom/moji/crop/ImageViewTouchBase;->getUnrotatedMatrix()Landroid/graphics/Matrix;

    move-result-object v0

    return-object v0
.end method

.method protected onDraw(Landroid/graphics/Canvas;)V
    .locals 2
    .param p1    # Landroid/graphics/Canvas;
        .annotation build Landroid/support/annotation/NonNull;
        .end annotation
    .end param

    .line 185
    invoke-super {p0, p1}, Lcom/moji/crop/ImageViewTouchBase;->onDraw(Landroid/graphics/Canvas;)V

    .line 186
    iget-object v0, p0, Lcom/moji/crop/CropImageView;->a:Ljava/util/ArrayList;

    invoke-virtual {v0}, Ljava/util/ArrayList;->iterator()Ljava/util/Iterator;

    move-result-object v0

    :goto_0
    invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z

    move-result v1

    if-eqz v1, :cond_0

    invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Lcom/moji/crop/HighlightView;

    .line 187
    invoke-virtual {v1, p1}, Lcom/moji/crop/HighlightView;->a(Landroid/graphics/Canvas;)V

    goto :goto_0

    :cond_0
    return-void
.end method

.method public bridge synthetic onKeyDown(ILandroid/view/KeyEvent;)Z
    .locals 0

    .line 12
    invoke-super {p0, p1, p2}, Lcom/moji/crop/ImageViewTouchBase;->onKeyDown(ILandroid/view/KeyEvent;)Z

    move-result p1

    return p1
.end method

.method public bridge synthetic onKeyUp(ILandroid/view/KeyEvent;)Z
    .locals 0

    .line 12
    invoke-super {p0, p1, p2}, Lcom/moji/crop/ImageViewTouchBase;->onKeyUp(ILandroid/view/KeyEvent;)Z

    move-result p1

    return p1
.end method

.method protected onLayout(ZIIII)V
    .locals 0

    .line 37
    invoke-super/range {p0 .. p5}, Lcom/moji/crop/ImageViewTouchBase;->onLayout(ZIIII)V

    .line 38
    iget-object p1, p0, Lcom/moji/crop/CropImageView;->f:Lcom/moji/crop/RotateBitmap;

    invoke-virtual {p1}, Lcom/moji/crop/RotateBitmap;->b()Landroid/graphics/Bitmap;

    move-result-object p1

    if-eqz p1, :cond_1

    .line 39
    iget-object p1, p0, Lcom/moji/crop/CropImageView;->a:Ljava/util/ArrayList;

    invoke-virtual {p1}, Ljava/util/ArrayList;->iterator()Ljava/util/Iterator;

    move-result-object p1

    :cond_0
    :goto_0
    invoke-interface {p1}, Ljava/util/Iterator;->hasNext()Z

    move-result p2

    if-eqz p2, :cond_1

    invoke-interface {p1}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object p2

    check-cast p2, Lcom/moji/crop/HighlightView;

    .line 41
    iget-object p3, p2, Lcom/moji/crop/HighlightView;->c:Landroid/graphics/Matrix;

    invoke-virtual {p0}, Lcom/moji/crop/CropImageView;->getUnrotatedMatrix()Landroid/graphics/Matrix;

    move-result-object p4

    invoke-virtual {p3, p4}, Landroid/graphics/Matrix;->set(Landroid/graphics/Matrix;)V

    .line 42
    invoke-virtual {p2}, Lcom/moji/crop/HighlightView;->a()V

    .line 43
    invoke-virtual {p2}, Lcom/moji/crop/HighlightView;->b()Z

    move-result p3

    if-eqz p3, :cond_0

    .line 44
    invoke-direct {p0, p2}, Lcom/moji/crop/CropImageView;->c(Lcom/moji/crop/HighlightView;)V

    goto :goto_0

    :cond_1
    return-void
.end method

.method public onTouchEvent(Landroid/view/MotionEvent;)Z
    .locals 6
    .param p1    # Landroid/view/MotionEvent;
        .annotation build Landroid/support/annotation/NonNull;
        .end annotation
    .end param

    .line 88
    iget-object v0, p0, Lcom/moji/crop/CropImageView;->c:Landroid/content/Context;

    check-cast v0, Lcom/moji/crop/CropImageActivity;

    .line 89
    invoke-virtual {v0}, Lcom/moji/crop/CropImageActivity;->isSaving()Z

    move-result v0

    if-eqz v0, :cond_0

    const/4 p1, 0x0

    return p1

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

    move-result v0

    const/4 v1, 0x1

    packed-switch v0, :pswitch_data_0

    goto/16 :goto_1

    .line 120
    :pswitch_0
    iget-object v0, p0, Lcom/moji/crop/CropImageView;->b:Lcom/moji/crop/HighlightView;

    if-eqz v0, :cond_1

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

    move-result v0

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

    move-result v0

    iget v2, p0, Lcom/moji/crop/CropImageView;->n:I

    if-ne v0, v2, :cond_1

    .line 121
    iget-object v0, p0, Lcom/moji/crop/CropImageView;->b:Lcom/moji/crop/HighlightView;

    iget v2, p0, Lcom/moji/crop/CropImageView;->m:I

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

    move-result v3

    iget v4, p0, Lcom/moji/crop/CropImageView;->k:F

    sub-float/2addr v3, v4

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

    move-result v4

    iget v5, p0, Lcom/moji/crop/CropImageView;->l:F

    sub-float/2addr v4, v5

    .line 121
    invoke-virtual {v0, v2, v3, v4}, Lcom/moji/crop/HighlightView;->a(IFF)V

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

    move-result v0

    iput v0, p0, Lcom/moji/crop/CropImageView;->k:F

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

    move-result p1

    iput p1, p0, Lcom/moji/crop/CropImageView;->l:F

    .line 129
    :cond_1
    invoke-virtual {p0}, Lcom/moji/crop/CropImageView;->getScale()F

    move-result p1

    const/high16 v0, 0x3f800000    # 1.0f

    cmpl-float p1, p1, v0

    if-nez p1, :cond_5

    .line 130
    invoke-virtual {p0}, Lcom/moji/crop/CropImageView;->b()V

    goto :goto_1

    .line 112
    :pswitch_1
    iget-object p1, p0, Lcom/moji/crop/CropImageView;->b:Lcom/moji/crop/HighlightView;

    if-eqz p1, :cond_2

    .line 113
    iget-object p1, p0, Lcom/moji/crop/CropImageView;->b:Lcom/moji/crop/HighlightView;

    invoke-direct {p0, p1}, Lcom/moji/crop/CropImageView;->c(Lcom/moji/crop/HighlightView;)V

    .line 114
    iget-object p1, p0, Lcom/moji/crop/CropImageView;->b:Lcom/moji/crop/HighlightView;

    sget-object v0, Lcom/moji/crop/HighlightView$ModifyMode;->None:Lcom/moji/crop/HighlightView$ModifyMode;

    invoke-virtual {p1, v0}, Lcom/moji/crop/HighlightView;->a(Lcom/moji/crop/HighlightView$ModifyMode;)V

    :cond_2
    const/4 p1, 0x0

    .line 116
    iput-object p1, p0, Lcom/moji/crop/CropImageView;->b:Lcom/moji/crop/HighlightView;

    .line 117
    invoke-virtual {p0}, Lcom/moji/crop/CropImageView;->b()V

    goto :goto_1

    .line 95
    :pswitch_2
    iget-object v0, p0, Lcom/moji/crop/CropImageView;->a:Ljava/util/ArrayList;

    invoke-virtual {v0}, Ljava/util/ArrayList;->iterator()Ljava/util/Iterator;

    move-result-object v0

    :cond_3
    invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z

    move-result v2

    if-eqz v2, :cond_5

    invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v2

    check-cast v2, Lcom/moji/crop/HighlightView;

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

    move-result v3

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

    move-result v4

    invoke-virtual {v2, v3, v4}, Lcom/moji/crop/HighlightView;->a(FF)I

    move-result v3

    if-eq v3, v1, :cond_3

    .line 98
    iput v3, p0, Lcom/moji/crop/CropImageView;->m:I

    .line 99
    iput-object v2, p0, Lcom/moji/crop/CropImageView;->b:Lcom/moji/crop/HighlightView;

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

    move-result v0

    iput v0, p0, Lcom/moji/crop/CropImageView;->k:F

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

    move-result v0

    iput v0, p0, Lcom/moji/crop/CropImageView;->l:F

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

    move-result v0

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

    move-result p1

    iput p1, p0, Lcom/moji/crop/CropImageView;->n:I

    .line 104
    iget-object p1, p0, Lcom/moji/crop/CropImageView;->b:Lcom/moji/crop/HighlightView;

    const/16 v0, 0x20

    if-ne v3, v0, :cond_4

    sget-object v0, Lcom/moji/crop/HighlightView$ModifyMode;->Move:Lcom/moji/crop/HighlightView$ModifyMode;

    goto :goto_0

    :cond_4
    sget-object v0, Lcom/moji/crop/HighlightView$ModifyMode;->Grow:Lcom/moji/crop/HighlightView$ModifyMode;

    :goto_0
    invoke-virtual {p1, v0}, Lcom/moji/crop/HighlightView;->a(Lcom/moji/crop/HighlightView$ModifyMode;)V

    :cond_5
    :goto_1
    return v1

    nop

    :pswitch_data_0
    .packed-switch 0x0
        :pswitch_2
        :pswitch_1
        :pswitch_0
    .end packed-switch
.end method

.method public bridge synthetic setImageBitmap(Landroid/graphics/Bitmap;)V
    .locals 0

    .line 12
    invoke-super {p0, p1}, Lcom/moji/crop/ImageViewTouchBase;->setImageBitmap(Landroid/graphics/Bitmap;)V

    return-void
.end method

.method public bridge synthetic setRecycler(Lcom/moji/crop/ImageViewTouchBase$Recycler;)V
    .locals 0

    .line 12
    invoke-super {p0, p1}, Lcom/moji/crop/ImageViewTouchBase;->setRecycler(Lcom/moji/crop/ImageViewTouchBase$Recycler;)V

    return-void
.end method
