DownloadAppInfo.smali
.class public Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadAppInfo;
.super Ljava/lang/Object;
.source "DownloadAppInfo.java"
# static fields
.field public static DF:Ljava/text/DecimalFormat; = null
.field public static final STATE_INSTALL:I = 0x8
.field public static final STATE_NULL:I = 0x0
.field public static final STATE_PAUSE:I = 0x4
.field public static final STATE_RETRY:I = 0x5
.field public static final STATE_RUNNING:I = 0x2
.field public static final STATE_SUCCESS:I = 0x3
.field public static final STATE_SUSPEND:I = 0x7
.field public static final STATE_WAITING:I = 0x1
# instance fields
.field private currentSize:J
.field private currentTime:J
.field private downloadRate:Ljava/lang/String;
.field private downloadState:Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadState;
.field private state:I
# direct methods
.method static constructor <clinit>()V
.registers 2
.prologue
.line 18
new-instance v0, Ljava/text/DecimalFormat;
const-string v1, "#.00"
invoke-direct {v0, v1}, Ljava/text/DecimalFormat;-><init>(Ljava/lang/String;)V
sput-object v0, Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadAppInfo;->DF:Ljava/text/DecimalFormat;
return-void
.end method
.method public constructor <init>()V
.registers 1
.prologue
.line 8
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
return-void
.end method
.method private initBtState()V
.registers 5
.prologue
.line 45
iget-object v0, p0, Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadAppInfo;->downloadState:Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadState;
invoke-virtual {v0}, Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadState;->getState()I
move-result v0
packed-switch v0, :pswitch_data_4a
.line 83
:goto_9
return-void
.line 49
:pswitch_a
const/4 v0, 0x0
iput v0, p0, Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadAppInfo;->state:I
goto :goto_9
.line 53
:pswitch_e
const/4 v0, 0x1
iput v0, p0, Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadAppInfo;->state:I
.line 54
iget-object v0, p0, Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadAppInfo;->downloadState:Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadState;
invoke-virtual {v0}, Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadState;->getLoad()J
move-result-wide v0
iget-object v2, p0, Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadAppInfo;->downloadState:Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadState;
invoke-virtual {v2}, Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadState;->getTotal()J
move-result-wide v2
invoke-virtual {p0, v0, v1, v2, v3}, Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadAppInfo;->updateDownloadRate(JJ)V
goto :goto_9
.line 58
:pswitch_21
const/4 v0, 0x2
iput v0, p0, Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadAppInfo;->state:I
.line 59
iget-object v0, p0, Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadAppInfo;->downloadState:Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadState;
invoke-virtual {v0}, Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadState;->getLoad()J
move-result-wide v0
iget-object v2, p0, Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadAppInfo;->downloadState:Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadState;
invoke-virtual {v2}, Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadState;->getTotal()J
move-result-wide v2
invoke-virtual {p0, v0, v1, v2, v3}, Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadAppInfo;->updateDownloadRate(JJ)V
goto :goto_9
.line 63
:pswitch_34
const/4 v0, 0x3
iput v0, p0, Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadAppInfo;->state:I
goto :goto_9
.line 67
:pswitch_38
const/4 v0, 0x4
iput v0, p0, Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadAppInfo;->state:I
goto :goto_9
.line 71
:pswitch_3c
const/4 v0, 0x5
iput v0, p0, Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadAppInfo;->state:I
goto :goto_9
.line 75
:pswitch_40
const/4 v0, 0x7
iput v0, p0, Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadAppInfo;->state:I
goto :goto_9
.line 78
:pswitch_44
const/16 v0, 0x8
iput v0, p0, Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadAppInfo;->state:I
goto :goto_9
.line 45
nop
:pswitch_data_4a
.packed-switch 0x0
:pswitch_a
:pswitch_e
:pswitch_21
:pswitch_34
:pswitch_38
:pswitch_3c
:pswitch_a
:pswitch_40
:pswitch_44
.end packed-switch
.end method
# virtual methods
.method public getDownloadRate()Ljava/lang/String;
.registers 2
.prologue
.line 86
iget-object v0, p0, Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadAppInfo;->downloadRate:Ljava/lang/String;
return-object v0
.end method
.method public getDownloadState()Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadState;
.registers 2
.prologue
.line 28
iget-object v0, p0, Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadAppInfo;->downloadState:Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadState;
return-object v0
.end method
.method public getIntPercent()I
.registers 5
.prologue
.line 128
iget-object v0, p0, Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadAppInfo;->downloadState:Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadState;
invoke-virtual {v0}, Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadState;->getTotal()J
move-result-wide v0
const-wide/16 v2, 0x0
cmp-long v0, v0, v2
if-gtz v0, :cond_e
.line 129
const/4 v0, 0x0
.line 132
:goto_d
return v0
.line 131
:cond_e
iget-object v0, p0, Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadAppInfo;->downloadState:Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadState;
invoke-virtual {v0}, Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadState;->getLoad()J
move-result-wide v0
const-wide/16 v2, 0x64
mul-long/2addr v0, v2
iget-object v2, p0, Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadAppInfo;->downloadState:Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadState;
invoke-virtual {v2}, Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadState;->getTotal()J
move-result-wide v2
div-long/2addr v0, v2
.line 132
long-to-int v0, v0
goto :goto_d
.end method
.method public getMbPercent()Ljava/lang/String;
.registers 9
.prologue
const/4 v7, 0x1
const/4 v6, 0x0
const/high16 v4, 0x49800000 # 1048576.0f
.line 136
iget-object v0, p0, Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadAppInfo;->downloadState:Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadState;
invoke-virtual {v0}, Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadState;->getTotal()J
move-result-wide v0
const-wide/16 v2, 0x0
cmp-long v0, v0, v2
if-gtz v0, :cond_13
.line 137
const-string v0, "0MB/0MB"
.line 142
:goto_12
return-object v0
.line 139
:cond_13
iget-object v0, p0, Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadAppInfo;->downloadState:Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadState;
invoke-virtual {v0}, Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadState;->getLoad()J
move-result-wide v0
long-to-float v0, v0
div-float/2addr v0, v4
.line 140
iget-object v1, p0, Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadAppInfo;->downloadState:Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadState;
invoke-virtual {v1}, Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadState;->getTotal()J
move-result-wide v2
long-to-float v1, v2
div-float/2addr v1, v4
.line 141
new-instance v2, Ljava/lang/StringBuilder;
invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V
sget-object v3, Ljava/util/Locale;->US:Ljava/util/Locale;
const-string v4, "%.2f"
new-array v5, v7, [Ljava/lang/Object;
invoke-static {v0}, Ljava/lang/Float;->valueOf(F)Ljava/lang/Float;
move-result-object v0
aput-object v0, v5, v6
invoke-static {v3, v4, v5}, Ljava/lang/String;->format(Ljava/util/Locale;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
move-result-object v0
invoke-virtual {v2, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v0
const-string v2, "MB/"
invoke-virtual {v0, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v0
sget-object v2, Ljava/util/Locale;->US:Ljava/util/Locale;
const-string v3, "%.2f"
new-array v4, v7, [Ljava/lang/Object;
invoke-static {v1}, Ljava/lang/Float;->valueOf(F)Ljava/lang/Float;
move-result-object v1
aput-object v1, v4, v6
invoke-static {v2, v3, v4}, Ljava/lang/String;->format(Ljava/util/Locale;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
move-result-object v1
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v0
const-string v1, "MB"
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v0
invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v0
goto :goto_12
.end method
.method public getPercent()Ljava/lang/String;
.registers 5
.prologue
.line 117
iget-object v0, p0, Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadAppInfo;->downloadState:Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadState;
invoke-virtual {v0}, Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadState;->getTotal()J
move-result-wide v0
const-wide/16 v2, 0x0
cmp-long v0, v0, v2
if-gtz v0, :cond_f
.line 118
const-string v0, "0%"
.line 124
:goto_e
return-object v0
.line 120
:cond_f
iget-object v0, p0, Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadAppInfo;->downloadState:Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadState;
invoke-virtual {v0}, Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadState;->getLoad()J
move-result-wide v0
const-wide/16 v2, 0x64
mul-long/2addr v0, v2
iget-object v2, p0, Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadAppInfo;->downloadState:Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadState;
invoke-virtual {v2}, Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadState;->getTotal()J
move-result-wide v2
div-long/2addr v0, v2
.line 121
new-instance v2, Ljava/lang/StringBuilder;
invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V
.line 122
invoke-virtual {v2, v0, v1}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;
.line 123
const/16 v0, 0x25
invoke-virtual {v2, v0}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder;
.line 124
invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v0
goto :goto_e
.end method
.method public getState()I
.registers 2
.prologue
.line 37
iget v0, p0, Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadAppInfo;->state:I
return v0
.end method
.method public setDownloadState(Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadState;)V
.registers 2
.prologue
.line 32
iput-object p1, p0, Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadAppInfo;->downloadState:Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadState;
.line 33
invoke-direct {p0}, Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadAppInfo;->initBtState()V
.line 34
return-void
.end method
.method public updateDownloadRate(JJ)V
.registers 14
.prologue
const-wide/16 v4, 0x0
const-wide v6, 0x408f400000000000L # 1000.0
.line 90
invoke-static {}, Ljava/lang/System;->currentTimeMillis()J
move-result-wide v0
.line 91
iget-wide v2, p0, Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadAppInfo;->currentTime:J
cmp-long v2, v2, v4
if-nez v2, :cond_1a
.line 92
iput-wide p1, p0, Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadAppInfo;->currentSize:J
.line 93
iput-wide v0, p0, Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadAppInfo;->currentTime:J
.line 94
const-string v0, "0K/s"
iput-object v0, p0, Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadAppInfo;->downloadRate:Ljava/lang/String;
.line 114
:cond_19
:goto_19
return-void
.line 96
:cond_1a
iget-wide v2, p0, Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadAppInfo;->currentTime:J
sub-long v2, v0, v2
cmp-long v2, v2, v4
if-lez v2, :cond_19
iget-wide v2, p0, Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadAppInfo;->currentSize:J
cmp-long v2, p1, v2
if-ltz v2, :cond_19
.line 97
iget-wide v2, p0, Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadAppInfo;->currentSize:J
sub-long v2, p1, v2
long-to-double v2, v2
const-wide/high16 v4, 0x4090000000000000L # 1024.0
div-double/2addr v2, v4
iget-wide v4, p0, Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadAppInfo;->currentTime:J
sub-long v4, v0, v4
long-to-double v4, v4
div-double/2addr v4, v6
div-double/2addr v2, v4
.line 98
iput-wide v0, p0, Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadAppInfo;->currentTime:J
.line 99
iput-wide p1, p0, Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadAppInfo;->currentSize:J
.line 100
new-instance v0, Ljava/lang/StringBuffer;
invoke-direct {v0}, Ljava/lang/StringBuffer;-><init>()V
.line 101
const-wide/high16 v4, 0x3ff0000000000000L # 1.0
cmpg-double v1, v2, v4
if-gez v1, :cond_52
.line 102
const-string v1, "<1K/s"
invoke-virtual {v0, v1}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;
.line 111
:goto_4b
invoke-virtual {v0}, Ljava/lang/StringBuffer;->toString()Ljava/lang/String;
move-result-object v0
iput-object v0, p0, Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadAppInfo;->downloadRate:Ljava/lang/String;
goto :goto_19
.line 104
:cond_52
cmpl-double v1, v2, v6
if-lez v1, :cond_67
.line 105
div-double/2addr v2, v6
.line 106
sget-object v1, Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadAppInfo;->DF:Ljava/text/DecimalFormat;
invoke-virtual {v1, v2, v3}, Ljava/text/DecimalFormat;->format(D)Ljava/lang/String;
move-result-object v1
invoke-virtual {v0, v1}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;
move-result-object v1
const-string v2, "M/s"
invoke-virtual {v1, v2}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;
goto :goto_4b
.line 108
:cond_67
double-to-int v1, v2
invoke-virtual {v0, v1}, Ljava/lang/StringBuffer;->append(I)Ljava/lang/StringBuffer;
move-result-object v1
const-string v2, "K/s"
invoke-virtual {v1, v2}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;
goto :goto_4b
.end method