@@ -80,39 +80,29 @@ public ResIntBasedValue factory(String value, int rawValue) {
80
80
return new ResStringValue (value , rawValue );
81
81
}
82
82
83
- public ResBagValue bagFactory (int parent , Duo <Integer , ResScalarValue >[] items , ResTypeSpec resTypeSpec ) throws AndrolibException {
83
+ public ResBagValue bagFactory (int parent , Duo <Integer , ResScalarValue >[] items , ResTypeSpec resTypeSpec )
84
+ throws AndrolibException {
84
85
ResReferenceValue parentVal = newReference (parent , null );
85
86
86
87
if (items .length == 0 ) {
87
88
return new ResBagValue (parentVal );
88
89
}
89
- int key = items [0 ].m1 ;
90
- if (key == ResAttr .BAG_KEY_ATTR_TYPE ) {
91
- return ResAttr .factory (parentVal , items , this , mPackage );
92
- }
93
-
94
90
String resTypeName = resTypeSpec .getName ();
95
91
96
- // Android O Preview added an unknown enum for c. This is hardcoded as 0 for now.
97
- if (ResTypeSpec .RES_TYPE_NAME_ARRAY .equals (resTypeName )
98
- || key == ResArrayValue .BAG_KEY_ARRAY_START || key == 0 ) {
99
- return new ResArrayValue (parentVal , items );
100
- }
101
-
102
- if (ResTypeSpec .RES_TYPE_NAME_PLURALS .equals (resTypeName ) ||
103
- (key >= ResPluralsValue .BAG_KEY_PLURALS_START && key <= ResPluralsValue .BAG_KEY_PLURALS_END )) {
104
- return new ResPluralsValue (parentVal , items );
105
- }
106
-
107
- if (ResTypeSpec .RES_TYPE_NAME_ATTR .equals (resTypeName )) {
108
- return new ResAttr (parentVal , 0 , null , null , null );
109
- }
110
-
111
- if (resTypeName .startsWith (ResTypeSpec .RES_TYPE_NAME_STYLES )) {
112
- return new ResStyleValue (parentVal , items , this );
92
+ switch (resTypeName ) {
93
+ case ResTypeSpec .RES_TYPE_NAME_ATTR :
94
+ case ResTypeSpec .RES_TYPE_NAME_ATTR_PRIVATE :
95
+ return ResAttr .factory (parentVal , items , this , mPackage );
96
+ case ResTypeSpec .RES_TYPE_NAME_ARRAY :
97
+ return new ResArrayValue (parentVal , items );
98
+ case ResTypeSpec .RES_TYPE_NAME_PLURALS :
99
+ return new ResPluralsValue (parentVal , items );
100
+ default :
101
+ if (resTypeName .startsWith (ResTypeSpec .RES_TYPE_NAME_STYLES )) {
102
+ return new ResStyleValue (parentVal , items , this );
103
+ }
104
+ throw new AndrolibException ("unsupported res type name for bags. Found: " + resTypeName );
113
105
}
114
-
115
- throw new AndrolibException ("unsupported res type name for bags. Found: " + resTypeName );
116
106
}
117
107
118
108
public ResReferenceValue newReference (int resID , String rawValue ) {
0 commit comments