200 lines
4.4 KiB
Smali
200 lines
4.4 KiB
Smali
.class public Lcom/moji/circleprogress/HorizontalProgress;
|
|
.super Landroid/widget/ImageView;
|
|
.source "HorizontalProgress.java"
|
|
|
|
|
|
# instance fields
|
|
.field private a:I
|
|
|
|
.field private b:I
|
|
|
|
.field private c:Landroid/graphics/Paint;
|
|
|
|
|
|
# direct methods
|
|
.method public constructor <init>(Landroid/content/Context;)V
|
|
.locals 0
|
|
|
|
.line 19
|
|
invoke-direct {p0, p1}, Landroid/widget/ImageView;-><init>(Landroid/content/Context;)V
|
|
|
|
const/16 p1, 0x64
|
|
|
|
.line 16
|
|
iput p1, p0, Lcom/moji/circleprogress/HorizontalProgress;->b:I
|
|
|
|
.line 20
|
|
invoke-direct {p0}, Lcom/moji/circleprogress/HorizontalProgress;->a()V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
|
|
.locals 0
|
|
|
|
.line 24
|
|
invoke-direct {p0, p1, p2}, Landroid/widget/ImageView;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
|
|
|
|
const/16 p1, 0x64
|
|
|
|
.line 16
|
|
iput p1, p0, Lcom/moji/circleprogress/HorizontalProgress;->b:I
|
|
|
|
.line 25
|
|
invoke-direct {p0}, Lcom/moji/circleprogress/HorizontalProgress;->a()V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V
|
|
.locals 0
|
|
|
|
.line 29
|
|
invoke-direct {p0, p1, p2, p3}, Landroid/widget/ImageView;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V
|
|
|
|
const/16 p1, 0x64
|
|
|
|
.line 16
|
|
iput p1, p0, Lcom/moji/circleprogress/HorizontalProgress;->b:I
|
|
|
|
.line 30
|
|
invoke-direct {p0}, Lcom/moji/circleprogress/HorizontalProgress;->a()V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method private a()V
|
|
.locals 1
|
|
|
|
.line 34
|
|
new-instance v0, Landroid/graphics/Paint;
|
|
|
|
invoke-direct {v0}, Landroid/graphics/Paint;-><init>()V
|
|
|
|
iput-object v0, p0, Lcom/moji/circleprogress/HorizontalProgress;->c:Landroid/graphics/Paint;
|
|
|
|
return-void
|
|
.end method
|
|
|
|
|
|
# virtual methods
|
|
.method public getMax()I
|
|
.locals 1
|
|
|
|
.line 41
|
|
iget v0, p0, Lcom/moji/circleprogress/HorizontalProgress;->b:I
|
|
|
|
return v0
|
|
.end method
|
|
|
|
.method public getProgress()I
|
|
.locals 1
|
|
|
|
.line 51
|
|
iget v0, p0, Lcom/moji/circleprogress/HorizontalProgress;->a:I
|
|
|
|
return v0
|
|
.end method
|
|
|
|
.method protected onDraw(Landroid/graphics/Canvas;)V
|
|
.locals 8
|
|
|
|
.line 64
|
|
invoke-super {p0, p1}, Landroid/widget/ImageView;->onDraw(Landroid/graphics/Canvas;)V
|
|
|
|
.line 65
|
|
invoke-virtual {p0}, Lcom/moji/circleprogress/HorizontalProgress;->getWidth()I
|
|
|
|
move-result v0
|
|
|
|
iget v1, p0, Lcom/moji/circleprogress/HorizontalProgress;->a:I
|
|
|
|
mul-int v0, v0, v1
|
|
|
|
int-to-float v0, v0
|
|
|
|
iget v1, p0, Lcom/moji/circleprogress/HorizontalProgress;->b:I
|
|
|
|
int-to-float v1, v1
|
|
|
|
div-float v5, v0, v1
|
|
|
|
invoke-virtual {p0}, Lcom/moji/circleprogress/HorizontalProgress;->getHeight()I
|
|
|
|
move-result v0
|
|
|
|
int-to-float v6, v0
|
|
|
|
iget-object v7, p0, Lcom/moji/circleprogress/HorizontalProgress;->c:Landroid/graphics/Paint;
|
|
|
|
const/4 v3, 0x0
|
|
|
|
const/4 v4, 0x0
|
|
|
|
move-object v2, p1
|
|
|
|
invoke-virtual/range {v2 .. v7}, Landroid/graphics/Canvas;->drawRect(FFFFLandroid/graphics/Paint;)V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public setMax(I)V
|
|
.locals 0
|
|
|
|
if-lez p1, :cond_0
|
|
|
|
.line 46
|
|
iput p1, p0, Lcom/moji/circleprogress/HorizontalProgress;->b:I
|
|
|
|
:cond_0
|
|
return-void
|
|
.end method
|
|
|
|
.method public setProgress(I)V
|
|
.locals 1
|
|
|
|
.line 55
|
|
iput p1, p0, Lcom/moji/circleprogress/HorizontalProgress;->a:I
|
|
|
|
.line 56
|
|
iget p1, p0, Lcom/moji/circleprogress/HorizontalProgress;->a:I
|
|
|
|
invoke-virtual {p0}, Lcom/moji/circleprogress/HorizontalProgress;->getMax()I
|
|
|
|
move-result v0
|
|
|
|
if-le p1, v0, :cond_0
|
|
|
|
.line 57
|
|
iget p1, p0, Lcom/moji/circleprogress/HorizontalProgress;->a:I
|
|
|
|
invoke-virtual {p0}, Lcom/moji/circleprogress/HorizontalProgress;->getMax()I
|
|
|
|
move-result v0
|
|
|
|
rem-int/2addr p1, v0
|
|
|
|
iput p1, p0, Lcom/moji/circleprogress/HorizontalProgress;->a:I
|
|
|
|
.line 59
|
|
:cond_0
|
|
invoke-virtual {p0}, Lcom/moji/circleprogress/HorizontalProgress;->invalidate()V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public setProgressColor(I)V
|
|
.locals 1
|
|
.param p1 # I
|
|
.annotation build Landroid/support/annotation/ColorInt;
|
|
.end annotation
|
|
.end param
|
|
|
|
.line 37
|
|
iget-object v0, p0, Lcom/moji/circleprogress/HorizontalProgress;->c:Landroid/graphics/Paint;
|
|
|
|
invoke-virtual {v0, p1}, Landroid/graphics/Paint;->setColor(I)V
|
|
|
|
return-void
|
|
.end method
|