MessageBackgroundDrawable.smali

.class public Lim/tpelyyftgw/ui/components/MessageBackgroundDrawable;
.super Landroid/graphics/drawable/Drawable;
.source "MessageBackgroundDrawable.java"


# static fields
.field public static final ANIMATION_DURATION:F = 200.0f


# instance fields
.field private animationInProgress:Z

.field private currentAnimationProgress:F

.field private finalRadius:I

.field private isSelected:Z

.field private lastAnimationTime:J

.field private paint:Landroid/graphics/Paint;

.field private touchX:F

.field private touchY:F


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

    return-void
.end method

.method public constructor <init>(I)V
    .registers 4
    .param p1, "color"    # I

    .line 24
    invoke-direct {p0}, Landroid/graphics/drawable/Drawable;-><init>()V

    .line 13
    new-instance v0, Landroid/graphics/Paint;

    const/4 v1, 0x1

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

    iput-object v0, p0, Lim/tpelyyftgw/ui/components/MessageBackgroundDrawable;->paint:Landroid/graphics/Paint;

    .line 19
    const/high16 v1, -0x40800000    # -1.0f

    iput v1, p0, Lim/tpelyyftgw/ui/components/MessageBackgroundDrawable;->touchX:F

    .line 20
    iput v1, p0, Lim/tpelyyftgw/ui/components/MessageBackgroundDrawable;->touchY:F

    .line 25
    invoke-virtual {v0, p1}, Landroid/graphics/Paint;->setColor(I)V

    .line 26
    return-void
.end method

.method private calcRadius()V
    .registers 11

    .line 53
    invoke-virtual {p0}, Lim/tpelyyftgw/ui/components/MessageBackgroundDrawable;->getBounds()Landroid/graphics/Rect;

    move-result-object v0

    .line 56
    .local v0, "bounds":Landroid/graphics/Rect;
    iget v1, p0, Lim/tpelyyftgw/ui/components/MessageBackgroundDrawable;->touchX:F

    const/4 v2, 0x0

    cmpl-float v1, v1, v2

    if-ltz v1, :cond_16

    iget v1, p0, Lim/tpelyyftgw/ui/components/MessageBackgroundDrawable;->touchY:F

    cmpl-float v1, v1, v2

    if-ltz v1, :cond_16

    .line 57
    iget v1, p0, Lim/tpelyyftgw/ui/components/MessageBackgroundDrawable;->touchX:F

    .line 58
    .local v1, "x1":F
    iget v2, p0, Lim/tpelyyftgw/ui/components/MessageBackgroundDrawable;->touchY:F

    .local v2, "y1":F
    goto :goto_20

    .line 60
    .end local v1    # "x1":F
    .end local v2    # "y1":F
    :cond_16
    invoke-virtual {v0}, Landroid/graphics/Rect;->centerX()I

    move-result v1

    int-to-float v1, v1

    .line 61
    .restart local v1    # "x1":F
    invoke-virtual {v0}, Landroid/graphics/Rect;->centerY()I

    move-result v2

    int-to-float v2, v2

    .line 63
    .restart local v2    # "y1":F
    :goto_20
    const/4 v3, 0x0

    iput v3, p0, Lim/tpelyyftgw/ui/components/MessageBackgroundDrawable;->finalRadius:I

    .line 64
    const/4 v3, 0x0

    .local v3, "a":I
    :goto_24
    const/4 v4, 0x4

    if-ge v3, v4, :cond_6d

    .line 67
    if-eqz v3, :cond_44

    const/4 v4, 0x1

    if-eq v3, v4, :cond_3d

    const/4 v4, 0x2

    if-eq v3, v4, :cond_36

    .line 82
    iget v4, v0, Landroid/graphics/Rect;->right:I

    int-to-float v4, v4

    .line 83
    .local v4, "x2":F
    iget v5, v0, Landroid/graphics/Rect;->bottom:I

    int-to-float v5, v5

    .local v5, "y2":F
    goto :goto_4b

    .line 77
    .end local v4    # "x2":F
    .end local v5    # "y2":F
    :cond_36
    iget v4, v0, Landroid/graphics/Rect;->right:I

    int-to-float v4, v4

    .line 78
    .restart local v4    # "x2":F
    iget v5, v0, Landroid/graphics/Rect;->top:I

    int-to-float v5, v5

    .line 79
    .restart local v5    # "y2":F
    goto :goto_4b

    .line 73
    .end local v4    # "x2":F
    .end local v5    # "y2":F
    :cond_3d
    iget v4, v0, Landroid/graphics/Rect;->left:I

    int-to-float v4, v4

    .line 74
    .restart local v4    # "x2":F
    iget v5, v0, Landroid/graphics/Rect;->bottom:I

    int-to-float v5, v5

    .line 75
    .restart local v5    # "y2":F
    goto :goto_4b

    .line 69
    .end local v4    # "x2":F
    .end local v5    # "y2":F
    :cond_44
    iget v4, v0, Landroid/graphics/Rect;->left:I

    int-to-float v4, v4

    .line 70
    .restart local v4    # "x2":F
    iget v5, v0, Landroid/graphics/Rect;->top:I

    int-to-float v5, v5

    .line 71
    .restart local v5    # "y2":F
    nop

    .line 86
    :goto_4b
    iget v6, p0, Lim/tpelyyftgw/ui/components/MessageBackgroundDrawable;->finalRadius:I

    sub-float v7, v4, v1

    sub-float v8, v4, v1

    mul-float v7, v7, v8

    sub-float v8, v5, v2

    sub-float v9, v5, v2

    mul-float v8, v8, v9

    add-float/2addr v7, v8

    float-to-double v7, v7

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

    move-result-wide v7

    invoke-static {v7, v8}, Ljava/lang/Math;->ceil(D)D

    move-result-wide v7

    double-to-int v7, v7

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

    move-result v6

    iput v6, p0, Lim/tpelyyftgw/ui/components/MessageBackgroundDrawable;->finalRadius:I

    .line 64
    .end local v4    # "x2":F
    .end local v5    # "y2":F
    add-int/lit8 v3, v3, 0x1

    goto :goto_24

    .line 88
    .end local v3    # "a":I
    :cond_6d
    return-void
