Java Code Examples for com.android.resources.ResourceType

The following examples show how to use com.android.resources.ResourceType. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: NBANDROID-V2   Source File: ResourceFolder.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Returns the list of {@link ResourceType}s generated by the files inside this folder.
 */
public Collection<ResourceType> getResourceTypes() {
    ArrayList<ResourceType> list = new ArrayList<ResourceType>();

    if (mFiles != null) {
        for (ResourceFile file : mFiles) {
            Collection<ResourceType> types = file.getResourceTypes();

            // loop through those and add them to the main list,
            // if they are not already present
            for (ResourceType resType : types) {
                if (list.indexOf(resType) == -1) {
                    list.add(resType);
                }
            }
        }
    }

    return list;
}
 
Example 2
Source Project: NBANDROID-V2   Source File: IdGeneratingResourceFile.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public ResourceValue getValue(ResourceType type, String name) {
    // Check to see if they're asking for one of the right types:
    if (type != mFileType && type != ResourceType.ID) {
        return null;
    }

    // If they're looking for a resource of this type with this name give them the whole file
    if (type == mFileType && name.equals(mFileName)) {
        return mFileValue;
    } else {
        // Otherwise try to return them an ID
        // the map will return null if it's not found
        return mIdResources.get(name);
    }
}
 
Example 3
Source Project: intellij   Source File: KotlinResourcePsiElementFinder.java    License: Apache License 2.0 6 votes vote down vote up
/** Checks if `expression` matches an expected R.abc.xyz pattern. */
private static boolean isResourceExpression(PsiElement expression) {
  if (!(expression instanceof KtQualifiedExpression)) {
    return false;
  }

  KtQualifiedExpression qualifiedExpression = (KtQualifiedExpression) expression;
  // qualifier should be `R.abc` which is also a `KtQualifiedExpression`
  PsiElement qualifier = qualifiedExpression.getReceiverExpression();
  if (!(qualifier instanceof KtQualifiedExpression)) {
    return false;
  }

  KtQualifiedExpression qualifierExpression = (KtQualifiedExpression) qualifier;
  // rClassExpression should be `R`
  PsiElement rClassExpression = qualifierExpression.getReceiverExpression();
  // rTypeExpression should be `abc`
  PsiElement rTypeExpression = qualifierExpression.getSelectorExpression();

  return rTypeExpression != null
      && SdkConstants.R_CLASS.equals(rClassExpression.getText())
      && ResourceType.fromClassName(rTypeExpression.getText()) != null;
}
 
Example 4
/**
 * Add the resources represented by this file to the repository
 */
private void updateResourceItems(ScanningContext context) {
    ResourceRepository repository = getRepository();

    // remove this file from all existing ResourceItem.
    repository.removeFile(mResourceTypeList, this);

    // First add this as a layout file
    ResourceItem item = repository.getResourceItem(mFileType, mFileName);
    item.add(this);

    // Now iterate through our IDs and add
    for (String idName : mIdResources.keySet()) {
        item = repository.getResourceItem(ResourceType.ID, idName);
        // add this file to the list of files generating ID resources.
        item.add(this);
    }

    //  Ask the repository for an ID refresh
    context.requestFullAapt();
}
 
Example 5
@Nullable
public ResourceValue getConfiguredValue(
        @NonNull ResourceType type,
        @NonNull String name,
        @NonNull FolderConfiguration referenceConfig) {
    // get the resource item for the given type
    ListMultimap<String, ResourceItem> items = getMap(type, false);
    if (items == null) {
        return null;
    }

    List<ResourceItem> keyItems = items.get(name);
    if (keyItems == null) {
        return null;
    }

    // look for the best match for the given configuration
    // the match has to be of type ResourceFile since that's what the input list contains
    ResourceItem match = (ResourceItem) referenceConfig.findMatchingConfigurable(keyItems);
    return match != null ? match.getResourceValue(mFramework) : null;
}
 
Example 6
Source Project: NBANDROID-V2   Source File: MultiResourceFile.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Adds a resource item to the list
 * @param value The value of the resource.
 */
