MryEditText.smali

.class public Lim/tpelyyftgw/ui/hviews/MryEditText;
.super Landroidx/appcompat/widget/AppCompatEditText;
.source "MryEditText.java"


# instance fields
.field private clearButtonDrawable:Landroid/graphics/drawable/Drawable;

.field private detector:Landroid/view/GestureDetector;

.field private showClearButton:Z


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

    return-void
.end method

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

    .line 41
    const/4 v0, 0x0

    invoke-direct {p0, p1, v0}, Lim/tpelyyftgw/ui/hviews/MryEditText;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;)V

    .line 42
    return-void
.end method

.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
    .registers 4
    .param p1, "context"    # Landroid/content/Context;
    .param p2, "attrs"    # Landroid/util/AttributeSet;

    .line 45
    const/4 v0, 0x0

    invoke-direct {p0, p1, p2, v0}, Lim/tpelyyftgw/ui/hviews/MryEditText;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V

    .line 46
    return-void
.end method

.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V
    .registers 15
    .param p1, "context"    # Landroid/content/Context;
    .param p2, "attrs"    # Landroid/util/AttributeSet;
    .param p3, "defStyleAttr"    # I

    .line 49
    invoke-direct {p0, p1, p2, p3}, Landroidx/appcompat/widget/AppCompatEditText;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V

    .line 50
    sget-object v0, Lim/tpelyyftgw/messenger/R$styleable;->MryEditText:[I

    invoke-virtual {p1, p2, v0}, Landroid/content/Context;->obtainStyledAttributes(Landroid/util/AttributeSet;[I)Landroid/content/res/TypedArray;

    move-result-object v0

    .line 51
    .local v0, "a":Landroid/content/res/TypedArray;
    const/4 v1, 0x2

    const/4 v2, 0x0

    invoke-virtual {v0, v1, v2}, Landroid/content/res/TypedArray;->getInteger(II)I

    move-result v3

    .line 52
    .local v3, "style":I
    const/4 v4, 0x3

    invoke-virtual {v0, v4, v2}, Landroid/content/res/TypedArray;->getBoolean(IZ)Z

    move-result v5

    .line 53
    .local v5, "render":Z
    const/4 v6, 0x5

    invoke-virtual {v0, v6}, Landroid/content/res/TypedArray;->getString(I)Ljava/lang/String;

    move-result-object v6

    .line 54
    .local v6, "textKey":Ljava/lang/String;
    const/4 v7, 0x1

    invoke-virtual {v0, v7}, Landroid/content/res/TypedArray;->getString(I)Ljava/lang/String;

    move-result-object v8

    .line 55
    .local v8, "hintKey":Ljava/lang/String;
    const/4 v9, 0x4

    invoke-virtual {v0, v9, v2}, Landroid/content/res/TypedArray;->getBoolean(IZ)Z

    move-result v10

    iput-boolean v10, p0, Lim/tpelyyftgw/ui/hviews/MryEditText;->showClearButton:Z

    .line 56
    invoke-virtual {v0, v2}, Landroid/content/res/TypedArray;->getDrawable(I)Landroid/graphics/drawable/Drawable;

    move-result-object v2

    iput-object v2, p0, Lim/tpelyyftgw/ui/hviews/MryEditText;->clearButtonDrawable:Landroid/graphics/drawable/Drawable;

    .line 57
    invoke-virtual {v0}, Landroid/content/res/TypedArray;->recycle()V

    .line 59
    if-eqz v3, :cond_47

    .line 60
    if-ne v3, v7, :cond_36

    .line 61
    invoke-virtual {p0}, Lim/tpelyyftgw/ui/hviews/MryEditText;->setBold()V

    goto :goto_47

    .line 62
    :cond_36
    if-ne v3, v1, :cond_3c

    .line 63
    invoke-virtual {p0}, Lim/tpelyyftgw/ui/hviews/MryEditText;->setItalic()V

    goto :goto_47

    .line 64
    :cond_3c
    if-ne v3, v4, :cond_42

    .line 65
    invoke-virtual {p0}, Lim/tpelyyftgw/ui/hviews/MryEditText;->setBoldAndItalic()V

    goto :goto_47

    .line 66
    :cond_42
    if-ne v3, v9, :cond_47

    .line 67
    invoke-virtual {p0}, Lim/tpelyyftgw/ui/hviews/MryEditText;->setMono()V

    .line 71
    :cond_47
    :goto_47
    invoke-virtual {p0}, Lim/tpelyyftgw/ui/hviews/MryEditText;->getTextColors()Landroid/content/res/ColorStateList;

    move-result-object v1

    if-eqz v1, :cond_4f

    if-eqz v5, :cond_59

    .line 72
    :cond_4f
    const-string v1, "windowBackgroundWhiteHintText"

    invoke-virtual {p0, v1}, Lim/tpelyyftgw/ui/hviews/MryEditText;->setHintColor(Ljava/lang/String;)V

    .line 73
    const-string v1, "windowBackgroundWhiteBlackText"

    invoke-virtual {p0, v1}, Lim/tpelyyftgw/ui/hviews/MryEditText;->setTextColor(Ljava/lang/String;)V

    .line 75
    :cond_59
    const-string v1, "string"

    if-eqz v6, :cond_6c

    .line 76
    invoke-virtual {p0}, Lim/tpelyyftgw/ui/hviews/MryEditText;->getResources()Landroid/content/res/Resources;

    move-result-object v2

    invoke-virtual {p1}, Landroid/content/Context;->getPackageName()Ljava/lang/String;

    move-result-object v4

    invoke-virtual {v2, v6, v1, v4}, Landroid/content/res/Resources;->getIdentifier(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)I

    move-result v2

    invoke-virtual {p0, v2}, Lim/tpelyyftgw/ui/hviews/MryEditText;->setMryText(I)V

    .line 78
    :cond_6c
    if-eqz v8, :cond_7d

    .line 79
    invoke-virtual {p0}, Lim/tpelyyftgw/ui/hviews/MryEditText;->getResources()Landroid/content/res/Resources;

    move-result-object v2

    invoke-virtual {p1}, Landroid/content/Context;->getPackageName()Ljava/lang/String;

    move-result-object v4

    invoke-virtual {v2, v8, v1, v4}, Landroid/content/res/Resources;->getIdentifier(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)I

    move-result v1

    invoke-virtual {p0, v1}, Lim/tpelyyftgw/ui/hviews/MryEditText;->setMryHint(I)V

    .line 81
    :cond_7d
    invoke-virtual {p0, v7}, Lim/tpelyyftgw/ui/hviews/MryEditText;->setFocusableInTouchMode(Z)V

    .line 83
    iget-boolean v1, p0, Lim/tpelyyftgw/ui/hviews/MryEditText;->showClearButton:Z

    invoke-virtual {p0, v1}, Lim/tpelyyftgw/ui/hviews/MryEditText;->setShowClearButton(Z)V

    .line 84
    iget-object v1, p0, Lim/tpelyyftgw/ui/hviews/MryEditText;->clearButtonDrawable:Landroid/graphics/drawable/Drawable;

    invoke-virtual {p0, v1}, Lim/tpelyyftgw/ui/hviews/MryEditText;->setClearButtonDrawable(Landroid/graphics/drawable/Drawable;)V

    .line 86
    invoke-static {p0}, Lim/tpelyyftgw/messenger/AndroidUtilities;->handleKeyboardShelterProblem(Landroid/widget/EditText;)V

    .line 87
    return-void
.end method

.method static synthetic access$000(Lim/tpelyyftgw/ui/hviews/MryEditText;)Landroid/graphics/drawable/Drawable;
    .registers 2
    .param p0, "x0"    # Lim/tpelyyftgw/ui/hviews/MryEditText;

    .line 32
    iget-object v0, p0, Lim/tpelyyftgw/ui/hviews/MryEditText;->clearButtonDrawable:Landroid/graphics/drawable/Drawable;

    return-object v0
.end method


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

    .line 91
    invoke-super {p0, p1}, Landroidx/appcompat/widget/AppCompatEditText;->onDraw(Landroid/graphics/Canvas;)V

    .line 93
    iget-boolean v0, p0, Lim/tpelyyftgw/ui/hviews/MryEditText;->showClearButton:Z

    if-eqz v0, :cond_35

    iget-object v0, p0, Lim/tpelyyftgw/ui/hviews/MryEditText;->clearButtonDrawable:Landroid/graphics/drawable/Drawable;

    if-eqz v0, :cond_35

    .line 94
    const/high16 v0, 0x42200000    # 40.0f

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

    move-result v0

    .line 95
    .local v0, "size":I
    invoke-virtual {p0}, Lim/tpelyyftgw/ui/hviews/MryEditText;->getMeasuredWidth()I

    move-result v1

    invoke-virtual {p0}, Lim/tpelyyftgw/ui/hviews/MryEditText;->getPaddingEnd()I

    move-result v2

    sub-int/2addr v1, v2

    sub-int/2addr v1, v0

    .line 96
    .local v1, "l":I
    invoke-virtual {p0}, Lim/tpelyyftgw/ui/hviews/MryEditText;->getMeasuredHeight()I

    move-result v2

    invoke-virtual {p0}, Lim/tpelyyftgw/ui/hviews/MryEditText;->getPaddingTop()I

    move-result v3

    sub-int/2addr v2, v3

    div-int/lit8 v3, v0, 0x2

    sub-int/2addr v2, v3

    .line 97
    .local v2, "t":I
    iget-object v3, p0, Lim/tpelyyftgw/ui/hviews/MryEditText;->clearButtonDrawable:Landroid/graphics/drawable/Drawable;

    add-int v4, v1, v0

    add-int v5, v2, v0

    invoke-virtual {v3, v1, v2, v4, v5}, Landroid/graphics/drawable/Drawable;->setBounds(IIII)V

    .line 98
    iget-object v3, p0, Lim/tpelyyftgw/ui/hviews/MryEditText;->clearButtonDrawable:Landroid/graphics/drawable/Drawable;

    invoke-virtual {v3, p1}, Landroid/graphics/drawable/Drawable;->draw(Landroid/graphics/Canvas;)V

    .line 100
    .end local v0    # "size":I
    .end local v1    # "l":I
    .end local v2    # "t":I
    :cond_35
    return-void
.end method

.method public onTouchEvent(Landroid/view/MotionEvent;)Z
    .registers 3
    .param p1, "event"    # Landroid/view/MotionEvent;

    .line 104
    iget-boolean v0, p0, Lim/tpelyyftgw/ui/hviews/MryEditText;->showClearButton:Z

    if-eqz v0, :cond_10

    iget-object v0, p0, Lim/tpelyyftgw/ui/hviews/MryEditText;->detector:Landroid/view/GestureDetector;

    if-eqz v0, :cond_10

    invoke-virtual {v0, p1}, Landroid/view/GestureDetector;->onTouchEvent(Landroid/view/MotionEvent;)Z

    move-result v0

    if-eqz v0, :cond_10

    .line 105
    const/4 v0, 0x1

    return v0

    .line 107
    :cond_10
    invoke-super {p0, p1}, Landroidx/appcompat/widget/AppCompatEditText;->onTouchEvent(Landroid/view/MotionEvent;)Z

    move-result v0

    return v0
.end method

.method public requestFocus(ILandroid/graphics/Rect;)Z
    .registers 4
    .param p1, "direction"    # I
    .param p2, "previouslyFocusedRect"    # Landroid/graphics/Rect;

    .line 112
    invoke-super {p0, p1, p2}, Landroidx/appcompat/widget/AppCompatEditText;->requestFocus(ILandroid/graphics/Rect;)Z

    move-result v0

    .line 113
    .local v0, "tag":Z
    invoke-virtual {p0}, Lim/tpelyyftgw/ui/hviews/MryEditText;->setSelectionEnd()V

    .line 114
    return v0
.end method

.method public setBackgroundColor(Ljava/lang/String;)V
    .registers 3
    .param p1, "colorThemeKey"    # Ljava/lang/String;

    .line 161
    if-nez p1, :cond_3

    return-void

    .line 162
    :cond_3
    invoke-static {p1}, Lim/tpelyyftgw/ui/actionbar/Theme;->getColor(Ljava/lang/String;)I

    move-result v0

    invoke-super {p0, v0}, Landroidx/appcompat/widget/AppCompatEditText;->setBackgroundColor(I)V

    .line 163
    return-void
.end method

.method public setBold()V
    .registers 2

    .line 171
    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 {p0, v0}, Lim/tpelyyftgw/ui/hviews/MryEditText;->setTypeface(Landroid/graphics/Typeface;)V

    .line 172
    return-void
.end method

.method public setBoldAndItalic()V
    .registers 2

    .line 179
    const-string v0, "fonts/rmediumitalic.ttf"

    invoke-static {v0}, Lim/tpelyyftgw/messenger/AndroidUtilities;->getTypeface(Ljava/lang/String;)Landroid/graphics/Typeface;

    move-result-object v0

    invoke-virtual {p0, v0}, Lim/tpelyyftgw/ui/hviews/MryEditText;->setTypeface(Landroid/graphics/Typeface;)V

    .line 180
    return-void
.end method

.method public setClearButtonDrawable(I)V
    .registers 3
    .param p1, "clearButtonDrawable"    # I

    .line 205
    invoke-virtual {p0}, Lim/tpelyyftgw/ui/hviews/MryEditText;->getContext()Landroid/content/Context;

    move-result-object v0

    invoke-static {v0, p1}, Landroidx/core/content/ContextCompat;->getDrawable(Landroid/content/Context;I)Landroid/graphics/drawable/Drawable;

    move-result-object v0

    iput-object v0, p0, Lim/tpelyyftgw/ui/hviews/MryEditText;->clearButtonDrawable:Landroid/graphics/drawable/Drawable;

    .line 206
    invoke-virtual {p0}, Lim/tpelyyftgw/ui/hviews/MryEditText;->invalidate()V

    .line 207
    return-void
.end method

.method public setClearButtonDrawable(Landroid/graphics/drawable/Drawable;)V
    .registers 2
    .param p1, "clearButtonDrawable"    # Landroid/graphics/drawable/Drawable;

    .line 210
    iput-object p1, p0, Lim/tpelyyftgw/ui/hviews/MryEditText;->clearButtonDrawable:Landroid/graphics/drawable/Drawable;

    .line 211
    invoke-virtual {p0}, Lim/tpelyyftgw/ui/hviews/MryEditText;->invalidate()V

    .line 212
    return-void
.end method

.method public setHighlightColor(Ljava/lang/String;)V
    .registers 3
    .param p1, "colorThemeKey"    # Ljava/lang/String;

    .line 166
    if-nez p1, :cond_3

    return-void

    .line 167
    :cond_3
    invoke-static {p1}, Lim/tpelyyftgw/ui/actionbar/Theme;->getColor(Ljava/lang/String;)I

    move-result v0

    invoke-super {p0, v0}, Landroidx/appcompat/widget/AppCompatEditText;->setHighlightColor(I)V

    .line 168
    return-void
.end method

.method public setHintColor(Ljava/lang/String;)V
    .registers 3
    .param p1, "colorThemeKey"    # Ljava/lang/String;

    .line 156
    if-nez p1, :cond_3

    return-void

    .line 157
    :cond_3
    invoke-static {p1}, Lim/tpelyyftgw/ui/actionbar/Theme;->getColor(Ljava/lang/String;)I

    move-result v0

    invoke-super {p0, v0}, Landroidx/appcompat/widget/AppCompatEditText;->setHintTextColor(I)V

    .line 158
    return-void
.end method

.method public setInputType(I)V
    .registers 2
    .param p1, "type"    # I

    .line 119
    invoke-super {p0, p1}, Landroidx/appcompat/widget/AppCompatEditText;->setInputType(I)V

    .line 120
    return-void
.end method

.method public setItalic()V
    .registers 2

    .line 175
    const-string v0, "fonts/ritalic.ttf"

    invoke-static {v0}, Lim/tpelyyftgw/messenger/AndroidUtilities;->getTypeface(Ljava/lang/String;)Landroid/graphics/Typeface;

    move-result-object v0

    invoke-virtual {p0, v0}, Lim/tpelyyftgw/ui/hviews/MryEditText;->setTypeface(Landroid/graphics/Typeface;)V

    .line 176
    return-void
.end method

.method public setMono()V
    .registers 2

    .line 183
    const-string v0, "fonts/rmono.ttf"

    invoke-static {v0}, Lim/tpelyyftgw/messenger/AndroidUtilities;->getTypeface(Ljava/lang/String;)Landroid/graphics/Typeface;

    move-result-object v0

    invoke-virtual {p0, v0}, Lim/tpelyyftgw/ui/hviews/MryEditText;->setTypeface(Landroid/graphics/Typeface;)V

    .line 184
    return-void
.end method

.method public setMryHint(I)V
    .registers 3
    .param p1, "resId"    # I

    .line 147
    invoke-static {p1}, Lim/tpelyyftgw/messenger/LocaleController;->getString(I)Ljava/lang/String;

    move-result-object v0

    invoke-virtual {p0, v0}, Lim/tpelyyftgw/ui/hviews/MryEditText;->setHint(Ljava/lang/CharSequence;)V

    .line 148
    return-void
.end method

.method public setMryText(I)V
    .registers 3
    .param p1, "resId"    # I

    .line 143
    invoke-static {p1}, Lim/tpelyyftgw/messenger/LocaleController;->getString(I)Ljava/lang/String;

    move-result-object v0

    invoke-virtual {p0, v0}, Lim/tpelyyftgw/ui/hviews/MryEditText;->setText(Ljava/lang/CharSequence;)V

    .line 144
    return-void
.end method

.method public setSelection(I)V
    .registers 3
    .param p1, "index"    # I

    .line 125
    :try_start_0
    invoke-super {p0, p1}, Landroidx/appcompat/widget/AppCompatEditText;->setSelection(I)V
    :try_end_3
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_3} :catch_4

    .line 127
    goto :goto_5

    .line 126
    :catch_4
    move-exception v0

    .line 128
    :goto_5
    return-void
.end method

.method public setSelection(II)V
    .registers 4
    .param p1, "start"    # I
    .param p2, "stop"    # I

    .line 133
    :try_start_0
    invoke-super {p0, p1, p2}, Landroidx/appcompat/widget/AppCompatEditText;->setSelection(II)V
    :try_end_3
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_3} :catch_4

    .line 135
    goto :goto_5

    .line 134
    :catch_4
    move-exception v0

    .line 136
    :goto_5
    return-void
