diff --git a/OsmAnd/src/net/osmand/plus/GPXUtilities.java b/OsmAnd/src/net/osmand/plus/GPXUtilities.java index 93d36823b1..a5ef4ce17a 100644 --- a/OsmAnd/src/net/osmand/plus/GPXUtilities.java +++ b/OsmAnd/src/net/osmand/plus/GPXUtilities.java @@ -779,7 +779,7 @@ public class GPXUtilities { public static String writeGpx(Writer output, GPXFile file, OsmandApplication ctx) { try { - SimpleDateFormat format = new SimpleDateFormat(GPX_TIME_FORMAT); + SimpleDateFormat format = new SimpleDateFormat(GPX_TIME_FORMAT, Locale.US); format.setTimeZone(TimeZone.getTimeZone("UTC")); XmlSerializer serializer = PlatformUtil.newSerializer(); serializer.setOutput(output); @@ -960,7 +960,7 @@ public class GPXUtilities { public static GPXFile loadGPXFile(Context ctx, InputStream f) { GPXFile res = new GPXFile(); - SimpleDateFormat format = new SimpleDateFormat(GPX_TIME_FORMAT); + SimpleDateFormat format = new SimpleDateFormat(GPX_TIME_FORMAT, Locale.US); format.setTimeZone(TimeZone.getTimeZone("UTC")); try { XmlPullParser parser = PlatformUtil.newXMLPullParser(); diff --git a/OsmAnd/src/net/osmand/plus/activities/ContributionVersionActivity.java b/OsmAnd/src/net/osmand/plus/activities/ContributionVersionActivity.java index 72a351919c..0e780ff39b 100644 --- a/OsmAnd/src/net/osmand/plus/activities/ContributionVersionActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/ContributionVersionActivity.java @@ -33,6 +33,7 @@ import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; +import java.util.Locale; public class ContributionVersionActivity extends OsmandListActivity { @@ -48,7 +49,7 @@ public class ContributionVersionActivity extends OsmandListActivity { private Date currentInstalledDate; private List downloadedBuilds = new ArrayList(); - private SimpleDateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy"); + private SimpleDateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy", Locale.US); private File pathToDownload; private OsmAndBuild currentSelectedBuild = null; diff --git a/OsmAnd/src/net/osmand/plus/activities/SavingTrackHelper.java b/OsmAnd/src/net/osmand/plus/activities/SavingTrackHelper.java index 65144e9084..43857cec00 100644 --- a/OsmAnd/src/net/osmand/plus/activities/SavingTrackHelper.java +++ b/OsmAnd/src/net/osmand/plus/activities/SavingTrackHelper.java @@ -1,12 +1,9 @@ package net.osmand.plus.activities; -import java.io.File; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Date; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; +import android.database.Cursor; +import android.database.sqlite.SQLiteDatabase; +import android.database.sqlite.SQLiteOpenHelper; +import android.text.format.DateFormat; import net.osmand.PlatformUtil; import net.osmand.data.LatLon; @@ -25,10 +22,14 @@ import net.osmand.plus.monitoring.OsmandMonitoringPlugin; import org.apache.commons.logging.Log; -import android.database.Cursor; -import android.database.sqlite.SQLiteDatabase; -import android.database.sqlite.SQLiteOpenHelper; -import android.text.format.DateFormat; +import java.io.File; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; public class SavingTrackHelper extends SQLiteOpenHelper { @@ -194,7 +195,7 @@ public class SavingTrackHelper extends SQLiteOpenHelper { File fout = new File(dir, f + ".gpx"); //$NON-NLS-1$ if (!data.get(f).isEmpty()) { WptPt pt = data.get(f).findPointToShow(); - String fileName = f + "_" + new SimpleDateFormat("HH-mm_EEE").format(new Date(pt.time)); //$NON-NLS-1$ + String fileName = f + "_" + new SimpleDateFormat("HH-mm_EEE", Locale.US).format(new Date(pt.time)); //$NON-NLS-1$ fout = new File(dir, fileName + ".gpx"); //$NON-NLS-1$ int ind = 1; while (fout.exists()) { diff --git a/OsmAnd/src/net/osmand/plus/download/DownloadActivityType.java b/OsmAnd/src/net/osmand/plus/download/DownloadActivityType.java index c9ca181484..883886b506 100644 --- a/OsmAnd/src/net/osmand/plus/download/DownloadActivityType.java +++ b/OsmAnd/src/net/osmand/plus/download/DownloadActivityType.java @@ -1,15 +1,6 @@ package net.osmand.plus.download; -import static net.osmand.IndexConstants.BINARY_MAP_INDEX_EXT; - -import java.io.File; -import java.io.IOException; -import java.net.URLEncoder; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.HashMap; -import java.util.Map; +import android.content.Context; import net.osmand.AndroidUtils; import net.osmand.IndexConstants; @@ -22,10 +13,20 @@ import net.osmand.util.Algorithms; import org.xmlpull.v1.XmlPullParser; -import android.content.Context; +import java.io.File; +import java.io.IOException; +import java.net.URLEncoder; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.HashMap; +import java.util.Locale; +import java.util.Map; + +import static net.osmand.IndexConstants.BINARY_MAP_INDEX_EXT; public class DownloadActivityType { - private static SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd.MM.yyyy"); + private static SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd.MM.yyyy", Locale.US); private static Map byTag = new HashMap<>(); public static final DownloadActivityType NORMAL_FILE = diff --git a/OsmAnd/src/net/osmand/plus/helpers/GpxImportHelper.java b/OsmAnd/src/net/osmand/plus/helpers/GpxImportHelper.java index f2f22ccea4..f2f7e8ecf6 100644 --- a/OsmAnd/src/net/osmand/plus/helpers/GpxImportHelper.java +++ b/OsmAnd/src/net/osmand/plus/helpers/GpxImportHelper.java @@ -34,6 +34,7 @@ import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; +import java.util.Locale; /** * @author Koen Rabaey @@ -281,7 +282,7 @@ public class GpxImportHelper { private File getFileToSave(final String fileName, final File importDir, final GPXUtilities.WptPt pt) { final StringBuilder builder = new StringBuilder(fileName); if ("".equals(fileName)) { - builder.append("import_").append(new SimpleDateFormat("HH-mm_EEE").format(new Date(pt.time))).append(GPX_SUFFIX); //$NON-NLS-1$ + builder.append("import_").append(new SimpleDateFormat("HH-mm_EEE", Locale.US).format(new Date(pt.time))).append(GPX_SUFFIX); //$NON-NLS-1$ } if (fileName.endsWith(KML_SUFFIX)) { builder.replace(builder.length() - KML_SUFFIX.length(), builder.length(), GPX_SUFFIX); diff --git a/OsmAnd/src/net/osmand/plus/osmo/OsMoThread.java b/OsmAnd/src/net/osmand/plus/osmo/OsMoThread.java index bfda09d432..cebdfbf10f 100644 --- a/OsmAnd/src/net/osmand/plus/osmo/OsMoThread.java +++ b/OsmAnd/src/net/osmand/plus/osmo/OsMoThread.java @@ -1,5 +1,16 @@ package net.osmand.plus.osmo; +import android.os.Handler; +import android.os.HandlerThread; +import android.os.Message; + +import net.osmand.PlatformUtil; +import net.osmand.plus.osmo.OsMoService.SessionInfo; + +import org.apache.commons.logging.Log; +import org.json.JSONException; +import org.json.JSONObject; + import java.io.IOException; import java.io.UnsupportedEncodingException; import java.net.InetSocketAddress; @@ -12,22 +23,12 @@ import java.util.Collection; import java.util.Date; import java.util.Iterator; import java.util.LinkedList; +import java.util.Locale; import java.util.Map; import java.util.Map.Entry; import java.util.Set; import java.util.concurrent.ConcurrentLinkedQueue; -import net.osmand.PlatformUtil; -import net.osmand.plus.osmo.OsMoService.SessionInfo; - -import org.apache.commons.logging.Log; -import org.json.JSONException; -import org.json.JSONObject; - -import android.os.Handler; -import android.os.HandlerThread; -import android.os.Message; - public class OsMoThread { // private static String TRACKER_SERVER = "srv.osmo.mobi"; // private static int TRACKER_PORT = 3245; @@ -63,7 +64,7 @@ public class OsMoThread { private ByteBuffer pendingReadCommand = ByteBuffer.allocate(2048); private LinkedList queueOfMessages = new LinkedList(); - private SimpleDateFormat df = new SimpleDateFormat("HH:mm:ss"); + private SimpleDateFormat df = new SimpleDateFormat("HH:mm:ss", Locale.US); private ConcurrentLinkedQueue lastCommands = new ConcurrentLinkedQueue(); private final static int STACK_CMD = 30;