diff --git a/OsmAnd/src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java b/OsmAnd/src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java index 696171f80c..5b4b46af54 100644 --- a/OsmAnd/src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java +++ b/OsmAnd/src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java @@ -4,6 +4,7 @@ import android.app.Activity; import android.content.Context; import android.content.DialogInterface; import android.content.DialogInterface.OnClickListener; +import android.support.annotation.Nullable; import android.support.v7.app.AlertDialog; import android.util.DisplayMetrics; import android.view.View; @@ -329,6 +330,10 @@ public class OsmandMonitoringPlugin extends OsmandPlugin { } public void saveCurrentTrack() { + saveCurrentTrack(null); + } + + public void saveCurrentTrack(@Nullable final Runnable onComplete) { app.getTaskManager().runInBackground(new OsmAndTaskRunnable() { @Override @@ -354,6 +359,9 @@ public class OsmandMonitoringPlugin extends OsmandPlugin { isSaving = false; app.getNotificationHelper().refreshNotifications(); updateControl(); + if (onComplete != null) { + onComplete.run(); + } } }, (Void) null); } diff --git a/OsmAnd/src/net/osmand/plus/myplaces/AvailableGPXFragment.java b/OsmAnd/src/net/osmand/plus/myplaces/AvailableGPXFragment.java index e14a42b2c5..8c3af3bbbf 100644 --- a/OsmAnd/src/net/osmand/plus/myplaces/AvailableGPXFragment.java +++ b/OsmAnd/src/net/osmand/plus/myplaces/AvailableGPXFragment.java @@ -265,7 +265,14 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment { save.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - plugin.saveCurrentTrack(); + plugin.saveCurrentTrack(new Runnable() { + @Override + public void run() { + if (isResumed()) { + reloadTracks(); + } + } + }); updateCurrentTrack(); } });