.class public Lcom/moji/camera/PhotoCameraImpl;
.super Ljava/lang/Object;
.source "PhotoCameraImpl.java"

# interfaces
.implements Lcom/moji/camera/PhotoCamera;


# static fields
.field public static RESULT_CANCEL:I = 0x2

.field public static RESULT_FAIL:I = 0x1

.field private static RESULT_SUCCESS:I = 0x0

.field private static SAVED_INSTANCE_STATE_CAMERAOUTURI:Ljava/lang/String; = "saved_instance_state_cameraouturi"

.field private static SAVED_INSTANCE_STATE_CROPOPTIONS:Ljava/lang/String; = "saved_instance_state_cropoptions"


# instance fields
.field private CameraOutUri:Landroid/net/Uri;

.field private cropOptions:Lcom/moji/camera/model/CropOptions;

.field private galleryOptions:Lcom/moji/camera/model/GalleryOptions;

.field private mActivity:Landroid/app/Activity;

.field private mParam:Lcom/moji/camera/model/Param;

.field private mResultListener:Lcom/moji/camera/PhotoCamera$OnResultListener;

.field private outList:Ljava/util/ArrayList;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/ArrayList<",
            "Lcom/moji/camera/model/Image;",
            ">;"
        }
    .end annotation
.end field

.field private permissionType:Lcom/moji/camera/permission/PermissionManager$TPermissionType;


# direct methods
.method static constructor <clinit>()V
    .locals 0

    return-void
.end method

.method public constructor <init>(Landroid/app/Activity;Lcom/moji/camera/model/GalleryOptions;Lcom/moji/camera/model/CropOptions;)V
    .locals 1
    .param p2    # Lcom/moji/camera/model/GalleryOptions;
        .annotation build Landroid/support/annotation/NonNull;
        .end annotation
    .end param
    .param p3    # Lcom/moji/camera/model/CropOptions;
        .annotation build Landroid/support/annotation/NonNull;
        .end annotation
    .end param

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

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

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

    iput-object v0, p0, Lcom/moji/camera/PhotoCameraImpl;->outList:Ljava/util/ArrayList;

    .line 57
    iput-object p1, p0, Lcom/moji/camera/PhotoCameraImpl;->mActivity:Landroid/app/Activity;

    .line 58
    iput-object p2, p0, Lcom/moji/camera/PhotoCameraImpl;->galleryOptions:Lcom/moji/camera/model/GalleryOptions;

    .line 59
    iput-object p3, p0, Lcom/moji/camera/PhotoCameraImpl;->cropOptions:Lcom/moji/camera/model/CropOptions;

    return-void
.end method

.method static synthetic access$000(Lcom/moji/camera/PhotoCameraImpl;)Ljava/util/ArrayList;
    .locals 0

    .line 36
    iget-object p0, p0, Lcom/moji/camera/PhotoCameraImpl;->outList:Ljava/util/ArrayList;

    return-object p0
.end method

.method static synthetic access$100(Lcom/moji/camera/PhotoCameraImpl;)Landroid/net/Uri;
    .locals 0

    .line 36
    iget-object p0, p0, Lcom/moji/camera/PhotoCameraImpl;->CameraOutUri:Landroid/net/Uri;

    return-object p0
.end method

.method static synthetic access$200(Lcom/moji/camera/PhotoCameraImpl;Landroid/net/Uri;)Lcom/moji/camera/model/Image;
    .locals 0

    .line 36
    invoke-direct {p0, p1}, Lcom/moji/camera/PhotoCameraImpl;->createOutImage(Landroid/net/Uri;)Lcom/moji/camera/model/Image;

    move-result-object p0

    return-object p0
.end method

.method static synthetic access$300(Lcom/moji/camera/PhotoCameraImpl;)Lcom/moji/camera/model/CropOptions;
    .locals 0

    .line 36
    iget-object p0, p0, Lcom/moji/camera/PhotoCameraImpl;->cropOptions:Lcom/moji/camera/model/CropOptions;

    return-object p0
.end method

.method static synthetic access$400(Lcom/moji/camera/PhotoCameraImpl;Lcom/moji/camera/model/Image;)V
    .locals 0

    .line 36
    invoke-direct {p0, p1}, Lcom/moji/camera/PhotoCameraImpl;->onCrop(Lcom/moji/camera/model/Image;)V

    return-void
.end method

.method static synthetic access$500()I
    .locals 1

    .line 36
    sget v0, Lcom/moji/camera/PhotoCameraImpl;->RESULT_SUCCESS:I

    return v0
.end method

