.class public Lcom/moji/mjweather/assshop/control/state/UpdateState;
.super Lcom/moji/mjweather/assshop/control/state/AvatarState;
.source "UpdateState.java"


# instance fields
.field private downloadTask:Lcom/moji/mjweather/assshop/task/AvatarDownloadVoiceTask;


# direct methods
.method public constructor <init>(Lcom/moji/mjad/avatar/data/AvatarInfo;)V
    .locals 0

    .line 26
    invoke-direct {p0, p1}, Lcom/moji/mjweather/assshop/control/state/AvatarState;-><init>(Lcom/moji/mjad/avatar/data/AvatarInfo;)V

    return-void
.end method


# virtual methods
.method public handleButtonClick(Lcom/moji/mjweather/assshop/task/AvatarDownloadTask$OnDownLoadListener;)V
    .locals 2

    .line 51
    invoke-static {}, Lcom/moji/tool/DeviceTool;->a()Z

    move-result v0

    if-nez v0, :cond_0

    const p1, 0x7f0e06b3

    .line 52
    invoke-static {p1}, Lcom/moji/tool/ToastTool;->a(I)V

    return-void

    .line 55
    :cond_0
    invoke-static {}, Lcom/moji/tool/DeviceTool;->m()Z

    move-result v0

    if-nez v0, :cond_1

    const p1, 0x7f0e0588

    .line 56
    invoke-static {p1}, Lcom/moji/tool/ToastTool;->a(I)V

    return-void

    .line 60
    :cond_1
    iget-object v0, p0, Lcom/moji/mjweather/assshop/control/state/UpdateState;->downloadTask:Lcom/moji/mjweather/assshop/task/AvatarDownloadVoiceTask;

    if-eqz v0, :cond_2

    iget-object v0, p0, Lcom/moji/mjweather/assshop/control/state/UpdateState;->downloadTask:Lcom/moji/mjweather/assshop/task/AvatarDownloadVoiceTask;

    iget-boolean v0, v0, Lcom/moji/mjweather/assshop/task/AvatarDownloadVoiceTask;->b:Z

    if-nez v0, :cond_3

    :cond_2
    const/4 v0, 0x1

    const/4 v1, 0x0

    .line 61
    invoke-virtual {p0, v0, v1}, Lcom/moji/mjweather/assshop/control/state/UpdateState;->handleChange(ZLjava/lang/Object;)V

    .line 62
    new-instance v0, Lcom/moji/mjweather/assshop/task/AvatarDownloadVoiceTask;

    iget-object v1, p0, Lcom/moji/mjweather/assshop/control/state/UpdateState;->mAvatarData:Lcom/moji/mjad/avatar/data/AvatarInfo;

    invoke-direct {v0, v1, p1}, Lcom/moji/mjweather/assshop/task/AvatarDownloadVoiceTask;-><init>(Lcom/moji/mjad/avatar/data/AvatarInfo;Lcom/moji/mjweather/assshop/task/AvatarDownloadTask$OnDownLoadListener;)V

    iput-object v0, p0, Lcom/moji/mjweather/assshop/control/state/UpdateState;->downloadTask:Lcom/moji/mjweather/assshop/task/AvatarDownloadVoiceTask;

    .line 63
    iget-object p1, p0, Lcom/moji/mjweather/assshop/control/state/UpdateState;->downloadTask:Lcom/moji/mjweather/assshop/task/AvatarDownloadVoiceTask;

    sget-object v0, Lcom/moji/tool/thread/ThreadType;->IO_THREAD:Lcom/moji/tool/thread/ThreadType;

    const/4 v1, 0x0

    new-array v1, v1, [Ljava/lang/Void;

    invoke-virtual {p1, v0, v1}, Lcom/moji/mjweather/assshop/task/AvatarDownloadVoiceTask;->a(Lcom/moji/tool/thread/ThreadType;[Ljava/lang/Object;)Lcom/moji/tool/thread/task/MJAsyncTask;

    :cond_3
    return-void
.end method

.method public handleChange(ZLjava/lang/Object;)V
    .locals 0

    .line 31
    iget-object p1, p0, Lcom/moji/mjweather/assshop/control/state/UpdateState;->mAvatarData:Lcom/moji/mjad/avatar/data/AvatarInfo;

    sget-object p2, Lcom/moji/mjad/avatar/data/AVATAR_STATUS;->AVATAR_STATE_UPDATING:Lcom/moji/mjad/avatar/data/AVATAR_STATUS;

    iput-object p2, p1, Lcom/moji/mjad/avatar/data/AvatarInfo;->status:Lcom/moji/mjad/avatar/data/AVATAR_STATUS;

    return-void
.end method

.method public setViewState(Lcom/moji/mjweather/assshop/data/avatar/AvatarViewHolder;)V
    .locals 2

    .line 36
    iget-object v0, p1, Lcom/moji/mjweather/assshop/data/avatar/AvatarViewHolder;->j:Landroid/widget/FrameLayout;

    const/16 v1, 0x8

    invoke-virtual {v0, v1}, Landroid/widget/FrameLayout;->setVisibility(I)V

    .line 37
    iget-object v0, p1, Lcom/moji/mjweather/assshop/data/avatar/AvatarViewHolder;->k:Landroid/widget/TextView;

    const/4 v1, 0x0

    invoke-virtual {v0, v1}, Landroid/widget/TextView;->setVisibility(I)V

    .line 38
    iget-object v0, p0, Lcom/moji/mjweather/assshop/control/state/UpdateState;->mAvatarData:Lcom/moji/mjad/avatar/data/AvatarInfo;

    iget v0, v0, Lcom/moji/mjad/avatar/data/AvatarInfo;->type:I

    sget-object v1, Lcom/moji/mjweather/assshop/data/enumdata/AVATAR_DATA_TYPE;->AVATAR_TYPE_AD:Lcom/moji/mjweather/assshop/data/enumdata/AVATAR_DATA_TYPE;

    iget v1, v1, Lcom/moji/mjweather/assshop/data/enumdata/AVATAR_DATA_TYPE;->id:I

    if-ne v0, v1, :cond_0

    const-string v0, "ad_suit_avatar"

    iget-object v1, p0, Lcom/moji/mjweather/assshop/control/state/UpdateState;->mAvatarData:Lcom/moji/mjad/avatar/data/AvatarInfo;

    iget-object v1, v1, Lcom/moji/mjad/avatar/data/AvatarInfo;->strartDate:Ljava/lang/String;

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

    move-result v0

    if-nez v0, :cond_0

    iget-object v0, p0, Lcom/moji/mjweather/assshop/control/state/UpdateState;->mAvatarData:Lcom/moji/mjad/avatar/data/AvatarInfo;

    iget-object v0, v0, Lcom/moji/mjad/avatar/data/AvatarInfo;->strartDate:Ljava/lang/String;

    iget-object v1, p0, Lcom/moji/mjweather/assshop/control/state/UpdateState;->mAvatarData:Lcom/moji/mjad/avatar/data/AvatarInfo;

    iget-object v1, v1, Lcom/moji/mjad/avatar/data/AvatarInfo;->endDate:Ljava/lang/String;

    invoke-static {v0, v1}, Lcom/moji/tool/DateFormatTool;->b(Ljava/lang/String;Ljava/lang/String;)Z

    move-result v0

    if-nez v0, :cond_0

    .line 40
    iget-object v0, p1, Lcom/moji/mjweather/assshop/data/avatar/AvatarViewHolder;->k:Landroid/widget/TextView;

    const v1, 0x7f0e011a

    invoke-static {v1}, Lcom/moji/tool/DeviceTool;->f(I)Ljava/lang/String;

    move-result-object v1

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

    .line 41
    iget-object v0, p1, Lcom/moji/mjweather/assshop/data/avatar/AvatarViewHolder;->k:Landroid/widget/TextView;

    const v1, 0x7f08010c

    invoke-virtual {v0, v1}, Landroid/widget/TextView;->setBackgroundResource(I)V

    goto :goto_0

    .line 44
    :cond_0
    iget-object v0, p1, Lcom/moji/mjweather/assshop/data/avatar/AvatarViewHolder;->k:Landroid/widget/TextView;

    const v1, 0x7f0e0115

    invoke-static {v1}, Lcom/moji/tool/DeviceTool;->f(I)Ljava/lang/String;

    move-result-object v1

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

    .line 46
    :goto_0
    iget-object p1, p1, Lcom/moji/mjweather/assshop/data/avatar/AvatarViewHolder;->k:Landroid/widget/TextView;

    sget-object v0, Lcom/moji/mjweather/MJApplication;->sContext:Landroid/content/Context;

    const v1, 0x7f0601cf

    invoke-static {v0, v1}, Lcom/moji/tool/DeviceTool;->a(Landroid/content/Context;I)I

    move-result v0

    invoke-virtual {p1, v0}, Landroid/widget/TextView;->setTextColor(I)V

    return-void
.end method
