diff options
| author | Bananeweizen <bananeweizen@gmx.de> | 2013-10-19 10:59:29 +0200 |
|---|---|---|
| committer | Bananeweizen <bananeweizen@gmx.de> | 2013-10-19 10:59:29 +0200 |
| commit | 898456bcf181714d9dfaff12f9c37dce74b4ea1c (patch) | |
| tree | f04cf56a38441c174f51ac75e487ffba1cc77cd3 /main/src/cgeo/geocaching/utils/LogTemplateProvider.java | |
| parent | 2093ea462db4d8e56282de5871c58579a023d7cf (diff) | |
| download | cgeo-898456bcf181714d9dfaff12f9c37dce74b4ea1c.zip cgeo-898456bcf181714d9dfaff12f9c37dce74b4ea1c.tar.gz cgeo-898456bcf181714d9dfaff12f9c37dce74b4ea1c.tar.bz2 | |
fix #3368: New placeholer [LOG] for twitter template
Diffstat (limited to 'main/src/cgeo/geocaching/utils/LogTemplateProvider.java')
| -rw-r--r-- | main/src/cgeo/geocaching/utils/LogTemplateProvider.java | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/main/src/cgeo/geocaching/utils/LogTemplateProvider.java b/main/src/cgeo/geocaching/utils/LogTemplateProvider.java index bf2a27c..af183f7 100644 --- a/main/src/cgeo/geocaching/utils/LogTemplateProvider.java +++ b/main/src/cgeo/geocaching/utils/LogTemplateProvider.java @@ -1,6 +1,7 @@ package cgeo.geocaching.utils; import cgeo.geocaching.Geocache; +import cgeo.geocaching.LogEntry; import cgeo.geocaching.R; import cgeo.geocaching.Trackable; import cgeo.geocaching.connector.ConnectorFactory; @@ -35,9 +36,10 @@ public final class LogTemplateProvider { private Geocache cache; private Trackable trackable; private boolean offline = false; + private LogEntry logEntry; - public LogContext(final Geocache cache) { - this(cache, false); + public LogContext(final Geocache cache, LogEntry logEntry) { + this(cache, logEntry, false); } public LogContext(final Trackable trackable) { @@ -45,12 +47,13 @@ public final class LogTemplateProvider { } public LogContext(final boolean offline) { - this(null, offline); + this(null, null, offline); } - public LogContext(final Geocache cache, final boolean offline) { + public LogContext(final Geocache cache, LogEntry logEntry, final boolean offline) { this.cache = cache; this.offline = offline; + this.logEntry = logEntry; } public final Geocache getCache() { @@ -64,6 +67,10 @@ public final class LogTemplateProvider { public final boolean isOffline() { return offline; } + + public final LogEntry getLogEntry() { + return logEntry; + } } public abstract static class LogTemplate { @@ -207,6 +214,16 @@ public final class LogTemplateProvider { return StringUtils.EMPTY; } }); + templates.add(new LogTemplate("LOG", R.string.init_signature_template_log) { + @Override + public String getValue(LogContext context) { + LogEntry logEntry = context.getLogEntry(); + if (logEntry != null) { + return logEntry.getDisplayText(); + } + return StringUtils.EMPTY; + } + }); return templates; } |
