.class public Lcom/moji/crop/CropImageActivity;
.super Lcom/moji/crop/MonitoredActivity;
.source "CropImageActivity.java"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/moji/crop/CropImageActivity$Cropper;
    }
.end annotation


# instance fields
.field private final a:Landroid/os/Handler;

.field private b:I

.field private c:I

.field private d:I

.field private e:I

.field private f:I

.field private g:Z

.field private h:Lcom/moji/camera/model/Image;

.field private i:Landroid/net/Uri;

.field private j:Z

.field private k:I

.field private l:Lcom/moji/crop/RotateBitmap;

.field private m:Lcom/moji/crop/CropImageView;

.field private n:Lcom/moji/crop/HighlightView;


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

    .line 51
    invoke-direct {p0}, Lcom/moji/crop/MonitoredActivity;-><init>()V

    .line 56
    new-instance v0, Landroid/os/Handler;

    invoke-direct {v0}, Landroid/os/Handler;-><init>()V

    iput-object v0, p0, Lcom/moji/crop/CropImageActivity;->a:Landroid/os/Handler;

    return-void
.end method

.method private a(Landroid/net/Uri;)I
    .locals 4
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .line 162
    new-instance v0, Landroid/graphics/BitmapFactory$Options;

    invoke-direct {v0}, Landroid/graphics/BitmapFactory$Options;-><init>()V

    const/4 v1, 0x1

    .line 163
    iput-boolean v1, v0, Landroid/graphics/BitmapFactory$Options;->inJustDecodeBounds:Z

    const/4 v2, 0x0

    .line 165
    :try_start_0
    invoke-virtual {p0}, Lcom/moji/crop/CropImageActivity;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v3

    invoke-virtual {v3, p1}, Landroid/content/ContentResolver;->openInputStream(Landroid/net/Uri;)Ljava/io/InputStream;

    move-result-object p1
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_1

    .line 166
    :try_start_1
    invoke-static {p1, v2, v0}, Landroid/graphics/BitmapFactory;->decodeStream(Ljava/io/InputStream;Landroid/graphics/Rect;Landroid/graphics/BitmapFactory$Options;)Landroid/graphics/Bitmap;
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    .line 168
    invoke-static {p1}, Lcom/moji/crop/CropUtil;->a(Ljava/io/Closeable;)V

    .line 171
    invoke-direct {p0}, Lcom/moji/crop/CropImageActivity;->d()I

    move-result v2

    .line 173
    :goto_0
    iget p1, v0, Landroid/graphics/BitmapFactory$Options;->outHeight:I

    div-int/2addr p1, v1

    if-gt p1, v2, :cond_1

    iget p1, v0, Landroid/graphics/BitmapFactory$Options;->outWidth:I

    div-int/2addr p1, v1

    if-le p1, v2, :cond_0

    goto :goto_1

    :cond_0
    return v1

    :cond_1
    :goto_1
    shl-int/lit8 v1, v1, 0x1

    goto :goto_0

    :catchall_0
    move-exception v0

    move-object v2, p1

    goto :goto_2

    :catchall_1
    move-exception v0

    .line 168
    :goto_2
    invoke-static {v2}, Lcom/moji/crop/CropUtil;->a(Ljava/io/Closeable;)V

    .line 169
    throw v0
.end method

