.class public Lcom/moji/mjweather/assshop/fragment/AssistBaseFragment;
.super Lcom/moji/base/MJFragment;
.source "AssistBaseFragment.java"

# interfaces
.implements Landroid/view/View$OnClickListener;


# instance fields
.field public b:Lcom/moji/mjweather/assshop/data/enumdata/ITEM_TYPE;

.field public c:Z

.field public d:Lcom/moji/mjweather/assshop/adapter/avatar/AvatarShopAdapter;

.field public e:Ljava/util/List;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/List<",
            "Lcom/moji/mjad/avatar/data/AvatarInfo;",
            ">;"
        }
    .end annotation
.end field


# direct methods
.method public constructor <init>()V
    .locals 1

    .line 43
    invoke-direct {p0}, Lcom/moji/base/MJFragment;-><init>()V

    .line 63
    new-instance v0, Ljava/util/ArrayList;

    invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V

    iput-object v0, p0, Lcom/moji/mjweather/assshop/fragment/AssistBaseFragment;->e:Ljava/util/List;

    return-void
.end method

.method private a()V
    .locals 3

    .line 233
    new-instance v0, Lcom/moji/mjweather/assshop/fragment/AssistBaseFragment$2;

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

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

    sget-object v2, Lcom/moji/tool/thread/ThreadPriority;->NORMAL:Lcom/moji/tool/thread/ThreadPriority;

    invoke-static {v0, v1, v2}, Lcom/moji/tool/thread/MJPools;->a(Ljava/lang/Runnable;Lcom/moji/tool/thread/ThreadType;Lcom/moji/tool/thread/ThreadPriority;)I

    return-void
.end method


# virtual methods
.method public a(Lcom/moji/mjweather/assshop/data/enumdata/ITEM_TYPE;)Lcom/moji/mjweather/assshop/adapter/avatar/AvatarShopAdapter;
    .locals 3

    .line 116
    new-instance v0, Lcom/moji/mjweather/assshop/adapter/avatar/AvatarShopAdapter;

    invoke-virtual {p0}, Lcom/moji/mjweather/assshop/fragment/AssistBaseFragment;->getActivity()Landroid/support/v4/app/FragmentActivity;

    move-result-object v1

    invoke-virtual {v1}, Landroid/support/v4/app/FragmentActivity;->getApplicationContext()Landroid/content/Context;

    move-result-object v1

    iget-object v2, p0, Lcom/moji/mjweather/assshop/fragment/AssistBaseFragment;->e:Ljava/util/List;

    invoke-direct {v0, v1, p1, v2, p0}, Lcom/moji/mjweather/assshop/adapter/avatar/AvatarShopAdapter;-><init>(Landroid/content/Context;Lcom/moji/mjweather/assshop/data/enumdata/ITEM_TYPE;Ljava/util/List;Landroid/view/View$OnClickListener;)V

    iput-object v0, p0, Lcom/moji/mjweather/assshop/fragment/AssistBaseFragment;->d:Lcom/moji/mjweather/assshop/adapter/avatar/AvatarShopAdapter;

    .line 117
    iget-object p1, p0, Lcom/moji/mjweather/assshop/fragment/AssistBaseFragment;->d:Lcom/moji/mjweather/assshop/adapter/avatar/AvatarShopAdapter;

    return-object p1
.end method

