diff --git a/MyTracks/src/com/google/android/apps/mytracks/ImportAllTracks.java b/MyTracks/src/com/google/android/apps/mytracks/ImportAllTracks.java index dec85c160..e36c76197 100644 --- a/MyTracks/src/com/google/android/apps/mytracks/ImportAllTracks.java +++ b/MyTracks/src/com/google/android/apps/mytracks/ImportAllTracks.java @@ -61,8 +61,8 @@ public class ImportAllTracks { Log.i(Constants.TAG, "ImportAllTracks: Starting"); fileUtils = new FileUtils(); gpxPath = fileUtils.buildExternalDirectoryPath("gpx"); - this.activity.runOnUiThread(runner); - //new Thread(runner).start(); + + new Thread(runner).start(); } private final Runnable runner = new Runnable() { @@ -95,6 +95,15 @@ public class ImportAllTracks { Log.i(Constants.TAG, "ImportAllTracks: Releasing wake lock."); } + activity.runOnUiThread(new Thread() { + @Override + public void run() { + showDoneDialog(); + } + }); + } + + private void showDoneDialog() { Log.i(Constants.TAG, "ImportAllTracks: Done"); AlertDialog.Builder builder = new AlertDialog.Builder(activity); if (gpxFileCount == 0) { diff --git a/MyTracks/src/com/google/android/apps/mytracks/io/docs/DocsHelper.java b/MyTracks/src/com/google/android/apps/mytracks/io/docs/DocsHelper.java index b3e7b8196..ca02b7aec 100644 --- a/MyTracks/src/com/google/android/apps/mytracks/io/docs/DocsHelper.java +++ b/MyTracks/src/com/google/android/apps/mytracks/io/docs/DocsHelper.java @@ -287,11 +287,13 @@ public class DocsHelper { String elevationUnit = context.getString(metricUnits ? R.string.meter : R.string.feet); + DateFormat trackDateFormat = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT); + // Prepare the Post-Text we are going to send. DocsTagBuilder tagBuilder = new DocsTagBuilder(metricUnits) .append("name", track.getName()) .append("description", track.getDescription()) - .append("date", DateFormat.getDateTimeInstance(DateFormat.SHORT,DateFormat.SHORT).format(new Date(stats.getStartTime()))) + .append("date", trackDateFormat.format(new Date(stats.getStartTime()))) .append("totaltime", StringUtils.formatTimeAlwaysShowingHours( stats.getTotalTime())) .append("movingtime", StringUtils.formatTimeAlwaysShowingHours( diff --git a/MyTracks/src/com/google/android/apps/mytracks/io/docs/DocsTagBuilder.java b/MyTracks/src/com/google/android/apps/mytracks/io/docs/DocsTagBuilder.java index 125fd725d..b20ae2eb6 100644 --- a/MyTracks/src/com/google/android/apps/mytracks/io/docs/DocsTagBuilder.java +++ b/MyTracks/src/com/google/android/apps/mytracks/io/docs/DocsTagBuilder.java @@ -18,36 +18,39 @@ package com.google.android.apps.mytracks.io.docs; import com.google.android.apps.mytracks.util.StringUtils; import com.google.android.apps.mytracks.util.UnitConversions; +import java.text.DecimalFormat; +import java.text.DecimalFormatSymbols; import java.text.NumberFormat; +import java.util.Locale; /** *
This class builds a string of XML tags used to talk to Docs using GData. - * + * *
Sample Usage:
- *
+ *
*
* String tags = new DocsTagBuilder(false)
* .append("tagName", "tagValue")
* .appendLargeUnits("bigTagName", 1.0)
* .build();
*
- *
+ *
*
results in:
- *
+ *
*
*
- *
+ *
* @author Matthew Simmons
*/
class DocsTagBuilder {
- // TODO(simmonmt): These formats aren't I18N-compatible. Not everyone uses
- // commas for thousands and dots for the decimal point.
+ private static final DecimalFormatSymbols FORMAT_SYMBOLS =
+ DecimalFormatSymbols.getInstance(Locale.ENGLISH);
private static final NumberFormat LARGE_UNIT_FORMAT =
- NumberFormat.getNumberInstance();
+ new DecimalFormat("#,###,###.00", FORMAT_SYMBOLS);
private static final NumberFormat SMALL_UNIT_FORMAT =
- NumberFormat.getNumberInstance();
+ new DecimalFormat("###,###", FORMAT_SYMBOLS);
protected final boolean metricUnits;
protected final StringBuilder stringBuilder;
@@ -58,7 +61,7 @@ class DocsTagBuilder {
*/
DocsTagBuilder(boolean metricUnits) {
this.metricUnits = metricUnits;
- stringBuilder = new StringBuilder();
+ this.stringBuilder = new StringBuilder();
}
/** Appends a tag containing a string value */
@@ -67,13 +70,13 @@ class DocsTagBuilder {
return this;
}
- /**
+ /**
* Appends a tag containing a numeric value. The value will be formatted
* according to the large distance of the specified measurement system (i.e.
* kilometers or miles).
- *
+ *
* @param name The tag name.
- * @param d The value to be formatted, in kilometers.
+ * @param d The value to be formatted, in kilometers.
*/
DocsTagBuilder appendLargeUnits(String name, double d) {
double value = metricUnits ? d : (d * UnitConversions.KM_TO_MI);
@@ -85,7 +88,7 @@ class DocsTagBuilder {
* Appends a tag containing a numeric value. The value will be formatted
* according to the small distance of the specified measurement system (i.e.
* meters or feet).
- *
+ *
* @param name The tag name.
* @param d The value to be formatted, in meters.
*/