Add points to download

This commit is contained in:
Victor Shcherb 2014-07-05 18:49:45 +02:00
parent dca5eff5a4
commit 8a13b24b75
3 changed files with 30 additions and 13 deletions

View file

@ -9,6 +9,7 @@
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated). 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 PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
--> -->
<string name="osmo_gpx_points_downloaded">OsMo points %1$s downloaded.</string>
<string name="osmo_auto_connect_descr">Automatically connect to the service after application startup</string> <string name="osmo_auto_connect_descr">Automatically connect to the service after application startup</string>
<string name="osmo_auto_connect">Auto-connect</string> <string name="osmo_auto_connect">Auto-connect</string>
<string name="osmo_start_service">OsMo service</string> <string name="osmo_start_service">OsMo service</string>

View file

@ -13,6 +13,7 @@ import net.osmand.plus.GPXUtilities.WptPt;
import net.osmand.plus.osmo.OsMoGroupsStorage.OsMoDevice; import net.osmand.plus.osmo.OsMoGroupsStorage.OsMoDevice;
import net.osmand.plus.osmo.OsMoGroupsStorage.OsMoGroup; import net.osmand.plus.osmo.OsMoGroupsStorage.OsMoGroup;
import net.osmand.plus.osmo.OsMoTracker.OsmoTrackerListener; import net.osmand.plus.osmo.OsMoTracker.OsmoTrackerListener;
import net.osmand.util.Algorithms;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONException; import org.json.JSONException;
@ -327,6 +328,9 @@ public class OsMoGroups implements OsMoReactor, OsmoTrackerListener {
if (jobj.has("name")) { if (jobj.has("name")) {
pt.name = jobj.getString("name"); pt.name = jobj.getString("name");
} }
if (jobj.has("color")) {
pt.setColor(Algorithms.parseColor(jobj.getString("color")));
}
if (jobj.has("description")) { if (jobj.has("description")) {
pt.desc = jobj.getString("description"); pt.desc = jobj.getString("description");
} }
@ -336,8 +340,9 @@ public class OsMoGroups implements OsMoReactor, OsmoTrackerListener {
if (jobj.has("visible")) { if (jobj.has("visible")) {
pt.getExtensionsToWrite().put("visible", a[i].getBoolean("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) { if(deleteUsers) {
for(OsMoDevice s : toDelete.values()) { for(OsMoDevice s : toDelete.values()) {

View file

@ -337,6 +337,16 @@ public class OsMoPlugin extends OsmandPlugin implements MonitoringInfoControlSer
public AsyncTask<WptPt, String, String> getSaveGpxTask(final String name, final long timestamp) { public AsyncTask<WptPt, String, String> getSaveGpxTask(final String name, final long timestamp) {
return new AsyncTask<WptPt, String, String>() { return new AsyncTask<WptPt, String, String>() {
protected void onProgressUpdate(String... values) {
if (values != null) {
String t = "";
for (String s : values) {
t += s + "\n";
}
app.showToastMessage(t.trim());
}
}
@Override @Override
protected String doInBackground(WptPt... params) { protected String doInBackground(WptPt... params) {
final File fl = app.getAppPath(IndexConstants.GPX_INDEX_DIR + "/osmo"); final File fl = app.getAppPath(IndexConstants.GPX_INDEX_DIR + "/osmo");
@ -355,6 +365,7 @@ public class OsMoPlugin extends OsmandPlugin implements MonitoringInfoControlSer
if (errors == null) { if (errors == null) {
errors = ""; errors = "";
} }
publishProgress(app.getString(R.string.osmo_gpx_points_downloaded, name));
} }
SelectedGpxFile byPath = app.getSelectedGpxHelper().getSelectedFileByPath(ps.getAbsolutePath()); SelectedGpxFile byPath = app.getSelectedGpxHelper().getSelectedFileByPath(ps.getAbsolutePath());
if (byPath == null || changed) { if (byPath == null || changed) {