diff options
Diffstat (limited to 'main/src/cgeo/geocaching/utils/Formatter.java')
| -rw-r--r-- | main/src/cgeo/geocaching/utils/Formatter.java | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/main/src/cgeo/geocaching/utils/Formatter.java b/main/src/cgeo/geocaching/utils/Formatter.java index db649d8..2127d59 100644 --- a/main/src/cgeo/geocaching/utils/Formatter.java +++ b/main/src/cgeo/geocaching/utils/Formatter.java @@ -17,6 +17,7 @@ import java.text.DateFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; +import java.util.Locale; public abstract class Formatter { @@ -149,10 +150,10 @@ public abstract class Formatter { private static void addShortInfos(final Geocache cache, final ArrayList<String> infos) { if (cache.hasDifficulty()) { - infos.add("D " + String.format("%.1f", cache.getDifficulty())); + infos.add("D " + formatDT(cache.getDifficulty())); } if (cache.hasTerrain()) { - infos.add("T " + String.format("%.1f", cache.getTerrain())); + infos.add("T " + formatDT(cache.getTerrain())); } // don't show "not chosen" for events and virtuals, that should be the normal case @@ -166,6 +167,10 @@ public abstract class Formatter { } } + private static String formatDT(final float value) { + return String.format(Locale.getDefault(), "%.1f", value); + } + public static String formatCacheInfoHistory(final Geocache cache) { final ArrayList<String> infos = new ArrayList<>(3); infos.add(StringUtils.upperCase(cache.getGeocode())); @@ -226,4 +231,8 @@ public abstract class Formatter { return dateString; } + public static String formatMapSubtitle(final Geocache cache) { + return "D " + formatDT(cache.getDifficulty()) + SEPARATOR + "T " + formatDT(cache.getTerrain()) + SEPARATOR + cache.getGeocode(); + } + } |
