WaterDropDrawable.smali
.class Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable;
.super Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/AbstractRefreshDrawable;
# interfaces
.implements Ljava/lang/Runnable;
# annotations
.annotation system Ldalvik/annotation/MemberClasses;
value = {
Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable$ProgressStates;
}
.end annotation
# static fields
.field private static final CIRCLE_COUNT:F
.field private static final MAX_COLOR_COUNT:I = 0x4
.field private static final MAX_LEVEL:F = 10000.0f
.field private static final MAX_LEVEL_PER_CIRCLE:F
# instance fields
.field private isRunning:Z
.field private mColorSchemeColors:[I
.field private mCurrentState:Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable$ProgressStates;
.field private mHandler:Landroid/os/Handler;
.field private mHeight:I
.field private mLevel:I
.field private mPaint:Landroid/graphics/Paint;
.field private mPath:Landroid/graphics/Path;
.field private mTop:I
.field private mWidth:I
.field private p1:Landroid/graphics/Point;
.field private p2:Landroid/graphics/Point;
.field private p3:Landroid/graphics/Point;
.field private p4:Landroid/graphics/Point;
# direct methods
.method static constructor <clinit>()V
.registers 2
invoke-static {}, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable$ProgressStates;->values()[Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable$ProgressStates;
move-result-object v0
array-length v0, v0
int-to-float v0, v0
sput v0, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable;->CIRCLE_COUNT:F
const v0, 0x461c4000 # 10000.0f
sget v1, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable;->CIRCLE_COUNT:F
div-float/2addr v0, v1
sput v0, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable;->MAX_LEVEL_PER_CIRCLE:F
return-void
.end method
.method public constructor <init>(Landroid/content/Context;Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/PullRefreshLayout;)V
.registers 5
invoke-direct {p0, p1, p2}, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/AbstractRefreshDrawable;-><init>(Landroid/content/Context;Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/PullRefreshLayout;)V
new-instance v0, Landroid/os/Handler;
invoke-direct {v0}, Landroid/os/Handler;-><init>()V
iput-object v0, p0, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable;->mHandler:Landroid/os/Handler;
new-instance v0, Landroid/graphics/Paint;
invoke-direct {v0}, Landroid/graphics/Paint;-><init>()V
iput-object v0, p0, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable;->mPaint:Landroid/graphics/Paint;
iget-object v0, p0, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable;->mPaint:Landroid/graphics/Paint;
const v1, -0xffff01
invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setColor(I)V
iget-object v0, p0, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable;->mPaint:Landroid/graphics/Paint;
sget-object v1, Landroid/graphics/Paint$Style;->FILL:Landroid/graphics/Paint$Style;
invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setStyle(Landroid/graphics/Paint$Style;)V
iget-object v0, p0, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable;->mPaint:Landroid/graphics/Paint;
const/4 v1, 0x1
invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setAntiAlias(Z)V
new-instance v0, Landroid/graphics/Path;
invoke-direct {v0}, Landroid/graphics/Path;-><init>()V
iput-object v0, p0, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable;->mPath:Landroid/graphics/Path;
new-instance v0, Landroid/graphics/Point;
invoke-direct {v0}, Landroid/graphics/Point;-><init>()V
iput-object v0, p0, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable;->p1:Landroid/graphics/Point;
new-instance v0, Landroid/graphics/Point;
invoke-direct {v0}, Landroid/graphics/Point;-><init>()V
iput-object v0, p0, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable;->p2:Landroid/graphics/Point;
new-instance v0, Landroid/graphics/Point;
invoke-direct {v0}, Landroid/graphics/Point;-><init>()V
iput-object v0, p0, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable;->p3:Landroid/graphics/Point;
new-instance v0, Landroid/graphics/Point;
invoke-direct {v0}, Landroid/graphics/Point;-><init>()V
iput-object v0, p0, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable;->p4:Landroid/graphics/Point;
return-void
.end method
.method private evaluate(FII)I
.registers 12
shr-int/lit8 v0, p2, 0x18
and-int/lit16 v0, v0, 0xff
shr-int/lit8 v1, p2, 0x10
and-int/lit16 v1, v1, 0xff
shr-int/lit8 v2, p2, 0x8
and-int/lit16 v2, v2, 0xff
and-int/lit16 v3, p2, 0xff
shr-int/lit8 v4, p3, 0x18
and-int/lit16 v4, v4, 0xff
shr-int/lit8 v5, p3, 0x10
and-int/lit16 v5, v5, 0xff
shr-int/lit8 v6, p3, 0x8
and-int/lit16 v6, v6, 0xff
and-int/lit16 v7, p3, 0xff
sub-int/2addr v4, v0
int-to-float v4, v4
mul-float/2addr v4, p1
float-to-int v4, v4
add-int/2addr v0, v4
shl-int/lit8 v0, v0, 0x18
sub-int v4, v5, v1
int-to-float v4, v4
mul-float/2addr v4, p1
float-to-int v4, v4
add-int/2addr v1, v4
shl-int/lit8 v1, v1, 0x10
or-int/2addr v0, v1
sub-int v1, v6, v2
int-to-float v1, v1
mul-float/2addr v1, p1
float-to-int v1, v1
add-int/2addr v1, v2
shl-int/lit8 v1, v1, 0x8
or-int/2addr v0, v1
sub-int v1, v7, v3
int-to-float v1, v1
mul-float/2addr v1, p1
float-to-int v1, v1
add-int/2addr v1, v3
or-int/2addr v0, v1
return v0
.end method
.method private updateBounds()V
.registers 6
iget v0, p0, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable;->mHeight:I
iget v1, p0, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable;->mWidth:I
invoke-virtual {p0}, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable;->getRefreshLayout()Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/PullRefreshLayout;
move-result-object v2
invoke-virtual {v2}, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/PullRefreshLayout;->getFinalOffset()I
move-result v2
if-le v0, v2, :cond_16
invoke-virtual {p0}, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable;->getRefreshLayout()Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/PullRefreshLayout;
move-result-object v0
invoke-virtual {v0}, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/PullRefreshLayout;->getFinalOffset()I
move-result v0
:cond_16
int-to-float v2, v0
invoke-virtual {p0}, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable;->getRefreshLayout()Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/PullRefreshLayout;
move-result-object v3
invoke-virtual {v3}, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/PullRefreshLayout;->getFinalOffset()I
move-result v3
int-to-float v3, v3
div-float/2addr v2, v3
div-int/lit8 v3, v1, 0x2
int-to-float v3, v3
mul-float/2addr v2, v3
float-to-int v2, v2
const/4 v3, 0x0
iget-object v4, p0, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable;->p1:Landroid/graphics/Point;
invoke-virtual {v4, v2, v3}, Landroid/graphics/Point;->set(II)V
iget-object v4, p0, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable;->p2:Landroid/graphics/Point;
sub-int v2, v1, v2
invoke-virtual {v4, v2, v3}, Landroid/graphics/Point;->set(II)V
iget-object v2, p0, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable;->p3:Landroid/graphics/Point;
div-int/lit8 v3, v1, 0x2
sub-int/2addr v3, v0
invoke-virtual {v2, v3, v0}, Landroid/graphics/Point;->set(II)V
iget-object v2, p0, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable;->p4:Landroid/graphics/Point;
div-int/lit8 v1, v1, 0x2
add-int/2addr v1, v0
invoke-virtual {v2, v1, v0}, Landroid/graphics/Point;->set(II)V
return-void
.end method
.method private updateLevel(I)V
.registers 7
int-to-float v0, p1
const v1, 0x461c4000 # 10000.0f
cmpl-float v0, v0, v1
if-nez v0, :cond_37
const/4 v0, 0x0
:goto_9
int-to-float v0, v0
sget v1, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable;->MAX_LEVEL_PER_CIRCLE:F
div-float/2addr v0, v1
float-to-int v0, v0
invoke-static {}, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable$ProgressStates;->values()[Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable$ProgressStates;
move-result-object v1
aget-object v1, v1, v0
iput-object v1, p0, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable;->mCurrentState:Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable$ProgressStates;
rem-int/lit16 v1, p1, 0x9c4
int-to-float v1, v1
const v2, 0x451c4000 # 2500.0f
div-float/2addr v1, v2
iget-object v2, p0, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable;->mColorSchemeColors:[I
aget v2, v2, v0
iget-object v3, p0, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable;->mColorSchemeColors:[I
add-int/lit8 v0, v0, 0x1
invoke-static {}, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable$ProgressStates;->values()[Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable$ProgressStates;
move-result-object v4
array-length v4, v4
rem-int/2addr v0, v4
aget v0, v3, v0
iget-object v3, p0, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable;->mPaint:Landroid/graphics/Paint;
invoke-direct {p0, v1, v2, v0}, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable;->evaluate(FII)I
move-result v0
invoke-virtual {v3, v0}, Landroid/graphics/Paint;->setColor(I)V
return-void
:cond_37
move v0, p1
goto :goto_9
.end method
# virtual methods
.method public draw(Landroid/graphics/Canvas;)V
.registers 9
const/4 v1, 0x0
invoke-virtual {p1}, Landroid/graphics/Canvas;->save()I
iget v0, p0, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable;->mTop:I
if-lez v0, :cond_50
iget v0, p0, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable;->mTop:I
int-to-float v0, v0
:goto_b
invoke-virtual {p1, v1, v0}, Landroid/graphics/Canvas;->translate(FF)V
iget-object v0, p0, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable;->mPath:Landroid/graphics/Path;
invoke-virtual {v0}, Landroid/graphics/Path;->reset()V
iget-object v0, p0, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable;->mPath:Landroid/graphics/Path;
iget-object v1, p0, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable;->p1:Landroid/graphics/Point;
iget v1, v1, Landroid/graphics/Point;->x:I
int-to-float v1, v1
iget-object v2, p0, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable;->p1:Landroid/graphics/Point;
iget v2, v2, Landroid/graphics/Point;->y:I
int-to-float v2, v2
invoke-virtual {v0, v1, v2}, Landroid/graphics/Path;->moveTo(FF)V
iget-object v0, p0, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable;->mPath:Landroid/graphics/Path;
iget-object v1, p0, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable;->p3:Landroid/graphics/Point;
iget v1, v1, Landroid/graphics/Point;->x:I
int-to-float v1, v1
iget-object v2, p0, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable;->p3:Landroid/graphics/Point;
iget v2, v2, Landroid/graphics/Point;->y:I
int-to-float v2, v2
iget-object v3, p0, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable;->p4:Landroid/graphics/Point;
iget v3, v3, Landroid/graphics/Point;->x:I
int-to-float v3, v3
iget-object v4, p0, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable;->p4:Landroid/graphics/Point;
iget v4, v4, Landroid/graphics/Point;->y:I
int-to-float v4, v4
iget-object v5, p0, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable;->p2:Landroid/graphics/Point;
iget v5, v5, Landroid/graphics/Point;->x:I
int-to-float v5, v5
iget-object v6, p0, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable;->p2:Landroid/graphics/Point;
iget v6, v6, Landroid/graphics/Point;->y:I
int-to-float v6, v6
invoke-virtual/range {v0 .. v6}, Landroid/graphics/Path;->cubicTo(FFFFFF)V
iget-object v0, p0, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable;->mPath:Landroid/graphics/Path;
iget-object v1, p0, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable;->mPaint:Landroid/graphics/Paint;
invoke-virtual {p1, v0, v1}, Landroid/graphics/Canvas;->drawPath(Landroid/graphics/Path;Landroid/graphics/Paint;)V
invoke-virtual {p1}, Landroid/graphics/Canvas;->restore()V
return-void
:cond_50
move v0, v1
goto :goto_b
.end method
.method public isRunning()Z
.registers 2
iget-boolean v0, p0, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable;->isRunning:Z
return v0
.end method
.method public offsetTopAndBottom(I)V
.registers 4
iget v0, p0, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable;->mHeight:I
add-int/2addr v0, p1
iput v0, p0, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable;->mHeight:I
iget v0, p0, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable;->mHeight:I
invoke-virtual {p0}, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable;->getRefreshLayout()Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/PullRefreshLayout;
move-result-object v1
invoke-virtual {v1}, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/PullRefreshLayout;->getFinalOffset()I
move-result v1
sub-int/2addr v0, v1
iput v0, p0, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable;->mTop:I
invoke-direct {p0}, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable;->updateBounds()V
invoke-virtual {p0}, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable;->invalidateSelf()V
return-void
.end method
.method protected onBoundsChange(Landroid/graphics/Rect;)V
.registers 3
invoke-virtual {p1}, Landroid/graphics/Rect;->width()I
move-result v0
iput v0, p0, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable;->mWidth:I
invoke-direct {p0}, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable;->updateBounds()V
invoke-super {p0, p1}, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/AbstractRefreshDrawable;->onBoundsChange(Landroid/graphics/Rect;)V
return-void
.end method
.method public run()V
.registers 5
iget v0, p0, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable;->mLevel:I
add-int/lit8 v0, v0, 0x3c
iput v0, p0, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable;->mLevel:I
iget v0, p0, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable;->mLevel:I
int-to-float v0, v0
const v1, 0x461c4000 # 10000.0f
cmpl-float v0, v0, v1
if-lez v0, :cond_13
const/4 v0, 0x0
iput v0, p0, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable;->mLevel:I
:cond_13
iget-boolean v0, p0, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable;->isRunning:Z
if-eqz v0, :cond_26
iget-object v0, p0, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable;->mHandler:Landroid/os/Handler;
const-wide/16 v2, 0x14
invoke-virtual {v0, p0, v2, v3}, Landroid/os/Handler;->postDelayed(Ljava/lang/Runnable;J)Z
iget v0, p0, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable;->mLevel:I
invoke-direct {p0, v0}, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable;->updateLevel(I)V
invoke-virtual {p0}, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable;->invalidateSelf()V
:cond_26
return-void
.end method
.method public setColorSchemeColors([I)V
.registers 4
if-eqz p1, :cond_6
array-length v0, p1
const/4 v1, 0x4
if-ge v0, v1, :cond_f
:cond_6
new-instance v0, Ljava/security/InvalidParameterException;
const-string/jumbo v1, "The color scheme length must be 4"
invoke-direct {v0, v1}, Ljava/security/InvalidParameterException;-><init>(Ljava/lang/String;)V
throw v0
:cond_f
iget-object v0, p0, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable;->mPaint:Landroid/graphics/Paint;
const/4 v1, 0x0
aget v1, p1, v1
invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setColor(I)V
iput-object p1, p0, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable;->mColorSchemeColors:[I
return-void
.end method
.method public setPercent(F)V
.registers 6
iget-object v0, p0, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable;->mPaint:Landroid/graphics/Paint;
iget-object v1, p0, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable;->mColorSchemeColors:[I
const/4 v2, 0x0
aget v1, v1, v2
iget-object v2, p0, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable;->mColorSchemeColors:[I
const/4 v3, 0x1
aget v2, v2, v3
invoke-direct {p0, p1, v1, v2}, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable;->evaluate(FII)I
move-result v1
invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setColor(I)V
return-void
.end method
.method public start()V
.registers 5
const/16 v0, 0x9c4
iput v0, p0, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable;->mLevel:I
const/4 v0, 0x1
iput-boolean v0, p0, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable;->isRunning:Z
iget-object v0, p0, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable;->mHandler:Landroid/os/Handler;
const-wide/16 v2, 0x14
invoke-virtual {v0, p0, v2, v3}, Landroid/os/Handler;->postDelayed(Ljava/lang/Runnable;J)Z
return-void
.end method
.method public stop()V
.registers 2
iget-object v0, p0, Lcom/sdk/orion/ui/baselibrary/widget/pullrefresh/WaterDropDrawable;->mHandler:Landroid/os/Handler;
invoke-virtual {v0, p0}, Landroid/os/Handler;->removeCallbacks(Ljava/lang/Runnable;)V
return-void
.end method