.end method

.method public setSelectionEnd()V
    .registers 2

    .line 139
    invoke-virtual {p0}, Lim/tpelyyftgw/ui/hviews/MryEditText;->getText()Landroid/text/Editable;

    move-result-object v0

    if-eqz v0, :cond_f

    invoke-virtual {p0}, Lim/tpelyyftgw/ui/hviews/MryEditText;->getText()Landroid/text/Editable;

    move-result-object v0

    invoke-interface {v0}, Landroid/text/Editable;->length()I

    move-result v0

    goto :goto_10

    :cond_f
    const/4 v0, 0x0

    :goto_10
    invoke-virtual {p0, v0}, Lim/tpelyyftgw/ui/hviews/MryEditText;->setSelection(I)V

    .line 140
    return-void
.end method

.method public setShowClearButton(Z)V
    .registers 5
    .param p1, "showClearButton"    # Z

    .line 187
    iput-boolean p1, p0, Lim/tpelyyftgw/ui/hviews/MryEditText;->showClearButton:Z

    .line 188
    if-eqz p1, :cond_18

    .line 189
    iget-object v0, p0, Lim/tpelyyftgw/ui/hviews/MryEditText;->detector:Landroid/view/GestureDetector;

    if-nez v0, :cond_18

    .line 190
    new-instance v0, Landroid/view/GestureDetector;

    invoke-virtual {p0}, Lim/tpelyyftgw/ui/hviews/MryEditText;->getContext()Landroid/content/Context;

    move-result-object v1

    new-instance v2, Lim/tpelyyftgw/ui/hviews/MryEditText$1;

    invoke-direct {v2, p0}, Lim/tpelyyftgw/ui/hviews/MryEditText$1;-><init>(Lim/tpelyyftgw/ui/hviews/MryEditText;)V

    invoke-direct {v0, v1, v2}, Landroid/view/GestureDetector;-><init>(Landroid/content/Context;Landroid/view/GestureDetector$OnGestureListener;)V

    iput-object v0, p0, Lim/tpelyyftgw/ui/hviews/MryEditText;->detector:Landroid/view/GestureDetector;

    .line 202
    :cond_18
    return-void
.end method

.method public setTextColor(Ljava/lang/String;)V
    .registers 3
    .param p1, "colorThemeKey"    # Ljava/lang/String;

    .line 151
    if-nez p1, :cond_3

    return-void

    .line 152
    :cond_3
    invoke-static {p1}, Lim/tpelyyftgw/ui/actionbar/Theme;->getColor(Ljava/lang/String;)I

    move-result v0

    invoke-super {p0, v0}, Landroidx/appcompat/widget/AppCompatEditText;->setTextColor(I)V

    .line 153
    return-void
.end method