Tabnine Logo
ResResSpec
Code IndexAdd Tabnine to your IDE (free)

How to use
ResResSpec
in
brut.androlib.res.data

Best Java code snippets using brut.androlib.res.data.ResResSpec (Showing top 20 results out of 315)

origin: iBotPeaches/Apktool

@Override
protected String encodeAsResXml() throws AndrolibException {
  if (isNull()) {
    return "@null";
  }
  ResResSpec spec = getReferent();
  if (spec == null) {
    return "@null";
  }
  boolean newId = spec.hasDefaultResource() && spec.getDefaultResource().getValue() instanceof ResIdValue;
  // generate the beginning to fix @android
  String mStart = (mTheme ? '?' : '@') + (newId ? "+" : "");
  return mStart + spec.getFullName(mPackage, mTheme && spec.getType().getName().equals("attr"));
}
origin: iBotPeaches/Apktool

public void removeResSpec(ResResSpec spec) throws AndrolibException {
  mResSpecs.remove(spec.getId());
}
origin: iBotPeaches/Apktool

public void addResource(ResResource res) throws AndrolibException {
  addResource(res, false);
}
origin: iBotPeaches/Apktool

public String getFullName(ResPackage relativeToPackage, boolean excludeType) {
  return getFullName(getPackage().equals(relativeToPackage), excludeType);
}
origin: iBotPeaches/Apktool

public String getFullName(boolean excludePackage, boolean excludeType) {
  return (excludePackage ? "" : getPackage().getName() + ":")
      + (excludeType ? "" : getType().getName() + "/") + getName();
}
origin: iBotPeaches/Apktool

                ResResource res) throws IOException, AndrolibException {
serializer.startTag(null, "style");
serializer.attribute(null, "name", res.getResSpec().getName());
if (!mParent.isNull() && !mParent.referentIsNull()) {
  serializer.attribute(null, "parent", mParent.encodeAsResXmlAttr());
} else if (res.getResSpec().getName().indexOf('.') != -1) {
  serializer.attribute(null, "parent", "");
  String value = null;
  ResValue resource = spec.getDefaultResource().getValue();
  if (resource instanceof ResReferenceValue) {
    continue;
    ResAttr attr = (ResAttr) resource;
    value = attr.convertToResXmlFormat(mItems[i].m2);
    name = spec.getFullName(res.getResSpec().getPackage(), true);
  } else {
    name = "@" + spec.getFullName(res.getResSpec().getPackage(), false);
origin: iBotPeaches/Apktool

private void generatePublicXml(ResPackage pkg, Directory out,
                XmlSerializer serial) throws AndrolibException {
  try {
    OutputStream outStream = out.getFileOutput("values/public.xml");
    serial.setOutput(outStream, null);
    serial.startDocument(null, null);
    serial.startTag(null, "resources");
    for (ResResSpec spec : pkg.listResSpecs()) {
      serial.startTag(null, "public");
      serial.attribute(null, "type", spec.getType().getName());
      serial.attribute(null, "name", spec.getName());
      serial.attribute(null, "id", String.format("0x%08x", spec.getId().id));
      serial.endTag(null, "public");
    }
    serial.endTag(null, "resources");
    serial.endDocument();
    serial.flush();
    outStream.close();
  } catch (IOException | DirectoryException ex) {
    throw new AndrolibException("Could not generate public.xml file", ex);
  }
}
origin: iBotPeaches/Apktool

public String getFilePath() {
  return mResSpec.getType().getName() + mConfig.getFlags().getQualifiers() + "/" + mResSpec.getName();
}
origin: iBotPeaches/Apktool

  spec = mPkg.getResSpec(resId);
  if (spec.isDummyResSpec()) {
    removeResSpec(spec);
    spec = new ResResSpec(resId, mSpecNames.getString(specNamesId), mPkg, mTypeSpec);
    mPkg.addResSpec(spec);
    mTypeSpec.addResSpec(spec);
  spec = new ResResSpec(resId, mSpecNames.getString(specNamesId), mPkg, mTypeSpec);
  mPkg.addResSpec(spec);
  mTypeSpec.addResSpec(spec);
  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()));
  } else {
origin: iBotPeaches/Apktool

public void removeResSpec(ResResSpec spec) throws AndrolibException {
  mResSpecs.remove(spec.getName());
}
origin: iBotPeaches/Apktool

public String getFullName() {
  return getFullName(false, false);
}
origin: iBotPeaches/Apktool

public Collection<ResValuesFile> listValuesFiles() {
  Map<Duo<ResTypeSpec, ResType>, ResValuesFile> ret = new HashMap<Duo<ResTypeSpec, ResType>, ResValuesFile>();
  for (ResResSpec spec : mResSpecs.values()) {
    for (ResResource res : spec.listResources()) {
      if (res.getValue() instanceof ResValuesXmlSerializable) {
        ResTypeSpec type = res.getResSpec().getType();
        ResType config = res.getConfig();
        Duo<ResTypeSpec, ResType> key = new Duo<ResTypeSpec, ResType>(type, config);
        ResValuesFile values = ret.get(key);
        if (values == null) {
          values = new ResValuesFile(this, type, config);
          ret.put(key, values);
        }
        values.addResource(res);
      }
    }
  }
  return ret.values();
}
origin: iBotPeaches/Apktool

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);
    }
  }
}
origin: iBotPeaches/Apktool

