a.smali

.class public Lcom/cmcm/ad/ui/a/a;
.super Ljava/lang/Object;
.source "AdDownload.java"


# instance fields
.field private a:Lcom/cm/plugincluster/ad/IAd;

.field private b:Landroid/widget/Button;

.field private c:Z

.field private d:Lcom/cm/plugincluster/common/interfaces/downloader/DownLoadListener;


# direct methods
.method public constructor <init>()V
    .registers 2

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

    .line 27
    new-instance v0, Lcom/cmcm/ad/ui/a/b;

    invoke-direct {v0, p0}, Lcom/cmcm/ad/ui/a/b;-><init>(Lcom/cmcm/ad/ui/a/a;)V

    iput-object v0, p0, Lcom/cmcm/ad/ui/a/a;->d:Lcom/cm/plugincluster/common/interfaces/downloader/DownLoadListener;

    return-void
.end method

.method static synthetic a(Lcom/cmcm/ad/ui/a/a;)Lcom/cm/plugincluster/ad/IAd;
    .registers 2

    .prologue
    .line 19
    iget-object v0, p0, Lcom/cmcm/ad/ui/a/a;->a:Lcom/cm/plugincluster/ad/IAd;

    return-object v0
.end method

.method static synthetic b(Lcom/cmcm/ad/ui/a/a;)V
    .registers 1

    .prologue
    .line 19
    invoke-direct {p0}, Lcom/cmcm/ad/ui/a/a;->h()V

    return-void
.end method

.method private e()V
    .registers 5

    .prologue
    .line 73
    iget-object v0, p0, Lcom/cmcm/ad/ui/a/a;->a:Lcom/cm/plugincluster/ad/IAd;

    invoke-interface {v0}, Lcom/cm/plugincluster/ad/IAd;->getPkg()Ljava/lang/String;

    move-result-object v0

    iget-object v1, p0, Lcom/cmcm/ad/ui/a/a;->a:Lcom/cm/plugincluster/ad/IAd;

    invoke-interface {v1}, Lcom/cm/plugincluster/ad/IAd;->getPkgUrl()Ljava/lang/String;

    move-result-object v1

    invoke-static {v0, v1}, Lcom/cleanmaster/hpsharelib/utils/CMDownloadManager;->queryState(Ljava/lang/String;Ljava/lang/String;)Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadState;

    move-result-object v0

    .line 74
    iget-object v1, p0, Lcom/cmcm/ad/ui/a/a;->a:Lcom/cm/plugincluster/ad/IAd;

    invoke-interface {v1}, Lcom/cm/plugincluster/ad/IAd;->getDownloadInfo()Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadAppInfo;

    move-result-object v1

    .line 75
    if-eqz v0, :cond_1a

    if-nez v1, :cond_1b

    .line 82
    :cond_1a
    :goto_1a
    return-void

    .line 78
    :cond_1b
    invoke-virtual {v0}, Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadState;->getState()I

    move-result v2

    invoke-virtual {v1}, Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadAppInfo;->getState()I

    move-result v3

    if-eq v2, v3, :cond_28

    .line 79
    invoke-virtual {v1, v0}, Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadAppInfo;->setDownloadState(Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadState;)V

    .line 81
    :cond_28
    iget-object v0, p0, Lcom/cmcm/ad/ui/a/a;->a:Lcom/cm/plugincluster/ad/IAd;

    invoke-interface {v0, v1}, Lcom/cm/plugincluster/ad/IAd;->setDownloadInfo(Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadAppInfo;)V

    goto :goto_1a
.end method

