.class public final Lcom/moji/mjweather/voice/DownloadManager;
.super Ljava/lang/Object;
.source "DownloadManager.java"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/moji/mjweather/voice/DownloadManager$DownloadListener;,
        Lcom/moji/mjweather/voice/DownloadManager$DownloadThread;
    }
.end annotation


# instance fields
.field private final a:Landroid/content/Context;

.field private final b:Ljava/lang/String;

.field private final c:Ljava/lang/String;

.field private d:Lcom/moji/dialog/MJDialog;

.field private e:Landroid/widget/TextView;

.field private f:Lcom/moji/mjweather/voice/DownloadManager$DownloadThread;

.field private g:Landroid/os/Handler;

.field private final h:Lcom/moji/mjweather/voice/DownloadManager$DownloadListener;

.field private final i:Landroid/os/Handler;

.field private j:Z


# direct methods
.method public constructor <init>(Landroid/content/Context;Ljava/lang/String;Lcom/moji/mjweather/voice/DownloadManager$DownloadListener;)V
    .locals 1

    .line 158
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 58
    sget-object v0, Lcom/moji/mjweather/voice/VoiceConstants;->a:Ljava/lang/String;

    iput-object v0, p0, Lcom/moji/mjweather/voice/DownloadManager;->c:Ljava/lang/String;

    .line 66
    new-instance v0, Lcom/moji/mjweather/voice/DownloadManager$1;

    invoke-direct {v0, p0}, Lcom/moji/mjweather/voice/DownloadManager$1;-><init>(Lcom/moji/mjweather/voice/DownloadManager;)V

    iput-object v0, p0, Lcom/moji/mjweather/voice/DownloadManager;->i:Landroid/os/Handler;

    const/4 v0, 0x0

    .line 156
    iput-boolean v0, p0, Lcom/moji/mjweather/voice/DownloadManager;->j:Z

    .line 159
    iput-object p1, p0, Lcom/moji/mjweather/voice/DownloadManager;->a:Landroid/content/Context;

    .line 160
    iput-object p2, p0, Lcom/moji/mjweather/voice/DownloadManager;->b:Ljava/lang/String;

    .line 161
    iput-object p3, p0, Lcom/moji/mjweather/voice/DownloadManager;->h:Lcom/moji/mjweather/voice/DownloadManager$DownloadListener;

    return-void
.end method

.method static synthetic a(Lcom/moji/mjweather/voice/DownloadManager;)Landroid/os/Handler;
    .locals 0

    .line 30
    iget-object p0, p0, Lcom/moji/mjweather/voice/DownloadManager;->g:Landroid/os/Handler;

    return-object p0
.end method

.method static synthetic a(Lcom/moji/mjweather/voice/DownloadManager;Landroid/os/Handler;)Landroid/os/Handler;
    .locals 0

    .line 30
    iput-object p1, p0, Lcom/moji/mjweather/voice/DownloadManager;->g:Landroid/os/Handler;

    return-object p1
.end method

