ChestRewardView.smali

.class public Lcom/sandboxol/halloween/widget/ChestRewardView;
.super Landroid/widget/FrameLayout;
.source "ChestRewardView.java"


# instance fields
.field private final pic0:Landroid/widget/ImageView;

.field private reward:Lcom/sandboxol/halloween/entity/Reward;

.field private final tv0:Landroid/widget/TextView;


# direct methods
.method public constructor <init>(Landroid/content/Context;)V
    .registers 3

    const/4 v0, 0x0

    .line 1
    invoke-direct {p0, p1, v0}, Lcom/sandboxol/halloween/widget/ChestRewardView;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;)V

    return-void
.end method

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

    const/4 v0, 0x0

    .line 2
    invoke-direct {p0, p1, p2, v0}, Lcom/sandboxol/halloween/widget/ChestRewardView;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V

    return-void
.end method

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

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

    .line 4
    sget p2, Lcom/sandboxol/halloween/R$layout;->event_chest_reward_view:I

    invoke-static {p1, p2, p0}, Landroid/widget/FrameLayout;->inflate(Landroid/content/Context;ILandroid/view/ViewGroup;)Landroid/view/View;

    .line 5
    sget p1, Lcom/sandboxol/halloween/R$id;->iv_open_0:I

    invoke-virtual {p0, p1}, Landroid/widget/FrameLayout;->findViewById(I)Landroid/view/View;

    move-result-object p1

    check-cast p1, Landroid/widget/ImageView;

    iput-object p1, p0, Lcom/sandboxol/halloween/widget/ChestRewardView;->pic0:Landroid/widget/ImageView;

    .line 6
    sget p1, Lcom/sandboxol/halloween/R$id;->tv_num_0:I

    invoke-virtual {p0, p1}, Landroid/widget/FrameLayout;->findViewById(I)Landroid/view/View;

    move-result-object p1

    check-cast p1, Landroid/widget/TextView;

    iput-object p1, p0, Lcom/sandboxol/halloween/widget/ChestRewardView;->tv0:Landroid/widget/TextView;

    return-void
.end method

.method private configReward(Landroid/widget/ImageView;Landroid/widget/TextView;Lcom/sandboxol/halloween/entity/Reward;)V
    .registers 16
    .annotation build Landroid/annotation/SuppressLint;
        value = {
            "SetTextI18n"
        }
    .end annotation

    .line 3
    invoke-virtual {p3}, Lcom/sandboxol/halloween/entity/Reward;->getRewardIcon()Ljava/lang/String;

    move-result-object v2

    const/4 v1, 0x0

    const/4 v3, 0x0

    const/4 v4, 0x0

    const/4 v5, 0x0

    const/4 v6, 0x0

    const/4 v7, 0x0

    const/4 v8, 0x0

    const/4 v9, 0x0

    const/4 v10, 0x0

    const/4 v11, 0x0

    move-object v0, p1

    invoke-static/range {v0 .. v11}, Lcom/sandboxol/common/binding/adapter/ImageViewBindingAdapters;->loadImage(Landroid/widget/ImageView;ILjava/lang/String;IIZZZZFZLcom/sandboxol/common/command/ReplyCommand;)V

    .line 4
    invoke-virtual {p3}, Lcom/sandboxol/halloween/entity/Reward;->getQuality()I

    move-result v0

    invoke-direct {p0, v0}, Lcom/sandboxol/halloween/widget/ChestRewardView;->getRewardBg(I)Landroid/graphics/drawable/Drawable;

    move-result-object v0

    invoke-virtual {p1, v0}, Landroid/widget/ImageView;->setBackground(Landroid/graphics/drawable/Drawable;)V

    .line 5
    invoke-virtual {p3}, Lcom/sandboxol/halloween/entity/Reward;->getAmount()I

    move-result p1

    const/4 v0, 0x0

    if-lez p1, :cond_40

    .line 6
    invoke-virtual {p2, v0}, Landroid/widget/TextView;->setVisibility(I)V

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

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

    const-string v0, "x"

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

    invoke-virtual {p3}, Lcom/sandboxol/halloween/entity/Reward;->getAmount()I

    move-result p3

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

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

    move-result-object p1

    invoke-virtual {p2, p1}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    goto :goto_5a

    .line 8
    :cond_40
    invoke-virtual {p3}, Lcom/sandboxol/halloween/entity/Reward;->getRewardName()Ljava/lang/String;

    move-result-object p1

    invoke-static {p1}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z

    move-result p1

    if-eqz p1, :cond_50

    const/16 p1, 0x8

    .line 9
    invoke-virtual {p2, p1}, Landroid/widget/TextView;->setVisibility(I)V

    goto :goto_5a

    .line 10
    :cond_50
    invoke-virtual {p2, v0}, Landroid/widget/TextView;->setVisibility(I)V

    .line 11
    invoke-virtual {p3}, Lcom/sandboxol/halloween/entity/Reward;->getRewardName()Ljava/lang/String;

    move-result-object p1

    invoke-virtual {p2, p1}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    :goto_5a
    return-void