.method private a(Landroid/graphics/Rect;II)Landroid/graphics/Bitmap;
    .locals 17

    move-object/from16 v1, p0

    move/from16 v0, p2

    move/from16 v2, p3

    .line 333
    invoke-direct/range {p0 .. p0}, Lcom/moji/crop/CropImageActivity;->h()V

    const/4 v3, 0x0

    .line 338
    :try_start_0
    invoke-virtual/range {p0 .. p0}, Lcom/moji/crop/CropImageActivity;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v4

    iget-object v5, v1, Lcom/moji/crop/CropImageActivity;->h:Lcom/moji/camera/model/Image;

    iget-object v5, v5, Lcom/moji/camera/model/Image;->contentUri:Landroid/net/Uri;

    invoke-virtual {v4, v5}, Landroid/content/ContentResolver;->openInputStream(Landroid/net/Uri;)Ljava/io/InputStream;

    move-result-object v4
    :try_end_0
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_7
    .catch Ljava/lang/OutOfMemoryError; {:try_start_0 .. :try_end_0} :catch_6
    .catchall {:try_start_0 .. :try_end_0} :catchall_1

    const/4 v5, 0x0

    .line 339
    :try_start_1
    invoke-static {v4, v5}, Landroid/graphics/BitmapRegionDecoder;->newInstance(Ljava/io/InputStream;Z)Landroid/graphics/BitmapRegionDecoder;

    move-result-object v5

    .line 340
    invoke-virtual {v5}, Landroid/graphics/BitmapRegionDecoder;->getWidth()I

    move-result v6

    .line 341
    invoke-virtual {v5}, Landroid/graphics/BitmapRegionDecoder;->getHeight()I

    move-result v7

    .line 343
    iget v8, v1, Lcom/moji/crop/CropImageActivity;->f:I

    if-eqz v8, :cond_2

    .line 345
    new-instance v8, Landroid/graphics/Matrix;

    invoke-direct {v8}, Landroid/graphics/Matrix;-><init>()V

    .line 346
    iget v9, v1, Lcom/moji/crop/CropImageActivity;->f:I

    neg-int v9, v9

    int-to-float v9, v9

    invoke-virtual {v8, v9}, Landroid/graphics/Matrix;->setRotate(F)V

    .line 348
    new-instance v9, Landroid/graphics/RectF;

    invoke-direct {v9}, Landroid/graphics/RectF;-><init>()V

    .line 349
    new-instance v10, Landroid/graphics/RectF;

    move-object/from16 v11, p1

    invoke-direct {v10, v11}, Landroid/graphics/RectF;-><init>(Landroid/graphics/Rect;)V

    invoke-virtual {v8, v9, v10}, Landroid/graphics/Matrix;->mapRect(Landroid/graphics/RectF;Landroid/graphics/RectF;)Z

    .line 351
    iget v8, v9, Landroid/graphics/RectF;->left:F

    const/4 v10, 0x0

    cmpg-float v8, v8, v10

    if-gez v8, :cond_0

    int-to-float v8, v6

    goto :goto_0

    :cond_0
    const/4 v8, 0x0

    :goto_0
    iget v11, v9, Landroid/graphics/RectF;->top:F

    cmpg-float v11, v11, v10

    if-gez v11, :cond_1

    int-to-float v10, v7

    :cond_1
    invoke-virtual {v9, v8, v10}, Landroid/graphics/RectF;->offset(FF)V

    .line 352
    new-instance v8, Landroid/graphics/Rect;

    iget v10, v9, Landroid/graphics/RectF;->left:F

    float-to-int v10, v10

    iget v11, v9, Landroid/graphics/RectF;->top:F

    float-to-int v11, v11

    iget v12, v9, Landroid/graphics/RectF;->right:F

    float-to-int v12, v12

    iget v9, v9, Landroid/graphics/RectF;->bottom:F

    float-to-int v9, v9

    invoke-direct {v8, v10, v11, v12, v9}, Landroid/graphics/Rect;-><init>(IIII)V
    :try_end_1
    .catch Ljava/io/IOException; {:try_start_1 .. :try_end_1} :catch_5
    .catch Ljava/lang/OutOfMemoryError; {:try_start_1 .. :try_end_1} :catch_4
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    goto :goto_1

    :cond_2
    move-object/from16 v11, p1

    move-object v8, v11

    .line 356
    :goto_1
    :try_start_2
    new-instance v9, Landroid/graphics/BitmapFactory$Options;

    invoke-direct {v9}, Landroid/graphics/BitmapFactory$Options;-><init>()V

    invoke-virtual {v5, v8, v9}, Landroid/graphics/BitmapRegionDecoder;->decodeRegion(Landroid/graphics/Rect;Landroid/graphics/BitmapFactory$Options;)Landroid/graphics/Bitmap;

    move-result-object v5
    :try_end_2
    .catch Ljava/lang/IllegalArgumentException; {:try_start_2 .. :try_end_2} :catch_3
    .catch Ljava/io/IOException; {:try_start_2 .. :try_end_2} :catch_5
    .catch Ljava/lang/OutOfMemoryError; {:try_start_2 .. :try_end_2} :catch_4
    .catchall {:try_start_2 .. :try_end_2} :catchall_0

    if-eqz v5, :cond_4

    .line 357
    :try_start_3
    invoke-virtual {v8}, Landroid/graphics/Rect;->width()I

    move-result v3

    if-gt v3, v0, :cond_3

    invoke-virtual {v8}, Landroid/graphics/Rect;->height()I

    move-result v3

    if-le v3, v2, :cond_4

    .line 358
    :cond_3
    new-instance v15, Landroid/graphics/Matrix;

    invoke-direct {v15}, Landroid/graphics/Matrix;-><init>()V

    int-to-float v0, v0

    .line 359
    invoke-virtual {v8}, Landroid/graphics/Rect;->width()I

    move-result v3

    int-to-float v3, v3

    div-float/2addr v0, v3

    int-to-float v2, v2

    invoke-virtual {v8}, Landroid/graphics/Rect;->height()I

    move-result v3

    int-to-float v3, v3

    div-float/2addr v2, v3

    invoke-virtual {v15, v0, v2}, Landroid/graphics/Matrix;->postScale(FF)Z

    const/4 v11, 0x0

    const/4 v12, 0x0

    .line 360
    invoke-virtual {v5}, Landroid/graphics/Bitmap;->getWidth()I

    move-result v13

    invoke-virtual {v5}, Landroid/graphics/Bitmap;->getHeight()I

    move-result v14

    const/16 v16, 0x1

    move-object v10, v5

    invoke-static/range {v10 .. v16}, Landroid/graphics/Bitmap;->createBitmap(Landroid/graphics/Bitmap;IIIILandroid/graphics/Matrix;Z)Landroid/graphics/Bitmap;

    move-result-object v0
    :try_end_3
    .catch Ljava/lang/IllegalArgumentException; {:try_start_3 .. :try_end_3} :catch_2
    .catch Ljava/io/IOException; {:try_start_3 .. :try_end_3} :catch_1
    .catch Ljava/lang/OutOfMemoryError; {:try_start_3 .. :try_end_3} :catch_0
    .catchall {:try_start_3 .. :try_end_3} :catchall_0

    goto :goto_2

    :catch_0
    move-exception v0

    goto :goto_4

    :catch_1
    move-exception v0

    goto :goto_5

    :catch_2
    move-exception v0

    move-object v3, v5

    goto :goto_3

    :cond_4
    move-object v0, v5

    .line 373
    :goto_2
    invoke-static {v4}, Lcom/moji/crop/CropUtil;->a(Ljava/io/Closeable;)V

    move-object v5, v0

    goto :goto_9

    :catch_3
    move-exception v0

    .line 364
    :goto_3
    :try_start_4
    new-instance v2, Ljava/lang/IllegalArgumentException;

    new-instance v5, Ljava/lang/StringBuilder;

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

    const-string v9, "Rectangle "

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

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

    const-string v8, " is outside of the image ("

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

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

    const-string v6, ","

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

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

    const-string v6, ","

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

    iget v6, v1, Lcom/moji/crop/CropImageActivity;->f:I

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

    const-string v6, ")"

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

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

    move-result-object v5

    invoke-direct {v2, v5, v0}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;Ljava/lang/Throwable;)V

    throw v2
    :try_end_4
    .catch Ljava/io/IOException; {:try_start_4 .. :try_end_4} :catch_5
    .catch Ljava/lang/OutOfMemoryError; {:try_start_4 .. :try_end_4} :catch_4
    .catchall {:try_start_4 .. :try_end_4} :catchall_0

    :catchall_0
    move-exception v0

    goto :goto_a

    :catch_4
    move-exception v0

    move-object v5, v3

    :goto_4
    move-object v3, v4

    goto :goto_6

    :catch_5
    move-exception v0

    move-object v5, v3

    :goto_5
    move-object v3, v4

    goto :goto_7

    :catchall_1
    move-exception v0

    move-object v4, v3

    goto :goto_a

    :catch_6
    move-exception v0

    move-object v5, v3

    .line 371
    :goto_6
    :try_start_5
    invoke-direct {v1, v0}, Lcom/moji/crop/CropImageActivity;->a(Ljava/lang/Throwable;)V

    goto :goto_8

    :catch_7
    move-exception v0

    move-object v5, v3

    .line 369
    :goto_7
    invoke-direct {v1, v0}, Lcom/moji/crop/CropImageActivity;->a(Ljava/lang/Throwable;)V
    :try_end_5
    .catchall {:try_start_5 .. :try_end_5} :catchall_1

    .line 373
    :goto_8
    invoke-static {v3}, Lcom/moji/crop/CropUtil;->a(Ljava/io/Closeable;)V

    :goto_9
    return-object v5

    :goto_a
    invoke-static {v4}, Lcom/moji/crop/CropUtil;->a(Ljava/io/Closeable;)V

    .line 374
    throw v0
