AppCompatCompoundButtonHelper.smali
.class Landroidx/appcompat/widget/AppCompatCompoundButtonHelper;
.super Ljava/lang/Object;
.source "AppCompatCompoundButtonHelper.java"
# annotations
.annotation system Ldalvik/annotation/MemberClasses;
value = {
Landroidx/appcompat/widget/AppCompatCompoundButtonHelper$DirectSetButtonDrawableInterface;
}
.end annotation
# instance fields
.field private mButtonTintList:Landroid/content/res/ColorStateList;
.field private mButtonTintMode:Landroid/graphics/PorterDuff$Mode;
.field private mHasButtonTint:Z
.field private mHasButtonTintMode:Z
.field private mSkipNextApply:Z
.field private final mView:Landroid/widget/CompoundButton;
# direct methods
.method constructor <init>(Landroid/widget/CompoundButton;)V
.registers 3
.line 52
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
const/4 v0, 0x0
.line 38
iput-object v0, p0, Landroidx/appcompat/widget/AppCompatCompoundButtonHelper;->mButtonTintList:Landroid/content/res/ColorStateList;
.line 39
iput-object v0, p0, Landroidx/appcompat/widget/AppCompatCompoundButtonHelper;->mButtonTintMode:Landroid/graphics/PorterDuff$Mode;
const/4 v0, 0x0
.line 40
iput-boolean v0, p0, Landroidx/appcompat/widget/AppCompatCompoundButtonHelper;->mHasButtonTint:Z
.line 41
iput-boolean v0, p0, Landroidx/appcompat/widget/AppCompatCompoundButtonHelper;->mHasButtonTintMode:Z
.line 53
iput-object p1, p0, Landroidx/appcompat/widget/AppCompatCompoundButtonHelper;->mView:Landroid/widget/CompoundButton;
return-void
.end method
# virtual methods
.method applyButtonTint()V
.registers 3
.line 130
iget-object v0, p0, Landroidx/appcompat/widget/AppCompatCompoundButtonHelper;->mView:Landroid/widget/CompoundButton;
invoke-static {v0}, Landroidx/core/widget/CompoundButtonCompat;->getButtonDrawable(Landroid/widget/CompoundButton;)Landroid/graphics/drawable/Drawable;
move-result-object v0
if-eqz v0, :cond_3e
.line 132
iget-boolean v1, p0, Landroidx/appcompat/widget/AppCompatCompoundButtonHelper;->mHasButtonTint:Z
if-nez v1, :cond_10
iget-boolean v1, p0, Landroidx/appcompat/widget/AppCompatCompoundButtonHelper;->mHasButtonTintMode:Z
if-eqz v1, :cond_3e
.line 133
:cond_10
invoke-static {v0}, Landroidx/core/graphics/drawable/DrawableCompat;->wrap(Landroid/graphics/drawable/Drawable;)Landroid/graphics/drawable/Drawable;
move-result-object v0
.line 134
invoke-virtual {v0}, Landroid/graphics/drawable/Drawable;->mutate()Landroid/graphics/drawable/Drawable;
move-result-object v0
.line 135
iget-boolean v1, p0, Landroidx/appcompat/widget/AppCompatCompoundButtonHelper;->mHasButtonTint:Z
if-eqz v1, :cond_21
.line 136
iget-object v1, p0, Landroidx/appcompat/widget/AppCompatCompoundButtonHelper;->mButtonTintList:Landroid/content/res/ColorStateList;
invoke-static {v0, v1}, Landroidx/core/graphics/drawable/DrawableCompat;->setTintList(Landroid/graphics/drawable/Drawable;Landroid/content/res/ColorStateList;)V
.line 138
:cond_21
iget-boolean v1, p0, Landroidx/appcompat/widget/AppCompatCompoundButtonHelper;->mHasButtonTintMode:Z
if-eqz v1, :cond_2a
.line 139
iget-object v1, p0, Landroidx/appcompat/widget/AppCompatCompoundButtonHelper;->mButtonTintMode:Landroid/graphics/PorterDuff$Mode;
invoke-static {v0, v1}, Landroidx/core/graphics/drawable/DrawableCompat;->setTintMode(Landroid/graphics/drawable/Drawable;Landroid/graphics/PorterDuff$Mode;)V
.line 143
:cond_2a
invoke-virtual {v0}, Landroid/graphics/drawable/Drawable;->isStateful()Z
move-result v1
if-eqz v1, :cond_39
.line 144
iget-object v1, p0, Landroidx/appcompat/widget/AppCompatCompoundButtonHelper;->mView:Landroid/widget/CompoundButton;
invoke-virtual {v1}, Landroid/widget/CompoundButton;->getDrawableState()[I
move-result-object v1
invoke-virtual {v0, v1}, Landroid/graphics/drawable/Drawable;->setState([I)Z
.line 146
:cond_39
iget-object v1, p0, Landroidx/appcompat/widget/AppCompatCompoundButtonHelper;->mView:Landroid/widget/CompoundButton;
invoke-virtual {v1, v0}, Landroid/widget/CompoundButton;->setButtonDrawable(Landroid/graphics/drawable/Drawable;)V
:cond_3e
return-void
.end method
.method getCompoundPaddingLeft(I)I
.registers 4
.line 151
sget v0, Landroid/os/Build$VERSION;->SDK_INT:I
const/16 v1, 0x11
if-ge v0, v1, :cond_13
.line 154
iget-object v0, p0, Landroidx/appcompat/widget/AppCompatCompoundButtonHelper;->mView:Landroid/widget/CompoundButton;
invoke-static {v0}, Landroidx/core/widget/CompoundButtonCompat;->getButtonDrawable(Landroid/widget/CompoundButton;)Landroid/graphics/drawable/Drawable;
move-result-object v0
if-eqz v0, :cond_13
.line 156
invoke-virtual {v0}, Landroid/graphics/drawable/Drawable;->getIntrinsicWidth()I
move-result v0
add-int/2addr p1, v0
:cond_13
return p1
.end method
.method getSupportButtonTintList()Landroid/content/res/ColorStateList;
.registers 2
.line 105
iget-object v0, p0, Landroidx/appcompat/widget/AppCompatCompoundButtonHelper;->mButtonTintList:Landroid/content/res/ColorStateList;
return-object v0
.end method
.method getSupportButtonTintMode()Landroid/graphics/PorterDuff$Mode;
.registers 2
.line 116
iget-object v0, p0, Landroidx/appcompat/widget/AppCompatCompoundButtonHelper;->mButtonTintMode:Landroid/graphics/PorterDuff$Mode;
return-object v0
.end method
.method loadFromAttributes(Landroid/util/AttributeSet;I)V
.registers 6
.line 57
iget-object v0, p0, Landroidx/appcompat/widget/AppCompatCompoundButtonHelper;->mView:Landroid/widget/CompoundButton;
invoke-virtual {v0}, Landroid/widget/CompoundButton;->getContext()Landroid/content/Context;
move-result-object v0
sget-object v1, Landroidx/appcompat/R$styleable;->CompoundButton:[I
const/4 v2, 0x0
invoke-virtual {v0, p1, v1, p2, v2}, Landroid/content/Context;->obtainStyledAttributes(Landroid/util/AttributeSet;[III)Landroid/content/res/TypedArray;
move-result-object p1
.line 61
:try_start_d
sget p2, Landroidx/appcompat/R$styleable;->CompoundButton_buttonCompat:I
invoke-virtual {p1, p2}, Landroid/content/res/TypedArray;->hasValue(I)Z
move-result p2
if-eqz p2, :cond_2c
.line 62
sget p2, Landroidx/appcompat/R$styleable;->CompoundButton_buttonCompat:I
invoke-virtual {p1, p2, v2}, Landroid/content/res/TypedArray;->getResourceId(II)I
move-result p2
:try_end_1b
.catchall {:try_start_d .. :try_end_1b} :catchall_7c
if-eqz p2, :cond_2c
.line 65
:try_start_1d
iget-object v0, p0, Landroidx/appcompat/widget/AppCompatCompoundButtonHelper;->mView:Landroid/widget/CompoundButton;
.line 66
invoke-virtual {v0}, Landroid/widget/CompoundButton;->getContext()Landroid/content/Context;
move-result-object v1
invoke-static {v1, p2}, Landroidx/appcompat/content/res/AppCompatResources;->getDrawable(Landroid/content/Context;I)Landroid/graphics/drawable/Drawable;
move-result-object p2
.line 65
invoke-virtual {v0, p2}, Landroid/widget/CompoundButton;->setButtonDrawable(Landroid/graphics/drawable/Drawable;)V
:try_end_2a
.catch Landroid/content/res/Resources$NotFoundException; {:try_start_1d .. :try_end_2a} :catch_2c
.catchall {:try_start_1d .. :try_end_2a} :catchall_7c
const/4 p2, 0x1
goto :goto_2d
:catch_2c
:cond_2c
const/4 p2, 0x0
:goto_2d
if-nez p2, :cond_4c
.line 74
:try_start_2f
sget p2, Landroidx/appcompat/R$styleable;->CompoundButton_android_button:I
invoke-virtual {p1, p2}, Landroid/content/res/TypedArray;->hasValue(I)Z
move-result p2
if-eqz p2, :cond_4c
.line 75
sget p2, Landroidx/appcompat/R$styleable;->CompoundButton_android_button:I
invoke-virtual {p1, p2, v2}, Landroid/content/res/TypedArray;->getResourceId(II)I
move-result p2
if-eqz p2, :cond_4c
.line 78
iget-object v0, p0, Landroidx/appcompat/widget/AppCompatCompoundButtonHelper;->mView:Landroid/widget/CompoundButton;
.line 79
invoke-virtual {v0}, Landroid/widget/CompoundButton;->getContext()Landroid/content/Context;
move-result-object v1
invoke-static {v1, p2}, Landroidx/appcompat/content/res/AppCompatResources;->getDrawable(Landroid/content/Context;I)Landroid/graphics/drawable/Drawable;
move-result-object p2
.line 78
invoke-virtual {v0, p2}, Landroid/widget/CompoundButton;->setButtonDrawable(Landroid/graphics/drawable/Drawable;)V
.line 82
:cond_4c
sget p2, Landroidx/appcompat/R$styleable;->CompoundButton_buttonTint:I
invoke-virtual {p1, p2}, Landroid/content/res/TypedArray;->hasValue(I)Z
move-result p2
if-eqz p2, :cond_5f
.line 83
iget-object p2, p0, Landroidx/appcompat/widget/AppCompatCompoundButtonHelper;->mView:Landroid/widget/CompoundButton;
sget v0, Landroidx/appcompat/R$styleable;->CompoundButton_buttonTint:I
.line 84
invoke-virtual {p1, v0}, Landroid/content/res/TypedArray;->getColorStateList(I)Landroid/content/res/ColorStateList;
move-result-object v0
.line 83
invoke-static {p2, v0}, Landroidx/core/widget/CompoundButtonCompat;->setButtonTintList(Landroid/widget/CompoundButton;Landroid/content/res/ColorStateList;)V
.line 86
:cond_5f
sget p2, Landroidx/appcompat/R$styleable;->CompoundButton_buttonTintMode:I
invoke-virtual {p1, p2}, Landroid/content/res/TypedArray;->hasValue(I)Z
move-result p2
if-eqz p2, :cond_78
.line 87
iget-object p2, p0, Landroidx/appcompat/widget/AppCompatCompoundButtonHelper;->mView:Landroid/widget/CompoundButton;
sget v0, Landroidx/appcompat/R$styleable;->CompoundButton_buttonTintMode:I
const/4 v1, -0x1
.line 89
invoke-virtual {p1, v0, v1}, Landroid/content/res/TypedArray;->getInt(II)I
move-result v0
const/4 v1, 0x0
.line 88
invoke-static {v0, v1}, Landroidx/appcompat/widget/DrawableUtils;->parseTintMode(ILandroid/graphics/PorterDuff$Mode;)Landroid/graphics/PorterDuff$Mode;
move-result-object v0
.line 87
invoke-static {p2, v0}, Landroidx/core/widget/CompoundButtonCompat;->setButtonTintMode(Landroid/widget/CompoundButton;Landroid/graphics/PorterDuff$Mode;)V
:try_end_78
.catchall {:try_start_2f .. :try_end_78} :catchall_7c
.line 93
:cond_78
invoke-virtual {p1}, Landroid/content/res/TypedArray;->recycle()V
return-void
:catchall_7c
move-exception p2
invoke-virtual {p1}, Landroid/content/res/TypedArray;->recycle()V
.line 94
throw p2
.end method
.method onSetButtonDrawable()V
.registers 2
.line 120
iget-boolean v0, p0, Landroidx/appcompat/widget/AppCompatCompoundButtonHelper;->mSkipNextApply:Z
if-eqz v0, :cond_8
const/4 v0, 0x0
.line 121
iput-boolean v0, p0, Landroidx/appcompat/widget/AppCompatCompoundButtonHelper;->mSkipNextApply:Z
return-void
:cond_8
const/4 v0, 0x1
.line 125
iput-boolean v0, p0, Landroidx/appcompat/widget/AppCompatCompoundButtonHelper;->mSkipNextApply:Z
.line 126
invoke-virtual {p0}, Landroidx/appcompat/widget/AppCompatCompoundButtonHelper;->applyButtonTint()V
return-void
.end method
.method setSupportButtonTintList(Landroid/content/res/ColorStateList;)V
.registers 2
.line 98
iput-object p1, p0, Landroidx/appcompat/widget/AppCompatCompoundButtonHelper;->mButtonTintList:Landroid/content/res/ColorStateList;
const/4 p1, 0x1
.line 99
iput-boolean p1, p0, Landroidx/appcompat/widget/AppCompatCompoundButtonHelper;->mHasButtonTint:Z
.line 101
invoke-virtual {p0}, Landroidx/appcompat/widget/AppCompatCompoundButtonHelper;->applyButtonTint()V
return-void
.end method
.method setSupportButtonTintMode(Landroid/graphics/PorterDuff$Mode;)V
.registers 2
.line 109
iput-object p1, p0, Landroidx/appcompat/widget/AppCompatCompoundButtonHelper;->mButtonTintMode:Landroid/graphics/PorterDuff$Mode;
const/4 p1, 0x1
.line 110
iput-boolean p1, p0, Landroidx/appcompat/widget/AppCompatCompoundButtonHelper;->mHasButtonTintMode:Z
.line 112
invoke-virtual {p0}, Landroidx/appcompat/widget/AppCompatCompoundButtonHelper;->applyButtonTint()V
return-void
.end method