CheckBoxUserCell.smali

.class public Lim/tpelyyftgw/ui/cells/CheckBoxUserCell;
.super Landroid/widget/FrameLayout;
.source "CheckBoxUserCell.java"


# instance fields
.field private avatarDrawable:Lim/tpelyyftgw/ui/components/AvatarDrawable;

.field private checkBox:Lim/tpelyyftgw/ui/components/CheckBoxSquare;

.field private currentUser:Lim/tpelyyftgw/tgnet/TLRPC$User;

.field private imageView:Lim/tpelyyftgw/ui/components/BackupImageView;

.field private needDivider:Z

.field private textView:Landroid/widget/TextView;


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

    return-void
.end method

.method public constructor <init>(Landroid/content/Context;Z)V
    .registers 15
    .param p1, "context"    # Landroid/content/Context;
    .param p2, "alert"    # Z

    .line 35
    invoke-direct {p0, p1}, Landroid/widget/FrameLayout;-><init>(Landroid/content/Context;)V

    .line 37
    new-instance v0, Landroid/widget/TextView;

    invoke-direct {v0, p1}, Landroid/widget/TextView;-><init>(Landroid/content/Context;)V

    iput-object v0, p0, Lim/tpelyyftgw/ui/cells/CheckBoxUserCell;->textView:Landroid/widget/TextView;

    .line 38
    if-eqz p2, :cond_f

    const-string v1, "dialogTextBlack"

    goto :goto_12

    :cond_f
    const-string/jumbo v1, "windowBackgroundWhiteBlackText"

    :goto_12
    invoke-static {v1}, Lim/tpelyyftgw/ui/actionbar/Theme;->getColor(Ljava/lang/String;)I

    move-result v1

    invoke-virtual {v0, v1}, Landroid/widget/TextView;->setTextColor(I)V

    .line 39
    iget-object v0, p0, Lim/tpelyyftgw/ui/cells/CheckBoxUserCell;->textView:Landroid/widget/TextView;

    const/high16 v1, 0x41600000    # 14.0f

    const/4 v2, 0x1

    invoke-virtual {v0, v2, v1}, Landroid/widget/TextView;->setTextSize(IF)V

    .line 40
    iget-object v0, p0, Lim/tpelyyftgw/ui/cells/CheckBoxUserCell;->textView:Landroid/widget/TextView;

    invoke-virtual {v0, v2}, Landroid/widget/TextView;->setLines(I)V

    .line 41
    iget-object v0, p0, Lim/tpelyyftgw/ui/cells/CheckBoxUserCell;->textView:Landroid/widget/TextView;

    invoke-virtual {v0, v2}, Landroid/widget/TextView;->setMaxLines(I)V

    .line 42
    iget-object v0, p0, Lim/tpelyyftgw/ui/cells/CheckBoxUserCell;->textView:Landroid/widget/TextView;

    invoke-virtual {v0, v2}, Landroid/widget/TextView;->setSingleLine(Z)V

    .line 43
    iget-object v0, p0, Lim/tpelyyftgw/ui/cells/CheckBoxUserCell;->textView:Landroid/widget/TextView;

    sget-object v1, Landroid/text/TextUtils$TruncateAt;->END:Landroid/text/TextUtils$TruncateAt;

    invoke-virtual {v0, v1}, Landroid/widget/TextView;->setEllipsize(Landroid/text/TextUtils$TruncateAt;)V

    .line 44
    iget-object v0, p0, Lim/tpelyyftgw/ui/cells/CheckBoxUserCell;->textView:Landroid/widget/TextView;

    sget-boolean v1, Lim/tpelyyftgw/messenger/LocaleController;->isRTL:Z

    const/4 v2, 0x5

    const/4 v3, 0x3

    if-eqz v1, :cond_41

    const/4 v1, 0x5

    goto :goto_42

    :cond_41
    const/4 v1, 0x3

    :goto_42
    or-int/lit8 v1, v1, 0x10

    invoke-virtual {v0, v1}, Landroid/widget/TextView;->setGravity(I)V

    .line 45
    iget-object v0, p0, Lim/tpelyyftgw/ui/cells/CheckBoxUserCell;->textView:Landroid/widget/TextView;

    const/high16 v4, -0x40800000    # -1.0f

    const/high16 v5, -0x40800000    # -1.0f

    sget-boolean v1, Lim/tpelyyftgw/messenger/LocaleController;->isRTL:Z

    if-eqz v1, :cond_53

    const/4 v1, 0x5

    goto :goto_54

    :cond_53
    const/4 v1, 0x3

    :goto_54
    or-int/lit8 v6, v1, 0x30

    sget-boolean v1, Lim/tpelyyftgw/messenger/LocaleController;->isRTL:Z

    const/16 v7, 0x5e

    const/16 v11, 0x15

    if-eqz v1, :cond_61

    const/16 v1, 0x15

    goto :goto_63

    :cond_61
    const/16 v1, 0x5e

    :goto_63
    int-to-float v1, v1

    const/4 v8, 0x0

    sget-boolean v9, Lim/tpelyyftgw/messenger/LocaleController;->isRTL:Z

    if-eqz v9, :cond_6a

    goto :goto_6c

    :cond_6a
    const/16 v7, 0x15

    :goto_6c
    int-to-float v9, v7

    const/4 v10, 0x0

    move v7, v1

    invoke-static/range {v4 .. v10}, Lim/tpelyyftgw/ui/components/LayoutHelper;->createFrame(FFIFFFF)Landroid/widget/FrameLayout$LayoutParams;

    move-result-object v1

    invoke-virtual {p0, v0, v1}, Lim/tpelyyftgw/ui/cells/CheckBoxUserCell;->addView(Landroid/view/View;Landroid/view/ViewGroup$LayoutParams;)V

    .line 47
    new-instance v0, Lim/tpelyyftgw/ui/components/AvatarDrawable;

    invoke-direct {v0}, Lim/tpelyyftgw/ui/components/AvatarDrawable;-><init>()V

    iput-object v0, p0, Lim/tpelyyftgw/ui/cells/CheckBoxUserCell;->avatarDrawable:Lim/tpelyyftgw/ui/components/AvatarDrawable;

    .line 48
    new-instance v0, Lim/tpelyyftgw/ui/components/BackupImageView;

    invoke-direct {v0, p1}, Lim/tpelyyftgw/ui/components/BackupImageView;-><init>(Landroid/content/Context;)V

    iput-object v0, p0, Lim/tpelyyftgw/ui/cells/CheckBoxUserCell;->imageView:Lim/tpelyyftgw/ui/components/BackupImageView;

    .line 49
    const/high16 v1, 0x42100000    # 36.0f

    invoke-static {v1}, Lim/tpelyyftgw/messenger/AndroidUtilities;->dp(F)I

    move-result v1

    invoke-virtual {v0, v1}, Lim/tpelyyftgw/ui/components/BackupImageView;->setRoundRadius(I)V

    .line 50
    iget-object v0, p0, Lim/tpelyyftgw/ui/cells/CheckBoxUserCell;->imageView:Lim/tpelyyftgw/ui/components/BackupImageView;

    const/high16 v4, 0x42100000    # 36.0f

    const/high16 v5, 0x42100000    # 36.0f

    sget-boolean v1, Lim/tpelyyftgw/messenger/LocaleController;->isRTL:Z

    if-eqz v1, :cond_99

    const/4 v1, 0x5

    goto :goto_9a

    :cond_99
    const/4 v1, 0x3

    :goto_9a
    or-int/lit8 v6, v1, 0x30

    const/high16 v7, 0x42400000    # 48.0f

    const/high16 v8, 0x40e00000    # 7.0f

    const/high16 v9, 0x42400000    # 48.0f

    const/4 v10, 0x0

    invoke-static/range {v4 .. v10}, Lim/tpelyyftgw/ui/components/LayoutHelper;->createFrame(FFIFFFF)Landroid/widget/FrameLayout$LayoutParams;

    move-result-object v1

    invoke-virtual {p0, v0, v1}, Lim/tpelyyftgw/ui/cells/CheckBoxUserCell;->addView(Landroid/view/View;Landroid/view/ViewGroup$LayoutParams;)V

    .line 52
    new-instance v0, Lim/tpelyyftgw/ui/components/CheckBoxSquare;

    invoke-direct {v0, p1, p2}, Lim/tpelyyftgw/ui/components/CheckBoxSquare;-><init>(Landroid/content/Context;Z)V

    iput-object v0, p0, Lim/tpelyyftgw/ui/cells/CheckBoxUserCell;->checkBox:Lim/tpelyyftgw/ui/components/CheckBoxSquare;

    .line 53
    const/high16 v4, 0x41900000    # 18.0f

    const/high16 v5, 0x41900000    # 18.0f

    sget-boolean v1, Lim/tpelyyftgw/messenger/LocaleController;->isRTL:Z

    if-eqz v1, :cond_ba

    goto :goto_bb

    :cond_ba
    const/4 v2, 0x3

    :goto_bb
    or-int/lit8 v6, v2, 0x30

    sget-boolean v1, Lim/tpelyyftgw/messenger/LocaleController;->isRTL:Z

    const/4 v2, 0x0

    if-eqz v1, :cond_c4

    const/4 v1, 0x0

    goto :goto_c6

    :cond_c4
    const/16 v1, 0x15

    :goto_c6
    int-to-float v7, v1

    const/high16 v8, 0x41800000    # 16.0f

    sget-boolean v1, Lim/tpelyyftgw/messenger/LocaleController;->isRTL:Z

    if-eqz v1, :cond_ce

    goto :goto_cf

    :cond_ce
    const/4 v11, 0x0

    :goto_cf
    int-to-float v9, v11

    const/4 v10, 0x0

    invoke-static/range {v4 .. v10}, Lim/tpelyyftgw/ui/components/LayoutHelper;->createFrame(FFIFFFF)Landroid/widget/FrameLayout$LayoutParams;

    move-result-object v1

    invoke-virtual {p0, v0, v1}, Lim/tpelyyftgw/ui/cells/CheckBoxUserCell;->addView(Landroid/view/View;Landroid/view/ViewGroup$LayoutParams;)V

    .line 54
    return-void