.end method

.method static synthetic a(Lcom/moji/crop/CropImageActivity;Lcom/moji/crop/HighlightView;)Lcom/moji/crop/HighlightView;
    .locals 0

    .line 51
    iput-object p1, p0, Lcom/moji/crop/CropImageActivity;->n:Lcom/moji/crop/HighlightView;

    return-object p1
.end method

.method private a()V
    .locals 2
    .annotation build Landroid/annotation/TargetApi;
        value = 0x13
    .end annotation

    const/4 v0, 0x1

    .line 93
    invoke-virtual {p0, v0}, Lcom/moji/crop/CropImageActivity;->requestWindowFeature(I)Z

    .line 94
    sget v0, Landroid/os/Build$VERSION;->SDK_INT:I

    const/16 v1, 0x13

    if-lt v0, v1, :cond_0

    .line 95
    invoke-virtual {p0}, Lcom/moji/crop/CropImageActivity;->getWindow()Landroid/view/Window;

    move-result-object v0

    const/high16 v1, 0x4000000

    invoke-virtual {v0, v1}, Landroid/view/Window;->clearFlags(I)V

    :cond_0
    return-void
.end method

.method private a(Landroid/graphics/Bitmap;)V
    .locals 3

    if-eqz p1, :cond_0

    const/4 v0, 0x0

    .line 319
    invoke-virtual {p0}, Lcom/moji/crop/CropImageActivity;->getResources()Landroid/content/res/Resources;

    move-result-object v1

    sget v2, Lcom/moji/camera/R$string;->crop__saving:I

    invoke-virtual {v1, v2}, Landroid/content/res/Resources;->getString(I)Ljava/lang/String;

    move-result-object v1

    new-instance v2, Lcom/moji/crop/CropImageActivity$5;

    invoke-direct {v2, p0, p1}, Lcom/moji/crop/CropImageActivity$5;-><init>(Lcom/moji/crop/CropImageActivity;Landroid/graphics/Bitmap;)V

    iget-object p1, p0, Lcom/moji/crop/CropImageActivity;->a:Landroid/os/Handler;

    invoke-static {p0, v0, v1, v2, p1}, Lcom/moji/crop/CropUtil;->a(Lcom/moji/crop/MonitoredActivity;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Runnable;Landroid/os/Handler;)V

    goto :goto_0

    .line 327
    :cond_0
    invoke-virtual {p0}, Lcom/moji/crop/CropImageActivity;->finish()V

    :goto_0
    return-void
.end method

.method static synthetic a(Lcom/moji/crop/CropImageActivity;)V
    .locals 0

    .line 51
    invoke-direct {p0}, Lcom/moji/crop/CropImageActivity;->g()V

    return-void
.end method

.method static synthetic a(Lcom/moji/crop/CropImageActivity;Landroid/graphics/Bitmap;)V
    .locals 0

    .line 51
    invoke-direct {p0, p1}, Lcom/moji/crop/CropImageActivity;->b(Landroid/graphics/Bitmap;)V

    return-void
.end method

.method private a(Ljava/lang/Throwable;)V
    .locals 2

    .line 447
    new-instance v0, Landroid/content/Intent;

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

    const-string v1, "error"

    invoke-virtual {v0, v1, p1}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/io/Serializable;)Landroid/content/Intent;

    move-result-object p1

    const/16 v0, 0x194

    invoke-virtual {p0, v0, p1}, Lcom/moji/crop/CropImageActivity;->setResult(ILandroid/content/Intent;)V

    return-void
.end method

.method static synthetic b(Lcom/moji/crop/CropImageActivity;)Lcom/moji/crop/CropImageView;
    .locals 0

    .line 51
    iget-object p0, p0, Lcom/moji/crop/CropImageActivity;->m:Lcom/moji/crop/CropImageView;

    return-object p0