.end method


# virtual methods
.method public draw(Landroid/graphics/Canvas;)V
    .registers 13
    .param p1, "canvas"    # Landroid/graphics/Canvas;

    .line 126
    iget-boolean v0, p0, Lim/tpelyyftgw/ui/components/MessageBackgroundDrawable;->animationInProgress:Z

    const/high16 v1, 0x3f800000    # 1.0f

    const/4 v2, 0x0

    if-eqz v0, :cond_47

    .line 127
    invoke-static {}, Landroid/os/SystemClock;->uptimeMillis()J

    move-result-wide v3

    .line 128
    .local v3, "newTime":J
    iget-wide v5, p0, Lim/tpelyyftgw/ui/components/MessageBackgroundDrawable;->lastAnimationTime:J

    sub-long v5, v3, v5

    .line 129
    .local v5, "dt":J
    iput-wide v3, p0, Lim/tpelyyftgw/ui/components/MessageBackgroundDrawable;->lastAnimationTime:J

    .line 131
    iget-boolean v0, p0, Lim/tpelyyftgw/ui/components/MessageBackgroundDrawable;->isSelected:Z

    const/4 v7, 0x0

    const/high16 v8, 0x43480000    # 200.0f

    const/high16 v9, -0x40800000    # -1.0f

    if-eqz v0, :cond_31

    .line 132
    iget v0, p0, Lim/tpelyyftgw/ui/components/MessageBackgroundDrawable;->currentAnimationProgress:F

    long-to-float v10, v5

    div-float/2addr v10, v8

    add-float/2addr v0, v10

    iput v0, p0, Lim/tpelyyftgw/ui/components/MessageBackgroundDrawable;->currentAnimationProgress:F

    .line 133
    cmpl-float v0, v0, v1

    if-ltz v0, :cond_2d

    .line 134
    iput v9, p0, Lim/tpelyyftgw/ui/components/MessageBackgroundDrawable;->touchX:F

    .line 135
    iput v9, p0, Lim/tpelyyftgw/ui/components/MessageBackgroundDrawable;->touchY:F

    .line 136
    iput v1, p0, Lim/tpelyyftgw/ui/components/MessageBackgroundDrawable;->currentAnimationProgress:F

    .line 137
    iput-boolean v7, p0, Lim/tpelyyftgw/ui/components/MessageBackgroundDrawable;->animationInProgress:Z

    .line 139
    :cond_2d
    invoke-virtual {p0}, Lim/tpelyyftgw/ui/components/MessageBackgroundDrawable;->invalidateSelf()V

    goto :goto_47

    .line 141
    :cond_31
    iget v0, p0, Lim/tpelyyftgw/ui/components/MessageBackgroundDrawable;->currentAnimationProgress:F

    long-to-float v10, v5

    div-float/2addr v10, v8

    sub-float/2addr v0, v10

    iput v0, p0, Lim/tpelyyftgw/ui/components/MessageBackgroundDrawable;->currentAnimationProgress:F

    .line 142
    cmpg-float v0, v0, v2

    if-gtz v0, :cond_44

    .line 143
    iput v9, p0, Lim/tpelyyftgw/ui/components/MessageBackgroundDrawable;->touchX:F

    .line 144
    iput v9, p0, Lim/tpelyyftgw/ui/components/MessageBackgroundDrawable;->touchY:F

    .line 145
    iput v2, p0, Lim/tpelyyftgw/ui/components/MessageBackgroundDrawable;->currentAnimationProgress:F

    .line 146
    iput-boolean v7, p0, Lim/tpelyyftgw/ui/components/MessageBackgroundDrawable;->animationInProgress:Z

    .line 148
    :cond_44
    invoke-virtual {p0}, Lim/tpelyyftgw/ui/components/MessageBackgroundDrawable;->invalidateSelf()V

    .line 151
    .end local v3    # "newTime":J
    .end local v5    # "dt":J
    :cond_47
    :goto_47
    iget v0, p0, Lim/tpelyyftgw/ui/components/MessageBackgroundDrawable;->currentAnimationProgress:F

    cmpl-float v1, v0, v1

    if-nez v1, :cond_57

    .line 152
    invoke-virtual {p0}, Lim/tpelyyftgw/ui/components/MessageBackgroundDrawable;->getBounds()Landroid/graphics/Rect;

    move-result-object v0

    iget-object v1, p0, Lim/tpelyyftgw/ui/components/MessageBackgroundDrawable;->paint:Landroid/graphics/Paint;

    invoke-virtual {p1, v0, v1}, Landroid/graphics/Canvas;->drawRect(Landroid/graphics/Rect;Landroid/graphics/Paint;)V

    goto :goto_8e

    .line 153
    :cond_57
    cmpl-float v0, v0, v2

    if-eqz v0, :cond_8e

    .line 156
    iget v0, p0, Lim/tpelyyftgw/ui/components/MessageBackgroundDrawable;->touchX:F

    cmpl-float v0, v0, v2

    if-ltz v0, :cond_6c

    iget v0, p0, Lim/tpelyyftgw/ui/components/MessageBackgroundDrawable;->touchY:F

    cmpl-float v0, v0, v2

    if-ltz v0, :cond_6c

    .line 157
    iget v0, p0, Lim/tpelyyftgw/ui/components/MessageBackgroundDrawable;->touchX:F

    .line 158
    .local v0, "x1":F
    iget v1, p0, Lim/tpelyyftgw/ui/components/MessageBackgroundDrawable;->touchY:F

    .local v1, "y1":F
    goto :goto_7c

    .line 160
    .end local v0    # "x1":F
    .end local v1    # "y1":F
    :cond_6c
    invoke-virtual {p0}, Lim/tpelyyftgw/ui/components/MessageBackgroundDrawable;->getBounds()Landroid/graphics/Rect;

    move-result-object v0

    .line 161
    .local v0, "bounds":Landroid/graphics/Rect;
    invoke-virtual {v0}, Landroid/graphics/Rect;->centerX()I

    move-result v1

    int-to-float v1, v1

    .line 162
    .local v1, "x1":F
    invoke-virtual {v0}, Landroid/graphics/Rect;->centerY()I

    move-result v2

    int-to-float v2, v2

    move v0, v1

    move v1, v2

    .line 164
    .local v0, "x1":F
    .local v1, "y1":F
    :goto_7c
    iget v2, p0, Lim/tpelyyftgw/ui/components/MessageBackgroundDrawable;->finalRadius:I

    int-to-float v2, v2

    sget-object v3, Lim/tpelyyftgw/ui/components/CubicBezierInterpolator;->EASE_OUT:Lim/tpelyyftgw/ui/components/CubicBezierInterpolator;

    iget v4, p0, Lim/tpelyyftgw/ui/components/MessageBackgroundDrawable;->currentAnimationProgress:F

    invoke-virtual {v3, v4}, Lim/tpelyyftgw/ui/components/CubicBezierInterpolator;->getInterpolation(F)F

    move-result v3

    mul-float v2, v2, v3

    iget-object v3, p0, Lim/tpelyyftgw/ui/components/MessageBackgroundDrawable;->paint:Landroid/graphics/Paint;

    invoke-virtual {p1, v0, v1, v2, v3}, Landroid/graphics/Canvas;->drawCircle(FFFLandroid/graphics/Paint;)V

    .line 166
    .end local v0    # "x1":F
    .end local v1    # "y1":F
    :cond_8e
    :goto_8e
    return-void