.method protected a(Ljava/util/List;)Ljava/util/List;
    .locals 5
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/util/List<",
            "Lcom/moji/mjad/avatar/data/AvatarInfo;",
            ">;)",
            "Ljava/util/List<",
            "Lcom/moji/mjad/avatar/data/AvatarInfo;",
            ">;"
        }
    .end annotation

    .line 67
    new-instance v0, Ljava/util/ArrayList;

    invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V

    if-eqz p1, :cond_3

    .line 68
    invoke-interface {p1}, Ljava/util/List;->isEmpty()Z

    move-result v1

    if-nez v1, :cond_3

    .line 69
    invoke-interface {p1}, Ljava/util/List;->iterator()Ljava/util/Iterator;

    move-result-object p1

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

    move-result v1

    if-eqz v1, :cond_3

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

    move-result-object v1

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

    if-eqz v1, :cond_0

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

    invoke-static {v2}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z

    move-result v2

    if-eqz v2, :cond_1

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

    invoke-static {v2}, Ljava/lang/String;->valueOf(I)Ljava/lang/String;

    move-result-object v2

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

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

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

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

    move-result v2

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

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

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

    if-ne v3, v4, :cond_2

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

    invoke-static {}, Lcom/moji/mjweather/weather/avatar/AvatarImageUtil;->c()I

    move-result v4

    if-ne v3, v4, :cond_2

    const-string v3, "ad_suit_avatar"

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

    .line 76
    invoke-virtual {v3, v4}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v3

    if-nez v3, :cond_2

    if-nez v2, :cond_2

    .line 77
    invoke-direct {p0}, Lcom/moji/mjweather/assshop/fragment/AssistBaseFragment;->a()V

    .line 79
    :cond_2
    new-instance v2, Lcom/moji/mjweather/assshop/control/AvatarStateControl;

    invoke-virtual {p0}, Lcom/moji/mjweather/assshop/fragment/AssistBaseFragment;->getActivity()Landroid/support/v4/app/FragmentActivity;

    move-result-object v3

    invoke-direct {v2, v1, v3}, Lcom/moji/mjweather/assshop/control/AvatarStateControl;-><init>(Lcom/moji/mjad/avatar/data/AvatarInfo;Landroid/content/Context;)V

    .line 80
    invoke-virtual {v2}, Lcom/moji/mjweather/assshop/control/AvatarStateControl;->setAvatarStatus()V

    .line 81
    invoke-interface {v0, v1}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    goto :goto_0

    :cond_3
    return-object v0
.end method

.method public a(Lcom/moji/mjad/avatar/data/AvatarInfo;)V
    .locals 3

    if-eqz p1, :cond_0

    .line 220
    :try_start_0
    iget-object v0, p1, Lcom/moji/mjad/avatar/data/AvatarInfo;->status:Lcom/moji/mjad/avatar/data/AVATAR_STATUS;

    sget-object v1, Lcom/moji/mjad/avatar/data/AVATAR_STATUS;->AVATAR_STATE_DOWNLOADING:Lcom/moji/mjad/avatar/data/AVATAR_STATUS;

    if-eq v0, v1, :cond_0

    .line 221
    new-instance v0, Landroid/content/Intent;

    invoke-virtual {p0}, Lcom/moji/mjweather/assshop/fragment/AssistBaseFragment;->getActivity()Landroid/support/v4/app/FragmentActivity;

    move-result-object v1

    const-class v2, Lcom/moji/mjweather/assshop/activity/AvatarDialogActivity;

    invoke-direct {v0, v1, v2}, Landroid/content/Intent;-><init>(Landroid/content/Context;Ljava/lang/Class;)V

    .line 222
    new-instance v1, Landroid/os/Bundle;

    invoke-direct {v1}, Landroid/os/Bundle;-><init>()V

    const-string v2, "avatar_dialog_data"

    .line 223
    invoke-virtual {v1, v2, p1}, Landroid/os/Bundle;->putSerializable(Ljava/lang/String;Ljava/io/Serializable;)V

    const-string p1, "avatar_dialog_data"

    .line 224
    invoke-virtual {v0, p1, v1}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Landroid/os/Bundle;)Landroid/content/Intent;

    .line 225
    invoke-virtual {p0, v0}, Lcom/moji/mjweather/assshop/fragment/AssistBaseFragment;->startActivity(Landroid/content/Intent;)V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_0

    :catch_0
    move-exception p1

    const-string v0, "AssistBaseFragment"

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

    :cond_0
    :goto_0
    return-void
.end method

.method protected a(Landroid/widget/AbsListView;)Z
    .locals 2

    if-eqz p1, :cond_0

    .line 251
    invoke-virtual {p1}, Landroid/widget/AbsListView;->getChildCount()I

    move-result v0

    if-lez v0, :cond_0

    const/4 v0, 0x0

    .line 252
    invoke-virtual {p1, v0}, Landroid/widget/AbsListView;->getChildAt(I)Landroid/view/View;

    move-result-object v1

    if-eqz v1, :cond_0

    invoke-virtual {p1, v0}, Landroid/widget/AbsListView;->getChildAt(I)Landroid/view/View;

    move-result-object v1

    invoke-virtual {v1}, Landroid/view/View;->getTop()I

    move-result v1

    invoke-virtual {p1}, Landroid/widget/AbsListView;->getPaddingTop()I

    move-result p1

    sub-int/2addr v1, p1

    if-gez v1, :cond_0

    return v0

    :cond_0
    const/4 p1, 0x1

    return p1