.end method

.method private b()V
    .locals 2

    .line 100
    sget v0, Lcom/moji/camera/R$layout;->crop__activity_crop:I

    invoke-virtual {p0, v0}, Lcom/moji/crop/CropImageActivity;->setContentView(I)V

    .line 102
    sget v0, Lcom/moji/camera/R$id;->crop_image:I

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

    move-result-object v0

    check-cast v0, Lcom/moji/crop/CropImageView;

    iput-object v0, p0, Lcom/moji/crop/CropImageActivity;->m:Lcom/moji/crop/CropImageView;

    .line 103
    iget-object v0, p0, Lcom/moji/crop/CropImageActivity;->m:Lcom/moji/crop/CropImageView;

    iput-object p0, v0, Lcom/moji/crop/CropImageView;->c:Landroid/content/Context;

    .line 104
    iget-object v0, p0, Lcom/moji/crop/CropImageActivity;->m:Lcom/moji/crop/CropImageView;

    new-instance v1, Lcom/moji/crop/CropImageActivity$1;

    invoke-direct {v1, p0}, Lcom/moji/crop/CropImageActivity$1;-><init>(Lcom/moji/crop/CropImageActivity;)V

    invoke-virtual {v0, v1}, Lcom/moji/crop/CropImageView;->setRecycler(Lcom/moji/crop/ImageViewTouchBase$Recycler;)V

    .line 111
    sget v0, Lcom/moji/camera/R$id;->btn_cancel:I

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

    move-result-object v0

    new-instance v1, Lcom/moji/crop/CropImageActivity$2;

    invoke-direct {v1, p0}, Lcom/moji/crop/CropImageActivity$2;-><init>(Lcom/moji/crop/CropImageActivity;)V

    invoke-virtual {v0, v1}, Landroid/view/View;->setOnClickListener(Landroid/view/View$OnClickListener;)V

    .line 118
    sget v0, Lcom/moji/camera/R$id;->btn_done:I

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

    move-result-object v0

    new-instance v1, Lcom/moji/crop/CropImageActivity$3;

    invoke-direct {v1, p0}, Lcom/moji/crop/CropImageActivity$3;-><init>(Lcom/moji/crop/CropImageActivity;)V

    invoke-virtual {v0, v1}, Landroid/view/View;->setOnClickListener(Landroid/view/View$OnClickListener;)V

    return-void
.end method

.method private b(Landroid/graphics/Bitmap;)V
    .locals 4

    .line 386
    iget-object v0, p0, Lcom/moji/crop/CropImageActivity;->i:Landroid/net/Uri;

    if-eqz v0, :cond_3

    const/4 v0, 0x0

    .line 390
    iget v1, p0, Lcom/moji/crop/CropImageActivity;->f:I

    if-eqz v1, :cond_0

    .line 391
    iget v1, p0, Lcom/moji/crop/CropImageActivity;->f:I

    invoke-static {p1, v1}, Lcom/moji/crop/CropUtil;->a(Landroid/graphics/Bitmap;I)Landroid/graphics/Bitmap;

    move-result-object v1

    goto :goto_0

    :cond_0
    move-object v1, p1

    .line 395
    :goto_0
    :try_start_0
    invoke-virtual {p0}, Lcom/moji/crop/CropImageActivity;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v2

    iget-object v3, p0, Lcom/moji/crop/CropImageActivity;->i:Landroid/net/Uri;

    invoke-virtual {v2, v3}, Landroid/content/ContentResolver;->openOutputStream(Landroid/net/Uri;)Ljava/io/OutputStream;

    move-result-object v2
    :try_end_0
    .catch Ljava/lang/OutOfMemoryError; {:try_start_0 .. :try_end_0} :catch_2
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_1
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    if-eqz v2, :cond_2

    .line 397
    :try_start_1
    iget-boolean v0, p0, Lcom/moji/crop/CropImageActivity;->g:Z

    if-eqz v0, :cond_1

    sget-object v0, Landroid/graphics/Bitmap$CompressFormat;->PNG:Landroid/graphics/Bitmap$CompressFormat;

    goto :goto_1

    :cond_1
    sget-object v0, Landroid/graphics/Bitmap$CompressFormat;->JPEG:Landroid/graphics/Bitmap$CompressFormat;

    :goto_1
    const/16 v3, 0x1e

    invoke-virtual {v1, v0, v3, v2}, Landroid/graphics/Bitmap;->compress(Landroid/graphics/Bitmap$CompressFormat;ILjava/io/OutputStream;)Z

    goto :goto_2

    :catch_0
    move-exception v0

    goto :goto_3

    .line 401
    :cond_2
    :goto_2
    invoke-virtual {v1}, Landroid/graphics/Bitmap;->recycle()V
    :try_end_1
    .catch Ljava/lang/OutOfMemoryError; {:try_start_1 .. :try_end_1} :catch_3
    .catch Ljava/io/IOException; {:try_start_1 .. :try_end_1} :catch_0
    .catchall {:try_start_1 .. :try_end_1} :catchall_1

    goto :goto_5

    :catchall_0
    move-exception p1

    move-object v2, v0

    goto :goto_4

    :catch_1
    move-exception v1

    move-object v2, v0

    move-object v0, v1

    .line 404
    :goto_3
    :try_start_2
    invoke-direct {p0, v0}, Lcom/moji/crop/CropImageActivity;->a(Ljava/lang/Throwable;)V
    :try_end_2
    .catchall {:try_start_2 .. :try_end_2} :catchall_1

    goto :goto_5

    :catchall_1
    move-exception p1

    .line 406
    :goto_4
    invoke-static {v2}, Lcom/moji/crop/CropUtil;->a(Ljava/io/Closeable;)V

    .line 407
    throw p1

    :catch_2
    move-object v2, v0

    .line 406
    :catch_3
    :goto_5
    invoke-static {v2}, Lcom/moji/crop/CropUtil;->a(Ljava/io/Closeable;)V

    .line 411
    iget-object v0, p0, Lcom/moji/crop/CropImageActivity;->i:Landroid/net/Uri;

    invoke-direct {p0, v0}, Lcom/moji/crop/CropImageActivity;->b(Landroid/net/Uri;)V

    .line 415
    :cond_3
    iget-object v0, p0, Lcom/moji/crop/CropImageActivity;->a:Landroid/os/Handler;

    new-instance v1, Lcom/moji/crop/CropImageActivity$6;

    invoke-direct {v1, p0, p1}, Lcom/moji/crop/CropImageActivity$6;-><init>(Lcom/moji/crop/CropImageActivity;Landroid/graphics/Bitmap;)V

    invoke-virtual {v0, v1}, Landroid/os/Handler;->post(Ljava/lang/Runnable;)Z

    .line 422
    invoke-virtual {p0}, Lcom/moji/crop/CropImageActivity;->finish()V

    return-void
