This commit is contained in:
Alex Sytnyk 2018-07-16 13:35:25 +03:00
parent aa0e4ed073
commit 10ecdb3bde
2 changed files with 16 additions and 1 deletions

View file

@ -4,6 +4,7 @@ import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener; import android.content.DialogInterface.OnClickListener;
import android.support.annotation.Nullable;
import android.support.v7.app.AlertDialog; import android.support.v7.app.AlertDialog;
import android.util.DisplayMetrics; import android.util.DisplayMetrics;
import android.view.View; import android.view.View;
@ -329,6 +330,10 @@ public class OsmandMonitoringPlugin extends OsmandPlugin {
} }
public void saveCurrentTrack() { public void saveCurrentTrack() {
saveCurrentTrack(null);
}
public void saveCurrentTrack(@Nullable final Runnable onComplete) {
app.getTaskManager().runInBackground(new OsmAndTaskRunnable<Void, Void, Void>() { app.getTaskManager().runInBackground(new OsmAndTaskRunnable<Void, Void, Void>() {
@Override @Override
@ -354,6 +359,9 @@ public class OsmandMonitoringPlugin extends OsmandPlugin {
isSaving = false; isSaving = false;
app.getNotificationHelper().refreshNotifications(); app.getNotificationHelper().refreshNotifications();
updateControl(); updateControl();
if (onComplete != null) {
onComplete.run();
}
} }
}, (Void) null); }, (Void) null);
} }

View file

@ -265,7 +265,14 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
save.setOnClickListener(new View.OnClickListener() { save.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
plugin.saveCurrentTrack(); plugin.saveCurrentTrack(new Runnable() {
@Override
public void run() {
if (isResumed()) {
reloadTracks();
}
}
});
updateCurrentTrack(); updateCurrentTrack();
} }
}); });