apkfuckery/com.discord/smali/androidx/appcompat/widget/ThemeUtils.smali
2020-09-16 23:45:23 +00:00

430 lines
11 KiB
Smali

.class public Landroidx/appcompat/widget/ThemeUtils;
.super Ljava/lang/Object;
.source "ThemeUtils.java"
# annotations
.annotation build Landroidx/annotation/RestrictTo;
value = {
.enum Landroidx/annotation/RestrictTo$Scope;->LIBRARY:Landroidx/annotation/RestrictTo$Scope;
}
.end annotation
# static fields
.field public static final ACTIVATED_STATE_SET:[I
.field public static final CHECKED_STATE_SET:[I
.field public static final DISABLED_STATE_SET:[I
.field public static final EMPTY_STATE_SET:[I
.field public static final FOCUSED_STATE_SET:[I
.field public static final NOT_PRESSED_OR_FOCUSED_STATE_SET:[I
.field public static final PRESSED_STATE_SET:[I
.field public static final SELECTED_STATE_SET:[I
.field public static final TAG:Ljava/lang/String; = "ThemeUtils"
.field public static final TEMP_ARRAY:[I
.field public static final TL_TYPED_VALUE:Ljava/lang/ThreadLocal;
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/lang/ThreadLocal<",
"Landroid/util/TypedValue;",
">;"
}
.end annotation
.end field
# direct methods
.method public static constructor <clinit>()V
.locals 4
new-instance v0, Ljava/lang/ThreadLocal;
invoke-direct {v0}, Ljava/lang/ThreadLocal;-><init>()V
sput-object v0, Landroidx/appcompat/widget/ThemeUtils;->TL_TYPED_VALUE:Ljava/lang/ThreadLocal;
const/4 v0, 0x1
new-array v1, v0, [I
const v2, -0x101009e
const/4 v3, 0x0
aput v2, v1, v3
sput-object v1, Landroidx/appcompat/widget/ThemeUtils;->DISABLED_STATE_SET:[I
new-array v1, v0, [I
const v2, 0x101009c
aput v2, v1, v3
sput-object v1, Landroidx/appcompat/widget/ThemeUtils;->FOCUSED_STATE_SET:[I
new-array v1, v0, [I
const v2, 0x10102fe
aput v2, v1, v3
sput-object v1, Landroidx/appcompat/widget/ThemeUtils;->ACTIVATED_STATE_SET:[I
new-array v1, v0, [I
const v2, 0x10100a7
aput v2, v1, v3
sput-object v1, Landroidx/appcompat/widget/ThemeUtils;->PRESSED_STATE_SET:[I
new-array v1, v0, [I
const v2, 0x10100a0
aput v2, v1, v3
sput-object v1, Landroidx/appcompat/widget/ThemeUtils;->CHECKED_STATE_SET:[I
new-array v1, v0, [I
const v2, 0x10100a1
aput v2, v1, v3
sput-object v1, Landroidx/appcompat/widget/ThemeUtils;->SELECTED_STATE_SET:[I
const/4 v1, 0x2
new-array v1, v1, [I
fill-array-data v1, :array_0
sput-object v1, Landroidx/appcompat/widget/ThemeUtils;->NOT_PRESSED_OR_FOCUSED_STATE_SET:[I
new-array v1, v3, [I
sput-object v1, Landroidx/appcompat/widget/ThemeUtils;->EMPTY_STATE_SET:[I
new-array v0, v0, [I
sput-object v0, Landroidx/appcompat/widget/ThemeUtils;->TEMP_ARRAY:[I
return-void
:array_0
.array-data 4
-0x10100a7
-0x101009c
.end array-data
.end method
.method public constructor <init>()V
.locals 0
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
return-void
.end method
.method public static checkAppCompatTheme(Landroid/view/View;Landroid/content/Context;)V
.locals 3
.param p0 # Landroid/view/View;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
.param p1 # Landroid/content/Context;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
sget-object v0, Landroidx/appcompat/R$styleable;->AppCompatTheme:[I
invoke-virtual {p1, v0}, Landroid/content/Context;->obtainStyledAttributes([I)Landroid/content/res/TypedArray;
move-result-object p1
:try_start_0
sget v0, Landroidx/appcompat/R$styleable;->AppCompatTheme_windowActionBar:I
invoke-virtual {p1, v0}, Landroid/content/res/TypedArray;->hasValue(I)Z
move-result v0
if-nez v0, :cond_0
const-string v0, "ThemeUtils"
new-instance v1, Ljava/lang/StringBuilder;
invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
const-string v2, "View "
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {p0}, Ljava/lang/Object;->getClass()Ljava/lang/Class;
move-result-object p0
invoke-virtual {v1, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
const-string p0, " is an AppCompat widget that can only be used with a Theme.AppCompat theme (or descendant)."
invoke-virtual {v1, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object p0
invoke-static {v0, p0}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
:cond_0
invoke-virtual {p1}, Landroid/content/res/TypedArray;->recycle()V
return-void
:catchall_0
move-exception p0
invoke-virtual {p1}, Landroid/content/res/TypedArray;->recycle()V
throw p0
.end method
.method public static createDisabledStateList(II)Landroid/content/res/ColorStateList;
.locals 4
.annotation build Landroidx/annotation/NonNull;
.end annotation
const/4 v0, 0x2
new-array v1, v0, [[I
new-array v0, v0, [I
sget-object v2, Landroidx/appcompat/widget/ThemeUtils;->DISABLED_STATE_SET:[I
const/4 v3, 0x0
aput-object v2, v1, v3
aput p1, v0, v3
sget-object p1, Landroidx/appcompat/widget/ThemeUtils;->EMPTY_STATE_SET:[I
const/4 v2, 0x1
aput-object p1, v1, v2
aput p0, v0, v2
new-instance p0, Landroid/content/res/ColorStateList;
invoke-direct {p0, v1, v0}, Landroid/content/res/ColorStateList;-><init>([[I[I)V
return-object p0
.end method
.method public static getDisabledThemeAttrColor(Landroid/content/Context;I)I
.locals 4
.param p0 # Landroid/content/Context;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
invoke-static {p0, p1}, Landroidx/appcompat/widget/ThemeUtils;->getThemeAttrColorStateList(Landroid/content/Context;I)Landroid/content/res/ColorStateList;
move-result-object v0
if-eqz v0, :cond_0
invoke-virtual {v0}, Landroid/content/res/ColorStateList;->isStateful()Z
move-result v1
if-eqz v1, :cond_0
sget-object p0, Landroidx/appcompat/widget/ThemeUtils;->DISABLED_STATE_SET:[I
invoke-virtual {v0}, Landroid/content/res/ColorStateList;->getDefaultColor()I
move-result p1
invoke-virtual {v0, p0, p1}, Landroid/content/res/ColorStateList;->getColorForState([II)I
move-result p0
return p0
:cond_0
invoke-static {}, Landroidx/appcompat/widget/ThemeUtils;->getTypedValue()Landroid/util/TypedValue;
move-result-object v0
invoke-virtual {p0}, Landroid/content/Context;->getTheme()Landroid/content/res/Resources$Theme;
move-result-object v1
const v2, 0x1010033
const/4 v3, 0x1
invoke-virtual {v1, v2, v0, v3}, Landroid/content/res/Resources$Theme;->resolveAttribute(ILandroid/util/TypedValue;Z)Z
invoke-virtual {v0}, Landroid/util/TypedValue;->getFloat()F
move-result v0
invoke-static {p0, p1, v0}, Landroidx/appcompat/widget/ThemeUtils;->getThemeAttrColor(Landroid/content/Context;IF)I
move-result p0
return p0
.end method
.method public static getThemeAttrColor(Landroid/content/Context;I)I
.locals 2
.param p0 # Landroid/content/Context;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
sget-object v0, Landroidx/appcompat/widget/ThemeUtils;->TEMP_ARRAY:[I
const/4 v1, 0x0
aput p1, v0, v1
const/4 p1, 0x0
invoke-static {p0, p1, v0}, Landroidx/appcompat/widget/TintTypedArray;->obtainStyledAttributes(Landroid/content/Context;Landroid/util/AttributeSet;[I)Landroidx/appcompat/widget/TintTypedArray;
move-result-object p0
:try_start_0
invoke-virtual {p0, v1, v1}, Landroidx/appcompat/widget/TintTypedArray;->getColor(II)I
move-result p1
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
invoke-virtual {p0}, Landroidx/appcompat/widget/TintTypedArray;->recycle()V
return p1
:catchall_0
move-exception p1
invoke-virtual {p0}, Landroidx/appcompat/widget/TintTypedArray;->recycle()V
throw p1
.end method
.method public static getThemeAttrColor(Landroid/content/Context;IF)I
.locals 0
.param p0 # Landroid/content/Context;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
invoke-static {p0, p1}, Landroidx/appcompat/widget/ThemeUtils;->getThemeAttrColor(Landroid/content/Context;I)I
move-result p0
invoke-static {p0}, Landroid/graphics/Color;->alpha(I)I
move-result p1
int-to-float p1, p1
mul-float p1, p1, p2
invoke-static {p1}, Ljava/lang/Math;->round(F)I
move-result p1
invoke-static {p0, p1}, Landroidx/core/graphics/ColorUtils;->setAlphaComponent(II)I
move-result p0
return p0
.end method
.method public static getThemeAttrColorStateList(Landroid/content/Context;I)Landroid/content/res/ColorStateList;
.locals 2
.param p0 # Landroid/content/Context;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
.annotation build Landroidx/annotation/Nullable;
.end annotation
sget-object v0, Landroidx/appcompat/widget/ThemeUtils;->TEMP_ARRAY:[I
const/4 v1, 0x0
aput p1, v0, v1
const/4 p1, 0x0
invoke-static {p0, p1, v0}, Landroidx/appcompat/widget/TintTypedArray;->obtainStyledAttributes(Landroid/content/Context;Landroid/util/AttributeSet;[I)Landroidx/appcompat/widget/TintTypedArray;
move-result-object p0
:try_start_0
invoke-virtual {p0, v1}, Landroidx/appcompat/widget/TintTypedArray;->getColorStateList(I)Landroid/content/res/ColorStateList;
move-result-object p1
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
invoke-virtual {p0}, Landroidx/appcompat/widget/TintTypedArray;->recycle()V
return-object p1
:catchall_0
move-exception p1
invoke-virtual {p0}, Landroidx/appcompat/widget/TintTypedArray;->recycle()V
throw p1
.end method
.method public static getTypedValue()Landroid/util/TypedValue;
.locals 2
sget-object v0, Landroidx/appcompat/widget/ThemeUtils;->TL_TYPED_VALUE:Ljava/lang/ThreadLocal;
invoke-virtual {v0}, Ljava/lang/ThreadLocal;->get()Ljava/lang/Object;
move-result-object v0
check-cast v0, Landroid/util/TypedValue;
if-nez v0, :cond_0
new-instance v0, Landroid/util/TypedValue;
invoke-direct {v0}, Landroid/util/TypedValue;-><init>()V
sget-object v1, Landroidx/appcompat/widget/ThemeUtils;->TL_TYPED_VALUE:Ljava/lang/ThreadLocal;
invoke-virtual {v1, v0}, Ljava/lang/ThreadLocal;->set(Ljava/lang/Object;)V
:cond_0
return-object v0
.end method