public ResType getOrCreateConfig(ResConfigFlags flags) throws AndrolibException { ResType config = mConfigs.get(flags); if (config == null) { config = new ResType(flags); mConfigs.put(flags, config); } return config; }
public void addResource(ResResource res) throws AndrolibException { addResource(res, false); }
public void addConfig(ResType config) throws AndrolibException { if (mConfigs.put(config.getFlags(), config) != null) { throw new AndrolibException("Multiple configs: " + config); } }
public ResResource getResource(ResType config) throws AndrolibException { return getResource(config.getFlags()); }
public void replace(ResValue value) throws AndrolibException { ResResource res = new ResResource(mConfig, mResSpec, value); mConfig.addResource(res, true); mResSpec.addResource(res, true); }
public void removeResource(ResResource res) throws AndrolibException { ResConfigFlags flags = res.getConfig().getFlags(); mResources.remove(flags); }
mType.addResource(res); spec.addResource(res); } catch (AndrolibException ex) { if (mKeepBroken) { mType.addResource(res, true); spec.addResource(res, true); LOGGER.warning(String.format("Duplicate Resource Detected. Ignoring duplicate: %s", res.toString()));
public boolean hasResource(ResType config) { return hasResource(config.getFlags()); }
private void addMissingResSpecs() throws AndrolibException { int resId = mResId & 0xffff0000; for (int i = 0; i < mMissingResSpecs.length; i++) { if (!mMissingResSpecs[i]) { continue; } ResResSpec spec = new ResResSpec(new ResID(resId | i), "APKTOOL_DUMMY_" + Integer.toHexString(i), mPkg, mTypeSpec); // If we already have this resID dont add it again. if (! mPkg.hasResSpec(new ResID(resId | i))) { mPkg.addResSpec(spec); mTypeSpec.addResSpec(spec); if (mType == null) { mType = mPkg.getOrCreateConfig(new ResConfigFlags()); } ResValue value = new ResBoolValue(false, 0, null); ResResource res = new ResResource(mType, spec, value); mPkg.addResource(res); mType.addResource(res); spec.addResource(res); } } }
public void addResource(ResResource res, boolean overwrite) throws AndrolibException { ResConfigFlags flags = res.getConfig().getFlags(); if (mResources.put(flags, res) != null && !overwrite) { throw new AndrolibException(String.format("Multiple resources: spec=%s, config=%s", this, flags)); } }
public String getPath() { return "values" + mConfig.getFlags().getQualifiers() + "/" + mType.getName() + (mType.getName().endsWith("s") ? "" : "s") + ".xml"; }
public String getFilePath() { return mResSpec.getType().getName() + mConfig.getFlags().getQualifiers() + "/" + mResSpec.getName(); }