@Override
public void addResourceValue(ResourceValue value) {
    ResourceType resType = value.getResourceType();

    ResourceValueMap list = mResourceItems.get(resType);

    // if the list does not exist, create it.
    if (list == null) {
        list = ResourceValueMap.create();
        mResourceItems.put(resType, list);
    } else {
        // look for a possible value already existing.
        ResourceValue oldValue = list.get(value.getName());

        if (oldValue != null) {
            oldValue.replaceWith(value);
            return;
        }
    }

    // empty list or no match found? add the given resource
    list.put(value.getName(), value);
}
 
Example 7
Source Project: NBANDROID-V2   Source File: ResourceResolver.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Updates the parent of a given framework style. This method is used to
 * patch DeviceDefault styles when using a CompatibilityTarget.
 */
public void patchAutoStyleParent(String childStyleName, String parentName) {
    // TODO(namespaces): why only framework styles?
    ResourceValueMap map = getResourceValueMap(ResourceNamespace.RES_AUTO, ResourceType.STYLE);
    if (map != null) {
        StyleResourceValue from = (StyleResourceValue) map.get(childStyleName);
        StyleResourceValue to = (StyleResourceValue) map.get(parentName);

        if (from != null && to != null) {
            StyleResourceValue newStyle
                    = new StyleResourceValueImpl(
                            from.asReference(), parentName, from.getLibraryName());
            newStyle.replaceWith(from);
            mStyleInheritanceMap.put(newStyle, to);
            mReverseStyleInheritanceMap.clear();
        }
    }
}
 
Example 8
Source Project: NBANDROID-V2   Source File: IdGeneratingResourceFile.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Add the resources represented by this file to the repository
 */
private void updateResourceItems(ScanningContext context) {
    ResourceRepository repository = getRepository();

    // remove this file from all existing ResourceItem.
    repository.removeFile(mResourceTypeList, this);

    // First add this as a layout file
    ResourceItem item = repository.getResourceItem(mFileType, mFileName);
    item.add(this);

    // Now iterate through our IDs and add
    for (String idName : mIdResources.keySet()) {
        item = repository.getResourceItem(ResourceType.ID, idName);
        // add this file to the list of files generating ID resources.
        item.add(this);
    }

    //  Ask the repository for an ID refresh
    context.requestFullAapt();
}
 
Example 9
Source Project: NBANDROID-V2   Source File: ResourceRepository.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Returns the resources values matching a given {@link FolderConfiguration} for the current
 * project.
 *
 * @param referenceConfig the configuration that each value must match.
 * @return a map with guaranteed to contain an entry for each {@link ResourceType}
 */
@NonNull
protected final Map<ResourceType, ResourceValueMap> doGetConfiguredResources(
        @NonNull FolderConfiguration referenceConfig) {
    ensureInitialized();

    Map<ResourceType, ResourceValueMap> map =
        new EnumMap<ResourceType, ResourceValueMap>(ResourceType.class);

    for (ResourceType key : ResourceType.values()) {
        // get the local results and put them in the map
        map.put(key, getConfiguredResource(key, referenceConfig));
    }

    return map;
}
 
Example 10
Source Project: bazel   Source File: ResourceName.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Constructs a ResourceName from the canonical form used throughout Android ({@code
 * [<pkg>:]<type>/<entry>}).
 */
// While we use aapt2 to convert XML data to protobuf, we still need to do some parsing:
//
// https://android.googlesource.com/platform/frameworks/base.git/+/refs/tags/platform-tools-29.0.2/tools/aapt2/Resources.proto#232
static ResourceName parse(String name) {
  Matcher matcher = FullyQualifiedName.QUALIFIED_REFERENCE.matcher(name);
  verify(
      matcher.matches(),
      "%s is not a valid resource name. Expected %s",
      name,
      FullyQualifiedName.QUALIFIED_REFERENCE);

  return create(
      Strings.nullToEmpty(matcher.group("package")),
      ResourceType.getEnum(matcher.group("type")),
      matcher.group("name"));
}
 
Example 11
/**
 * Returns the resources values matching a given {@link FolderConfiguration}.
 *
 * @param referenceConfig the configuration that each value must match.
 * @return a map with guaranteed to contain an entry for each {@link ResourceType}
 */
