Search in sources :

Example 1 with OsmEditsUploadListenerHelper

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);
}
Also used : OsmEditsUploadListenerHelper(net.osmand.plus.plugins.osmedit.helpers.OsmEditsUploadListenerHelper) OsmBugsLayer(net.osmand.plus.plugins.osmedit.OsmBugsLayer) ProgressDialogFragment(net.osmand.plus.dialogs.ProgressDialogFragment) OsmEditsUploadListener(net.osmand.plus.plugins.osmedit.OsmEditsUploadListener) Map(java.util.Map) UploadOpenstreetmapPointAsyncTask(net.osmand.plus.plugins.osmedit.asynctasks.UploadOpenstreetmapPointAsyncTask) OsmEditingPlugin(net.osmand.plus.plugins.osmedit.OsmEditingPlugin)

Example 2 with OsmEditsUploadListenerHelper

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);
}
Also used : OsmPoint(net.osmand.plus.plugins.osmedit.data.OsmPoint) OsmEditsUploadListenerHelper(net.osmand.plus.plugins.osmedit.helpers.OsmEditsUploadListenerHelper) ProgressDialogFragment(net.osmand.plus.dialogs.ProgressDialogFragment) OsmEditsUploadListener(net.osmand.plus.plugins.osmedit.OsmEditsUploadListener) Map(java.util.Map) DashboardOnMap(net.osmand.plus.dashboard.DashboardOnMap) UploadOpenstreetmapPointAsyncTask(net.osmand.plus.plugins.osmedit.asynctasks.UploadOpenstreetmapPointAsyncTask)

Example 3 with OsmEditsUploadListenerHelper

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);
}
Also used : OsmPoint(net.osmand.plus.plugins.osmedit.data.OsmPoint) OsmEditsUploadListenerHelper(net.osmand.plus.plugins.osmedit.helpers.OsmEditsUploadListenerHelper) ProgressDialogFragment(net.osmand.plus.dialogs.ProgressDialogFragment) OsmEditsUploadListener(net.osmand.plus.plugins.osmedit.OsmEditsUploadListener) Map(java.util.Map) UploadOpenstreetmapPointAsyncTask(net.osmand.plus.plugins.osmedit.asynctasks.UploadOpenstreetmapPointAsyncTask)

Aggregations

Map (java.util.Map)3 ProgressDialogFragment (net.osmand.plus.dialogs.ProgressDialogFragment)3 OsmEditsUploadListener (net.osmand.plus.plugins.osmedit.OsmEditsUploadListener)3 UploadOpenstreetmapPointAsyncTask (net.osmand.plus.plugins.osmedit.asynctasks.UploadOpenstreetmapPointAsyncTask)3 OsmEditsUploadListenerHelper (net.osmand.plus.plugins.osmedit.helpers.OsmEditsUploadListenerHelper)3 OsmPoint (net.osmand.plus.plugins.osmedit.data.OsmPoint)2 DashboardOnMap (net.osmand.plus.dashboard.DashboardOnMap)1 OsmBugsLayer (net.osmand.plus.plugins.osmedit.OsmBugsLayer)1 OsmEditingPlugin (net.osmand.plus.plugins.osmedit.OsmEditingPlugin)1