diff options
| author | Bananeweizen <bananeweizen@gmx.de> | 2014-10-05 09:38:24 +0200 |
|---|---|---|
| committer | Bananeweizen <bananeweizen@gmx.de> | 2014-10-05 09:38:24 +0200 |
| commit | 3e34ef9d4062080d5abd956fd06aefeddcebe13a (patch) | |
| tree | 7c282bd406ad4699300a48a357d6240c96f900d9 /main/src/cgeo/geocaching/utils/Formatter.java | |
| parent | d5b3cdc50cd2b4a4a66ee6843a802c4c07a5bbf5 (diff) | |
| download | cgeo-3e34ef9d4062080d5abd956fd06aefeddcebe13a.zip cgeo-3e34ef9d4062080d5abd956fd06aefeddcebe13a.tar.gz cgeo-3e34ef9d4062080d5abd956fd06aefeddcebe13a.tar.bz2 | |
fix #4380: translation of encoded hint does not work
Diffstat (limited to 'main/src/cgeo/geocaching/utils/Formatter.java')
| -rw-r--r-- | main/src/cgeo/geocaching/utils/Formatter.java | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/main/src/cgeo/geocaching/utils/Formatter.java b/main/src/cgeo/geocaching/utils/Formatter.java index 1b774f8..c764c5a 100644 --- a/main/src/cgeo/geocaching/utils/Formatter.java +++ b/main/src/cgeo/geocaching/utils/Formatter.java @@ -200,4 +200,27 @@ public abstract class Formatter { return CgeoApplication.getInstance().getResources().getQuantityString(R.plurals.days_ago, days, days); } } + + /** + * Formatting of the hidden date of a cache + * + * @param cache + * @return {@code null} or hidden date of the cache (or event date of the cache) in human readable format + */ + public static String formatHiddenDate(final Geocache cache) { + final Date hiddenDate = cache.getHiddenDate(); + if (hiddenDate == null) { + return null; + } + final long time = hiddenDate.getTime(); + if (time <= 0) { + return null; + } + String dateString = Formatter.formatFullDate(time); + if (cache.isEventCache()) { + dateString = DateUtils.formatDateTime(CgeoApplication.getInstance().getBaseContext(), time, DateUtils.FORMAT_SHOW_WEEKDAY) + ", " + dateString; + } + return dateString; + } + } |
