PhotoCropView.smali

.class public Lim/tpelyyftgw/ui/components/PhotoCropView;
.super Landroid/widget/FrameLayout;
.source "PhotoCropView.java"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lim/tpelyyftgw/ui/components/PhotoCropView$PhotoCropViewDelegate;
    }
.end annotation


# instance fields
.field private cropView:Lim/tpelyyftgw/ui/components/crop/CropView;

.field private delegate:Lim/tpelyyftgw/ui/components/PhotoCropView$PhotoCropViewDelegate;

.field isFcCrop:Z

.field private showOnSetBitmap:Z

.field private wheelView:Lim/tpelyyftgw/ui/components/crop/CropRotationWheel;


# direct methods
.method static constructor <clinit>()V
    .registers 1

    return-void
.end method

.method public constructor <init>(Landroid/content/Context;)V
    .registers 10
    .param p1, "context"    # Landroid/content/Context;

    .line 31
    invoke-direct {p0, p1}, Landroid/widget/FrameLayout;-><init>(Landroid/content/Context;)V

    .line 33
    new-instance v0, Lim/tpelyyftgw/ui/components/crop/CropView;

    invoke-virtual {p0}, Lim/tpelyyftgw/ui/components/PhotoCropView;->getContext()Landroid/content/Context;

    move-result-object v1

    invoke-direct {v0, v1}, Lim/tpelyyftgw/ui/components/crop/CropView;-><init>(Landroid/content/Context;)V

    iput-object v0, p0, Lim/tpelyyftgw/ui/components/PhotoCropView;->cropView:Lim/tpelyyftgw/ui/components/crop/CropView;

    .line 34
    new-instance v1, Lim/tpelyyftgw/ui/components/PhotoCropView$1;

    invoke-direct {v1, p0}, Lim/tpelyyftgw/ui/components/PhotoCropView$1;-><init>(Lim/tpelyyftgw/ui/components/PhotoCropView;)V

    invoke-virtual {v0, v1}, Lim/tpelyyftgw/ui/components/crop/CropView;->setListener(Lim/tpelyyftgw/ui/components/crop/CropView$CropViewListener;)V

    .line 47
    iget-object v0, p0, Lim/tpelyyftgw/ui/components/PhotoCropView;->cropView:Lim/tpelyyftgw/ui/components/crop/CropView;

    const/high16 v1, 0x42800000    # 64.0f

    invoke-static {v1}, Lim/tpelyyftgw/messenger/AndroidUtilities;->dp(F)I

    move-result v1

    int-to-float v1, v1

    invoke-virtual {v0, v1}, Lim/tpelyyftgw/ui/components/crop/CropView;->setBottomPadding(F)V

    .line 48
    iget-object v0, p0, Lim/tpelyyftgw/ui/components/PhotoCropView;->cropView:Lim/tpelyyftgw/ui/components/crop/CropView;

    invoke-virtual {p0, v0}, Lim/tpelyyftgw/ui/components/PhotoCropView;->addView(Landroid/view/View;)V

    .line 50
    new-instance v0, Lim/tpelyyftgw/ui/components/crop/CropRotationWheel;

    invoke-virtual {p0}, Lim/tpelyyftgw/ui/components/PhotoCropView;->getContext()Landroid/content/Context;

    move-result-object v1

    invoke-direct {v0, v1}, Lim/tpelyyftgw/ui/components/crop/CropRotationWheel;-><init>(Landroid/content/Context;)V

    iput-object v0, p0, Lim/tpelyyftgw/ui/components/PhotoCropView;->wheelView:Lim/tpelyyftgw/ui/components/crop/CropRotationWheel;

    .line 51
    new-instance v1, Lim/tpelyyftgw/ui/components/PhotoCropView$2;

    invoke-direct {v1, p0}, Lim/tpelyyftgw/ui/components/PhotoCropView$2;-><init>(Lim/tpelyyftgw/ui/components/PhotoCropView;)V

    invoke-virtual {v0, v1}, Lim/tpelyyftgw/ui/components/crop/CropRotationWheel;->setListener(Lim/tpelyyftgw/ui/components/crop/CropRotationWheel$RotationWheelListener;)V

    .line 80
    iget-object v0, p0, Lim/tpelyyftgw/ui/components/PhotoCropView;->wheelView:Lim/tpelyyftgw/ui/components/crop/CropRotationWheel;

    const/high16 v1, -0x40800000    # -1.0f

    const/high16 v2, -0x40000000    # -2.0f

    const/16 v3, 0x51

    const/4 v4, 0x0

    const/4 v5, 0x0

    const/4 v6, 0x0

    const/4 v7, 0x0

    invoke-static/range {v1 .. v7}, Lim/tpelyyftgw/ui/components/LayoutHelper;->createFrame(FFIFFFF)Landroid/widget/FrameLayout$LayoutParams;

    move-result-object v1

    invoke-virtual {p0, v0, v1}, Lim/tpelyyftgw/ui/components/PhotoCropView;->addView(Landroid/view/View;Landroid/view/ViewGroup$LayoutParams;)V

    .line 81
    return-void
