use of net.osmand.plus.plugins.osmedit.helpers.OsmEditsUploadListenerHelper in project Osmand by osmandapp.
the class SimpleProgressDialogPoiUploader method showProgressDialog.
@Override
public void showProgressDialog(OsmPoint[] points, boolean closeChangeSet, boolean anonymously) {
ProgressDialogFragment dialog = ProgressDialogFragment.createInstance(R.string.uploading, R.string.local_openstreetmap_uploading, ProgressDialog.STYLE_HORIZONTAL);
OsmEditingPlugin plugin = OsmandPlugin.getPlugin(OsmEditingPlugin.class);
OsmEditsUploadListener listener = new OsmEditsUploadListenerHelper(mapActivity, mapActivity.getString(R.string.local_openstreetmap_were_uploaded)) {
@Override
public void uploadEnded(Map<OsmPoint, String> loadErrorsMap) {
super.uploadEnded(loadErrorsMap);
mapActivity.getContextMenu().close();
OsmBugsLayer l = mapActivity.getMapView().getLayerByClass(OsmBugsLayer.class);
if (l != null) {
l.clearCache();
mapActivity.refreshMap();
}
}
};
dialog.show(mapActivity.getSupportFragmentManager(), ProgressDialogFragment.TAG);
UploadOpenstreetmapPointAsyncTask uploadTask = new UploadOpenstreetmapPointAsyncTask(dialog, listener, plugin, points.length, closeChangeSet, anonymously);
uploadTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, points);
}
use of net.osmand.plus.plugins.osmedit.helpers.OsmEditsUploadListenerHelper in project Osmand by osmandapp.
the class DashOsmEditsFragment method showProgressDialog.
@Override
public void showProgressDialog(OsmPoint[] points, boolean closeChangeSet, boolean anonymously) {
OsmPoint[] toUpload = points;
ProgressDialogFragment dialog = ProgressDialogFragment.createInstance(R.string.uploading, R.string.local_openstreetmap_uploading, ProgressDialog.STYLE_HORIZONTAL);
OsmEditsUploadListener listener = new OsmEditsUploadListenerHelper(getActivity(), getString(R.string.local_openstreetmap_were_uploaded)) {
@Override
public void uploadUpdated(OsmPoint point) {
super.uploadUpdated(point);
if (DashOsmEditsFragment.this.isAdded()) {
onOpenDash();
}
}
@Override
public void uploadEnded(Map<OsmPoint, String> loadErrorsMap) {
super.uploadEnded(loadErrorsMap);
if (DashOsmEditsFragment.this.isAdded()) {
onOpenDash();
}
}
};
dialog.show(getChildFragmentManager(), ProgressDialogFragment.TAG);
UploadOpenstreetmapPointAsyncTask uploadTask = new UploadOpenstreetmapPointAsyncTask(dialog, listener, plugin, toUpload.length, closeChangeSet, anonymously);
uploadTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, toUpload);
}
use of net.osmand.plus.plugins.osmedit.helpers.OsmEditsUploadListenerHelper in project Osmand by osmandapp.
the class OsmEditsFragment method showProgressDialog.
public void showProgressDialog(OsmPoint[] points, boolean closeChangeSet, boolean anonymously) {
ProgressDialogFragment dialog = ProgressDialogFragment.createInstance(R.string.uploading, R.string.local_openstreetmap_uploading, ProgressDialog.STYLE_HORIZONTAL);
OsmEditsUploadListener listener = new OsmEditsUploadListenerHelper(getActivity(), getString(R.string.local_openstreetmap_were_uploaded)) {
@Override
public void uploadEnded(Map<OsmPoint, String> loadErrorsMap) {
super.uploadEnded(loadErrorsMap);
for (Map.Entry<OsmPoint, String> entry : loadErrorsMap.entrySet()) {
if (entry.getValue() == null) {
osmEdits.remove(entry.getKey());
}
}
recreateAdapterData();
}
};
dialog.show(getActivity().getSupportFragmentManager(), ProgressDialogFragment.TAG);
UploadOpenstreetmapPointAsyncTask uploadTask = new UploadOpenstreetmapPointAsyncTask(dialog, listener, plugin, points.length, closeChangeSet, anonymously);
uploadTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, points);
}
Aggregations