ChestRewardQueue.smali

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


# instance fields
.field private final chestRewardQueues:Ljava/util/Queue;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/Queue<",
            "Lcom/sandboxol/halloween/widget/ChestRewardView;",
            ">;"
        }
    .end annotation
.end field

.field private rewards:Ljava/util/List;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/List<",
            "Lcom/sandboxol/halloween/entity/Reward;",
            ">;"
        }
    .end annotation
.end field

.field private startPosition:I


# 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/ChestRewardQueue;-><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/ChestRewardQueue;-><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_queue:I

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

    .line 5
    new-instance p1, Ljava/util/LinkedList;

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

    iput-object p1, p0, Lcom/sandboxol/halloween/widget/ChestRewardQueue;->chestRewardQueues:Ljava/util/Queue;

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

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

    move-result-object p1

    check-cast p1, Lcom/sandboxol/halloween/widget/ChestRewardView;

    invoke-virtual {p0, p1}, Lcom/sandboxol/halloween/widget/ChestRewardQueue;->recycleRewardView(Lcom/sandboxol/halloween/widget/ChestRewardView;)V

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

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

    move-result-object p1

    check-cast p1, Lcom/sandboxol/halloween/widget/ChestRewardView;

    invoke-virtual {p0, p1}, Lcom/sandboxol/halloween/widget/ChestRewardQueue;->recycleRewardView(Lcom/sandboxol/halloween/widget/ChestRewardView;)V

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

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

    move-result-object p1

    check-cast p1, Lcom/sandboxol/halloween/widget/ChestRewardView;

    invoke-virtual {p0, p1}, Lcom/sandboxol/halloween/widget/ChestRewardQueue;->recycleRewardView(Lcom/sandboxol/halloween/widget/ChestRewardView;)V

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

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

    move-result-object p1

    check-cast p1, Lcom/sandboxol/halloween/widget/ChestRewardView;

    invoke-virtual {p0, p1}, Lcom/sandboxol/halloween/widget/ChestRewardQueue;->recycleRewardView(Lcom/sandboxol/halloween/widget/ChestRewardView;)V

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

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

    move-result-object p1

    check-cast p1, Lcom/sandboxol/halloween/widget/ChestRewardView;

    invoke-virtual {p0, p1}, Lcom/sandboxol/halloween/widget/ChestRewardQueue;->recycleRewardView(Lcom/sandboxol/halloween/widget/ChestRewardView;)V

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

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

    move-result-object p1

    check-cast p1, Lcom/sandboxol/halloween/widget/ChestRewardView;

    invoke-virtual {p0, p1}, Lcom/sandboxol/halloween/widget/ChestRewardQueue;->recycleRewardView(Lcom/sandboxol/halloween/widget/ChestRewardView;)V

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

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

    move-result-object p1

    check-cast p1, Lcom/sandboxol/halloween/widget/ChestRewardView;

    invoke-virtual {p0, p1}, Lcom/sandboxol/halloween/widget/ChestRewardQueue;->recycleRewardView(Lcom/sandboxol/halloween/widget/ChestRewardView;)V

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

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

    move-result-object p1

    check-cast p1, Lcom/sandboxol/halloween/widget/ChestRewardView;

    invoke-virtual {p0, p1}, Lcom/sandboxol/halloween/widget/ChestRewardQueue;->recycleRewardView(Lcom/sandboxol/halloween/widget/ChestRewardView;)V

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

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

    move-result-object p1

    check-cast p1, Lcom/sandboxol/halloween/widget/ChestRewardView;

    invoke-virtual {p0, p1}, Lcom/sandboxol/halloween/widget/ChestRewardQueue;->recycleRewardView(Lcom/sandboxol/halloween/widget/ChestRewardView;)V

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

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

    move-result-object p1

    check-cast p1, Lcom/sandboxol/halloween/widget/ChestRewardView;

    invoke-virtual {p0, p1}, Lcom/sandboxol/halloween/widget/ChestRewardQueue;->recycleRewardView(Lcom/sandboxol/halloween/widget/ChestRewardView;)V

    return-void
.end method


