.class Lcom/moji/fancycoverflow/FancyCoverFlowItemWrapper;
.super Landroid/view/ViewGroup;
.source "FancyCoverFlowItemWrapper.java"


# static fields
.field private static final a:Ljava/lang/Object;


# instance fields
.field private b:Landroid/graphics/Bitmap;

.field private c:Landroid/graphics/Canvas;


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

    .line 49
    new-instance v0, Ljava/lang/Object;

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

    sput-object v0, Lcom/moji/fancycoverflow/FancyCoverFlowItemWrapper;->a:Ljava/lang/Object;

    return-void
.end method

.method public constructor <init>(Landroid/content/Context;)V
    .locals 0

    .line 68
    invoke-direct {p0, p1}, Landroid/view/ViewGroup;-><init>(Landroid/content/Context;)V

    .line 69
    invoke-direct {p0}, Lcom/moji/fancycoverflow/FancyCoverFlowItemWrapper;->a()V

    return-void
.end method

.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
    .locals 0

    .line 73
    invoke-direct {p0, p1, p2}, Landroid/view/ViewGroup;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;)V

    .line 74
    invoke-direct {p0}, Lcom/moji/fancycoverflow/FancyCoverFlowItemWrapper;->a()V

    return-void
.end method

.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V
    .locals 0

    .line 78
    invoke-direct {p0, p1, p2, p3}, Landroid/view/ViewGroup;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V

    .line 79
    invoke-direct {p0}, Lcom/moji/fancycoverflow/FancyCoverFlowItemWrapper;->a()V

    return-void
.end method

.method private a()V
    .locals 0

    return-void
.end method

.method private a(Landroid/view/View;)V
    .locals 2

    .line 148
    invoke-virtual {p1}, Landroid/view/View;->getTag()Ljava/lang/Object;

    move-result-object v0

    if-eqz v0, :cond_0

    .line 149
    check-cast v0, Ljava/lang/Boolean;

    invoke-virtual {v0}, Ljava/lang/Boolean;->booleanValue()Z

    move-result v0

    if-nez v0, :cond_2

    .line 150
    :cond_0
    sget-object v0, Lcom/moji/fancycoverflow/FancyCoverFlowItemWrapper;->a:Ljava/lang/Object;

    monitor-enter v0

    .line 151
    :try_start_0
    iget-object v1, p0, Lcom/moji/fancycoverflow/FancyCoverFlowItemWrapper;->c:Landroid/graphics/Canvas;

    if-eqz v1, :cond_1

    .line 152
    iget-object v1, p0, Lcom/moji/fancycoverflow/FancyCoverFlowItemWrapper;->c:Landroid/graphics/Canvas;

    invoke-virtual {p1, v1}, Landroid/view/View;->draw(Landroid/graphics/Canvas;)V

    const/4 v1, 0x1

    .line 153
    invoke-static {v1}, Ljava/lang/Boolean;->valueOf(Z)Ljava/lang/Boolean;

    move-result-object v1

    invoke-virtual {p1, v1}, Landroid/view/View;->setTag(Ljava/lang/Object;)V

    goto :goto_0

    :cond_1
    const-string p1, "FancyCoverFlowItemWrapp"

    const-string v1, "this.wrappedViewDrawingCanvas is null"

    .line 155
    invoke-static {p1, v1}, Lcom/moji/tool/log/MJLogger;->e(Ljava/lang/String;Ljava/lang/String;)V

    .line 157
    :goto_0
    monitor-exit v0

    :cond_2
    return-void

    :catchall_0
    move-exception p1

    monitor-exit v0
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw p1
.end method