@NonNull
public Map<ResourceType, Map<String, ResourceValue>> getConfiguredResources(
        @NonNull FolderConfiguration referenceConfig) {
    Map<ResourceType, Map<String, ResourceValue>> map = Maps.newEnumMap(ResourceType.class);

    synchronized (ITEM_MAP_LOCK) {
        Map<ResourceType, ListMultimap<String, ResourceItem>> itemMap = getMap();
        for (ResourceType key : ResourceType.values()) {
            // get the local results and put them in the map
            map.put(key, getConfiguredResources(itemMap, key, referenceConfig));
        }
    }

    return map;
}
 
Example 12
Source Project: javaide   Source File: ResourceRepository.java    License: GNU General Public License v3.0 6 votes vote down vote up
/**
 * Returns the {@link ResourceFile} matching the given name,
 * {@link ResourceFolderType} and configuration.
 * <p/>
 * This only works with files generating one resource named after the file
 * (for instance, layouts, bitmap based drawable, xml, anims).
 *
 * @param name the resource name or file name
 * @param type the folder type search for
 * @param config the folder configuration to match for
 * @return the matching file or <code>null</code> if no match was found.
 */
@Nullable
public ResourceFile getMatchingFile(
        @NonNull String name,
        @NonNull ResourceFolderType type,
        @NonNull FolderConfiguration config) {
    List<ResourceType> types = FolderTypeRelationship.getRelatedResourceTypes(type);
    for (ResourceType t : types) {
        if (t == ResourceType.ID) {
            continue;
        }
        ResourceFile match = getMatchingFile(name, t, config);
        if (match != null) {
            return match;
        }
    }

    return null;
}
 
Example 13
Source Project: NBANDROID-V2   Source File: ResourceClassGeneratorConfig.java    License: Apache License 2.0 6 votes vote down vote up
public int getOrCreateId(ResourceNamespace namespace, ResourceType resourceType, String name) {
    Map<ResourceReference, Integer> references = resources.get(resourceType);
    Map<String, Integer> names = resourceNamesToId.get(resourceType);
    if (references == null) {
        references = new HashMap<>();
        resources.put(resourceType, references);
    }
    if (names == null) {
        names = new HashMap<>();
        resourceNamesToId.put(resourceType, names);
    }
    ResourceReference reference = new ResourceReference(namespace, resourceType, name);
    Integer value = references.get(reference);
    if (value == null) {
        value = getCounter(resourceType).incrementAndGet();
        references.put(reference, value);
        names.put(name, value);
        resourcesReverse.put(value, reference);
    }
    return value;
}
 
Example 14
Source Project: javaide   Source File: ProjectCallback.java    License: GNU General Public License v3.0 6 votes vote down vote up
public Integer getResourceId(ResourceType type, String name) {
    // since we don't have access to compiled id, generate one on the fly.
    Map<String, Integer> typeMap = mIdMap.get(type);
    if (typeMap == null) {
        typeMap = new HashMap<String, Integer>();
        mIdMap.put(type, typeMap);
    }

    Integer value = typeMap.get(name);
    if (value == null) {
        value = typeMap.size() + 1;
        typeMap.put(name, value);
        mReverseIdMap.put(value, Pair.of(type, name));
    }

    return value;
}
 
Example 15
Source Project: atlas   Source File: AtlasSymbolIo.java    License: Apache License 2.0 6 votes vote down vote up
@Nullable
private static AtlasSymbolIo.SymbolData readLine(@NonNull String line, @Nullable AtlasSymbolIo.SymbolFilter filter)
        throws IOException {
    // format is "<type> <class> <name> <value>"
    // don't want to split on space as value could contain spaces.
    int pos = line.indexOf(' ');
    String typeName = line.substring(0, pos);

    SymbolJavaType type = SymbolJavaType.getEnum(typeName);
    int pos2 = line.indexOf(' ', pos + 1);
    String className = line.substring(pos + 1, pos2);

    if (filter != null && !filter.validate(className, typeName)) {
        return null;
    }

    ResourceType resourceType = ResourceType.getEnum(className);
    if (resourceType == null) {
        throw new IOException("Invalid resource type " + className);
    }
    int pos3 = line.indexOf(' ', pos2 + 1);
    String name = line.substring(pos2 + 1, pos3);
    String value = line.substring(pos3 + 1);

    return new SymbolData(resourceType, name, type, value);
}
 
