.class public Lcom/moji/forum/ui/TopicLocationSelectActivity;
.super Lcom/moji/forum/base/ForumBaseActivity;
.source "TopicLocationSelectActivity.java"

# interfaces
.implements Landroid/widget/AdapterView$OnItemClickListener;


# static fields
.field public static final KEY_CITY:Ljava/lang/String; = "key_city"

.field public static final KEY_CITY_ID:Ljava/lang/String; = "key_city_id"

.field public static final NOT_SHOW_LOCATION:Ljava/lang/String; = "not_show_location"


# instance fields
.field private i:Landroid/widget/ListView;

.field private j:Ljava/util/ArrayList;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/ArrayList<",
            "Lcom/moji/areamanagement/entity/ProvinceCityInfo$City;",
            ">;"
        }
    .end annotation
.end field

.field private k:Lcom/moji/forum/ui/TopicLocationSelectAdapter;

.field private l:Lcom/moji/areamanagement/db/LocalCityDBHelper;


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

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

    return-void
.end method

.method private j()Ljava/util/List;
    .locals 6
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "()",
            "Ljava/util/List<",
            "Lcom/moji/areamanagement/entity/ProvinceCityInfo$City;",
            ">;"
        }
    .end annotation

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

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

    .line 62
    invoke-static {}, Lcom/moji/areamanagement/MJAreaManager;->c()Ljava/util/List;

    move-result-object v1

    if-eqz v1, :cond_2

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

    move-result-object v1

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

    move-result v2

    if-eqz v2, :cond_2

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

    move-result-object v2

    check-cast v2, Lcom/moji/common/area/AreaInfo;

    .line 65
    new-instance v3, Lcom/moji/areamanagement/entity/ProvinceCityInfo$City;

    invoke-direct {v3}, Lcom/moji/areamanagement/entity/ProvinceCityInfo$City;-><init>()V

    .line 67
    iget-boolean v4, v2, Lcom/moji/common/area/AreaInfo;->isLocation:Z

    if-eqz v4, :cond_0

    .line 68
    invoke-static {}, Lcom/moji/areamanagement/MJAreaManager;->j()I

    move-result v4

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

    move-result-object v4

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

    move-result v5

    if-eqz v5, :cond_1

    .line 70
    iget-object v4, p0, Lcom/moji/forum/ui/TopicLocationSelectActivity;->l:Lcom/moji/areamanagement/db/LocalCityDBHelper;

    iget-object v5, v2, Lcom/moji/common/area/AreaInfo;->cityName:Ljava/lang/String;

    invoke-virtual {v4, v5}, Lcom/moji/areamanagement/db/LocalCityDBHelper;->b(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v4

    goto :goto_1

    .line 73
    :cond_0
    new-instance v4, Ljava/lang/StringBuilder;

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

    iget v5, v2, Lcom/moji/common/area/AreaInfo;->cityId:I

    invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    const-string v5, ""

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

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

    move-result-object v4

    .line 75
    :cond_1
    :goto_1
    iput-object v4, v3, Lcom/moji/areamanagement/entity/ProvinceCityInfo$City;->b:Ljava/lang/String;

    .line 76
    iget-object v2, v2, Lcom/moji/common/area/AreaInfo;->cityName:Ljava/lang/String;

    iput-object v2, v3, Lcom/moji/areamanagement/entity/ProvinceCityInfo$City;->a:Ljava/lang/String;

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

    goto :goto_0

    :cond_2
    return-object v0
.end method


# virtual methods
.method protected b()V
    .locals 2

    .line 46
    new-instance v0, Lcom/moji/areamanagement/db/LocalCityDBHelper;

    invoke-virtual {p0}, Lcom/moji/forum/ui/TopicLocationSelectActivity;->getApplicationContext()Landroid/content/Context;

    move-result-object v1

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

    iput-object v0, p0, Lcom/moji/forum/ui/TopicLocationSelectActivity;->l:Lcom/moji/areamanagement/db/LocalCityDBHelper;

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

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

    iput-object v0, p0, Lcom/moji/forum/ui/TopicLocationSelectActivity;->j:Ljava/util/ArrayList;

    .line 48
    new-instance v0, Lcom/moji/areamanagement/entity/ProvinceCityInfo$City;

    invoke-direct {v0}, Lcom/moji/areamanagement/entity/ProvinceCityInfo$City;-><init>()V

    .line 49
    sget v1, Lcom/moji/forum/R$string;->not_show_location:I

    invoke-virtual {p0, v1}, Lcom/moji/forum/ui/TopicLocationSelectActivity;->getString(I)Ljava/lang/String;

    move-result-object v1

    iput-object v1, v0, Lcom/moji/areamanagement/entity/ProvinceCityInfo$City;->a:Ljava/lang/String;

    .line 50
    iget-object v1, p0, Lcom/moji/forum/ui/TopicLocationSelectActivity;->j:Ljava/util/ArrayList;

    invoke-virtual {v1, v0}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

    .line 51
    new-instance v0, Lcom/moji/areamanagement/entity/ProvinceCityInfo$City;

    invoke-direct {v0}, Lcom/moji/areamanagement/entity/ProvinceCityInfo$City;-><init>()V

    .line 52
    sget v1, Lcom/moji/forum/R$string;->other_city:I

    invoke-virtual {p0, v1}, Lcom/moji/forum/ui/TopicLocationSelectActivity;->getString(I)Ljava/lang/String;

    move-result-object v1

    iput-object v1, v0, Lcom/moji/areamanagement/entity/ProvinceCityInfo$City;->a:Ljava/lang/String;

    .line 53
    iget-object v1, p0, Lcom/moji/forum/ui/TopicLocationSelectActivity;->j:Ljava/util/ArrayList;

    invoke-virtual {v1, v0}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

    .line 54
    iget-object v0, p0, Lcom/moji/forum/ui/TopicLocationSelectActivity;->j:Ljava/util/ArrayList;

    invoke-direct {p0}, Lcom/moji/forum/ui/TopicLocationSelectActivity;->j()Ljava/util/List;

    move-result-object v1

    invoke-virtual {v0, v1}, Ljava/util/ArrayList;->addAll(Ljava/util/Collection;)Z

    .line 55
    new-instance v0, Lcom/moji/forum/ui/TopicLocationSelectAdapter;

    iget-object v1, p0, Lcom/moji/forum/ui/TopicLocationSelectActivity;->j:Ljava/util/ArrayList;

    invoke-direct {v0, p0, v1}, Lcom/moji/forum/ui/TopicLocationSelectAdapter;-><init>(Landroid/content/Context;Ljava/util/ArrayList;)V

    iput-object v0, p0, Lcom/moji/forum/ui/TopicLocationSelectActivity;->k:Lcom/moji/forum/ui/TopicLocationSelectAdapter;

    .line 56
    iget-object v0, p0, Lcom/moji/forum/ui/TopicLocationSelectActivity;->i:Landroid/widget/ListView;

    iget-object v1, p0, Lcom/moji/forum/ui/TopicLocationSelectActivity;->k:Lcom/moji/forum/ui/TopicLocationSelectAdapter;

    invoke-virtual {v0, v1}, Landroid/widget/ListView;->setAdapter(Landroid/widget/ListAdapter;)V

    return-void
.end method

.method protected c()V
    .locals 1

    .line 40
    sget v0, Lcom/moji/forum/R$id;->lv_location:I

    invoke-virtual {p0, v0}, Lcom/moji/forum/ui/TopicLocationSelectActivity;->findViewById(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Landroid/widget/ListView;

    iput-object v0, p0, Lcom/moji/forum/ui/TopicLocationSelectActivity;->i:Landroid/widget/ListView;

    .line 41
    iget-object v0, p0, Lcom/moji/forum/ui/TopicLocationSelectActivity;->i:Landroid/widget/ListView;

    invoke-virtual {v0, p0}, Landroid/widget/ListView;->setOnItemClickListener(Landroid/widget/AdapterView$OnItemClickListener;)V

    return-void
.end method

.method protected e()V
    .locals 1

    .line 85
    sget v0, Lcom/moji/forum/R$layout;->activity_topic_location_select:I

    invoke-virtual {p0, v0}, Lcom/moji/forum/ui/TopicLocationSelectActivity;->setContentView(I)V

    return-void
.end method

.method protected onDestroy()V
    .locals 1

    .line 178
    invoke-super {p0}, Lcom/moji/forum/base/ForumBaseActivity;->onDestroy()V

    .line 179
    iget-object v0, p0, Lcom/moji/forum/ui/TopicLocationSelectActivity;->l:Lcom/moji/areamanagement/db/LocalCityDBHelper;

    invoke-virtual {v0}, Lcom/moji/areamanagement/db/LocalCityDBHelper;->a()V

    return-void
.end method

.method public onItemClick(Landroid/widget/AdapterView;Landroid/view/View;IJ)V
    .locals 0
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Landroid/widget/AdapterView<",
            "*>;",
            "Landroid/view/View;",
            "IJ)V"
        }
    .end annotation

    .line 91
    new-instance p1, Landroid/content/Intent;

    invoke-direct {p1}, Landroid/content/Intent;-><init>()V

    const/4 p2, 0x1

    if-ne p3, p2, :cond_0

    .line 93
    iget-object p2, p0, Lcom/moji/forum/ui/TopicLocationSelectActivity;->l:Lcom/moji/areamanagement/db/LocalCityDBHelper;

    invoke-virtual {p2}, Lcom/moji/areamanagement/db/LocalCityDBHelper;->b()Ljava/util/List;

    move-result-object p2

    .line 94
    new-instance p3, Lcom/moji/dialog/control/MJDialogPickAddressControl$Builder;

    invoke-direct {p3, p0}, Lcom/moji/dialog/control/MJDialogPickAddressControl$Builder;-><init>(Landroid/content/Context;)V

    new-instance p4, Lcom/moji/forum/ui/TopicLocationSelectActivity$2;

    invoke-direct {p4, p0, p2}, Lcom/moji/forum/ui/TopicLocationSelectActivity$2;-><init>(Lcom/moji/forum/ui/TopicLocationSelectActivity;Ljava/util/List;)V

    .line 95
    invoke-virtual {p3, p4}, Lcom/moji/dialog/control/MJDialogPickAddressControl$Builder;->a(Lcom/moji/dialog/control/MJDialogPickAddressControl$CascadeDataWrap;)Lcom/moji/dialog/control/MJDialogPickAddressControl$Builder;

    move-result-object p2

    sget p3, Lcom/moji/forum/R$string;->select_location:I

    .line 147
    invoke-virtual {p2, p3}, Lcom/moji/dialog/control/MJDialogPickAddressControl$Builder;->a(I)Lcom/moji/dialog/control/MJDialogDefaultControl$Builder;

    move-result-object p2

    sget p3, Lcom/moji/forum/R$string;->cancel:I

    .line 148
    invoke-virtual {p2, p3}, Lcom/moji/dialog/control/MJDialogDefaultControl$Builder;->e(I)Lcom/moji/dialog/control/MJDialogDefaultControl$Builder;

    move-result-object p2

    sget p3, Lcom/moji/forum/R$string;->save:I

    .line 149
    invoke-virtual {p2, p3}, Lcom/moji/dialog/control/MJDialogDefaultControl$Builder;->d(I)Lcom/moji/dialog/control/MJDialogDefaultControl$Builder;

    move-result-object p2

    new-instance p3, Lcom/moji/forum/ui/TopicLocationSelectActivity$1;

    invoke-direct {p3, p0, p1}, Lcom/moji/forum/ui/TopicLocationSelectActivity$1;-><init>(Lcom/moji/forum/ui/TopicLocationSelectActivity;Landroid/content/Intent;)V

    .line 150
    invoke-virtual {p2, p3}, Lcom/moji/dialog/control/MJDialogDefaultControl$Builder;->a(Lcom/moji/dialog/control/MJDialogDefaultControl$SingleButtonCallback;)Lcom/moji/dialog/control/MJDialogDefaultControl$Builder;

    move-result-object p1

    .line 164
    invoke-virtual {p1}, Lcom/moji/dialog/control/MJDialogDefaultControl$Builder;->a()Lcom/moji/dialog/MJDialog;

    move-result-object p1

    .line 165
    invoke-virtual {p1}, Lcom/moji/dialog/MJDialog;->show()V

    goto :goto_2

    :cond_0
    const-string p2, "key_city"

    if-nez p3, :cond_1

    const-string p4, "not_show_location"

    goto :goto_0

    .line 167
    :cond_1
    iget-object p4, p0, Lcom/moji/forum/ui/TopicLocationSelectActivity;->j:Ljava/util/ArrayList;

    invoke-virtual {p4, p3}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;

    move-result-object p4

    check-cast p4, Lcom/moji/areamanagement/entity/ProvinceCityInfo$City;

    iget-object p4, p4, Lcom/moji/areamanagement/entity/ProvinceCityInfo$City;->a:Ljava/lang/String;

    :goto_0
    invoke-virtual {p1, p2, p4}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

    const-string p2, "key_city_id"

    if-nez p3, :cond_2

    const-string p3, ""

    goto :goto_1

    .line 168
    :cond_2
    iget-object p4, p0, Lcom/moji/forum/ui/TopicLocationSelectActivity;->j:Ljava/util/ArrayList;

    invoke-virtual {p4, p3}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;

    move-result-object p3

    check-cast p3, Lcom/moji/areamanagement/entity/ProvinceCityInfo$City;

    iget-object p3, p3, Lcom/moji/areamanagement/entity/ProvinceCityInfo$City;->b:Ljava/lang/String;

    :goto_1
    invoke-virtual {p1, p2, p3}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

    const/4 p2, -0x1

    .line 169
    invoke-virtual {p0, p2, p1}, Lcom/moji/forum/ui/TopicLocationSelectActivity;->setResult(ILandroid/content/Intent;)V

    .line 170
    invoke-virtual {p0}, Lcom/moji/forum/ui/TopicLocationSelectActivity;->finish()V

    :goto_2
    return-void
.end method
