remove newlines and extra spaces when parsing repo name and description

The formatting of these texts should happen in the Android layouts, not
with inline whitespace characters.
This commit is contained in:
Hans-Christoph Steiner 2014-10-08 15:04:12 -04:00
parent e085bcd54c
commit 8a06aa1c9b

View File

@ -243,7 +243,7 @@ public class RepoXMLHandler extends DefaultHandler {
curapp.requirements = Utils.CommaSeparatedList.make(str); curapp.requirements = Utils.CommaSeparatedList.make(str);
} }
} else if (curel.equals("description")) { } else if (curel.equals("description")) {
description = str; description = cleanWhiteSpace(str);
} }
} }
@ -273,10 +273,10 @@ public class RepoXMLHandler extends DefaultHandler {
String nm = attributes.getValue("", "name"); String nm = attributes.getValue("", "name");
if (nm != null) if (nm != null)
name = nm; name = cleanWhiteSpace(nm);
String dc = attributes.getValue("", "description"); String dc = attributes.getValue("", "description");
if (dc != null) if (dc != null)
description = dc; description = cleanWhiteSpace(dc);
} else if (localName.equals("application") && curapp == null) { } else if (localName.equals("application") && curapp == null) {
curapp = new App(); curapp = new App();
@ -306,4 +306,8 @@ public class RepoXMLHandler extends DefaultHandler {
public void setTotalAppCount(int totalAppCount) { public void setTotalAppCount(int totalAppCount) {
this.totalAppCount = totalAppCount; this.totalAppCount = totalAppCount;
} }
private String cleanWhiteSpace(String str) {
return str.replaceAll("\n", " ").replaceAll(" ", " ");
}
} }