Example 16
Source Project: bazel   Source File: PublicXmlResourceValue.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public XmlResourceValue combineWith(XmlResourceValue value) {
  if (!(value instanceof PublicXmlResourceValue)) {
    throw new IllegalArgumentException(value + "is not combinable with " + this);
  }
  PublicXmlResourceValue other = (PublicXmlResourceValue) value;
  Map<ResourceType, Optional<Integer>> combined = new EnumMap<>(ResourceType.class);
  combined.putAll(typeToId);
  for (Map.Entry<ResourceType, Optional<Integer>> entry : other.typeToId.entrySet()) {
    Optional<Integer> existing = combined.get(entry.getKey());
    if (existing != null && !existing.equals(entry.getValue())) {
      throw new IllegalArgumentException(
          String.format(
              "Public resource of type %s assigned two different id values 0x%x and 0x%x",
              entry.getKey(), existing.orNull(), entry.getValue().orNull()));
    }
    combined.put(entry.getKey(), entry.getValue());
  }
  return of(combined);
}
 
Example 17
Source Project: java-n-IDE-for-Android   Source File: MultiResourceFile.java    License: Apache License 2.0 6 votes vote down vote up
private void updateResourceItems(ScanningContext context) {
    ResourceRepository repository = getRepository();

    // remove this file from all existing ResourceItem.
    repository.removeFile(mResourceTypeList, this);

    for (ResourceType type : mResourceTypeList) {
        Map<String, ResourceValue> list = mResourceItems.get(type);

        if (list != null) {
            Collection<ResourceValue> values = list.values();
            for (ResourceValue res : values) {
                ResourceItem item = repository.getResourceItem(type, res.getName());

                // add this file to the list of files generating this resource item.
                item.add(this);
            }
        }
    }

    // If we need an ID refresh, ask the repository for that now
    if (mNeedIdRefresh) {
        context.requestFullAapt();
    }
}
 
Example 18
Source Project: java-n-IDE-for-Android   Source File: MultiResourceFile.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Adds a resource item to the list
 * @param value The value of the resource.
 */
@Override
public void addResourceValue(ResourceValue value) {
    ResourceType resType = value.getResourceType();

    Map<String, ResourceValue> list = mResourceItems.get(resType);

    // if the list does not exist, create it.
    if (list == null) {
        list = new HashMap<String, ResourceValue>();
        mResourceItems.put(resType, list);
    } else {
        // look for a possible value already existing.
        ResourceValue oldValue = list.get(value.getName());

        if (oldValue != null) {
            oldValue.replaceWith(value);
            return;
        }
    }

    // empty list or no match found? add the given resource
    list.put(value.getName(), value);
}
 
Example 19
/**
 * Returns true if the given resource is private in the library
 *
 * @param type the type of the resource
 * @param name the name of the resource
 * @return true if the given resource is private
 */
@Override
public boolean isPrivate(@NonNull ResourceType type, @NonNull String name) {
    //noinspection SimplifiableIfStatement
    if (mPublic == null) {
        // No public definitions: Everything assumed to be public
        return false;
    }

    //noinspection SimplifiableIfStatement
    if (!mAll.containsEntry(name, type)) {
        // Don't respond to resource URLs that are not part of this project
        // since we won't have private information on them
        return false;
    }
    return !mPublic.containsEntry(name, type);
}
 
Example 20
Source Project: javaide   Source File: ResourceItem.java    License: GNU General Public License v3.0 5 votes vote down vote up
@Nullable
private ResourceType getType(String qName, NamedNodeMap attributes) {
    String typeValue;

    // if the node is <item>, we get the type from the attribute "type"
    if (SdkConstants.TAG_ITEM.equals(qName)) {
        typeValue = getAttributeValue(attributes, ATTR_TYPE);
    } else {
        // the type is the name of the node.
        typeValue = qName;
    }

    return ResourceType.getEnum(typeValue);
}
 
