From d5e912573c4b73b37961f1a1cb4a992ab3b8b6bb Mon Sep 17 00:00:00 2001 From: GaidamakUA Date: Tue, 31 May 2016 17:04:46 +0300 Subject: [PATCH] Fixed bug that context menu wasn't opened on moved poi change. --- .../src/net/osmand/plus/osmedit/OsmEditsLayer.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsLayer.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsLayer.java index 8e01a9d69c..4447b00eb0 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsLayer.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsLayer.java @@ -207,7 +207,7 @@ public class OsmEditsLayer extends OsmandMapLayer implements ContextMenuLayer.IC Node node = objectInMotion.getEntity(); node.setLatitude(position.getLatitude()); node.setLongitude(position.getLongitude()); - new SaveOsmChangeAsyncTask(mOsmChangeUtil, callback).execute(node); + new SaveOsmChangeAsyncTask(mOsmChangeUtil, callback, objectInMotion).execute(); } else if (o instanceof OsmNotesPoint) { OsmNotesPoint objectInMotion = (OsmNotesPoint) o; objectInMotion.setLatitude(position.getLatitude()); @@ -218,20 +218,22 @@ public class OsmEditsLayer extends OsmandMapLayer implements ContextMenuLayer.IC } } - static class SaveOsmChangeAsyncTask extends AsyncTask { + static class SaveOsmChangeAsyncTask extends AsyncTask { private final OpenstreetmapLocalUtil mOpenstreetmapUtil; @Nullable private final ContextMenuLayer.ApplyMovedObjectCallback mCallback; + private final OpenstreetmapPoint objectInMotion; SaveOsmChangeAsyncTask(OpenstreetmapLocalUtil openstreetmapUtil, - @Nullable ContextMenuLayer.ApplyMovedObjectCallback callback) { + @Nullable ContextMenuLayer.ApplyMovedObjectCallback callback, OpenstreetmapPoint objectInMotion) { this.mOpenstreetmapUtil = openstreetmapUtil; this.mCallback = callback; + this.objectInMotion = objectInMotion; } @Override - protected Node doInBackground(Node... params) { - Node node = params[0]; + protected Node doInBackground(Void... params) { + Node node = objectInMotion.getEntity(); return mOpenstreetmapUtil.commitNodeImpl(OsmPoint.Action.MODIFY, node, mOpenstreetmapUtil.getEntityInfo(node.getId()), "", false); } @@ -239,7 +241,7 @@ public class OsmEditsLayer extends OsmandMapLayer implements ContextMenuLayer.IC @Override protected void onPostExecute(Node newNode) { if (mCallback != null) { - mCallback.onApplyMovedObject(true, newNode); + mCallback.onApplyMovedObject(newNode != null, objectInMotion); } } }