# virtual methods
.method public getNextRewardView()Lcom/sandboxol/halloween/widget/ChestRewardView;
    .registers 4

    .line 1
    iget-object v0, p0, Lcom/sandboxol/halloween/widget/ChestRewardQueue;->chestRewardQueues:Ljava/util/Queue;

    invoke-interface {v0}, Ljava/util/Queue;->size()I

    move-result v0

    const/4 v1, 0x0

    if-nez v0, :cond_a

    return-object v1

    .line 2
    :cond_a
    iget v0, p0, Lcom/sandboxol/halloween/widget/ChestRewardQueue;->startPosition:I

    if-ltz v0, :cond_4e

    iget-object v0, p0, Lcom/sandboxol/halloween/widget/ChestRewardQueue;->rewards:Ljava/util/List;

    invoke-interface {v0}, Ljava/util/List;->size()I

    move-result v0

    if-eqz v0, :cond_4e

    iget v0, p0, Lcom/sandboxol/halloween/widget/ChestRewardQueue;->startPosition:I

    iget-object v2, p0, Lcom/sandboxol/halloween/widget/ChestRewardQueue;->rewards:Ljava/util/List;

    invoke-interface {v2}, Ljava/util/List;->size()I

    move-result v2

    if-le v0, v2, :cond_21

    goto :goto_4e

    .line 3
    :cond_21
    iget v0, p0, Lcom/sandboxol/halloween/widget/ChestRewardQueue;->startPosition:I

    iget-object v2, p0, Lcom/sandboxol/halloween/widget/ChestRewardQueue;->rewards:Ljava/util/List;

    invoke-interface {v2}, Ljava/util/List;->size()I

    move-result v2

    if-ne v0, v2, :cond_2c

    return-object v1

    .line 4
    :cond_2c
    iget-object v0, p0, Lcom/sandboxol/halloween/widget/ChestRewardQueue;->chestRewardQueues:Ljava/util/Queue;

    invoke-interface {v0}, Ljava/util/Queue;->poll()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/sandboxol/halloween/widget/ChestRewardView;

    if-eqz v0, :cond_47

    .line 5
    iget-object v1, p0, Lcom/sandboxol/halloween/widget/ChestRewardQueue;->rewards:Ljava/util/List;

    iget v2, p0, Lcom/sandboxol/halloween/widget/ChestRewardQueue;->startPosition:I

    invoke-interface {v1, v2}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Lcom/sandboxol/halloween/entity/Reward;

    invoke-virtual {v0, v1}, Lcom/sandboxol/halloween/widget/ChestRewardView;->configReward(Lcom/sandboxol/halloween/entity/Reward;)V

    const/4 v1, 0x0

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

    .line 7
    :cond_47
    iget v1, p0, Lcom/sandboxol/halloween/widget/ChestRewardQueue;->startPosition:I

    add-int/lit8 v1, v1, 0x1

    iput v1, p0, Lcom/sandboxol/halloween/widget/ChestRewardQueue;->startPosition:I

    return-object v0

    :cond_4e
    :goto_4e
    return-object v1
.end method

.method public recycleRewardView(Lcom/sandboxol/halloween/widget/ChestRewardView;)V
    .registers 3

    .line 1
    iget-object v0, p0, Lcom/sandboxol/halloween/widget/ChestRewardQueue;->chestRewardQueues:Ljava/util/Queue;

    invoke-interface {v0, p1}, Ljava/util/Queue;->contains(Ljava/lang/Object;)Z

    move-result v0

    if-nez v0, :cond_12

    const/16 v0, 0x8

    .line 2
    invoke-virtual {p1, v0}, Landroid/widget/FrameLayout;->setVisibility(I)V

    .line 3
    iget-object v0, p0, Lcom/sandboxol/halloween/widget/ChestRewardQueue;->chestRewardQueues:Ljava/util/Queue;

    invoke-interface {v0, p1}, Ljava/util/Queue;->offer(Ljava/lang/Object;)Z

    :cond_12
    return-void
.end method

.method public setRewards(Ljava/util/List;I)V
    .registers 3
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/util/List<",
            "Lcom/sandboxol/halloween/entity/Reward;",
            ">;I)V"
        }
    .end annotation

    .line 1
    iput-object p1, p0, Lcom/sandboxol/halloween/widget/ChestRewardQueue;->rewards:Ljava/util/List;

    .line 2
    invoke-interface {p1}, Ljava/util/List;->size()I

    move-result p1

    sub-int/2addr p1, p2

    iput p1, p0, Lcom/sandboxol/halloween/widget/ChestRewardQueue;->startPosition:I

    return-void
.end method