Example 21
@Override
public void beforeCheckFile(@NonNull Context context) {
    File file = context.file;
    boolean isXmlFile = LintUtils.isXmlFile(file);
    if (!isXmlFile && !LintUtils.isBitmapFile(file)) {
        return;
    }
    String parentName = file.getParentFile().getName();
    int dash = parentName.indexOf('-');
    if (dash != -1 || FD_RES_VALUES.equals(parentName)) {
        return;
    }
    ResourceFolderType folderType = ResourceFolderType.getFolderType(parentName);
    if (folderType == null) {
        return;
    }
    List<ResourceType> types = FolderTypeRelationship.getRelatedResourceTypes(folderType);
    if (types.isEmpty()) {
        return;
    }
    ResourceType type = types.get(0);
    String resourceName = getResourceFieldName(getBaseName(file.getName()));
    if (isPrivate(context, type, resourceName)) {
        String message = createOverrideErrorMessage(context, type, resourceName);
        Location location = Location.create(file);
        context.report(ISSUE, location, message);
    }
}
 
Example 22
/**
 * Returns the type of the ResourceItem based on a node's attributes.
 * @param node the node
 * @return the ResourceType or null if it could not be inferred.
 */
static ResourceType getType(@NonNull Node node, @Nullable File from) {
    String nodeName = node.getLocalName();
    String typeString = null;

    if (TAG_ITEM.equals(nodeName)) {
        Attr attribute = (Attr) node.getAttributes().getNamedItemNS(null, ATTR_TYPE);
        if (attribute != null) {
            typeString = attribute.getValue();
        }
    } else if (TAG_EAT_COMMENT.equals(nodeName) || TAG_SKIP.equals(nodeName)) {
        return null;
    } else {
        // the type is the name of the node.
        typeString = nodeName;
    }

    if (typeString != null) {
        ResourceType type = ResourceType.getEnum(typeString);
        if (type != null) {
            return type;
        }

        if (from != null) {
            throw new RuntimeException(String.format("Unsupported type '%s' in file %s", typeString, from));
        }
        throw new RuntimeException(String.format("Unsupported type '%s'", typeString));
    }

    if (from != null) {
        throw new RuntimeException(String.format("Unsupported node '%s' in file %s", nodeName, from));
    }
    throw new RuntimeException(String.format("Unsupported node '%s'", nodeName));
}
 
Example 23
/**
 * Adds any declare styleable attr items below the given declare styleable nodes
 * into the given list
 *
 * @param styleableNode the declare styleable node
 * @param list the list to add items into
 * @param map map of existing items to detect dups.
 */
static void addStyleableItems(@NonNull Node styleableNode,
                              @NonNull List<ResourceItem> list,
                              @Nullable Map<ResourceType, Set<String>> map,
                              @Nullable File from)
        throws MergingException {
    assert styleableNode.getNodeName().equals(ResourceType.DECLARE_STYLEABLE.getName());
    NodeList nodes = styleableNode.getChildNodes();

    for (int i = 0, n = nodes.getLength(); i < n; i++) {
        Node node = nodes.item(i);

        if (node.getNodeType() != Node.ELEMENT_NODE) {
            continue;
        }

        ResourceItem resource = getResource(node, from);
        if (resource != null) {
            assert resource.getType() == ResourceType.ATTR;

            // is the attribute in the android namespace?
            if (!resource.getName().startsWith(ANDROID_NS_NAME_PREFIX)) {
                if (hasFormatAttribute(node) || XmlUtils.hasElementChildren(node)) {
                    checkDuplicate(resource, map);
                    resource.setIgnoredFromDiskMerge(true);
                    list.add(resource);
                }
            }
        }
    }
}
 
Example 24
Source Project: javaide   Source File: ResourceResolver.java    License: GNU General Public License v3.0 5 votes vote down vote up
@Override
@Nullable
public StyleResourceValue getStyle(@NonNull String styleName, boolean isFramework) {
    ResourceValue res;
    Map<String, ResourceValue> styleMap;

    // First check if we can find the style directly.
    if (isFramework) {
        styleMap = mFrameworkResources.get(ResourceType.STYLE);
    } else {
        styleMap = mProjectResources.get(ResourceType.STYLE);
    }
    res = getStyleFromMap(styleMap, styleName);
    if (res != null) {
        // If the obtained resource is not StyleResourceValue, return null.
        return res instanceof StyleResourceValue ? (StyleResourceValue) res : null;
    }

    // We cannot find the style directly. The style name may have been flattened by AAPT for use
    // in the R class. Try and obtain the original name.
    String xmlStyleName = getReverseStyleMap(isFramework)
            .get(getNormalizedStyleName(styleName));
    if (!styleName.equals(xmlStyleName)) {
        res = getStyleFromMap(styleMap, xmlStyleName);
    }
    return res instanceof StyleResourceValue ? (StyleResourceValue) res : null;
}
 
