Fixed bug that context menu wasn't opened on moved poi change.
This commit is contained in:
parent
0a4d651cd3
commit
d5e912573c
1 changed files with 8 additions and 6 deletions
|
@ -207,7 +207,7 @@ public class OsmEditsLayer extends OsmandMapLayer implements ContextMenuLayer.IC
|
||||||
Node node = objectInMotion.getEntity();
|
Node node = objectInMotion.getEntity();
|
||||||
node.setLatitude(position.getLatitude());
|
node.setLatitude(position.getLatitude());
|
||||||
node.setLongitude(position.getLongitude());
|
node.setLongitude(position.getLongitude());
|
||||||
new SaveOsmChangeAsyncTask(mOsmChangeUtil, callback).execute(node);
|
new SaveOsmChangeAsyncTask(mOsmChangeUtil, callback, objectInMotion).execute();
|
||||||
} else if (o instanceof OsmNotesPoint) {
|
} else if (o instanceof OsmNotesPoint) {
|
||||||
OsmNotesPoint objectInMotion = (OsmNotesPoint) o;
|
OsmNotesPoint objectInMotion = (OsmNotesPoint) o;
|
||||||
objectInMotion.setLatitude(position.getLatitude());
|
objectInMotion.setLatitude(position.getLatitude());
|
||||||
|
@ -218,20 +218,22 @@ public class OsmEditsLayer extends OsmandMapLayer implements ContextMenuLayer.IC
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static class SaveOsmChangeAsyncTask extends AsyncTask<Node, Void, Node> {
|
static class SaveOsmChangeAsyncTask extends AsyncTask<Void, Void, Node> {
|
||||||
private final OpenstreetmapLocalUtil mOpenstreetmapUtil;
|
private final OpenstreetmapLocalUtil mOpenstreetmapUtil;
|
||||||
@Nullable
|
@Nullable
|
||||||
private final ContextMenuLayer.ApplyMovedObjectCallback mCallback;
|
private final ContextMenuLayer.ApplyMovedObjectCallback mCallback;
|
||||||
|
private final OpenstreetmapPoint objectInMotion;
|
||||||
|
|
||||||
SaveOsmChangeAsyncTask(OpenstreetmapLocalUtil openstreetmapUtil,
|
SaveOsmChangeAsyncTask(OpenstreetmapLocalUtil openstreetmapUtil,
|
||||||
@Nullable ContextMenuLayer.ApplyMovedObjectCallback callback) {
|
@Nullable ContextMenuLayer.ApplyMovedObjectCallback callback, OpenstreetmapPoint objectInMotion) {
|
||||||
this.mOpenstreetmapUtil = openstreetmapUtil;
|
this.mOpenstreetmapUtil = openstreetmapUtil;
|
||||||
this.mCallback = callback;
|
this.mCallback = callback;
|
||||||
|
this.objectInMotion = objectInMotion;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Node doInBackground(Node... params) {
|
protected Node doInBackground(Void... params) {
|
||||||
Node node = params[0];
|
Node node = objectInMotion.getEntity();
|
||||||
return mOpenstreetmapUtil.commitNodeImpl(OsmPoint.Action.MODIFY, node,
|
return mOpenstreetmapUtil.commitNodeImpl(OsmPoint.Action.MODIFY, node,
|
||||||
mOpenstreetmapUtil.getEntityInfo(node.getId()), "", false);
|
mOpenstreetmapUtil.getEntityInfo(node.getId()), "", false);
|
||||||
}
|
}
|
||||||
|
@ -239,7 +241,7 @@ public class OsmEditsLayer extends OsmandMapLayer implements ContextMenuLayer.IC
|
||||||
@Override
|
@Override
|
||||||
protected void onPostExecute(Node newNode) {
|
protected void onPostExecute(Node newNode) {
|
||||||
if (mCallback != null) {
|
if (mCallback != null) {
|
||||||
mCallback.onApplyMovedObject(true, newNode);
|
mCallback.onApplyMovedObject(newNode != null, objectInMotion);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue