Search in sources :

Example 6 with ProgressDialogFragment

use of net.osmand.plus.dialogs.ProgressDialogFragment 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 (OsmPoint osmPoint : loadErrorsMap.keySet()) {
                if (loadErrorsMap.get(osmPoint) == null) {
                    osmEdits.remove(osmPoint);
                }
            }
            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 : ProgressDialogFragment(net.osmand.plus.dialogs.ProgressDialogFragment) Map(java.util.Map)

Example 7 with ProgressDialogFragment

use of net.osmand.plus.dialogs.ProgressDialogFragment 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

ProgressDialogFragment (net.osmand.plus.dialogs.ProgressDialogFragment)7 Map (java.util.Map)5 UploadOpenstreetmapPointAsyncTask (net.osmand.plus.plugins.osmedit.asynctasks.UploadOpenstreetmapPointAsyncTask)4 OsmEditsUploadListener (net.osmand.plus.plugins.osmedit.OsmEditsUploadListener)3 OsmEditsUploadListenerHelper (net.osmand.plus.plugins.osmedit.helpers.OsmEditsUploadListenerHelper)3 DashboardOnMap (net.osmand.plus.dashboard.DashboardOnMap)2 OsmEditingPlugin (net.osmand.plus.plugins.osmedit.OsmEditingPlugin)2 OsmPoint (net.osmand.plus.plugins.osmedit.data.OsmPoint)2 FragmentActivity (android.support.v4.app.FragmentActivity)1 FragmentActivity (androidx.fragment.app.FragmentActivity)1 OsmBugsLayer (net.osmand.plus.plugins.osmedit.OsmBugsLayer)1