今奥全景相机
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.

387 lines
11 KiB

.class public Lcom/viatech/widget/DownloadDialog;
.super Ljava/lang/Object;
.source "DownloadDialog.java"
# interfaces
.implements Lcom/viatech/widget/IDownload;
# annotations
.annotation system Ldalvik/annotation/MemberClasses;
value = {
Lcom/viatech/widget/DownloadDialog$DownloadDialogListener;
}
.end annotation
# static fields
.field private static final MSG_DOWNLOAD_FINISH:I = 0x1
.field private static final MSG_PROGRESS_CHANGE:I
.field private static final TAG:Ljava/lang/String;
# instance fields
.field private downloadTask:Lcom/viatech/util/DownloadTask;
.field private handler:Landroid/os/Handler;
.field private mDialog:Landroid/app/AlertDialog;
.field private mDownloadDialogListener:Lcom/viatech/widget/DownloadDialog$DownloadDialogListener;
.field private onDownloadListener:Lcom/viatech/util/HttpDownloadManager$OnDownloadListener;
.field private pb_download:Landroid/widget/ProgressBar;
.field private tv_download:Landroid/widget/TextView;
# direct methods
.method static constructor <clinit>()V
.locals 1
.prologue
.line 29
const-class v0, Lcom/viatech/widget/DownloadDialog;
invoke-virtual {v0}, Ljava/lang/Class;->getSimpleName()Ljava/lang/String;
move-result-object v0
sput-object v0, Lcom/viatech/widget/DownloadDialog;->TAG:Ljava/lang/String;
return-void
.end method
.method public constructor <init>(Landroid/content/Context;)V
.locals 4
.prologue
.line 85
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
.line 38
new-instance v0, Lcom/viatech/widget/DownloadDialog$1;
invoke-direct {v0, p0}, Lcom/viatech/widget/DownloadDialog$1;-><init>(Lcom/viatech/widget/DownloadDialog;)V
iput-object v0, p0, Lcom/viatech/widget/DownloadDialog;->handler:Landroid/os/Handler;
.line 58
new-instance v0, Lcom/viatech/widget/DownloadDialog$2;
invoke-direct {v0, p0}, Lcom/viatech/widget/DownloadDialog$2;-><init>(Lcom/viatech/widget/DownloadDialog;)V
iput-object v0, p0, Lcom/viatech/widget/DownloadDialog;->onDownloadListener:Lcom/viatech/util/HttpDownloadManager$OnDownloadListener;
.line 86
invoke-static {p1}, Landroid/view/LayoutInflater;->from(Landroid/content/Context;)Landroid/view/LayoutInflater;
move-result-object v0
const v1, 0x7f03005f
const/4 v2, 0x0
invoke-virtual {v0, v1, v2}, Landroid/view/LayoutInflater;->inflate(ILandroid/view/ViewGroup;)Landroid/view/View;
move-result-object v1
.line 87
new-instance v0, Lcom/viatech/widget/VPaiDialog$Builder;
invoke-direct {v0, p1}, Lcom/viatech/widget/VPaiDialog$Builder;-><init>(Landroid/content/Context;)V
.line 88
const v2, 0x7f0701e4
invoke-virtual {v0, v2}, Lcom/viatech/widget/VPaiDialog$Builder;->setTitle(I)Landroid/app/AlertDialog$Builder;
.line 89
invoke-virtual {v0, v1}, Lcom/viatech/widget/VPaiDialog$Builder;->setView(Landroid/view/View;)Landroid/app/AlertDialog$Builder;
.line 90
const v2, 0x7f070088
new-instance v3, Lcom/viatech/widget/DownloadDialog$3;
invoke-direct {v3, p0}, Lcom/viatech/widget/DownloadDialog$3;-><init>(Lcom/viatech/widget/DownloadDialog;)V
invoke-virtual {v0, v2, v3}, Lcom/viatech/widget/VPaiDialog$Builder;->setPositiveButton(ILandroid/content/DialogInterface$OnClickListener;)Landroid/app/AlertDialog$Builder;
.line 96
invoke-virtual {v0}, Lcom/viatech/widget/VPaiDialog$Builder;->create()Landroid/app/AlertDialog;
move-result-object v0
iput-object v0, p0, Lcom/viatech/widget/DownloadDialog;->mDialog:Landroid/app/AlertDialog;
.line 97
const v0, 0x7f0c0234
invoke-virtual {v1, v0}, Landroid/view/View;->findViewById(I)Landroid/view/View;
move-result-object v0
check-cast v0, Landroid/widget/TextView;
iput-object v0, p0, Lcom/viatech/widget/DownloadDialog;->tv_download:Landroid/widget/TextView;
.line 98
const v0, 0x7f0c0232
invoke-virtual {v1, v0}, Landroid/view/View;->findViewById(I)Landroid/view/View;
move-result-object v0
check-cast v0, Landroid/widget/SeekBar;
iput-object v0, p0, Lcom/viatech/widget/DownloadDialog;->pb_download:Landroid/widget/ProgressBar;
.line 99
return-void
.end method
.method static synthetic access$000(Lcom/viatech/widget/DownloadDialog;)Landroid/widget/ProgressBar;
.locals 1
.prologue
.line 28
iget-object v0, p0, Lcom/viatech/widget/DownloadDialog;->pb_download:Landroid/widget/ProgressBar;
return-object v0
.end method
.method static synthetic access$100(Lcom/viatech/widget/DownloadDialog;)Landroid/widget/TextView;
.locals 1
.prologue
.line 28
iget-object v0, p0, Lcom/viatech/widget/DownloadDialog;->tv_download:Landroid/widget/TextView;
return-object v0
.end method
.method static synthetic access$200(Lcom/viatech/widget/DownloadDialog;)Landroid/app/AlertDialog;
.locals 1
.prologue
.line 28
iget-object v0, p0, Lcom/viatech/widget/DownloadDialog;->mDialog:Landroid/app/AlertDialog;
return-object v0
.end method
.method static synthetic access$300(Lcom/viatech/widget/DownloadDialog;)Lcom/viatech/widget/DownloadDialog$DownloadDialogListener;
.locals 1
.prologue
.line 28
iget-object v0, p0, Lcom/viatech/widget/DownloadDialog;->mDownloadDialogListener:Lcom/viatech/widget/DownloadDialog$DownloadDialogListener;
return-object v0
.end method
.method static synthetic access$400(Lcom/viatech/widget/DownloadDialog;)Landroid/os/Handler;
.locals 1
.prologue
.line 28
iget-object v0, p0, Lcom/viatech/widget/DownloadDialog;->handler:Landroid/os/Handler;
return-object v0
.end method
.method private downloadFile(Lcom/viatech/gallery/FileInfo;)V
.locals 4
.prologue
.line 118
invoke-static {}, Lcom/viatech/util/HttpDownloadManager;->instance()Lcom/viatech/util/HttpDownloadManager;
move-result-object v0
iget-object v1, p1, Lcom/viatech/gallery/FileInfo;->url:Ljava/lang/String;
invoke-virtual {v0, v1}, Lcom/viatech/util/HttpDownloadManager;->getDownloadTask(Ljava/lang/String;)Lcom/viatech/util/DownloadTask;
move-result-object v0
.line 119
if-eqz v0, :cond_0
.line 120
invoke-static {}, Lcom/viatech/util/HttpDownloadManager;->instance()Lcom/viatech/util/HttpDownloadManager;
move-result-object v1
invoke-virtual {v1, v0}, Lcom/viatech/util/HttpDownloadManager;->cancelDownload(Lcom/viatech/util/DownloadTask;)V
.line 123
:cond_0
new-instance v0, Lcom/viatech/util/DownloadTask;
iget-object v1, p1, Lcom/viatech/gallery/FileInfo;->name:Ljava/lang/String;
iget-object v2, p1, Lcom/viatech/gallery/FileInfo;->url:Ljava/lang/String;
iget-object v3, p0, Lcom/viatech/widget/DownloadDialog;->onDownloadListener:Lcom/viatech/util/HttpDownloadManager$OnDownloadListener;
invoke-direct {v0, v1, v2, v3}, Lcom/viatech/util/DownloadTask;-><init>(Ljava/lang/String;Ljava/lang/String;Lcom/viatech/util/HttpDownloadManager$OnDownloadListener;)V
iput-object v0, p0, Lcom/viatech/widget/DownloadDialog;->downloadTask:Lcom/viatech/util/DownloadTask;
.line 124
invoke-static {}, Lcom/viatech/util/HttpDownloadManager;->instance()Lcom/viatech/util/HttpDownloadManager;
move-result-object v0
invoke-virtual {v0}, Lcom/viatech/util/HttpDownloadManager;->getDownloadInfos()Ljava/util/Map;
move-result-object v0
.line 125
iget-object v1, p0, Lcom/viatech/widget/DownloadDialog;->downloadTask:Lcom/viatech/util/DownloadTask;
invoke-interface {v0, v1, p1}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
.line 126
invoke-static {}, Lcom/viatech/util/HttpDownloadManager;->instance()Lcom/viatech/util/HttpDownloadManager;
move-result-object v0
iget-object v1, p0, Lcom/viatech/widget/DownloadDialog;->downloadTask:Lcom/viatech/util/DownloadTask;
invoke-virtual {v0, v1}, Lcom/viatech/util/HttpDownloadManager;->requestDownload(Lcom/viatech/util/DownloadTask;)V
.line 127
return-void
.end method
.method private isDownload(Lcom/viatech/gallery/FileInfo;)Z
.locals 8
.prologue
const/4 v1, 0x0
.line 130
const/4 v0, 0x1
.line 131
sget-object v2, Lcom/viatech/Config;->d:Ljava/lang/String;
invoke-static {v2}, Lcom/viatech/util/Util;->getAvailableSpace(Ljava/lang/String;)J
move-result-wide v2
.line 132
iget-wide v4, p1, Lcom/viatech/gallery/FileInfo;->lsize:J
const-wide/32 v6, 0x11e1a300
sub-long/2addr v2, v6
cmp-long v2, v4, v2
if-lez v2, :cond_0
.line 133
const v0, 0x7f07008d
invoke-static {v0}, Lcom/viatech/VPaiApplication;->b(I)V
move v0, v1
.line 136
:cond_0
invoke-virtual {p1}, Lcom/viatech/gallery/FileInfo;->getFullPath()Ljava/lang/String;
move-result-object v2
invoke-static {v2}, Lcom/viatech/util/Util;->isFileExist(Ljava/lang/String;)Z
move-result v2
if-eqz v2, :cond_1
.line 137
const v0, 0x7f070045
invoke-static {v0}, Lcom/viatech/VPaiApplication;->b(I)V
.line 140
:goto_0
return v1
:cond_1
move v1, v0
goto :goto_0
.end method
# virtual methods
.method public setDownloadDialogListener(Lcom/viatech/widget/DownloadDialog$DownloadDialogListener;)V
.locals 0
.prologue
.line 144
iput-object p1, p0, Lcom/viatech/widget/DownloadDialog;->mDownloadDialogListener:Lcom/viatech/widget/DownloadDialog$DownloadDialogListener;
.line 145
return-void
.end method
.method public startDownload(Lcom/viatech/gallery/FileInfo;)V
.locals 1
.prologue
.line 103
invoke-direct {p0, p1}, Lcom/viatech/widget/DownloadDialog;->isDownload(Lcom/viatech/gallery/FileInfo;)Z
move-result v0
if-eqz v0, :cond_0
.line 104
iget-object v0, p0, Lcom/viatech/widget/DownloadDialog;->mDialog:Landroid/app/AlertDialog;
invoke-virtual {v0}, Landroid/app/AlertDialog;->isShowing()Z
move-result v0
if-nez v0, :cond_0
.line 105
iget-object v0, p0, Lcom/viatech/widget/DownloadDialog;->mDialog:Landroid/app/AlertDialog;
invoke-virtual {v0}, Landroid/app/AlertDialog;->show()V
.line 106
invoke-direct {p0, p1}, Lcom/viatech/widget/DownloadDialog;->downloadFile(Lcom/viatech/gallery/FileInfo;)V
.line 109
:cond_0
return-void
.end method
.method public stopDownload()V
.locals 1
.prologue
.line 113
iget-object v0, p0, Lcom/viatech/widget/DownloadDialog;->downloadTask:Lcom/viatech/util/DownloadTask;
invoke-virtual {v0}, Lcom/viatech/util/DownloadTask;->cancelDownload()V
.line 114
iget-object v0, p0, Lcom/viatech/widget/DownloadDialog;->mDialog:Landroid/app/AlertDialog;
invoke-virtual {v0}, Landroid/app/AlertDialog;->dismiss()V
.line 115
return-void
.end method