.class public Lcom/scaleasw/powercalc/ConstantAdapter;
.super Landroid/widget/BaseAdapter;
.source "ConstantAdapter.java"


# static fields
.field private static inflater:Landroid/view/LayoutInflater;


# instance fields
.field private activity:Landroid/app/Activity;

.field private data:Ljava/util/ArrayList;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/ArrayList",
            "<",
            "Lcom/scaleasw/powercalc/ConstantItem;",
            ">;"
        }
    .end annotation
.end field


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

    .prologue
    .line 18
    const/4 v0, 0x0

    sput-object v0, Lcom/scaleasw/powercalc/ConstantAdapter;->inflater:Landroid/view/LayoutInflater;

    return-void
.end method

.method public constructor <init>(Landroid/app/Activity;Ljava/util/ArrayList;)V
    .locals 2
    .param p1, "a"    # Landroid/app/Activity;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Landroid/app/Activity;",
            "Ljava/util/ArrayList",
            "<",
            "Lcom/scaleasw/powercalc/ConstantItem;",
            ">;)V"
        }
    .end annotation

    .prologue
    .line 20
    .local p2, "d":Ljava/util/ArrayList;, "Ljava/util/ArrayList<Lcom/scaleasw/powercalc/ConstantItem;>;"
    invoke-direct {p0}, Landroid/widget/BaseAdapter;-><init>()V

    .line 21
    iput-object p1, p0, Lcom/scaleasw/powercalc/ConstantAdapter;->activity:Landroid/app/Activity;

    .line 22
    iput-object p2, p0, Lcom/scaleasw/powercalc/ConstantAdapter;->data:Ljava/util/ArrayList;

    .line 23
    iget-object v0, p0, Lcom/scaleasw/powercalc/ConstantAdapter;->activity:Landroid/app/Activity;

    const-string v1, "layout_inflater"

    invoke-virtual {v0, v1}, Landroid/app/Activity;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/view/LayoutInflater;

    sput-object v0, Lcom/scaleasw/powercalc/ConstantAdapter;->inflater:Landroid/view/LayoutInflater;

    .line 24
    return-void
.end method


# virtual methods
.method public getCount()I
    .locals 1

    .prologue
    .line 27
    iget-object v0, p0, Lcom/scaleasw/powercalc/ConstantAdapter;->data:Ljava/util/ArrayList;

    invoke-virtual {v0}, Ljava/util/ArrayList;->size()I

    move-result v0

    return v0
.end method

.method public getItem(I)Ljava/lang/Object;
    .locals 2
    .param p1, "position"    # I

    .prologue
    .line 31
    iget-object v1, p0, Lcom/scaleasw/powercalc/ConstantAdapter;->data:Ljava/util/ArrayList;

    invoke-virtual {v1, p1}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/scaleasw/powercalc/ConstantItem;

    .line 32
    .local v0, "item":Lcom/scaleasw/powercalc/ConstantItem;
    return-object v0
.end method

.method public getItemId(I)J
    .locals 2
    .param p1, "position"    # I

    .prologue
    .line 36
    int-to-long v0, p1

    return-wide v0
.end method

.method public getView(ILandroid/view/View;Landroid/view/ViewGroup;)Landroid/view/View;
    .locals 8
    .param p1, "position"    # I
    .param p2, "convertView"    # Landroid/view/View;
    .param p3, "parent"    # Landroid/view/ViewGroup;

    .prologue
    const/4 v7, 0x0

    .line 40
    move-object v4, p2

    .line 41
    .local v4, "vi":Landroid/view/View;
    iget-object v5, p0, Lcom/scaleasw/powercalc/ConstantAdapter;->data:Ljava/util/ArrayList;

    invoke-virtual {v5, p1}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/scaleasw/powercalc/ConstantItem;

    .line 43
    .local v0, "constant":Lcom/scaleasw/powercalc/ConstantItem;
    iget-object v5, v0, Lcom/scaleasw/powercalc/ConstantItem;->type:Lcom/scaleasw/powercalc/ConstantItem$ConstantType;

    sget-object v6, Lcom/scaleasw/powercalc/ConstantItem$ConstantType;->ITEM:Lcom/scaleasw/powercalc/ConstantItem$ConstantType;

    if-ne v5, v6, :cond_2

    .line 44
    if-nez p2, :cond_0

    sget-object v5, Lcom/scaleasw/powercalc/ConstantAdapter;->inflater:Landroid/view/LayoutInflater;

    const v6, 0x7f030003

    invoke-virtual {v5, v6, v7}, Landroid/view/LayoutInflater;->inflate(ILandroid/view/ViewGroup;)Landroid/view/View;

    move-result-object v4

    .line 50
    :cond_0
    :goto_0
    const v5, 0x7f0b000d

    invoke-virtual {v4, v5}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v1

    check-cast v1, Landroid/widget/TextView;

    .line 51
    .local v1, "symbol":Landroid/widget/TextView;
    const v5, 0x7f0b000e

    invoke-virtual {v4, v5}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v2

    check-cast v2, Landroid/widget/TextView;

    .line 52
    .local v2, "title":Landroid/widget/TextView;
    const v5, 0x7f0b000f

    invoke-virtual {v4, v5}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v3

    check-cast v3, Landroid/widget/TextView;

    .line 56
    .local v3, "value":Landroid/widget/TextView;
    iget-object v5, v0, Lcom/scaleasw/powercalc/ConstantItem;->type:Lcom/scaleasw/powercalc/ConstantItem$ConstantType;

    sget-object v6, Lcom/scaleasw/powercalc/ConstantItem$ConstantType;->CONSTANT:Lcom/scaleasw/powercalc/ConstantItem$ConstantType;

    if-ne v5, v6, :cond_1

    .line 57
    iget-object v5, v0, Lcom/scaleasw/powercalc/ConstantItem;->symbol:Ljava/lang/String;

    invoke-static {v5}, Landroid/text/Html;->fromHtml(Ljava/lang/String;)Landroid/text/Spanned;

    move-result-object v5

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

    .line 58
    new-instance v5, Ljava/lang/StringBuilder;

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

    iget-object v6, v0, Lcom/scaleasw/powercalc/ConstantItem;->displayValue:Ljava/lang/String;

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

    move-result-object v5

    const-string v6, " "

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

    move-result-object v5

    iget-object v6, v0, Lcom/scaleasw/powercalc/ConstantItem;->unit:Ljava/lang/String;

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

    move-result-object v5

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

    move-result-object v5

    invoke-static {v5}, Landroid/text/Html;->fromHtml(Ljava/lang/String;)Landroid/text/Spanned;

    move-result-object v5

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

    .line 61
    :cond_1
    iget-object v5, v0, Lcom/scaleasw/powercalc/ConstantItem;->title:Ljava/lang/String;

    invoke-static {v5}, Landroid/text/Html;->fromHtml(Ljava/lang/String;)Landroid/text/Spanned;

    move-result-object v5

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

    .line 63
    return-object v4

    .line 47
    .end local v1    # "symbol":Landroid/widget/TextView;
    .end local v2    # "title":Landroid/widget/TextView;
    .end local v3    # "value":Landroid/widget/TextView;
    :cond_2
    if-nez p2, :cond_0

    sget-object v5, Lcom/scaleasw/powercalc/ConstantAdapter;->inflater:Landroid/view/LayoutInflater;

    const v6, 0x7f030002

    invoke-virtual {v5, v6, v7}, Landroid/view/LayoutInflater;->inflate(ILandroid/view/ViewGroup;)Landroid/view/View;

    move-result-object v4

    goto :goto_0
.end method