.method private b()V
    .locals 4

    const/4 v0, 0x0

    .line 162
    invoke-virtual {p0, v0}, Lcom/moji/fancycoverflow/FancyCoverFlowItemWrapper;->getChildAt(I)Landroid/view/View;

    move-result-object v1

    if-eqz v1, :cond_0

    .line 166
    invoke-virtual {p0}, Lcom/moji/fancycoverflow/FancyCoverFlowItemWrapper;->getMeasuredHeight()I

    move-result v1

    const/high16 v2, 0x3f800000    # 1.0f

    int-to-float v1, v1

    mul-float v1, v1, v2

    float-to-int v1, v1

    .line 169
    invoke-virtual {p0}, Lcom/moji/fancycoverflow/FancyCoverFlowItemWrapper;->getMeasuredWidth()I

    move-result v3

    int-to-float v3, v3

    mul-float v3, v3, v2

    float-to-int v2, v3

    const/high16 v3, -0x80000000

    .line 171
    invoke-static {v1, v3}, Landroid/view/View$MeasureSpec;->makeMeasureSpec(II)I

    move-result v1

    .line 172
    invoke-static {v2, v3}, Landroid/view/View$MeasureSpec;->makeMeasureSpec(II)I

    move-result v2

    .line 173
    invoke-virtual {p0, v0}, Lcom/moji/fancycoverflow/FancyCoverFlowItemWrapper;->getChildAt(I)Landroid/view/View;

    move-result-object v0

    invoke-virtual {v0, v2, v1}, Landroid/view/View;->measure(II)V

    :cond_0
    return-void
.end method


# virtual methods
.method protected dispatchDraw(Landroid/graphics/Canvas;)V
    .locals 5

    const/4 v0, 0x0

    .line 130
    invoke-virtual {p0, v0}, Lcom/moji/fancycoverflow/FancyCoverFlowItemWrapper;->getChildAt(I)Landroid/view/View;

    move-result-object v0

    if-eqz v0, :cond_1

    .line 133
    invoke-direct {p0, v0}, Lcom/moji/fancycoverflow/FancyCoverFlowItemWrapper;->a(Landroid/view/View;)V

    .line 134
    sget-object v1, Lcom/moji/fancycoverflow/FancyCoverFlowItemWrapper;->a:Ljava/lang/Object;

    monitor-enter v1

    .line 135
    :try_start_0
    iget-object v2, p0, Lcom/moji/fancycoverflow/FancyCoverFlowItemWrapper;->b:Landroid/graphics/Bitmap;

    if-eqz v2, :cond_0

    iget-object v2, p0, Lcom/moji/fancycoverflow/FancyCoverFlowItemWrapper;->b:Landroid/graphics/Bitmap;

    invoke-virtual {v2}, Landroid/graphics/Bitmap;->isRecycled()Z

    move-result v2

    if-nez v2, :cond_0

    .line 136
    iget-object v2, p0, Lcom/moji/fancycoverflow/FancyCoverFlowItemWrapper;->b:Landroid/graphics/Bitmap;

    invoke-virtual {p0}, Lcom/moji/fancycoverflow/FancyCoverFlowItemWrapper;->getWidth()I

    move-result v3

    invoke-virtual {v0}, Landroid/view/View;->getWidth()I

    move-result v0

    sub-int/2addr v3, v0

    div-int/lit8 v3, v3, 0x2

    int-to-float v0, v3

    const/4 v3, 0x0

    const/4 v4, 0x0

    invoke-virtual {p1, v2, v0, v3, v4}, Landroid/graphics/Canvas;->drawBitmap(Landroid/graphics/Bitmap;FFLandroid/graphics/Paint;)V

    .line 138
    :cond_0
    monitor-exit v1

    goto :goto_0

    :catchall_0
    move-exception p1

    monitor-exit v1
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw p1

    .line 140
    :cond_1
    :goto_0
    invoke-super {p0, p1}, Landroid/view/ViewGroup;->dispatchDraw(Landroid/graphics/Canvas;)V

    return-void
.end method