.method static synthetic access$600(Lcom/moji/camera/PhotoCameraImpl;I[Ljava/lang/String;)V
    .locals 0

    .line 36
    invoke-direct {p0, p1, p2}, Lcom/moji/camera/PhotoCameraImpl;->goResult(I[Ljava/lang/String;)V

    return-void
.end method

.method static synthetic access$700(Lcom/moji/camera/PhotoCameraImpl;)Landroid/app/Activity;
    .locals 0

    .line 36
    iget-object p0, p0, Lcom/moji/camera/PhotoCameraImpl;->mActivity:Landroid/app/Activity;

    return-object p0
.end method

.method private createOutImage(Landroid/net/Uri;)Lcom/moji/camera/model/Image;
    .locals 7

    const/4 v0, 0x0

    if-nez p1, :cond_0

    return-object v0

    .line 256
    :cond_0
    invoke-virtual {p1}, Landroid/net/Uri;->getPath()Ljava/lang/String;

    move-result-object v1

    if-nez v1, :cond_1

    return-object v0

    .line 261
    :cond_1
    invoke-virtual {p1}, Landroid/net/Uri;->getScheme()Ljava/lang/String;

    move-result-object v0

    const-string v1, "content"

    .line 262
    invoke-virtual {v1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_2

    move-object v4, p1

    goto :goto_0

    .line 265
    :cond_2
    iget-object v0, p0, Lcom/moji/camera/PhotoCameraImpl;->mActivity:Landroid/app/Activity;

    iget-object v1, p0, Lcom/moji/camera/PhotoCameraImpl;->mActivity:Landroid/app/Activity;

    invoke-static {v1}, Lcom/moji/camera/utils/FileUtils;->a(Landroid/content/Context;)Ljava/lang/String;

    move-result-object v1

    new-instance v2, Ljava/io/File;

    invoke-virtual {p1}, Landroid/net/Uri;->getPath()Ljava/lang/String;

    move-result-object v3

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

    invoke-static {v0, v1, v2}, Landroid/support/v4/content/FileProvider;->getUriForFile(Landroid/content/Context;Ljava/lang/String;Ljava/io/File;)Landroid/net/Uri;

    move-result-object v0

    move-object v4, v0

    .line 268
    :goto_0
    invoke-static {v4}, Lcom/moji/camera/utils/FileUtils;->a(Landroid/net/Uri;)Ljava/lang/String;

    move-result-object v2

    .line 270
    iget-object v0, p0, Lcom/moji/camera/PhotoCameraImpl;->mActivity:Landroid/app/Activity;

    invoke-static {v0, v4}, Lcom/moji/camera/utils/FileUtils;->a(Landroid/app/Activity;Landroid/net/Uri;)Ljava/lang/String;

    move-result-object v0

    .line 272
    invoke-static {v2, v0}, Lcom/moji/camera/utils/FileUtils;->c(Ljava/lang/String;Ljava/lang/String;)Ljava/io/File;

    move-result-object v1

    .line 273
    invoke-static {v1}, Landroid/net/Uri;->fromFile(Ljava/io/File;)Landroid/net/Uri;

    move-result-object v5

    .line 275
    invoke-static {v2, v0}, Lcom/moji/camera/utils/FileUtils;->d(Ljava/lang/String;Ljava/lang/String;)Ljava/io/File;

    move-result-object v0

    .line 276
    invoke-static {v0}, Landroid/net/Uri;->fromFile(Ljava/io/File;)Landroid/net/Uri;

    move-result-object v6

    .line 277
    new-instance v0, Lcom/moji/camera/model/Image;

    move-object v1, v0

    move-object v3, p1

    invoke-direct/range {v1 .. v6}, Lcom/moji/camera/model/Image;-><init>(Ljava/lang/String;Landroid/net/Uri;Landroid/net/Uri;Landroid/net/Uri;Landroid/net/Uri;)V

    return-object v0
.end method

.method private varargs goResult(I[Ljava/lang/String;)V
    .locals 1

    .line 292
    iget-object v0, p0, Lcom/moji/camera/PhotoCameraImpl;->mResultListener:Lcom/moji/camera/PhotoCamera$OnResultListener;

    if-nez v0, :cond_0

    return-void

    .line 295
    :cond_0
    sget v0, Lcom/moji/camera/PhotoCameraImpl;->RESULT_SUCCESS:I

    if-ne p1, v0, :cond_1

    .line 296
    iget-object p1, p0, Lcom/moji/camera/PhotoCameraImpl;->mResultListener:Lcom/moji/camera/PhotoCamera$OnResultListener;

    iget-object p2, p0, Lcom/moji/camera/PhotoCameraImpl;->outList:Ljava/util/ArrayList;

    invoke-interface {p1, p2}, Lcom/moji/camera/PhotoCamera$OnResultListener;->takeSuccess(Ljava/util/ArrayList;)V

    goto :goto_0

    .line 297
    :cond_1
    sget v0, Lcom/moji/camera/PhotoCameraImpl;->RESULT_FAIL:I

    if-ne p1, v0, :cond_2

    array-length p1, p2

    if-lez p1, :cond_2

    .line 298
    iget-object p1, p0, Lcom/moji/camera/PhotoCameraImpl;->mResultListener:Lcom/moji/camera/PhotoCamera$OnResultListener;

    const/4 v0, 0x0

    aget-object p2, p2, v0

    invoke-interface {p1, p2}, Lcom/moji/camera/PhotoCamera$OnResultListener;->takeFail(Ljava/lang/String;)V

    goto :goto_0

    .line 300
    :cond_2
    iget-object p1, p0, Lcom/moji/camera/PhotoCameraImpl;->mResultListener:Lcom/moji/camera/PhotoCamera$OnResultListener;

    invoke-interface {p1}, Lcom/moji/camera/PhotoCamera$OnResultListener;->takeCancel()V

    :goto_0
    return-void
.end method

.method private onCrop(Lcom/moji/camera/model/Image;)V
    .locals 2

    .line 282
    iget-object v0, p0, Lcom/moji/camera/PhotoCameraImpl;->cropOptions:Lcom/moji/camera/model/CropOptions;

    invoke-virtual {v0}, Lcom/moji/camera/model/CropOptions;->getAspectX()I

    move-result v0

    iget-object v1, p0, Lcom/moji/camera/PhotoCameraImpl;->cropOptions:Lcom/moji/camera/model/CropOptions;

    invoke-virtual {v1}, Lcom/moji/camera/model/CropOptions;->getAspectY()I

    move-result v1

    mul-int v0, v0, v1

    if-lez v0, :cond_0

    .line 283
    invoke-static {p1}, Lcom/moji/crop/Crop;->a(Lcom/moji/camera/model/Image;)Lcom/moji/crop/Crop;

    move-result-object p1

    iget-object v0, p0, Lcom/moji/camera/PhotoCameraImpl;->cropOptions:Lcom/moji/camera/model/CropOptions;

    invoke-virtual {v0}, Lcom/moji/camera/model/CropOptions;->getAspectX()I

    move-result v0

    iget-object v1, p0, Lcom/moji/camera/PhotoCameraImpl;->cropOptions:Lcom/moji/camera/model/CropOptions;

    invoke-virtual {v1}, Lcom/moji/camera/model/CropOptions;->getAspectY()I

    move-result v1

    invoke-virtual {p1, v0, v1}, Lcom/moji/crop/Crop;->a(II)Lcom/moji/crop/Crop;

    move-result-object p1

    iget-object v0, p0, Lcom/moji/camera/PhotoCameraImpl;->mActivity:Landroid/app/Activity;

    invoke-virtual {p1, v0}, Lcom/moji/crop/Crop;->a(Landroid/app/Activity;)V

    goto :goto_0

    .line 284
    :cond_0
    iget-object v0, p0, Lcom/moji/camera/PhotoCameraImpl;->cropOptions:Lcom/moji/camera/model/CropOptions;

    invoke-virtual {v0}, Lcom/moji/camera/model/CropOptions;->getOutputX()I

    move-result v0

    iget-object v1, p0, Lcom/moji/camera/PhotoCameraImpl;->cropOptions:Lcom/moji/camera/model/CropOptions;

    invoke-virtual {v1}, Lcom/moji/camera/model/CropOptions;->getOutputY()I

    move-result v1

    mul-int v0, v0, v1

    if-lez v0, :cond_1

    .line 285
    invoke-static {p1}, Lcom/moji/crop/Crop;->a(Lcom/moji/camera/model/Image;)Lcom/moji/crop/Crop;

    move-result-object p1

    iget-object v0, p0, Lcom/moji/camera/PhotoCameraImpl;->cropOptions:Lcom/moji/camera/model/CropOptions;

    invoke-virtual {v0}, Lcom/moji/camera/model/CropOptions;->getOutputX()I

    move-result v0

    iget-object v1, p0, Lcom/moji/camera/PhotoCameraImpl;->cropOptions:Lcom/moji/camera/model/CropOptions;

    invoke-virtual {v1}, Lcom/moji/camera/model/CropOptions;->getOutputY()I

    move-result v1

    invoke-virtual {p1, v0, v1}, Lcom/moji/crop/Crop;->b(II)Lcom/moji/crop/Crop;

    move-result-object p1

    iget-object v0, p0, Lcom/moji/camera/PhotoCameraImpl;->mActivity:Landroid/app/Activity;

    invoke-virtual {p1, v0}, Lcom/moji/crop/Crop;->a(Landroid/app/Activity;)V

    goto :goto_0

    .line 287
    :cond_1
    invoke-static {p1}, Lcom/moji/crop/Crop;->a(Lcom/moji/camera/model/Image;)Lcom/moji/crop/Crop;

    move-result-object p1

    invoke-virtual {p1}, Lcom/moji/crop/Crop;->a()Lcom/moji/crop/Crop;

    move-result-object p1

    iget-object v0, p0, Lcom/moji/camera/PhotoCameraImpl;->mActivity:Landroid/app/Activity;

    invoke-virtual {p1, v0}, Lcom/moji/crop/Crop;->a(Landroid/app/Activity;)V

    :goto_0
    return-void
.end method


# virtual methods
.method public initArgs(Landroid/os/Bundle;Lcom/moji/camera/PhotoCamera$OnResultListener;)V
    .locals 1

    if-eqz p1, :cond_1

    .line 68
    invoke-virtual {p1}, Landroid/os/Bundle;->isEmpty()Z

    move-result v0

    if-nez v0, :cond_1

    .line 69
    iput-object p2, p0, Lcom/moji/camera/PhotoCameraImpl;->mResultListener:Lcom/moji/camera/PhotoCamera$OnResultListener;

    .line 70
    sget-object p2, Lcom/moji/camera/PhotoCameraImpl;->SAVED_INSTANCE_STATE_CAMERAOUTURI:Ljava/lang/String;

    invoke-virtual {p1, p2}, Landroid/os/Bundle;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object p2

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

    move-result v0

    if-nez v0, :cond_0

    .line 72
    invoke-static {p2}, Landroid/net/Uri;->parse(Ljava/lang/String;)Landroid/net/Uri;

    move-result-object p2

    iput-object p2, p0, Lcom/moji/camera/PhotoCameraImpl;->CameraOutUri:Landroid/net/Uri;

    .line 74
    :cond_0
    sget-object p2, Lcom/moji/camera/PhotoCameraImpl;->SAVED_INSTANCE_STATE_CROPOPTIONS:Ljava/lang/String;

    invoke-virtual {p1, p2}, Landroid/os/Bundle;->getParcelable(Ljava/lang/String;)Landroid/os/Parcelable;

    move-result-object p1

    check-cast p1, Lcom/moji/camera/model/CropOptions;

    iput-object p1, p0, Lcom/moji/camera/PhotoCameraImpl;->cropOptions:Lcom/moji/camera/model/CropOptions;

    :cond_1
    return-void
.end method

.method public onActivityResult(IILandroid/content/Intent;)V
    .locals 4

    const/16 v0, 0xe9

    const/4 v1, -0x1

    const/4 v2, 0x0

    if-eq p1, v0, :cond_e

    const/16 v0, 0x3eb

    if-eq p1, v0, :cond_c

    const/16 v0, 0x3ed

    if-eq p1, v0, :cond_8

    const/16 v0, 0x914

    if-eq p1, v0, :cond_6

    const/16 v3, 0x1a35

    if-eq p1, v3, :cond_4

    packed-switch p1, :pswitch_data_0

    goto/16 :goto_1

    :pswitch_0
    if-ne p2, v1, :cond_3

    if-eqz p3, :cond_3

    .line 194
    iget-object p1, p0, Lcom/moji/camera/PhotoCameraImpl;->outList:Ljava/util/ArrayList;

    invoke-virtual {p1}, Ljava/util/ArrayList;->clear()V

    const-string p1, "intent_extra_images"

    .line 195
    invoke-virtual {p3, p1}, Landroid/content/Intent;->getParcelableArrayListExtra(Ljava/lang/String;)Ljava/util/ArrayList;

    move-result-object p1

    .line 197
    iget-object p2, p0, Lcom/moji/camera/PhotoCameraImpl;->mParam:Lcom/moji/camera/model/Param;

    if-eqz p2, :cond_0

    iget-object p2, p0, Lcom/moji/camera/PhotoCameraImpl;->mParam:Lcom/moji/camera/model/Param;

    invoke-virtual {p2}, Lcom/moji/camera/model/Param;->focus()Z

    move-result p2

    if-eqz p2, :cond_0

    invoke-virtual {p1}, Ljava/util/ArrayList;->isEmpty()Z

    move-result p2

    if-nez p2, :cond_0

    .line 198
    invoke-virtual {p1, v2}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;

    move-result-object p1

    check-cast p1, Lcom/moji/multiselector/bean/ImageItem;

    .line 199
    iget-object p1, p1, Lcom/moji/multiselector/bean/ImageItem;->path:Ljava/lang/String;

    invoke-static {p1}, Landroid/net/Uri;->parse(Ljava/lang/String;)Landroid/net/Uri;

    move-result-object p1

    invoke-direct {p0, p1}, Lcom/moji/camera/PhotoCameraImpl;->createOutImage(Landroid/net/Uri;)Lcom/moji/camera/model/Image;

    move-result-object p1

    .line 200
    iget-object p2, p0, Lcom/moji/camera/PhotoCameraImpl;->mActivity:Landroid/app/Activity;

    iget-object p3, p0, Lcom/moji/camera/PhotoCameraImpl;->mParam:Lcom/moji/camera/model/Param;

    invoke-static {p2, p1, v0, p3}, Lcom/moji/camera/GalleryOpActivity;->start(Landroid/app/Activity;Lcom/moji/camera/model/Image;ILcom/moji/camera/model/Param;)V

    return-void

    .line 203
    :cond_0
    invoke-virtual {p1}, Ljava/util/ArrayList;->iterator()Ljava/util/Iterator;

    move-result-object p1

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

    move-result p2

    if-eqz p2, :cond_2

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

    move-result-object p2

    check-cast p2, Lcom/moji/multiselector/bean/ImageItem;

    .line 204
    iget-object p2, p2, Lcom/moji/multiselector/bean/ImageItem;->path:Ljava/lang/String;

    invoke-static {p2}, Landroid/net/Uri;->parse(Ljava/lang/String;)Landroid/net/Uri;

    move-result-object p2

    invoke-direct {p0, p2}, Lcom/moji/camera/PhotoCameraImpl;->createOutImage(Landroid/net/Uri;)Lcom/moji/camera/model/Image;

    move-result-object p2

    if-eqz p2, :cond_1

    .line 206
    iget-object p3, p0, Lcom/moji/camera/PhotoCameraImpl;->outList:Ljava/util/ArrayList;

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

    goto :goto_0

    .line 209
    :cond_2
    sget p1, Lcom/moji/camera/PhotoCameraImpl;->RESULT_SUCCESS:I

    new-array p2, v2, [Ljava/lang/String;

    invoke-direct {p0, p1, p2}, Lcom/moji/camera/PhotoCameraImpl;->goResult(I[Ljava/lang/String;)V

    goto/16 :goto_1

    .line 211
    :cond_3
    sget p1, Lcom/moji/camera/PhotoCameraImpl;->RESULT_CANCEL:I

    new-array p2, v2, [Ljava/lang/String;

    invoke-direct {p0, p1, p2}, Lcom/moji/camera/PhotoCameraImpl;->goResult(I[Ljava/lang/String;)V

    goto/16 :goto_1

    :cond_4
    if-ne p2, v1, :cond_5

    .line 216
    sget p1, Lcom/moji/camera/PhotoCameraImpl;->RESULT_SUCCESS:I

    new-array p2, v2, [Ljava/lang/String;

    invoke-direct {p0, p1, p2}, Lcom/moji/camera/PhotoCameraImpl;->goResult(I[Ljava/lang/String;)V

    goto/16 :goto_1

    .line 218
    :cond_5
    sget p1, Lcom/moji/camera/PhotoCameraImpl;->RESULT_CANCEL:I

    new-array p2, v2, [Ljava/lang/String;

    invoke-direct {p0, p1, p2}, Lcom/moji/camera/PhotoCameraImpl;->goResult(I[Ljava/lang/String;)V

    goto/16 :goto_1

    :cond_6
    if-ne p2, v1, :cond_7

    .line 238
    iget-object p1, p0, Lcom/moji/camera/PhotoCameraImpl;->outList:Ljava/util/ArrayList;

    invoke-virtual {p1}, Ljava/util/ArrayList;->clear()V

    const-string p1, "result_extra_data"

    .line 240
    invoke-virtual {p3, p1}, Landroid/content/Intent;->getParcelableExtra(Ljava/lang/String;)Landroid/os/Parcelable;

    move-result-object p1

    check-cast p1, Lcom/moji/camera/model/Image;

    .line 241
    iget-object p2, p0, Lcom/moji/camera/PhotoCameraImpl;->outList:Ljava/util/ArrayList;

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

    .line 242
    sget p1, Lcom/moji/camera/PhotoCameraImpl;->RESULT_SUCCESS:I

    new-array p2, v2, [Ljava/lang/String;

    invoke-direct {p0, p1, p2}, Lcom/moji/camera/PhotoCameraImpl;->goResult(I[Ljava/lang/String;)V

    goto/16 :goto_1

    .line 244
    :cond_7
    new-array p1, v2, [Ljava/lang/String;

    invoke-direct {p0, p2, p1}, Lcom/moji/camera/PhotoCameraImpl;->goResult(I[Ljava/lang/String;)V

    goto/16 :goto_1

    :cond_8
    :pswitch_1
    if-ne p2, v1, :cond_b

    if-eqz p3, :cond_b

    .line 178
    iget-object p1, p0, Lcom/moji/camera/PhotoCameraImpl;->outList:Ljava/util/ArrayList;

    invoke-virtual {p1}, Ljava/util/ArrayList;->clear()V

    .line 179
    invoke-virtual {p3}, Landroid/content/Intent;->getData()Landroid/net/Uri;

    move-result-object p1

    invoke-direct {p0, p1}, Lcom/moji/camera/PhotoCameraImpl;->createOutImage(Landroid/net/Uri;)Lcom/moji/camera/model/Image;

    move-result-object p1

    if-eqz p1, :cond_9

    .line 181
    iget-object p2, p0, Lcom/moji/camera/PhotoCameraImpl;->outList:Ljava/util/ArrayList;

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

    .line 183
    :cond_9
    iget-object p2, p0, Lcom/moji/camera/PhotoCameraImpl;->cropOptions:Lcom/moji/camera/model/CropOptions;

    if-eqz p2, :cond_a

    iget-object p2, p0, Lcom/moji/camera/PhotoCameraImpl;->cropOptions:Lcom/moji/camera/model/CropOptions;

    invoke-virtual {p2}, Lcom/moji/camera/model/CropOptions;->isNeedCrop()Z

    move-result p2

    if-eqz p2, :cond_a

    .line 184
    invoke-direct {p0, p1}, Lcom/moji/camera/PhotoCameraImpl;->onCrop(Lcom/moji/camera/model/Image;)V

    goto :goto_1

    .line 186
    :cond_a
    sget p1, Lcom/moji/camera/PhotoCameraImpl;->RESULT_SUCCESS:I

    new-array p2, v2, [Ljava/lang/String;

    invoke-direct {p0, p1, p2}, Lcom/moji/camera/PhotoCameraImpl;->goResult(I[Ljava/lang/String;)V

    goto :goto_1

    .line 189
    :cond_b
    sget p1, Lcom/moji/camera/PhotoCameraImpl;->RESULT_CANCEL:I

    new-array p2, v2, [Ljava/lang/String;

    invoke-direct {p0, p1, p2}, Lcom/moji/camera/PhotoCameraImpl;->goResult(I[Ljava/lang/String;)V

    goto :goto_1

    :cond_c
    if-ne p2, v1, :cond_d

    .line 153
    iget-object p1, p0, Lcom/moji/camera/PhotoCameraImpl;->mActivity:Landroid/app/Activity;

    invoke-virtual {p1}, Landroid/app/Activity;->getApplicationContext()Landroid/content/Context;

    move-result-object p1

    iget-object p2, p0, Lcom/moji/camera/PhotoCameraImpl;->CameraOutUri:Landroid/net/Uri;

    new-instance p3, Lcom/moji/camera/PhotoCameraImpl$1;

    invoke-direct {p3, p0}, Lcom/moji/camera/PhotoCameraImpl$1;-><init>(Lcom/moji/camera/PhotoCameraImpl;)V

    invoke-static {p1, p2, p3}, Lcom/moji/camera/utils/FileUtils;->a(Landroid/content/Context;Landroid/net/Uri;Ljava/lang/Runnable;)V

    goto :goto_1

    .line 172
    :cond_d
    sget p1, Lcom/moji/camera/PhotoCameraImpl;->RESULT_CANCEL:I

    new-array p2, v2, [Ljava/lang/String;

    invoke-direct {p0, p1, p2}, Lcom/moji/camera/PhotoCameraImpl;->goResult(I[Ljava/lang/String;)V

    goto :goto_1

    :cond_e
    if-ne p2, v1, :cond_f

    .line 224
    iget-object p1, p0, Lcom/moji/camera/PhotoCameraImpl;->outList:Ljava/util/ArrayList;

    invoke-virtual {p1}, Ljava/util/ArrayList;->clear()V

    .line 225
    sget-object p1, Lcom/moji/camera/CameraActivity;->CAMERA_CROP_PATH:Ljava/lang/String;

    invoke-static {p1}, Landroid/net/Uri;->parse(Ljava/lang/String;)Landroid/net/Uri;

    move-result-object p1

    .line 226
    new-instance p2, Lcom/moji/camera/model/Image;

    invoke-static {p1}, Lcom/moji/camera/utils/FileUtils;->a(Landroid/net/Uri;)Ljava/lang/String;

    move-result-object p3

    const/4 v0, 0x0

    invoke-direct {p2, p3, p1, v0}, Lcom/moji/camera/model/Image;-><init>(Ljava/lang/String;Landroid/net/Uri;Landroid/net/Uri;)V

    const/4 p1, 0x1

    .line 228
    iput p1, p2, Lcom/moji/camera/model/Image;->isCamera:I

    .line 229
    iget-object p1, p0, Lcom/moji/camera/PhotoCameraImpl;->outList:Ljava/util/ArrayList;

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

    .line 231
    sget p1, Lcom/moji/camera/PhotoCameraImpl;->RESULT_SUCCESS:I

    new-array p2, v2, [Ljava/lang/String;

    invoke-direct {p0, p1, p2}, Lcom/moji/camera/PhotoCameraImpl;->goResult(I[Ljava/lang/String;)V

    goto :goto_1

    .line 233
    :cond_f
    new-array p1, v2, [Ljava/lang/String;

    invoke-direct {p0, p2, p1}, Lcom/moji/camera/PhotoCameraImpl;->goResult(I[Ljava/lang/String;)V

    :goto_1
    return-void

    :pswitch_data_0
    .packed-switch 0x3ef
        :pswitch_1
        :pswitch_0
    .end packed-switch
.end method

.method public onSaveInstanceState(Landroid/os/Bundle;)V
    .locals 2

    .line 80
    iget-object v0, p0, Lcom/moji/camera/PhotoCameraImpl;->CameraOutUri:Landroid/net/Uri;

    if-eqz v0, :cond_0

    .line 81
    sget-object v0, Lcom/moji/camera/PhotoCameraImpl;->SAVED_INSTANCE_STATE_CAMERAOUTURI:Ljava/lang/String;

    iget-object v1, p0, Lcom/moji/camera/PhotoCameraImpl;->CameraOutUri:Landroid/net/Uri;

    invoke-virtual {v1}, Landroid/net/Uri;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-virtual {p1, v0, v1}, Landroid/os/Bundle;->putString(Ljava/lang/String;Ljava/lang/String;)V

    .line 83
    :cond_0
    sget-object v0, Lcom/moji/camera/PhotoCameraImpl;->SAVED_INSTANCE_STATE_CROPOPTIONS:Ljava/lang/String;

    iget-object v1, p0, Lcom/moji/camera/PhotoCameraImpl;->cropOptions:Lcom/moji/camera/model/CropOptions;

    invoke-virtual {p1, v0, v1}, Landroid/os/Bundle;->putParcelable(Ljava/lang/String;Landroid/os/Parcelable;)V

    return-void
.end method

.method public openCamera(Lcom/moji/camera/PhotoCamera$OnResultListener;)V
    .locals 1

    const/4 v0, 0x0

    .line 112
    invoke-virtual {p0, p1, v0}, Lcom/moji/camera/PhotoCameraImpl;->openCamera(Lcom/moji/camera/PhotoCamera$OnResultListener;Lcom/moji/camera/model/Param;)V

    return-void
.end method

.method public openCamera(Lcom/moji/camera/PhotoCamera$OnResultListener;Lcom/moji/camera/model/Param;)V
    .locals 2

    .line 117
    sget-object v0, Lcom/moji/camera/permission/PermissionManager$TPermissionType;->WAIT:Lcom/moji/camera/permission/PermissionManager$TPermissionType;

    iget-object v1, p0, Lcom/moji/camera/PhotoCameraImpl;->permissionType:Lcom/moji/camera/permission/PermissionManager$TPermissionType;

    invoke-virtual {v0, v1}, Lcom/moji/camera/permission/PermissionManager$TPermissionType;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_0

    return-void

    .line 118
    :cond_0
    iput-object p1, p0, Lcom/moji/camera/PhotoCameraImpl;->mResultListener:Lcom/moji/camera/PhotoCamera$OnResultListener;

    .line 119
    iput-object p2, p0, Lcom/moji/camera/PhotoCameraImpl;->mParam:Lcom/moji/camera/model/Param;

    .line 120
    invoke-static {}, Lcom/moji/camera/utils/FileUtils;->a()V

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

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

    const-string v0, "liveview_photo"

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

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

    move-result-wide v0

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

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

    move-result-object p1

    const-string v0, "jpg"

    invoke-static {p1, v0}, Lcom/moji/camera/utils/FileUtils;->b(Ljava/lang/String;Ljava/lang/String;)Ljava/io/File;

    move-result-object p1

    if-eqz p2, :cond_1

    .line 124
    invoke-virtual {p2}, Lcom/moji/camera/model/Param;->focus()Z

    move-result v0

    if-eqz v0, :cond_1

    .line 125
    iget-object p1, p0, Lcom/moji/camera/PhotoCameraImpl;->mActivity:Landroid/app/Activity;

    const/16 v0, 0xe9

    invoke-static {p1, v0, p2}, Lcom/moji/camera/CameraActivity;->start(Landroid/app/Activity;ILcom/moji/camera/model/Param;)V

    return-void

    .line 131
    :cond_1
    sget p2, Landroid/os/Build$VERSION;->SDK_INT:I

    const/16 v0, 0x17

    if-lt p2, v0, :cond_2

    .line 132
    invoke-static {p1}, Landroid/net/Uri;->fromFile(Ljava/io/File;)Landroid/net/Uri;

    move-result-object p2

    iput-object p2, p0, Lcom/moji/camera/PhotoCameraImpl;->CameraOutUri:Landroid/net/Uri;

    .line 133
    iget-object p2, p0, Lcom/moji/camera/PhotoCameraImpl;->mActivity:Landroid/app/Activity;

    iget-object v0, p0, Lcom/moji/camera/PhotoCameraImpl;->mActivity:Landroid/app/Activity;

    invoke-static {v0}, Lcom/moji/camera/utils/FileUtils;->a(Landroid/content/Context;)Ljava/lang/String;

    move-result-object v0

    invoke-static {p2, v0, p1}, Landroid/support/v4/content/FileProvider;->getUriForFile(Landroid/content/Context;Ljava/lang/String;Ljava/io/File;)Landroid/net/Uri;

    move-result-object p1

    goto :goto_0

    .line 135
    :cond_2
    invoke-static {p1}, Landroid/net/Uri;->fromFile(Ljava/io/File;)Landroid/net/Uri;

    move-result-object p2

    iput-object p2, p0, Lcom/moji/camera/PhotoCameraImpl;->CameraOutUri:Landroid/net/Uri;

    .line 136
    invoke-static {p1}, Landroid/net/Uri;->fromFile(Ljava/io/File;)Landroid/net/Uri;

    move-result-object p1

    .line 138
    :goto_0
    invoke-static {p1}, Lcom/moji/camera/utils/IntentUtils;->a(Landroid/net/Uri;)Lcom/moji/camera/model/TIntentWap;

    move-result-object p1

    .line 139
    iget-object p2, p0, Lcom/moji/camera/PhotoCameraImpl;->mActivity:Landroid/app/Activity;

    invoke-virtual {p2}, Landroid/app/Activity;->getPackageManager()Landroid/content/pm/PackageManager;

    move-result-object p2

    invoke-virtual {p1}, Lcom/moji/camera/model/TIntentWap;->a()Landroid/content/Intent;

    move-result-object v0

    const/high16 v1, 0x20000

    invoke-virtual {p2, v0, v1}, Landroid/content/pm/PackageManager;->queryIntentActivities(Landroid/content/Intent;I)Ljava/util/List;

    move-result-object p2

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

    move-result p2

    if-eqz p2, :cond_3

    .line 141
    sget p1, Lcom/moji/camera/PhotoCameraImpl;->RESULT_FAIL:I

    const/4 p2, 0x1

    new-array p2, p2, [Ljava/lang/String;

    const/4 v0, 0x0

    sget v1, Lcom/moji/camera/R$string;->cannot_find_camera:I

    invoke-static {v1}, Lcom/moji/tool/DeviceTool;->f(I)Ljava/lang/String;

    move-result-object v1

    aput-object v1, p2, v0

    invoke-direct {p0, p1, p2}, Lcom/moji/camera/PhotoCameraImpl;->goResult(I[Ljava/lang/String;)V

    goto :goto_1

    .line 143
    :cond_3
    iget-object p2, p0, Lcom/moji/camera/PhotoCameraImpl;->mActivity:Landroid/app/Activity;

    invoke-virtual {p1}, Lcom/moji/camera/model/TIntentWap;->a()Landroid/content/Intent;

    move-result-object v0

    invoke-virtual {p1}, Lcom/moji/camera/model/TIntentWap;->b()I

    move-result p1

    invoke-virtual {p2, v0, p1}, Landroid/app/Activity;->startActivityForResult(Landroid/content/Intent;I)V

    :goto_1
    return-void
.end method

.method public openGallery(Lcom/moji/camera/PhotoCamera$OnResultListener;)V
    .locals 1

    const/4 v0, 0x0

    .line 88
    invoke-virtual {p0, p1, v0}, Lcom/moji/camera/PhotoCameraImpl;->openGallery(Lcom/moji/camera/PhotoCamera$OnResultListener;Lcom/moji/camera/model/Param;)V

    return-void
.end method

.method public openGallery(Lcom/moji/camera/PhotoCamera$OnResultListener;Lcom/moji/camera/model/Param;)V
    .locals 2

    .line 93
    sget-object v0, Lcom/moji/camera/permission/PermissionManager$TPermissionType;->WAIT:Lcom/moji/camera/permission/PermissionManager$TPermissionType;

    iget-object v1, p0, Lcom/moji/camera/PhotoCameraImpl;->permissionType:Lcom/moji/camera/permission/PermissionManager$TPermissionType;

    invoke-virtual {v0, v1}, Lcom/moji/camera/permission/PermissionManager$TPermissionType;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_0

    return-void

    .line 95
    :cond_0
    iget-object v0, p0, Lcom/moji/camera/PhotoCameraImpl;->galleryOptions:Lcom/moji/camera/model/GalleryOptions;

    invoke-virtual {v0}, Lcom/moji/camera/model/GalleryOptions;->getSingle()Z

    move-result v0

    if-eqz v0, :cond_2

    .line 96
    iget-object v0, p0, Lcom/moji/camera/PhotoCameraImpl;->galleryOptions:Lcom/moji/camera/model/GalleryOptions;

    invoke-virtual {v0}, Lcom/moji/camera/model/GalleryOptions;->isGallery()Z

    move-result v0

    if-eqz v0, :cond_1

    .line 97
    invoke-static {}, Lcom/moji/camera/utils/IntentUtils;->a()Lcom/moji/camera/model/TIntentWap;

    move-result-object v0

    goto :goto_0

    .line 99
    :cond_1
    invoke-static {}, Lcom/moji/camera/utils/IntentUtils;->b()Lcom/moji/camera/model/TIntentWap;

    move-result-object v0

    goto :goto_0

    .line 102
    :cond_2
    iget-object v0, p0, Lcom/moji/camera/PhotoCameraImpl;->galleryOptions:Lcom/moji/camera/model/GalleryOptions;

    invoke-virtual {v0}, Lcom/moji/camera/model/GalleryOptions;->getLimit()I

    move-result v0

    .line 103
    iget-object v1, p0, Lcom/moji/camera/PhotoCameraImpl;->mActivity:Landroid/app/Activity;

    invoke-static {v1, v0}, Lcom/moji/camera/utils/IntentUtils;->a(Landroid/app/Activity;I)Lcom/moji/camera/model/TIntentWap;

    move-result-object v0

    .line 105
    :goto_0
    iput-object p1, p0, Lcom/moji/camera/PhotoCameraImpl;->mResultListener:Lcom/moji/camera/PhotoCamera$OnResultListener;

    .line 106
    iput-object p2, p0, Lcom/moji/camera/PhotoCameraImpl;->mParam:Lcom/moji/camera/model/Param;

    .line 107
    iget-object p1, p0, Lcom/moji/camera/PhotoCameraImpl;->mActivity:Landroid/app/Activity;

    invoke-virtual {v0}, Lcom/moji/camera/model/TIntentWap;->a()Landroid/content/Intent;

    move-result-object p2

    invoke-virtual {v0}, Lcom/moji/camera/model/TIntentWap;->b()I

    move-result v0

    invoke-virtual {p1, p2, v0}, Landroid/app/Activity;->startActivityForResult(Landroid/content/Intent;I)V

    return-void
.end method

.method public permissionNotify(Lcom/moji/camera/permission/PermissionManager$TPermissionType;)V
    .locals 0

    .line 63
    iput-object p1, p0, Lcom/moji/camera/PhotoCameraImpl;->permissionType:Lcom/moji/camera/permission/PermissionManager$TPermissionType;

    return-void
.end method