.method private a(I)V
    .locals 3

    .line 213
    iget-boolean v0, p0, Lcom/moji/mjweather/voice/DownloadManager;->j:Z

    if-eqz v0, :cond_0

    return-void

    :cond_0
    const/4 v0, 0x1

    if-eq p1, v0, :cond_1

    const v0, 0x7f0e05f7

    const v1, 0x7f0e066f

    packed-switch p1, :pswitch_data_0

    goto/16 :goto_0

    .line 245
    :pswitch_0
    new-instance p1, Lcom/moji/dialog/control/MJDialogDefaultControl$Builder;

    iget-object v2, p0, Lcom/moji/mjweather/voice/DownloadManager;->a:Landroid/content/Context;

    invoke-direct {p1, v2}, Lcom/moji/dialog/control/MJDialogDefaultControl$Builder;-><init>(Landroid/content/Context;)V

    .line 246
    invoke-virtual {p1, v1}, Lcom/moji/dialog/control/MJDialogDefaultControl$Builder;->a(I)Lcom/moji/dialog/control/MJDialogDefaultControl$Builder;

    move-result-object p1

    const v1, 0x7f0e0a25

    .line 247
    invoke-virtual {p1, v1}, Lcom/moji/dialog/control/MJDialogDefaultControl$Builder;->b(I)Lcom/moji/dialog/control/MJDialogDefaultControl$Builder;

    move-result-object p1

    .line 248
    invoke-virtual {p1, v0}, Lcom/moji/dialog/control/MJDialogDefaultControl$Builder;->d(I)Lcom/moji/dialog/control/MJDialogDefaultControl$Builder;

    move-result-object p1

    .line 249
    invoke-virtual {p1}, Lcom/moji/dialog/control/MJDialogDefaultControl$Builder;->b()Lcom/moji/dialog/MJDialog;

    goto/16 :goto_0

    .line 261
    :pswitch_1
    new-instance p1, Lcom/moji/dialog/control/MJDialogDefaultControl$Builder;

    iget-object v2, p0, Lcom/moji/mjweather/voice/DownloadManager;->a:Landroid/content/Context;

    invoke-direct {p1, v2}, Lcom/moji/dialog/control/MJDialogDefaultControl$Builder;-><init>(Landroid/content/Context;)V

    .line 262
    invoke-virtual {p1, v1}, Lcom/moji/dialog/control/MJDialogDefaultControl$Builder;->a(I)Lcom/moji/dialog/control/MJDialogDefaultControl$Builder;

    move-result-object p1

    const v1, 0x7f0e02a7

    .line 263
    invoke-virtual {p1, v1}, Lcom/moji/dialog/control/MJDialogDefaultControl$Builder;->b(I)Lcom/moji/dialog/control/MJDialogDefaultControl$Builder;

    move-result-object p1

    .line 264
    invoke-virtual {p1, v0}, Lcom/moji/dialog/control/MJDialogDefaultControl$Builder;->d(I)Lcom/moji/dialog/control/MJDialogDefaultControl$Builder;

    move-result-object p1

    .line 265
    invoke-virtual {p1}, Lcom/moji/dialog/control/MJDialogDefaultControl$Builder;->b()Lcom/moji/dialog/MJDialog;

    goto/16 :goto_0

    .line 253
    :pswitch_2
    new-instance p1, Lcom/moji/dialog/control/MJDialogDefaultControl$Builder;

    iget-object v2, p0, Lcom/moji/mjweather/voice/DownloadManager;->a:Landroid/content/Context;

    invoke-direct {p1, v2}, Lcom/moji/dialog/control/MJDialogDefaultControl$Builder;-><init>(Landroid/content/Context;)V

    .line 254
    invoke-virtual {p1, v1}, Lcom/moji/dialog/control/MJDialogDefaultControl$Builder;->a(I)Lcom/moji/dialog/control/MJDialogDefaultControl$Builder;

    move-result-object p1

    const v1, 0x7f0e02c4

    .line 255
    invoke-virtual {p1, v1}, Lcom/moji/dialog/control/MJDialogDefaultControl$Builder;->b(I)Lcom/moji/dialog/control/MJDialogDefaultControl$Builder;

    move-result-object p1

    .line 256
    invoke-virtual {p1, v0}, Lcom/moji/dialog/control/MJDialogDefaultControl$Builder;->d(I)Lcom/moji/dialog/control/MJDialogDefaultControl$Builder;

    move-result-object p1

    .line 257
    invoke-virtual {p1}, Lcom/moji/dialog/control/MJDialogDefaultControl$Builder;->b()Lcom/moji/dialog/MJDialog;

    goto :goto_0

    .line 238
    :pswitch_3
    new-instance p1, Lcom/moji/dialog/control/MJDialogDefaultControl$Builder;

    iget-object v2, p0, Lcom/moji/mjweather/voice/DownloadManager;->a:Landroid/content/Context;

    invoke-direct {p1, v2}, Lcom/moji/dialog/control/MJDialogDefaultControl$Builder;-><init>(Landroid/content/Context;)V

    .line 239
    invoke-virtual {p1, v1}, Lcom/moji/dialog/control/MJDialogDefaultControl$Builder;->a(I)Lcom/moji/dialog/control/MJDialogDefaultControl$Builder;

    move-result-object p1

    const v1, 0x7f0e0588

    .line 240
    invoke-virtual {p1, v1}, Lcom/moji/dialog/control/MJDialogDefaultControl$Builder;->b(I)Lcom/moji/dialog/control/MJDialogDefaultControl$Builder;

    move-result-object p1

    .line 241
    invoke-virtual {p1, v0}, Lcom/moji/dialog/control/MJDialogDefaultControl$Builder;->d(I)Lcom/moji/dialog/control/MJDialogDefaultControl$Builder;

    move-result-object p1

    .line 242
    invoke-virtual {p1}, Lcom/moji/dialog/control/MJDialogDefaultControl$Builder;->b()Lcom/moji/dialog/MJDialog;

    goto :goto_0

    .line 218
    :cond_1
    iget-object p1, p0, Lcom/moji/mjweather/voice/DownloadManager;->a:Landroid/content/Context;

    invoke-static {p1}, Landroid/view/LayoutInflater;->from(Landroid/content/Context;)Landroid/view/LayoutInflater;

    move-result-object p1

    const v0, 0x7f0b00f6

    const/4 v1, 0x0

    invoke-virtual {p1, v0, v1}, Landroid/view/LayoutInflater;->inflate(ILandroid/view/ViewGroup;)Landroid/view/View;

    move-result-object p1

    const v0, 0x7f0901cf

    .line 219
    invoke-virtual {p1, v0}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Landroid/widget/TextView;

    iput-object v0, p0, Lcom/moji/mjweather/voice/DownloadManager;->e:Landroid/widget/TextView;

    .line 221
    new-instance v0, Lcom/moji/dialog/control/MJDialogCustomControl$Builder;

    iget-object v1, p0, Lcom/moji/mjweather/voice/DownloadManager;->a:Landroid/content/Context;

    invoke-direct {v0, v1}, Lcom/moji/dialog/control/MJDialogCustomControl$Builder;-><init>(Landroid/content/Context;)V

    .line 222
    invoke-virtual {v0, p1}, Lcom/moji/dialog/control/MJDialogCustomControl$Builder;->a(Landroid/view/View;)Lcom/moji/dialog/control/MJDialogCustomControl$Builder;

    move-result-object p1

    const v0, 0x7f0e0587

    .line 223
    invoke-virtual {p1, v0}, Lcom/moji/dialog/control/MJDialogCustomControl$Builder;->a(I)Lcom/moji/dialog/control/MJDialogDefaultControl$Builder;

    move-result-object p1

    const v0, 0x7f0e0586

    .line 224
    invoke-virtual {p1, v0}, Lcom/moji/dialog/control/MJDialogDefaultControl$Builder;->e(I)Lcom/moji/dialog/control/MJDialogDefaultControl$Builder;

    move-result-object p1

    new-instance v0, Lcom/moji/mjweather/voice/DownloadManager$2;

    invoke-direct {v0, p0}, Lcom/moji/mjweather/voice/DownloadManager$2;-><init>(Lcom/moji/mjweather/voice/DownloadManager;)V

    .line 225
    invoke-virtual {p1, v0}, Lcom/moji/dialog/control/MJDialogDefaultControl$Builder;->b(Lcom/moji/dialog/control/MJDialogDefaultControl$SingleButtonCallback;)Lcom/moji/dialog/control/MJDialogDefaultControl$Builder;

    move-result-object p1

    const/4 v0, 0x0

    .line 232
    invoke-virtual {p1, v0}, Lcom/moji/dialog/control/MJDialogDefaultControl$Builder;->d(Z)Lcom/moji/dialog/control/MJDialogDefaultControl$Builder;

    move-result-object p1

    invoke-virtual {p1}, Lcom/moji/dialog/control/MJDialogDefaultControl$Builder;->a()Lcom/moji/dialog/MJDialog;

    move-result-object p1

    iput-object p1, p0, Lcom/moji/mjweather/voice/DownloadManager;->d:Lcom/moji/dialog/MJDialog;

    .line 233
    iget-object p1, p0, Lcom/moji/mjweather/voice/DownloadManager;->d:Lcom/moji/dialog/MJDialog;

    invoke-virtual {p1}, Lcom/moji/dialog/MJDialog;->show()V

    :goto_0
    return-void

    nop

    :pswitch_data_0
    .packed-switch 0x3
        :pswitch_3
        :pswitch_2
        :pswitch_1
        :pswitch_0
    .end packed-switch
.end method

.method static synthetic a(Lcom/moji/mjweather/voice/DownloadManager;I)V
    .locals 0

    .line 30
    invoke-direct {p0, p1}, Lcom/moji/mjweather/voice/DownloadManager;->a(I)V

    return-void
.end method

.method static synthetic b(Lcom/moji/mjweather/voice/DownloadManager;)Lcom/moji/dialog/MJDialog;
    .locals 0

    .line 30
    iget-object p0, p0, Lcom/moji/mjweather/voice/DownloadManager;->d:Lcom/moji/dialog/MJDialog;

    return-object p0
.end method

.method static synthetic c(Lcom/moji/mjweather/voice/DownloadManager;)Landroid/widget/TextView;
    .locals 0

    .line 30
    iget-object p0, p0, Lcom/moji/mjweather/voice/DownloadManager;->e:Landroid/widget/TextView;

    return-object p0
.end method

.method private c()V
    .locals 3

    const-string v0, "MJDownLoadManager"

    const-string v1, "closeDownloadThread"

    .line 183
    invoke-static {v0, v1}, Lcom/moji/tool/log/MJLogger;->a(Ljava/lang/String;Ljava/lang/String;)V

    .line 184
    iget-object v0, p0, Lcom/moji/mjweather/voice/DownloadManager;->f:Lcom/moji/mjweather/voice/DownloadManager$DownloadThread;

    if-eqz v0, :cond_2

    iget-object v0, p0, Lcom/moji/mjweather/voice/DownloadManager;->g:Landroid/os/Handler;

    if-nez v0, :cond_0

    goto :goto_2

    .line 188
    :cond_0
    iget-object v0, p0, Lcom/moji/mjweather/voice/DownloadManager;->g:Landroid/os/Handler;

    iget-object v1, p0, Lcom/moji/mjweather/voice/DownloadManager;->g:Landroid/os/Handler;

    const/16 v2, 0xc

    invoke-virtual {v1, v2}, Landroid/os/Handler;->obtainMessage(I)Landroid/os/Message;

    move-result-object v1

    invoke-virtual {v0, v1}, Landroid/os/Handler;->sendMessage(Landroid/os/Message;)Z

    .line 192
    :try_start_0
    iget-object v0, p0, Lcom/moji/mjweather/voice/DownloadManager;->f:Lcom/moji/mjweather/voice/DownloadManager$DownloadThread;

    const-wide/16 v1, 0x3e8

    invoke-virtual {v0, v1, v2}, Lcom/moji/mjweather/voice/DownloadManager$DownloadThread;->join(J)V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_0

    :catch_0
    move-exception v0

    const-string v1, "MJDownLoadManager"

    .line 194
    invoke-static {v1, v0}, Lcom/moji/tool/log/MJLogger;->a(Ljava/lang/String;Ljava/lang/Throwable;)V

    .line 199
    :goto_0
    iget-object v0, p0, Lcom/moji/mjweather/voice/DownloadManager;->f:Lcom/moji/mjweather/voice/DownloadManager$DownloadThread;

    invoke-virtual {v0}, Lcom/moji/mjweather/voice/DownloadManager$DownloadThread;->isAlive()Z

    move-result v0

    if-eqz v0, :cond_1

    const-string v0, "MJDownLoadManager"

    const-string v1, "downLoadThread is still alive, kill it now"

    .line 200
    invoke-static {v0, v1}, Lcom/moji/tool/log/MJLogger;->b(Ljava/lang/String;Ljava/lang/String;)V

    .line 202
    :try_start_1
    iget-object v0, p0, Lcom/moji/mjweather/voice/DownloadManager;->f:Lcom/moji/mjweather/voice/DownloadManager$DownloadThread;

    invoke-virtual {v0}, Lcom/moji/mjweather/voice/DownloadManager$DownloadThread;->interrupt()V
    :try_end_1
    .catch Ljava/lang/Exception; {:try_start_1 .. :try_end_1} :catch_1

    goto :goto_1

    :catch_1
    move-exception v0

    const-string v1, "MJDownLoadManager"

    .line 204
    invoke-static {v1, v0}, Lcom/moji/tool/log/MJLogger;->a(Ljava/lang/String;Ljava/lang/Throwable;)V

    .line 206
    :goto_1
    iget-object v0, p0, Lcom/moji/mjweather/voice/DownloadManager;->c:Ljava/lang/String;

    invoke-static {v0}, Lcom/moji/tool/FileTool;->e(Ljava/lang/String;)Z

    :cond_1
    const/4 v0, 0x0

    .line 209
    iput-object v0, p0, Lcom/moji/mjweather/voice/DownloadManager;->f:Lcom/moji/mjweather/voice/DownloadManager$DownloadThread;

    return-void

    :cond_2
    :goto_2
    return-void
