You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
350 lines
9.4 KiB
350 lines
9.4 KiB
.class public Lcom/viatech/gallery/SquareProgressBar; |
|
.super Landroid/view/View; |
|
.source "SquareProgressBar.java" |
|
|
|
|
|
# static fields |
|
.field private static TAG:Ljava/lang/String; |
|
|
|
|
|
# instance fields |
|
.field private mFullColor:I |
|
|
|
.field private mPaint:Landroid/graphics/Paint; |
|
|
|
.field private mProgress:I |
|
|
|
.field private mProgressColor:I |
|
|
|
|
|
# direct methods |
|
.method static constructor <clinit>()V |
|
.locals 1 |
|
|
|
.prologue |
|
.line 18 |
|
const-string v0, "VPai_SquareProgressBar" |
|
|
|
sput-object v0, Lcom/viatech/gallery/SquareProgressBar;->TAG:Ljava/lang/String; |
|
|
|
return-void |
|
.end method |
|
|
|
.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;)V |
|
.locals 3 |
|
|
|
.prologue |
|
const/4 v2, 0x0 |
|
|
|
.line 26 |
|
invoke-direct {p0, p1, p2}, Landroid/view/View;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;)V |
|
|
|
.line 22 |
|
iput v2, p0, Lcom/viatech/gallery/SquareProgressBar;->mProgress:I |
|
|
|
.line 27 |
|
sget-object v0, Lcom/via/vpai/R$styleable;->SquareProgressBar:[I |
|
|
|
invoke-virtual {p1, p2, v0}, Landroid/content/Context;->obtainStyledAttributes(Landroid/util/AttributeSet;[I)Landroid/content/res/TypedArray; |
|
|
|
move-result-object v0 |
|
|
|
.line 28 |
|
const/4 v1, 0x1 |
|
|
|
invoke-virtual {v0, v1, v2}, Landroid/content/res/TypedArray;->getColor(II)I |
|
|
|
move-result v1 |
|
|
|
iput v1, p0, Lcom/viatech/gallery/SquareProgressBar;->mProgressColor:I |
|
|
|
.line 29 |
|
invoke-virtual {v0, v2, v2}, Landroid/content/res/TypedArray;->getColor(II)I |
|
|
|
move-result v0 |
|
|
|
iput v0, p0, Lcom/viatech/gallery/SquareProgressBar;->mFullColor:I |
|
|
|
.line 30 |
|
new-instance v0, Landroid/graphics/Paint; |
|
|
|
invoke-direct {v0}, Landroid/graphics/Paint;-><init>()V |
|
|
|
iput-object v0, p0, Lcom/viatech/gallery/SquareProgressBar;->mPaint:Landroid/graphics/Paint; |
|
|
|
.line 31 |
|
iget-object v0, p0, Lcom/viatech/gallery/SquareProgressBar;->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 |
|
|
|
.line 32 |
|
return-void |
|
.end method |
|
|
|
.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V |
|
.locals 3 |
|
|
|
.prologue |
|
const/4 v2, 0x0 |
|
|
|
.line 35 |
|
invoke-direct {p0, p1, p2, p3}, Landroid/view/View;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V |
|
|
|
.line 22 |
|
iput v2, p0, Lcom/viatech/gallery/SquareProgressBar;->mProgress:I |
|
|
|
.line 36 |
|
sget-object v0, Lcom/via/vpai/R$styleable;->SquareProgressBar:[I |
|
|
|
invoke-virtual {p1, p2, v0}, Landroid/content/Context;->obtainStyledAttributes(Landroid/util/AttributeSet;[I)Landroid/content/res/TypedArray; |
|
|
|
move-result-object v0 |
|
|
|
.line 37 |
|
const/4 v1, 0x1 |
|
|
|
invoke-virtual {v0, v1, v2}, Landroid/content/res/TypedArray;->getColor(II)I |
|
|
|
move-result v1 |
|
|
|
iput v1, p0, Lcom/viatech/gallery/SquareProgressBar;->mProgressColor:I |
|
|
|
.line 38 |
|
invoke-virtual {v0, v2, v2}, Landroid/content/res/TypedArray;->getColor(II)I |
|
|
|
move-result v0 |
|
|
|
iput v0, p0, Lcom/viatech/gallery/SquareProgressBar;->mFullColor:I |
|
|
|
.line 39 |
|
new-instance v0, Landroid/graphics/Paint; |
|
|
|
invoke-direct {v0}, Landroid/graphics/Paint;-><init>()V |
|
|
|
iput-object v0, p0, Lcom/viatech/gallery/SquareProgressBar;->mPaint:Landroid/graphics/Paint; |
|
|
|
.line 40 |
|
iget-object v0, p0, Lcom/viatech/gallery/SquareProgressBar;->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 |
|
|
|
.line 41 |
|
return-void |
|
.end method |
|
|
|
|
|
# virtual methods |
|
.method protected onDraw(Landroid/graphics/Canvas;)V |
|
.locals 8 |
|
|
|
.prologue |
|
const/4 v1, 0x0 |
|
|
|
.line 50 |
|
invoke-virtual {p0}, Lcom/viatech/gallery/SquareProgressBar;->getWidth()I |
|
|
|
move-result v6 |
|
|
|
.line 51 |
|
invoke-virtual {p0}, Lcom/viatech/gallery/SquareProgressBar;->getHeight()I |
|
|
|
move-result v7 |
|
|
|
.line 53 |
|
sget-object v0, Lcom/viatech/gallery/SquareProgressBar;->TAG:Ljava/lang/String; |
|
|
|
new-instance v2, Ljava/lang/StringBuilder; |
|
|
|
invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V |
|
|
|
const-string v3, "width = " |
|
|
|
invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; |
|
|
|
move-result-object v2 |
|
|
|
invoke-virtual {v2, v6}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder; |
|
|
|
move-result-object v2 |
|
|
|
invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; |
|
|
|
move-result-object v2 |
|
|
|
invoke-static {v0, v2}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I |
|
|
|
.line 54 |
|
sget-object v0, Lcom/viatech/gallery/SquareProgressBar;->TAG:Ljava/lang/String; |
|
|
|
new-instance v2, Ljava/lang/StringBuilder; |
|
|
|
invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V |
|
|
|
const-string v3, "height = " |
|
|
|
invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; |
|
|
|
move-result-object v2 |
|
|
|
invoke-virtual {v2, v7}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder; |
|
|
|
move-result-object v2 |
|
|
|
invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; |
|
|
|
move-result-object v2 |
|
|
|
invoke-static {v0, v2}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I |
|
|
|
.line 56 |
|
sget-object v0, Lcom/viatech/gallery/SquareProgressBar;->TAG:Ljava/lang/String; |
|
|
|
new-instance v2, Ljava/lang/StringBuilder; |
|
|
|
invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V |
|
|
|
const-string v3, "mProgressColor = " |
|
|
|
invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; |
|
|
|
move-result-object v2 |
|
|
|
iget v3, p0, Lcom/viatech/gallery/SquareProgressBar;->mProgressColor:I |
|
|
|
invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder; |
|
|
|
move-result-object v2 |
|
|
|
invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; |
|
|
|
move-result-object v2 |
|
|
|
invoke-static {v0, v2}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I |
|
|
|
.line 57 |
|
sget-object v0, Lcom/viatech/gallery/SquareProgressBar;->TAG:Ljava/lang/String; |
|
|
|
new-instance v2, Ljava/lang/StringBuilder; |
|
|
|
invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V |
|
|
|
const-string v3, "mFullColor = " |
|
|
|
invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; |
|
|
|
move-result-object v2 |
|
|
|
iget v3, p0, Lcom/viatech/gallery/SquareProgressBar;->mFullColor:I |
|
|
|
invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder; |
|
|
|
move-result-object v2 |
|
|
|
invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; |
|
|
|
move-result-object v2 |
|
|
|
invoke-static {v0, v2}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I |
|
|
|
.line 59 |
|
sget-object v0, Lcom/viatech/gallery/SquareProgressBar;->TAG:Ljava/lang/String; |
|
|
|
new-instance v2, Ljava/lang/StringBuilder; |
|
|
|
invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V |
|
|
|
const-string v3, "mProgress = " |
|
|
|
invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; |
|
|
|
move-result-object v2 |
|
|
|
iget v3, p0, Lcom/viatech/gallery/SquareProgressBar;->mProgress:I |
|
|
|
invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder; |
|
|
|
move-result-object v2 |
|
|
|
invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; |
|
|
|
move-result-object v2 |
|
|
|
invoke-static {v0, v2}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I |
|
|
|
.line 61 |
|
iget v0, p0, Lcom/viatech/gallery/SquareProgressBar;->mProgress:I |
|
|
|
mul-int/2addr v0, v7 |
|
|
|
int-to-float v0, v0 |
|
|
|
const/high16 v2, 0x3f800000 # 1.0f |
|
|
|
mul-float/2addr v0, v2 |
|
|
|
const/high16 v2, 0x42c80000 # 100.0f |
|
|
|
div-float v4, v0, v2 |
|
|
|
.line 62 |
|
iget-object v0, p0, Lcom/viatech/gallery/SquareProgressBar;->mPaint:Landroid/graphics/Paint; |
|
|
|
iget v2, p0, Lcom/viatech/gallery/SquareProgressBar;->mProgressColor:I |
|
|
|
invoke-virtual {v0, v2}, Landroid/graphics/Paint;->setColor(I)V |
|
|
|
.line 63 |
|
int-to-float v3, v6 |
|
|
|
iget-object v5, p0, Lcom/viatech/gallery/SquareProgressBar;->mPaint:Landroid/graphics/Paint; |
|
|
|
move-object v0, p1 |
|
|
|
move v2, v1 |
|
|
|
invoke-virtual/range {v0 .. v5}, Landroid/graphics/Canvas;->drawRect(FFFFLandroid/graphics/Paint;)V |
|
|
|
.line 65 |
|
iget-object v0, p0, Lcom/viatech/gallery/SquareProgressBar;->mPaint:Landroid/graphics/Paint; |
|
|
|
iget v2, p0, Lcom/viatech/gallery/SquareProgressBar;->mFullColor:I |
|
|
|
invoke-virtual {v0, v2}, Landroid/graphics/Paint;->setColor(I)V |
|
|
|
.line 66 |
|
int-to-float v5, v6 |
|
|
|
int-to-float v6, v7 |
|
|
|
iget-object v7, p0, Lcom/viatech/gallery/SquareProgressBar;->mPaint:Landroid/graphics/Paint; |
|
|
|
move-object v2, p1 |
|
|
|
move v3, v1 |
|
|
|
invoke-virtual/range {v2 .. v7}, Landroid/graphics/Canvas;->drawRect(FFFFLandroid/graphics/Paint;)V |
|
|
|
.line 68 |
|
invoke-super {p0, p1}, Landroid/view/View;->onDraw(Landroid/graphics/Canvas;)V |
|
|
|
.line 69 |
|
return-void |
|
.end method |
|
|
|
.method public setProgress(I)V |
|
.locals 0 |
|
|
|
.prologue |
|
.line 44 |
|
iput p1, p0, Lcom/viatech/gallery/SquareProgressBar;->mProgress:I |
|
|
|
.line 45 |
|
invoke-virtual {p0}, Lcom/viatech/gallery/SquareProgressBar;->invalidate()V |
|
|
|
.line 46 |
|
return-void |
|
.end method
|
|
|