aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/cgeodetail.java
diff options
context:
space:
mode:
authorBananeweizen <bananeweizen@gmx.de>2011-09-16 18:45:07 +0200
committerBananeweizen <bananeweizen@gmx.de>2011-09-16 18:45:07 +0200
commit1055014f23f929e656d04ae53656a1a0acf3c124 (patch)
tree60c2fd782828ff5bb790d55f0fc38758e51d564f /main/src/cgeo/geocaching/cgeodetail.java
parente94489086517a78de488cb9580bba756bd86b30b (diff)
parenta025a700b60df64e16f6aed0ea2fa8b011313fea (diff)
downloadcgeo-1055014f23f929e656d04ae53656a1a0acf3c124.zip
cgeo-1055014f23f929e656d04ae53656a1a0acf3c124.tar.gz
cgeo-1055014f23f929e656d04ae53656a1a0acf3c124.tar.bz2
Merge branch 'master' of https://Bananeweizen@github.com/cgeo/c-geo-opensource.git
Diffstat (limited to 'main/src/cgeo/geocaching/cgeodetail.java')
-rw-r--r--main/src/cgeo/geocaching/cgeodetail.java14
1 files changed, 9 insertions, 5 deletions
diff --git a/main/src/cgeo/geocaching/cgeodetail.java b/main/src/cgeo/geocaching/cgeodetail.java
index 2121b7c..16af323 100644
--- a/main/src/cgeo/geocaching/cgeodetail.java
+++ b/main/src/cgeo/geocaching/cgeodetail.java
@@ -889,7 +889,7 @@ public class cgeodetail extends AbstractActivity {
inventoryString.append('\n');
}
// avoid HTML parsing where possible
- if (inventoryItem.name.indexOf('<') >= 0 || inventoryItem.name.indexOf('&') >= 0) {
+ if (containsHtml(inventoryItem.name)) {
inventoryString.append(Html.fromHtml(inventoryItem.name).toString());
}
else {
@@ -1023,7 +1023,7 @@ public class cgeodetail extends AbstractActivity {
nameView.setText(cgBase.formatCoords(wpt.coords, true));
} else {
// avoid HTML parsing
- if (wpt.name.indexOf('<') >= 0 || wpt.name.indexOf('&') >= 0) {
+ if (containsHtml(wpt.name)) {
nameView.setText(Html.fromHtml(wpt.name.trim()), TextView.BufferType.SPANNABLE);
}
else {
@@ -1033,7 +1033,7 @@ public class cgeodetail extends AbstractActivity {
wpt.setIcon(res, base, nameView);
// avoid HTML parsing
- if (wpt.note.indexOf('<') >= 0 || wpt.note.indexOf('&') >= 0) {
+ if (containsHtml(wpt.note)) {
((TextView) waypointView.findViewById(R.id.note)).setText(Html.fromHtml(wpt.note.trim()), TextView.BufferType.SPANNABLE);
}
else {
@@ -1087,6 +1087,10 @@ public class cgeodetail extends AbstractActivity {
geoUpdate.updateLoc(geo);
}
+ static private boolean containsHtml(final String str) {
+ return str.indexOf('<') != -1 || str.indexOf('&') != -1;
+ }
+
private void parseLongDescription() {
if (longDesc == null && cache != null && cache.description != null) {
longDesc = Html.fromHtml(cache.description.trim(), new cgHtmlImg(this, geocode, true, cache.reason, false), new UnknownTagsHandler());
@@ -1182,7 +1186,7 @@ public class cgeodetail extends AbstractActivity {
((TextView) rowView.findViewById(R.id.type)).setText(cgBase.logTypes1.get(4)); // note if type is unknown
}
// avoid parsing HTML if not necessary
- if (log.author.indexOf('<') >= 0 || log.author.indexOf('&') >= 0) {
+ if (containsHtml(log.author)) {
((TextView) rowView.findViewById(R.id.author)).setText(Html.fromHtml(log.author), TextView.BufferType.SPANNABLE);
}
else {
@@ -1199,7 +1203,7 @@ public class cgeodetail extends AbstractActivity {
((TextView) rowView.findViewById(R.id.count)).setText(log.found + " " + res.getString(R.string.cache_count_more));
}
// avoid parsing HTML if not necessary
- if (log.log.indexOf('<') >= 0 || log.log.indexOf('&') >= 0) {
+ if (containsHtml(log.log)) {
((TextView) rowView.findViewById(R.id.log)).setText(Html.fromHtml(log.log, new cgHtmlImg(this, null, false, cache.reason, false), null), TextView.BufferType.SPANNABLE);
}
else {