.end method

.method static synthetic d(Lcom/moji/mjweather/voice/DownloadManager;)Landroid/content/Context;
    .locals 0

    .line 30
    iget-object p0, p0, Lcom/moji/mjweather/voice/DownloadManager;->a:Landroid/content/Context;

    return-object p0
.end method

.method static synthetic e(Lcom/moji/mjweather/voice/DownloadManager;)V
    .locals 0

    .line 30
    invoke-direct {p0}, Lcom/moji/mjweather/voice/DownloadManager;->c()V

    return-void
.end method

.method static synthetic f(Lcom/moji/mjweather/voice/DownloadManager;)Lcom/moji/mjweather/voice/DownloadManager$DownloadListener;
    .locals 0

    .line 30
    iget-object p0, p0, Lcom/moji/mjweather/voice/DownloadManager;->h:Lcom/moji/mjweather/voice/DownloadManager$DownloadListener;

    return-object p0
.end method

.method static synthetic g(Lcom/moji/mjweather/voice/DownloadManager;)Landroid/os/Handler;
    .locals 0

    .line 30
    iget-object p0, p0, Lcom/moji/mjweather/voice/DownloadManager;->i:Landroid/os/Handler;

    return-object p0
.end method

.method static synthetic h(Lcom/moji/mjweather/voice/DownloadManager;)Ljava/lang/String;
    .locals 0

    .line 30
    iget-object p0, p0, Lcom/moji/mjweather/voice/DownloadManager;->c:Ljava/lang/String;

    return-object p0
