apkfuckery/com.discord/smali/androidx/appcompat/widget/TintContextWrapper.smali

363 lines
9.4 KiB
Smali
Raw Normal View History

2019-07-24 11:27:29 +00:00
.class public Landroidx/appcompat/widget/TintContextWrapper;
.super Landroid/content/ContextWrapper;
.source "TintContextWrapper.java"
2019-12-06 03:29:40 +00:00
# annotations
.annotation build Landroidx/annotation/RestrictTo;
value = {
.enum Landroidx/annotation/RestrictTo$Scope;->LIBRARY_GROUP_PREFIX:Landroidx/annotation/RestrictTo$Scope;
}
.end annotation
2019-07-24 11:27:29 +00:00
# static fields
2019-12-06 03:29:40 +00:00
.field public static final CACHE_LOCK:Ljava/lang/Object;
2019-07-24 11:27:29 +00:00
2019-12-06 03:29:40 +00:00
.field public static sCache:Ljava/util/ArrayList;
2019-07-24 11:27:29 +00:00
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/util/ArrayList<",
"Ljava/lang/ref/WeakReference<",
"Landroidx/appcompat/widget/TintContextWrapper;",
">;>;"
}
.end annotation
.end field
# instance fields
2019-12-06 03:29:40 +00:00
.field public final mResources:Landroid/content/res/Resources;
2019-07-24 11:27:29 +00:00
2019-12-06 03:29:40 +00:00
.field public final mTheme:Landroid/content/res/Resources$Theme;
2019-07-24 11:27:29 +00:00
# direct methods
2019-12-06 03:29:40 +00:00
.method public static constructor <clinit>()V
2019-07-24 11:27:29 +00:00
.locals 1
new-instance v0, Ljava/lang/Object;
invoke-direct {v0}, Ljava/lang/Object;-><init>()V
sput-object v0, Landroidx/appcompat/widget/TintContextWrapper;->CACHE_LOCK:Ljava/lang/Object;
return-void
.end method
2019-12-06 03:29:40 +00:00
.method public constructor <init>(Landroid/content/Context;)V
2019-07-24 11:27:29 +00:00
.locals 2
2019-12-06 03:29:40 +00:00
.param p1 # Landroid/content/Context;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
2019-07-24 11:27:29 +00:00
invoke-direct {p0, p1}, Landroid/content/ContextWrapper;-><init>(Landroid/content/Context;)V
invoke-static {}, Landroidx/appcompat/widget/VectorEnabledTintResources;->shouldBeUsed()Z
move-result v0
if-eqz v0, :cond_0
new-instance v0, Landroidx/appcompat/widget/VectorEnabledTintResources;
invoke-virtual {p1}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;
move-result-object v1
invoke-direct {v0, p0, v1}, Landroidx/appcompat/widget/VectorEnabledTintResources;-><init>(Landroid/content/Context;Landroid/content/res/Resources;)V
iput-object v0, p0, Landroidx/appcompat/widget/TintContextWrapper;->mResources:Landroid/content/res/Resources;
iget-object v0, p0, Landroidx/appcompat/widget/TintContextWrapper;->mResources:Landroid/content/res/Resources;
invoke-virtual {v0}, Landroid/content/res/Resources;->newTheme()Landroid/content/res/Resources$Theme;
move-result-object v0
iput-object v0, p0, Landroidx/appcompat/widget/TintContextWrapper;->mTheme:Landroid/content/res/Resources$Theme;
iget-object v0, p0, Landroidx/appcompat/widget/TintContextWrapper;->mTheme:Landroid/content/res/Resources$Theme;
invoke-virtual {p1}, Landroid/content/Context;->getTheme()Landroid/content/res/Resources$Theme;
move-result-object p1
invoke-virtual {v0, p1}, Landroid/content/res/Resources$Theme;->setTo(Landroid/content/res/Resources$Theme;)V
2019-12-06 03:29:40 +00:00
goto :goto_0
2019-07-24 11:27:29 +00:00
:cond_0
new-instance v0, Landroidx/appcompat/widget/TintResources;
invoke-virtual {p1}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;
move-result-object p1
invoke-direct {v0, p0, p1}, Landroidx/appcompat/widget/TintResources;-><init>(Landroid/content/Context;Landroid/content/res/Resources;)V
iput-object v0, p0, Landroidx/appcompat/widget/TintContextWrapper;->mResources:Landroid/content/res/Resources;
const/4 p1, 0x0
iput-object p1, p0, Landroidx/appcompat/widget/TintContextWrapper;->mTheme:Landroid/content/res/Resources$Theme;
2019-12-06 03:29:40 +00:00
:goto_0
2019-07-24 11:27:29 +00:00
return-void
.end method
2019-12-06 03:29:40 +00:00
.method public static shouldWrap(Landroid/content/Context;)Z
2019-07-24 11:27:29 +00:00
.locals 2
2019-12-06 03:29:40 +00:00
.param p0 # Landroid/content/Context;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
2019-07-24 11:27:29 +00:00
instance-of v0, p0, Landroidx/appcompat/widget/TintContextWrapper;
const/4 v1, 0x0
2019-12-06 03:29:40 +00:00
if-nez v0, :cond_1
2019-07-24 11:27:29 +00:00
invoke-virtual {p0}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;
move-result-object v0
instance-of v0, v0, Landroidx/appcompat/widget/TintResources;
2019-12-06 03:29:40 +00:00
if-nez v0, :cond_1
2019-07-24 11:27:29 +00:00
invoke-virtual {p0}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;
move-result-object p0
instance-of p0, p0, Landroidx/appcompat/widget/VectorEnabledTintResources;
if-eqz p0, :cond_0
2019-12-06 03:29:40 +00:00
goto :goto_0
2019-07-24 11:27:29 +00:00
:cond_0
sget p0, Landroid/os/Build$VERSION;->SDK_INT:I
invoke-static {}, Landroidx/appcompat/widget/VectorEnabledTintResources;->shouldBeUsed()Z
move-result p0
if-eqz p0, :cond_1
2019-12-06 03:29:40 +00:00
const/4 v1, 0x1
2019-07-24 11:27:29 +00:00
:cond_1
:goto_0
return v1
.end method
.method public static wrap(Landroid/content/Context;)Landroid/content/Context;
.locals 4
2019-12-06 03:29:40 +00:00
.param p0 # Landroid/content/Context;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
2019-07-24 11:27:29 +00:00
invoke-static {p0}, Landroidx/appcompat/widget/TintContextWrapper;->shouldWrap(Landroid/content/Context;)Z
move-result v0
if-eqz v0, :cond_7
sget-object v0, Landroidx/appcompat/widget/TintContextWrapper;->CACHE_LOCK:Ljava/lang/Object;
monitor-enter v0
:try_start_0
sget-object v1, Landroidx/appcompat/widget/TintContextWrapper;->sCache:Ljava/util/ArrayList;
if-nez v1, :cond_0
new-instance v1, Ljava/util/ArrayList;
invoke-direct {v1}, Ljava/util/ArrayList;-><init>()V
sput-object v1, Landroidx/appcompat/widget/TintContextWrapper;->sCache:Ljava/util/ArrayList;
goto :goto_3
:cond_0
sget-object v1, Landroidx/appcompat/widget/TintContextWrapper;->sCache:Ljava/util/ArrayList;
invoke-virtual {v1}, Ljava/util/ArrayList;->size()I
move-result v1
add-int/lit8 v1, v1, -0x1
:goto_0
if-ltz v1, :cond_3
sget-object v2, Landroidx/appcompat/widget/TintContextWrapper;->sCache:Ljava/util/ArrayList;
invoke-virtual {v2, v1}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;
move-result-object v2
check-cast v2, Ljava/lang/ref/WeakReference;
if-eqz v2, :cond_1
invoke-virtual {v2}, Ljava/lang/ref/WeakReference;->get()Ljava/lang/Object;
move-result-object v2
if-nez v2, :cond_2
:cond_1
sget-object v2, Landroidx/appcompat/widget/TintContextWrapper;->sCache:Ljava/util/ArrayList;
invoke-virtual {v2, v1}, Ljava/util/ArrayList;->remove(I)Ljava/lang/Object;
:cond_2
add-int/lit8 v1, v1, -0x1
goto :goto_0
:cond_3
sget-object v1, Landroidx/appcompat/widget/TintContextWrapper;->sCache:Ljava/util/ArrayList;
invoke-virtual {v1}, Ljava/util/ArrayList;->size()I
move-result v1
add-int/lit8 v1, v1, -0x1
:goto_1
if-ltz v1, :cond_6
sget-object v2, Landroidx/appcompat/widget/TintContextWrapper;->sCache:Ljava/util/ArrayList;
invoke-virtual {v2, v1}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;
move-result-object v2
check-cast v2, Ljava/lang/ref/WeakReference;
if-eqz v2, :cond_4
invoke-virtual {v2}, Ljava/lang/ref/WeakReference;->get()Ljava/lang/Object;
move-result-object v2
check-cast v2, Landroidx/appcompat/widget/TintContextWrapper;
goto :goto_2
:cond_4
const/4 v2, 0x0
:goto_2
if-eqz v2, :cond_5
2019-12-06 03:29:40 +00:00
invoke-virtual {v2}, Landroid/content/ContextWrapper;->getBaseContext()Landroid/content/Context;
2019-07-24 11:27:29 +00:00
move-result-object v3
if-ne v3, p0, :cond_5
monitor-exit v0
return-object v2
:cond_5
add-int/lit8 v1, v1, -0x1
goto :goto_1
:cond_6
:goto_3
new-instance v1, Landroidx/appcompat/widget/TintContextWrapper;
invoke-direct {v1, p0}, Landroidx/appcompat/widget/TintContextWrapper;-><init>(Landroid/content/Context;)V
sget-object p0, Landroidx/appcompat/widget/TintContextWrapper;->sCache:Ljava/util/ArrayList;
new-instance v2, Ljava/lang/ref/WeakReference;
invoke-direct {v2, v1}, Ljava/lang/ref/WeakReference;-><init>(Ljava/lang/Object;)V
invoke-virtual {p0, v2}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z
monitor-exit v0
return-object v1
:catchall_0
move-exception p0
monitor-exit v0
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
throw p0
:cond_7
return-object p0
.end method
# virtual methods
.method public getAssets()Landroid/content/res/AssetManager;
.locals 1
iget-object v0, p0, Landroidx/appcompat/widget/TintContextWrapper;->mResources:Landroid/content/res/Resources;
invoke-virtual {v0}, Landroid/content/res/Resources;->getAssets()Landroid/content/res/AssetManager;
move-result-object v0
return-object v0
.end method
.method public getResources()Landroid/content/res/Resources;
.locals 1
iget-object v0, p0, Landroidx/appcompat/widget/TintContextWrapper;->mResources:Landroid/content/res/Resources;
return-object v0
.end method
.method public getTheme()Landroid/content/res/Resources$Theme;
.locals 1
iget-object v0, p0, Landroidx/appcompat/widget/TintContextWrapper;->mTheme:Landroid/content/res/Resources$Theme;
if-nez v0, :cond_0
invoke-super {p0}, Landroid/content/ContextWrapper;->getTheme()Landroid/content/res/Resources$Theme;
move-result-object v0
:cond_0
return-object v0
.end method
.method public setTheme(I)V
.locals 2
iget-object v0, p0, Landroidx/appcompat/widget/TintContextWrapper;->mTheme:Landroid/content/res/Resources$Theme;
if-nez v0, :cond_0
invoke-super {p0, p1}, Landroid/content/ContextWrapper;->setTheme(I)V
2019-12-06 03:29:40 +00:00
goto :goto_0
2019-07-24 11:27:29 +00:00
:cond_0
const/4 v1, 0x1
invoke-virtual {v0, p1, v1}, Landroid/content/res/Resources$Theme;->applyStyle(IZ)V
2019-12-06 03:29:40 +00:00
:goto_0
2019-07-24 11:27:29 +00:00
return-void
.end method