.end method

.method public constructor <init>(Landroid/content/Context;Z)V
    .registers 11
    .param p1, "context"    # Landroid/content/Context;
    .param p2, "isFcCrop"    # Z

    .line 90
    invoke-direct {p0, p1}, Landroid/widget/FrameLayout;-><init>(Landroid/content/Context;)V

    .line 91
    iput-boolean p2, p0, Lim/tpelyyftgw/ui/components/PhotoCropView;->isFcCrop:Z

    .line 92
    if-eqz p2, :cond_14

    .line 93
    new-instance v0, Lim/tpelyyftgw/ui/components/crop/CropView;

    invoke-virtual {p0}, Lim/tpelyyftgw/ui/components/PhotoCropView;->getContext()Landroid/content/Context;

    move-result-object v1

    const/4 v2, 0x1

    invoke-direct {v0, v1, v2}, Lim/tpelyyftgw/ui/components/crop/CropView;-><init>(Landroid/content/Context;Z)V

    iput-object v0, p0, Lim/tpelyyftgw/ui/components/PhotoCropView;->cropView:Lim/tpelyyftgw/ui/components/crop/CropView;

    goto :goto_1f

    .line 95
    :cond_14
    new-instance v0, Lim/tpelyyftgw/ui/components/crop/CropView;

    invoke-virtual {p0}, Lim/tpelyyftgw/ui/components/PhotoCropView;->getContext()Landroid/content/Context;

    move-result-object v1

    invoke-direct {v0, v1}, Lim/tpelyyftgw/ui/components/crop/CropView;-><init>(Landroid/content/Context;)V

    iput-object v0, p0, Lim/tpelyyftgw/ui/components/PhotoCropView;->cropView:Lim/tpelyyftgw/ui/components/crop/CropView;

    .line 97
    :goto_1f
    iget-object v0, p0, Lim/tpelyyftgw/ui/components/PhotoCropView;->cropView:Lim/tpelyyftgw/ui/components/crop/CropView;

    new-instance v1, Lim/tpelyyftgw/ui/components/PhotoCropView$3;

    invoke-direct {v1, p0}, Lim/tpelyyftgw/ui/components/PhotoCropView$3;-><init>(Lim/tpelyyftgw/ui/components/PhotoCropView;)V

    invoke-virtual {v0, v1}, Lim/tpelyyftgw/ui/components/crop/CropView;->setListener(Lim/tpelyyftgw/ui/components/crop/CropView$CropViewListener;)V

    .line 110
    iget-object v0, p0, Lim/tpelyyftgw/ui/components/PhotoCropView;->cropView:Lim/tpelyyftgw/ui/components/crop/CropView;

    const/high16 v1, 0x42800000    # 64.0f

    invoke-static {v1}, Lim/tpelyyftgw/messenger/AndroidUtilities;->dp(F)I

    move-result v1

    int-to-float v1, v1

    invoke-virtual {v0, v1}, Lim/tpelyyftgw/ui/components/crop/CropView;->setBottomPadding(F)V

    .line 111
    iget-object v0, p0, Lim/tpelyyftgw/ui/components/PhotoCropView;->cropView:Lim/tpelyyftgw/ui/components/crop/CropView;

    invoke-virtual {p0, v0}, Lim/tpelyyftgw/ui/components/PhotoCropView;->addView(Landroid/view/View;)V

    .line 113
    new-instance v0, Lim/tpelyyftgw/ui/components/crop/CropRotationWheel;

    invoke-virtual {p0}, Lim/tpelyyftgw/ui/components/PhotoCropView;->getContext()Landroid/content/Context;

    move-result-object v1

    invoke-direct {v0, v1}, Lim/tpelyyftgw/ui/components/crop/CropRotationWheel;-><init>(Landroid/content/Context;)V

    iput-object v0, p0, Lim/tpelyyftgw/ui/components/PhotoCropView;->wheelView:Lim/tpelyyftgw/ui/components/crop/CropRotationWheel;

    .line 114
    new-instance v1, Lim/tpelyyftgw/ui/components/PhotoCropView$4;

    invoke-direct {v1, p0}, Lim/tpelyyftgw/ui/components/PhotoCropView$4;-><init>(Lim/tpelyyftgw/ui/components/PhotoCropView;)V

    invoke-virtual {v0, v1}, Lim/tpelyyftgw/ui/components/crop/CropRotationWheel;->setListener(Lim/tpelyyftgw/ui/components/crop/CropRotationWheel$RotationWheelListener;)V

    .line 143
    iget-object v0, p0, Lim/tpelyyftgw/ui/components/PhotoCropView;->wheelView:Lim/tpelyyftgw/ui/components/crop/CropRotationWheel;

    const/high16 v1, -0x40800000    # -1.0f

    const/high16 v2, -0x40000000    # -2.0f

    const/16 v3, 0x51

    const/4 v4, 0x0

    const/4 v5, 0x0

    const/4 v6, 0x0

    const/4 v7, 0x0

    invoke-static/range {v1 .. v7}, Lim/tpelyyftgw/ui/components/LayoutHelper;->createFrame(FFIFFFF)Landroid/widget/FrameLayout$LayoutParams;

    move-result-object v1

    invoke-virtual {p0, v0, v1}, Lim/tpelyyftgw/ui/components/PhotoCropView;->addView(Landroid/view/View;Landroid/view/ViewGroup$LayoutParams;)V

    .line 144
    return-void