.method protected onLayout(ZIIII)V
    .locals 0
    .annotation build Landroid/annotation/SuppressLint;
        value = {
            "DrawAllocation"
        }
    .end annotation

    if-eqz p1, :cond_2

    .line 104
    invoke-virtual {p0}, Lcom/moji/fancycoverflow/FancyCoverFlowItemWrapper;->getMeasuredWidth()I

    move-result p1

    .line 105
    invoke-virtual {p0}, Lcom/moji/fancycoverflow/FancyCoverFlowItemWrapper;->getMeasuredHeight()I

    move-result p2

    .line 108
    :try_start_0
    sget-object p3, Lcom/moji/fancycoverflow/FancyCoverFlowItemWrapper;->a:Ljava/lang/Object;

    monitor-enter p3
    :try_end_0
    .catch Ljava/lang/Throwable; {:try_start_0 .. :try_end_0} :catch_0

    .line 109
    :try_start_1
    iget-object p4, p0, Lcom/moji/fancycoverflow/FancyCoverFlowItemWrapper;->b:Landroid/graphics/Bitmap;

    if-eqz p4, :cond_0

    iget-object p4, p0, Lcom/moji/fancycoverflow/FancyCoverFlowItemWrapper;->b:Landroid/graphics/Bitmap;

    invoke-virtual {p4}, Landroid/graphics/Bitmap;->isRecycled()Z

    move-result p4

    if-nez p4, :cond_0

    iget-object p4, p0, Lcom/moji/fancycoverflow/FancyCoverFlowItemWrapper;->b:Landroid/graphics/Bitmap;

    invoke-virtual {p4}, Landroid/graphics/Bitmap;->getWidth()I

    move-result p4

    if-ne p4, p1, :cond_0

    iget-object p4, p0, Lcom/moji/fancycoverflow/FancyCoverFlowItemWrapper;->b:Landroid/graphics/Bitmap;

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

    move-result p4

    if-eq p4, p2, :cond_1

    .line 110
    :cond_0
    iget-object p4, p0, Lcom/moji/fancycoverflow/FancyCoverFlowItemWrapper;->b:Landroid/graphics/Bitmap;

    invoke-static {p4}, Lcom/moji/tool/BitmapTool;->a(Landroid/graphics/Bitmap;)Z

    .line 111
    sget-object p4, Landroid/graphics/Bitmap$Config;->ARGB_4444:Landroid/graphics/Bitmap$Config;

    invoke-static {p1, p2, p4}, Landroid/graphics/Bitmap;->createBitmap(IILandroid/graphics/Bitmap$Config;)Landroid/graphics/Bitmap;

    move-result-object p2

    iput-object p2, p0, Lcom/moji/fancycoverflow/FancyCoverFlowItemWrapper;->b:Landroid/graphics/Bitmap;

    .line 112
    new-instance p2, Landroid/graphics/Canvas;

    iget-object p4, p0, Lcom/moji/fancycoverflow/FancyCoverFlowItemWrapper;->b:Landroid/graphics/Bitmap;

    invoke-direct {p2, p4}, Landroid/graphics/Canvas;-><init>(Landroid/graphics/Bitmap;)V

    iput-object p2, p0, Lcom/moji/fancycoverflow/FancyCoverFlowItemWrapper;->c:Landroid/graphics/Canvas;

    .line 114
    :cond_1
    monitor-exit p3

    goto :goto_0

    :catchall_0
    move-exception p2

    monitor-exit p3
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    :try_start_2
    throw p2
    :try_end_2
    .catch Ljava/lang/Throwable; {:try_start_2 .. :try_end_2} :catch_0

    :catch_0
    move-exception p2

    const-string p3, "FancyCoverFlowItemWrapper"

    .line 116
    invoke-static {p3, p2}, Lcom/moji/tool/log/MJLogger;->a(Ljava/lang/String;Ljava/lang/Throwable;)V

    :goto_0
    const/4 p2, 0x0

    .line 119
    invoke-virtual {p0, p2}, Lcom/moji/fancycoverflow/FancyCoverFlowItemWrapper;->getChildAt(I)Landroid/view/View;

    move-result-object p3

    .line 120
    invoke-virtual {p3}, Landroid/view/View;->getMeasuredWidth()I

    move-result p4

    .line 121
    invoke-virtual {p3}, Landroid/view/View;->getMeasuredHeight()I

    move-result p5

    sub-int p4, p1, p4

    .line 122
    div-int/lit8 p4, p4, 0x2

    sub-int/2addr p1, p4

    .line 124
    invoke-virtual {p3, p4, p2, p1, p5}, Landroid/view/View;->layout(IIII)V

    :cond_2
    return-void
.end method

.method protected onMeasure(II)V
    .locals 0

    .line 96
    invoke-super {p0, p1, p2}, Landroid/view/ViewGroup;->onMeasure(II)V

    .line 97
    invoke-direct {p0}, Lcom/moji/fancycoverflow/FancyCoverFlowItemWrapper;->b()V

    return-void
.end method
