diff options
| author | 2016-04-25 14:20:21 -0700 | |
|---|---|---|
| committer | 2016-04-30 01:36:12 +0000 | |
| commit | 458b877488c12ea4336d8fc00a95d9c0298bd6d0 (patch) | |
| tree | 6169f78510254f6bde737279763049f00eaef200 /tools/aapt2/ResourceParser.cpp | |
| parent | 832449800e2e5068ab0eb986bb359906ddf6efdc (diff) | |
AAPT2: Add diff command
Adds the diff command and various small fixes to issues
discovered when diffing old AAPT built APKs with new AAPT2
built APKS.
Bug:22775504
Change-Id: I682a7fe1cf4b3efa7cbd5d18b333cf2d1046fe1b
Diffstat (limited to 'tools/aapt2/ResourceParser.cpp')
| -rw-r--r-- | tools/aapt2/ResourceParser.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/tools/aapt2/ResourceParser.cpp b/tools/aapt2/ResourceParser.cpp index 9704d97029b7..a84c306e2733 100644 --- a/tools/aapt2/ResourceParser.cpp +++ b/tools/aapt2/ResourceParser.cpp @@ -152,7 +152,7 @@ bool ResourceParser::flattenXmlSubtree(xml::XmlPullParser* parser, std::u16strin break; } - spanStack.back().lastChar = builder.str().size(); + spanStack.back().lastChar = builder.str().size() - 1; outStyleString->spans.push_back(spanStack.back()); spanStack.pop_back(); @@ -1058,6 +1058,16 @@ bool ResourceParser::parseArrayImpl(xml::XmlPullParser* parser, ParsedResource* std::unique_ptr<Array> array = util::make_unique<Array>(); + bool translateable = mOptions.translatable; + if (Maybe<StringPiece16> translateableAttr = xml::findAttribute(parser, u"translatable")) { + if (!ResourceUtils::tryParseBool(translateableAttr.value(), &translateable)) { + mDiag->error(DiagMessage(outResource->source) + << "invalid value for 'translatable'. Must be a boolean"); + return false; + } + } + array->setTranslateable(translateable); + bool error = false; const size_t depth = parser->getDepth(); while (xml::XmlPullParser::nextChildNode(parser, depth)) { |