.end method

.method static synthetic access$000(Lim/tpelyyftgw/ui/components/PhotoCropView;)Lim/tpelyyftgw/ui/components/PhotoCropView$PhotoCropViewDelegate;
    .registers 2
    .param p0, "x0"    # Lim/tpelyyftgw/ui/components/PhotoCropView;

    .line 15
    iget-object v0, p0, Lim/tpelyyftgw/ui/components/PhotoCropView;->delegate:Lim/tpelyyftgw/ui/components/PhotoCropView$PhotoCropViewDelegate;

    return-object v0
.end method

.method static synthetic access$100(Lim/tpelyyftgw/ui/components/PhotoCropView;)Lim/tpelyyftgw/ui/components/crop/CropRotationWheel;
    .registers 2
    .param p0, "x0"    # Lim/tpelyyftgw/ui/components/PhotoCropView;

    .line 15
    iget-object v0, p0, Lim/tpelyyftgw/ui/components/PhotoCropView;->wheelView:Lim/tpelyyftgw/ui/components/crop/CropRotationWheel;

    return-object v0
.end method

.method static synthetic access$200(Lim/tpelyyftgw/ui/components/PhotoCropView;)Lim/tpelyyftgw/ui/components/crop/CropView;
    .registers 2
    .param p0, "x0"    # Lim/tpelyyftgw/ui/components/PhotoCropView;

    .line 15
    iget-object v0, p0, Lim/tpelyyftgw/ui/components/PhotoCropView;->cropView:Lim/tpelyyftgw/ui/components/crop/CropView;

    return-object v0
.end method


