.class Lcom/moji/forum/ui/ChoicePhotosActivity$1;
.super Ljava/lang/Object;
.source "ChoicePhotosActivity.java"

# interfaces
.implements Ljava/lang/Runnable;


# annotations
.annotation system Ldalvik/annotation/EnclosingMethod;
    value = Lcom/moji/forum/ui/ChoicePhotosActivity;->j()V
.end annotation

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


# instance fields
.field final synthetic a:Lcom/moji/forum/ui/ChoicePhotosActivity;


# direct methods
.method constructor <init>(Lcom/moji/forum/ui/ChoicePhotosActivity;)V
    .locals 0

    .line 163
    iput-object p1, p0, Lcom/moji/forum/ui/ChoicePhotosActivity$1;->a:Lcom/moji/forum/ui/ChoicePhotosActivity;

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

    return-void
.end method


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

    const/4 v0, 0x0

    .line 169
    :try_start_0
    sget-object v2, Landroid/provider/MediaStore$Images$Media;->EXTERNAL_CONTENT_URI:Landroid/net/Uri;

    .line 170
    iget-object v1, p0, Lcom/moji/forum/ui/ChoicePhotosActivity$1;->a:Lcom/moji/forum/ui/ChoicePhotosActivity;

    invoke-virtual {v1}, Lcom/moji/forum/ui/ChoicePhotosActivity;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v1

    sget-object v3, Lcom/moji/forum/ui/ChoicePhotosActivity;->PROJECTION_IMAGES:[Ljava/lang/String;

    const/4 v4, 0x0

    const/4 v5, 0x0

    const-string v6, "_id desc"

    invoke-virtual/range {v1 .. v6}, Landroid/content/ContentResolver;->query(Landroid/net/Uri;[Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)Landroid/database/Cursor;

    move-result-object v1
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_1
    .catchall {:try_start_0 .. :try_end_0} :catchall_1

    if-eqz v1, :cond_6

    .line 171
    :try_start_1
    invoke-interface {v1}, Landroid/database/Cursor;->moveToFirst()Z

    move-result v0

    if-eqz v0, :cond_6

    .line 175
    :cond_0
    iget-object v0, p0, Lcom/moji/forum/ui/ChoicePhotosActivity$1;->a:Lcom/moji/forum/ui/ChoicePhotosActivity;

    invoke-static {v0}, Lcom/moji/forum/ui/ChoicePhotosActivity;->a(Lcom/moji/forum/ui/ChoicePhotosActivity;)Z

    move-result v0

    if-eqz v0, :cond_1

    goto/16 :goto_0

    :cond_1
    const/16 v0, 0x8

    .line 177
    invoke-interface {v1, v0}, Landroid/database/Cursor;->getString(I)Ljava/lang/String;

    move-result-object v0

    .line 178
    new-instance v2, Ljava/io/File;

    invoke-direct {v2, v0}, Ljava/io/File;-><init>(Ljava/lang/String;)V

    invoke-virtual {v2}, Ljava/io/File;->exists()Z

    move-result v0

    if-eqz v0, :cond_5

    .line 179
    new-instance v0, Lcom/moji/http/mqn/entity/MediaItem;

    invoke-direct {v0}, Lcom/moji/http/mqn/entity/MediaItem;-><init>()V

    .line 180
    iget-object v2, p0, Lcom/moji/forum/ui/ChoicePhotosActivity$1;->a:Lcom/moji/forum/ui/ChoicePhotosActivity;

    sget-object v3, Lcom/moji/forum/ui/ChoicePhotosActivity;->BASE_CONTENT_STRING_IMAGES:Ljava/lang/String;

    invoke-static {v2, v0, v1, v3}, Lcom/moji/forum/ui/ChoicePhotosActivity;->a(Lcom/moji/forum/ui/ChoicePhotosActivity;Lcom/moji/http/mqn/entity/MediaItem;Landroid/database/Cursor;Ljava/lang/String;)V

    const/4 v2, 0x3

    .line 182
    new-array v5, v2, [Ljava/lang/String;

    const-string v2, "_id"

    const/4 v3, 0x0

    aput-object v2, v5, v3

    const-string v2, "image_id"

    const/4 v9, 0x1

    aput-object v2, v5, v9

    const/4 v2, 0x2

    const-string v4, "_data"

    aput-object v4, v5, v2

    .line 183
    iget-object v2, p0, Lcom/moji/forum/ui/ChoicePhotosActivity$1;->a:Lcom/moji/forum/ui/ChoicePhotosActivity;

    invoke-virtual {v2}, Lcom/moji/forum/ui/ChoicePhotosActivity;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v2

    sget-object v4, Landroid/provider/MediaStore$Images$Thumbnails;->EXTERNAL_CONTENT_URI:Landroid/net/Uri;

    const-string v6, "image_id=?"

    new-array v7, v9, [Ljava/lang/String;

    iget-wide v10, v0, Lcom/moji/http/mqn/entity/MediaItem;->a:J

    .line 184
    invoke-static {v10, v11}, Ljava/lang/String;->valueOf(J)Ljava/lang/String;

    move-result-object v8

    aput-object v8, v7, v3

    const/4 v8, 0x0

    move-object v3, v2

    .line 183
    invoke-virtual/range {v3 .. v8}, Landroid/content/ContentResolver;->query(Landroid/net/Uri;[Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)Landroid/database/Cursor;

    move-result-object v2

    if-eqz v2, :cond_2

    .line 186
    invoke-interface {v2}, Landroid/database/Cursor;->moveToFirst()Z

    move-result v3

    if-eqz v3, :cond_2

    const-string v3, "_data"

    .line 190
    invoke-interface {v2, v3}, Landroid/database/Cursor;->getColumnIndex(Ljava/lang/String;)I

    move-result v3

    .line 191
    invoke-interface {v2, v3}, Landroid/database/Cursor;->getString(I)Ljava/lang/String;

    move-result-object v3

    .line 192
    iput-object v3, v0, Lcom/moji/http/mqn/entity/MediaItem;->p:Ljava/lang/String;

    .line 199
    :cond_2
    iget-object v3, p0, Lcom/moji/forum/ui/ChoicePhotosActivity$1;->a:Lcom/moji/forum/ui/ChoicePhotosActivity;

    invoke-static {v3}, Lcom/moji/forum/ui/ChoicePhotosActivity;->b(Lcom/moji/forum/ui/ChoicePhotosActivity;)Ljava/util/ArrayList;

    move-result-object v3

    iget-wide v4, v0, Lcom/moji/http/mqn/entity/MediaItem;->a:J

    invoke-static {v4, v5}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;

    move-result-object v4

    invoke-virtual {v3, v4}, Ljava/util/ArrayList;->contains(Ljava/lang/Object;)Z

    move-result v3

    if-eqz v3, :cond_3

    .line 200
    iput-boolean v9, v0, Lcom/moji/http/mqn/entity/MediaItem;->q:Z

    .line 201
    iget-object v3, p0, Lcom/moji/forum/ui/ChoicePhotosActivity$1;->a:Lcom/moji/forum/ui/ChoicePhotosActivity;

    invoke-static {v3}, Lcom/moji/forum/ui/ChoicePhotosActivity;->c(Lcom/moji/forum/ui/ChoicePhotosActivity;)I

    .line 204
    :cond_3
    iget-object v3, p0, Lcom/moji/forum/ui/ChoicePhotosActivity$1;->a:Lcom/moji/forum/ui/ChoicePhotosActivity;

    invoke-static {v3}, Lcom/moji/forum/ui/ChoicePhotosActivity;->d(Lcom/moji/forum/ui/ChoicePhotosActivity;)Ljava/util/ArrayList;

    move-result-object v3

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

    if-eqz v2, :cond_4

    .line 206
    invoke-interface {v2}, Landroid/database/Cursor;->close()V

    .line 207
    :cond_4
    iget-object v0, p0, Lcom/moji/forum/ui/ChoicePhotosActivity$1;->a:Lcom/moji/forum/ui/ChoicePhotosActivity;

    invoke-static {v0}, Lcom/moji/forum/ui/ChoicePhotosActivity;->e(Lcom/moji/forum/ui/ChoicePhotosActivity;)Lcom/moji/forum/ui/ChoicePhotosActivity$LoadingHandler;

    move-result-object v0

    const/16 v2, 0x3e7

    invoke-virtual {v0, v2}, Lcom/moji/forum/ui/ChoicePhotosActivity$LoadingHandler;->sendEmptyMessage(I)Z

    .line 209
    :cond_5
    invoke-interface {v1}, Landroid/database/Cursor;->moveToNext()Z

    move-result v0

    if-nez v0, :cond_0

    .line 210
    :goto_0
    invoke-interface {v1}, Landroid/database/Cursor;->close()V
    :try_end_1
    .catch Ljava/lang/Exception; {:try_start_1 .. :try_end_1} :catch_0
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    goto :goto_1

    :catchall_0
    move-exception v0

    goto :goto_2

    :catch_0
    nop

    goto :goto_3

    :cond_6
    :goto_1
    if-eqz v1, :cond_8

    goto :goto_4

    :catchall_1
    move-exception v1

    move-object v12, v1

    move-object v1, v0

    move-object v0, v12

    :goto_2
    if-eqz v1, :cond_7

    .line 216
    invoke-interface {v1}, Landroid/database/Cursor;->close()V

    .line 218
    :cond_7
    throw v0

    :catch_1
    move-object v1, v0

    :goto_3
    if-eqz v1, :cond_8

    .line 216
    :goto_4
    invoke-interface {v1}, Landroid/database/Cursor;->close()V

    .line 219
    :cond_8
    iget-object v0, p0, Lcom/moji/forum/ui/ChoicePhotosActivity$1;->a:Lcom/moji/forum/ui/ChoicePhotosActivity;

    invoke-static {v0}, Lcom/moji/forum/ui/ChoicePhotosActivity;->e(Lcom/moji/forum/ui/ChoicePhotosActivity;)Lcom/moji/forum/ui/ChoicePhotosActivity$LoadingHandler;

    move-result-object v0

    const/16 v1, 0x3e6

    invoke-virtual {v0, v1}, Lcom/moji/forum/ui/ChoicePhotosActivity$LoadingHandler;->sendEmptyMessage(I)Z

    return-void
.end method
