230 lines
6.0 KiB
Smali
230 lines
6.0 KiB
Smali
.class public Lcom/my/target/BorderedTextView;
|
|
.super Landroid/widget/TextView;
|
|
.source "BorderedTextView.java"
|
|
|
|
|
|
# annotations
|
|
.annotation build Landroid/annotation/SuppressLint;
|
|
value = {
|
|
"AppCompatCustomView"
|
|
}
|
|
.end annotation
|
|
|
|
|
|
# instance fields
|
|
.field private final a:Landroid/graphics/drawable/GradientDrawable;
|
|
.annotation build Landroidx/annotation/NonNull;
|
|
.end annotation
|
|
.end field
|
|
|
|
.field private final b:I
|
|
|
|
|
|
# direct methods
|
|
.method public constructor <init>(Landroid/content/Context;)V
|
|
.locals 1
|
|
.param p1 # Landroid/content/Context;
|
|
.annotation build Landroidx/annotation/NonNull;
|
|
.end annotation
|
|
.end param
|
|
|
|
const/4 v0, 0x0
|
|
|
|
.line 1
|
|
invoke-direct {p0, p1, v0}, Lcom/my/target/BorderedTextView;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
|
|
.locals 1
|
|
.param p1 # Landroid/content/Context;
|
|
.annotation build Landroidx/annotation/NonNull;
|
|
.end annotation
|
|
.end param
|
|
.param p2 # Landroid/util/AttributeSet;
|
|
.annotation build Landroidx/annotation/Nullable;
|
|
.end annotation
|
|
.end param
|
|
|
|
const/4 v0, 0x0
|
|
|
|
.line 2
|
|
invoke-direct {p0, p1, p2, v0}, Lcom/my/target/BorderedTextView;-><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 1
|
|
.param p1 # Landroid/content/Context;
|
|
.annotation build Landroidx/annotation/NonNull;
|
|
.end annotation
|
|
.end param
|
|
.param p2 # Landroid/util/AttributeSet;
|
|
.annotation build Landroidx/annotation/Nullable;
|
|
.end annotation
|
|
.end param
|
|
|
|
.line 3
|
|
invoke-direct {p0, p1, p2, p3}, Landroid/widget/TextView;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V
|
|
|
|
.line 4
|
|
new-instance p2, Landroid/graphics/drawable/GradientDrawable;
|
|
|
|
invoke-direct {p2}, Landroid/graphics/drawable/GradientDrawable;-><init>()V
|
|
|
|
iput-object p2, p0, Lcom/my/target/BorderedTextView;->a:Landroid/graphics/drawable/GradientDrawable;
|
|
|
|
.line 5
|
|
iget-object p2, p0, Lcom/my/target/BorderedTextView;->a:Landroid/graphics/drawable/GradientDrawable;
|
|
|
|
const/4 p3, 0x0
|
|
|
|
const v0, -0xcccccd
|
|
|
|
invoke-virtual {p2, p3, v0}, Landroid/graphics/drawable/GradientDrawable;->setStroke(II)V
|
|
|
|
.line 6
|
|
iget-object p2, p0, Lcom/my/target/BorderedTextView;->a:Landroid/graphics/drawable/GradientDrawable;
|
|
|
|
invoke-virtual {p2, p3}, Landroid/graphics/drawable/GradientDrawable;->setColor(I)V
|
|
|
|
.line 7
|
|
invoke-virtual {p1}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;
|
|
|
|
move-result-object p1
|
|
|
|
.line 8
|
|
invoke-virtual {p1}, Landroid/content/res/Resources;->getDisplayMetrics()Landroid/util/DisplayMetrics;
|
|
|
|
move-result-object p1
|
|
|
|
const/4 p2, 0x1
|
|
|
|
const/high16 p3, 0x40000000 # 2.0f
|
|
|
|
invoke-static {p2, p3, p1}, Landroid/util/TypedValue;->applyDimension(IFLandroid/util/DisplayMetrics;)F
|
|
|
|
move-result p1
|
|
|
|
float-to-int p1, p1
|
|
|
|
iput p1, p0, Lcom/my/target/BorderedTextView;->b:I
|
|
|
|
return-void
|
|
.end method
|
|
|
|
|
|
# virtual methods
|
|
.method public a(II)V
|
|
.locals 1
|
|
|
|
const/4 v0, 0x0
|
|
|
|
.line 1
|
|
invoke-virtual {p0, p1, p2, v0}, Lcom/my/target/BorderedTextView;->a(III)V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public a(III)V
|
|
.locals 1
|
|
|
|
.line 2
|
|
iget-object v0, p0, Lcom/my/target/BorderedTextView;->a:Landroid/graphics/drawable/GradientDrawable;
|
|
|
|
invoke-virtual {v0, p1, p2}, Landroid/graphics/drawable/GradientDrawable;->setStroke(II)V
|
|
|
|
.line 3
|
|
iget-object p1, p0, Lcom/my/target/BorderedTextView;->a:Landroid/graphics/drawable/GradientDrawable;
|
|
|
|
int-to-float p2, p3
|
|
|
|
invoke-virtual {p1, p2}, Landroid/graphics/drawable/GradientDrawable;->setCornerRadius(F)V
|
|
|
|
.line 4
|
|
invoke-virtual {p0}, Landroid/widget/TextView;->invalidate()V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method protected onDraw(Landroid/graphics/Canvas;)V
|
|
.locals 5
|
|
|
|
.line 1
|
|
iget-object v0, p0, Lcom/my/target/BorderedTextView;->a:Landroid/graphics/drawable/GradientDrawable;
|
|
|
|
invoke-virtual {p0}, Landroid/widget/TextView;->getPaddingLeft()I
|
|
|
|
move-result v1
|
|
|
|
iget v2, p0, Lcom/my/target/BorderedTextView;->b:I
|
|
|
|
sub-int/2addr v1, v2
|
|
|
|
invoke-virtual {p0}, Landroid/widget/TextView;->getPaddingTop()I
|
|
|
|
move-result v2
|
|
|
|
invoke-virtual {p0}, Landroid/widget/TextView;->getWidth()I
|
|
|
|
move-result v3
|
|
|
|
invoke-virtual {p0}, Landroid/widget/TextView;->getHeight()I
|
|
|
|
move-result v4
|
|
|
|
invoke-virtual {v0, v1, v2, v3, v4}, Landroid/graphics/drawable/GradientDrawable;->setBounds(IIII)V
|
|
|
|
.line 2
|
|
iget-object v0, p0, Lcom/my/target/BorderedTextView;->a:Landroid/graphics/drawable/GradientDrawable;
|
|
|
|
invoke-virtual {v0, p1}, Landroid/graphics/drawable/GradientDrawable;->draw(Landroid/graphics/Canvas;)V
|
|
|
|
.line 3
|
|
invoke-super {p0, p1}, Landroid/widget/TextView;->onDraw(Landroid/graphics/Canvas;)V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method protected onMeasure(II)V
|
|
.locals 0
|
|
|
|
.line 1
|
|
invoke-super {p0, p1, p2}, Landroid/widget/TextView;->onMeasure(II)V
|
|
|
|
.line 2
|
|
invoke-virtual {p0}, Landroid/widget/TextView;->getMeasuredWidth()I
|
|
|
|
move-result p1
|
|
|
|
iget p2, p0, Lcom/my/target/BorderedTextView;->b:I
|
|
|
|
mul-int/lit8 p2, p2, 0x2
|
|
|
|
add-int/2addr p1, p2
|
|
|
|
invoke-virtual {p0}, Landroid/widget/TextView;->getMeasuredHeight()I
|
|
|
|
move-result p2
|
|
|
|
invoke-virtual {p0, p1, p2}, Landroid/widget/TextView;->setMeasuredDimension(II)V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public setBackgroundColor(I)V
|
|
.locals 1
|
|
|
|
.line 1
|
|
iget-object v0, p0, Lcom/my/target/BorderedTextView;->a:Landroid/graphics/drawable/GradientDrawable;
|
|
|
|
invoke-virtual {v0, p1}, Landroid/graphics/drawable/GradientDrawable;->setColor(I)V
|
|
|
|
.line 2
|
|
invoke-virtual {p0}, Landroid/widget/TextView;->invalidate()V
|
|
|
|
return-void
|
|
.end method
|