.end method


# virtual methods
.method public getCheckBox()Lim/tpelyyftgw/ui/components/CheckBoxSquare;
    .registers 2

    .line 92
    iget-object v0, p0, Lim/tpelyyftgw/ui/cells/CheckBoxUserCell;->checkBox:Lim/tpelyyftgw/ui/components/CheckBoxSquare;

    return-object v0
.end method

.method public getCurrentUser()Lim/tpelyyftgw/tgnet/TLRPC$User;
    .registers 2

    .line 66
    iget-object v0, p0, Lim/tpelyyftgw/ui/cells/CheckBoxUserCell;->currentUser:Lim/tpelyyftgw/tgnet/TLRPC$User;

    return-object v0
.end method

.method public getTextView()Landroid/widget/TextView;
    .registers 2

    .line 88
    iget-object v0, p0, Lim/tpelyyftgw/ui/cells/CheckBoxUserCell;->textView:Landroid/widget/TextView;

    return-object v0
.end method

.method public isChecked()Z
    .registers 2

    .line 84
    iget-object v0, p0, Lim/tpelyyftgw/ui/cells/CheckBoxUserCell;->checkBox:Lim/tpelyyftgw/ui/components/CheckBoxSquare;

    invoke-virtual {v0}, Lim/tpelyyftgw/ui/components/CheckBoxSquare;->isChecked()Z

    move-result v0

    return v0
