598 lines
12 KiB
Smali
598 lines
12 KiB
Smali
.class public Lcom/moji/AutoResizeTextView;
|
|
.super Landroid/widget/TextView;
|
|
.source "AutoResizeTextView.java"
|
|
|
|
|
|
# annotations
|
|
.annotation system Ldalvik/annotation/MemberClasses;
|
|
value = {
|
|
Lcom/moji/AutoResizeTextView$SizeTester;
|
|
}
|
|
.end annotation
|
|
|
|
|
|
# instance fields
|
|
.field private final a:Landroid/graphics/RectF;
|
|
|
|
.field private final b:Lcom/moji/AutoResizeTextView$SizeTester;
|
|
|
|
.field private c:F
|
|
|
|
.field private d:F
|
|
|
|
.field private e:F
|
|
|
|
.field private f:F
|
|
|
|
.field private g:I
|
|
|
|
.field private h:I
|
|
|
|
.field private i:Z
|
|
|
|
.field private j:Landroid/text/TextPaint;
|
|
|
|
|
|
# direct methods
|
|
.method public constructor <init>(Landroid/content/Context;)V
|
|
.locals 2
|
|
|
|
const/4 v0, 0x0
|
|
|
|
const v1, 0x1010084
|
|
|
|
.line 45
|
|
invoke-direct {p0, p1, v0, v1}, Lcom/moji/AutoResizeTextView;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
|
|
.locals 1
|
|
|
|
const v0, 0x1010084
|
|
|
|
.line 49
|
|
invoke-direct {p0, p1, p2, v0}, Lcom/moji/AutoResizeTextView;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V
|
|
.locals 0
|
|
|
|
.line 53
|
|
invoke-direct {p0, p1, p2, p3}, Landroid/widget/TextView;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V
|
|
|
|
.line 26
|
|
new-instance p1, Landroid/graphics/RectF;
|
|
|
|
invoke-direct {p1}, Landroid/graphics/RectF;-><init>()V
|
|
|
|
iput-object p1, p0, Lcom/moji/AutoResizeTextView;->a:Landroid/graphics/RectF;
|
|
|
|
const/high16 p1, 0x3f800000 # 1.0f
|
|
|
|
.line 28
|
|
iput p1, p0, Lcom/moji/AutoResizeTextView;->d:F
|
|
|
|
const/4 p1, 0x0
|
|
|
|
iput p1, p0, Lcom/moji/AutoResizeTextView;->e:F
|
|
|
|
const/4 p1, 0x0
|
|
|
|
.line 30
|
|
iput-boolean p1, p0, Lcom/moji/AutoResizeTextView;->i:Z
|
|
|
|
.line 55
|
|
invoke-virtual {p0}, Lcom/moji/AutoResizeTextView;->getResources()Landroid/content/res/Resources;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-virtual {p1}, Landroid/content/res/Resources;->getDisplayMetrics()Landroid/util/DisplayMetrics;
|
|
|
|
move-result-object p1
|
|
|
|
const/4 p2, 0x2
|
|
|
|
const/high16 p3, 0x41000000 # 8.0f
|
|
|
|
invoke-static {p2, p3, p1}, Landroid/util/TypedValue;->applyDimension(IFLandroid/util/DisplayMetrics;)F
|
|
|
|
move-result p1
|
|
|
|
iput p1, p0, Lcom/moji/AutoResizeTextView;->f:F
|
|
|
|
.line 56
|
|
invoke-virtual {p0}, Lcom/moji/AutoResizeTextView;->getTextSize()F
|
|
|
|
move-result p1
|
|
|
|
iput p1, p0, Lcom/moji/AutoResizeTextView;->c:F
|
|
|
|
.line 57
|
|
new-instance p1, Landroid/text/TextPaint;
|
|
|
|
invoke-virtual {p0}, Lcom/moji/AutoResizeTextView;->getPaint()Landroid/text/TextPaint;
|
|
|
|
move-result-object p2
|
|
|
|
invoke-direct {p1, p2}, Landroid/text/TextPaint;-><init>(Landroid/graphics/Paint;)V
|
|
|
|
iput-object p1, p0, Lcom/moji/AutoResizeTextView;->j:Landroid/text/TextPaint;
|
|
|
|
.line 58
|
|
iget p1, p0, Lcom/moji/AutoResizeTextView;->h:I
|
|
|
|
if-nez p1, :cond_0
|
|
|
|
const/4 p1, -0x1
|
|
|
|
.line 60
|
|
iput p1, p0, Lcom/moji/AutoResizeTextView;->h:I
|
|
|
|
.line 62
|
|
:cond_0
|
|
new-instance p1, Lcom/moji/AutoResizeTextView$1;
|
|
|
|
invoke-direct {p1, p0}, Lcom/moji/AutoResizeTextView$1;-><init>(Lcom/moji/AutoResizeTextView;)V
|
|
|
|
iput-object p1, p0, Lcom/moji/AutoResizeTextView;->b:Lcom/moji/AutoResizeTextView$SizeTester;
|
|
|
|
const/4 p1, 0x1
|
|
|
|
.line 107
|
|
iput-boolean p1, p0, Lcom/moji/AutoResizeTextView;->i:Z
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method private a(IILcom/moji/AutoResizeTextView$SizeTester;Landroid/graphics/RectF;)I
|
|
.locals 3
|
|
|
|
add-int/lit8 p2, p2, -0x1
|
|
|
|
move v0, p1
|
|
|
|
:goto_0
|
|
if-gt p1, p2, :cond_2
|
|
|
|
add-int v0, p1, p2
|
|
|
|
ushr-int/lit8 v0, v0, 0x1
|
|
|
|
.line 227
|
|
invoke-interface {p3, v0, p4}, Lcom/moji/AutoResizeTextView$SizeTester;->a(ILandroid/graphics/RectF;)I
|
|
|
|
move-result v1
|
|
|
|
if-gez v1, :cond_0
|
|
|
|
add-int/lit8 v0, v0, 0x1
|
|
|
|
move v2, v0
|
|
|
|
move v0, p1
|
|
|
|
move p1, v2
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
if-lez v1, :cond_1
|
|
|
|
add-int/lit8 v0, v0, -0x1
|
|
|
|
move p2, v0
|
|
|
|
goto :goto_0
|
|
|
|
:cond_1
|
|
return v0
|
|
|
|
:cond_2
|
|
return v0
|
|
.end method
|
|
|
|
.method static synthetic a(Lcom/moji/AutoResizeTextView;)Landroid/text/TextPaint;
|
|
.locals 0
|
|
|
|
.line 24
|
|
iget-object p0, p0, Lcom/moji/AutoResizeTextView;->j:Landroid/text/TextPaint;
|
|
|
|
return-object p0
|
|
.end method
|
|
|
|
.method private a()V
|
|
.locals 4
|
|
|
|
.line 203
|
|
iget-boolean v0, p0, Lcom/moji/AutoResizeTextView;->i:Z
|
|
|
|
if-nez v0, :cond_0
|
|
|
|
return-void
|
|
|
|
.line 205
|
|
:cond_0
|
|
iget v0, p0, Lcom/moji/AutoResizeTextView;->f:F
|
|
|
|
float-to-int v0, v0
|
|
|
|
.line 206
|
|
invoke-virtual {p0}, Lcom/moji/AutoResizeTextView;->getMeasuredHeight()I
|
|
|
|
move-result v1
|
|
|
|
invoke-virtual {p0}, Lcom/moji/AutoResizeTextView;->getCompoundPaddingBottom()I
|
|
|
|
move-result v2
|
|
|
|
sub-int/2addr v1, v2
|
|
|
|
invoke-virtual {p0}, Lcom/moji/AutoResizeTextView;->getCompoundPaddingTop()I
|
|
|
|
move-result v2
|
|
|
|
sub-int/2addr v1, v2
|
|
|
|
.line 207
|
|
invoke-virtual {p0}, Lcom/moji/AutoResizeTextView;->getMeasuredWidth()I
|
|
|
|
move-result v2
|
|
|
|
invoke-virtual {p0}, Lcom/moji/AutoResizeTextView;->getCompoundPaddingLeft()I
|
|
|
|
move-result v3
|
|
|
|
sub-int/2addr v2, v3
|
|
|
|
invoke-virtual {p0}, Lcom/moji/AutoResizeTextView;->getCompoundPaddingRight()I
|
|
|
|
move-result v3
|
|
|
|
sub-int/2addr v2, v3
|
|
|
|
iput v2, p0, Lcom/moji/AutoResizeTextView;->g:I
|
|
|
|
.line 208
|
|
iget v2, p0, Lcom/moji/AutoResizeTextView;->g:I
|
|
|
|
if-gtz v2, :cond_1
|
|
|
|
return-void
|
|
|
|
.line 210
|
|
:cond_1
|
|
new-instance v2, Landroid/text/TextPaint;
|
|
|
|
invoke-virtual {p0}, Lcom/moji/AutoResizeTextView;->getPaint()Landroid/text/TextPaint;
|
|
|
|
move-result-object v3
|
|
|
|
invoke-direct {v2, v3}, Landroid/text/TextPaint;-><init>(Landroid/graphics/Paint;)V
|
|
|
|
iput-object v2, p0, Lcom/moji/AutoResizeTextView;->j:Landroid/text/TextPaint;
|
|
|
|
.line 211
|
|
iget-object v2, p0, Lcom/moji/AutoResizeTextView;->a:Landroid/graphics/RectF;
|
|
|
|
iget v3, p0, Lcom/moji/AutoResizeTextView;->g:I
|
|
|
|
int-to-float v3, v3
|
|
|
|
iput v3, v2, Landroid/graphics/RectF;->right:F
|
|
|
|
.line 212
|
|
iget-object v2, p0, Lcom/moji/AutoResizeTextView;->a:Landroid/graphics/RectF;
|
|
|
|
int-to-float v1, v1
|
|
|
|
iput v1, v2, Landroid/graphics/RectF;->bottom:F
|
|
|
|
.line 213
|
|
invoke-direct {p0, v0}, Lcom/moji/AutoResizeTextView;->a(I)V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method private a(I)V
|
|
.locals 3
|
|
|
|
.line 219
|
|
iget v0, p0, Lcom/moji/AutoResizeTextView;->c:F
|
|
|
|
float-to-int v0, v0
|
|
|
|
iget-object v1, p0, Lcom/moji/AutoResizeTextView;->b:Lcom/moji/AutoResizeTextView$SizeTester;
|
|
|
|
iget-object v2, p0, Lcom/moji/AutoResizeTextView;->a:Landroid/graphics/RectF;
|
|
|
|
invoke-direct {p0, p1, v0, v1, v2}, Lcom/moji/AutoResizeTextView;->a(IILcom/moji/AutoResizeTextView$SizeTester;Landroid/graphics/RectF;)I
|
|
|
|
move-result p1
|
|
|
|
int-to-float p1, p1
|
|
|
|
const/4 v0, 0x0
|
|
|
|
.line 220
|
|
invoke-super {p0, v0, p1}, Landroid/widget/TextView;->setTextSize(IF)V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method static synthetic b(Lcom/moji/AutoResizeTextView;)I
|
|
.locals 0
|
|
|
|
.line 24
|
|
iget p0, p0, Lcom/moji/AutoResizeTextView;->g:I
|
|
|
|
return p0
|
|
.end method
|
|
|
|
.method static synthetic c(Lcom/moji/AutoResizeTextView;)F
|
|
.locals 0
|
|
|
|
.line 24
|
|
iget p0, p0, Lcom/moji/AutoResizeTextView;->d:F
|
|
|
|
return p0
|
|
.end method
|
|
|
|
.method static synthetic d(Lcom/moji/AutoResizeTextView;)F
|
|
.locals 0
|
|
|
|
.line 24
|
|
iget p0, p0, Lcom/moji/AutoResizeTextView;->e:F
|
|
|
|
return p0
|
|
.end method
|
|
|
|
|
|
# virtual methods
|
|
.method public a(CC)Z
|
|
.locals 0
|
|
|
|
const/16 p2, 0x20
|
|
|
|
if-eq p1, p2, :cond_1
|
|
|
|
const/16 p2, 0x2d
|
|
|
|
if-ne p1, p2, :cond_0
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
const/4 p1, 0x0
|
|
|
|
goto :goto_1
|
|
|
|
:cond_1
|
|
:goto_0
|
|
const/4 p1, 0x1
|
|
|
|
:goto_1
|
|
return p1
|
|
.end method
|
|
|
|
.method public getMaxLines()I
|
|
.locals 1
|
|
|
|
.line 141
|
|
iget v0, p0, Lcom/moji/AutoResizeTextView;->h:I
|
|
|
|
return v0
|
|
.end method
|
|
|
|
.method protected onSizeChanged(IIII)V
|
|
.locals 0
|
|
|
|
.line 249
|
|
invoke-super {p0, p1, p2, p3, p4}, Landroid/widget/TextView;->onSizeChanged(IIII)V
|
|
|
|
if-ne p1, p3, :cond_0
|
|
|
|
if-eq p2, p4, :cond_1
|
|
|
|
.line 251
|
|
:cond_0
|
|
invoke-direct {p0}, Lcom/moji/AutoResizeTextView;->a()V
|
|
|
|
:cond_1
|
|
return-void
|
|
.end method
|
|
|
|
.method protected onTextChanged(Ljava/lang/CharSequence;III)V
|
|
.locals 0
|
|
|
|
.line 243
|
|
invoke-super {p0, p1, p2, p3, p4}, Landroid/widget/TextView;->onTextChanged(Ljava/lang/CharSequence;III)V
|
|
|
|
.line 244
|
|
invoke-direct {p0}, Lcom/moji/AutoResizeTextView;->a()V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public setAllCaps(Z)V
|
|
.locals 0
|
|
|
|
.line 116
|
|
invoke-super {p0, p1}, Landroid/widget/TextView;->setAllCaps(Z)V
|
|
|
|
.line 117
|
|
invoke-direct {p0}, Lcom/moji/AutoResizeTextView;->a()V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public setLineSpacing(FF)V
|
|
.locals 0
|
|
|
|
.line 180
|
|
invoke-super {p0, p1, p2}, Landroid/widget/TextView;->setLineSpacing(FF)V
|
|
|
|
.line 181
|
|
iput p2, p0, Lcom/moji/AutoResizeTextView;->d:F
|
|
|
|
.line 182
|
|
iput p1, p0, Lcom/moji/AutoResizeTextView;->e:F
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public setLines(I)V
|
|
.locals 0
|
|
|
|
.line 162
|
|
invoke-super {p0, p1}, Landroid/widget/TextView;->setLines(I)V
|
|
|
|
.line 163
|
|
iput p1, p0, Lcom/moji/AutoResizeTextView;->h:I
|
|
|
|
.line 164
|
|
invoke-direct {p0}, Lcom/moji/AutoResizeTextView;->a()V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public setMaxLines(I)V
|
|
.locals 0
|
|
|
|
.line 134
|
|
invoke-super {p0, p1}, Landroid/widget/TextView;->setMaxLines(I)V
|
|
|
|
.line 135
|
|
iput p1, p0, Lcom/moji/AutoResizeTextView;->h:I
|
|
|
|
.line 136
|
|
invoke-direct {p0}, Lcom/moji/AutoResizeTextView;->a()V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public setMinTextSize(F)V
|
|
.locals 0
|
|
|
|
.line 191
|
|
iput p1, p0, Lcom/moji/AutoResizeTextView;->f:F
|
|
|
|
.line 192
|
|
invoke-direct {p0}, Lcom/moji/AutoResizeTextView;->a()V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public setSingleLine()V
|
|
.locals 1
|
|
|
|
.line 146
|
|
invoke-super {p0}, Landroid/widget/TextView;->setSingleLine()V
|
|
|
|
const/4 v0, 0x1
|
|
|
|
.line 147
|
|
iput v0, p0, Lcom/moji/AutoResizeTextView;->h:I
|
|
|
|
.line 148
|
|
invoke-direct {p0}, Lcom/moji/AutoResizeTextView;->a()V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public setSingleLine(Z)V
|
|
.locals 0
|
|
|
|
.line 153
|
|
invoke-super {p0, p1}, Landroid/widget/TextView;->setSingleLine(Z)V
|
|
|
|
if-eqz p1, :cond_0
|
|
|
|
const/4 p1, 0x1
|
|
|
|
.line 155
|
|
iput p1, p0, Lcom/moji/AutoResizeTextView;->h:I
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
const/4 p1, -0x1
|
|
|
|
.line 156
|
|
iput p1, p0, Lcom/moji/AutoResizeTextView;->h:I
|
|
|
|
.line 157
|
|
:goto_0
|
|
invoke-direct {p0}, Lcom/moji/AutoResizeTextView;->a()V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public setTextSize(F)V
|
|
.locals 0
|
|
|
|
.line 128
|
|
iput p1, p0, Lcom/moji/AutoResizeTextView;->c:F
|
|
|
|
.line 129
|
|
invoke-direct {p0}, Lcom/moji/AutoResizeTextView;->a()V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public setTextSize(IF)V
|
|
.locals 1
|
|
|
|
.line 169
|
|
invoke-virtual {p0}, Lcom/moji/AutoResizeTextView;->getContext()Landroid/content/Context;
|
|
|
|
move-result-object v0
|
|
|
|
if-nez v0, :cond_0
|
|
|
|
.line 172
|
|
invoke-static {}, Landroid/content/res/Resources;->getSystem()Landroid/content/res/Resources;
|
|
|
|
move-result-object v0
|
|
|
|
goto :goto_0
|
|
|
|
.line 173
|
|
:cond_0
|
|
invoke-virtual {v0}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;
|
|
|
|
move-result-object v0
|
|
|
|
.line 174
|
|
:goto_0
|
|
invoke-virtual {v0}, Landroid/content/res/Resources;->getDisplayMetrics()Landroid/util/DisplayMetrics;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-static {p1, p2, v0}, Landroid/util/TypedValue;->applyDimension(IFLandroid/util/DisplayMetrics;)F
|
|
|
|
move-result p1
|
|
|
|
iput p1, p0, Lcom/moji/AutoResizeTextView;->c:F
|
|
|
|
.line 175
|
|
invoke-direct {p0}, Lcom/moji/AutoResizeTextView;->a()V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public setTypeface(Landroid/graphics/Typeface;)V
|
|
.locals 0
|
|
|
|
.line 122
|
|
invoke-super {p0, p1}, Landroid/widget/TextView;->setTypeface(Landroid/graphics/Typeface;)V
|
|
|
|
.line 123
|
|
invoke-direct {p0}, Lcom/moji/AutoResizeTextView;->a()V
|
|
|
|
return-void
|
|
.end method
|