aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBananeweizen <bananeweizen@gmx.de>2012-01-14 12:57:57 +0100
committerBananeweizen <bananeweizen@gmx.de>2012-01-14 12:57:57 +0100
commitee3b241d516377bd8e06d035c4b589cdfb79f741 (patch)
tree91d1b716e37773d66f3380a0c5e544a24c5a33ad
parent72092c27a658b303a6b472b428a1aef3f3025c35 (diff)
downloadcgeo-ee3b241d516377bd8e06d035c4b589cdfb79f741.zip
cgeo-ee3b241d516377bd8e06d035c4b589cdfb79f741.tar.gz
cgeo-ee3b241d516377bd8e06d035c4b589cdfb79f741.tar.bz2
#965: use box drawing characters for table
-rw-r--r--main/src/cgeo/geocaching/CacheDetailActivity.java2
-rw-r--r--main/src/cgeo/geocaching/utils/UnknownTagsHandler.java10
2 files changed, 8 insertions, 4 deletions
diff --git a/main/src/cgeo/geocaching/CacheDetailActivity.java b/main/src/cgeo/geocaching/CacheDetailActivity.java
index 090ea80..f749009 100644
--- a/main/src/cgeo/geocaching/CacheDetailActivity.java
+++ b/main/src/cgeo/geocaching/CacheDetailActivity.java
@@ -2092,7 +2092,7 @@ public class CacheDetailActivity extends AbstractActivity {
// if description has HTML table, add a note at the end of the long description
if (unknownTagsHandler.isTableDetected() && descriptionView == view.findViewById(R.id.longdesc)) {
final int startPos = description.length();
- ((Editable) description).append("\n" + res.getString(R.string.cache_description_table_note));
+ ((Editable) description).append("\n\n" + res.getString(R.string.cache_description_table_note));
((Editable) description).setSpan(new StyleSpan(Typeface.ITALIC), startPos, description.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
publishProgress();
}
diff --git a/main/src/cgeo/geocaching/utils/UnknownTagsHandler.java b/main/src/cgeo/geocaching/utils/UnknownTagsHandler.java
index ade499a..9991a50 100644
--- a/main/src/cgeo/geocaching/utils/UnknownTagsHandler.java
+++ b/main/src/cgeo/geocaching/utils/UnknownTagsHandler.java
@@ -10,6 +10,7 @@ import android.text.style.StrikethroughSpan;
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;
@@ -47,16 +48,19 @@ public class UnknownTagsHandler implements TagHandler {
}
private static void handleTd(boolean opening, Editable output) {
- // insert space for each table column
+ // insert bar for each table column, see https://en.wikipedia.org/wiki/Box-drawing_characters
if (opening) {
- output.insert(output.length(), " ");
+ if (countCells++ > 0) {
+ output.append('┆');
+ }
}
}
private static void handleTr(boolean opening, Editable output) {
// insert new line for each table row
if (opening) {
- output.insert(output.length(), "\n");
+ output.append('\n');
+ countCells = 0;
}
}