.method private f()V
    .registers 3

    .prologue
    .line 85
    iget-object v0, p0, Lcom/cmcm/ad/ui/a/a;->a:Lcom/cm/plugincluster/ad/IAd;

    if-eqz v0, :cond_8

    iget-object v0, p0, Lcom/cmcm/ad/ui/a/a;->b:Landroid/widget/Button;

    if-nez v0, :cond_9

    .line 97
    :cond_8
    :goto_8
    return-void

    .line 90
    :cond_9
    iget-object v0, p0, Lcom/cmcm/ad/ui/a/a;->a:Lcom/cm/plugincluster/ad/IAd;

    invoke-interface {v0}, Lcom/cm/plugincluster/ad/IAd;->getAdBehaviorType()I

    move-result v0

    const/4 v1, 0x1

    if-ne v0, v1, :cond_26

    .line 91
    invoke-static {}, Lcom/cleanmaster/pluginscommonlib/n;->b()Landroid/content/Context;

    move-result-object v0

    invoke-virtual {v0}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object v0

    sget v1, Lcom/cmcm/ad/R$string;->download_download:I

    invoke-virtual {v0, v1}, Landroid/content/res/Resources;->getString(I)Ljava/lang/String;

    move-result-object v0

    .line 95
    :goto_20
    iget-object v1, p0, Lcom/cmcm/ad/ui/a/a;->b:Landroid/widget/Button;

    invoke-virtual {v1, v0}, Landroid/widget/Button;->setText(Ljava/lang/CharSequence;)V

    goto :goto_8

    .line 93
    :cond_26
    invoke-static {}, Lcom/cleanmaster/pluginscommonlib/n;->b()Landroid/content/Context;

    move-result-object v0

    invoke-virtual {v0}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object v0

    sget v1, Lcom/cmcm/ad/R$string;->download_open:I

    invoke-virtual {v0, v1}, Landroid/content/res/Resources;->getString(I)Ljava/lang/String;

    move-result-object v0

    goto :goto_20
.end method

.method private g()V
    .registers 2

    .prologue
    .line 101
    iget-object v0, p0, Lcom/cmcm/ad/ui/a/a;->a:Lcom/cm/plugincluster/ad/IAd;

    if-eqz v0, :cond_8

    iget-object v0, p0, Lcom/cmcm/ad/ui/a/a;->b:Landroid/widget/Button;

    if-nez v0, :cond_9

    .line 112
    :cond_8
    :goto_8
    return-void

    .line 105
    :cond_9
    invoke-virtual {p0}, Lcom/cmcm/ad/ui/a/a;->b()V

    .line 107
    invoke-direct {p0}, Lcom/cmcm/ad/ui/a/a;->h()V

    .line 109
    invoke-direct {p0}, Lcom/cmcm/ad/ui/a/a;->j()V

    .line 111
    invoke-direct {p0}, Lcom/cmcm/ad/ui/a/a;->i()V

    goto :goto_8
.end method

.method private h()V
    .registers 4

    .prologue
    .line 116
    iget-object v0, p0, Lcom/cmcm/ad/ui/a/a;->a:Lcom/cm/plugincluster/ad/IAd;

    invoke-interface {v0}, Lcom/cm/plugincluster/ad/IAd;->getAdButtonText()Ljava/lang/String;

    move-result-object v0

    .line 117
    iget-object v1, p0, Lcom/cmcm/ad/ui/a/a;->a:Lcom/cm/plugincluster/ad/IAd;

    invoke-interface {v1}, Lcom/cm/plugincluster/ad/IAd;->getAdBehaviorType()I

    move-result v1

    const/4 v2, 0x2

    if-ne v1, v2, :cond_33

    .line 118
    invoke-static {v0}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z

    move-result v1

    if-eqz v1, :cond_29

    .line 119
    iget-object v0, p0, Lcom/cmcm/ad/ui/a/a;->b:Landroid/widget/Button;

    invoke-static {}, Lcom/cleanmaster/pluginscommonlib/n;->b()Landroid/content/Context;

    move-result-object v1

    invoke-virtual {v1}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object v1

    sget v2, Lcom/cmcm/ad/R$string;->download_open:I

    invoke-virtual {v1, v2}, Landroid/content/res/Resources;->getString(I)Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v1}, Landroid/widget/Button;->setText(Ljava/lang/CharSequence;)V

    .line 134
    :goto_28
    return-void

    .line 121
    :cond_29
    iget-object v1, p0, Lcom/cmcm/ad/ui/a/a;->b:Landroid/widget/Button;

    invoke-virtual {v0}, Ljava/lang/String;->toUpperCase()Ljava/lang/String;

    move-result-object v0

    invoke-virtual {v1, v0}, Landroid/widget/Button;->setText(Ljava/lang/CharSequence;)V

    goto :goto_28

    .line 124
    :cond_33
    invoke-virtual {p0}, Lcom/cmcm/ad/ui/a/a;->c()Z

    move-result v1

    if-eqz v1, :cond_41

    iget-boolean v1, p0, Lcom/cmcm/ad/ui/a/a;->c:Z

    if-eqz v1, :cond_41

    .line 125
    invoke-virtual {p0}, Lcom/cmcm/ad/ui/a/a;->a()V

    goto :goto_28

    .line 127
    :cond_41
    invoke-static {v0}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z

    move-result v1

    if-eqz v1, :cond_5b

    .line 128
    iget-object v0, p0, Lcom/cmcm/ad/ui/a/a;->b:Landroid/widget/Button;

    invoke-static {}, Lcom/cleanmaster/pluginscommonlib/n;->b()Landroid/content/Context;

    move-result-object v1

    invoke-virtual {v1}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object v1

    sget v2, Lcom/cmcm/ad/R$string;->download_download:I

    invoke-virtual {v1, v2}, Landroid/content/res/Resources;->getString(I)Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v1}, Landroid/widget/Button;->setText(Ljava/lang/CharSequence;)V

    goto :goto_28

    .line 130
    :cond_5b
    iget-object v1, p0, Lcom/cmcm/ad/ui/a/a;->b:Landroid/widget/Button;

    invoke-virtual {v0}, Ljava/lang/String;->toUpperCase()Ljava/lang/String;

    move-result-object v0

    invoke-virtual {v1, v0}, Landroid/widget/Button;->setText(Ljava/lang/CharSequence;)V

    goto :goto_28
