.class Lcom/moji/mjweather/assshop/voice/AvatarSettingFragment$4;
.super Ljava/lang/Thread;
.source "AvatarSettingFragment.java"


# annotations
.annotation system Ldalvik/annotation/EnclosingMethod;
    value = Lcom/moji/mjweather/assshop/voice/AvatarSettingFragment;->a()V
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x0
    name = null
.end annotation


# instance fields
.field final synthetic a:Lcom/moji/mjweather/assshop/voice/AvatarSettingFragment;


# direct methods
.method constructor <init>(Lcom/moji/mjweather/assshop/voice/AvatarSettingFragment;)V
    .locals 0

    .line 304
    iput-object p1, p0, Lcom/moji/mjweather/assshop/voice/AvatarSettingFragment$4;->a:Lcom/moji/mjweather/assshop/voice/AvatarSettingFragment;

    invoke-direct {p0}, Ljava/lang/Thread;-><init>()V

    return-void
.end method


# virtual methods
.method public run()V
    .locals 6

    .line 307
    invoke-super {p0}, Ljava/lang/Thread;->run()V

    .line 309
    iget-object v0, p0, Lcom/moji/mjweather/assshop/voice/AvatarSettingFragment$4;->a:Lcom/moji/mjweather/assshop/voice/AvatarSettingFragment;

    invoke-static {v0}, Lcom/moji/mjweather/assshop/voice/AvatarSettingFragment;->c(Lcom/moji/mjweather/assshop/voice/AvatarSettingFragment;)Ljava/util/List;

    move-result-object v0

    invoke-interface {v0}, Ljava/util/List;->iterator()Ljava/util/Iterator;

    move-result-object v0

    :cond_0
    :goto_0
    invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z

    move-result v1

    if-eqz v1, :cond_3

    invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Lcom/moji/mjad/avatar/data/AvatarInfo;

    .line 310
    new-instance v2, Ljava/lang/StringBuilder;

    invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V

    sget-object v3, Lcom/moji/mjweather/weather/avatar/AvatarImageUtil;->a:Ljava/lang/String;

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    const-string v3, "avatar"

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

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

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    .line 312
    iget-object v3, p0, Lcom/moji/mjweather/assshop/voice/AvatarSettingFragment$4;->a:Lcom/moji/mjweather/assshop/voice/AvatarSettingFragment;

    invoke-static {v3, v2}, Lcom/moji/mjweather/assshop/voice/AvatarSettingFragment;->a(Lcom/moji/mjweather/assshop/voice/AvatarSettingFragment;Ljava/lang/String;)Z

    move-result v2

    .line 313
    iget-object v3, p0, Lcom/moji/mjweather/assshop/voice/AvatarSettingFragment$4;->a:Lcom/moji/mjweather/assshop/voice/AvatarSettingFragment;

    iget v4, v1, Lcom/moji/mjad/avatar/data/AvatarInfo;->voiceId:I

    iget v5, v1, Lcom/moji/mjad/avatar/data/AvatarInfo;->id:I

    invoke-static {v3, v4, v5}, Lcom/moji/mjweather/assshop/voice/AvatarSettingFragment;->a(Lcom/moji/mjweather/assshop/voice/AvatarSettingFragment;II)Z

    if-eqz v2, :cond_1

    .line 315
    new-instance v2, Lcom/moji/mjweather/assshop/db/AvatarDBManager;

    invoke-direct {v2}, Lcom/moji/mjweather/assshop/db/AvatarDBManager;-><init>()V

    .line 316
    iget v3, v1, Lcom/moji/mjad/avatar/data/AvatarInfo;->id:I

    invoke-virtual {v2, v3}, Lcom/moji/mjweather/assshop/db/AvatarDBManager;->a(I)V

    .line 319
    :cond_1
    sget-object v2, Lcom/moji/mjad/avatar/data/AVATAR_STATUS;->AVATAR_STATE_UNDOWNLOAD:Lcom/moji/mjad/avatar/data/AVATAR_STATUS;

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

    .line 320
    invoke-static {}, Lorg/greenrobot/eventbus/EventBus;->a()Lorg/greenrobot/eventbus/EventBus;

    move-result-object v2

    new-instance v3, Lcom/moji/mjweather/assshop/event/AvatarStateChangedEvent;

    const/4 v4, 0x4

    invoke-direct {v3, v1, v4}, Lcom/moji/mjweather/assshop/event/AvatarStateChangedEvent;-><init>(Lcom/moji/mjad/avatar/data/AvatarInfo;I)V

    invoke-virtual {v2, v3}, Lorg/greenrobot/eventbus/EventBus;->d(Ljava/lang/Object;)V

    const-string v2, "ad_suit_avatar"

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

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

    move-result v1

    if-eqz v1, :cond_0

    .line 323
    new-instance v1, Lcom/moji/mjad/common/db/AdSuitAvatrDBManager;

    invoke-static {}, Lcom/moji/tool/AppDelegate;->a()Landroid/content/Context;

    move-result-object v2

    invoke-direct {v1, v2}, Lcom/moji/mjad/common/db/AdSuitAvatrDBManager;-><init>(Landroid/content/Context;)V

    .line 324
    invoke-virtual {v1}, Lcom/moji/mjad/common/db/AdSuitAvatrDBManager;->a()Lcom/moji/mjad/avatar/data/AvatarSuitAdInfo;

    move-result-object v2

    if-eqz v2, :cond_2

    .line 325
    iget-object v3, v2, Lcom/moji/mjad/avatar/data/AvatarSuitAdInfo;->avatarInfo:Lcom/moji/mjad/avatar/data/AvatarInfo;

    if-eqz v3, :cond_2

    .line 326
    iget-object v3, v2, Lcom/moji/mjad/avatar/data/AvatarSuitAdInfo;->avatarInfo:Lcom/moji/mjad/avatar/data/AvatarInfo;

    const-string v4, "delete"

    iput-object v4, v3, Lcom/moji/mjad/avatar/data/AvatarInfo;->endDate:Ljava/lang/String;

    :cond_2
    const/4 v3, 0x0

    .line 328
    invoke-virtual {v1, v3, v2}, Lcom/moji/mjad/common/db/AdSuitAvatrDBManager;->a(ILcom/moji/mjad/avatar/data/AvatarSuitAdInfo;)Z

    goto :goto_0

    .line 331
    :cond_3
    iget-object v0, p0, Lcom/moji/mjweather/assshop/voice/AvatarSettingFragment$4;->a:Lcom/moji/mjweather/assshop/voice/AvatarSettingFragment;

    invoke-static {v0}, Lcom/moji/mjweather/assshop/voice/AvatarSettingFragment;->c(Lcom/moji/mjweather/assshop/voice/AvatarSettingFragment;)Ljava/util/List;

    move-result-object v0

    invoke-interface {v0}, Ljava/util/List;->clear()V

    return-void
.end method