.end method

.method static synthetic i(Lcom/moji/mjweather/voice/DownloadManager;)Ljava/lang/String;
    .locals 0

    .line 30
    iget-object p0, p0, Lcom/moji/mjweather/voice/DownloadManager;->b:Ljava/lang/String;

    return-object p0
.end method


# virtual methods
.method public a()V
    .locals 1

    .line 176
    iget-object v0, p0, Lcom/moji/mjweather/voice/DownloadManager;->f:Lcom/moji/mjweather/voice/DownloadManager$DownloadThread;

    if-eqz v0, :cond_0

    .line 177
    iget-object v0, p0, Lcom/moji/mjweather/voice/DownloadManager;->f:Lcom/moji/mjweather/voice/DownloadManager$DownloadThread;

    invoke-virtual {v0}, Lcom/moji/mjweather/voice/DownloadManager$DownloadThread;->a()V

    .line 178
    invoke-direct {p0}, Lcom/moji/mjweather/voice/DownloadManager;->c()V

    :cond_0
    return-void
.end method

.method public a(Z)V
    .locals 2

    .line 167
    invoke-static {}, Landroid/os/Environment;->getExternalStorageState()Ljava/lang/String;

    move-result-object v0

    const-string v1, "mounted"

    invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-nez v0, :cond_0

    const/4 p1, 0x5

    .line 168
    invoke-direct {p0, p1}, Lcom/moji/mjweather/voice/DownloadManager;->a(I)V

    goto :goto_0

    .line 170
    :cond_0
    new-instance v0, Lcom/moji/mjweather/voice/DownloadManager$DownloadThread;

    invoke-direct {v0, p0, p1}, Lcom/moji/mjweather/voice/DownloadManager$DownloadThread;-><init>(Lcom/moji/mjweather/voice/DownloadManager;Z)V

    iput-object v0, p0, Lcom/moji/mjweather/voice/DownloadManager;->f:Lcom/moji/mjweather/voice/DownloadManager$DownloadThread;

    .line 171
    iget-object p1, p0, Lcom/moji/mjweather/voice/DownloadManager;->f:Lcom/moji/mjweather/voice/DownloadManager$DownloadThread;

    invoke-virtual {p1}, Lcom/moji/mjweather/voice/DownloadManager$DownloadThread;->start()V

    :goto_0
    return-void
.end method

.method public b()V
    .locals 1

    const/4 v0, 0x1

    .line 274
    iput-boolean v0, p0, Lcom/moji/mjweather/voice/DownloadManager;->j:Z

    return-void
.end method
