ResStringValue: added support for strings which require formatted="false".

This commit is contained in:
Ryszard Wiśniewski 2011-05-10 17:13:54 +02:00
parent 99882396b9
commit 9fd97ca9a5

View File

@ -17,7 +17,10 @@
package brut.androlib.res.data.value;
import brut.androlib.AndrolibException;
import brut.androlib.res.data.ResResource;
import brut.androlib.res.xml.ResXmlEncoders;
import java.io.IOException;
import org.xmlpull.v1.XmlSerializer;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
@ -46,4 +49,19 @@ public class ResStringValue extends ResScalarValue {
protected String encodeAsResXml() throws AndrolibException {
throw new UnsupportedOperationException();
}
@Override
protected void serializeExtraXmlAttrs(XmlSerializer serializer,
ResResource res) throws IOException {
int pos = 0;
int count = 0;
while((pos = mRawValue.indexOf('%', pos)) != -1) {
if (mRawValue.charAt(pos + 1) != '%') {
if (++count >= 2) {
serializer.attribute(null, "formatted", "false");
return;
}
}
}
}
}