.class Lcom/moji/forum/ui/TopicSquareActivity$CopyPicTask;
.super Lcom/moji/tool/thread/task/MJAsyncTask;
.source "TopicSquareActivity.java"


# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lcom/moji/forum/ui/TopicSquareActivity;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x2
    name = "CopyPicTask"
.end annotation

.annotation system Ldalvik/annotation/Signature;
    value = {
        "Lcom/moji/tool/thread/task/MJAsyncTask<",
        "Ljava/lang/Void;",
        "Ljava/lang/Void;",
        "Ljava/lang/Void;",
        ">;"
    }
.end annotation


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

.field private b:Ljava/lang/String;


# virtual methods
.method protected bridge synthetic a([Ljava/lang/Object;)Ljava/lang/Object;
    .locals 0

    .line 1702
    check-cast p1, [Ljava/lang/Void;

    invoke-virtual {p0, p1}, Lcom/moji/forum/ui/TopicSquareActivity$CopyPicTask;->a([Ljava/lang/Void;)Ljava/lang/Void;

    move-result-object p1

    return-object p1
.end method

.method protected varargs a([Ljava/lang/Void;)Ljava/lang/Void;
    .locals 5

    .line 1741
    :try_start_0
    new-instance p1, Ljava/io/File;

    new-instance v0, Ljava/lang/StringBuilder;

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

    invoke-static {}, Landroid/os/Environment;->getExternalStorageDirectory()Ljava/io/File;

    move-result-object v1

    invoke-virtual {v1}, Ljava/io/File;->toString()Ljava/lang/String;

    move-result-object v1

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

    const-string v1, "/DCIM/"

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

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

    move-result-object v0

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

    .line 1742
    invoke-virtual {p1}, Ljava/io/File;->list()[Ljava/lang/String;

    move-result-object p1

    .line 1744
    array-length v0, p1

    const/4 v1, 0x0

    const/4 v2, 0x0

    :goto_0
    if-ge v1, v0, :cond_1

    aget-object v3, p1, v1

    const-string v4, "Moji"

    .line 1745
    invoke-virtual {v3, v4}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z

    move-result v3

    if-eqz v3, :cond_0

    const/4 v2, 0x1

    :cond_0
    add-int/lit8 v1, v1, 0x1

    goto :goto_0

    :cond_1
    if-nez v2, :cond_2

    .line 1750
    new-instance p1, Ljava/io/File;

    new-instance v0, Ljava/lang/StringBuilder;

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

    invoke-static {}, Landroid/os/Environment;->getExternalStorageDirectory()Ljava/io/File;

    move-result-object v1

    invoke-virtual {v1}, Ljava/io/File;->toString()Ljava/lang/String;

    move-result-object v1

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

    sget-object v1, Lcom/moji/forum/common/Constants;->l:Ljava/lang/String;

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

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

    move-result-object v0

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

    .line 1751
    invoke-virtual {p1}, Ljava/io/File;->mkdirs()Z

    move-result p1

    if-eqz p1, :cond_2

    const-string p1, "TopicSquare"

    const-string v0, "mkdirs_success"

    invoke-static {p1, v0}, Lcom/moji/tool/log/MJLogger;->b(Ljava/lang/String;Ljava/lang/String;)V

    .line 1753
    :cond_2
    new-instance p1, Ljava/lang/StringBuilder;

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

    invoke-static {}, Landroid/os/Environment;->getExternalStorageDirectory()Ljava/io/File;

    move-result-object v0

    invoke-virtual {v0}, Ljava/io/File;->toString()Ljava/lang/String;

    move-result-object v0

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

    sget-object v0, Lcom/moji/forum/common/Constants;->l:Ljava/lang/String;

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

    const-string v0, "/"

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

    iget-object v0, p0, Lcom/moji/forum/ui/TopicSquareActivity$CopyPicTask;->b:Ljava/lang/String;

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

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

    move-result-object p1

    .line 1754
    new-instance v0, Ljava/lang/StringBuilder;

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

    invoke-static {}, Landroid/os/Environment;->getExternalStorageDirectory()Ljava/io/File;

    move-result-object v1

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    const-string v1, "/DCIM/"

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

    const-string v1, "Moji/shijing_photo.jpg"

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

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

    move-result-object v0

    .line 1755
    invoke-static {v0, p1}, Lcom/moji/forum/common/ForumUtil;->a(Ljava/lang/String;Ljava/lang/String;)Z

    move-result v0

    if-eqz v0, :cond_3

    .line 1757
    new-instance v0, Ljava/io/File;

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

    .line 1758
    new-instance p1, Landroid/content/ContentValues;

    const/4 v1, 0x6

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

    const-string v1, "title"

    .line 1759
    invoke-virtual {v0}, Ljava/io/File;->getName()Ljava/lang/String;

    move-result-object v2

    invoke-virtual {p1, v1, v2}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/String;)V

    const-string v1, "_display_name"

    .line 1760
    invoke-static {}, Ljava/lang/System;->currentTimeMillis()J

    move-result-wide v2

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

    move-result-object v2

    invoke-virtual {p1, v1, v2}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/Long;)V

    const-string v1, "datetaken"

    .line 1761
    invoke-virtual {v0}, Ljava/io/File;->lastModified()J

    move-result-wide v2

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

    move-result-object v2

    invoke-virtual {p1, v1, v2}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/Long;)V

    const-string v1, "mime_type"

    const-string v2, "image/jpeg"

    .line 1762
    invoke-virtual {p1, v1, v2}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/String;)V

    const-string v1, "_data"

    .line 1763
    invoke-virtual {v0}, Ljava/io/File;->getAbsolutePath()Ljava/lang/String;

    move-result-object v2

    invoke-virtual {p1, v1, v2}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/String;)V

    const-string v1, "_size"

    .line 1764
    invoke-virtual {v0}, Ljava/io/File;->length()J

    move-result-wide v2

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

    move-result-object v0

    invoke-virtual {p1, v1, v0}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/Long;)V

    .line 1765
    iget-object v0, p0, Lcom/moji/forum/ui/TopicSquareActivity$CopyPicTask;->a:Lcom/moji/forum/ui/TopicSquareActivity;

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

    move-result-object v0

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

    invoke-virtual {v0, v1, p1}, Landroid/content/ContentResolver;->insert(Landroid/net/Uri;Landroid/content/ContentValues;)Landroid/net/Uri;
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    :catch_0
    :cond_3
    const/4 p1, 0x0

    return-object p1
