425 lines
12 KiB
Smali
425 lines
12 KiB
Smali
.class public final Landroidx/appcompat/content/res/AppCompatResources;
|
|
.super Ljava/lang/Object;
|
|
.source "AppCompatResources.java"
|
|
|
|
|
|
# annotations
|
|
.annotation build Landroid/annotation/SuppressLint;
|
|
value = {
|
|
"RestrictedAPI"
|
|
}
|
|
.end annotation
|
|
|
|
.annotation system Ldalvik/annotation/MemberClasses;
|
|
value = {
|
|
Landroidx/appcompat/content/res/AppCompatResources$ColorStateListCacheEntry;
|
|
}
|
|
.end annotation
|
|
|
|
|
|
# static fields
|
|
.field public static final LOG_TAG:Ljava/lang/String; = "AppCompatResources"
|
|
|
|
.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
|
|
|
|
.field public static final sColorStateCacheLock:Ljava/lang/Object;
|
|
|
|
.field public static final sColorStateCaches:Ljava/util/WeakHashMap;
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"Ljava/util/WeakHashMap<",
|
|
"Landroid/content/Context;",
|
|
"Landroid/util/SparseArray<",
|
|
"Landroidx/appcompat/content/res/AppCompatResources$ColorStateListCacheEntry;",
|
|
">;>;"
|
|
}
|
|
.end annotation
|
|
.end field
|
|
|
|
|
|
# direct methods
|
|
.method public static constructor <clinit>()V
|
|
.locals 2
|
|
|
|
new-instance v0, Ljava/lang/ThreadLocal;
|
|
|
|
invoke-direct {v0}, Ljava/lang/ThreadLocal;-><init>()V
|
|
|
|
sput-object v0, Landroidx/appcompat/content/res/AppCompatResources;->TL_TYPED_VALUE:Ljava/lang/ThreadLocal;
|
|
|
|
new-instance v0, Ljava/util/WeakHashMap;
|
|
|
|
const/4 v1, 0x0
|
|
|
|
invoke-direct {v0, v1}, Ljava/util/WeakHashMap;-><init>(I)V
|
|
|
|
sput-object v0, Landroidx/appcompat/content/res/AppCompatResources;->sColorStateCaches:Ljava/util/WeakHashMap;
|
|
|
|
new-instance v0, Ljava/lang/Object;
|
|
|
|
invoke-direct {v0}, Ljava/lang/Object;-><init>()V
|
|
|
|
sput-object v0, Landroidx/appcompat/content/res/AppCompatResources;->sColorStateCacheLock:Ljava/lang/Object;
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public constructor <init>()V
|
|
.locals 0
|
|
|
|
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public static addColorStateListToCache(Landroid/content/Context;ILandroid/content/res/ColorStateList;)V
|
|
.locals 3
|
|
.param p0 # Landroid/content/Context;
|
|
.annotation build Landroidx/annotation/NonNull;
|
|
.end annotation
|
|
.end param
|
|
.param p1 # I
|
|
.annotation build Landroidx/annotation/ColorRes;
|
|
.end annotation
|
|
.end param
|
|
.param p2 # Landroid/content/res/ColorStateList;
|
|
.annotation build Landroidx/annotation/NonNull;
|
|
.end annotation
|
|
.end param
|
|
|
|
sget-object v0, Landroidx/appcompat/content/res/AppCompatResources;->sColorStateCacheLock:Ljava/lang/Object;
|
|
|
|
monitor-enter v0
|
|
|
|
:try_start_0
|
|
sget-object v1, Landroidx/appcompat/content/res/AppCompatResources;->sColorStateCaches:Ljava/util/WeakHashMap;
|
|
|
|
invoke-virtual {v1, p0}, Ljava/util/WeakHashMap;->get(Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
move-result-object v1
|
|
|
|
check-cast v1, Landroid/util/SparseArray;
|
|
|
|
if-nez v1, :cond_0
|
|
|
|
new-instance v1, Landroid/util/SparseArray;
|
|
|
|
invoke-direct {v1}, Landroid/util/SparseArray;-><init>()V
|
|
|
|
sget-object v2, Landroidx/appcompat/content/res/AppCompatResources;->sColorStateCaches:Ljava/util/WeakHashMap;
|
|
|
|
invoke-virtual {v2, p0, v1}, Ljava/util/WeakHashMap;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
:cond_0
|
|
new-instance v2, Landroidx/appcompat/content/res/AppCompatResources$ColorStateListCacheEntry;
|
|
|
|
invoke-virtual {p0}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-virtual {p0}, Landroid/content/res/Resources;->getConfiguration()Landroid/content/res/Configuration;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-direct {v2, p2, p0}, Landroidx/appcompat/content/res/AppCompatResources$ColorStateListCacheEntry;-><init>(Landroid/content/res/ColorStateList;Landroid/content/res/Configuration;)V
|
|
|
|
invoke-virtual {v1, p1, v2}, Landroid/util/SparseArray;->append(ILjava/lang/Object;)V
|
|
|
|
monitor-exit v0
|
|
|
|
return-void
|
|
|
|
:catchall_0
|
|
move-exception p0
|
|
|
|
monitor-exit v0
|
|
:try_end_0
|
|
.catchall {:try_start_0 .. :try_end_0} :catchall_0
|
|
|
|
throw p0
|
|
.end method
|
|
|
|
.method public static getCachedColorStateList(Landroid/content/Context;I)Landroid/content/res/ColorStateList;
|
|
.locals 4
|
|
.param p0 # Landroid/content/Context;
|
|
.annotation build Landroidx/annotation/NonNull;
|
|
.end annotation
|
|
.end param
|
|
.param p1 # I
|
|
.annotation build Landroidx/annotation/ColorRes;
|
|
.end annotation
|
|
.end param
|
|
.annotation build Landroidx/annotation/Nullable;
|
|
.end annotation
|
|
|
|
sget-object v0, Landroidx/appcompat/content/res/AppCompatResources;->sColorStateCacheLock:Ljava/lang/Object;
|
|
|
|
monitor-enter v0
|
|
|
|
:try_start_0
|
|
sget-object v1, Landroidx/appcompat/content/res/AppCompatResources;->sColorStateCaches:Ljava/util/WeakHashMap;
|
|
|
|
invoke-virtual {v1, p0}, Ljava/util/WeakHashMap;->get(Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
move-result-object v1
|
|
|
|
check-cast v1, Landroid/util/SparseArray;
|
|
|
|
if-eqz v1, :cond_1
|
|
|
|
invoke-virtual {v1}, Landroid/util/SparseArray;->size()I
|
|
|
|
move-result v2
|
|
|
|
if-lez v2, :cond_1
|
|
|
|
invoke-virtual {v1, p1}, Landroid/util/SparseArray;->get(I)Ljava/lang/Object;
|
|
|
|
move-result-object v2
|
|
|
|
check-cast v2, Landroidx/appcompat/content/res/AppCompatResources$ColorStateListCacheEntry;
|
|
|
|
if-eqz v2, :cond_1
|
|
|
|
iget-object v3, v2, Landroidx/appcompat/content/res/AppCompatResources$ColorStateListCacheEntry;->configuration:Landroid/content/res/Configuration;
|
|
|
|
invoke-virtual {p0}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-virtual {p0}, Landroid/content/res/Resources;->getConfiguration()Landroid/content/res/Configuration;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-virtual {v3, p0}, Landroid/content/res/Configuration;->equals(Landroid/content/res/Configuration;)Z
|
|
|
|
move-result p0
|
|
|
|
if-eqz p0, :cond_0
|
|
|
|
iget-object p0, v2, Landroidx/appcompat/content/res/AppCompatResources$ColorStateListCacheEntry;->value:Landroid/content/res/ColorStateList;
|
|
|
|
monitor-exit v0
|
|
|
|
return-object p0
|
|
|
|
:cond_0
|
|
invoke-virtual {v1, p1}, Landroid/util/SparseArray;->remove(I)V
|
|
|
|
:cond_1
|
|
monitor-exit v0
|
|
|
|
const/4 p0, 0x0
|
|
|
|
return-object p0
|
|
|
|
:catchall_0
|
|
move-exception p0
|
|
|
|
monitor-exit v0
|
|
:try_end_0
|
|
.catchall {:try_start_0 .. :try_end_0} :catchall_0
|
|
|
|
throw p0
|
|
.end method
|
|
|
|
.method public static getColorStateList(Landroid/content/Context;I)Landroid/content/res/ColorStateList;
|
|
.locals 2
|
|
.param p0 # Landroid/content/Context;
|
|
.annotation build Landroidx/annotation/NonNull;
|
|
.end annotation
|
|
.end param
|
|
.param p1 # I
|
|
.annotation build Landroidx/annotation/ColorRes;
|
|
.end annotation
|
|
.end param
|
|
|
|
sget v0, Landroid/os/Build$VERSION;->SDK_INT:I
|
|
|
|
const/16 v1, 0x17
|
|
|
|
if-lt v0, v1, :cond_0
|
|
|
|
invoke-virtual {p0, p1}, Landroid/content/Context;->getColorStateList(I)Landroid/content/res/ColorStateList;
|
|
|
|
move-result-object p0
|
|
|
|
return-object p0
|
|
|
|
:cond_0
|
|
invoke-static {p0, p1}, Landroidx/appcompat/content/res/AppCompatResources;->getCachedColorStateList(Landroid/content/Context;I)Landroid/content/res/ColorStateList;
|
|
|
|
move-result-object v0
|
|
|
|
if-eqz v0, :cond_1
|
|
|
|
return-object v0
|
|
|
|
:cond_1
|
|
invoke-static {p0, p1}, Landroidx/appcompat/content/res/AppCompatResources;->inflateColorStateList(Landroid/content/Context;I)Landroid/content/res/ColorStateList;
|
|
|
|
move-result-object v0
|
|
|
|
if-eqz v0, :cond_2
|
|
|
|
invoke-static {p0, p1, v0}, Landroidx/appcompat/content/res/AppCompatResources;->addColorStateListToCache(Landroid/content/Context;ILandroid/content/res/ColorStateList;)V
|
|
|
|
return-object v0
|
|
|
|
:cond_2
|
|
invoke-static {p0, p1}, Landroidx/core/content/ContextCompat;->getColorStateList(Landroid/content/Context;I)Landroid/content/res/ColorStateList;
|
|
|
|
move-result-object p0
|
|
|
|
return-object p0
|
|
.end method
|
|
|
|
.method public static getDrawable(Landroid/content/Context;I)Landroid/graphics/drawable/Drawable;
|
|
.locals 1
|
|
.param p0 # Landroid/content/Context;
|
|
.annotation build Landroidx/annotation/NonNull;
|
|
.end annotation
|
|
.end param
|
|
.param p1 # I
|
|
.annotation build Landroidx/annotation/DrawableRes;
|
|
.end annotation
|
|
.end param
|
|
.annotation build Landroidx/annotation/Nullable;
|
|
.end annotation
|
|
|
|
invoke-static {}, Landroidx/appcompat/widget/ResourceManagerInternal;->get()Landroidx/appcompat/widget/ResourceManagerInternal;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-virtual {v0, p0, p1}, Landroidx/appcompat/widget/ResourceManagerInternal;->getDrawable(Landroid/content/Context;I)Landroid/graphics/drawable/Drawable;
|
|
|
|
move-result-object p0
|
|
|
|
return-object p0
|
|
.end method
|
|
|
|
.method public static getTypedValue()Landroid/util/TypedValue;
|
|
.locals 2
|
|
.annotation build Landroidx/annotation/NonNull;
|
|
.end annotation
|
|
|
|
sget-object v0, Landroidx/appcompat/content/res/AppCompatResources;->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/content/res/AppCompatResources;->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
|
|
|
|
.method public static inflateColorStateList(Landroid/content/Context;I)Landroid/content/res/ColorStateList;
|
|
.locals 2
|
|
.annotation build Landroidx/annotation/Nullable;
|
|
.end annotation
|
|
|
|
invoke-static {p0, p1}, Landroidx/appcompat/content/res/AppCompatResources;->isColorInt(Landroid/content/Context;I)Z
|
|
|
|
move-result v0
|
|
|
|
const/4 v1, 0x0
|
|
|
|
if-eqz v0, :cond_0
|
|
|
|
return-object v1
|
|
|
|
:cond_0
|
|
invoke-virtual {p0}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-virtual {v0, p1}, Landroid/content/res/Resources;->getXml(I)Landroid/content/res/XmlResourceParser;
|
|
|
|
move-result-object p1
|
|
|
|
:try_start_0
|
|
invoke-virtual {p0}, Landroid/content/Context;->getTheme()Landroid/content/res/Resources$Theme;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-static {v0, p1, p0}, Landroidx/core/content/res/ColorStateListInflaterCompat;->createFromXml(Landroid/content/res/Resources;Lorg/xmlpull/v1/XmlPullParser;Landroid/content/res/Resources$Theme;)Landroid/content/res/ColorStateList;
|
|
|
|
move-result-object p0
|
|
:try_end_0
|
|
.catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
|
|
|
|
return-object p0
|
|
|
|
:catch_0
|
|
move-exception p0
|
|
|
|
const-string p1, "AppCompatResources"
|
|
|
|
const-string v0, "Failed to inflate ColorStateList, leaving it to the framework"
|
|
|
|
invoke-static {p1, v0, p0}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
|
|
|
|
return-object v1
|
|
.end method
|
|
|
|
.method public static isColorInt(Landroid/content/Context;I)Z
|
|
.locals 2
|
|
.param p0 # Landroid/content/Context;
|
|
.annotation build Landroidx/annotation/NonNull;
|
|
.end annotation
|
|
.end param
|
|
.param p1 # I
|
|
.annotation build Landroidx/annotation/ColorRes;
|
|
.end annotation
|
|
.end param
|
|
|
|
invoke-virtual {p0}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-static {}, Landroidx/appcompat/content/res/AppCompatResources;->getTypedValue()Landroid/util/TypedValue;
|
|
|
|
move-result-object v0
|
|
|
|
const/4 v1, 0x1
|
|
|
|
invoke-virtual {p0, p1, v0, v1}, Landroid/content/res/Resources;->getValue(ILandroid/util/TypedValue;Z)V
|
|
|
|
iget p0, v0, Landroid/util/TypedValue;->type:I
|
|
|
|
const/16 p1, 0x1c
|
|
|
|
if-lt p0, p1, :cond_0
|
|
|
|
const/16 p1, 0x1f
|
|
|
|
if-gt p0, p1, :cond_0
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
const/4 v1, 0x0
|
|
|
|
:goto_0
|
|
return v1
|
|
.end method
|