.end method

.method private i()V
    .registers 2

    .prologue
    .line 217
    iget-boolean v0, p0, Lcom/cmcm/ad/ui/a/a;->c:Z

    if-nez v0, :cond_5

    .line 221
    :goto_4
    return-void

    .line 220
    :cond_5
    iget-object v0, p0, Lcom/cmcm/ad/ui/a/a;->d:Lcom/cm/plugincluster/common/interfaces/downloader/DownLoadListener;

    invoke-static {v0}, Lcom/cleanmaster/hpsharelib/utils/CMDownloadManager;->addListener(Lcom/cm/plugincluster/common/interfaces/downloader/DownLoadListener;)V

    goto :goto_4
.end method

.method private j()V
    .registers 2

    .prologue
    .line 224
    iget-object v0, p0, Lcom/cmcm/ad/ui/a/a;->d:Lcom/cm/plugincluster/common/interfaces/downloader/DownLoadListener;

    invoke-static {v0}, Lcom/cleanmaster/hpsharelib/utils/CMDownloadManager;->removeListener(Lcom/cm/plugincluster/common/interfaces/downloader/DownLoadListener;)V

    .line 225
    return-void
.end method


# virtual methods
.method protected a()V
    .registers 3

    .prologue
    .line 138
    iget-object v0, p0, Lcom/cmcm/ad/ui/a/a;->a:Lcom/cm/plugincluster/ad/IAd;

    if-eqz v0, :cond_8

    iget-object v0, p0, Lcom/cmcm/ad/ui/a/a;->b:Landroid/widget/Button;

    if-nez v0, :cond_9

    .line 148
    :cond_8
    :goto_8
    return-void

    .line 142
    :cond_9
    iget-object v0, p0, Lcom/cmcm/ad/ui/a/a;->a:Lcom/cm/plugincluster/ad/IAd;

    invoke-interface {v0}, Lcom/cm/plugincluster/ad/IAd;->getDownloadInfo()Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadAppInfo;

    move-result-object v0

    .line 143
    if-eqz v0, :cond_8

    .line 147
    iget-object v1, p0, Lcom/cmcm/ad/ui/a/a;->b:Landroid/widget/Button;

    invoke-virtual {p0, v1, v0}, Lcom/cmcm/ad/ui/a/a;->a(Landroid/widget/Button;Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadAppInfo;)V

    goto :goto_8
.end method

