Removed updating of deleted track. Added update after track downloaded via OsMo.

This commit is contained in:
GaidamakUA 2016-01-29 15:30:40 +02:00
parent ef9cb10426
commit a5905fbe84
2 changed files with 18 additions and 10 deletions

View file

@ -281,8 +281,8 @@ public class OsMoGroups implements OsMoReactor, OsmoTrackerListener {
helper.selectGpxFile(sg.getGpxFile(), false, false);
}
}
plugin.refreshMap();
}
}
private OsMoGroup parseGroup(JSONObject obj) throws JSONException {
@ -367,18 +367,19 @@ public class OsMoGroups implements OsMoReactor, OsmoTrackerListener {
if (obj.has(TRACK)) {
JSONArray ar = obj.getJSONArray(TRACK);
JSONObject[] a = new JSONObject[ar.length()];
List<JSONObject> a = new ArrayList<>(ar.length());
Set<String> toDeleteT = new HashSet<String>(gr.groupTracks);
gr.groupTracks.clear();
for (int i = 0; i < a.length; i++) {
a[i] = (JSONObject) ar.get(i);
if (!a[i].has(DELETED)) {
String track = a[i].getString("name") + ".gpx";
for (int i = 0; i < ar.length(); i++) {
JSONObject trackJson = (JSONObject) ar.get(i);
if (!trackJson.has(DELETED)) {
String track = trackJson.getString("name") + ".gpx";
gr.groupTracks.add(track);
toDeleteT.remove(track);
a.add(trackJson);
}
}
plugin.getDownloadGpxTask(true).execute(a);
plugin.getDownloadGpxTask(true).execute(a.toArray(new JSONObject[a.size()]));
disableGroupTracks(gr, toDeleteT);
}

View file

@ -171,7 +171,7 @@ public class OsMoPlugin extends OsmandPlugin implements OsMoReactor {
@Override
public void mapActivityPause(MapActivity activity) {
groups.removeUiListener(olayer);
mapActivity = activity;
mapActivity = null;
}
@Override
@ -179,7 +179,7 @@ public class OsMoPlugin extends OsmandPlugin implements OsMoReactor {
if (olayer != null) {
groups.addUiListeners(olayer);
}
mapActivity = null;
mapActivity = activity;
}
/**
@ -445,13 +445,14 @@ public class OsMoPlugin extends OsmandPlugin implements OsMoReactor {
t += s + "\n";
}
app.showToastMessage(t.trim());
refreshMap();
}
};
@Override
protected void onPostExecute(String result) {
if(result.length() > 0) {
app.showToastMessage(app.getString(R.string.osmo_io_error)+ result);
app.showToastMessage(app.getString(R.string.osmo_io_error) + result);
}
}
@ -459,6 +460,12 @@ public class OsMoPlugin extends OsmandPlugin implements OsMoReactor {
}
public void refreshMap() {
if (mapActivity != null) {
mapActivity.getMapView().refreshMap();
}
}
@Override
public boolean acceptCommand(String command, String id, String data, JSONObject obj, OsMoThread tread) {
return false;