.end method

.method protected b(Ljava/util/List;)Ljava/util/List;
    .locals 3
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/util/List<",
            "Lcom/moji/mjad/avatar/data/AvatarInfo;",
            ">;)",
            "Ljava/util/List<",
            "Lcom/moji/mjad/avatar/data/AvatarInfo;",
            ">;"
        }
    .end annotation

    .line 96
    :try_start_0
    new-instance v0, Lcom/moji/mjad/common/db/AdSuitAvatrDBManager;

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

    move-result-object v1

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

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

    move-result-object v0

    const/4 v1, 0x0

    const/4 v2, 0x0

    if-eqz v0, :cond_0

    .line 100
    iget-object v1, v0, Lcom/moji/mjad/avatar/data/AvatarSuitAdInfo;->avatarInfo:Lcom/moji/mjad/avatar/data/AvatarInfo;

    .line 101
    iget-object v0, v0, Lcom/moji/mjad/avatar/data/AvatarSuitAdInfo;->assist_detail:Lcom/moji/launchserver/AdCommonInterface$AssistDetail;

    invoke-virtual {v0}, Lcom/moji/launchserver/AdCommonInterface$AssistDetail;->getIndex()I

    move-result v2

    .line 102
    invoke-interface {p1}, Ljava/util/List;->size()I

    move-result v0

    if-le v2, v0, :cond_0

    .line 103
    invoke-interface {p1}, Ljava/util/List;->size()I

    move-result v2

    :cond_0
    if-eqz v1, :cond_1

    if-ltz v2, :cond_1

    .line 107
    invoke-interface {p1, v2, v1}, Ljava/util/List;->add(ILjava/lang/Object;)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, "AssistBaseFragment"

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

    :cond_1
    :goto_0
    return-object p1
.end method

