Merge branch 'master' of https://github.com/osmandapp/Osmand
This commit is contained in:
commit
aad04aa940
2 changed files with 11 additions and 7 deletions
|
@ -92,8 +92,6 @@ public class EditPoiDialogFragment extends DialogFragment {
|
|||
OsmEditingPlugin plugin = OsmandPlugin.getPlugin(OsmEditingPlugin.class);
|
||||
if (settings.OFFLINE_EDITION.get() || !settings.isInternetConnectionAvailable(true)) {
|
||||
mOpenstreetmapUtil = new OpenstreetmapLocalUtil(plugin, activity);
|
||||
} else if (!settings.isInternetConnectionAvailable(true)) {
|
||||
mOpenstreetmapUtil = new OpenstreetmapLocalUtil(plugin, activity);
|
||||
} else {
|
||||
mOpenstreetmapUtil = new OpenstreetmapRemoteUtil(activity);
|
||||
}
|
||||
|
@ -249,7 +247,8 @@ public class EditPoiDialogFragment extends DialogFragment {
|
|||
poiTypeEditText.setText(editPoiData.amenity.getSubType());
|
||||
|
||||
Button saveButton = (Button) view.findViewById(R.id.saveButton);
|
||||
saveButton.setText(R.string.shared_string_save);
|
||||
saveButton.setText(mOpenstreetmapUtil instanceof OpenstreetmapRemoteUtil? R.string.shared_string_upload :
|
||||
R.string.shared_string_save);
|
||||
saveButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
@ -515,11 +514,10 @@ public class EditPoiDialogFragment extends DialogFragment {
|
|||
final OsmandSettings settings = ((OsmandApplication) activity.getApplication())
|
||||
.getSettings();
|
||||
final OpenstreetmapUtil openstreetmapUtilToLoad;
|
||||
if (settings.OFFLINE_EDITION.get() || !settings.isInternetConnectionAvailable(true)) {
|
||||
if (//settings.OFFLINE_EDITION.get() ||
|
||||
!settings.isInternetConnectionAvailable(true)) {
|
||||
OsmEditingPlugin plugin = OsmandPlugin.getPlugin(OsmEditingPlugin.class);
|
||||
openstreetmapUtilToLoad = new OpenstreetmapLocalUtil(plugin, activity);
|
||||
} else if (!settings.isInternetConnectionAvailable(true)) {
|
||||
openstreetmapUtilToLoad = new OpenstreetmapRemoteUtil(activity);
|
||||
} else {
|
||||
openstreetmapUtilToLoad = new OpenstreetmapRemoteUtil(activity);
|
||||
}
|
||||
|
@ -595,6 +593,7 @@ public class EditPoiDialogFragment extends DialogFragment {
|
|||
AccessibleToast.makeText(activity, activity.getResources().getString(R.string.poi_error_poi_not_found), Toast.LENGTH_LONG).show();
|
||||
return;
|
||||
}
|
||||
// FIXME give back alert dialog and use openstreetmapUtil field!
|
||||
DeletePoiDialogFragment.createInstance(n).show(activity.getSupportFragmentManager(),
|
||||
"DeletePoiDialogFragment");
|
||||
}
|
||||
|
|
|
@ -45,6 +45,7 @@ public class UploadOpenstreetmapPointAsyncTask
|
|||
protected Map<OsmPoint, String> doInBackground(OsmPoint... points) {
|
||||
Map<OsmPoint, String> loadErrorsMap = new HashMap<>();
|
||||
|
||||
boolean uploaded = false;
|
||||
for (OsmPoint point : points) {
|
||||
if (interruptUploading)
|
||||
break;
|
||||
|
@ -56,8 +57,9 @@ public class UploadOpenstreetmapPointAsyncTask
|
|||
entityInfo = remotepoi.loadNode(p.getEntity());
|
||||
}
|
||||
Node n = remotepoi.commitNodeImpl(p.getAction(), p.getEntity(), entityInfo,
|
||||
p.getComment(), closeChangeSet);
|
||||
p.getComment(), false);
|
||||
if (n != null) {
|
||||
uploaded = true;
|
||||
plugin.getDBPOI().deletePOI(p);
|
||||
publishProgress(p);
|
||||
}
|
||||
|
@ -79,6 +81,9 @@ public class UploadOpenstreetmapPointAsyncTask
|
|||
loadErrorsMap.put(point, errorMessage);
|
||||
}
|
||||
}
|
||||
if(uploaded) {
|
||||
remotepoi.closeChangeSet();
|
||||
}
|
||||
|
||||
return loadErrorsMap;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue