diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index 800e6c8e2f..969056afe9 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -9,6 +9,7 @@ 3. All your modified/created strings are in the top of the file (to make easier find what\'s translated). PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy --> + OsMo points %1$s downloaded. Automatically connect to the service after application startup Auto-connect OsMo service diff --git a/OsmAnd/src/net/osmand/plus/osmo/OsMoGroups.java b/OsmAnd/src/net/osmand/plus/osmo/OsMoGroups.java index e2989ea8fc..1398c77907 100644 --- a/OsmAnd/src/net/osmand/plus/osmo/OsMoGroups.java +++ b/OsmAnd/src/net/osmand/plus/osmo/OsMoGroups.java @@ -13,6 +13,7 @@ import net.osmand.plus.GPXUtilities.WptPt; import net.osmand.plus.osmo.OsMoGroupsStorage.OsMoDevice; import net.osmand.plus.osmo.OsMoGroupsStorage.OsMoGroup; import net.osmand.plus.osmo.OsMoTracker.OsmoTrackerListener; +import net.osmand.util.Algorithms; import org.json.JSONArray; import org.json.JSONException; @@ -327,6 +328,9 @@ public class OsMoGroups implements OsMoReactor, OsmoTrackerListener { if (jobj.has("name")) { pt.name = jobj.getString("name"); } + if (jobj.has("color")) { + pt.setColor(Algorithms.parseColor(jobj.getString("color"))); + } if (jobj.has("description")) { pt.desc = jobj.getString("description"); } @@ -336,8 +340,9 @@ public class OsMoGroups implements OsMoReactor, OsmoTrackerListener { if (jobj.has("visible")) { pt.getExtensionsToWrite().put("visible", a[i].getBoolean("visible") + ""); } + points.add(pt); } - plugin.getSaveGpxTask(gr.groupId + "_points", modify).execute(points.toArray(new WptPt[0])); + plugin.getSaveGpxTask(gr.groupId + "_points", modify).execute(points.toArray(new WptPt[points.size()])); } if(deleteUsers) { for(OsMoDevice s : toDelete.values()) { diff --git a/OsmAnd/src/net/osmand/plus/osmo/OsMoPlugin.java b/OsmAnd/src/net/osmand/plus/osmo/OsMoPlugin.java index 1dccf4eb37..5c1ee1dbc0 100644 --- a/OsmAnd/src/net/osmand/plus/osmo/OsMoPlugin.java +++ b/OsmAnd/src/net/osmand/plus/osmo/OsMoPlugin.java @@ -335,15 +335,25 @@ public class OsMoPlugin extends OsmandPlugin implements MonitoringInfoControlSer } public AsyncTask getSaveGpxTask(final String name, final long timestamp) { - return new AsyncTask (){ - + return new AsyncTask() { + + protected void onProgressUpdate(String... values) { + if (values != null) { + String t = ""; + for (String s : values) { + t += s + "\n"; + } + app.showToastMessage(t.trim()); + } + } + @Override protected String doInBackground(WptPt... params) { - final File fl = app.getAppPath(IndexConstants.GPX_INDEX_DIR+"/osmo"); - if(!fl.exists()) { + final File fl = app.getAppPath(IndexConstants.GPX_INDEX_DIR + "/osmo"); + if (!fl.exists()) { fl.mkdirs(); } - File ps = new File(fl, name+".gpx"); + File ps = new File(fl, name + ".gpx"); String errors = ""; boolean changed = false; if (!ps.exists() || ps.lastModified() != timestamp) { @@ -352,28 +362,29 @@ public class OsMoPlugin extends OsmandPlugin implements MonitoringInfoControlSer g.points.addAll(Arrays.asList(params)); errors = GPXUtilities.writeGpxFile(ps, g, app); ps.setLastModified(timestamp); - if(errors == null ) { + if (errors == null) { errors = ""; } + publishProgress(app.getString(R.string.osmo_gpx_points_downloaded, name)); } SelectedGpxFile byPath = app.getSelectedGpxHelper().getSelectedFileByPath(ps.getAbsolutePath()); - if(byPath == null || changed) { + if (byPath == null || changed) { GPXFile selectGPXFile = GPXUtilities.loadGPXFile(app, ps); - if(byPath != null) { + if (byPath != null) { app.getSelectedGpxHelper().selectGpxFile(selectGPXFile, false, false); } app.getSelectedGpxHelper().setGpxFileToDisplay(selectGPXFile); } return errors; } - + @Override protected void onPostExecute(String result) { - if(result.length() > 0) { - app.showToastMessage(app.getString(R.string.osmo_io_error)+ result); + if (result.length() > 0) { + app.showToastMessage(app.getString(R.string.osmo_io_error) + result); } } - + }; }