# virtual methods
.method public getBitmap()Landroid/graphics/Bitmap;
    .registers 2

    .line 228
    iget-object v0, p0, Lim/tpelyyftgw/ui/components/PhotoCropView;->cropView:Lim/tpelyyftgw/ui/components/crop/CropView;

    if-eqz v0, :cond_9

    .line 229
    invoke-virtual {v0}, Lim/tpelyyftgw/ui/components/crop/CropView;->getResult()Landroid/graphics/Bitmap;

    move-result-object v0

    return-object v0

    .line 231
    :cond_9
    const/4 v0, 0x0

    return-object v0
.end method

.method public getRectSizeX()F
    .registers 2

    .line 220
    iget-object v0, p0, Lim/tpelyyftgw/ui/components/PhotoCropView;->cropView:Lim/tpelyyftgw/ui/components/crop/CropView;

    invoke-virtual {v0}, Lim/tpelyyftgw/ui/components/crop/CropView;->getCropWidth()F

    move-result v0

    return v0
.end method

.method public getRectSizeY()F
    .registers 2

    .line 224
    iget-object v0, p0, Lim/tpelyyftgw/ui/components/PhotoCropView;->cropView:Lim/tpelyyftgw/ui/components/crop/CropView;

    invoke-virtual {v0}, Lim/tpelyyftgw/ui/components/crop/CropView;->getCropHeight()F

    move-result v0

    return v0
.end method

.method public getRectX()F
    .registers 3

    .line 212
    iget-object v0, p0, Lim/tpelyyftgw/ui/components/PhotoCropView;->cropView:Lim/tpelyyftgw/ui/components/crop/CropView;

    invoke-virtual {v0}, Lim/tpelyyftgw/ui/components/crop/CropView;->getCropLeft()F

    move-result v0

    const/high16 v1, 0x41600000    # 14.0f

    invoke-static {v1}, Lim/tpelyyftgw/messenger/AndroidUtilities;->dp(F)I

    move-result v1

    int-to-float v1, v1

    sub-float/2addr v0, v1

    return v0
.end method

.method public getRectY()F
    .registers 4

    .line 216
    iget-object v0, p0, Lim/tpelyyftgw/ui/components/PhotoCropView;->cropView:Lim/tpelyyftgw/ui/components/crop/CropView;

    invoke-virtual {v0}, Lim/tpelyyftgw/ui/components/crop/CropView;->getCropTop()F

    move-result v0

    const/high16 v1, 0x41600000    # 14.0f

    invoke-static {v1}, Lim/tpelyyftgw/messenger/AndroidUtilities;->dp(F)I

    move-result v1

    int-to-float v1, v1

    sub-float/2addr v0, v1

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

    const/16 v2, 0x15

    if-lt v1, v2, :cond_17

    sget v1, Lim/tpelyyftgw/messenger/AndroidUtilities;->statusBarHeight:I

    goto :goto_18

    :cond_17
    const/4 v1, 0x0

    :goto_18
    int-to-float v1, v1

    sub-float/2addr v0, v1

    return v0
.end method

.method public hideBackView()V
    .registers 2

    .line 186
    iget-object v0, p0, Lim/tpelyyftgw/ui/components/PhotoCropView;->cropView:Lim/tpelyyftgw/ui/components/crop/CropView;

    invoke-virtual {v0}, Lim/tpelyyftgw/ui/components/crop/CropView;->hideBackView()V

    .line 187
    return-void
.end method

.method public isFcCrop()Z
    .registers 2

    .line 86
    iget-boolean v0, p0, Lim/tpelyyftgw/ui/components/PhotoCropView;->isFcCrop:Z

    return v0
.end method

.method public isReady()Z
    .registers 2

    .line 169
    iget-object v0, p0, Lim/tpelyyftgw/ui/components/PhotoCropView;->cropView:Lim/tpelyyftgw/ui/components/crop/CropView;

    invoke-virtual {v0}, Lim/tpelyyftgw/ui/components/crop/CropView;->isReady()Z

    move-result v0

    return v0
.end method

