.class public Lcom/moji/mjallergy/viewcontrol/AllergyPieForcastView;
.super Lcom/moji/viewcontrol/MJViewControl;
.source "AllergyPieForcastView.java"

# interfaces
.implements Landroid/view/View$OnClickListener;


# annotations
.annotation system Ldalvik/annotation/Signature;
    value = {
        "Lcom/moji/viewcontrol/MJViewControl<",
        "Lcom/moji/http/allergy/bean/AllergyMainBean;",
        ">;",
        "Landroid/view/View$OnClickListener;"
    }
.end annotation


# instance fields
.field private a:[F

.field private b:[I

.field private c:[I

.field private d:Landroid/widget/TextView;

.field private e:Landroid/widget/TextView;

.field private f:Landroid/widget/TextView;

.field private g:Landroid/widget/TextView;

.field private h:Lcom/moji/mjallergy/view/JerryChartView;

.field private i:Landroid/widget/TextView;


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

    .line 44
    invoke-direct {p0, p1}, Lcom/moji/viewcontrol/MJViewControl;-><init>(Landroid/content/Context;)V

    const/4 p1, 0x4

    .line 32
    new-array v0, p1, [F

    iput-object v0, p0, Lcom/moji/mjallergy/viewcontrol/AllergyPieForcastView;->a:[F

    .line 33
    new-array v0, p1, [I

    iput-object v0, p0, Lcom/moji/mjallergy/viewcontrol/AllergyPieForcastView;->b:[I

    .line 34
    new-array p1, p1, [I

    const-string v0, "#7AC558"

    invoke-static {v0}, Landroid/graphics/Color;->parseColor(Ljava/lang/String;)I

    move-result v0

    const/4 v1, 0x0

    aput v0, p1, v1

    const-string v0, "#FFAA1C"

    invoke-static {v0}, Landroid/graphics/Color;->parseColor(Ljava/lang/String;)I

    move-result v0

    const/4 v1, 0x1

    aput v0, p1, v1

    const-string v0, "#FE8729"

    .line 35
    invoke-static {v0}, Landroid/graphics/Color;->parseColor(Ljava/lang/String;)I

    move-result v0

    const/4 v1, 0x2

    aput v0, p1, v1

    const-string v0, "#FE6554"

    invoke-static {v0}, Landroid/graphics/Color;->parseColor(Ljava/lang/String;)I

    move-result v0

    const/4 v1, 0x3

    aput v0, p1, v1

    iput-object p1, p0, Lcom/moji/mjallergy/viewcontrol/AllergyPieForcastView;->c:[I

    return-void
.end method


# virtual methods
.method protected a(Lcom/moji/http/allergy/bean/AllergyMainBean;)V
    .locals 8
    .annotation build Landroid/annotation/SuppressLint;
        value = {
            "DefaultLocale"
        }
    .end annotation

    .line 67
    iget-object p1, p1, Lcom/moji/http/allergy/bean/AllergyMainBean;->mIncidentPercent:Ljava/util/List;

    .line 68
    invoke-static {}, Ljava/text/NumberFormat;->getNumberInstance()Ljava/text/NumberFormat;

    move-result-object v0

    const/4 v1, 0x2

    .line 69
    invoke-virtual {v0, v1}, Ljava/text/NumberFormat;->setMaximumFractionDigits(I)V

    const/4 v2, 0x0

    const/4 v3, 0x0

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

    move-result v4

    if-ge v3, v4, :cond_0

    .line 71
    invoke-interface {p1, v3}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v4

    check-cast v4, Lcom/moji/http/allergy/bean/AllergyMainBean$IncidentPercent;

    .line 72
    iget-object v5, p0, Lcom/moji/mjallergy/viewcontrol/AllergyPieForcastView;->a:[F

    iget v6, v4, Lcom/moji/http/allergy/bean/AllergyMainBean$IncidentPercent;->percent:F

    float-to-double v6, v6

    invoke-virtual {v0, v6, v7}, Ljava/text/NumberFormat;->format(D)Ljava/lang/String;

    move-result-object v6

    invoke-static {v6}, Ljava/lang/Float;->valueOf(Ljava/lang/String;)Ljava/lang/Float;

    move-result-object v6

    invoke-virtual {v6}, Ljava/lang/Float;->floatValue()F

    move-result v6

    aput v6, v5, v3

    .line 73
    iget-object v5, p0, Lcom/moji/mjallergy/viewcontrol/AllergyPieForcastView;->b:[I

    iget v4, v4, Lcom/moji/http/allergy/bean/AllergyMainBean$IncidentPercent;->percent:F

    const/high16 v6, 0x42c80000    # 100.0f

    mul-float v4, v4, v6

    float-to-int v4, v4

    aput v4, v5, v3

    add-int/lit8 v3, v3, 0x1

    goto :goto_0

    .line 75
    :cond_0
    iget-object p1, p0, Lcom/moji/mjallergy/viewcontrol/AllergyPieForcastView;->a:[F

    const/high16 v0, 0x3f800000    # 1.0f

    iget-object v3, p0, Lcom/moji/mjallergy/viewcontrol/AllergyPieForcastView;->a:[F

    aget v3, v3, v2

    sub-float/2addr v0, v3

    iget-object v3, p0, Lcom/moji/mjallergy/viewcontrol/AllergyPieForcastView;->a:[F

    const/4 v4, 0x1

    aget v3, v3, v4

    sub-float/2addr v0, v3

    iget-object v3, p0, Lcom/moji/mjallergy/viewcontrol/AllergyPieForcastView;->a:[F

    aget v3, v3, v1

    sub-float/2addr v0, v3

    const/4 v3, 0x3

    aput v0, p1, v3

    .line 76
    iget-object p1, p0, Lcom/moji/mjallergy/viewcontrol/AllergyPieForcastView;->b:[I

    iget-object v0, p0, Lcom/moji/mjallergy/viewcontrol/AllergyPieForcastView;->b:[I

    aget v0, v0, v2

    rsub-int/lit8 v0, v0, 0x64

    iget-object v5, p0, Lcom/moji/mjallergy/viewcontrol/AllergyPieForcastView;->b:[I

    aget v5, v5, v4

    sub-int/2addr v0, v5

    iget-object v5, p0, Lcom/moji/mjallergy/viewcontrol/AllergyPieForcastView;->b:[I

    aget v5, v5, v1

    sub-int/2addr v0, v5

    aput v0, p1, v3

    .line 78
    new-instance p1, Ljava/util/ArrayList;

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

    .line 80
    new-instance v0, Lcom/moji/mjallergy/view/ChartData;

    iget-object v5, p0, Lcom/moji/mjallergy/viewcontrol/AllergyPieForcastView;->c:[I

    aget v5, v5, v2

    iget-object v6, p0, Lcom/moji/mjallergy/viewcontrol/AllergyPieForcastView;->a:[F

    aget v6, v6, v2

    invoke-direct {v0, v5, v6, v2, v2}, Lcom/moji/mjallergy/view/ChartData;-><init>(IFIZ)V

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

    .line 81
    new-instance v0, Lcom/moji/mjallergy/view/ChartData;

    iget-object v5, p0, Lcom/moji/mjallergy/viewcontrol/AllergyPieForcastView;->c:[I

    aget v5, v5, v4

    iget-object v6, p0, Lcom/moji/mjallergy/viewcontrol/AllergyPieForcastView;->a:[F

    aget v6, v6, v4

    invoke-direct {v0, v5, v6, v2, v2}, Lcom/moji/mjallergy/view/ChartData;-><init>(IFIZ)V

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

    .line 82
    new-instance v0, Lcom/moji/mjallergy/view/ChartData;

    iget-object v5, p0, Lcom/moji/mjallergy/viewcontrol/AllergyPieForcastView;->c:[I

    aget v5, v5, v1

    iget-object v6, p0, Lcom/moji/mjallergy/viewcontrol/AllergyPieForcastView;->a:[F

    aget v6, v6, v1

    invoke-direct {v0, v5, v6, v2, v2}, Lcom/moji/mjallergy/view/ChartData;-><init>(IFIZ)V

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

    .line 83
    new-instance v0, Lcom/moji/mjallergy/view/ChartData;

    iget-object v5, p0, Lcom/moji/mjallergy/viewcontrol/AllergyPieForcastView;->c:[I

    aget v5, v5, v3

    iget-object v6, p0, Lcom/moji/mjallergy/viewcontrol/AllergyPieForcastView;->a:[F

    aget v6, v6, v3

    invoke-direct {v0, v5, v6, v2, v2}, Lcom/moji/mjallergy/view/ChartData;-><init>(IFIZ)V

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

    .line 85
    iget-object v0, p0, Lcom/moji/mjallergy/viewcontrol/AllergyPieForcastView;->d:Landroid/widget/TextView;

    const-string v5, "%d%%"

    new-array v6, v4, [Ljava/lang/Object;

    iget-object v7, p0, Lcom/moji/mjallergy/viewcontrol/AllergyPieForcastView;->b:[I

    aget v7, v7, v2

    invoke-static {v7}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v7

    aput-object v7, v6, v2

    invoke-static {v5, v6}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v5

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

    .line 86
    iget-object v0, p0, Lcom/moji/mjallergy/viewcontrol/AllergyPieForcastView;->e:Landroid/widget/TextView;

    const-string v5, "%d%%"

    new-array v6, v4, [Ljava/lang/Object;

    iget-object v7, p0, Lcom/moji/mjallergy/viewcontrol/AllergyPieForcastView;->b:[I

    aget v7, v7, v4

    invoke-static {v7}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v7

    aput-object v7, v6, v2

    invoke-static {v5, v6}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v5

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

    .line 87
    iget-object v0, p0, Lcom/moji/mjallergy/viewcontrol/AllergyPieForcastView;->f:Landroid/widget/TextView;

    const-string v5, "%d%%"

    new-array v6, v4, [Ljava/lang/Object;

    iget-object v7, p0, Lcom/moji/mjallergy/viewcontrol/AllergyPieForcastView;->b:[I

    aget v7, v7, v1

    invoke-static {v7}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v7

    aput-object v7, v6, v2

    invoke-static {v5, v6}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v5

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

    .line 88
    iget-object v0, p0, Lcom/moji/mjallergy/viewcontrol/AllergyPieForcastView;->g:Landroid/widget/TextView;

    const-string v5, "%d%%"

    new-array v6, v4, [Ljava/lang/Object;

    iget-object v7, p0, Lcom/moji/mjallergy/viewcontrol/AllergyPieForcastView;->b:[I

    aget v3, v7, v3

    invoke-static {v3}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v3

    aput-object v3, v6, v2

    invoke-static {v5, v6}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v3

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

    .line 89
    iget-object v0, p0, Lcom/moji/mjallergy/viewcontrol/AllergyPieForcastView;->h:Lcom/moji/mjallergy/view/JerryChartView;

    invoke-virtual {v0, p1}, Lcom/moji/mjallergy/view/JerryChartView;->setData(Ljava/util/List;)V

    .line 91
    invoke-static {}, Ljava/util/Calendar;->getInstance()Ljava/util/Calendar;

    move-result-object p1

    .line 92
    invoke-virtual {p1, v1}, Ljava/util/Calendar;->get(I)I

    move-result v0

    add-int/2addr v0, v4

    const/4 v3, 0x5

    .line 93
    invoke-virtual {p1, v3}, Ljava/util/Calendar;->get(I)I

    move-result p1

    .line 94
    iget-object v3, p0, Lcom/moji/mjallergy/viewcontrol/AllergyPieForcastView;->i:Landroid/widget/TextView;

    const-string v5, "%d\u6708%d\u65e5"

    new-array v1, v1, [Ljava/lang/Object;

    invoke-static {v0}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v0

    aput-object v0, v1, v2

    invoke-static {p1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object p1

    aput-object p1, v1, v4

    invoke-static {v5, v1}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    move-result-object p1

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

    return-void
.end method

.method protected getResLayoutId()I
    .locals 1

    .line 49
    sget v0, Lpad/aqi/cnemc/com/mjallergymodule/R$layout;->view_allergy_percent_pie:I

    return v0
.end method

.method protected synthetic onBindViewData(Ljava/lang/Object;)V
    .locals 0
    .annotation build Landroid/annotation/SuppressLint;
        value = {
            "DefaultLocale"
        }
    .end annotation

    .line 31
    check-cast p1, Lcom/moji/http/allergy/bean/AllergyMainBean;

    invoke-virtual {p0, p1}, Lcom/moji/mjallergy/viewcontrol/AllergyPieForcastView;->a(Lcom/moji/http/allergy/bean/AllergyMainBean;)V

    return-void
.end method

.method public onClick(Landroid/view/View;)V
    .locals 2

    .line 99
    invoke-virtual {p1}, Landroid/view/View;->getId()I

    move-result p1

    sget v0, Lpad/aqi/cnemc/com/mjallergymodule/R$id;->feedback_allergy:I

    if-ne p1, v0, :cond_0

    .line 100
    invoke-static {}, Lcom/moji/statistics/EventManager;->a()Lcom/moji/statistics/EventManager;

    move-result-object p1

    sget-object v0, Lcom/moji/statistics/EVENT_TAG;->ALLERGY_FEEDBACK_CLICK:Lcom/moji/statistics/EVENT_TAG;

    invoke-virtual {p1, v0}, Lcom/moji/statistics/EventManager;->a(Lcom/moji/statistics/EVENT_TAG;)Lcom/moji/statistics/EventManager;

    .line 101
    new-instance p1, Landroid/content/Intent;

    invoke-virtual {p0}, Lcom/moji/mjallergy/viewcontrol/AllergyPieForcastView;->getContext()Landroid/content/Context;

    move-result-object v0

    const-class v1, Lcom/moji/mjallergy/AllergyFeedbackActivity;

    invoke-direct {p1, v0, v1}, Landroid/content/Intent;-><init>(Landroid/content/Context;Ljava/lang/Class;)V

    .line 102
    invoke-virtual {p0}, Lcom/moji/mjallergy/viewcontrol/AllergyPieForcastView;->getContext()Landroid/content/Context;

    move-result-object v0

    invoke-virtual {v0, p1}, Landroid/content/Context;->startActivity(Landroid/content/Intent;)V

    :cond_0
    return-void
.end method

.method protected onCreatedView(Landroid/view/View;)V
    .locals 1

    .line 54
    sget v0, Lpad/aqi/cnemc/com/mjallergymodule/R$id;->pie_view:I

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

    move-result-object v0

    check-cast v0, Lcom/moji/mjallergy/view/JerryChartView;

    iput-object v0, p0, Lcom/moji/mjallergy/viewcontrol/AllergyPieForcastView;->h:Lcom/moji/mjallergy/view/JerryChartView;

    .line 55
    sget v0, Lpad/aqi/cnemc/com/mjallergymodule/R$id;->pie_date:I

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

    move-result-object v0

    check-cast v0, Landroid/widget/TextView;

    iput-object v0, p0, Lcom/moji/mjallergy/viewcontrol/AllergyPieForcastView;->i:Landroid/widget/TextView;

    .line 56
    sget v0, Lpad/aqi/cnemc/com/mjallergymodule/R$id;->wu_percent:I

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

    move-result-object v0

    check-cast v0, Landroid/widget/TextView;

    iput-object v0, p0, Lcom/moji/mjallergy/viewcontrol/AllergyPieForcastView;->d:Landroid/widget/TextView;

    .line 57
    sget v0, Lpad/aqi/cnemc/com/mjallergymodule/R$id;->nanshou_light_percent:I

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

    move-result-object v0

    check-cast v0, Landroid/widget/TextView;

    iput-object v0, p0, Lcom/moji/mjallergy/viewcontrol/AllergyPieForcastView;->e:Landroid/widget/TextView;

    .line 58
    sget v0, Lpad/aqi/cnemc/com/mjallergymodule/R$id;->nanshou_percent:I

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

    move-result-object v0

    check-cast v0, Landroid/widget/TextView;

    iput-object v0, p0, Lcom/moji/mjallergy/viewcontrol/AllergyPieForcastView;->f:Landroid/widget/TextView;

    .line 59
    sget v0, Lpad/aqi/cnemc/com/mjallergymodule/R$id;->nanshou_hard_percent:I

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

    move-result-object v0

    check-cast v0, Landroid/widget/TextView;

    iput-object v0, p0, Lcom/moji/mjallergy/viewcontrol/AllergyPieForcastView;->g:Landroid/widget/TextView;

    .line 60
    sget v0, Lpad/aqi/cnemc/com/mjallergymodule/R$id;->feedback_allergy:I

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

    move-result-object p1

    check-cast p1, Landroid/widget/TextView;

    .line 61
    invoke-virtual {p1, p0}, Landroid/widget/TextView;->setOnClickListener(Landroid/view/View$OnClickListener;)V

    return-void
.end method
