aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/LogEntry.java
diff options
context:
space:
mode:
Diffstat (limited to 'main/src/cgeo/geocaching/LogEntry.java')
-rw-r--r--main/src/cgeo/geocaching/LogEntry.java15
1 files changed, 15 insertions, 0 deletions
diff --git a/main/src/cgeo/geocaching/LogEntry.java b/main/src/cgeo/geocaching/LogEntry.java
index e03dc66..b625bb5 100644
--- a/main/src/cgeo/geocaching/LogEntry.java
+++ b/main/src/cgeo/geocaching/LogEntry.java
@@ -10,9 +10,13 @@ import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
public final class LogEntry {
+ private static final Pattern PATTERN_REMOVE_COLORS = Pattern.compile("</?font.*?>", Pattern.CASE_INSENSITIVE);
+
public int id = 0;
public LogType type = LogType.UNKNOWN;
public String author = "";
@@ -97,4 +101,15 @@ public final class LogEntry {
public int daysSinceLog() {
return DateUtils.daysSince(date);
}
+
+ /**
+ * Get the log text to be displayed. Depending on the settings, color tags might be removed.
+ */
+ public String getDisplayText() {
+ if (Settings.getPlainLogs()) {
+ Matcher matcher = PATTERN_REMOVE_COLORS.matcher(log);
+ return matcher.replaceAll("");
+ }
+ return log;
+ }
}