.end method

.method public getOpacity()I
    .registers 2

    .line 116
    const/4 v0, -0x2

    return v0
.end method

.method public setAlpha(I)V
    .registers 3
    .param p1, "alpha"    # I

    .line 121
    iget-object v0, p0, Lim/tpelyyftgw/ui/components/MessageBackgroundDrawable;->paint:Landroid/graphics/Paint;

    invoke-virtual {v0, p1}, Landroid/graphics/Paint;->setAlpha(I)V

    .line 122
    return-void
.end method

.method public setBounds(IIII)V
    .registers 5
    .param p1, "left"    # I
    .param p2, "top"    # I
    .param p3, "right"    # I
    .param p4, "bottom"    # I

    .line 99
    invoke-super {p0, p1, p2, p3, p4}, Landroid/graphics/drawable/Drawable;->setBounds(IIII)V

    .line 100
    invoke-direct {p0}, Lim/tpelyyftgw/ui/components/MessageBackgroundDrawable;->calcRadius()V

    .line 101
    return-void
.end method

.method public setBounds(Landroid/graphics/Rect;)V
    .registers 2
    .param p1, "bounds"    # Landroid/graphics/Rect;

    .line 105
    invoke-super {p0, p1}, Landroid/graphics/drawable/Drawable;->setBounds(Landroid/graphics/Rect;)V

    .line 106
    invoke-direct {p0}, Lim/tpelyyftgw/ui/components/MessageBackgroundDrawable;->calcRadius()V

    .line 107
    return-void