.method public onAppear()V
    .registers 2

    .line 178
    iget-object v0, p0, Lim/tpelyyftgw/ui/components/PhotoCropView;->cropView:Lim/tpelyyftgw/ui/components/crop/CropView;

    invoke-virtual {v0}, Lim/tpelyyftgw/ui/components/crop/CropView;->willShow()V

    .line 179
    return-void
.end method

.method public onAppeared()V
    .registers 2

    .line 198
    iget-object v0, p0, Lim/tpelyyftgw/ui/components/PhotoCropView;->cropView:Lim/tpelyyftgw/ui/components/crop/CropView;

    if-eqz v0, :cond_8

    .line 199
    invoke-virtual {v0}, Lim/tpelyyftgw/ui/components/crop/CropView;->show()V

    goto :goto_b

    .line 201
    :cond_8
    const/4 v0, 0x1

    iput-boolean v0, p0, Lim/tpelyyftgw/ui/components/PhotoCropView;->showOnSetBitmap:Z

    .line 203
    :goto_b
    return-void
.end method

.method public onDisappear()V
    .registers 2

    .line 206
    iget-object v0, p0, Lim/tpelyyftgw/ui/components/PhotoCropView;->cropView:Lim/tpelyyftgw/ui/components/crop/CropView;

    if-eqz v0, :cond_7

    .line 207
    invoke-virtual {v0}, Lim/tpelyyftgw/ui/components/crop/CropView;->hide()V

    .line 209
    :cond_7
    return-void
.end method

.method protected onLayout(ZIIII)V
    .registers 7
    .param p1, "changed"    # Z
    .param p2, "left"    # I
    .param p3, "top"    # I
    .param p4, "right"    # I
    .param p5, "bottom"    # I

    .line 240
    invoke-super/range {p0 .. p5}, Landroid/widget/FrameLayout;->onLayout(ZIIII)V

    .line 241
    iget-object v0, p0, Lim/tpelyyftgw/ui/components/PhotoCropView;->cropView:Lim/tpelyyftgw/ui/components/crop/CropView;

    if-eqz v0, :cond_a

    .line 242
    invoke-virtual {v0}, Lim/tpelyyftgw/ui/components/crop/CropView;->updateLayout()V

    .line 244
    :cond_a
    return-void
.end method

.method public reset()V
    .registers 2

    .line 173
    iget-object v0, p0, Lim/tpelyyftgw/ui/components/PhotoCropView;->wheelView:Lim/tpelyyftgw/ui/components/crop/CropRotationWheel;

    invoke-virtual {v0}, Lim/tpelyyftgw/ui/components/crop/CropRotationWheel;->reset()V

    .line 174
    iget-object v0, p0, Lim/tpelyyftgw/ui/components/PhotoCropView;->cropView:Lim/tpelyyftgw/ui/components/crop/CropView;

    invoke-virtual {v0}, Lim/tpelyyftgw/ui/components/crop/CropView;->reset()V

    .line 175
    return-void
.end method

.method public rotate()V
    .registers 2

    .line 147
    iget-object v0, p0, Lim/tpelyyftgw/ui/components/PhotoCropView;->wheelView:Lim/tpelyyftgw/ui/components/crop/CropRotationWheel;

    if-eqz v0, :cond_7

    .line 148
    invoke-virtual {v0}, Lim/tpelyyftgw/ui/components/crop/CropRotationWheel;->reset()V

    .line 150
    :cond_7
    iget-object v0, p0, Lim/tpelyyftgw/ui/components/PhotoCropView;->cropView:Lim/tpelyyftgw/ui/components/crop/CropView;

    invoke-virtual {v0}, Lim/tpelyyftgw/ui/components/crop/CropView;->rotate90Degrees()V

    .line 151
    return-void
.end method

.method public setAspectRatio(F)V
    .registers 3
    .param p1, "ratio"    # F

    .line 182
    iget-object v0, p0, Lim/tpelyyftgw/ui/components/PhotoCropView;->cropView:Lim/tpelyyftgw/ui/components/crop/CropView;

    invoke-virtual {v0, p1}, Lim/tpelyyftgw/ui/components/crop/CropView;->setAspectRatio(F)V

    .line 183
    return-void
