ChatActivity$UnreadCounterTextView.smali
.class Lim/tpelyyftgw/ui/ChatActivity$UnreadCounterTextView;
.super Landroidx/appcompat/widget/AppCompatTextView;
.source "ChatActivity.java"
# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
value = Lim/tpelyyftgw/ui/ChatActivity;
.end annotation
.annotation system Ldalvik/annotation/InnerClass;
accessFlags = 0x2
name = "UnreadCounterTextView"
.end annotation
# instance fields
.field private circleWidth:I
.field private currentCounter:I
.field private currentCounterString:Ljava/lang/String;
.field private paint:Landroid/graphics/Paint;
.field private rect:Landroid/graphics/RectF;
.field private textPaint:Landroid/text/TextPaint;
.field private textWidth:I
.field final synthetic this$0:Lim/tpelyyftgw/ui/ChatActivity;
# direct methods
.method static constructor <clinit>()V
.registers 1
return-void
.end method
.method public constructor <init>(Lim/tpelyyftgw/ui/ChatActivity;Landroid/content/Context;)V
.registers 4
.param p2, "context" # Landroid/content/Context;
.line 614
iput-object p1, p0, Lim/tpelyyftgw/ui/ChatActivity$UnreadCounterTextView;->this$0:Lim/tpelyyftgw/ui/ChatActivity;
.line 615
invoke-direct {p0, p2}, Landroidx/appcompat/widget/AppCompatTextView;-><init>(Landroid/content/Context;)V
.line 609
new-instance p1, Landroid/text/TextPaint;
const/4 v0, 0x1
invoke-direct {p1, v0}, Landroid/text/TextPaint;-><init>(I)V
iput-object p1, p0, Lim/tpelyyftgw/ui/ChatActivity$UnreadCounterTextView;->textPaint:Landroid/text/TextPaint;
.line 610
new-instance p1, Landroid/graphics/Paint;
invoke-direct {p1, v0}, Landroid/graphics/Paint;-><init>(I)V
iput-object p1, p0, Lim/tpelyyftgw/ui/ChatActivity$UnreadCounterTextView;->paint:Landroid/graphics/Paint;
.line 611
new-instance p1, Landroid/graphics/RectF;
invoke-direct {p1}, Landroid/graphics/RectF;-><init>()V
iput-object p1, p0, Lim/tpelyyftgw/ui/ChatActivity$UnreadCounterTextView;->rect:Landroid/graphics/RectF;
.line 616
iget-object p1, p0, Lim/tpelyyftgw/ui/ChatActivity$UnreadCounterTextView;->textPaint:Landroid/text/TextPaint;
const/high16 v0, 0x41500000 # 13.0f
invoke-static {v0}, Lim/tpelyyftgw/messenger/AndroidUtilities;->dp(F)I
move-result v0
int-to-float v0, v0
invoke-virtual {p1, v0}, Landroid/text/TextPaint;->setTextSize(F)V
.line 617
iget-object p1, p0, Lim/tpelyyftgw/ui/ChatActivity$UnreadCounterTextView;->textPaint:Landroid/text/TextPaint;
const-string v0, "fonts/rmedium.ttf"
invoke-static {v0}, Lim/tpelyyftgw/messenger/AndroidUtilities;->getTypeface(Ljava/lang/String;)Landroid/graphics/Typeface;
move-result-object v0
invoke-virtual {p1, v0}, Landroid/text/TextPaint;->setTypeface(Landroid/graphics/Typeface;)Landroid/graphics/Typeface;
.line 618
return-void
.end method
# virtual methods
.method protected onDraw(Landroid/graphics/Canvas;)V
.registers 12
.param p1, "canvas" # Landroid/graphics/Canvas;
.line 660
invoke-super {p0, p1}, Landroidx/appcompat/widget/AppCompatTextView;->onDraw(Landroid/graphics/Canvas;)V
.line 662
iget-object v0, p0, Lim/tpelyyftgw/ui/ChatActivity$UnreadCounterTextView;->currentCounterString:Ljava/lang/String;
if-eqz v0, :cond_85
.line 663
invoke-virtual {p0}, Lim/tpelyyftgw/ui/ChatActivity$UnreadCounterTextView;->getLayout()Landroid/text/Layout;
move-result-object v0
.line 664
.local v0, "layout":Landroid/text/Layout;
if-eqz v0, :cond_85
invoke-virtual {p0}, Lim/tpelyyftgw/ui/ChatActivity$UnreadCounterTextView;->getLineCount()I
move-result v1
if-lez v1, :cond_85
.line 665
const/4 v1, 0x0
invoke-virtual {v0, v1}, Landroid/text/Layout;->getLineWidth(I)F
move-result v1
float-to-double v1, v1
invoke-static {v1, v2}, Ljava/lang/Math;->ceil(D)D
move-result-wide v1
double-to-int v1, v1
.line 666
.local v1, "lineWidth":I
invoke-virtual {p0}, Lim/tpelyyftgw/ui/ChatActivity$UnreadCounterTextView;->getMeasuredWidth()I
move-result v2
iget v3, p0, Lim/tpelyyftgw/ui/ChatActivity$UnreadCounterTextView;->circleWidth:I
sub-int v3, v1, v3
add-int/2addr v2, v3
div-int/lit8 v2, v2, 0x2
const/high16 v3, 0x41000000 # 8.0f
invoke-static {v3}, Lim/tpelyyftgw/messenger/AndroidUtilities;->dp(F)I
move-result v3
add-int/2addr v2, v3
.line 667
.local v2, "x":I
iget-object v3, p0, Lim/tpelyyftgw/ui/ChatActivity$UnreadCounterTextView;->rect:Landroid/graphics/RectF;
int-to-float v4, v2
invoke-virtual {p0}, Lim/tpelyyftgw/ui/ChatActivity$UnreadCounterTextView;->getMeasuredHeight()I
move-result v5
div-int/lit8 v5, v5, 0x2
const/high16 v6, 0x41200000 # 10.0f
invoke-static {v6}, Lim/tpelyyftgw/messenger/AndroidUtilities;->dp(F)I
move-result v7
sub-int/2addr v5, v7
int-to-float v5, v5
iget v7, p0, Lim/tpelyyftgw/ui/ChatActivity$UnreadCounterTextView;->circleWidth:I
add-int/2addr v7, v2
int-to-float v7, v7
invoke-virtual {p0}, Lim/tpelyyftgw/ui/ChatActivity$UnreadCounterTextView;->getMeasuredHeight()I
move-result v8
div-int/lit8 v8, v8, 0x2
invoke-static {v6}, Lim/tpelyyftgw/messenger/AndroidUtilities;->dp(F)I
move-result v9
add-int/2addr v8, v9
int-to-float v8, v8
invoke-virtual {v3, v4, v5, v7, v8}, Landroid/graphics/RectF;->set(FFFF)V
.line 668
iget-object v3, p0, Lim/tpelyyftgw/ui/ChatActivity$UnreadCounterTextView;->rect:Landroid/graphics/RectF;
invoke-static {v6}, Lim/tpelyyftgw/messenger/AndroidUtilities;->dp(F)I
move-result v4
int-to-float v4, v4
invoke-static {v6}, Lim/tpelyyftgw/messenger/AndroidUtilities;->dp(F)I
move-result v5
int-to-float v5, v5
iget-object v6, p0, Lim/tpelyyftgw/ui/ChatActivity$UnreadCounterTextView;->paint:Landroid/graphics/Paint;
invoke-virtual {p1, v3, v4, v5, v6}, Landroid/graphics/Canvas;->drawRoundRect(Landroid/graphics/RectF;FFLandroid/graphics/Paint;)V
.line 669
iget-object v3, p0, Lim/tpelyyftgw/ui/ChatActivity$UnreadCounterTextView;->currentCounterString:Ljava/lang/String;
iget-object v4, p0, Lim/tpelyyftgw/ui/ChatActivity$UnreadCounterTextView;->rect:Landroid/graphics/RectF;
invoke-virtual {v4}, Landroid/graphics/RectF;->centerX()F
move-result v4
iget v5, p0, Lim/tpelyyftgw/ui/ChatActivity$UnreadCounterTextView;->textWidth:I
int-to-float v5, v5
const/high16 v6, 0x40000000 # 2.0f
div-float/2addr v5, v6
sub-float/2addr v4, v5
iget-object v5, p0, Lim/tpelyyftgw/ui/ChatActivity$UnreadCounterTextView;->rect:Landroid/graphics/RectF;
iget v5, v5, Landroid/graphics/RectF;->top:F
const/high16 v6, 0x41680000 # 14.5f
invoke-static {v6}, Lim/tpelyyftgw/messenger/AndroidUtilities;->dp(F)I
move-result v6
int-to-float v6, v6
add-float/2addr v5, v6
iget-object v6, p0, Lim/tpelyyftgw/ui/ChatActivity$UnreadCounterTextView;->textPaint:Landroid/text/TextPaint;
invoke-virtual {p1, v3, v4, v5, v6}, Landroid/graphics/Canvas;->drawText(Ljava/lang/String;FFLandroid/graphics/Paint;)V
.line 672
.end local v0 # "layout":Landroid/text/Layout;
.end local v1 # "lineWidth":I
.end local v2 # "x":I
:cond_85
return-void
.end method
.method public setTextColor(I)V
.registers 4
.param p1, "color" # I
.line 622
invoke-super {p0, p1}, Landroidx/appcompat/widget/AppCompatTextView;->setTextColor(I)V
.line 623
iget-object v0, p0, Lim/tpelyyftgw/ui/ChatActivity$UnreadCounterTextView;->textPaint:Landroid/text/TextPaint;
const-string v1, "chat_messagePanelBackground"
invoke-static {v1}, Lim/tpelyyftgw/ui/actionbar/Theme;->getColor(Ljava/lang/String;)I
move-result v1
invoke-virtual {v0, v1}, Landroid/text/TextPaint;->setColor(I)V
.line 624
iget-object v0, p0, Lim/tpelyyftgw/ui/ChatActivity$UnreadCounterTextView;->paint:Landroid/graphics/Paint;
const-string v1, "chat_goDownButtonCounterBackground"
invoke-static {v1}, Lim/tpelyyftgw/ui/actionbar/Theme;->getColor(Ljava/lang/String;)I
move-result v1
invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setColor(I)V
.line 625
return-void
.end method
.method public updateCounter()V
.registers 6
.line 629
iget-object v0, p0, Lim/tpelyyftgw/ui/ChatActivity$UnreadCounterTextView;->this$0:Lim/tpelyyftgw/ui/ChatActivity;
iget-object v0, v0, Lim/tpelyyftgw/ui/ChatActivity;->currentChat:Lim/tpelyyftgw/tgnet/TLRPC$Chat;
invoke-static {v0}, Lim/tpelyyftgw/messenger/ChatObject;->isChannel(Lim/tpelyyftgw/tgnet/TLRPC$Chat;)Z
move-result v0
if-eqz v0, :cond_3d
iget-object v0, p0, Lim/tpelyyftgw/ui/ChatActivity$UnreadCounterTextView;->this$0:Lim/tpelyyftgw/ui/ChatActivity;
iget-object v0, v0, Lim/tpelyyftgw/ui/ChatActivity;->currentChat:Lim/tpelyyftgw/tgnet/TLRPC$Chat;
iget-boolean v0, v0, Lim/tpelyyftgw/tgnet/TLRPC$Chat;->megagroup:Z
if-nez v0, :cond_3d
iget-object v0, p0, Lim/tpelyyftgw/ui/ChatActivity$UnreadCounterTextView;->this$0:Lim/tpelyyftgw/ui/ChatActivity;
iget-object v0, v0, Lim/tpelyyftgw/ui/ChatActivity;->chatInfo:Lim/tpelyyftgw/tgnet/TLRPC$ChatFull;
if-eqz v0, :cond_3d
iget-object v0, p0, Lim/tpelyyftgw/ui/ChatActivity$UnreadCounterTextView;->this$0:Lim/tpelyyftgw/ui/ChatActivity;
iget-object v0, v0, Lim/tpelyyftgw/ui/ChatActivity;->chatInfo:Lim/tpelyyftgw/tgnet/TLRPC$ChatFull;
iget v0, v0, Lim/tpelyyftgw/tgnet/TLRPC$ChatFull;->linked_chat_id:I
if-eqz v0, :cond_3d
.line 630
iget-object v0, p0, Lim/tpelyyftgw/ui/ChatActivity$UnreadCounterTextView;->this$0:Lim/tpelyyftgw/ui/ChatActivity;
invoke-static {v0}, Lim/tpelyyftgw/ui/ChatActivity;->access$000(Lim/tpelyyftgw/ui/ChatActivity;)Lim/tpelyyftgw/messenger/MessagesController;
move-result-object v0
iget-object v0, v0, Lim/tpelyyftgw/messenger/MessagesController;->dialogs_dict:Landroid/util/LongSparseArray;
iget-object v1, p0, Lim/tpelyyftgw/ui/ChatActivity$UnreadCounterTextView;->this$0:Lim/tpelyyftgw/ui/ChatActivity;
iget-object v1, v1, Lim/tpelyyftgw/ui/ChatActivity;->chatInfo:Lim/tpelyyftgw/tgnet/TLRPC$ChatFull;
iget v1, v1, Lim/tpelyyftgw/tgnet/TLRPC$ChatFull;->linked_chat_id:I
neg-int v1, v1
int-to-long v1, v1
invoke-virtual {v0, v1, v2}, Landroid/util/LongSparseArray;->get(J)Ljava/lang/Object;
move-result-object v0
check-cast v0, Lim/tpelyyftgw/tgnet/TLRPC$Dialog;
.line 631
.local v0, "dialog":Lim/tpelyyftgw/tgnet/TLRPC$Dialog;
if-eqz v0, :cond_3b
.line 632
iget v1, v0, Lim/tpelyyftgw/tgnet/TLRPC$Dialog;->unread_count:I
.local v1, "newCount":I
goto :goto_3c
.line 634
.end local v1 # "newCount":I
:cond_3b
const/4 v1, 0x0
.line 636
.end local v0 # "dialog":Lim/tpelyyftgw/tgnet/TLRPC$Dialog;
.restart local v1 # "newCount":I
:goto_3c
goto :goto_3e
.line 637
.end local v1 # "newCount":I
:cond_3d
const/4 v1, 0x0
.line 639
.restart local v1 # "newCount":I
:goto_3e
iget v0, p0, Lim/tpelyyftgw/ui/ChatActivity$UnreadCounterTextView;->currentCounter:I
if-eq v0, v1, :cond_97
.line 640
iput v1, p0, Lim/tpelyyftgw/ui/ChatActivity$UnreadCounterTextView;->currentCounter:I
.line 641
const/4 v0, 0x0
if-nez v1, :cond_50
.line 642
const/4 v2, 0x0
iput-object v2, p0, Lim/tpelyyftgw/ui/ChatActivity$UnreadCounterTextView;->currentCounterString:Ljava/lang/String;
.line 643
iput v0, p0, Lim/tpelyyftgw/ui/ChatActivity$UnreadCounterTextView;->circleWidth:I
.line 644
invoke-virtual {p0, v0, v0, v0, v0}, Lim/tpelyyftgw/ui/ChatActivity$UnreadCounterTextView;->setPadding(IIII)V
goto :goto_94
.line 646
:cond_50
const/4 v2, 0x1
new-array v2, v2, [Ljava/lang/Object;
invoke-static {v1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
move-result-object v3
aput-object v3, v2, v0
const-string v3, "%d"
invoke-static {v3, v2}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
move-result-object v2
iput-object v2, p0, Lim/tpelyyftgw/ui/ChatActivity$UnreadCounterTextView;->currentCounterString:Ljava/lang/String;
.line 647
iget-object v3, p0, Lim/tpelyyftgw/ui/ChatActivity$UnreadCounterTextView;->textPaint:Landroid/text/TextPaint;
invoke-virtual {v3, v2}, Landroid/text/TextPaint;->measureText(Ljava/lang/String;)F
move-result v2
float-to-double v2, v2
invoke-static {v2, v3}, Ljava/lang/Math;->ceil(D)D
move-result-wide v2
double-to-int v2, v2
iput v2, p0, Lim/tpelyyftgw/ui/ChatActivity$UnreadCounterTextView;->textWidth:I
.line 648
const/high16 v2, 0x41a00000 # 20.0f
invoke-static {v2}, Lim/tpelyyftgw/messenger/AndroidUtilities;->dp(F)I
move-result v2
const/high16 v3, 0x41400000 # 12.0f
invoke-static {v3}, Lim/tpelyyftgw/messenger/AndroidUtilities;->dp(F)I
move-result v3
iget v4, p0, Lim/tpelyyftgw/ui/ChatActivity$UnreadCounterTextView;->textWidth:I
add-int/2addr v3, v4
invoke-static {v2, v3}, Ljava/lang/Math;->max(II)I
move-result v2
.line 649
.local v2, "newWidth":I
iget v3, p0, Lim/tpelyyftgw/ui/ChatActivity$UnreadCounterTextView;->circleWidth:I
if-eq v3, v2, :cond_94
.line 650
iput v2, p0, Lim/tpelyyftgw/ui/ChatActivity$UnreadCounterTextView;->circleWidth:I
.line 651
div-int/lit8 v3, v2, 0x2
const/high16 v4, 0x40e00000 # 7.0f
invoke-static {v4}, Lim/tpelyyftgw/messenger/AndroidUtilities;->dp(F)I
move-result v4
add-int/2addr v3, v4
invoke-virtual {p0, v0, v0, v3, v0}, Lim/tpelyyftgw/ui/ChatActivity$UnreadCounterTextView;->setPadding(IIII)V
.line 654
.end local v2 # "newWidth":I
:cond_94
:goto_94
invoke-virtual {p0}, Lim/tpelyyftgw/ui/ChatActivity$UnreadCounterTextView;->invalidate()V
.line 656
:cond_97
return-void
.end method