| 160 | } |
| 161 | |
| 162 | public int next() throws IOException { |
| 163 | if (fileSize < 0) { |
| 164 | int type = in.getInt() & 0xFFFF; |
| 165 | if (type != RES_XML_TYPE) { |
| 166 | throw new RuntimeException(); |
| 167 | } |
| 168 | fileSize = in.getInt(); |
| 169 | return START_FILE; |
| 170 | } |
| 171 | int event = -1; |
| 172 | for (int p = in.position(); p < fileSize; p = in.position()) { |
| 173 | int type = in.getInt() & 0xFFFF; |
| 174 | int size = in.getInt(); |
| 175 | switch (type) { |
| 176 | case RES_XML_START_ELEMENT_TYPE: { |
| 177 | { |
| 178 | lineNumber = in.getInt(); |
| 179 | in.getInt();/* skip, 0xFFFFFFFF */ |
| 180 | nsIdx = in.getInt(); |
| 181 | nameIdx = in.getInt(); |
| 182 | int flag = in.getInt();// 0x00140014 ? |
| 183 | if (flag != 0x00140014) { |
| 184 | throw new RuntimeException(); |
| 185 | } |
| 186 | } |
| 187 | |
| 188 | attributeCount = in.getShort() & 0xFFFF; |
| 189 | idAttribute = (in.getShort() & 0xFFFF) - 1; |
| 190 | classAttribute = (in.getShort() & 0xFFFF) - 1; |
| 191 | styleAttribute = (in.getShort() & 0xFFFF) - 1; |
| 192 | |
| 193 | attrs = in.asIntBuffer(); |
| 194 | |
| 195 | // attrResId = new int[attributeCount]; |
| 196 | // attrName = new int[attributeCount]; |
| 197 | // attrNs = new int[attributeCount]; |
| 198 | // attrType = new int[attributeCount]; |
| 199 | // attrValue = new Object[attributeCount]; |
| 200 | // for (int i = 0; i < attributeCount; i++) { |
| 201 | // int attrNsIdx = in.getInt(); |
| 202 | // int attrNameIdx = in.getInt(); |
| 203 | // int raw = in.getInt(); |
| 204 | // int aValueType = in.getInt() >>> 24; |
| 205 | // int aValue = in.getInt(); |
| 206 | // Object value = null; |
| 207 | // switch (aValueType) { |
| 208 | // case TYPE_STRING: |
| 209 | // value = strings[aValue]; |
| 210 | // break; |
| 211 | // case TYPE_INT_BOOLEAN: |
| 212 | // value = aValue != 0; |
| 213 | // break; |
| 214 | // default: |
| 215 | // value = aValue; |
| 216 | // } |
| 217 | // int resourceId = attrNameIdx < this.resourceIds.length ? |
| 218 | // resourceIds[attrNameIdx] : -1; |
| 219 | // attrNs[i] = attrNsIdx; |