Offset 3, 24 lines modifiedOffset 3, 31 lines modified
  
3 import·android.graphics.Color;3 import·android.graphics.Color;
4 import·android.content.res.TypedArray;4 import·android.content.res.TypedArray;
5 import·android.util.StateSet;5 import·android.util.StateSet;
6 import·androidx.core.R$attr;6 import·androidx.core.R$attr;
7 import·androidx.core.R$styleable;7 import·androidx.core.R$styleable;
8 import·android.util.Log;8 import·android.util.Log;
 9 import·android.util.TypedValue;
9 import·android.util.AttributeSet;10 import·android.util.AttributeSet;
10 import·org.xmlpull.v1.XmlPullParserException;11 import·org.xmlpull.v1.XmlPullParserException;
11 import·android.util.Xml;12 import·android.util.Xml;
12 import·android.content.res.ColorStateList;13 import·android.content.res.ColorStateList;
13 import·android.content.res.Resources$Theme;14 import·android.content.res.Resources$Theme;
14 import·org.xmlpull.v1.XmlPullParser;15 import·org.xmlpull.v1.XmlPullParser;
15 import·android.content.res.Resources;16 import·android.content.res.Resources;
  
16 public·final·class·ColorStateListInflaterCompat17 public·final·class·ColorStateListInflaterCompat
17 {18 {
 19 ····private·static·final·ThreadLocal·sTempTypedValue;
 20 ····
 21 ····static·{
 22 ········sTempTypedValue·=·new·ThreadLocal();
 23 ····}
 24 ····
18 ····public·static·ColorStateList·createFromXml(final·Resources·resources,·final·XmlPullParser·xmlPullParser,·final·Resources$Theme·resources$Theme)·{25 ····public·static·ColorStateList·createFromXml(final·Resources·resources,·final·XmlPullParser·xmlPullParser,·final·Resources$Theme·resources$Theme)·{
19 ········final·AttributeSet·attributeSet·=·Xml.asAttributeSet(xmlPullParser);26 ········final·AttributeSet·attributeSet·=·Xml.asAttributeSet(xmlPullParser);
20 ········int·next;27 ········int·next;
21 ········int·n;28 ········int·n;
22 ········do·{29 ········do·{
23 ············next·=·xmlPullParser.next();30 ············next·=·xmlPullParser.next();
24 ············n·=·2;31 ············n·=·2;
Offset 39, 14 lines modifiedOffset 46, 23 lines modified
39 ········final·StringBuilder·sb·=·new·StringBuilder();46 ········final·StringBuilder·sb·=·new·StringBuilder();
40 ········sb.append(xmlPullParser.getPositionDescription());47 ········sb.append(xmlPullParser.getPositionDescription());
41 ········sb.append(":·invalid·color·state·list·tag·");48 ········sb.append(":·invalid·color·state·list·tag·");
42 ········sb.append(name);49 ········sb.append(name);
43 ········throw·new·XmlPullParserException(sb.toString());50 ········throw·new·XmlPullParserException(sb.toString());
44 ····}51 ····}
45 ····52 ····
 53 ····private·static·TypedValue·getTypedValue()·{
 54 ········TypedValue·value·=·(TypedValue)ColorStateListInflaterCompat.sTempTypedValue.get();
 55 ········if·(value·==·null)·{
 56 ············value·=·new·TypedValue();
 57 ············ColorStateListInflaterCompat.sTempTypedValue.set(value);
 58 ········}
 59 ········return·value;
 60 ····}
 61 ····
46 ····public·static·ColorStateList·inflate(final·Resources·resources,·final·int·n,·final·Resources$Theme·resources$Theme)·{62 ····public·static·ColorStateList·inflate(final·Resources·resources,·final·int·n,·final·Resources$Theme·resources$Theme)·{
47 ········try·{63 ········try·{
48 ············return·createFromXml(resources,·(XmlPullParser)resources.getXml(n),·resources$Theme);64 ············return·createFromXml(resources,·(XmlPullParser)resources.getXml(n),·resources$Theme);
49 ········}65 ········}
50 ········catch·(Exception·ex)·{66 ········catch·(Exception·ex)·{
51 ············Log.e("CSLCompat",·"Failed·to·inflate·ColorStateList.",·(Throwable)ex);67 ············Log.e("CSLCompat",·"Failed·to·inflate·ColorStateList.",·(Throwable)ex);
52 ············return·null;68 ············return·null;
Offset 66, 55 lines modifiedOffset 82, 93 lines modified
66 ············if·(next·==·n)·{82 ············if·(next·==·n)·{
67 ················break;83 ················break;
68 ············}84 ············}
69 ············final·int·depth2·=·xmlPullParser.getDepth();85 ············final·int·depth2·=·xmlPullParser.getDepth();
70 ············if·(depth2·<·n2·&&·next·==·3)·{86 ············if·(depth2·<·n2·&&·next·==·3)·{
71 ················break;87 ················break;
72 ············}88 ············}
 89 ············if·(next·==·2·&&·depth2·<=·n2)·{
73 ············if·(next·==·2·&&·depth2·<=·n2·&&·xmlPullParser.getName().equals("item"))·{90 ················if·(xmlPullParser.getName().equals("item"))·{
74 ················final·TypedArray·obtainAttributes·=·obtainAttributes(resources,·resources$Theme,·set,·R$styleable.ColorStateListItem);91 ····················final·TypedArray·obtainAttributes·=·obtainAttributes(resources,·resources$Theme,·set,·R$styleable.ColorStateListItem);
 92 ····················final·int·colorStateListItem_android_color·=·R$styleable.ColorStateListItem_android_color;
 93 ····················final·int·n5·=·-1;
75 ················final·int·color·=·obtainAttributes.getColor(R$styleable.ColorStateListItem_android_color,·-65281);94 ····················final·int·resourceId·=·obtainAttributes.getResourceId(colorStateListItem_android_color,·n5);
 95 ····················final·int·n6·=·-65281;
76 ················float·n5·=·1.0f; 
77 ················if·(obtainAttributes.hasValue(R$styleable.ColorStateListItem_android_alpha))·{ 
78 ····················n5·=·obtainAttributes.getFloat(R$styleable.ColorStateListItem_android_alpha,·n5); 
79 ················} 
80 ················else·if·(obtainAttributes.hasValue(R$styleable.ColorStateListItem_alpha))·{ 
81 ····················n5·=·obtainAttributes.getFloat(R$styleable.ColorStateListItem_alpha,·n5); 
82 ················} 
83 ················obtainAttributes.recycle(); 
84 ················final·int·attributeCount·=·set.getAttributeCount(); 
85 ················final·int[]·array2·=·new·int[attributeCount]; 
86 ················int·i·=·0; 
87 ················int·n6·=·0;96 ····················int·n7·=·0;
88 ················while·(i·<·attributeCount)·{ 
89 ····················int·attributeNameResource·=·set.getAttributeNameResource(i); 
90 ····················if·(attributeNameResource·!=·16843173·&&·attributeNameResource·!=·16843551·&&·attributeNameResource·!=·R$attr.alpha)·{97 ····················Label_0274:·{
 98 ························if·(resourceId·!=·n5·&&·!isColorInt(resources,·resourceId))·{
 99 ····························try·{
 100 ································final·ColorStateList·fromXml·=·createFromXml(resources,·(XmlPullParser)resources.getXml(resourceId),·resources$Theme);
 101 ································try·{
 102 ····································n7·=·fromXml.getDefaultColor();
91 ························final·int·n7·=·n6·+·1;103 ································}
92 ························if·(!set.getAttributeBooleanValue(i,·false))·{ 
93 ····························attributeNameResource·=·-attributeNameResource;104 ································catch·(Exception·ex)·{
 105 ····································n7·=·obtainAttributes.getColor(R$styleable.ColorStateListItem_android_color,·n6);
 106 ································}
 107 ································break·Label_0274;
 108 ····························}
 109 ····························catch·(Exception·ex2)·{}
94 ························}110 ························}
 111 ························n7·=·obtainAttributes.getColor(R$styleable.ColorStateListItem_android_color,·n6);
95 ························array2[n6]·=·attributeNameResource; 
96 ························n6·=·n7; 
97 ····················}112 ····················}
 113 ····················float·n8·=·1.0f;
 114 ····················if·(obtainAttributes.hasValue(R$styleable.ColorStateListItem_android_alpha))·{
 115 ························n8·=·obtainAttributes.getFloat(R$styleable.ColorStateListItem_android_alpha,·n8);
 116 ····················}
 117 ····················else·if·(obtainAttributes.hasValue(R$styleable.ColorStateListItem_alpha))·{
 118 ························n8·=·obtainAttributes.getFloat(R$styleable.ColorStateListItem_alpha,·n8);
 119 ····················}
 120 ····················obtainAttributes.recycle();
 121 ····················final·int·attributeCount·=·set.getAttributeCount();
 122 ····················final·int[]·array2·=·new·int[attributeCount];
 123 ····················int·i·=·0;
 124 ····················int·n9·=·0;
 125 ····················while·(i·<·attributeCount)·{
 126 ························int·attributeNameResource·=·set.getAttributeNameResource(i);
 127 ························if·(attributeNameResource·!=·16843173·&&·attributeNameResource·!=·16843551·&&·attributeNameResource·!=·R$attr.alpha)·{
 128 ····························final·int·n10·=·n9·+·1;
 129 ····························if·(!set.getAttributeBooleanValue(i,·false))·{
 130 ································attributeNameResource·=·-attributeNameResource;
 131 ····························}
 132 ····························array2[n9]·=·attributeNameResource;
 133 ····························n9·=·n10;
 134 ························}
 135 ························++i;
 136 ····················}
 137 ····················final·int[]·trimStateSet·=·StateSet.trimStateSet(array2,·n9);
 138 ····················append·=·GrowingArrayUtils.append(append,·n4,·modulateColorAlpha(n7,·n8));
 139 ····················array·=·(int[][])GrowingArrayUtils.append((Object[])array,·n4,·(Object)trimStateSet);
98 ····················++i;140 ····················++n4;
99 ················}141 ················}
100 ················final·int[]·trimStateSet·=·StateSet.trimStateSet(array2,·n6); 
101 ················append·=·GrowingArrayUtils.append(append,·n4,·modulateColorAlpha(color,·n5)); 
102 ················array·=·(int[][])GrowingArrayUtils.append((Object[])array,·n4,·(Object)trimStateSet); 
103 ················++n4; 
104 ············}142 ············}
105 ············n·=·1;143 ············n·=·1;
106 ········}144 ········}
107 ········final·int[]·array3·=·new·int[n4];145 ········final·int[]·array3·=·new·int[n4];
108 ········final·int[][]·array4·=·new·int[n4][];146 ········final·int[][]·array4·=·new·int[n4][];
109 ········System.arraycopy(append,·0,·array3,·0,·n4);147 ········System.arraycopy(append,·0,·array3,·0,·n4);
110 ········System.arraycopy(array,·0,·array4,·0,·n4);148 ········System.arraycopy(array,·0,·array4,·0,·n4);
111 ········return·new·ColorStateList(array4,·array3);149 ········return·new·ColorStateList(array4,·array3);
112 ····}150 ····}
113 ····151 ····
 152 ····private·static·boolean·isColorInt(final·Resources·resources,·int·n)·{
 153 ········final·TypedValue·typedValue·=·getTypedValue();
 154 ········boolean·b·=·true;
 155 ········resources.getValue(n,·typedValue,·b);
 156 ········final·int·type·=·typedValue.type;
 157 ········n·=·28;
 158 ········if·(type·>=·n)·{
 159 ············n·=·31;
 160 ············if·(type·<=·n)·{
 161 ················return·b;
 162 ············}
 163 ········}
 164 ········b·=·false;
 165 ········return·b;
 166 ····}
 167 ····
114 ····private·static·int·modulateColorAlpha(int·n,·final·float·n2)·{168 ····private·static·int·modulateColorAlpha(int·n,·final·float·n2)·{
115 ········final·int·round·=·Math.round((float)Color.alpha(n)·*·n2);169 ········final·int·round·=·Math.round((float)Color.alpha(n)·*·n2);
116 ········n·&=·0xFFFFFF;170 ········n·&=·0xFFFFFF;
117 ········return·n·|·round·<<·24;171 ········return·n·|·round·<<·24;
118 ····}172 ····}
119 ····173 ····
120 ····private·static·TypedArray·obtainAttributes(final·Resources·resources,·final·Resources$Theme·resources$Theme,·final·AttributeSet·set,·final·int[]·array)·{174 ····private·static·TypedArray·obtainAttributes(final·Resources·resources,·final·Resources$Theme·resources$Theme,·final·AttributeSet·set,·final·int[]·array)·{