ProgressView.smali
.class public Lcom/rey/material/widget/ProgressView;
.super Landroid/view/View;
.source "ProgressView.java"
# interfaces
.implements Lcom/rey/material/app/ThemeManager$OnThemeChangedListener;
# static fields
.field public static final MODE_BUFFER:I = 0x2
.field public static final MODE_DETERMINATE:I = 0x0
.field public static final MODE_INDETERMINATE:I = 0x1
.field public static final MODE_QUERY:I = 0x3
# instance fields
.field private mAutostart:Z
.field private mCircular:Z
.field protected mCurrentStyle:I
.field private mProgressDrawable:Landroid/graphics/drawable/Drawable;
.field private mProgressId:I
.field protected mStyleId:I
# direct methods
.method public constructor <init>(Landroid/content/Context;)V
.registers 4
.line 35
invoke-direct {p0, p1}, Landroid/view/View;-><init>(Landroid/content/Context;)V
const/high16 v0, -0x80000000
.line 20
iput v0, p0, Lcom/rey/material/widget/ProgressView;->mCurrentStyle:I
const/4 v0, 0x0
.line 22
iput-boolean v0, p0, Lcom/rey/material/widget/ProgressView;->mAutostart:Z
const/4 v1, 0x1
.line 23
iput-boolean v1, p0, Lcom/rey/material/widget/ProgressView;->mCircular:Z
const/4 v1, 0x0
.line 37
invoke-virtual {p0, p1, v1, v0, v0}, Lcom/rey/material/widget/ProgressView;->init(Landroid/content/Context;Landroid/util/AttributeSet;II)V
return-void
.end method
.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
.registers 5
.line 41
invoke-direct {p0, p1, p2}, Landroid/view/View;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
const/high16 v0, -0x80000000
.line 20
iput v0, p0, Lcom/rey/material/widget/ProgressView;->mCurrentStyle:I
const/4 v0, 0x0
.line 22
iput-boolean v0, p0, Lcom/rey/material/widget/ProgressView;->mAutostart:Z
const/4 v1, 0x1
.line 23
iput-boolean v1, p0, Lcom/rey/material/widget/ProgressView;->mCircular:Z
.line 43
invoke-virtual {p0, p1, p2, v0, v0}, Lcom/rey/material/widget/ProgressView;->init(Landroid/content/Context;Landroid/util/AttributeSet;II)V
return-void
.end method
.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V
.registers 6
.line 47
invoke-direct {p0, p1, p2, p3}, Landroid/view/View;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V
const/high16 v0, -0x80000000
.line 20
iput v0, p0, Lcom/rey/material/widget/ProgressView;->mCurrentStyle:I
const/4 v0, 0x0
.line 22
iput-boolean v0, p0, Lcom/rey/material/widget/ProgressView;->mAutostart:Z
const/4 v1, 0x1
.line 23
iput-boolean v1, p0, Lcom/rey/material/widget/ProgressView;->mCircular:Z
.line 49
invoke-virtual {p0, p1, p2, p3, v0}, Lcom/rey/material/widget/ProgressView;->init(Landroid/content/Context;Landroid/util/AttributeSet;II)V
return-void
.end method
.method private needCreateProgress(Z)Z
.registers 4
.line 64
iget-object v0, p0, Lcom/rey/material/widget/ProgressView;->mProgressDrawable:Landroid/graphics/drawable/Drawable;
const/4 v1, 0x1
if-nez v0, :cond_6
return v1
:cond_6
if-eqz p1, :cond_c
.line 68
instance-of p1, v0, Lcom/rey/material/drawable/CircularProgressDrawable;
xor-int/2addr p1, v1
return p1
.line 70
:cond_c
instance-of p1, v0, Lcom/rey/material/drawable/LinearProgressDrawable;
xor-int/2addr p1, v1
return p1
.end method
# virtual methods
.method public applyStyle(I)V
.registers 5
.line 59
invoke-static {p0, p1}, Lcom/rey/material/util/ViewUtil;->applyStyle(Landroid/view/View;I)V
.line 60
invoke-virtual {p0}, Lcom/rey/material/widget/ProgressView;->getContext()Landroid/content/Context;
move-result-object v0
const/4 v1, 0x0
const/4 v2, 0x0
invoke-virtual {p0, v0, v1, v2, p1}, Lcom/rey/material/widget/ProgressView;->applyStyle(Landroid/content/Context;Landroid/util/AttributeSet;II)V
return-void
.end method
.method protected applyStyle(Landroid/content/Context;Landroid/util/AttributeSet;II)V
.registers 14
.line 74
sget-object v0, Lcom/rey/material/R$styleable;->ProgressView:[I
invoke-virtual {p1, p2, v0, p3, p4}, Landroid/content/Context;->obtainStyledAttributes(Landroid/util/AttributeSet;[III)Landroid/content/res/TypedArray;
move-result-object p2
.line 81
invoke-virtual {p2}, Landroid/content/res/TypedArray;->getIndexCount()I
move-result p3
const/high16 p4, -0x40800000 # -1.0f
const/4 v0, 0x0
const/4 v1, -0x1
const/high16 v1, -0x40800000 # -1.0f
const/4 v2, -0x1
const/4 v3, 0x0
const/4 v4, 0x0
:goto_13
const/4 v5, 0x1
const/4 v6, 0x0
if-ge v3, p3, :cond_57
.line 82
invoke-virtual {p2, v3}, Landroid/content/res/TypedArray;->getIndex(I)I
move-result v7
.line 84
sget v8, Lcom/rey/material/R$styleable;->ProgressView_pv_autostart:I
if-ne v7, v8, :cond_26
.line 85
invoke-virtual {p2, v7, v0}, Landroid/content/res/TypedArray;->getBoolean(IZ)Z
move-result v5
iput-boolean v5, p0, Lcom/rey/material/widget/ProgressView;->mAutostart:Z
goto :goto_54
.line 86
:cond_26
sget v8, Lcom/rey/material/R$styleable;->ProgressView_pv_circular:I
if-ne v7, v8, :cond_31
.line 87
invoke-virtual {p2, v7, v5}, Landroid/content/res/TypedArray;->getBoolean(IZ)Z
move-result v5
iput-boolean v5, p0, Lcom/rey/material/widget/ProgressView;->mCircular:Z
goto :goto_54
.line 88
:cond_31
sget v5, Lcom/rey/material/R$styleable;->ProgressView_pv_progressStyle:I
if-ne v7, v5, :cond_3a
.line 89
invoke-virtual {p2, v7, v0}, Landroid/content/res/TypedArray;->getResourceId(II)I
move-result v4
goto :goto_54
.line 90
:cond_3a
sget v5, Lcom/rey/material/R$styleable;->ProgressView_pv_progressMode:I
if-ne v7, v5, :cond_43
.line 91
invoke-virtual {p2, v7, v0}, Landroid/content/res/TypedArray;->getInteger(II)I
move-result v2
goto :goto_54
.line 92
:cond_43
sget v5, Lcom/rey/material/R$styleable;->ProgressView_pv_progress:I
if-ne v7, v5, :cond_4c
.line 93
invoke-virtual {p2, v7, v6}, Landroid/content/res/TypedArray;->getFloat(IF)F
move-result p4
goto :goto_54
.line 94
:cond_4c
sget v5, Lcom/rey/material/R$styleable;->ProgressView_pv_secondaryProgress:I
if-ne v7, v5, :cond_54
.line 95
invoke-virtual {p2, v7, v6}, Landroid/content/res/TypedArray;->getFloat(IF)F
move-result v1
:cond_54
:goto_54
add-int/lit8 v3, v3, 0x1
goto :goto_13
.line 98
:cond_57
invoke-virtual {p2}, Landroid/content/res/TypedArray;->recycle()V
.line 102
iget-boolean p2, p0, Lcom/rey/material/widget/ProgressView;->mCircular:Z
invoke-direct {p0, p2}, Lcom/rey/material/widget/ProgressView;->needCreateProgress(Z)Z
move-result p2
if-eqz p2, :cond_9f
.line 103
iput v4, p0, Lcom/rey/material/widget/ProgressView;->mProgressId:I
if-nez v4, :cond_71
.line 105
iget-boolean p2, p0, Lcom/rey/material/widget/ProgressView;->mCircular:Z
if-eqz p2, :cond_6d
sget p2, Lcom/rey/material/R$style;->Material_Drawable_CircularProgress:I
goto :goto_6f
:cond_6d
sget p2, Lcom/rey/material/R$style;->Material_Drawable_LinearProgress:I
:goto_6f
iput p2, p0, Lcom/rey/material/widget/ProgressView;->mProgressId:I
.line 107
:cond_71
iget-object p2, p0, Lcom/rey/material/widget/ProgressView;->mProgressDrawable:Landroid/graphics/drawable/Drawable;
if-eqz p2, :cond_7e
check-cast p2, Landroid/graphics/drawable/Animatable;
invoke-interface {p2}, Landroid/graphics/drawable/Animatable;->isRunning()Z
move-result p2
if-eqz p2, :cond_7e
const/4 v0, 0x1
.line 108
:cond_7e
iget-boolean p2, p0, Lcom/rey/material/widget/ProgressView;->mCircular:Z
if-eqz p2, :cond_8e
new-instance p2, Lcom/rey/material/drawable/CircularProgressDrawable$Builder;
iget p3, p0, Lcom/rey/material/widget/ProgressView;->mProgressId:I
invoke-direct {p2, p1, p3}, Lcom/rey/material/drawable/CircularProgressDrawable$Builder;-><init>(Landroid/content/Context;I)V
invoke-virtual {p2}, Lcom/rey/material/drawable/CircularProgressDrawable$Builder;->build()Lcom/rey/material/drawable/CircularProgressDrawable;
move-result-object p1
goto :goto_99
:cond_8e
new-instance p2, Lcom/rey/material/drawable/LinearProgressDrawable$Builder;
iget p3, p0, Lcom/rey/material/widget/ProgressView;->mProgressId:I
invoke-direct {p2, p1, p3}, Lcom/rey/material/drawable/LinearProgressDrawable$Builder;-><init>(Landroid/content/Context;I)V
invoke-virtual {p2}, Lcom/rey/material/drawable/LinearProgressDrawable$Builder;->build()Lcom/rey/material/drawable/LinearProgressDrawable;
move-result-object p1
:goto_99
iput-object p1, p0, Lcom/rey/material/widget/ProgressView;->mProgressDrawable:Landroid/graphics/drawable/Drawable;
.line 109
invoke-static {p0, p1}, Lcom/rey/material/util/ViewUtil;->setBackground(Landroid/view/View;Landroid/graphics/drawable/Drawable;)V
goto :goto_b6
.line 111
:cond_9f
iget p2, p0, Lcom/rey/material/widget/ProgressView;->mProgressId:I
if-eq p2, v4, :cond_b6
.line 112
iput v4, p0, Lcom/rey/material/widget/ProgressView;->mProgressId:I
.line 113
iget-object p2, p0, Lcom/rey/material/widget/ProgressView;->mProgressDrawable:Landroid/graphics/drawable/Drawable;
instance-of p3, p2, Lcom/rey/material/drawable/CircularProgressDrawable;
if-eqz p3, :cond_b1
.line 114
check-cast p2, Lcom/rey/material/drawable/CircularProgressDrawable;
invoke-virtual {p2, p1, v4}, Lcom/rey/material/drawable/CircularProgressDrawable;->applyStyle(Landroid/content/Context;I)V
goto :goto_b6
.line 116
:cond_b1
check-cast p2, Lcom/rey/material/drawable/LinearProgressDrawable;
invoke-virtual {p2, p1, v4}, Lcom/rey/material/drawable/LinearProgressDrawable;->applyStyle(Landroid/content/Context;I)V
:cond_b6
:goto_b6
if-ltz v2, :cond_c9
.line 120
iget-object p1, p0, Lcom/rey/material/widget/ProgressView;->mProgressDrawable:Landroid/graphics/drawable/Drawable;
instance-of p2, p1, Lcom/rey/material/drawable/CircularProgressDrawable;
if-eqz p2, :cond_c4
.line 121
check-cast p1, Lcom/rey/material/drawable/CircularProgressDrawable;
invoke-virtual {p1, v2}, Lcom/rey/material/drawable/CircularProgressDrawable;->setProgressMode(I)V
goto :goto_c9
.line 123
:cond_c4
check-cast p1, Lcom/rey/material/drawable/LinearProgressDrawable;
invoke-virtual {p1, v2}, Lcom/rey/material/drawable/LinearProgressDrawable;->setProgressMode(I)V
:cond_c9
:goto_c9
cmpl-float p1, p4, v6
if-ltz p1, :cond_d0
.line 127
invoke-virtual {p0, p4}, Lcom/rey/material/widget/ProgressView;->setProgress(F)V
:cond_d0
cmpl-float p1, v1, v6
if-ltz p1, :cond_d7
.line 130
invoke-virtual {p0, v1}, Lcom/rey/material/widget/ProgressView;->setSecondaryProgress(F)V
:cond_d7
if-eqz v0, :cond_dc
.line 133
invoke-virtual {p0}, Lcom/rey/material/widget/ProgressView;->start()V
:cond_dc
return-void
.end method
.method public getProgress()F
.registers 2
.line 192
iget-boolean v0, p0, Lcom/rey/material/widget/ProgressView;->mCircular:Z
if-eqz v0, :cond_d
.line 193
iget-object v0, p0, Lcom/rey/material/widget/ProgressView;->mProgressDrawable:Landroid/graphics/drawable/Drawable;
check-cast v0, Lcom/rey/material/drawable/CircularProgressDrawable;
invoke-virtual {v0}, Lcom/rey/material/drawable/CircularProgressDrawable;->getProgress()F
move-result v0
return v0
.line 195
:cond_d
iget-object v0, p0, Lcom/rey/material/widget/ProgressView;->mProgressDrawable:Landroid/graphics/drawable/Drawable;
check-cast v0, Lcom/rey/material/drawable/LinearProgressDrawable;
invoke-virtual {v0}, Lcom/rey/material/drawable/LinearProgressDrawable;->getProgress()F
move-result v0
return v0
.end method
.method public getProgressMode()I
.registers 2
.line 182
iget-boolean v0, p0, Lcom/rey/material/widget/ProgressView;->mCircular:Z
if-eqz v0, :cond_d
.line 183
iget-object v0, p0, Lcom/rey/material/widget/ProgressView;->mProgressDrawable:Landroid/graphics/drawable/Drawable;
check-cast v0, Lcom/rey/material/drawable/CircularProgressDrawable;
invoke-virtual {v0}, Lcom/rey/material/drawable/CircularProgressDrawable;->getProgressMode()I
move-result v0
return v0
.line 185
:cond_d
iget-object v0, p0, Lcom/rey/material/widget/ProgressView;->mProgressDrawable:Landroid/graphics/drawable/Drawable;
check-cast v0, Lcom/rey/material/drawable/LinearProgressDrawable;
invoke-virtual {v0}, Lcom/rey/material/drawable/LinearProgressDrawable;->getProgressMode()I
move-result v0
return v0
.end method
.method public getSecondaryProgress()F
.registers 2
.line 202
iget-boolean v0, p0, Lcom/rey/material/widget/ProgressView;->mCircular:Z
if-eqz v0, :cond_d
.line 203
iget-object v0, p0, Lcom/rey/material/widget/ProgressView;->mProgressDrawable:Landroid/graphics/drawable/Drawable;
check-cast v0, Lcom/rey/material/drawable/CircularProgressDrawable;
invoke-virtual {v0}, Lcom/rey/material/drawable/CircularProgressDrawable;->getSecondaryProgress()F
move-result v0
return v0
.line 205
:cond_d
iget-object v0, p0, Lcom/rey/material/widget/ProgressView;->mProgressDrawable:Landroid/graphics/drawable/Drawable;
check-cast v0, Lcom/rey/material/drawable/LinearProgressDrawable;
invoke-virtual {v0}, Lcom/rey/material/drawable/LinearProgressDrawable;->getSecondaryProgress()F
move-result v0
return v0
.end method
.method protected init(Landroid/content/Context;Landroid/util/AttributeSet;II)V
.registers 6
.line 53
invoke-virtual {p0, p1, p2, p3, p4}, Lcom/rey/material/widget/ProgressView;->applyStyle(Landroid/content/Context;Landroid/util/AttributeSet;II)V
.line 54
invoke-virtual {p0}, Lcom/rey/material/widget/ProgressView;->isInEditMode()Z
move-result v0
if-nez v0, :cond_f
.line 55
invoke-static {p1, p2, p3, p4}, Lcom/rey/material/app/ThemeManager;->getStyleId(Landroid/content/Context;Landroid/util/AttributeSet;II)I
move-result p1
iput p1, p0, Lcom/rey/material/widget/ProgressView;->mStyleId:I
:cond_f
return-void
.end method
.method protected onAttachedToWindow()V
.registers 2
.line 162
invoke-super {p0}, Landroid/view/View;->onAttachedToWindow()V
.line 163
invoke-virtual {p0}, Lcom/rey/material/widget/ProgressView;->getVisibility()I
move-result v0
if-nez v0, :cond_10
iget-boolean v0, p0, Lcom/rey/material/widget/ProgressView;->mAutostart:Z
if-eqz v0, :cond_10
.line 164
invoke-virtual {p0}, Lcom/rey/material/widget/ProgressView;->start()V
.line 165
:cond_10
iget v0, p0, Lcom/rey/material/widget/ProgressView;->mStyleId:I
if-eqz v0, :cond_1f
.line 166
invoke-static {}, Lcom/rey/material/app/ThemeManager;->getInstance()Lcom/rey/material/app/ThemeManager;
move-result-object v0
invoke-virtual {v0, p0}, Lcom/rey/material/app/ThemeManager;->registerOnThemeChangedListener(Lcom/rey/material/app/ThemeManager$OnThemeChangedListener;)V
const/4 v0, 0x0
.line 167
invoke-virtual {p0, v0}, Lcom/rey/material/widget/ProgressView;->onThemeChanged(Lcom/rey/material/app/ThemeManager$OnThemeChangedEvent;)V
:cond_1f
return-void
.end method
.method protected onDetachedFromWindow()V
.registers 2
.line 173
iget-boolean v0, p0, Lcom/rey/material/widget/ProgressView;->mAutostart:Z
if-eqz v0, :cond_7
.line 174
invoke-virtual {p0}, Lcom/rey/material/widget/ProgressView;->stop()V
.line 176
:cond_7
invoke-super {p0}, Landroid/view/View;->onDetachedFromWindow()V
.line 177
iget v0, p0, Lcom/rey/material/widget/ProgressView;->mStyleId:I
if-eqz v0, :cond_15
.line 178
invoke-static {}, Lcom/rey/material/app/ThemeManager;->getInstance()Lcom/rey/material/app/ThemeManager;
move-result-object v0
invoke-virtual {v0, p0}, Lcom/rey/material/app/ThemeManager;->unregisterOnThemeChangedListener(Lcom/rey/material/app/ThemeManager$OnThemeChangedListener;)V
:cond_15
return-void
.end method
.method public onThemeChanged(Lcom/rey/material/app/ThemeManager$OnThemeChangedEvent;)V
.registers 3
.line 138
invoke-static {}, Lcom/rey/material/app/ThemeManager;->getInstance()Lcom/rey/material/app/ThemeManager;
move-result-object p1
iget v0, p0, Lcom/rey/material/widget/ProgressView;->mStyleId:I
invoke-virtual {p1, v0}, Lcom/rey/material/app/ThemeManager;->getCurrentStyle(I)I
move-result p1
.line 139
iget v0, p0, Lcom/rey/material/widget/ProgressView;->mCurrentStyle:I
if-eq v0, p1, :cond_13
.line 140
iput p1, p0, Lcom/rey/material/widget/ProgressView;->mCurrentStyle:I
.line 141
invoke-virtual {p0, p1}, Lcom/rey/material/widget/ProgressView;->applyStyle(I)V
:cond_13
return-void
.end method
.method protected onVisibilityChanged(Landroid/view/View;I)V
.registers 3
.line 147
invoke-super {p0, p1, p2}, Landroid/view/View;->onVisibilityChanged(Landroid/view/View;I)V
if-eq p1, p0, :cond_6
return-void
.line 152
:cond_6
iget-boolean p1, p0, Lcom/rey/material/widget/ProgressView;->mAutostart:Z
if-eqz p1, :cond_19
const/16 p1, 0x8
if-eq p2, p1, :cond_16
const/4 p1, 0x4
if-ne p2, p1, :cond_12
goto :goto_16
.line 156
:cond_12
invoke-virtual {p0}, Lcom/rey/material/widget/ProgressView;->start()V
goto :goto_19
.line 154
:cond_16
:goto_16
invoke-virtual {p0}, Lcom/rey/material/widget/ProgressView;->stop()V
:cond_19
:goto_19
return-void
.end method
.method public setProgress(F)V
.registers 3
.line 213
iget-boolean v0, p0, Lcom/rey/material/widget/ProgressView;->mCircular:Z
if-eqz v0, :cond_c
.line 214
iget-object v0, p0, Lcom/rey/material/widget/ProgressView;->mProgressDrawable:Landroid/graphics/drawable/Drawable;
check-cast v0, Lcom/rey/material/drawable/CircularProgressDrawable;
invoke-virtual {v0, p1}, Lcom/rey/material/drawable/CircularProgressDrawable;->setProgress(F)V
goto :goto_13
.line 216
:cond_c
iget-object v0, p0, Lcom/rey/material/widget/ProgressView;->mProgressDrawable:Landroid/graphics/drawable/Drawable;
check-cast v0, Lcom/rey/material/drawable/LinearProgressDrawable;
invoke-virtual {v0, p1}, Lcom/rey/material/drawable/LinearProgressDrawable;->setProgress(F)V
:goto_13
return-void
.end method
.method public setSecondaryProgress(F)V
.registers 3
.line 224
iget-boolean v0, p0, Lcom/rey/material/widget/ProgressView;->mCircular:Z
if-eqz v0, :cond_c
.line 225
iget-object v0, p0, Lcom/rey/material/widget/ProgressView;->mProgressDrawable:Landroid/graphics/drawable/Drawable;
check-cast v0, Lcom/rey/material/drawable/CircularProgressDrawable;
invoke-virtual {v0, p1}, Lcom/rey/material/drawable/CircularProgressDrawable;->setSecondaryProgress(F)V
goto :goto_13
.line 227
:cond_c
iget-object v0, p0, Lcom/rey/material/widget/ProgressView;->mProgressDrawable:Landroid/graphics/drawable/Drawable;
check-cast v0, Lcom/rey/material/drawable/LinearProgressDrawable;
invoke-virtual {v0, p1}, Lcom/rey/material/drawable/LinearProgressDrawable;->setSecondaryProgress(F)V
:goto_13
return-void
.end method
.method public start()V
.registers 2
.line 234
iget-object v0, p0, Lcom/rey/material/widget/ProgressView;->mProgressDrawable:Landroid/graphics/drawable/Drawable;
if-eqz v0, :cond_9
.line 235
check-cast v0, Landroid/graphics/drawable/Animatable;
invoke-interface {v0}, Landroid/graphics/drawable/Animatable;->start()V
:cond_9
return-void
.end method
.method public stop()V
.registers 2
.line 242
iget-object v0, p0, Lcom/rey/material/widget/ProgressView;->mProgressDrawable:Landroid/graphics/drawable/Drawable;
if-eqz v0, :cond_9
.line 243
check-cast v0, Landroid/graphics/drawable/Animatable;
invoke-interface {v0}, Landroid/graphics/drawable/Animatable;->stop()V
:cond_9
return-void
.end method