Last active
March 14, 2017 01:07
-
-
Save raviagarwal7/8b3e95a0cfd6d0ca26d5c6730743c9c0 to your computer and use it in GitHub Desktop.
styelable.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for (int index = 0; index < linesInSymbolsFile.size(); index++) { | |
RDotTxtEntry resource = getResourceAtIndex(linesInSymbolsFile, index); | |
if (uberRDotTxtIds.isPresent()) { | |
Preconditions.checkNotNull(finalIds); | |
if (!finalIds.containsKey(resource)) { | |
LOG.debug("Cannot find resource '%s' in the uber R.txt.", resource); | |
continue; | |
} | |
resource = resource.copyWithNewIdValue(finalIds.get(resource)); | |
} else if (useOldStyleableFormat) { | |
if (resource.idValue.startsWith("0x7f")) { | |
Preconditions.checkNotNull(enumerator); | |
resource = resource.copyWithNewIdValue(String.format("0x%08x", enumerator.next())); | |
} | |
} else { | |
if (resourceToIdValuesMap.get(resource) != null) { | |
resource = resource.copyWithNewIdValue(resourceToIdValuesMap.get(resource)); | |
} else if (resource.idType == IdType.INT_ARRAY && resource.type == RType.STYLEABLE) { | |
Map<RDotTxtEntry, String> styleableResourcesMap = getStyleableResources( | |
resourceToIdValuesMap, linesInSymbolsFile, resource.name, index + 1 | |
); | |
for (RDotTxtEntry styleableResource : styleableResourcesMap.keySet()) { | |
resourceToIdValuesMap.put(styleableResource, styleableResource.idValue); | |
} | |
// int[] styleable entry is not added to the cache as | |
// the number of child can differ in dependent libraries | |
resource = resource.copyWithNewIdValue(String.format("{ %s }", | |
Joiner.on(RDotTxtEntry.INT_ARRAY_SEPARATOR) | |
.join(styleableResourcesMap.values()))); | |
} else { | |
Preconditions.checkNotNull(enumerator); | |
resource = resource.copyWithNewIdValue(String.format("0x%08x", enumerator.next())); | |
// Add resource to cache so that the id value is consistent across all R.txt | |
resourceToIdValuesMap.put(resource, resource.idValue); | |
} | |
} | |
if (bannedDuplicateResourceTypes.contains(resource.type)) { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment