Search in sources :

Example 6 with OsmEditingPlugin

use of net.osmand.plus.plugins.osmedit.OsmEditingPlugin in project Osmand by osmandapp.

the class ValidateOsmLoginDetailsTask method doInBackground.

@Override
protected OsmBugResult doInBackground(Void... params) {
    OsmEditingPlugin plugin = OsmandPlugin.getPlugin(OsmEditingPlugin.class);
    assert plugin != null;
    OsmBugsRemoteUtil remoteUtil = plugin.getOsmNotesRemoteUtil();
    return remoteUtil.validateLoginDetails();
}
Also used : OsmBugsRemoteUtil(net.osmand.plus.plugins.osmedit.helpers.OsmBugsRemoteUtil) OsmEditingPlugin(net.osmand.plus.plugins.osmedit.OsmEditingPlugin)

Example 7 with OsmEditingPlugin

use of net.osmand.plus.plugins.osmedit.OsmEditingPlugin 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 8 with OsmEditingPlugin

use of net.osmand.plus.plugins.osmedit.OsmEditingPlugin in project Osmand by osmandapp.

the class OsmandDevelopmentPlugin method disable.

@Override
public void disable(OsmandApplication app) {
    OsmEditingPlugin osmPlugin = OsmandPlugin.getPlugin(OsmEditingPlugin.class);
    if (osmPlugin != null && osmPlugin.OSM_USE_DEV_URL.get()) {
        osmPlugin.OSM_USE_DEV_URL.set(false);
        app.getOsmOAuthHelper().resetAuthorization();
    }
    OpenPlaceReviewsPlugin oprPlugin = OsmandPlugin.getPlugin(OpenPlaceReviewsPlugin.class);
    if (oprPlugin != null && oprPlugin.OPR_USE_DEV_URL.get()) {
        oprPlugin.OPR_USE_DEV_URL.set(false);
        app.getOprAuthHelper().resetAuthorization();
    }
    super.disable(app);
}
Also used : OpenPlaceReviewsPlugin(net.osmand.plus.plugins.openplacereviews.OpenPlaceReviewsPlugin) OsmEditingPlugin(net.osmand.plus.plugins.osmedit.OsmEditingPlugin)

Example 9 with OsmEditingPlugin

use of net.osmand.plus.plugins.osmedit.OsmEditingPlugin in project Osmand by osmandapp.

the class ShowHideOSMBugAction method execute.

@Override
public void execute(@NonNull MapActivity mapActivity) {
    OsmEditingPlugin plugin = OsmandPlugin.getActivePlugin(OsmEditingPlugin.class);
    if (plugin != null) {
        plugin.SHOW_OSM_BUGS.set(!plugin.SHOW_OSM_BUGS.get());
        plugin.updateLayers(mapActivity, mapActivity);
        mapActivity.getMapView().refreshMap(true);
    }
}
Also used : OsmEditingPlugin(net.osmand.plus.plugins.osmedit.OsmEditingPlugin)

Example 10 with OsmEditingPlugin

use of net.osmand.plus.plugins.osmedit.OsmEditingPlugin in project Osmand by osmandapp.

the class OsmEditsUploadListenerHelper method showUploadItemsProgressDialog.

private static void showUploadItemsProgressDialog(Fragment fragment, OsmPoint[] toUpload) {
    FragmentActivity activity = fragment.getActivity();
    OsmEditingPlugin plugin = OsmandPlugin.getActivePlugin(OsmEditingPlugin.class);
    OsmEditsUploadListenerHelper helper = new OsmEditsUploadListenerHelper(activity, activity.getResources().getString(R.string.local_openstreetmap_were_uploaded));
    ProgressDialogFragment dialog = ProgressDialogFragment.createInstance(R.string.uploading, R.string.local_openstreetmap_uploading, ProgressDialog.STYLE_HORIZONTAL);
    dialog.show(activity.getSupportFragmentManager(), ProgressDialogFragment.TAG);
    UploadOpenstreetmapPointAsyncTask uploadTask = new UploadOpenstreetmapPointAsyncTask(dialog, helper, plugin, toUpload.length, false, false);
    uploadTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, toUpload);
}
Also used : FragmentActivity(androidx.fragment.app.FragmentActivity) ProgressDialogFragment(net.osmand.plus.dialogs.ProgressDialogFragment) UploadOpenstreetmapPointAsyncTask(net.osmand.plus.plugins.osmedit.asynctasks.UploadOpenstreetmapPointAsyncTask) OsmEditingPlugin(net.osmand.plus.plugins.osmedit.OsmEditingPlugin)

Aggregations

OsmEditingPlugin (net.osmand.plus.plugins.osmedit.OsmEditingPlugin)20 OpenstreetmapPoint (net.osmand.plus.plugins.osmedit.data.OpenstreetmapPoint)5 Entity (net.osmand.osm.edit.Entity)4 OsmandApplication (net.osmand.plus.OsmandApplication)4 MapActivity (net.osmand.plus.activities.MapActivity)4 AlertDialog (androidx.appcompat.app.AlertDialog)3 LinkedHashMap (java.util.LinkedHashMap)3 Map (java.util.Map)3 OsmPoint (net.osmand.plus.plugins.osmedit.data.OsmPoint)3 DialogInterface (android.content.DialogInterface)2 FragmentActivity (androidx.fragment.app.FragmentActivity)2 File (java.io.File)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 LatLon (net.osmand.data.LatLon)2 PoiCategory (net.osmand.osm.PoiCategory)2 PoiType (net.osmand.osm.PoiType)2 Node (net.osmand.osm.edit.Node)2 ProgressDialogFragment (net.osmand.plus.dialogs.ProgressDialogFragment)2 UploadOpenstreetmapPointAsyncTask (net.osmand.plus.plugins.osmedit.asynctasks.UploadOpenstreetmapPointAsyncTask)2