.end method

.method private b(Landroid/net/Uri;)V
    .locals 2

    .line 443
    new-instance v0, Landroid/content/Intent;

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

    const-string v1, "output"

    invoke-virtual {v0, v1, p1}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Landroid/os/Parcelable;)Landroid/content/Intent;

    move-result-object p1

    const/4 v0, -0x1

    invoke-virtual {p0, v0, p1}, Lcom/moji/crop/CropImageActivity;->setResult(ILandroid/content/Intent;)V

    return-void
.end method

.method static synthetic c(Lcom/moji/crop/CropImageActivity;)Landroid/os/Handler;
    .locals 0

    .line 51
    iget-object p0, p0, Lcom/moji/crop/CropImageActivity;->a:Landroid/os/Handler;

    return-object p0
.end method

.method private c()V
    .locals 5

    .line 126
    invoke-virtual {p0}, Lcom/moji/crop/CropImageActivity;->getIntent()Landroid/content/Intent;

    move-result-object v0

    .line 127
    invoke-virtual {v0}, Landroid/content/Intent;->getExtras()Landroid/os/Bundle;

    move-result-object v0

    if-eqz v0, :cond_1

    const-string v1, "image"

    .line 130
    invoke-virtual {v0, v1}, Landroid/os/Bundle;->getParcelable(Ljava/lang/String;)Landroid/os/Parcelable;

    move-result-object v1

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

    iput-object v1, p0, Lcom/moji/crop/CropImageActivity;->h:Lcom/moji/camera/model/Image;

    .line 131
    iget-object v1, p0, Lcom/moji/crop/CropImageActivity;->h:Lcom/moji/camera/model/Image;

    iget-object v1, v1, Lcom/moji/camera/model/Image;->cropUri:Landroid/net/Uri;

    iput-object v1, p0, Lcom/moji/crop/CropImageActivity;->i:Landroid/net/Uri;

    .line 132
    sget v1, Landroid/os/Build$VERSION;->SDK_INT:I

    const/16 v2, 0x17

    if-lt v1, v2, :cond_0

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

    move-result-object v1

    new-instance v2, Ljava/io/File;

    iget-object v3, p0, Lcom/moji/crop/CropImageActivity;->h:Lcom/moji/camera/model/Image;

    iget-object v3, v3, Lcom/moji/camera/model/Image;->cropUri:Landroid/net/Uri;

    invoke-virtual {v3}, 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 {p0, v1, v2}, Landroid/support/v4/content/FileProvider;->getUriForFile(Landroid/content/Context;Ljava/lang/String;Ljava/io/File;)Landroid/net/Uri;

    move-result-object v1

    iput-object v1, p0, Lcom/moji/crop/CropImageActivity;->i:Landroid/net/Uri;

    :cond_0
    const-string v1, "aspect_x"

    .line 135
    invoke-virtual {v0, v1}, Landroid/os/Bundle;->getInt(Ljava/lang/String;)I

    move-result v1

    iput v1, p0, Lcom/moji/crop/CropImageActivity;->b:I

    const-string v1, "aspect_y"

    .line 136
    invoke-virtual {v0, v1}, Landroid/os/Bundle;->getInt(Ljava/lang/String;)I

    move-result v1

    iput v1, p0, Lcom/moji/crop/CropImageActivity;->c:I

    const-string v1, "max_x"

    .line 137
    invoke-virtual {v0, v1}, Landroid/os/Bundle;->getInt(Ljava/lang/String;)I

    move-result v1

    iput v1, p0, Lcom/moji/crop/CropImageActivity;->d:I

    const-string v1, "max_y"

    .line 138
    invoke-virtual {v0, v1}, Landroid/os/Bundle;->getInt(Ljava/lang/String;)I

    move-result v1

    iput v1, p0, Lcom/moji/crop/CropImageActivity;->e:I

    const-string v1, "as_png"

    const/4 v2, 0x0

    .line 139
    invoke-virtual {v0, v1, v2}, Landroid/os/Bundle;->getBoolean(Ljava/lang/String;Z)Z

    move-result v0

    iput-boolean v0, p0, Lcom/moji/crop/CropImageActivity;->g:Z

    .line 141
    :cond_1
    iget-object v0, p0, Lcom/moji/crop/CropImageActivity;->h:Lcom/moji/camera/model/Image;

    if-eqz v0, :cond_2

    .line 142
    invoke-virtual {p0}, Lcom/moji/crop/CropImageActivity;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v0

    iget-object v1, p0, Lcom/moji/crop/CropImageActivity;->h:Lcom/moji/camera/model/Image;

    iget-object v1, v1, Lcom/moji/camera/model/Image;->originalUri:Landroid/net/Uri;

    invoke-static {p0, v0, v1}, Lcom/moji/crop/CropUtil;->a(Landroid/content/Context;Landroid/content/ContentResolver;Landroid/net/Uri;)Ljava/io/File;

    move-result-object v0

    invoke-static {v0}, Lcom/moji/crop/CropUtil;->a(Ljava/io/File;)I

    move-result v0

    iput v0, p0, Lcom/moji/crop/CropImageActivity;->f:I

    const/4 v0, 0x0

    .line 145
    :try_start_0
    iget-object v1, p0, Lcom/moji/crop/CropImageActivity;->h:Lcom/moji/camera/model/Image;

    iget-object v1, v1, Lcom/moji/camera/model/Image;->contentUri:Landroid/net/Uri;

    invoke-direct {p0, v1}, Lcom/moji/crop/CropImageActivity;->a(Landroid/net/Uri;)I

    move-result v1

    iput v1, p0, Lcom/moji/crop/CropImageActivity;->k:I

    .line 146
    invoke-virtual {p0}, Lcom/moji/crop/CropImageActivity;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v1

    iget-object v2, p0, Lcom/moji/crop/CropImageActivity;->h:Lcom/moji/camera/model/Image;

    iget-object v2, v2, Lcom/moji/camera/model/Image;->contentUri:Landroid/net/Uri;

    invoke-virtual {v1, v2}, Landroid/content/ContentResolver;->openInputStream(Landroid/net/Uri;)Ljava/io/InputStream;

    move-result-object v1
    :try_end_0
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_3
    .catch Ljava/lang/OutOfMemoryError; {:try_start_0 .. :try_end_0} :catch_2
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    .line 147
    :try_start_1
    new-instance v2, Landroid/graphics/BitmapFactory$Options;

    invoke-direct {v2}, Landroid/graphics/BitmapFactory$Options;-><init>()V

    .line 148
    iget v3, p0, Lcom/moji/crop/CropImageActivity;->k:I

    iput v3, v2, Landroid/graphics/BitmapFactory$Options;->inSampleSize:I

    .line 149
    new-instance v3, Lcom/moji/crop/RotateBitmap;

    invoke-static {v1, v0, v2}, Landroid/graphics/BitmapFactory;->decodeStream(Ljava/io/InputStream;Landroid/graphics/Rect;Landroid/graphics/BitmapFactory$Options;)Landroid/graphics/Bitmap;

    move-result-object v0

    iget v2, p0, Lcom/moji/crop/CropImageActivity;->f:I

    invoke-direct {v3, v0, v2}, Lcom/moji/crop/RotateBitmap;-><init>(Landroid/graphics/Bitmap;I)V

    iput-object v3, p0, Lcom/moji/crop/CropImageActivity;->l:Lcom/moji/crop/RotateBitmap;
    :try_end_1
    .catch Ljava/io/IOException; {:try_start_1 .. :try_end_1} :catch_1
    .catch Ljava/lang/OutOfMemoryError; {:try_start_1 .. :try_end_1} :catch_0
    .catchall {:try_start_1 .. :try_end_1} :catchall_1

    goto :goto_2

    :catch_0
    move-exception v0

    goto :goto_0

    :catch_1
    move-exception v0

    goto :goto_1

    :catchall_0
    move-exception v1

    move-object v4, v1

    move-object v1, v0

    move-object v0, v4

    goto :goto_3

    :catch_2
    move-exception v1

    move-object v4, v1

    move-object v1, v0

    move-object v0, v4

    .line 153
    :goto_0
    :try_start_2
    invoke-direct {p0, v0}, Lcom/moji/crop/CropImageActivity;->a(Ljava/lang/Throwable;)V

    goto :goto_2

    :catch_3
    move-exception v1

    move-object v4, v1

    move-object v1, v0

    move-object v0, v4

    .line 151
    :goto_1
    invoke-direct {p0, v0}, Lcom/moji/crop/CropImageActivity;->a(Ljava/lang/Throwable;)V
    :try_end_2
    .catchall {:try_start_2 .. :try_end_2} :catchall_1

    .line 155
    :goto_2
    invoke-static {v1}, Lcom/moji/crop/CropUtil;->a(Ljava/io/Closeable;)V

    goto :goto_4

    :catchall_1
    move-exception v0

    :goto_3
    invoke-static {v1}, Lcom/moji/crop/CropUtil;->a(Ljava/io/Closeable;)V

    .line 156
    throw v0

    :cond_2
    :goto_4
    return-void