.end method

.method protected onDraw(Landroid/graphics/Canvas;)V
    .registers 10
    .param p1, "canvas"    # Landroid/graphics/Canvas;

    .line 97
    iget-boolean v0, p0, Lim/tpelyyftgw/ui/cells/CheckBoxUserCell;->needDivider:Z

    if-eqz v0, :cond_37

    .line 98
    sget-boolean v0, Lim/tpelyyftgw/messenger/LocaleController;->isRTL:Z

    const/high16 v1, 0x41a00000    # 20.0f

    if-eqz v0, :cond_d

    const/4 v0, 0x0

    const/4 v3, 0x0

    goto :goto_13

    :cond_d
    invoke-static {v1}, Lim/tpelyyftgw/messenger/AndroidUtilities;->dp(F)I

    move-result v0

    int-to-float v0, v0

    move v3, v0

    :goto_13
    invoke-virtual {p0}, Lim/tpelyyftgw/ui/cells/CheckBoxUserCell;->getMeasuredHeight()I

    move-result v0

    add-int/lit8 v0, v0, -0x1

    int-to-float v4, v0

    invoke-virtual {p0}, Lim/tpelyyftgw/ui/cells/CheckBoxUserCell;->getMeasuredWidth()I

    move-result v0

    sget-boolean v2, Lim/tpelyyftgw/messenger/LocaleController;->isRTL:Z

    if-eqz v2, :cond_27

    invoke-static {v1}, Lim/tpelyyftgw/messenger/AndroidUtilities;->dp(F)I

    move-result v1

    goto :goto_28

    :cond_27
    const/4 v1, 0x0

    :goto_28
    sub-int/2addr v0, v1

    int-to-float v5, v0

    invoke-virtual {p0}, Lim/tpelyyftgw/ui/cells/CheckBoxUserCell;->getMeasuredHeight()I

    move-result v0

    add-int/lit8 v0, v0, -0x1

    int-to-float v6, v0

    sget-object v7, Lim/tpelyyftgw/ui/actionbar/Theme;->dividerPaint:Landroid/graphics/Paint;

    move-object v2, p1

    invoke-virtual/range {v2 .. v7}, Landroid/graphics/Canvas;->drawLine(FFFFLandroid/graphics/Paint;)V

    .line 100
    :cond_37
    return-void
.end method

