BallPulseFooter.smali

.class public Lcom/scwang/smartrefresh/layout/footer/BallPulseFooter;
.super Lcom/scwang/smartrefresh/layout/internal/InternalAbstract;
.source "BallPulseFooter.java"

# interfaces
.implements Lcom/scwang/smartrefresh/layout/api/RefreshFooter;


# instance fields
.field protected mAnimatingColor:I

.field protected mCircleSpacing:F

.field protected mInterpolator:Landroid/animation/TimeInterpolator;

.field protected mIsStarted:Z

.field protected mManualAnimationColor:Z

.field protected mManualNormalColor:Z

.field protected mNormalColor:I

.field protected mPaint:Landroid/graphics/Paint;

.field protected mStartTime:J


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

    return-void
.end method

.method public constructor <init>(Landroid/content/Context;)V
    .registers 3
    .param p1, "context"    # Landroid/content/Context;

    .line 51
    const/4 v0, 0x0

    invoke-direct {p0, p1, v0}, Lcom/scwang/smartrefresh/layout/footer/BallPulseFooter;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;)V

    .line 52
    return-void
.end method

.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
    .registers 9
    .param p1, "context"    # Landroid/content/Context;
    .param p2, "attrs"    # Landroid/util/AttributeSet;

    .line 55
    const/4 v0, 0x0

    invoke-direct {p0, p1, p2, v0}, Lcom/scwang/smartrefresh/layout/internal/InternalAbstract;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V

    .line 39
    const v1, -0x111112

    iput v1, p0, Lcom/scwang/smartrefresh/layout/footer/BallPulseFooter;->mNormalColor:I

    .line 40
    const v1, -0x18a6ba

    iput v1, p0, Lcom/scwang/smartrefresh/layout/footer/BallPulseFooter;->mAnimatingColor:I

    .line 44
    const-wide/16 v1, 0x0

    iput-wide v1, p0, Lcom/scwang/smartrefresh/layout/footer/BallPulseFooter;->mStartTime:J

    .line 45
    iput-boolean v0, p0, Lcom/scwang/smartrefresh/layout/footer/BallPulseFooter;->mIsStarted:Z

    .line 46
    new-instance v1, Landroid/view/animation/AccelerateDecelerateInterpolator;

    invoke-direct {v1}, Landroid/view/animation/AccelerateDecelerateInterpolator;-><init>()V

    iput-object v1, p0, Lcom/scwang/smartrefresh/layout/footer/BallPulseFooter;->mInterpolator:Landroid/animation/TimeInterpolator;

    .line 57
    move-object v1, p0

    .line 58
    .local v1, "thisView":Landroid/view/View;
    const/high16 v2, 0x42700000    # 60.0f

    invoke-static {v2}, Lcom/scwang/smartrefresh/layout/util/SmartUtil;->dp2px(F)I

    move-result v2

    invoke-virtual {v1, v2}, Landroid/view/View;->setMinimumHeight(I)V

    .line 60
    sget-object v2, Lcom/scwang/smartrefresh/layout/R$styleable;->BallPulseFooter:[I

    invoke-virtual {p1, p2, v2}, Landroid/content/Context;->obtainStyledAttributes(Landroid/util/AttributeSet;[I)Landroid/content/res/TypedArray;

    move-result-object v2

    .line 62
    .local v2, "ta":Landroid/content/res/TypedArray;
    new-instance v3, Landroid/graphics/Paint;

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

    iput-object v3, p0, Lcom/scwang/smartrefresh/layout/footer/BallPulseFooter;->mPaint:Landroid/graphics/Paint;

    .line 63
    const/4 v4, -0x1

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

    .line 64
    iget-object v3, p0, Lcom/scwang/smartrefresh/layout/footer/BallPulseFooter;->mPaint:Landroid/graphics/Paint;

    sget-object v4, Landroid/graphics/Paint$Style;->FILL:Landroid/graphics/Paint$Style;

    invoke-virtual {v3, v4}, Landroid/graphics/Paint;->setStyle(Landroid/graphics/Paint$Style;)V

    .line 65
    iget-object v3, p0, Lcom/scwang/smartrefresh/layout/footer/BallPulseFooter;->mPaint:Landroid/graphics/Paint;

    const/4 v4, 0x1

    invoke-virtual {v3, v4}, Landroid/graphics/Paint;->setAntiAlias(Z)V

    .line 67
    sget-object v3, Lcom/scwang/smartrefresh/layout/constant/SpinnerStyle;->Translate:Lcom/scwang/smartrefresh/layout/constant/SpinnerStyle;

    iput-object v3, p0, Lcom/scwang/smartrefresh/layout/footer/BallPulseFooter;->mSpinnerStyle:Lcom/scwang/smartrefresh/layout/constant/SpinnerStyle;

    .line 68
    sget-object v3, Lcom/scwang/smartrefresh/layout/constant/SpinnerStyle;->values:[Lcom/scwang/smartrefresh/layout/constant/SpinnerStyle;

    sget v4, Lcom/scwang/smartrefresh/layout/R$styleable;->BallPulseFooter_srlClassicsSpinnerStyle:I

    iget-object v5, p0, Lcom/scwang/smartrefresh/layout/footer/BallPulseFooter;->mSpinnerStyle:Lcom/scwang/smartrefresh/layout/constant/SpinnerStyle;

    iget v5, v5, Lcom/scwang/smartrefresh/layout/constant/SpinnerStyle;->ordinal:I

    invoke-virtual {v2, v4, v5}, Landroid/content/res/TypedArray;->getInt(II)I

    move-result v4

    aget-object v3, v3, v4

    iput-object v3, p0, Lcom/scwang/smartrefresh/layout/footer/BallPulseFooter;->mSpinnerStyle:Lcom/scwang/smartrefresh/layout/constant/SpinnerStyle;

    .line 70
    sget v3, Lcom/scwang/smartrefresh/layout/R$styleable;->BallPulseFooter_srlNormalColor:I

    invoke-virtual {v2, v3}, Landroid/content/res/TypedArray;->hasValue(I)Z

    move-result v3

    if-eqz v3, :cond_68

    .line 71
    sget v3, Lcom/scwang/smartrefresh/layout/R$styleable;->BallPulseFooter_srlNormalColor:I

    invoke-virtual {v2, v3, v0}, Landroid/content/res/TypedArray;->getColor(II)I

    move-result v3

    invoke-virtual {p0, v3}, Lcom/scwang/smartrefresh/layout/footer/BallPulseFooter;->setNormalColor(I)Lcom/scwang/smartrefresh/layout/footer/BallPulseFooter;

    .line 73
    :cond_68
    sget v3, Lcom/scwang/smartrefresh/layout/R$styleable;->BallPulseFooter_srlAnimatingColor:I

    invoke-virtual {v2, v3}, Landroid/content/res/TypedArray;->hasValue(I)Z

    move-result v3

    if-eqz v3, :cond_79

    .line 74
    sget v3, Lcom/scwang/smartrefresh/layout/R$styleable;->BallPulseFooter_srlAnimatingColor:I

    invoke-virtual {v2, v3, v0}, Landroid/content/res/TypedArray;->getColor(II)I

    move-result v0

    invoke-virtual {p0, v0}, Lcom/scwang/smartrefresh/layout/footer/BallPulseFooter;->setAnimatingColor(I)Lcom/scwang/smartrefresh/layout/footer/BallPulseFooter;

    .line 77
    :cond_79
    invoke-virtual {v2}, Landroid/content/res/TypedArray;->recycle()V

    .line 79
    const/high16 v0, 0x40800000    # 4.0f

    invoke-static {v0}, Lcom/scwang/smartrefresh/layout/util/SmartUtil;->dp2px(F)I

    move-result v0

    int-to-float v0, v0

    iput v0, p0, Lcom/scwang/smartrefresh/layout/footer/BallPulseFooter;->mCircleSpacing:F

    .line 81
    return-void
.end method


# virtual methods
.method protected dispatchDraw(Landroid/graphics/Canvas;)V
    .registers 24
    .param p1, "canvas"    # Landroid/graphics/Canvas;

    .line 87
    move-object/from16 v0, p0

    move-object/from16 v1, p1

    move-object/from16 v2, p0

    .line 88
    .local v2, "thisView":Landroid/view/View;
    invoke-virtual {v2}, Landroid/view/View;->getWidth()I

    move-result v3

    .line 89
    .local v3, "width":I
    invoke-virtual {v2}, Landroid/view/View;->getHeight()I

    move-result v4

    .line 90
    .local v4, "height":I
    invoke-static {v3, v4}, Ljava/lang/Math;->min(II)I

    move-result v5

    int-to-float v5, v5

    iget v6, v0, Lcom/scwang/smartrefresh/layout/footer/BallPulseFooter;->mCircleSpacing:F

    const/high16 v7, 0x40000000    # 2.0f

    mul-float v8, v6, v7

    sub-float/2addr v5, v8

    const/high16 v8, 0x40c00000    # 6.0f

    div-float/2addr v5, v8

    .line 91
    .local v5, "radius":F
    int-to-float v8, v3

    div-float/2addr v8, v7

    mul-float v9, v5, v7

    add-float/2addr v9, v6

    sub-float/2addr v8, v9

    .line 92
    .local v8, "x":F
    int-to-float v6, v4

    div-float/2addr v6, v7

    .line 94
    .local v6, "y":F
    invoke-static {}, Ljava/lang/System;->currentTimeMillis()J

    move-result-wide v9

    .line 96
    .local v9, "now":J
    const/4 v11, 0x0

    .local v11, "i":I
    :goto_2a
    const/4 v12, 0x3

    if-ge v11, v12, :cond_9e

    .line 98
    iget-wide v12, v0, Lcom/scwang/smartrefresh/layout/footer/BallPulseFooter;->mStartTime:J

    sub-long v12, v9, v12

    add-int/lit8 v14, v11, 0x1

    mul-int/lit8 v14, v14, 0x78

    int-to-long v14, v14

    sub-long/2addr v12, v14

    .line 99
    .local v12, "time":J
    const-wide/16 v14, 0x0

    cmp-long v17, v12, v14

    if-lez v17, :cond_47

    const-wide/16 v14, 0x2ee

    rem-long v14, v12, v14

    long-to-float v14, v14

    const v15, 0x443b8000    # 750.0f

    div-float/2addr v14, v15

    goto :goto_48

    :cond_47
    const/4 v14, 0x0

    .line 100
    .local v14, "percent":F
    :goto_48
    iget-object v15, v0, Lcom/scwang/smartrefresh/layout/footer/BallPulseFooter;->mInterpolator:Landroid/animation/TimeInterpolator;

    invoke-interface {v15, v14}, Landroid/animation/TimeInterpolator;->getInterpolation(F)F

    move-result v14

    .line 102
    invoke-virtual/range {p1 .. p1}, Landroid/graphics/Canvas;->save()I

    .line 104
    const/high16 v15, 0x40000000    # 2.0f

    mul-float v17, v5, v15

    int-to-float v15, v11

    mul-float v17, v17, v15

    add-float v17, v8, v17

    iget v15, v0, Lcom/scwang/smartrefresh/layout/footer/BallPulseFooter;->mCircleSpacing:F

    int-to-float v7, v11

    mul-float v15, v15, v7

    add-float v7, v17, v15

    .line 105
    .local v7, "translateX":F
    invoke-virtual {v1, v7, v6}, Landroid/graphics/Canvas;->translate(FF)V

    .line 107
    move v15, v3

    move/from16 v17, v4

    .end local v3    # "width":I
    .end local v4    # "height":I
    .local v15, "width":I
    .local v17, "height":I
    float-to-double v3, v14

    const-wide/high16 v18, 0x3fe0000000000000L    # 0.5

    const v20, 0x3f333333    # 0.7f

    cmpg-double v21, v3, v18

    if-gez v21, :cond_7f

    .line 108
    const/high16 v3, 0x3f800000    # 1.0f

    const/high16 v4, 0x40000000    # 2.0f

    mul-float v16, v14, v4

    mul-float v16, v16, v20

    sub-float v3, v3, v16

    .line 109
    .local v3, "scale":F
    invoke-virtual {v1, v3, v3}, Landroid/graphics/Canvas;->scale(FF)V

    .line 110
    .end local v3    # "scale":F
    goto :goto_8d

    .line 111
    :cond_7f
    const/high16 v4, 0x40000000    # 2.0f

    mul-float v3, v14, v4

    mul-float v3, v3, v20

    const v16, 0x3ecccccd    # 0.4f

    sub-float v3, v3, v16

    .line 112
    .restart local v3    # "scale":F
    invoke-virtual {v1, v3, v3}, Landroid/graphics/Canvas;->scale(FF)V

    .line 115
    .end local v3    # "scale":F
    :goto_8d
    iget-object v3, v0, Lcom/scwang/smartrefresh/layout/footer/BallPulseFooter;->mPaint:Landroid/graphics/Paint;

    const/4 v4, 0x0

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

    .line 116
    invoke-virtual/range {p1 .. p1}, Landroid/graphics/Canvas;->restore()V

    .line 96
    .end local v7    # "translateX":F
    .end local v12    # "time":J
    .end local v14    # "percent":F
    add-int/lit8 v11, v11, 0x1

    move v3, v15

    move/from16 v4, v17

    const/high16 v7, 0x40000000    # 2.0f

    goto :goto_2a

    .end local v15    # "width":I
    .end local v17    # "height":I
    .local v3, "width":I
    .restart local v4    # "height":I
    :cond_9e
    move v15, v3

    move/from16 v17, v4

    .line 119
    .end local v3    # "width":I
    .end local v4    # "height":I
    .end local v11    # "i":I
    .restart local v15    # "width":I
    .restart local v17    # "height":I
    invoke-super/range {p0 .. p1}, Lcom/scwang/smartrefresh/layout/internal/InternalAbstract;->dispatchDraw(Landroid/graphics/Canvas;)V

    .line 121
    iget-boolean v3, v0, Lcom/scwang/smartrefresh/layout/footer/BallPulseFooter;->mIsStarted:Z

    if-eqz v3, :cond_ab

    .line 122
    invoke-virtual {v2}, Landroid/view/View;->invalidate()V

    .line 124
    :cond_ab
    return-void
.end method

.method public onFinish(Lcom/scwang/smartrefresh/layout/api/RefreshLayout;Z)I
    .registers 6
    .param p1, "layout"    # Lcom/scwang/smartrefresh/layout/api/RefreshLayout;
    .param p2, "success"    # Z

    .line 141
    const/4 v0, 0x0

    iput-boolean v0, p0, Lcom/scwang/smartrefresh/layout/footer/BallPulseFooter;->mIsStarted:Z

    .line 142
    const-wide/16 v1, 0x0

    iput-wide v1, p0, Lcom/scwang/smartrefresh/layout/footer/BallPulseFooter;->mStartTime:J

    .line 143
    iget-object v1, p0, Lcom/scwang/smartrefresh/layout/footer/BallPulseFooter;->mPaint:Landroid/graphics/Paint;

    iget v2, p0, Lcom/scwang/smartrefresh/layout/footer/BallPulseFooter;->mNormalColor:I

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

    .line 144
    return v0
.end method

.method public onStartAnimator(Lcom/scwang/smartrefresh/layout/api/RefreshLayout;II)V
    .registers 7
    .param p1, "layout"    # Lcom/scwang/smartrefresh/layout/api/RefreshLayout;
    .param p2, "height"    # I
    .param p3, "maxDragHeight"    # I

    .line 130
    iget-boolean v0, p0, Lcom/scwang/smartrefresh/layout/footer/BallPulseFooter;->mIsStarted:Z

    if-eqz v0, :cond_5

    return-void

    .line 132
    :cond_5
    move-object v0, p0

    .line 133
    .local v0, "thisView":Landroid/view/View;
    invoke-virtual {v0}, Landroid/view/View;->invalidate()V

    .line 134
    const/4 v1, 0x1

    iput-boolean v1, p0, Lcom/scwang/smartrefresh/layout/footer/BallPulseFooter;->mIsStarted:Z

    .line 135
    invoke-static {}, Ljava/lang/System;->currentTimeMillis()J

    move-result-wide v1

    iput-wide v1, p0, Lcom/scwang/smartrefresh/layout/footer/BallPulseFooter;->mStartTime:J

    .line 136
    iget-object v1, p0, Lcom/scwang/smartrefresh/layout/footer/BallPulseFooter;->mPaint:Landroid/graphics/Paint;

    iget v2, p0, Lcom/scwang/smartrefresh/layout/footer/BallPulseFooter;->mAnimatingColor:I

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

    .line 137
    return-void
.end method

.method public setAnimatingColor(I)Lcom/scwang/smartrefresh/layout/footer/BallPulseFooter;
    .registers 3
    .param p1, "color"    # I

    .line 181
    iput p1, p0, Lcom/scwang/smartrefresh/layout/footer/BallPulseFooter;->mAnimatingColor:I

    .line 182
    const/4 v0, 0x1

    iput-boolean v0, p0, Lcom/scwang/smartrefresh/layout/footer/BallPulseFooter;->mManualAnimationColor:Z

    .line 183
    iget-boolean v0, p0, Lcom/scwang/smartrefresh/layout/footer/BallPulseFooter;->mIsStarted:Z

    if-eqz v0, :cond_e

    .line 184
    iget-object v0, p0, Lcom/scwang/smartrefresh/layout/footer/BallPulseFooter;->mPaint:Landroid/graphics/Paint;

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

    .line 186
    :cond_e
    return-object p0
.end method

.method public setNormalColor(I)Lcom/scwang/smartrefresh/layout/footer/BallPulseFooter;
    .registers 3
    .param p1, "color"    # I

    .line 172
    iput p1, p0, Lcom/scwang/smartrefresh/layout/footer/BallPulseFooter;->mNormalColor:I

    .line 173
    const/4 v0, 0x1

    iput-boolean v0, p0, Lcom/scwang/smartrefresh/layout/footer/BallPulseFooter;->mManualNormalColor:Z

    .line 174
    iget-boolean v0, p0, Lcom/scwang/smartrefresh/layout/footer/BallPulseFooter;->mIsStarted:Z

    if-nez v0, :cond_e

    .line 175
    iget-object v0, p0, Lcom/scwang/smartrefresh/layout/footer/BallPulseFooter;->mPaint:Landroid/graphics/Paint;

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

    .line 177
    :cond_e
    return-object p0
.end method

.method public varargs setPrimaryColors([I)V
    .registers 5
    .param p1, "colors"    # [I
    .annotation runtime Ljava/lang/Deprecated;
    .end annotation

    .line 149
    iget-boolean v0, p0, Lcom/scwang/smartrefresh/layout/footer/BallPulseFooter;->mManualAnimationColor:Z

    const/4 v1, 0x1

    const/4 v2, 0x0

    if-nez v0, :cond_10

    array-length v0, p1

    if-le v0, v1, :cond_10

    .line 150
    aget v0, p1, v2

    invoke-virtual {p0, v0}, Lcom/scwang/smartrefresh/layout/footer/BallPulseFooter;->setAnimatingColor(I)Lcom/scwang/smartrefresh/layout/footer/BallPulseFooter;

    .line 151
    iput-boolean v2, p0, Lcom/scwang/smartrefresh/layout/footer/BallPulseFooter;->mManualAnimationColor:Z

    .line 153
    :cond_10
    iget-boolean v0, p0, Lcom/scwang/smartrefresh/layout/footer/BallPulseFooter;->mManualNormalColor:Z

    if-nez v0, :cond_2e

    .line 154
    array-length v0, p1

    if-le v0, v1, :cond_1d

    .line 155
    aget v0, p1, v1

    invoke-virtual {p0, v0}, Lcom/scwang/smartrefresh/layout/footer/BallPulseFooter;->setNormalColor(I)Lcom/scwang/smartrefresh/layout/footer/BallPulseFooter;

    goto :goto_2c

    .line 156
    :cond_1d
    array-length v0, p1

    if-lez v0, :cond_2c

    .line 157
    const v0, -0x66000001

    aget v1, p1, v2

    invoke-static {v0, v1}, Landroidx/core/graphics/ColorUtils;->compositeColors(II)I

    move-result v0

    invoke-virtual {p0, v0}, Lcom/scwang/smartrefresh/layout/footer/BallPulseFooter;->setNormalColor(I)Lcom/scwang/smartrefresh/layout/footer/BallPulseFooter;

    .line 159
    :cond_2c
    :goto_2c
    iput-boolean v2, p0, Lcom/scwang/smartrefresh/layout/footer/BallPulseFooter;->mManualNormalColor:Z

    .line 161
    :cond_2e
    return-void
.end method

.method public setSpinnerStyle(Lcom/scwang/smartrefresh/layout/constant/SpinnerStyle;)Lcom/scwang/smartrefresh/layout/footer/BallPulseFooter;
    .registers 2
    .param p1, "mSpinnerStyle"    # Lcom/scwang/smartrefresh/layout/constant/SpinnerStyle;

    .line 167
    iput-object p1, p0, Lcom/scwang/smartrefresh/layout/footer/BallPulseFooter;->mSpinnerStyle:Lcom/scwang/smartrefresh/layout/constant/SpinnerStyle;

    .line 168
    return-object p0
.end method