.end method

.method private d()I
    .locals 2

    .line 180
    invoke-direct {p0}, Lcom/moji/crop/CropImageActivity;->e()I

    move-result v0

    if-nez v0, :cond_0

    const/16 v0, 0x800

    return v0

    :cond_0
    const/16 v1, 0x1000

    .line 184
    invoke-static {v0, v1}, Ljava/lang/Math;->min(II)I

    move-result v0

    return v0
.end method

.method static synthetic d(Lcom/moji/crop/CropImageActivity;)Lcom/moji/crop/RotateBitmap;
    .locals 0

    .line 51
    iget-object p0, p0, Lcom/moji/crop/CropImageActivity;->l:Lcom/moji/crop/RotateBitmap;

    return-object p0
.end method

.method private e()I
    .locals 3

    const/4 v0, 0x1

    .line 190
    new-array v0, v0, [I

    const/4 v1, 0x0

    const/16 v2, 0xd33

    .line 191
    invoke-static {v2, v0, v1}, Landroid/opengl/GLES10;->glGetIntegerv(I[II)V

    .line 192
    aget v0, v0, v1

    return v0
.end method

.method static synthetic e(Lcom/moji/crop/CropImageActivity;)I
    .locals 0

    .line 51
    iget p0, p0, Lcom/moji/crop/CropImageActivity;->b:I

    return p0
.end method

.method static synthetic f(Lcom/moji/crop/CropImageActivity;)I
    .locals 0

    .line 51
    iget p0, p0, Lcom/moji/crop/CropImageActivity;->c:I

    return p0
.end method

.method private f()V
    .locals 4

    .line 196
    invoke-virtual {p0}, Lcom/moji/crop/CropImageActivity;->isFinishing()Z

    move-result v0

    if-eqz v0, :cond_0

    return-void

    .line 199
    :cond_0
    iget-object v0, p0, Lcom/moji/crop/CropImageActivity;->m:Lcom/moji/crop/CropImageView;

    iget-object v1, p0, Lcom/moji/crop/CropImageActivity;->l:Lcom/moji/crop/RotateBitmap;

    const/4 v2, 0x1

    invoke-virtual {v0, v1, v2}, Lcom/moji/crop/CropImageView;->a(Lcom/moji/crop/RotateBitmap;Z)V

    const/4 v0, 0x0

    .line 200
    invoke-virtual {p0}, Lcom/moji/crop/CropImageActivity;->getResources()Landroid/content/res/Resources;

    move-result-object v1

    sget v2, Lcom/moji/camera/R$string;->crop__wait:I

    invoke-virtual {v1, v2}, Landroid/content/res/Resources;->getString(I)Ljava/lang/String;

    move-result-object v1

    new-instance v2, Lcom/moji/crop/CropImageActivity$4;

    invoke-direct {v2, p0}, Lcom/moji/crop/CropImageActivity$4;-><init>(Lcom/moji/crop/CropImageActivity;)V

    iget-object v3, p0, Lcom/moji/crop/CropImageActivity;->a:Landroid/os/Handler;

    invoke-static {p0, v0, v1, v2, v3}, Lcom/moji/crop/CropUtil;->a(Lcom/moji/crop/MonitoredActivity;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Runnable;Landroid/os/Handler;)V

    return-void
.end method

.method static synthetic g(Lcom/moji/crop/CropImageActivity;)Lcom/moji/crop/HighlightView;
    .locals 0

    .line 51
    iget-object p0, p0, Lcom/moji/crop/CropImageActivity;->n:Lcom/moji/crop/HighlightView;

    return-object p0
.end method

.method private g()V
    .locals 7

    .line 272
    iget-object v0, p0, Lcom/moji/crop/CropImageActivity;->n:Lcom/moji/crop/HighlightView;

    if-eqz v0, :cond_6

    iget-boolean v0, p0, Lcom/moji/crop/CropImageActivity;->j:Z

    if-eqz v0, :cond_0

    goto/16 :goto_1

    :cond_0
    const/4 v0, 0x1

    .line 275
    iput-boolean v0, p0, Lcom/moji/crop/CropImageActivity;->j:Z

    .line 278
    iget-object v1, p0, Lcom/moji/crop/CropImageActivity;->n:Lcom/moji/crop/HighlightView;

    iget v2, p0, Lcom/moji/crop/CropImageActivity;->k:I

    int-to-float v2, v2

    invoke-virtual {v1, v2}, Lcom/moji/crop/HighlightView;->a(F)Landroid/graphics/Rect;

    move-result-object v1

    .line 279
    invoke-virtual {v1}, Landroid/graphics/Rect;->width()I

    move-result v2

    .line 280
    invoke-virtual {v1}, Landroid/graphics/Rect;->height()I

    move-result v3

    .line 284
    iget v4, p0, Lcom/moji/crop/CropImageActivity;->d:I

    if-lez v4, :cond_3

    iget v4, p0, Lcom/moji/crop/CropImageActivity;->e:I

    if-lez v4, :cond_3

    iget v4, p0, Lcom/moji/crop/CropImageActivity;->d:I

    if-gt v2, v4, :cond_1

    iget v4, p0, Lcom/moji/crop/CropImageActivity;->e:I

    if-le v3, v4, :cond_3

    :cond_1
    int-to-float v2, v2

    int-to-float v3, v3

    div-float/2addr v2, v3

    .line 286
    iget v3, p0, Lcom/moji/crop/CropImageActivity;->d:I

    int-to-float v3, v3

    iget v4, p0, Lcom/moji/crop/CropImageActivity;->e:I

    int-to-float v4, v4

    div-float/2addr v3, v4

    const/high16 v4, 0x3f000000    # 0.5f

    cmpl-float v3, v3, v2

    if-lez v3, :cond_2

    .line 287
    iget v3, p0, Lcom/moji/crop/CropImageActivity;->e:I

    .line 288
    iget v5, p0, Lcom/moji/crop/CropImageActivity;->e:I

    int-to-float v5, v5

    mul-float v5, v5, v2

    add-float/2addr v5, v4

    float-to-int v2, v5

    goto :goto_0

    .line 290
    :cond_2
    iget v3, p0, Lcom/moji/crop/CropImageActivity;->d:I

    .line 291
    iget v5, p0, Lcom/moji/crop/CropImageActivity;->d:I

    int-to-float v5, v5

    div-float/2addr v5, v2

    add-float/2addr v5, v4

    float-to-int v2, v5

    move v6, v3

    move v3, v2

    move v2, v6

    .line 295
    :cond_3
    :goto_0
    iget v4, p0, Lcom/moji/crop/CropImageActivity;->f:I

    if-eqz v4, :cond_4

    iget v4, p0, Lcom/moji/crop/CropImageActivity;->f:I

    rem-int/lit8 v4, v4, 0x5a

    if-nez v4, :cond_4

    move v6, v3

    move v3, v2

    move v2, v6

    .line 301
    :cond_4
    :try_start_0
    invoke-direct {p0, v1, v2, v3}, Lcom/moji/crop/CropImageActivity;->a(Landroid/graphics/Rect;II)Landroid/graphics/Bitmap;

    move-result-object v1
    :try_end_0
    .catch Ljava/lang/IllegalArgumentException; {:try_start_0 .. :try_end_0} :catch_0

    if-eqz v1, :cond_5

    .line 309
    iget-object v2, p0, Lcom/moji/crop/CropImageActivity;->m:Lcom/moji/crop/CropImageView;

    new-instance v3, Lcom/moji/crop/RotateBitmap;

    iget v4, p0, Lcom/moji/crop/CropImageActivity;->f:I

    invoke-direct {v3, v1, v4}, Lcom/moji/crop/RotateBitmap;-><init>(Landroid/graphics/Bitmap;I)V

    invoke-virtual {v2, v3, v0}, Lcom/moji/crop/CropImageView;->a(Lcom/moji/crop/RotateBitmap;Z)V

    .line 310
    iget-object v0, p0, Lcom/moji/crop/CropImageActivity;->m:Lcom/moji/crop/CropImageView;

    invoke-virtual {v0}, Lcom/moji/crop/CropImageView;->b()V

    .line 311
    iget-object v0, p0, Lcom/moji/crop/CropImageActivity;->m:Lcom/moji/crop/CropImageView;

    iget-object v0, v0, Lcom/moji/crop/CropImageView;->a:Ljava/util/ArrayList;

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

    .line 313
    :cond_5
    invoke-direct {p0, v1}, Lcom/moji/crop/CropImageActivity;->a(Landroid/graphics/Bitmap;)V

    return-void

    :catch_0
    move-exception v0

    .line 303
    invoke-direct {p0, v0}, Lcom/moji/crop/CropImageActivity;->a(Ljava/lang/Throwable;)V

    .line 304
    invoke-virtual {p0}, Lcom/moji/crop/CropImageActivity;->finish()V

    return-void

    :cond_6
    :goto_1
    return-void
.end method

.method private h()V
    .locals 1

    .line 379
    iget-object v0, p0, Lcom/moji/crop/CropImageActivity;->m:Lcom/moji/crop/CropImageView;

    invoke-virtual {v0}, Lcom/moji/crop/CropImageView;->a()V

    .line 380
    iget-object v0, p0, Lcom/moji/crop/CropImageActivity;->l:Lcom/moji/crop/RotateBitmap;

    if-eqz v0, :cond_0

    .line 381
    iget-object v0, p0, Lcom/moji/crop/CropImageActivity;->l:Lcom/moji/crop/RotateBitmap;

    invoke-virtual {v0}, Lcom/moji/crop/RotateBitmap;->g()V

    :cond_0
    return-void
.end method


# virtual methods
.method public bridge synthetic addLifeCycleListener(Lcom/moji/crop/MonitoredActivity$LifeCycleListener;)V
    .locals 0

    .line 51
    invoke-super {p0, p1}, Lcom/moji/crop/MonitoredActivity;->addLifeCycleListener(Lcom/moji/crop/MonitoredActivity$LifeCycleListener;)V

    return-void
.end method

.method public isSaving()Z
    .locals 1

    .line 439
    iget-boolean v0, p0, Lcom/moji/crop/CropImageActivity;->j:Z

    return v0
.end method

.method public onCreate(Landroid/os/Bundle;)V
    .locals 0

    .line 79
    invoke-super {p0, p1}, Lcom/moji/crop/MonitoredActivity;->onCreate(Landroid/os/Bundle;)V

    .line 80
    invoke-direct {p0}, Lcom/moji/crop/CropImageActivity;->a()V

    .line 81
    invoke-direct {p0}, Lcom/moji/crop/CropImageActivity;->b()V

    .line 83
    invoke-direct {p0}, Lcom/moji/crop/CropImageActivity;->c()V

    .line 84
    iget-object p1, p0, Lcom/moji/crop/CropImageActivity;->l:Lcom/moji/crop/RotateBitmap;

    if-nez p1, :cond_0

    .line 85
    invoke-virtual {p0}, Lcom/moji/crop/CropImageActivity;->finish()V

    return-void

    .line 88
    :cond_0
    invoke-direct {p0}, Lcom/moji/crop/CropImageActivity;->f()V

    return-void
.end method

.method protected onDestroy()V
    .locals 1

    .line 427
    invoke-super {p0}, Lcom/moji/crop/MonitoredActivity;->onDestroy()V

    .line 428
    iget-object v0, p0, Lcom/moji/crop/CropImageActivity;->l:Lcom/moji/crop/RotateBitmap;

    if-eqz v0, :cond_0

    .line 429
    iget-object v0, p0, Lcom/moji/crop/CropImageActivity;->l:Lcom/moji/crop/RotateBitmap;

    invoke-virtual {v0}, Lcom/moji/crop/RotateBitmap;->g()V

    :cond_0
    return-void
.end method

.method public onSearchRequested()Z
    .locals 1

    const/4 v0, 0x0

    return v0
.end method

.method public bridge synthetic removeLifeCycleListener(Lcom/moji/crop/MonitoredActivity$LifeCycleListener;)V
    .locals 0

    .line 51
    invoke-super {p0, p1}, Lcom/moji/crop/MonitoredActivity;->removeLifeCycleListener(Lcom/moji/crop/MonitoredActivity$LifeCycleListener;)V

    return-void
.end method
