+ResPackage.getOrCreateConfig().

This commit is contained in:
Ryszard Wiśniewski 2010-09-01 18:57:39 +02:00
parent 430fc72388
commit 6a75830a4f
2 changed files with 13 additions and 11 deletions

View File

@ -84,6 +84,16 @@ public class ResPackage {
return config;
}
public ResConfig getOrCreateConfig(ResConfigFlags flags)
throws AndrolibException {
ResConfig config = mConfigs.get(flags);
if (config == null) {
config = new ResConfig(flags);
mConfigs.put(flags, config);
}
return config;
}
public List<ResType> listTypes() {
return new ArrayList<ResType>(mTypes.values());
}

View File

@ -155,16 +155,8 @@ public class ARSCDecoder {
}
}
ResConfig config;
if (flags.isInvalid && ! mKeepBroken) {
config = null;
} else if (mPkg.hasConfig(flags)) {
config = mPkg.getConfig(flags);
} else {
config = new ResConfig(flags);
mPkg.addConfig(config);
}
mConfig = config;
mConfig = flags.isInvalid && ! mKeepBroken ?
null : mPkg.getOrCreateConfig(flags);
for (int i = 0; i < entryOffsets.length; i++) {
if (entryOffsets[i] != -1) {
@ -174,7 +166,7 @@ public class ARSCDecoder {
}
}
return config;
return mConfig;
}
private void readEntry() throws IOException, AndrolibException {