.end method

.method public setBitmap(Landroid/graphics/Bitmap;IZZ)V
    .registers 7
    .param p1, "bitmap"    # Landroid/graphics/Bitmap;
    .param p2, "rotation"    # I
    .param p3, "freeform"    # Z
    .param p4, "update"    # Z

    .line 154
    invoke-virtual {p0}, Lim/tpelyyftgw/ui/components/PhotoCropView;->requestLayout()V

    .line 156
    iget-object v0, p0, Lim/tpelyyftgw/ui/components/PhotoCropView;->cropView:Lim/tpelyyftgw/ui/components/crop/CropView;

    invoke-virtual {v0, p1, p2, p3, p4}, Lim/tpelyyftgw/ui/components/crop/CropView;->setBitmap(Landroid/graphics/Bitmap;IZZ)V

    .line 158
    iget-boolean v0, p0, Lim/tpelyyftgw/ui/components/PhotoCropView;->showOnSetBitmap:Z

    const/4 v1, 0x0

    if-eqz v0, :cond_14

    .line 159
    iput-boolean v1, p0, Lim/tpelyyftgw/ui/components/PhotoCropView;->showOnSetBitmap:Z

    .line 160
    iget-object v0, p0, Lim/tpelyyftgw/ui/components/PhotoCropView;->cropView:Lim/tpelyyftgw/ui/components/crop/CropView;

    invoke-virtual {v0}, Lim/tpelyyftgw/ui/components/crop/CropView;->show()V

    .line 163
    :cond_14
    iget-object v0, p0, Lim/tpelyyftgw/ui/components/PhotoCropView;->wheelView:Lim/tpelyyftgw/ui/components/crop/CropRotationWheel;

    invoke-virtual {v0, p3}, Lim/tpelyyftgw/ui/components/crop/CropRotationWheel;->setFreeform(Z)V

    .line 164
    iget-object v0, p0, Lim/tpelyyftgw/ui/components/PhotoCropView;->wheelView:Lim/tpelyyftgw/ui/components/crop/CropRotationWheel;

    invoke-virtual {v0}, Lim/tpelyyftgw/ui/components/crop/CropRotationWheel;->reset()V

    .line 165
    iget-object v0, p0, Lim/tpelyyftgw/ui/components/PhotoCropView;->wheelView:Lim/tpelyyftgw/ui/components/crop/CropRotationWheel;

    if-eqz p3, :cond_23

    goto :goto_24

    :cond_23
    const/4 v1, 0x4

    :goto_24
    invoke-virtual {v0, v1}, Lim/tpelyyftgw/ui/components/crop/CropRotationWheel;->setVisibility(I)V

    .line 166
    return-void
.end method

.method public setDelegate(Lim/tpelyyftgw/ui/components/PhotoCropView$PhotoCropViewDelegate;)V
    .registers 2
    .param p1, "delegate"    # Lim/tpelyyftgw/ui/components/PhotoCropView$PhotoCropViewDelegate;

    .line 235
    iput-object p1, p0, Lim/tpelyyftgw/ui/components/PhotoCropView;->delegate:Lim/tpelyyftgw/ui/components/PhotoCropView$PhotoCropViewDelegate;

    .line 236
    return-void
.end method

.method public setFreeform(Z)V
    .registers 3
    .param p1, "freeform"    # Z

    .line 194
    iget-object v0, p0, Lim/tpelyyftgw/ui/components/PhotoCropView;->cropView:Lim/tpelyyftgw/ui/components/crop/CropView;

    invoke-virtual {v0, p1}, Lim/tpelyyftgw/ui/components/crop/CropView;->setFreeform(Z)V

    .line 195
    return-void
.end method

.method public showBackView()V
    .registers 2

    .line 190
    iget-object v0, p0, Lim/tpelyyftgw/ui/components/PhotoCropView;->cropView:Lim/tpelyyftgw/ui/components/crop/CropView;

    invoke-virtual {v0}, Lim/tpelyyftgw/ui/components/crop/CropView;->showBackView()V

    .line 191
    return-void
.end method