421 lines
10 KiB
Smali
421 lines
10 KiB
Smali
.class public final Landroidx/core/content/res/ColorStateListInflaterCompat;
|
|
.super Ljava/lang/Object;
|
|
.source "ColorStateListInflaterCompat.java"
|
|
|
|
|
|
# direct methods
|
|
.method private constructor <init>()V
|
|
.locals 0
|
|
|
|
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public static createFromXml(Landroid/content/res/Resources;Lorg/xmlpull/v1/XmlPullParser;Landroid/content/res/Resources$Theme;)Landroid/content/res/ColorStateList;
|
|
.locals 4
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
value = {
|
|
Lorg/xmlpull/v1/XmlPullParserException;,
|
|
Ljava/io/IOException;
|
|
}
|
|
.end annotation
|
|
|
|
invoke-static {p1}, Landroid/util/Xml;->asAttributeSet(Lorg/xmlpull/v1/XmlPullParser;)Landroid/util/AttributeSet;
|
|
|
|
move-result-object v0
|
|
|
|
:cond_0
|
|
invoke-interface {p1}, Lorg/xmlpull/v1/XmlPullParser;->next()I
|
|
|
|
move-result v1
|
|
|
|
const/4 v2, 0x2
|
|
|
|
if-eq v1, v2, :cond_1
|
|
|
|
const/4 v3, 0x1
|
|
|
|
if-ne v1, v3, :cond_0
|
|
|
|
:cond_1
|
|
if-ne v1, v2, :cond_2
|
|
|
|
invoke-static {p0, p1, v0, p2}, Landroidx/core/content/res/ColorStateListInflaterCompat;->createFromXmlInner(Landroid/content/res/Resources;Lorg/xmlpull/v1/XmlPullParser;Landroid/util/AttributeSet;Landroid/content/res/Resources$Theme;)Landroid/content/res/ColorStateList;
|
|
|
|
move-result-object p0
|
|
|
|
return-object p0
|
|
|
|
:cond_2
|
|
new-instance p0, Lorg/xmlpull/v1/XmlPullParserException;
|
|
|
|
const-string p1, "No start tag found"
|
|
|
|
invoke-direct {p0, p1}, Lorg/xmlpull/v1/XmlPullParserException;-><init>(Ljava/lang/String;)V
|
|
|
|
goto :goto_1
|
|
|
|
:goto_0
|
|
throw p0
|
|
|
|
:goto_1
|
|
goto :goto_0
|
|
.end method
|
|
|
|
.method public static createFromXmlInner(Landroid/content/res/Resources;Lorg/xmlpull/v1/XmlPullParser;Landroid/util/AttributeSet;Landroid/content/res/Resources$Theme;)Landroid/content/res/ColorStateList;
|
|
.locals 2
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
value = {
|
|
Lorg/xmlpull/v1/XmlPullParserException;,
|
|
Ljava/io/IOException;
|
|
}
|
|
.end annotation
|
|
|
|
invoke-interface {p1}, Lorg/xmlpull/v1/XmlPullParser;->getName()Ljava/lang/String;
|
|
|
|
move-result-object v0
|
|
|
|
const-string v1, "selector"
|
|
|
|
invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
|
|
|
|
move-result v1
|
|
|
|
if-eqz v1, :cond_0
|
|
|
|
invoke-static {p0, p1, p2, p3}, Landroidx/core/content/res/ColorStateListInflaterCompat;->inflate(Landroid/content/res/Resources;Lorg/xmlpull/v1/XmlPullParser;Landroid/util/AttributeSet;Landroid/content/res/Resources$Theme;)Landroid/content/res/ColorStateList;
|
|
|
|
move-result-object p0
|
|
|
|
return-object p0
|
|
|
|
:cond_0
|
|
new-instance p0, Lorg/xmlpull/v1/XmlPullParserException;
|
|
|
|
new-instance p2, Ljava/lang/StringBuilder;
|
|
|
|
invoke-direct {p2}, Ljava/lang/StringBuilder;-><init>()V
|
|
|
|
invoke-interface {p1}, Lorg/xmlpull/v1/XmlPullParser;->getPositionDescription()Ljava/lang/String;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-virtual {p2, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
const-string p1, ": invalid color state list tag "
|
|
|
|
invoke-virtual {p2, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {p2, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {p2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-direct {p0, p1}, Lorg/xmlpull/v1/XmlPullParserException;-><init>(Ljava/lang/String;)V
|
|
|
|
throw p0
|
|
.end method
|
|
|
|
.method public static inflate(Landroid/content/res/Resources;ILandroid/content/res/Resources$Theme;)Landroid/content/res/ColorStateList;
|
|
.locals 0
|
|
|
|
:try_start_0
|
|
invoke-virtual {p0, p1}, Landroid/content/res/Resources;->getXml(I)Landroid/content/res/XmlResourceParser;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-static {p0, p1, p2}, 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, "CSLCompat"
|
|
|
|
const-string p2, "Failed to inflate ColorStateList."
|
|
|
|
invoke-static {p1, p2, p0}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
|
|
|
|
const/4 p0, 0x0
|
|
|
|
return-object p0
|
|
.end method
|
|
|
|
.method private static inflate(Landroid/content/res/Resources;Lorg/xmlpull/v1/XmlPullParser;Landroid/util/AttributeSet;Landroid/content/res/Resources$Theme;)Landroid/content/res/ColorStateList;
|
|
.locals 17
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
value = {
|
|
Lorg/xmlpull/v1/XmlPullParserException;,
|
|
Ljava/io/IOException;
|
|
}
|
|
.end annotation
|
|
|
|
move-object/from16 v0, p2
|
|
|
|
invoke-interface/range {p1 .. p1}, Lorg/xmlpull/v1/XmlPullParser;->getDepth()I
|
|
|
|
move-result v1
|
|
|
|
const/4 v2, 0x1
|
|
|
|
add-int/2addr v1, v2
|
|
|
|
const/16 v3, 0x14
|
|
|
|
new-array v4, v3, [[I
|
|
|
|
new-array v3, v3, [I
|
|
|
|
const/4 v5, 0x0
|
|
|
|
const/4 v6, 0x0
|
|
|
|
:goto_0
|
|
invoke-interface/range {p1 .. p1}, Lorg/xmlpull/v1/XmlPullParser;->next()I
|
|
|
|
move-result v7
|
|
|
|
if-eq v7, v2, :cond_7
|
|
|
|
invoke-interface/range {p1 .. p1}, Lorg/xmlpull/v1/XmlPullParser;->getDepth()I
|
|
|
|
move-result v8
|
|
|
|
if-ge v8, v1, :cond_0
|
|
|
|
const/4 v9, 0x3
|
|
|
|
if-eq v7, v9, :cond_7
|
|
|
|
:cond_0
|
|
const/4 v9, 0x2
|
|
|
|
if-ne v7, v9, :cond_6
|
|
|
|
if-gt v8, v1, :cond_6
|
|
|
|
invoke-interface/range {p1 .. p1}, Lorg/xmlpull/v1/XmlPullParser;->getName()Ljava/lang/String;
|
|
|
|
move-result-object v7
|
|
|
|
const-string v8, "item"
|
|
|
|
invoke-virtual {v7, v8}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
|
|
|
|
move-result v7
|
|
|
|
if-eqz v7, :cond_6
|
|
|
|
sget-object v7, Landroidx/core/R$styleable;->ColorStateListItem:[I
|
|
|
|
move-object/from16 v8, p0
|
|
|
|
move-object/from16 v9, p3
|
|
|
|
invoke-static {v8, v9, v0, v7}, Landroidx/core/content/res/ColorStateListInflaterCompat;->obtainAttributes(Landroid/content/res/Resources;Landroid/content/res/Resources$Theme;Landroid/util/AttributeSet;[I)Landroid/content/res/TypedArray;
|
|
|
|
move-result-object v7
|
|
|
|
sget v10, Landroidx/core/R$styleable;->ColorStateListItem_android_color:I
|
|
|
|
const v11, -0xff01
|
|
|
|
invoke-virtual {v7, v10, v11}, Landroid/content/res/TypedArray;->getColor(II)I
|
|
|
|
move-result v10
|
|
|
|
sget v11, Landroidx/core/R$styleable;->ColorStateListItem_android_alpha:I
|
|
|
|
invoke-virtual {v7, v11}, Landroid/content/res/TypedArray;->hasValue(I)Z
|
|
|
|
move-result v11
|
|
|
|
const/high16 v12, 0x3f800000 # 1.0f
|
|
|
|
if-eqz v11, :cond_1
|
|
|
|
sget v11, Landroidx/core/R$styleable;->ColorStateListItem_android_alpha:I
|
|
|
|
invoke-virtual {v7, v11, v12}, Landroid/content/res/TypedArray;->getFloat(IF)F
|
|
|
|
move-result v12
|
|
|
|
goto :goto_1
|
|
|
|
:cond_1
|
|
sget v11, Landroidx/core/R$styleable;->ColorStateListItem_alpha:I
|
|
|
|
invoke-virtual {v7, v11}, Landroid/content/res/TypedArray;->hasValue(I)Z
|
|
|
|
move-result v11
|
|
|
|
if-eqz v11, :cond_2
|
|
|
|
sget v11, Landroidx/core/R$styleable;->ColorStateListItem_alpha:I
|
|
|
|
invoke-virtual {v7, v11, v12}, Landroid/content/res/TypedArray;->getFloat(IF)F
|
|
|
|
move-result v12
|
|
|
|
:cond_2
|
|
:goto_1
|
|
invoke-virtual {v7}, Landroid/content/res/TypedArray;->recycle()V
|
|
|
|
invoke-interface/range {p2 .. p2}, Landroid/util/AttributeSet;->getAttributeCount()I
|
|
|
|
move-result v7
|
|
|
|
new-array v11, v7, [I
|
|
|
|
const/4 v13, 0x0
|
|
|
|
const/4 v14, 0x0
|
|
|
|
:goto_2
|
|
if-ge v13, v7, :cond_5
|
|
|
|
invoke-interface {v0, v13}, Landroid/util/AttributeSet;->getAttributeNameResource(I)I
|
|
|
|
move-result v15
|
|
|
|
const v2, 0x10101a5
|
|
|
|
if-eq v15, v2, :cond_4
|
|
|
|
const v2, 0x101031f
|
|
|
|
if-eq v15, v2, :cond_4
|
|
|
|
sget v2, Landroidx/core/R$attr;->alpha:I
|
|
|
|
if-eq v15, v2, :cond_4
|
|
|
|
add-int/lit8 v2, v14, 0x1
|
|
|
|
invoke-interface {v0, v13, v5}, Landroid/util/AttributeSet;->getAttributeBooleanValue(IZ)Z
|
|
|
|
move-result v16
|
|
|
|
if-eqz v16, :cond_3
|
|
|
|
goto :goto_3
|
|
|
|
:cond_3
|
|
neg-int v15, v15
|
|
|
|
:goto_3
|
|
aput v15, v11, v14
|
|
|
|
move v14, v2
|
|
|
|
:cond_4
|
|
add-int/lit8 v13, v13, 0x1
|
|
|
|
const/4 v2, 0x1
|
|
|
|
goto :goto_2
|
|
|
|
:cond_5
|
|
invoke-static {v11, v14}, Landroid/util/StateSet;->trimStateSet([II)[I
|
|
|
|
move-result-object v2
|
|
|
|
invoke-static {v10, v12}, Landroidx/core/content/res/ColorStateListInflaterCompat;->modulateColorAlpha(IF)I
|
|
|
|
move-result v7
|
|
|
|
invoke-static {v3, v6, v7}, Landroidx/core/content/res/GrowingArrayUtils;->append([III)[I
|
|
|
|
move-result-object v3
|
|
|
|
invoke-static {v4, v6, v2}, Landroidx/core/content/res/GrowingArrayUtils;->append([Ljava/lang/Object;ILjava/lang/Object;)[Ljava/lang/Object;
|
|
|
|
move-result-object v2
|
|
|
|
move-object v4, v2
|
|
|
|
check-cast v4, [[I
|
|
|
|
add-int/lit8 v6, v6, 0x1
|
|
|
|
goto :goto_4
|
|
|
|
:cond_6
|
|
move-object/from16 v8, p0
|
|
|
|
move-object/from16 v9, p3
|
|
|
|
:goto_4
|
|
const/4 v2, 0x1
|
|
|
|
goto/16 :goto_0
|
|
|
|
:cond_7
|
|
new-array v0, v6, [I
|
|
|
|
new-array v1, v6, [[I
|
|
|
|
invoke-static {v3, v5, v0, v5, v6}, Ljava/lang/System;->arraycopy(Ljava/lang/Object;ILjava/lang/Object;II)V
|
|
|
|
invoke-static {v4, v5, v1, v5, v6}, Ljava/lang/System;->arraycopy(Ljava/lang/Object;ILjava/lang/Object;II)V
|
|
|
|
new-instance v2, Landroid/content/res/ColorStateList;
|
|
|
|
invoke-direct {v2, v1, v0}, Landroid/content/res/ColorStateList;-><init>([[I[I)V
|
|
|
|
return-object v2
|
|
.end method
|
|
|
|
.method private static modulateColorAlpha(IF)I
|
|
.locals 1
|
|
|
|
invoke-static {p0}, Landroid/graphics/Color;->alpha(I)I
|
|
|
|
move-result v0
|
|
|
|
int-to-float v0, v0
|
|
|
|
mul-float v0, v0, p1
|
|
|
|
invoke-static {v0}, Ljava/lang/Math;->round(F)I
|
|
|
|
move-result p1
|
|
|
|
const v0, 0xffffff
|
|
|
|
and-int/2addr p0, v0
|
|
|
|
shl-int/lit8 p1, p1, 0x18
|
|
|
|
or-int/2addr p0, p1
|
|
|
|
return p0
|
|
.end method
|
|
|
|
.method private static obtainAttributes(Landroid/content/res/Resources;Landroid/content/res/Resources$Theme;Landroid/util/AttributeSet;[I)Landroid/content/res/TypedArray;
|
|
.locals 0
|
|
|
|
if-nez p1, :cond_0
|
|
|
|
invoke-virtual {p0, p2, p3}, Landroid/content/res/Resources;->obtainAttributes(Landroid/util/AttributeSet;[I)Landroid/content/res/TypedArray;
|
|
|
|
move-result-object p0
|
|
|
|
return-object p0
|
|
|
|
:cond_0
|
|
const/4 p0, 0x0
|
|
|
|
invoke-virtual {p1, p2, p3, p0, p0}, Landroid/content/res/Resources$Theme;->obtainStyledAttributes(Landroid/util/AttributeSet;[III)Landroid/content/res/TypedArray;
|
|
|
|
move-result-object p0
|
|
|
|
return-object p0
|
|
.end method
|