aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/ui/Formatter.java
diff options
context:
space:
mode:
Diffstat (limited to 'main/src/cgeo/geocaching/ui/Formatter.java')
-rw-r--r--main/src/cgeo/geocaching/ui/Formatter.java24
1 files changed, 13 insertions, 11 deletions
diff --git a/main/src/cgeo/geocaching/ui/Formatter.java b/main/src/cgeo/geocaching/ui/Formatter.java
index 53a7276..412b993 100644
--- a/main/src/cgeo/geocaching/ui/Formatter.java
+++ b/main/src/cgeo/geocaching/ui/Formatter.java
@@ -1,8 +1,8 @@
package cgeo.geocaching.ui;
+import cgeo.geocaching.Geocache;
import cgeo.geocaching.R;
-import cgeo.geocaching.cgCache;
-import cgeo.geocaching.cgWaypoint;
+import cgeo.geocaching.Waypoint;
import cgeo.geocaching.cgeoapplication;
import cgeo.geocaching.enumerations.CacheListType;
import cgeo.geocaching.enumerations.CacheSize;
@@ -13,6 +13,7 @@ import org.apache.commons.lang3.StringUtils;
import android.content.Context;
import android.text.format.DateUtils;
+import java.text.DateFormat;
import java.util.ArrayList;
import java.util.List;
@@ -70,8 +71,8 @@ public abstract class Formatter {
* @return the formatted string
*/
public static String formatShortDate(long date) {
- return DateUtils.formatDateTime(context, date, DateUtils.FORMAT_SHOW_DATE
- | DateUtils.FORMAT_NUMERIC_DATE);
+ DateFormat dateFormat = android.text.format.DateFormat.getDateFormat(context);
+ return dateFormat.format(date);
}
/**
@@ -108,7 +109,7 @@ public abstract class Formatter {
return DateUtils.formatDateTime(context, date, DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_ABBREV_ALL);
}
- public static String formatCacheInfoLong(cgCache cache, CacheListType cacheListType) {
+ public static String formatCacheInfoLong(Geocache cache, CacheListType cacheListType) {
final ArrayList<String> infos = new ArrayList<String>();
if (StringUtils.isNotBlank(cache.getGeocode())) {
infos.add(cache.getGeocode());
@@ -125,7 +126,7 @@ public abstract class Formatter {
return StringUtils.join(infos, Formatter.SEPARATOR);
}
- public static String formatCacheInfoShort(cgCache cache) {
+ public static String formatCacheInfoShort(Geocache cache) {
final ArrayList<String> infos = new ArrayList<String>();
if (cache.hasDifficulty()) {
infos.add("D " + String.format("%.1f", cache.getDifficulty()));
@@ -143,7 +144,7 @@ public abstract class Formatter {
return StringUtils.join(infos, Formatter.SEPARATOR);
}
- public static String formatCacheInfoHistory(cgCache cache) {
+ public static String formatCacheInfoHistory(Geocache cache) {
final ArrayList<String> infos = new ArrayList<String>(3);
infos.add(StringUtils.upperCase(cache.getGeocode()));
infos.add(Formatter.formatDate(cache.getVisitedDate()));
@@ -151,12 +152,13 @@ public abstract class Formatter {
return StringUtils.join(infos, Formatter.SEPARATOR);
}
- public static String formatWaypointInfo(cgWaypoint waypoint) {
+ public static String formatWaypointInfo(Waypoint waypoint) {
final List<String> infos = new ArrayList<String>(3);
- if (WaypointType.ALL_TYPES_EXCEPT_OWN.contains(waypoint.getWaypointType())) {
- infos.add(waypoint.getWaypointType().getL10n());
+ WaypointType waypointType = waypoint.getWaypointType();
+ if (waypointType != WaypointType.OWN && waypointType != null) {
+ infos.add(waypointType.getL10n());
}
- if (cgWaypoint.PREFIX_OWN.equalsIgnoreCase(waypoint.getPrefix())) {
+ if (Waypoint.PREFIX_OWN.equalsIgnoreCase(waypoint.getPrefix())) {
infos.add(cgeoapplication.getInstance().getString(R.string.waypoint_custom));
} else {
if (StringUtils.isNotBlank(waypoint.getPrefix())) {