aboutsummaryrefslogtreecommitdiffstats
path: root/ide_common/src/com/android/ide/common/resources/IdGeneratingResourceFile.java
diff options
context:
space:
mode:
authorTor Norbye <tnorbye@google.com>2012-07-25 09:30:43 -0700
committerTor Norbye <tnorbye@google.com>2012-07-25 09:30:43 -0700
commitda7ea9a923f66412631f36ee7105c644414eb986 (patch)
tree1c5e5b6e0111747e5b8451723adf4c1a49d65379 /ide_common/src/com/android/ide/common/resources/IdGeneratingResourceFile.java
parent48e6b702ea40f0904f90bf7d90799d01e007a2e4 (diff)
downloadsdk-da7ea9a923f66412631f36ee7105c644414eb986.zip
sdk-da7ea9a923f66412631f36ee7105c644414eb986.tar.gz
sdk-da7ea9a923f66412631f36ee7105c644414eb986.tar.bz2
Fix handling of @id/ resources
If you create a relative layout where one of the widgets create a new id such as @+id/button1, and then a later widget references this widget in a layout constraint using @id instead of @+id, such as layout_below="@id/button1", then it's possible for the resource repository to not update itself properly, and a subsequent layout editor render will generate error messages (can't find @id/button1). The problem is that the id parser was only looking up the resource repository for the @id reference, it was not also looking up the current resource file, to see if an @id reference is valid. This made it erroneously mark an error, and therefore return false from the parse method. This then had the cascaded effect of not updating the repository information from the parse, so the newly added id didn't get added to the maps. Change-Id: Iae3d215897525582579faf1c8ba64260215fec9d
Diffstat (limited to 'ide_common/src/com/android/ide/common/resources/IdGeneratingResourceFile.java')
-rw-r--r--ide_common/src/com/android/ide/common/resources/IdGeneratingResourceFile.java13
1 files changed, 12 insertions, 1 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;
+ }
}