diff options
author | Adam Lesinski <adamlesinski@google.com> | 2015-04-24 19:19:30 -0700 |
---|---|---|
committer | Adam Lesinski <adamlesinski@google.com> | 2015-05-04 16:43:24 -0700 |
commit | 24aad163bc88cb10d2275385e9afc3de7f342d65 (patch) | |
tree | 361fc0b3fbef5f68a16f357ae9d2bed5e93efbf5 /tools/aapt2/ResourceParser.h | |
parent | ab2581398c812917145088590bd18eb83f3a2ea6 (diff) |
Add namespace handling in attribute values
Previously, you could only reference namespace prefixes in attribute names:
<View xmlns:appcompat="http://schemas.android.com/apk/res/android.support.v7.appcompat"
appcompat:name="hey"
...
Now you can also reference them in resource names within an attribute value:
...
android:text="@appcompat:string/confirm"
...
Which will be treated as "@android.support.v7.appcompat:string/confirm".
Change-Id: Ib076e867a990c80cf877a704eb77cd1ef0b23b52
Diffstat (limited to 'tools/aapt2/ResourceParser.h')
-rw-r--r-- | tools/aapt2/ResourceParser.h | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/tools/aapt2/ResourceParser.h b/tools/aapt2/ResourceParser.h index 52194bd02f99..7618999f0023 100644 --- a/tools/aapt2/ResourceParser.h +++ b/tools/aapt2/ResourceParser.h @@ -76,12 +76,10 @@ public: /* * Returns a Reference object if the string was parsed as a resource or attribute reference, - * ( @[+][package:]type/name | ?[package:]type/name ) - * assigning defaultPackage if the package was not present in the string, and setting - * outCreate to true if the '+' was present in the string. + * ( @[+][package:]type/name | ?[package:]type/name ) setting outCreate to true if + * the '+' was present in the string. */ static std::unique_ptr<Reference> tryParseReference(const StringPiece16& str, - const StringPiece16& defaultPackage, bool* outCreate); /* @@ -127,20 +125,18 @@ public: */ static std::unique_ptr<BinaryPrimitive> tryParseFlagSymbol(const Attribute& enumAttr, const StringPiece16& str); - /* * Try to convert a string to an Item for the given attribute. The attribute will * restrict what values the string can be converted to. - * The defaultPackage is used when the string is a reference with no defined package. * The callback function onCreateReference is called when the parsed item is a * reference to an ID that must be created (@+id/foo). */ static std::unique_ptr<Item> parseItemForAttribute( - const StringPiece16& value, const Attribute& attr, const StringPiece16& defaultPackage, + const StringPiece16& value, const Attribute& attr, std::function<void(const ResourceName&)> onCreateReference = {}); static std::unique_ptr<Item> parseItemForAttribute( - const StringPiece16& value, uint32_t typeMask, const StringPiece16& defaultPackage, + const StringPiece16& value, uint32_t typeMask, std::function<void(const ResourceName&)> onCreateReference = {}); static uint32_t androidTypeToAttributeTypeMask(uint16_t type); |