ONewsCityResponse.smali

.class public Lcom/cm/plugincluster/news/model/ONewsCityResponse;
.super Ljava/lang/Object;
.source "ONewsCityResponse.java"

# interfaces
.implements Lcom/cm/plugincluster/news/model/ITransformer;


# instance fields
.field cityList:Ljava/util/List;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/List",
            "<",
            "Lcom/cm/plugincluster/news/model/ONewsCity;",
            ">;"
        }
    .end annotation
.end field

.field header:Lcom/cm/plugincluster/news/model/ONewsResponseHeader;


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

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

    .line 19
    new-instance v0, Lcom/cm/plugincluster/news/model/ONewsResponseHeader;

    invoke-direct {v0}, Lcom/cm/plugincluster/news/model/ONewsResponseHeader;-><init>()V

    iput-object v0, p0, Lcom/cm/plugincluster/news/model/ONewsCityResponse;->header:Lcom/cm/plugincluster/news/model/ONewsResponseHeader;

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

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

    iput-object v0, p0, Lcom/cm/plugincluster/news/model/ONewsCityResponse;->cityList:Ljava/util/List;

    return-void
.end method


# virtual methods
.method public cityList()Ljava/util/List;
    .registers 2
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "()",
            "Ljava/util/List",
            "<",
            "Lcom/cm/plugincluster/news/model/ONewsCity;",
            ">;"
        }
    .end annotation

    .prologue
    .line 51
    iget-object v0, p0, Lcom/cm/plugincluster/news/model/ONewsCityResponse;->cityList:Ljava/util/List;

    return-object v0
.end method

.method public fromJson(Ljava/lang/String;Lcom/cm/plugincluster/news/interfaces/INewsSdk;)V
    .registers 8

    .prologue
    .line 25
    if-eqz p1, :cond_8

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

    move-result v0

    if-eqz v0, :cond_9

    .line 48
    :cond_8
    :goto_8
    return-void

    .line 29
    :cond_9
    :try_start_9
    new-instance v0, Lorg/json/JSONObject;

    invoke-direct {v0, p1}, Lorg/json/JSONObject;-><init>(Ljava/lang/String;)V

    .line 30
    iget-object v1, p0, Lcom/cm/plugincluster/news/model/ONewsCityResponse;->header:Lcom/cm/plugincluster/news/model/ONewsResponseHeader;

    invoke-virtual {v1, v0}, Lcom/cm/plugincluster/news/model/ONewsResponseHeader;->fromJSONObject(Lorg/json/JSONObject;)Lcom/cm/plugincluster/news/model/ONewsResponseHeader;

    .line 32
    iget-object v1, p0, Lcom/cm/plugincluster/news/model/ONewsCityResponse;->header:Lcom/cm/plugincluster/news/model/ONewsResponseHeader;

    invoke-virtual {v1}, Lcom/cm/plugincluster/news/model/ONewsResponseHeader;->success()Z

    move-result v1

    if-eqz v1, :cond_8

    .line 33
    const-string v1, "data"

    invoke-virtual {v0, v1}, Lorg/json/JSONObject;->has(Ljava/lang/String;)Z

    move-result v1

    if-eqz v1, :cond_8

    .line 34
    const-string v1, "data"

    invoke-virtual {v0, v1}, Lorg/json/JSONObject;->getJSONArray(Ljava/lang/String;)Lorg/json/JSONArray;

    move-result-object v1

    .line 35
    const/4 v0, 0x0

    :goto_2a
    invoke-virtual {v1}, Lorg/json/JSONArray;->length()I

    move-result v2

    if-ge v0, v2, :cond_8

    .line 36
    invoke-virtual {v1, v0}, Lorg/json/JSONArray;->getJSONObject(I)Lorg/json/JSONObject;

    move-result-object v2

    .line 37
    new-instance v3, Lcom/cm/plugincluster/news/model/ONewsCity;

    invoke-direct {v3}, Lcom/cm/plugincluster/news/model/ONewsCity;-><init>()V

    .line 38
    const-string v4, "gid"

    invoke-virtual {v2, v4}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v4

    invoke-virtual {v3, v4}, Lcom/cm/plugincluster/news/model/ONewsCity;->setGid(Ljava/lang/String;)V

    .line 39
    const-string v4, "id"

    invoke-virtual {v2, v4}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v4

    invoke-virtual {v3, v4}, Lcom/cm/plugincluster/news/model/ONewsCity;->setId(Ljava/lang/String;)V

    .line 40
    const-string v4, "display_name"

    invoke-virtual {v2, v4}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v3, v2}, Lcom/cm/plugincluster/news/model/ONewsCity;->setDisplayName(Ljava/lang/String;)V

    .line 41
    iget-object v2, p0, Lcom/cm/plugincluster/news/model/ONewsCityResponse;->cityList:Ljava/util/List;

    invoke-interface {v2, v3}, Ljava/util/List;->add(Ljava/lang/Object;)Z
    :try_end_59
    .catch Lorg/json/JSONException; {:try_start_9 .. :try_end_59} :catch_5c

    .line 35
    add-int/lit8 v0, v0, 0x1

    goto :goto_2a

    .line 45
    :catch_5c
    move-exception v0

    .line 46
    invoke-virtual {v0}, Lorg/json/JSONException;->printStackTrace()V

    goto :goto_8
.end method