.method public onClick(Landroid/view/View;)V
    .locals 4

    .line 123
    invoke-virtual {p1}, Landroid/view/View;->getId()I

    move-result v0

    const v1, 0x7f0904c1

    if-eq v0, v1, :cond_0

    const v1, 0x7f0909ee

    if-eq v0, v1, :cond_0

    goto/16 :goto_0

    .line 126
    :cond_0
    invoke-static {}, Lcom/moji/mjweather/assshop/weather/WeatherAvatarUtil;->b()Lcom/moji/mjweather/assshop/weather/WeatherAvatarUtil;

    move-result-object v0

    invoke-virtual {v0}, Lcom/moji/mjweather/assshop/weather/WeatherAvatarUtil;->j()V

    .line 127
    invoke-virtual {p1}, Landroid/view/View;->getTag()Ljava/lang/Object;

    move-result-object p1

    check-cast p1, Ljava/lang/Integer;

    invoke-virtual {p1}, Ljava/lang/Integer;->intValue()I

    move-result p1

    .line 128
    iget-object v0, p0, Lcom/moji/mjweather/assshop/fragment/AssistBaseFragment;->e:Ljava/util/List;

    if-eqz v0, :cond_3

    iget-object v0, p0, Lcom/moji/mjweather/assshop/fragment/AssistBaseFragment;->e:Ljava/util/List;

    invoke-interface {v0}, Ljava/util/List;->isEmpty()Z

    move-result v0

    if-nez v0, :cond_3

    iget-object v0, p0, Lcom/moji/mjweather/assshop/fragment/AssistBaseFragment;->e:Ljava/util/List;

    invoke-interface {v0}, Ljava/util/List;->size()I

    move-result v0

    if-ge p1, v0, :cond_3

    iget-object v0, p0, Lcom/moji/mjweather/assshop/fragment/AssistBaseFragment;->e:Ljava/util/List;

    invoke-interface {v0, p1}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v0

    if-eqz v0, :cond_3

    .line 129
    iget-object v0, p0, Lcom/moji/mjweather/assshop/fragment/AssistBaseFragment;->e:Ljava/util/List;

    invoke-interface {v0, p1}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object p1

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

    .line 130
    new-instance v0, Lcom/moji/mjweather/assshop/control/AvatarStateControl;

    invoke-virtual {p0}, Lcom/moji/mjweather/assshop/fragment/AssistBaseFragment;->getActivity()Landroid/support/v4/app/FragmentActivity;

    move-result-object v1

    invoke-direct {v0, p1, v1}, Lcom/moji/mjweather/assshop/control/AvatarStateControl;-><init>(Lcom/moji/mjad/avatar/data/AvatarInfo;Landroid/content/Context;)V

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

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

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

    move-result v1

    .line 132
    iget v2, p1, Lcom/moji/mjad/avatar/data/AvatarInfo;->type:I

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

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

    if-ne v2, v3, :cond_1

    const-string v2, "ad_suit_avatar"

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

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

    move-result v2

    if-nez v2, :cond_1

    if-nez v1, :cond_1

    const p1, 0x7f0e010f

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

    goto :goto_0

    .line 135
    :cond_1
    new-instance v1, Lcom/moji/mjweather/assshop/fragment/AssistBaseFragment$1;

    invoke-direct {v1, p0, p1}, Lcom/moji/mjweather/assshop/fragment/AssistBaseFragment$1;-><init>(Lcom/moji/mjweather/assshop/fragment/AssistBaseFragment;Lcom/moji/mjad/avatar/data/AvatarInfo;)V

    invoke-virtual {v0, v1}, Lcom/moji/mjweather/assshop/control/AvatarStateControl;->handleButtonClick(Lcom/moji/mjweather/assshop/task/AvatarDownloadTask$OnDownLoadListener;)V

    .line 205
    iget-object v0, p0, Lcom/moji/mjweather/assshop/fragment/AssistBaseFragment;->d:Lcom/moji/mjweather/assshop/adapter/avatar/AvatarShopAdapter;

    invoke-virtual {v0}, Lcom/moji/mjweather/assshop/adapter/avatar/AvatarShopAdapter;->notifyDataSetChanged()V

    .line 206
    iget-object v0, p0, Lcom/moji/mjweather/assshop/fragment/AssistBaseFragment;->b:Lcom/moji/mjweather/assshop/data/enumdata/ITEM_TYPE;

    sget-object v1, Lcom/moji/mjweather/assshop/data/enumdata/ITEM_TYPE;->OFFIC_AVATAR:Lcom/moji/mjweather/assshop/data/enumdata/ITEM_TYPE;

    if-ne v0, v1, :cond_2

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

    move-result-object v0

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

    const/4 v2, 0x2

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

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

    goto :goto_0

    .line 208
    :cond_2
    iget-object v0, p0, Lcom/moji/mjweather/assshop/fragment/AssistBaseFragment;->b:Lcom/moji/mjweather/assshop/data/enumdata/ITEM_TYPE;

    sget-object v1, Lcom/moji/mjweather/assshop/data/enumdata/ITEM_TYPE;->STAR_AVATAR:Lcom/moji/mjweather/assshop/data/enumdata/ITEM_TYPE;

    if-ne v0, v1, :cond_3

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

    move-result-object v0

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

    const/4 v2, 0x3

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

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

    :cond_3
    :goto_0
    return-void
.end method

.method public onCreate(Landroid/os/Bundle;)V
    .locals 0

    .line 51
    invoke-super {p0, p1}, Lcom/moji/base/MJFragment;->onCreate(Landroid/os/Bundle;)V

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

    move-result-object p1

    invoke-virtual {p1, p0}, Lorg/greenrobot/eventbus/EventBus;->a(Ljava/lang/Object;)V

    return-void
.end method

.method public onDestroy()V
    .locals 1

    .line 57
    invoke-super {p0}, Lcom/moji/base/MJFragment;->onDestroy()V

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

    move-result-object v0

    invoke-virtual {v0, p0}, Lorg/greenrobot/eventbus/EventBus;->c(Ljava/lang/Object;)V

    return-void
.end method