.method public a(Landroid/widget/Button;Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadAppInfo;)V
    .registers 5

    .prologue
    .line 152
    if-eqz p1, :cond_4

    if-nez p2, :cond_5

    .line 180
    :cond_4
    :goto_4
    return-void

    .line 156
    :cond_5
    invoke-virtual {p2}, Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadAppInfo;->getState()I

    move-result v0

    packed-switch v0, :pswitch_data_5c

    :pswitch_c
    goto :goto_4

    .line 158
    :pswitch_d
    invoke-static {}, Lcom/cleanmaster/pluginscommonlib/n;->b()Landroid/content/Context;

    move-result-object v0

    sget v1, Lcom/cmcm/ad/R$string;->download_download:I

    invoke-virtual {v0, v1}, Landroid/content/Context;->getString(I)Ljava/lang/String;

    move-result-object v0

    invoke-virtual {p1, v0}, Landroid/widget/Button;->setText(Ljava/lang/CharSequence;)V

    goto :goto_4

    .line 162
    :pswitch_1b
    invoke-virtual {p2}, Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadAppInfo;->getPercent()Ljava/lang/String;

    move-result-object v0

    invoke-virtual {p1, v0}, Landroid/widget/Button;->setText(Ljava/lang/CharSequence;)V

    goto :goto_4

    .line 165
    :pswitch_23
    invoke-static {}, Lcom/cleanmaster/pluginscommonlib/n;->b()Landroid/content/Context;

    move-result-object v0

    sget v1, Lcom/cmcm/ad/R$string;->download_install:I

    invoke-virtual {v0, v1}, Landroid/content/Context;->getString(I)Ljava/lang/String;

    move-result-object v0

    invoke-virtual {p1, v0}, Landroid/widget/Button;->setText(Ljava/lang/CharSequence;)V

    goto :goto_4

    .line 169
    :pswitch_31
    invoke-static {}, Lcom/cleanmaster/pluginscommonlib/n;->b()Landroid/content/Context;

    move-result-object v0

    sget v1, Lcom/cmcm/ad/R$string;->download_continue:I

    invoke-virtual {v0, v1}, Landroid/content/Context;->getString(I)Ljava/lang/String;

    move-result-object v0

    invoke-virtual {p1, v0}, Landroid/widget/Button;->setText(Ljava/lang/CharSequence;)V

    goto :goto_4

    .line 172
    :pswitch_3f
    invoke-static {}, Lcom/cleanmaster/pluginscommonlib/n;->b()Landroid/content/Context;

    move-result-object v0

    sget v1, Lcom/cmcm/ad/R$string;->download_retry:I

    invoke-virtual {v0, v1}, Landroid/content/Context;->getString(I)Ljava/lang/String;

    move-result-object v0

    invoke-virtual {p1, v0}, Landroid/widget/Button;->setText(Ljava/lang/CharSequence;)V

    goto :goto_4

    .line 175
    :pswitch_4d
    invoke-static {}, Lcom/cleanmaster/pluginscommonlib/n;->b()Landroid/content/Context;

    move-result-object v0

    sget v1, Lcom/cmcm/ad/R$string;->download_open:I

    invoke-virtual {v0, v1}, Landroid/content/Context;->getString(I)Ljava/lang/String;

    move-result-object v0

    invoke-virtual {p1, v0}, Landroid/widget/Button;->setText(Ljava/lang/CharSequence;)V

    goto :goto_4

    .line 156
    nop

    :pswitch_data_5c
    .packed-switch 0x0
        :pswitch_d
        :pswitch_1b
        :pswitch_1b
        :pswitch_23
        :pswitch_31
        :pswitch_3f
        :pswitch_c
        :pswitch_31
        :pswitch_4d
    .end packed-switch
.end method

.method public a(Lcom/cm/plugincluster/ad/IAd;Landroid/widget/Button;Z)V
    .registers 6

    .prologue
    .line 57
    iput-boolean p3, p0, Lcom/cmcm/ad/ui/a/a;->c:Z

    .line 58
    if-eqz p1, :cond_6

    if-nez p2, :cond_7

    .line 70
    :cond_6
    :goto_6
    return-void

    .line 62
    :cond_7
    iput-object p1, p0, Lcom/cmcm/ad/ui/a/a;->a:Lcom/cm/plugincluster/ad/IAd;

    .line 63
    iput-object p2, p0, Lcom/cmcm/ad/ui/a/a;->b:Landroid/widget/Button;

    .line 64
    invoke-direct {p0}, Lcom/cmcm/ad/ui/a/a;->e()V

    .line 65
    invoke-interface {p1}, Lcom/cm/plugincluster/ad/IAd;->getAdSourceType()I

    move-result v0

    const/4 v1, 0x1

    if-eq v0, v1, :cond_1c

    invoke-interface {p1}, Lcom/cm/plugincluster/ad/IAd;->getAdSourceType()I

    move-result v0

    const/4 v1, 0x2

    if-ne v0, v1, :cond_20

    .line 66
    :cond_1c
    invoke-direct {p0}, Lcom/cmcm/ad/ui/a/a;->g()V

    goto :goto_6

    .line 68
    :cond_20
    invoke-direct {p0}, Lcom/cmcm/ad/ui/a/a;->f()V

    goto :goto_6