.end method

.method protected a()V
    .locals 1

    .line 1712
    invoke-super {p0}, Lcom/moji/tool/thread/task/MJAsyncTask;->a()V

    .line 1713
    iget-object v0, p0, Lcom/moji/forum/ui/TopicSquareActivity$CopyPicTask;->a:Lcom/moji/forum/ui/TopicSquareActivity;

    invoke-virtual {v0}, Lcom/moji/forum/ui/TopicSquareActivity;->showLoadDialog()V

    return-void
.end method

.method protected bridge synthetic a(Ljava/lang/Object;)V
    .locals 0

    .line 1702
    check-cast p1, Ljava/lang/Void;

    invoke-virtual {p0, p1}, Lcom/moji/forum/ui/TopicSquareActivity$CopyPicTask;->a(Ljava/lang/Void;)V

    return-void
.end method

.method protected a(Ljava/lang/Void;)V
    .locals 8

    .line 1718
    invoke-super {p0, p1}, Lcom/moji/tool/thread/task/MJAsyncTask;->a(Ljava/lang/Object;)V

    .line 1719
    sget-object v1, Landroid/provider/MediaStore$Images$Media;->EXTERNAL_CONTENT_URI:Landroid/net/Uri;

    .line 1720
    new-instance p1, Ljava/lang/StringBuilder;

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

    invoke-static {}, Landroid/os/Environment;->getExternalStorageDirectory()Ljava/io/File;

    move-result-object v0

    invoke-virtual {v0}, Ljava/io/File;->toString()Ljava/lang/String;

    move-result-object v0

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

    sget-object v0, Lcom/moji/forum/common/Constants;->l:Ljava/lang/String;

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

    const-string v0, "/"

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

    iget-object v0, p0, Lcom/moji/forum/ui/TopicSquareActivity$CopyPicTask;->b:Ljava/lang/String;

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

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

    move-result-object p1

    .line 1721
    iget-object v0, p0, Lcom/moji/forum/ui/TopicSquareActivity$CopyPicTask;->a:Lcom/moji/forum/ui/TopicSquareActivity;

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

    move-result-object v0

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

    const-string v3, "_data=?"

    const/4 v6, 0x1

    new-array v4, v6, [Ljava/lang/String;

    const/4 v7, 0x0

    aput-object p1, v4, v7

    const-string v5, "_id desc"

    invoke-virtual/range {v0 .. v5}, 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 v0

    if-eqz v0, :cond_3

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

    move-result v1

    if-eqz v1, :cond_2

    .line 1724
    invoke-interface {v0, v7}, Landroid/database/Cursor;->getLong(I)J

    move-result-wide v1

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

    move-result-object v1

    .line 1726
    new-instance v2, Lcom/moji/http/ugc/bean/ImageInfo;

    invoke-virtual {v1}, Ljava/lang/Long;->longValue()J

    move-result-wide v3

    invoke-direct {v2, p1, v7, v3, v4}, Lcom/moji/http/ugc/bean/ImageInfo;-><init>(Ljava/lang/String;IJ)V

    .line 1727
    iget-object p1, p0, Lcom/moji/forum/ui/TopicSquareActivity$CopyPicTask;->a:Lcom/moji/forum/ui/TopicSquareActivity;

    invoke-static {p1}, Lcom/moji/forum/ui/TopicSquareActivity;->N(Lcom/moji/forum/ui/TopicSquareActivity;)Ljava/util/ArrayList;

    move-result-object p1

    iget-object v1, p0, Lcom/moji/forum/ui/TopicSquareActivity$CopyPicTask;->a:Lcom/moji/forum/ui/TopicSquareActivity;

    invoke-static {v1}, Lcom/moji/forum/ui/TopicSquareActivity;->N(Lcom/moji/forum/ui/TopicSquareActivity;)Ljava/util/ArrayList;

    move-result-object v1

    invoke-virtual {v1}, Ljava/util/ArrayList;->size()I

    move-result v1

    sub-int/2addr v1, v6

    if-ltz v1, :cond_0

    iget-object v1, p0, Lcom/moji/forum/ui/TopicSquareActivity$CopyPicTask;->a:Lcom/moji/forum/ui/TopicSquareActivity;

    invoke-static {v1}, Lcom/moji/forum/ui/TopicSquareActivity;->N(Lcom/moji/forum/ui/TopicSquareActivity;)Ljava/util/ArrayList;

    move-result-object v1

    invoke-virtual {v1}, Ljava/util/ArrayList;->size()I

    move-result v1

    add-int/lit8 v7, v1, -0x1

    :cond_0
    invoke-virtual {p1, v7, v2}, Ljava/util/ArrayList;->add(ILjava/lang/Object;)V

    .line 1728
    iget-object p1, p0, Lcom/moji/forum/ui/TopicSquareActivity$CopyPicTask;->a:Lcom/moji/forum/ui/TopicSquareActivity;

    invoke-static {p1}, Lcom/moji/forum/ui/TopicSquareActivity;->N(Lcom/moji/forum/ui/TopicSquareActivity;)Ljava/util/ArrayList;

    move-result-object p1

    invoke-virtual {p1}, Ljava/util/ArrayList;->size()I

    move-result p1

    iget-object v1, p0, Lcom/moji/forum/ui/TopicSquareActivity$CopyPicTask;->a:Lcom/moji/forum/ui/TopicSquareActivity;

    iget v1, v1, Lcom/moji/forum/ui/TopicSquareActivity;->picNumLimit:I

    if-le p1, v1, :cond_1

    .line 1729
    iget-object p1, p0, Lcom/moji/forum/ui/TopicSquareActivity$CopyPicTask;->a:Lcom/moji/forum/ui/TopicSquareActivity;

    invoke-static {p1}, Lcom/moji/forum/ui/TopicSquareActivity;->N(Lcom/moji/forum/ui/TopicSquareActivity;)Ljava/util/ArrayList;

    move-result-object p1

    iget-object v1, p0, Lcom/moji/forum/ui/TopicSquareActivity$CopyPicTask;->a:Lcom/moji/forum/ui/TopicSquareActivity;

    invoke-static {v1}, Lcom/moji/forum/ui/TopicSquareActivity;->N(Lcom/moji/forum/ui/TopicSquareActivity;)Ljava/util/ArrayList;

    move-result-object v1

    invoke-virtual {v1}, Ljava/util/ArrayList;->size()I

    move-result v1

    sub-int/2addr v1, v6

    invoke-virtual {p1, v1}, Ljava/util/ArrayList;->remove(I)Ljava/lang/Object;

    .line 1730
    :cond_1
    iget-object p1, p0, Lcom/moji/forum/ui/TopicSquareActivity$CopyPicTask;->a:Lcom/moji/forum/ui/TopicSquareActivity;

    invoke-static {p1}, Lcom/moji/forum/ui/TopicSquareActivity;->i(Lcom/moji/forum/ui/TopicSquareActivity;)V

    .line 1731
    iget-object p1, p0, Lcom/moji/forum/ui/TopicSquareActivity$CopyPicTask;->a:Lcom/moji/forum/ui/TopicSquareActivity;

    invoke-static {p1}, Lcom/moji/forum/ui/TopicSquareActivity;->O(Lcom/moji/forum/ui/TopicSquareActivity;)Lcom/moji/forum/ui/ImageAdapter;

    move-result-object p1

    invoke-virtual {p1}, Lcom/moji/forum/ui/ImageAdapter;->notifyDataSetChanged()V

    .line 1733
    :cond_2
    invoke-interface {v0}, Landroid/database/Cursor;->close()V

    .line 1735
    :cond_3
    iget-object p1, p0, Lcom/moji/forum/ui/TopicSquareActivity$CopyPicTask;->a:Lcom/moji/forum/ui/TopicSquareActivity;

    invoke-virtual {p1}, Lcom/moji/forum/ui/TopicSquareActivity;->dismissLoadDialog()V

    return-void
.end method
