aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--main/src/cgeo/geocaching/CacheDetailActivity.java6
-rw-r--r--main/src/cgeo/geocaching/utils/UnknownTagsHandler.java14
2 files changed, 12 insertions, 8 deletions
diff --git a/main/src/cgeo/geocaching/CacheDetailActivity.java b/main/src/cgeo/geocaching/CacheDetailActivity.java
index b5a22c0..d3bb28a 100644
--- a/main/src/cgeo/geocaching/CacheDetailActivity.java
+++ b/main/src/cgeo/geocaching/CacheDetailActivity.java
@@ -2018,8 +2018,10 @@ public class CacheDetailActivity extends AbstractActivity {
publishProgress();
}
- // if description has HTML table, add a note at the end of the long description
- if (unknownTagsHandler.isTableDetected() && descriptionView == view.findViewById(R.id.longdesc)) {
+ // If description has an HTML construct which may be problematic to render, add a note at the end of the long description.
+ // Technically, it may not be a table, but a pre, which has the same problems as a table, so the message is ok even though
+ // sometimes technically incorrect.
+ if (unknownTagsHandler.isProblematicDetected() && descriptionView == view.findViewById(R.id.longdesc)) {
final int startPos = description.length();
((Editable) description).append("\n\n").append(res.getString(R.string.cache_description_table_note));
((Editable) description).setSpan(new StyleSpan(Typeface.ITALIC), startPos, description.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
diff --git a/main/src/cgeo/geocaching/utils/UnknownTagsHandler.java b/main/src/cgeo/geocaching/utils/UnknownTagsHandler.java
index 149605d..68bdb1f 100644
--- a/main/src/cgeo/geocaching/utils/UnknownTagsHandler.java
+++ b/main/src/cgeo/geocaching/utils/UnknownTagsHandler.java
@@ -12,7 +12,7 @@ public class UnknownTagsHandler implements TagHandler {
private static final int UNDEFINED_POSITION = -1;
private static int countCells = 0;
int strikePos = UNDEFINED_POSITION;
- private boolean tableDetected = false;
+ private boolean problematicDetected = false;
@Override
public void handleTag(boolean opening, String tag, Editable output,
@@ -20,11 +20,13 @@ public class UnknownTagsHandler implements TagHandler {
if (tag.equalsIgnoreCase("strike") || tag.equals("s")) {
handleStrike(opening, output);
} else if (tag.equalsIgnoreCase("table")) {
- handleTable();
+ handleProblematic();
} else if (tag.equalsIgnoreCase("td")) {
handleTd(opening, output);
} else if (tag.equalsIgnoreCase("tr")) {
handleTr(opening, output);
+ } else if (tag.equalsIgnoreCase("pre")) {
+ handleProblematic();
}
}
@@ -40,12 +42,12 @@ public class UnknownTagsHandler implements TagHandler {
}
}
- public boolean isTableDetected() {
- return tableDetected;
+ public boolean isProblematicDetected() {
+ return problematicDetected;
}
- private void handleTable() {
- tableDetected = true;
+ private void handleProblematic() {
+ problematicDetected = true;
}
private static void handleTd(boolean opening, Editable output) {