.end method

.method public b()V
    .registers 3

    .prologue
    .line 183
    iget-object v0, p0, Lcom/cmcm/ad/ui/a/a;->a:Lcom/cm/plugincluster/ad/IAd;

    if-eqz v0, :cond_8

    iget-object v0, p0, Lcom/cmcm/ad/ui/a/a;->b:Landroid/widget/Button;

    if-nez v0, :cond_9

    .line 197
    :cond_8
    :goto_8
    return-void

    .line 186
    :cond_9
    iget-object v0, p0, Lcom/cmcm/ad/ui/a/a;->a:Lcom/cm/plugincluster/ad/IAd;

    invoke-interface {v0}, Lcom/cm/plugincluster/ad/IAd;->getAdButtonText()Ljava/lang/String;

    move-result-object v0

    .line 193
    invoke-static {v0}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z

    move-result v1

    if-eqz v1, :cond_23

    .line 194
    invoke-static {}, Lcom/cleanmaster/pluginscommonlib/n;->b()Landroid/content/Context;

    move-result-object v0

    invoke-virtual {v0}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object v0

    sget v1, Lcom/cmcm/ad/R$string;->market_download:I

    invoke-virtual {v0, v1}, Landroid/content/res/Resources;->getString(I)Ljava/lang/String;

    move-result-object v0

    .line 196
    :cond_23
    iget-object v1, p0, Lcom/cmcm/ad/ui/a/a;->b:Landroid/widget/Button;

    invoke-virtual {v0}, Ljava/lang/String;->toUpperCase()Ljava/lang/String;

    move-result-object v0

    invoke-virtual {v1, v0}, Landroid/widget/Button;->setText(Ljava/lang/CharSequence;)V

    goto :goto_8
.end method

.method protected c()Z
    .registers 3

    .prologue
    const/4 v0, 0x0

    .line 201
    iget-object v1, p0, Lcom/cmcm/ad/ui/a/a;->a:Lcom/cm/plugincluster/ad/IAd;

    if-nez v1, :cond_6

    .line 213
    :cond_5
    :goto_5
    return v0

    .line 205
    :cond_6
    iget-object v1, p0, Lcom/cmcm/ad/ui/a/a;->a:Lcom/cm/plugincluster/ad/IAd;

    invoke-interface {v1}, Lcom/cm/plugincluster/ad/IAd;->getDownloadInfo()Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadAppInfo;

    move-result-object v1

    if-eqz v1, :cond_5

    .line 209
    iget-object v1, p0, Lcom/cmcm/ad/ui/a/a;->a:Lcom/cm/plugincluster/ad/IAd;

    invoke-interface {v1}, Lcom/cm/plugincluster/ad/IAd;->getDownloadInfo()Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadAppInfo;

    move-result-object v1

    invoke-virtual {v1}, Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadAppInfo;->getDownloadState()Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadState;

    move-result-object v1

    .line 210
    if-eqz v1, :cond_5

    invoke-virtual {v1}, Lcom/cm/plugincluster/common/interfaces/downloader/bean/DownloadState;->getState()I

    move-result v1

    if-eqz v1, :cond_5

    .line 213
    const/4 v0, 0x1

    goto :goto_5
.end method

.method public d()V
    .registers 2

    .prologue
    const/4 v0, 0x0

    .line 232
    iput-object v0, p0, Lcom/cmcm/ad/ui/a/a;->a:Lcom/cm/plugincluster/ad/IAd;

    .line 233
    iput-object v0, p0, Lcom/cmcm/ad/ui/a/a;->b:Landroid/widget/Button;

    .line 235
    invoke-direct {p0}, Lcom/cmcm/ad/ui/a/a;->j()V

    .line 236
    return-void
.end method