Example 25
Source Project: intellij   Source File: BlazeRClass.java    License: Apache License 2.0 5 votes vote down vote up
public BlazeRClass(PsiManager psiManager, AndroidFacet androidFacet, String packageName) {
  super(
      psiManager,
      new ResourcesSource() {
        @Override
        public String getPackageName() {
          return packageName;
        }

        @Override
        public LocalResourceRepository getResourceRepository() {
          return ResourceRepositoryManager.getAppResources(androidFacet);
        }

        @Override
        public ResourceNamespace getResourceNamespace() {
          return ResourceNamespace.RES_AUTO;
        }

        @Override
        public AndroidLightField.FieldModifier getFieldModifier() {
          return AndroidLightField.FieldModifier.NON_FINAL;
        }

        @Override
        public boolean isPublic(ResourceType resourceType, String resourceName) {
          return true;
        }
      });
  this.androidFacet = androidFacet;
  setModuleInfo(getModule(), false);
}
 
Example 26
Source Project: bazel   Source File: FullyQualifiedName.java    License: Apache License 2.0 5 votes vote down vote up
private static Type createTypeFrom(String rawType) {
  ResourceType resourceType = ResourceType.getEnum(rawType);
  VirtualType virtualType = VirtualType.getEnum(rawType);
  if (resourceType != null) {
    return new ResourceTypeWrapper(resourceType);
  } else if (virtualType != null) {
    return virtualType;
  }
  return null;
}
 
Example 27
@NonNull
public Map<String, ResourceValue> getConfiguredResources(
        @NonNull Map<ResourceType, ListMultimap<String, ResourceItem>> itemMap,
        @NonNull ResourceType type,
        @NonNull FolderConfiguration referenceConfig) {
    // get the resource item for the given type
    ListMultimap<String, ResourceItem> items = itemMap.get(type);
    if (items == null) {
        return Maps.newHashMap();
    }

    Set<String> keys = items.keySet();

    // create the map
    Map<String, ResourceValue> map = Maps.newHashMapWithExpectedSize(keys.size());

    for (String key : keys) {
        List<ResourceItem> keyItems = items.get(key);

        // look for the best match for the given configuration
        // the match has to be of type ResourceFile since that's what the input list contains
        ResourceItem match = (ResourceItem) referenceConfig.findMatchingConfigurable(keyItems);
        if (match != null) {
            ResourceValue value = match.getResourceValue(mFramework);
            if (value != null) {
                map.put(match.getName(), value);
            }
        }
    }

    return map;
}
 
Example 28
Source Project: java-n-IDE-for-Android   Source File: ResourceRepository.java    License: Apache License 2.0 5 votes vote down vote up
public synchronized void clear() {
    mCleared = true;
    mFolderMap = new EnumMap<ResourceFolderType, List<ResourceFolder>>(
            ResourceFolderType.class);
    mResourceMap = new EnumMap<ResourceType, Map<String, ResourceItem>>(
            ResourceType.class);

    mReadOnlyListMap =
        new IdentityHashMap<Map<String, ResourceItem>, Collection<ResourceItem>>();
}
 
Example 29
Source Project: NBANDROID-V2   Source File: SingleResourceFile.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Returns the name of the resources.
 */
private String getResourceName(ResourceType type) {
    // get the name from the filename.
    String name = getFile().getName();

    int pos = name.indexOf('.');
    if (pos != -1) {
        name = name.substring(0, pos);
    }

    return name;
}
 
Example 30
Source Project: javaide   Source File: ResourceResolver.java    License: GNU General Public License v3.0 5 votes vote down vote up
@Override
public ResourceValue resolveValue(ResourceType type, String name, String value,
        boolean isFrameworkValue) {
    ResourceValue resourceValue = super.resolveValue(type, name, value, isFrameworkValue);
    if (resourceValue != null) {
        mLookupChain.add(resourceValue);
    }
    return resourceValue;
}