.method protected onMeasure(II)V
    .registers 7
    .param p1, "widthMeasureSpec"    # I
    .param p2, "heightMeasureSpec"    # I

    .line 58
    invoke-static {p1}, Landroid/view/View$MeasureSpec;->getSize(I)I

    move-result v0

    const/high16 v1, 0x40000000    # 2.0f

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

    move-result v0

    const/high16 v2, 0x42480000    # 50.0f

    invoke-static {v2}, Lim/tpelyyftgw/messenger/AndroidUtilities;->dp(F)I

    move-result v2

    iget-boolean v3, p0, Lim/tpelyyftgw/ui/cells/CheckBoxUserCell;->needDivider:Z

    add-int/2addr v2, v3

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

    move-result v1

    invoke-super {p0, v0, v1}, Landroid/widget/FrameLayout;->onMeasure(II)V

    .line 59
    return-void
.end method

.method public setChecked(ZZ)V
    .registers 4
    .param p1, "checked"    # Z
    .param p2, "animated"    # Z

    .line 80
    iget-object v0, p0, Lim/tpelyyftgw/ui/cells/CheckBoxUserCell;->checkBox:Lim/tpelyyftgw/ui/components/CheckBoxSquare;

    invoke-virtual {v0, p1, p2}, Lim/tpelyyftgw/ui/components/CheckBoxSquare;->setChecked(ZZ)V

    .line 81
    return-void
.end method

.method public setTextColor(I)V
    .registers 3
    .param p1, "color"    # I

    .line 62
    iget-object v0, p0, Lim/tpelyyftgw/ui/cells/CheckBoxUserCell;->textView:Landroid/widget/TextView;

    invoke-virtual {v0, p1}, Landroid/widget/TextView;->setTextColor(I)V

    .line 63
    return-void
.end method

.method public setUser(Lim/tpelyyftgw/tgnet/TLRPC$User;ZZ)V
    .registers 8
    .param p1, "user"    # Lim/tpelyyftgw/tgnet/TLRPC$User;
    .param p2, "checked"    # Z
    .param p3, "divider"    # Z

    .line 70
    iput-object p1, p0, Lim/tpelyyftgw/ui/cells/CheckBoxUserCell;->currentUser:Lim/tpelyyftgw/tgnet/TLRPC$User;

    .line 71
    iget-object v0, p0, Lim/tpelyyftgw/ui/cells/CheckBoxUserCell;->textView:Landroid/widget/TextView;

    iget-object v1, p1, Lim/tpelyyftgw/tgnet/TLRPC$User;->first_name:Ljava/lang/String;

    iget-object v2, p1, Lim/tpelyyftgw/tgnet/TLRPC$User;->last_name:Ljava/lang/String;

    invoke-static {v1, v2}, Lim/tpelyyftgw/messenger/ContactsController;->formatName(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v1

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

    .line 72
    iget-object v0, p0, Lim/tpelyyftgw/ui/cells/CheckBoxUserCell;->checkBox:Lim/tpelyyftgw/ui/components/CheckBoxSquare;

    const/4 v1, 0x0

    invoke-virtual {v0, p2, v1}, Lim/tpelyyftgw/ui/components/CheckBoxSquare;->setChecked(ZZ)V

    .line 73
    iget-object v0, p0, Lim/tpelyyftgw/ui/cells/CheckBoxUserCell;->avatarDrawable:Lim/tpelyyftgw/ui/components/AvatarDrawable;

    invoke-virtual {v0, p1}, Lim/tpelyyftgw/ui/components/AvatarDrawable;->setInfo(Lim/tpelyyftgw/tgnet/TLRPC$User;)V

    .line 74
    iget-object v0, p0, Lim/tpelyyftgw/ui/cells/CheckBoxUserCell;->imageView:Lim/tpelyyftgw/ui/components/BackupImageView;

    invoke-static {p1, v1}, Lim/tpelyyftgw/messenger/ImageLocation;->getForUser(Lim/tpelyyftgw/tgnet/TLRPC$User;Z)Lim/tpelyyftgw/messenger/ImageLocation;

    move-result-object v1

    iget-object v2, p0, Lim/tpelyyftgw/ui/cells/CheckBoxUserCell;->avatarDrawable:Lim/tpelyyftgw/ui/components/AvatarDrawable;

    const-string v3, "50_50"

    invoke-virtual {v0, v1, v3, v2, p1}, Lim/tpelyyftgw/ui/components/BackupImageView;->setImage(Lim/tpelyyftgw/messenger/ImageLocation;Ljava/lang/String;Landroid/graphics/drawable/Drawable;Ljava/lang/Object;)V

    .line 75
    iput-boolean p3, p0, Lim/tpelyyftgw/ui/cells/CheckBoxUserCell;->needDivider:Z

    .line 76
    xor-int/lit8 v0, p3, 0x1

    invoke-virtual {p0, v0}, Lim/tpelyyftgw/ui/cells/CheckBoxUserCell;->setWillNotDraw(Z)V

    .line 77
    return-void
.end method