.end method

.method private getRewardBg(I)Landroid/graphics/drawable/Drawable;
    .registers 3

    const/4 v0, 0x2

    if-eq p1, v0, :cond_1c

    const/4 v0, 0x3

    if-eq p1, v0, :cond_11

    .line 1
    invoke-static {}, Lcom/sandboxol/common/base/app/BaseApplication;->getContext()Landroid/content/Context;

    move-result-object p1

    sget v0, Lcom/sandboxol/halloween/R$mipmap;->event_chest_bg_open_0:I

    invoke-static {p1, v0}, Landroidx/core/content/b;->c(Landroid/content/Context;I)Landroid/graphics/drawable/Drawable;

    move-result-object p1

    return-object p1

    .line 2
    :cond_11
    invoke-static {}, Lcom/sandboxol/common/base/app/BaseApplication;->getContext()Landroid/content/Context;

    move-result-object p1

    sget v0, Lcom/sandboxol/halloween/R$mipmap;->event_chest_bg_open_2:I

    invoke-static {p1, v0}, Landroidx/core/content/b;->c(Landroid/content/Context;I)Landroid/graphics/drawable/Drawable;

    move-result-object p1

    return-object p1

    .line 3
    :cond_1c
    invoke-static {}, Lcom/sandboxol/common/base/app/BaseApplication;->getContext()Landroid/content/Context;

    move-result-object p1

    sget v0, Lcom/sandboxol/halloween/R$mipmap;->event_chest_bg_open_1:I

    invoke-static {p1, v0}, Landroidx/core/content/b;->c(Landroid/content/Context;I)Landroid/graphics/drawable/Drawable;

    move-result-object p1

    return-object p1
.end method


# virtual methods
.method public configReward(Lcom/sandboxol/halloween/entity/Reward;)V
    .registers 4

    if-nez p1, :cond_3

    return-void

    .line 1
    :cond_3
    iput-object p1, p0, Lcom/sandboxol/halloween/widget/ChestRewardView;->reward:Lcom/sandboxol/halloween/entity/Reward;

    .line 2
    iget-object v0, p0, Lcom/sandboxol/halloween/widget/ChestRewardView;->pic0:Landroid/widget/ImageView;

    iget-object v1, p0, Lcom/sandboxol/halloween/widget/ChestRewardView;->tv0:Landroid/widget/TextView;

    invoke-direct {p0, v0, v1, p1}, Lcom/sandboxol/halloween/widget/ChestRewardView;->configReward(Landroid/widget/ImageView;Landroid/widget/TextView;Lcom/sandboxol/halloween/entity/Reward;)V

    return-void
.end method

.method public getReward()Lcom/sandboxol/halloween/entity/Reward;
    .registers 2

    .line 1
    iget-object v0, p0, Lcom/sandboxol/halloween/widget/ChestRewardView;->reward:Lcom/sandboxol/halloween/entity/Reward;

    return-object v0
.end method