258 lines
7 KiB
Smali
258 lines
7 KiB
Smali
.class public final Landroidx/core/widget/CompoundButtonCompat;
|
|
.super Ljava/lang/Object;
|
|
.source "CompoundButtonCompat.java"
|
|
|
|
|
|
# static fields
|
|
.field private static final TAG:Ljava/lang/String; = "CompoundButtonCompat"
|
|
|
|
.field private static sButtonDrawableField:Ljava/lang/reflect/Field;
|
|
|
|
.field private static sButtonDrawableFieldFetched:Z
|
|
|
|
|
|
# direct methods
|
|
.method private constructor <init>()V
|
|
.locals 0
|
|
|
|
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public static getButtonDrawable(Landroid/widget/CompoundButton;)Landroid/graphics/drawable/Drawable;
|
|
.locals 4
|
|
.param p0 # Landroid/widget/CompoundButton;
|
|
.annotation build Landroidx/annotation/NonNull;
|
|
.end annotation
|
|
.end param
|
|
.annotation build Landroidx/annotation/Nullable;
|
|
.end annotation
|
|
|
|
sget v0, Landroid/os/Build$VERSION;->SDK_INT:I
|
|
|
|
const/16 v1, 0x17
|
|
|
|
if-lt v0, v1, :cond_0
|
|
|
|
invoke-virtual {p0}, Landroid/widget/CompoundButton;->getButtonDrawable()Landroid/graphics/drawable/Drawable;
|
|
|
|
move-result-object p0
|
|
|
|
return-object p0
|
|
|
|
:cond_0
|
|
sget-boolean v0, Landroidx/core/widget/CompoundButtonCompat;->sButtonDrawableFieldFetched:Z
|
|
|
|
const-string v1, "CompoundButtonCompat"
|
|
|
|
if-nez v0, :cond_1
|
|
|
|
const/4 v0, 0x1
|
|
|
|
:try_start_0
|
|
const-class v2, Landroid/widget/CompoundButton;
|
|
|
|
const-string v3, "mButtonDrawable"
|
|
|
|
invoke-virtual {v2, v3}, Ljava/lang/Class;->getDeclaredField(Ljava/lang/String;)Ljava/lang/reflect/Field;
|
|
|
|
move-result-object v2
|
|
|
|
sput-object v2, Landroidx/core/widget/CompoundButtonCompat;->sButtonDrawableField:Ljava/lang/reflect/Field;
|
|
|
|
invoke-virtual {v2, v0}, Ljava/lang/reflect/Field;->setAccessible(Z)V
|
|
:try_end_0
|
|
.catch Ljava/lang/NoSuchFieldException; {:try_start_0 .. :try_end_0} :catch_0
|
|
|
|
goto :goto_0
|
|
|
|
:catch_0
|
|
move-exception v2
|
|
|
|
const-string v3, "Failed to retrieve mButtonDrawable field"
|
|
|
|
invoke-static {v1, v3, v2}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
|
|
|
|
:goto_0
|
|
sput-boolean v0, Landroidx/core/widget/CompoundButtonCompat;->sButtonDrawableFieldFetched:Z
|
|
|
|
:cond_1
|
|
sget-object v0, Landroidx/core/widget/CompoundButtonCompat;->sButtonDrawableField:Ljava/lang/reflect/Field;
|
|
|
|
const/4 v2, 0x0
|
|
|
|
if-eqz v0, :cond_2
|
|
|
|
:try_start_1
|
|
invoke-virtual {v0, p0}, Ljava/lang/reflect/Field;->get(Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
move-result-object p0
|
|
|
|
check-cast p0, Landroid/graphics/drawable/Drawable;
|
|
:try_end_1
|
|
.catch Ljava/lang/IllegalAccessException; {:try_start_1 .. :try_end_1} :catch_1
|
|
|
|
return-object p0
|
|
|
|
:catch_1
|
|
move-exception p0
|
|
|
|
const-string v0, "Failed to get button drawable via reflection"
|
|
|
|
invoke-static {v1, v0, p0}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
|
|
|
|
sput-object v2, Landroidx/core/widget/CompoundButtonCompat;->sButtonDrawableField:Ljava/lang/reflect/Field;
|
|
|
|
:cond_2
|
|
return-object v2
|
|
.end method
|
|
|
|
.method public static getButtonTintList(Landroid/widget/CompoundButton;)Landroid/content/res/ColorStateList;
|
|
.locals 2
|
|
.param p0 # Landroid/widget/CompoundButton;
|
|
.annotation build Landroidx/annotation/NonNull;
|
|
.end annotation
|
|
.end param
|
|
.annotation build Landroidx/annotation/Nullable;
|
|
.end annotation
|
|
|
|
sget v0, Landroid/os/Build$VERSION;->SDK_INT:I
|
|
|
|
const/16 v1, 0x15
|
|
|
|
if-lt v0, v1, :cond_0
|
|
|
|
invoke-virtual {p0}, Landroid/widget/CompoundButton;->getButtonTintList()Landroid/content/res/ColorStateList;
|
|
|
|
move-result-object p0
|
|
|
|
return-object p0
|
|
|
|
:cond_0
|
|
instance-of v0, p0, Landroidx/core/widget/TintableCompoundButton;
|
|
|
|
if-eqz v0, :cond_1
|
|
|
|
check-cast p0, Landroidx/core/widget/TintableCompoundButton;
|
|
|
|
invoke-interface {p0}, Landroidx/core/widget/TintableCompoundButton;->getSupportButtonTintList()Landroid/content/res/ColorStateList;
|
|
|
|
move-result-object p0
|
|
|
|
return-object p0
|
|
|
|
:cond_1
|
|
const/4 p0, 0x0
|
|
|
|
return-object p0
|
|
.end method
|
|
|
|
.method public static getButtonTintMode(Landroid/widget/CompoundButton;)Landroid/graphics/PorterDuff$Mode;
|
|
.locals 2
|
|
.param p0 # Landroid/widget/CompoundButton;
|
|
.annotation build Landroidx/annotation/NonNull;
|
|
.end annotation
|
|
.end param
|
|
.annotation build Landroidx/annotation/Nullable;
|
|
.end annotation
|
|
|
|
sget v0, Landroid/os/Build$VERSION;->SDK_INT:I
|
|
|
|
const/16 v1, 0x15
|
|
|
|
if-lt v0, v1, :cond_0
|
|
|
|
invoke-virtual {p0}, Landroid/widget/CompoundButton;->getButtonTintMode()Landroid/graphics/PorterDuff$Mode;
|
|
|
|
move-result-object p0
|
|
|
|
return-object p0
|
|
|
|
:cond_0
|
|
instance-of v0, p0, Landroidx/core/widget/TintableCompoundButton;
|
|
|
|
if-eqz v0, :cond_1
|
|
|
|
check-cast p0, Landroidx/core/widget/TintableCompoundButton;
|
|
|
|
invoke-interface {p0}, Landroidx/core/widget/TintableCompoundButton;->getSupportButtonTintMode()Landroid/graphics/PorterDuff$Mode;
|
|
|
|
move-result-object p0
|
|
|
|
return-object p0
|
|
|
|
:cond_1
|
|
const/4 p0, 0x0
|
|
|
|
return-object p0
|
|
.end method
|
|
|
|
.method public static setButtonTintList(Landroid/widget/CompoundButton;Landroid/content/res/ColorStateList;)V
|
|
.locals 2
|
|
.param p0 # Landroid/widget/CompoundButton;
|
|
.annotation build Landroidx/annotation/NonNull;
|
|
.end annotation
|
|
.end param
|
|
.param p1 # Landroid/content/res/ColorStateList;
|
|
.annotation build Landroidx/annotation/Nullable;
|
|
.end annotation
|
|
.end param
|
|
|
|
sget v0, Landroid/os/Build$VERSION;->SDK_INT:I
|
|
|
|
const/16 v1, 0x15
|
|
|
|
if-lt v0, v1, :cond_0
|
|
|
|
invoke-virtual {p0, p1}, Landroid/widget/CompoundButton;->setButtonTintList(Landroid/content/res/ColorStateList;)V
|
|
|
|
return-void
|
|
|
|
:cond_0
|
|
instance-of v0, p0, Landroidx/core/widget/TintableCompoundButton;
|
|
|
|
if-eqz v0, :cond_1
|
|
|
|
check-cast p0, Landroidx/core/widget/TintableCompoundButton;
|
|
|
|
invoke-interface {p0, p1}, Landroidx/core/widget/TintableCompoundButton;->setSupportButtonTintList(Landroid/content/res/ColorStateList;)V
|
|
|
|
:cond_1
|
|
return-void
|
|
.end method
|
|
|
|
.method public static setButtonTintMode(Landroid/widget/CompoundButton;Landroid/graphics/PorterDuff$Mode;)V
|
|
.locals 2
|
|
.param p0 # Landroid/widget/CompoundButton;
|
|
.annotation build Landroidx/annotation/NonNull;
|
|
.end annotation
|
|
.end param
|
|
.param p1 # Landroid/graphics/PorterDuff$Mode;
|
|
.annotation build Landroidx/annotation/Nullable;
|
|
.end annotation
|
|
.end param
|
|
|
|
sget v0, Landroid/os/Build$VERSION;->SDK_INT:I
|
|
|
|
const/16 v1, 0x15
|
|
|
|
if-lt v0, v1, :cond_0
|
|
|
|
invoke-virtual {p0, p1}, Landroid/widget/CompoundButton;->setButtonTintMode(Landroid/graphics/PorterDuff$Mode;)V
|
|
|
|
return-void
|
|
|
|
:cond_0
|
|
instance-of v0, p0, Landroidx/core/widget/TintableCompoundButton;
|
|
|
|
if-eqz v0, :cond_1
|
|
|
|
check-cast p0, Landroidx/core/widget/TintableCompoundButton;
|
|
|
|
invoke-interface {p0, p1}, Landroidx/core/widget/TintableCompoundButton;->setSupportButtonTintMode(Landroid/graphics/PorterDuff$Mode;)V
|
|
|
|
:cond_1
|
|
return-void
|
|
.end method
|