aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ide_common/src/com/android/ide/common/resources/IdGeneratingResourceFile.java13
-rw-r--r--ide_common/src/com/android/ide/common/resources/IdResourceParser.java3
-rw-r--r--ide_common/src/com/android/ide/common/resources/MultiResourceFile.java6
-rw-r--r--ide_common/src/com/android/ide/common/resources/ValueResourceParser.java1
4 files changed, 21 insertions, 2 deletions
diff --git a/ide_common/src/com/android/ide/common/resources/IdGeneratingResourceFile.java b/ide_common/src/com/android/ide/common/resources/IdGeneratingResourceFile.java
index 6c72dbf..9ff1748 100644
--- a/ide_common/src/com/android/ide/common/resources/IdGeneratingResourceFile.java
+++ b/ide_common/src/com/android/ide/common/resources/IdGeneratingResourceFile.java
@@ -87,7 +87,9 @@ public final class IdGeneratingResourceFile extends ResourceFile
// need to parse the file and find the IDs.
if (!parseFileForIds(context)) {
context.requestFullAapt();
- return;
+ // Continue through to updating the resource item here since it
+ // will make for example layout rendering more accurate until
+ // aapt is re-run
}
// We only need to update the repository if our IDs have changed
@@ -226,4 +228,13 @@ public final class IdGeneratingResourceFile extends ResourceFile
// IDs declared
mIdResources.put(value.getName(), value);
}
+
+ @Override
+ public boolean hasResourceValue(ResourceType type, String name) {
+ if (type == ResourceType.ID) {
+ return mIdResources.containsKey(name);
+ }
+
+ return false;
+ }
}
diff --git a/ide_common/src/com/android/ide/common/resources/IdResourceParser.java b/ide_common/src/com/android/ide/common/resources/IdResourceParser.java
index 324ad2b..1de664e 100644
--- a/ide_common/src/com/android/ide/common/resources/IdResourceParser.java
+++ b/ide_common/src/com/android/ide/common/resources/IdResourceParser.java
@@ -130,7 +130,8 @@ public class IdResourceParser {
// Validate resource references (unless we're scanning a framework
// resource or if we've already scheduled a full aapt run)
boolean exists = resources.hasResourceItem(value);
- if (!exists) {
+ if (!exists && !mRepository.hasResourceValue(ResourceType.ID,
+ value.substring(value.indexOf('/') + 1))) {
String error = String.format(
// Don't localize because the exact pattern matches AAPT's
// output which has hardcoded regexp matching in
diff --git a/ide_common/src/com/android/ide/common/resources/MultiResourceFile.java b/ide_common/src/com/android/ide/common/resources/MultiResourceFile.java
index cff1869..c9a8bc7 100644
--- a/ide_common/src/com/android/ide/common/resources/MultiResourceFile.java
+++ b/ide_common/src/com/android/ide/common/resources/MultiResourceFile.java
@@ -204,6 +204,12 @@ public final class MultiResourceFile extends ResourceFile implements IValueResou
}
@Override
+ public boolean hasResourceValue(ResourceType type, String name) {
+ Map<String, ResourceValue> map = mResourceItems.get(type);
+ return map != null && map.containsKey(name);
+ }
+
+ @Override
public ResourceValue getValue(ResourceType type, String name) {
// get the list for the given type
Map<String, ResourceValue> list = mResourceItems.get(type);
diff --git a/ide_common/src/com/android/ide/common/resources/ValueResourceParser.java b/ide_common/src/com/android/ide/common/resources/ValueResourceParser.java
index 7c11dd7..aabfd35 100644
--- a/ide_common/src/com/android/ide/common/resources/ValueResourceParser.java
+++ b/ide_common/src/com/android/ide/common/resources/ValueResourceParser.java
@@ -44,6 +44,7 @@ public final class ValueResourceParser extends DefaultHandler {
public interface IValueResourceRepository {
void addResourceValue(ResourceValue value);
+ boolean hasResourceValue(ResourceType type, String name);
}
private boolean inResources = false;