public ResResource getDefaultResource() throws AndrolibException {
  return getResource(new ResConfigFlags());
}
origin: iBotPeaches/Apktool

public ResValue getValue(String package_, String type, String name) throws AndrolibException {
  return getPackage(package_).getType(type).getResSpec(name).getDefaultResource().getValue();
}
origin: iBotPeaches/Apktool

String inFileName = fileValue.getStrippedPath();
String outResName = res.getFilePath();
String typeName = res.getResSpec().getType().getName();
origin: iBotPeaches/Apktool

  @Override
  public void serializeToResValuesXml(XmlSerializer serializer,
                    ResResource res) throws IOException, AndrolibException {
    serializer.startTag(null, "item");
    serializer
        .attribute(null, "type", res.getResSpec().getType().getName());
    serializer.attribute(null, "name", res.getResSpec().getName());
    serializer.endTag(null, "item");
  }
}
origin: iBotPeaches/Apktool

public boolean isDummyResSpec() {
  return getName().startsWith("APKTOOL_DUMMY_");
}
origin: droidefense/engine

  ResResSpec spec = resTable.getResSpec(resID);
  out.println(String.format(RES_NAME_FORMAT,
      spec.getFullName()));
} catch (UndefinedResObject ex) {
  if (!R_FILE_PATTERN.matcher(fileName).matches()) {
origin: iBotPeaches/Apktool

public ResResource getResource(ResType config) throws AndrolibException {
  return getResource(config.getFlags());
}
brut.androlib.res.dataResResSpec

Most used methods

  • getFullName
  • getId
  • <init>
  • addResource
  • getDefaultResource
  • getName
  • getPackage
  • getResource
  • getType
  • hasDefaultResource
  • hasResource
  • isDummyResSpec
  • hasResource,
  • isDummyResSpec,
  • listResources

Popular in Java

  • Reactive rest calls using spring rest template
  • setScale (BigDecimal)
  • getSupportFragmentManager (FragmentActivity)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • Color (java.awt)
    The Color class is used to encapsulate colors in the default sRGB color space or colors in arbitrary
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • ByteBuffer (java.nio)
    A buffer for bytes. A byte buffer can be created in either one of the following ways: * #allocate
  • Notification (javax.management)
  • BasicDataSource (org.apache.commons.dbcp)
    Basic implementation of javax.sql.DataSource that is configured via JavaBeans properties. This is no
  • Table (org.hibernate.mapping)
    A relational table
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now