.end method

.method public setColor(I)V
    .registers 3
    .param p1, "color"    # I

    .line 29
    iget-object v0, p0, Lim/tpelyyftgw/ui/components/MessageBackgroundDrawable;->paint:Landroid/graphics/Paint;

    invoke-virtual {v0, p1}, Landroid/graphics/Paint;->setColor(I)V

    .line 30
    return-void
.end method

.method public setColorFilter(Landroid/graphics/ColorFilter;)V
    .registers 3
    .param p1, "colorFilter"    # Landroid/graphics/ColorFilter;

    .line 111
    iget-object v0, p0, Lim/tpelyyftgw/ui/components/MessageBackgroundDrawable;->paint:Landroid/graphics/Paint;

    invoke-virtual {v0, p1}, Landroid/graphics/Paint;->setColorFilter(Landroid/graphics/ColorFilter;)Landroid/graphics/ColorFilter;

    .line 112
    return-void
.end method

.method public setSelected(ZZ)V
    .registers 6
    .param p1, "selected"    # Z
    .param p2, "animated"    # Z

    .line 33
    const/4 p2, 0x0

    .line 34
    iget-boolean v0, p0, Lim/tpelyyftgw/ui/components/MessageBackgroundDrawable;->isSelected:Z

    const/high16 v1, 0x3f800000    # 1.0f

    const/4 v2, 0x0

    if-ne v0, p1, :cond_18

    .line 35
    iget-boolean v0, p0, Lim/tpelyyftgw/ui/components/MessageBackgroundDrawable;->animationInProgress:Z

    if-eq v0, p2, :cond_17

    if-nez p2, :cond_17

    .line 36
    if-eqz p1, :cond_11

    goto :goto_12

    :cond_11
    const/4 v1, 0x0

    :goto_12
    iput v1, p0, Lim/tpelyyftgw/ui/components/MessageBackgroundDrawable;->currentAnimationProgress:F

    .line 37
    const/4 v0, 0x0

    iput-boolean v0, p0, Lim/tpelyyftgw/ui/components/MessageBackgroundDrawable;->animationInProgress:Z

    .line 39
    :cond_17
    return-void

    .line 41
    :cond_18
    iput-boolean p1, p0, Lim/tpelyyftgw/ui/components/MessageBackgroundDrawable;->isSelected:Z

    .line 42
    iput-boolean p2, p0, Lim/tpelyyftgw/ui/components/MessageBackgroundDrawable;->animationInProgress:Z

    .line 43
    if-eqz p2, :cond_25

    .line 44
    invoke-static {}, Landroid/os/SystemClock;->uptimeMillis()J

    move-result-wide v0

    iput-wide v0, p0, Lim/tpelyyftgw/ui/components/MessageBackgroundDrawable;->lastAnimationTime:J

    goto :goto_2b

    .line 46
    :cond_25
    if-eqz p1, :cond_28

    goto :goto_29

    :cond_28
    const/4 v1, 0x0

    :goto_29
    iput v1, p0, Lim/tpelyyftgw/ui/components/MessageBackgroundDrawable;->currentAnimationProgress:F

    .line 48
    :goto_2b
    invoke-direct {p0}, Lim/tpelyyftgw/ui/components/MessageBackgroundDrawable;->calcRadius()V

    .line 49
    invoke-virtual {p0}, Lim/tpelyyftgw/ui/components/MessageBackgroundDrawable;->invalidateSelf()V

    .line 50
    return-void
.end method

.method public setTouchCoords(FF)V
    .registers 3
    .param p1, "x"    # F
    .param p2, "y"    # F

    .line 91
    iput p1, p0, Lim/tpelyyftgw/ui/components/MessageBackgroundDrawable;->touchX:F

    .line 92
    iput p2, p0, Lim/tpelyyftgw/ui/components/MessageBackgroundDrawable;->touchY:F

    .line 93
    invoke-direct {p0}, Lim/tpelyyftgw/ui/components/MessageBackgroundDrawable;->calcRadius()V

    .line 94
    invoke-virtual {p0}, Lim/tpelyyftgw/ui/components/MessageBackgroundDrawable;->invalidateSelf()V

    .line 95
    return-void
.end method