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

531 lines
17 KiB
Smali
Raw Normal View History

2020-05-17 12:40:10 +00:00
.class public Landroidx/appcompat/widget/AppCompatBackgroundHelper;
.super Ljava/lang/Object;
.source "AppCompatBackgroundHelper.java"
# instance fields
.field public mBackgroundResId:I
.field public mBackgroundTint:Landroidx/appcompat/widget/TintInfo;
.field public final mDrawableManager:Landroidx/appcompat/widget/AppCompatDrawableManager;
.field public mInternalBackgroundTint:Landroidx/appcompat/widget/TintInfo;
.field public mTmpInfo:Landroidx/appcompat/widget/TintInfo;
.field public final mView:Landroid/view/View;
2020-09-09 19:21:20 +00:00
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end field
2020-05-17 12:40:10 +00:00
# direct methods
.method public constructor <init>(Landroid/view/View;)V
.locals 1
2020-09-09 19:21:20 +00:00
.param p1 # Landroid/view/View;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
2020-05-17 12:40:10 +00:00
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
const/4 v0, -0x1
iput v0, p0, Landroidx/appcompat/widget/AppCompatBackgroundHelper;->mBackgroundResId:I
iput-object p1, p0, Landroidx/appcompat/widget/AppCompatBackgroundHelper;->mView:Landroid/view/View;
invoke-static {}, Landroidx/appcompat/widget/AppCompatDrawableManager;->get()Landroidx/appcompat/widget/AppCompatDrawableManager;
move-result-object p1
iput-object p1, p0, Landroidx/appcompat/widget/AppCompatBackgroundHelper;->mDrawableManager:Landroidx/appcompat/widget/AppCompatDrawableManager;
return-void
.end method
.method private applyFrameworkTintUsingColorFilter(Landroid/graphics/drawable/Drawable;)Z
.locals 3
.param p1 # Landroid/graphics/drawable/Drawable;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
iget-object v0, p0, Landroidx/appcompat/widget/AppCompatBackgroundHelper;->mTmpInfo:Landroidx/appcompat/widget/TintInfo;
if-nez v0, :cond_0
new-instance v0, Landroidx/appcompat/widget/TintInfo;
invoke-direct {v0}, Landroidx/appcompat/widget/TintInfo;-><init>()V
iput-object v0, p0, Landroidx/appcompat/widget/AppCompatBackgroundHelper;->mTmpInfo:Landroidx/appcompat/widget/TintInfo;
:cond_0
iget-object v0, p0, Landroidx/appcompat/widget/AppCompatBackgroundHelper;->mTmpInfo:Landroidx/appcompat/widget/TintInfo;
invoke-virtual {v0}, Landroidx/appcompat/widget/TintInfo;->clear()V
iget-object v1, p0, Landroidx/appcompat/widget/AppCompatBackgroundHelper;->mView:Landroid/view/View;
invoke-static {v1}, Landroidx/core/view/ViewCompat;->getBackgroundTintList(Landroid/view/View;)Landroid/content/res/ColorStateList;
move-result-object v1
const/4 v2, 0x1
if-eqz v1, :cond_1
iput-boolean v2, v0, Landroidx/appcompat/widget/TintInfo;->mHasTintList:Z
iput-object v1, v0, Landroidx/appcompat/widget/TintInfo;->mTintList:Landroid/content/res/ColorStateList;
:cond_1
iget-object v1, p0, Landroidx/appcompat/widget/AppCompatBackgroundHelper;->mView:Landroid/view/View;
invoke-static {v1}, Landroidx/core/view/ViewCompat;->getBackgroundTintMode(Landroid/view/View;)Landroid/graphics/PorterDuff$Mode;
move-result-object v1
if-eqz v1, :cond_2
iput-boolean v2, v0, Landroidx/appcompat/widget/TintInfo;->mHasTintMode:Z
iput-object v1, v0, Landroidx/appcompat/widget/TintInfo;->mTintMode:Landroid/graphics/PorterDuff$Mode;
:cond_2
iget-boolean v1, v0, Landroidx/appcompat/widget/TintInfo;->mHasTintList:Z
if-nez v1, :cond_4
iget-boolean v1, v0, Landroidx/appcompat/widget/TintInfo;->mHasTintMode:Z
if-eqz v1, :cond_3
goto :goto_0
:cond_3
const/4 p1, 0x0
return p1
:cond_4
:goto_0
iget-object v1, p0, Landroidx/appcompat/widget/AppCompatBackgroundHelper;->mView:Landroid/view/View;
invoke-virtual {v1}, Landroid/view/View;->getDrawableState()[I
move-result-object v1
invoke-static {p1, v0, v1}, Landroidx/appcompat/widget/AppCompatDrawableManager;->tintDrawable(Landroid/graphics/drawable/Drawable;Landroidx/appcompat/widget/TintInfo;[I)V
return v2
.end method
.method private shouldApplyFrameworkTintUsingColorFilter()Z
.locals 4
sget v0, Landroid/os/Build$VERSION;->SDK_INT:I
const/4 v1, 0x1
const/4 v2, 0x0
const/16 v3, 0x15
if-le v0, v3, :cond_1
iget-object v0, p0, Landroidx/appcompat/widget/AppCompatBackgroundHelper;->mInternalBackgroundTint:Landroidx/appcompat/widget/TintInfo;
if-eqz v0, :cond_0
goto :goto_0
:cond_0
const/4 v1, 0x0
:goto_0
return v1
:cond_1
if-ne v0, v3, :cond_2
return v1
:cond_2
return v2
.end method
# virtual methods
.method public applySupportBackgroundTint()V
.locals 3
iget-object v0, p0, Landroidx/appcompat/widget/AppCompatBackgroundHelper;->mView:Landroid/view/View;
invoke-virtual {v0}, Landroid/view/View;->getBackground()Landroid/graphics/drawable/Drawable;
move-result-object v0
if-eqz v0, :cond_2
invoke-direct {p0}, Landroidx/appcompat/widget/AppCompatBackgroundHelper;->shouldApplyFrameworkTintUsingColorFilter()Z
move-result v1
if-eqz v1, :cond_0
invoke-direct {p0, v0}, Landroidx/appcompat/widget/AppCompatBackgroundHelper;->applyFrameworkTintUsingColorFilter(Landroid/graphics/drawable/Drawable;)Z
move-result v1
if-eqz v1, :cond_0
return-void
:cond_0
iget-object v1, p0, Landroidx/appcompat/widget/AppCompatBackgroundHelper;->mBackgroundTint:Landroidx/appcompat/widget/TintInfo;
if-eqz v1, :cond_1
iget-object v2, p0, Landroidx/appcompat/widget/AppCompatBackgroundHelper;->mView:Landroid/view/View;
invoke-virtual {v2}, Landroid/view/View;->getDrawableState()[I
move-result-object v2
invoke-static {v0, v1, v2}, Landroidx/appcompat/widget/AppCompatDrawableManager;->tintDrawable(Landroid/graphics/drawable/Drawable;Landroidx/appcompat/widget/TintInfo;[I)V
goto :goto_0
:cond_1
iget-object v1, p0, Landroidx/appcompat/widget/AppCompatBackgroundHelper;->mInternalBackgroundTint:Landroidx/appcompat/widget/TintInfo;
if-eqz v1, :cond_2
iget-object v2, p0, Landroidx/appcompat/widget/AppCompatBackgroundHelper;->mView:Landroid/view/View;
invoke-virtual {v2}, Landroid/view/View;->getDrawableState()[I
move-result-object v2
invoke-static {v0, v1, v2}, Landroidx/appcompat/widget/AppCompatDrawableManager;->tintDrawable(Landroid/graphics/drawable/Drawable;Landroidx/appcompat/widget/TintInfo;[I)V
:cond_2
:goto_0
return-void
.end method
.method public getSupportBackgroundTintList()Landroid/content/res/ColorStateList;
.locals 1
iget-object v0, p0, Landroidx/appcompat/widget/AppCompatBackgroundHelper;->mBackgroundTint:Landroidx/appcompat/widget/TintInfo;
if-eqz v0, :cond_0
iget-object v0, v0, Landroidx/appcompat/widget/TintInfo;->mTintList:Landroid/content/res/ColorStateList;
goto :goto_0
:cond_0
const/4 v0, 0x0
:goto_0
return-object v0
.end method
.method public getSupportBackgroundTintMode()Landroid/graphics/PorterDuff$Mode;
.locals 1
iget-object v0, p0, Landroidx/appcompat/widget/AppCompatBackgroundHelper;->mBackgroundTint:Landroidx/appcompat/widget/TintInfo;
if-eqz v0, :cond_0
iget-object v0, v0, Landroidx/appcompat/widget/TintInfo;->mTintMode:Landroid/graphics/PorterDuff$Mode;
goto :goto_0
:cond_0
const/4 v0, 0x0
:goto_0
return-object v0
.end method
.method public loadFromAttributes(Landroid/util/AttributeSet;I)V
2020-09-09 19:21:20 +00:00
.locals 8
.param p1 # Landroid/util/AttributeSet;
.annotation build Landroidx/annotation/Nullable;
.end annotation
.end param
2020-05-17 12:40:10 +00:00
iget-object v0, p0, Landroidx/appcompat/widget/AppCompatBackgroundHelper;->mView:Landroid/view/View;
invoke-virtual {v0}, Landroid/view/View;->getContext()Landroid/content/Context;
move-result-object v0
sget-object v1, Landroidx/appcompat/R$styleable;->ViewBackgroundHelper:[I
const/4 v2, 0x0
invoke-static {v0, p1, v1, p2, v2}, Landroidx/appcompat/widget/TintTypedArray;->obtainStyledAttributes(Landroid/content/Context;Landroid/util/AttributeSet;[III)Landroidx/appcompat/widget/TintTypedArray;
2020-09-09 19:21:20 +00:00
move-result-object v0
iget-object v1, p0, Landroidx/appcompat/widget/AppCompatBackgroundHelper;->mView:Landroid/view/View;
invoke-virtual {v1}, Landroid/view/View;->getContext()Landroid/content/Context;
move-result-object v2
sget-object v3, Landroidx/appcompat/R$styleable;->ViewBackgroundHelper:[I
invoke-virtual {v0}, Landroidx/appcompat/widget/TintTypedArray;->getWrappedTypeArray()Landroid/content/res/TypedArray;
move-result-object v5
const/4 v7, 0x0
move-object v4, p1
move v6, p2
invoke-static/range {v1 .. v7}, Landroidx/core/view/ViewCompat;->saveAttributeDataForStyleable(Landroid/view/View;Landroid/content/Context;[ILandroid/util/AttributeSet;Landroid/content/res/TypedArray;II)V
2020-05-17 12:40:10 +00:00
:try_start_0
2020-09-09 19:21:20 +00:00
sget p1, Landroidx/appcompat/R$styleable;->ViewBackgroundHelper_android_background:I
2020-05-17 12:40:10 +00:00
2020-09-09 19:21:20 +00:00
invoke-virtual {v0, p1}, Landroidx/appcompat/widget/TintTypedArray;->hasValue(I)Z
2020-05-17 12:40:10 +00:00
2020-09-09 19:21:20 +00:00
move-result p1
2020-05-17 12:40:10 +00:00
2020-09-09 19:21:20 +00:00
const/4 p2, -0x1
2020-05-17 12:40:10 +00:00
2020-09-09 19:21:20 +00:00
if-eqz p1, :cond_0
2020-05-17 12:40:10 +00:00
2020-09-09 19:21:20 +00:00
sget p1, Landroidx/appcompat/R$styleable;->ViewBackgroundHelper_android_background:I
2020-05-17 12:40:10 +00:00
2020-09-09 19:21:20 +00:00
invoke-virtual {v0, p1, p2}, Landroidx/appcompat/widget/TintTypedArray;->getResourceId(II)I
2020-05-17 12:40:10 +00:00
2020-09-09 19:21:20 +00:00
move-result p1
2020-05-17 12:40:10 +00:00
2020-09-09 19:21:20 +00:00
iput p1, p0, Landroidx/appcompat/widget/AppCompatBackgroundHelper;->mBackgroundResId:I
2020-05-17 12:40:10 +00:00
2020-09-09 19:21:20 +00:00
iget-object p1, p0, Landroidx/appcompat/widget/AppCompatBackgroundHelper;->mDrawableManager:Landroidx/appcompat/widget/AppCompatDrawableManager;
2020-05-17 12:40:10 +00:00
iget-object v1, p0, Landroidx/appcompat/widget/AppCompatBackgroundHelper;->mView:Landroid/view/View;
invoke-virtual {v1}, Landroid/view/View;->getContext()Landroid/content/Context;
move-result-object v1
iget v2, p0, Landroidx/appcompat/widget/AppCompatBackgroundHelper;->mBackgroundResId:I
2020-09-09 19:21:20 +00:00
invoke-virtual {p1, v1, v2}, Landroidx/appcompat/widget/AppCompatDrawableManager;->getTintList(Landroid/content/Context;I)Landroid/content/res/ColorStateList;
2020-05-17 12:40:10 +00:00
2020-09-09 19:21:20 +00:00
move-result-object p1
2020-05-17 12:40:10 +00:00
2020-09-09 19:21:20 +00:00
if-eqz p1, :cond_0
2020-05-17 12:40:10 +00:00
2020-09-09 19:21:20 +00:00
invoke-virtual {p0, p1}, Landroidx/appcompat/widget/AppCompatBackgroundHelper;->setInternalBackgroundTint(Landroid/content/res/ColorStateList;)V
2020-05-17 12:40:10 +00:00
:cond_0
2020-09-09 19:21:20 +00:00
sget p1, Landroidx/appcompat/R$styleable;->ViewBackgroundHelper_backgroundTint:I
2020-05-17 12:40:10 +00:00
2020-09-09 19:21:20 +00:00
invoke-virtual {v0, p1}, Landroidx/appcompat/widget/TintTypedArray;->hasValue(I)Z
2020-05-17 12:40:10 +00:00
2020-09-09 19:21:20 +00:00
move-result p1
2020-05-17 12:40:10 +00:00
2020-09-09 19:21:20 +00:00
if-eqz p1, :cond_1
2020-05-17 12:40:10 +00:00
2020-09-09 19:21:20 +00:00
iget-object p1, p0, Landroidx/appcompat/widget/AppCompatBackgroundHelper;->mView:Landroid/view/View;
2020-05-17 12:40:10 +00:00
sget v1, Landroidx/appcompat/R$styleable;->ViewBackgroundHelper_backgroundTint:I
2020-09-09 19:21:20 +00:00
invoke-virtual {v0, v1}, Landroidx/appcompat/widget/TintTypedArray;->getColorStateList(I)Landroid/content/res/ColorStateList;
2020-05-17 12:40:10 +00:00
move-result-object v1
2020-09-09 19:21:20 +00:00
invoke-static {p1, v1}, Landroidx/core/view/ViewCompat;->setBackgroundTintList(Landroid/view/View;Landroid/content/res/ColorStateList;)V
2020-05-17 12:40:10 +00:00
:cond_1
2020-09-09 19:21:20 +00:00
sget p1, Landroidx/appcompat/R$styleable;->ViewBackgroundHelper_backgroundTintMode:I
2020-05-17 12:40:10 +00:00
2020-09-09 19:21:20 +00:00
invoke-virtual {v0, p1}, Landroidx/appcompat/widget/TintTypedArray;->hasValue(I)Z
2020-05-17 12:40:10 +00:00
2020-09-09 19:21:20 +00:00
move-result p1
2020-05-17 12:40:10 +00:00
2020-09-09 19:21:20 +00:00
if-eqz p1, :cond_2
2020-05-17 12:40:10 +00:00
2020-09-09 19:21:20 +00:00
iget-object p1, p0, Landroidx/appcompat/widget/AppCompatBackgroundHelper;->mView:Landroid/view/View;
2020-05-17 12:40:10 +00:00
sget v1, Landroidx/appcompat/R$styleable;->ViewBackgroundHelper_backgroundTintMode:I
2020-09-09 19:21:20 +00:00
invoke-virtual {v0, v1, p2}, Landroidx/appcompat/widget/TintTypedArray;->getInt(II)I
2020-05-17 12:40:10 +00:00
2020-09-09 19:21:20 +00:00
move-result p2
2020-05-17 12:40:10 +00:00
const/4 v1, 0x0
2020-09-09 19:21:20 +00:00
invoke-static {p2, v1}, Landroidx/appcompat/widget/DrawableUtils;->parseTintMode(ILandroid/graphics/PorterDuff$Mode;)Landroid/graphics/PorterDuff$Mode;
2020-05-17 12:40:10 +00:00
2020-09-09 19:21:20 +00:00
move-result-object p2
2020-05-17 12:40:10 +00:00
2020-09-09 19:21:20 +00:00
invoke-static {p1, p2}, Landroidx/core/view/ViewCompat;->setBackgroundTintMode(Landroid/view/View;Landroid/graphics/PorterDuff$Mode;)V
2020-05-17 12:40:10 +00:00
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
:cond_2
2020-09-09 19:21:20 +00:00
invoke-virtual {v0}, Landroidx/appcompat/widget/TintTypedArray;->recycle()V
2020-05-17 12:40:10 +00:00
return-void
:catchall_0
2020-09-09 19:21:20 +00:00
move-exception p1
2020-05-17 12:40:10 +00:00
2020-09-09 19:21:20 +00:00
invoke-virtual {v0}, Landroidx/appcompat/widget/TintTypedArray;->recycle()V
2020-05-17 12:40:10 +00:00
2020-09-09 19:21:20 +00:00
throw p1
2020-05-17 12:40:10 +00:00
.end method
.method public onSetBackgroundDrawable(Landroid/graphics/drawable/Drawable;)V
.locals 0
const/4 p1, -0x1
iput p1, p0, Landroidx/appcompat/widget/AppCompatBackgroundHelper;->mBackgroundResId:I
const/4 p1, 0x0
invoke-virtual {p0, p1}, Landroidx/appcompat/widget/AppCompatBackgroundHelper;->setInternalBackgroundTint(Landroid/content/res/ColorStateList;)V
invoke-virtual {p0}, Landroidx/appcompat/widget/AppCompatBackgroundHelper;->applySupportBackgroundTint()V
return-void
.end method
.method public onSetBackgroundResource(I)V
.locals 2
iput p1, p0, Landroidx/appcompat/widget/AppCompatBackgroundHelper;->mBackgroundResId:I
iget-object v0, p0, Landroidx/appcompat/widget/AppCompatBackgroundHelper;->mDrawableManager:Landroidx/appcompat/widget/AppCompatDrawableManager;
if-eqz v0, :cond_0
iget-object v1, p0, Landroidx/appcompat/widget/AppCompatBackgroundHelper;->mView:Landroid/view/View;
invoke-virtual {v1}, Landroid/view/View;->getContext()Landroid/content/Context;
move-result-object v1
invoke-virtual {v0, v1, p1}, Landroidx/appcompat/widget/AppCompatDrawableManager;->getTintList(Landroid/content/Context;I)Landroid/content/res/ColorStateList;
move-result-object p1
goto :goto_0
:cond_0
const/4 p1, 0x0
:goto_0
invoke-virtual {p0, p1}, Landroidx/appcompat/widget/AppCompatBackgroundHelper;->setInternalBackgroundTint(Landroid/content/res/ColorStateList;)V
invoke-virtual {p0}, Landroidx/appcompat/widget/AppCompatBackgroundHelper;->applySupportBackgroundTint()V
return-void
.end method
.method public setInternalBackgroundTint(Landroid/content/res/ColorStateList;)V
.locals 1
if-eqz p1, :cond_1
iget-object v0, p0, Landroidx/appcompat/widget/AppCompatBackgroundHelper;->mInternalBackgroundTint:Landroidx/appcompat/widget/TintInfo;
if-nez v0, :cond_0
new-instance v0, Landroidx/appcompat/widget/TintInfo;
invoke-direct {v0}, Landroidx/appcompat/widget/TintInfo;-><init>()V
iput-object v0, p0, Landroidx/appcompat/widget/AppCompatBackgroundHelper;->mInternalBackgroundTint:Landroidx/appcompat/widget/TintInfo;
:cond_0
iget-object v0, p0, Landroidx/appcompat/widget/AppCompatBackgroundHelper;->mInternalBackgroundTint:Landroidx/appcompat/widget/TintInfo;
iput-object p1, v0, Landroidx/appcompat/widget/TintInfo;->mTintList:Landroid/content/res/ColorStateList;
const/4 p1, 0x1
iput-boolean p1, v0, Landroidx/appcompat/widget/TintInfo;->mHasTintList:Z
goto :goto_0
:cond_1
const/4 p1, 0x0
iput-object p1, p0, Landroidx/appcompat/widget/AppCompatBackgroundHelper;->mInternalBackgroundTint:Landroidx/appcompat/widget/TintInfo;
:goto_0
invoke-virtual {p0}, Landroidx/appcompat/widget/AppCompatBackgroundHelper;->applySupportBackgroundTint()V
return-void
.end method
.method public setSupportBackgroundTintList(Landroid/content/res/ColorStateList;)V
.locals 1
iget-object v0, p0, Landroidx/appcompat/widget/AppCompatBackgroundHelper;->mBackgroundTint:Landroidx/appcompat/widget/TintInfo;
if-nez v0, :cond_0
new-instance v0, Landroidx/appcompat/widget/TintInfo;
invoke-direct {v0}, Landroidx/appcompat/widget/TintInfo;-><init>()V
iput-object v0, p0, Landroidx/appcompat/widget/AppCompatBackgroundHelper;->mBackgroundTint:Landroidx/appcompat/widget/TintInfo;
:cond_0
iget-object v0, p0, Landroidx/appcompat/widget/AppCompatBackgroundHelper;->mBackgroundTint:Landroidx/appcompat/widget/TintInfo;
iput-object p1, v0, Landroidx/appcompat/widget/TintInfo;->mTintList:Landroid/content/res/ColorStateList;
const/4 p1, 0x1
iput-boolean p1, v0, Landroidx/appcompat/widget/TintInfo;->mHasTintList:Z
invoke-virtual {p0}, Landroidx/appcompat/widget/AppCompatBackgroundHelper;->applySupportBackgroundTint()V
return-void
.end method
.method public setSupportBackgroundTintMode(Landroid/graphics/PorterDuff$Mode;)V
.locals 1
iget-object v0, p0, Landroidx/appcompat/widget/AppCompatBackgroundHelper;->mBackgroundTint:Landroidx/appcompat/widget/TintInfo;
if-nez v0, :cond_0
new-instance v0, Landroidx/appcompat/widget/TintInfo;
invoke-direct {v0}, Landroidx/appcompat/widget/TintInfo;-><init>()V
iput-object v0, p0, Landroidx/appcompat/widget/AppCompatBackgroundHelper;->mBackgroundTint:Landroidx/appcompat/widget/TintInfo;
:cond_0
iget-object v0, p0, Landroidx/appcompat/widget/AppCompatBackgroundHelper;->mBackgroundTint:Landroidx/appcompat/widget/TintInfo;
iput-object p1, v0, Landroidx/appcompat/widget/TintInfo;->mTintMode:Landroid/graphics/PorterDuff$Mode;
const/4 p1, 0x1
iput-boolean p1, v0, Landroidx/appcompat/widget/TintInfo;->mHasTintMode:Z
invoke-virtual {p0}, Landroidx/appcompat/widget/AppCompatBackgroundHelper;->applySupportBackgroundTint()V
return-void
.end method