Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
3fc0ffee93
4 changed files with 28 additions and 36 deletions
|
@ -358,6 +358,12 @@ public class GeoPointParserUtil {
|
|||
System.out.println("url: " + url);
|
||||
actual = GeoPointParserUtil.parse(url);
|
||||
assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon, z));
|
||||
|
||||
// http://www.google.com/maps/?q=loc:34.99393,-106.61568&z=11
|
||||
url = "http://www.google.com/maps/?q=loc:" + dlat + "," + dlon + " (" + name +") ";
|
||||
System.out.println("url: " + url);
|
||||
actual = GeoPointParserUtil.parse(url);
|
||||
assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon, name));
|
||||
|
||||
// https://www.google.com/maps/preview#!q=paris&data=!4m15!2m14!1m13!1s0x47e66e1f06e2b70f%3A0x40b82c3688c9460!3m8!1m3!1d24383582!2d-95.677068!3d37.0625!3m2!1i1222!2i718!4f13.1!4m2!3d48.856614!4d2.3522219
|
||||
url = "https://www.google.com/maps/preview#!q=paris&data=!4m15!2m14!1m13!1s0x47e66e1f06e2b70f%3A0x40b82c3688c9460!3m8!1m3!1d24383582!2d-95.677068!3d37.0625!3m2!1i1222!2i718!4f13.1!4m2!3d48.856614!4d2.3522219";
|
||||
|
|
|
@ -402,7 +402,7 @@ public class EditPoiDialogFragment extends DialogFragment {
|
|||
final Runnable successAction,
|
||||
final Activity activity,
|
||||
final OpenstreetmapUtil openstreetmapUtil) {
|
||||
if (info == null && OsmPoint.Action.CREATE != action) {
|
||||
if (info == null && OsmPoint.Action.CREATE != action && openstreetmapUtil instanceof OpenstreetmapRemoteUtil) {
|
||||
AccessibleToast.makeText(activity, activity.getResources().getString(R.string.poi_error_info_not_loaded), Toast.LENGTH_LONG).show();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -69,6 +69,8 @@ public class OpenstreetmapsDbHelper extends SQLiteOpenHelper {
|
|||
tags.append("$$$");
|
||||
}
|
||||
}
|
||||
db.execSQL("DELETE FROM " + OPENSTREETMAP_TABLE_NAME +
|
||||
" WHERE " + OPENSTREETMAP_COL_ID + " = ?", new Object[] { p.getId() }); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
db.execSQL("INSERT INTO " + OPENSTREETMAP_TABLE_NAME +
|
||||
" (" + OPENSTREETMAP_COL_ID + ", " + OPENSTREETMAP_COL_LAT + ", " + OPENSTREETMAP_COL_LON + ", " + OPENSTREETMAP_COL_TAGS + ", " + OPENSTREETMAP_COL_ACTION + "," + OPENSTREETMAP_COL_COMMENT + ")" +
|
||||
" VALUES (?, ?, ?, ?, ?, ?)",
|
||||
|
|
|
@ -68,7 +68,7 @@ public class OsmEditsFragment extends OsmAndListFragment
|
|||
private final static int MODE_UPLOAD = 101;
|
||||
|
||||
private ActionMode actionMode;
|
||||
|
||||
private long refreshId;
|
||||
private ArrayList<OsmPoint> osmEditsSelected = new ArrayList<>();
|
||||
|
||||
|
||||
|
@ -466,9 +466,13 @@ public class OsmEditsFragment extends OsmAndListFragment
|
|||
item = optionsMenu.getMenu().add(R.string.poi_context_menu_modify_osm_change)
|
||||
.setIcon(app.getIconsCache().getContentIcon(R.drawable.ic_action_edit_dark));
|
||||
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
final Node entity = ((OpenstreetmapPoint) info).getEntity();
|
||||
OpenstreetmapPoint i = (OpenstreetmapPoint) getPointAfterModify(info);
|
||||
final Node entity = i.getEntity();
|
||||
refreshId = entity.getId();
|
||||
EditPoiDialogFragment.createInstance(entity, false)
|
||||
.show(getActivity().getSupportFragmentManager(), "edit_poi");
|
||||
return true;
|
||||
|
@ -492,13 +496,25 @@ public class OsmEditsFragment extends OsmAndListFragment
|
|||
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
uploadItems(new OsmPoint[]{info});
|
||||
uploadItems(new OsmPoint[]{getPointAfterModify(info)});
|
||||
return true;
|
||||
}
|
||||
});
|
||||
optionsMenu.show();
|
||||
}
|
||||
|
||||
protected OsmPoint getPointAfterModify(OsmPoint info) {
|
||||
if(info instanceof OpenstreetmapPoint && info.getId() == refreshId) {
|
||||
for(OpenstreetmapPoint p : plugin.getDBPOI().getOpenstreetmapPoints()) {
|
||||
if(p.getId() == info.getId()) {
|
||||
return p;
|
||||
}
|
||||
}
|
||||
}
|
||||
return info;
|
||||
}
|
||||
|
||||
|
||||
public OsmandApplication getMyApplication() {
|
||||
return (OsmandApplication) getActivity().getApplication();
|
||||
}
|
||||
|
@ -710,36 +726,4 @@ public class OsmEditsFragment extends OsmAndListFragment
|
|||
}
|
||||
}
|
||||
|
||||
// public static class UploadOsmEditsConfirmDialogFragment extends DialogFragment {
|
||||
// public static final String TAG = "UploadOsmEditsConfirmDialogFragment";
|
||||
// private static final String POINTS_ARRAY = "points_list";
|
||||
//
|
||||
// @NonNull
|
||||
// @Override
|
||||
// public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
// final OsmPoint[] points = (OsmPoint[]) getArguments().getSerializable(POINTS_ARRAY);
|
||||
// AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||
// builder.setMessage(
|
||||
// getString(R.string.local_osm_changes_upload_all_confirm, points.length));
|
||||
// builder.setPositiveButton(R.string.shared_string_yes,
|
||||
// new DialogInterface.OnClickListener() {
|
||||
// @Override
|
||||
// public void onClick(DialogInterface dialog, int which) {
|
||||
// ((OsmEditsFragment) getParentFragment())
|
||||
// .showUploadItemsProgressDialog(points);
|
||||
// }
|
||||
// });
|
||||
// builder.setNegativeButton(R.string.shared_string_cancel, null);
|
||||
// return builder.create();
|
||||
// }
|
||||
//
|
||||
// public static UploadOsmEditsConfirmDialogFragment createInstance(OsmPoint[] points) {
|
||||
// UploadOsmEditsConfirmDialogFragment fragment =
|
||||
// new UploadOsmEditsConfirmDialogFragment();
|
||||
// Bundle args = new Bundle();
|
||||
// args.putSerializable(POINTS_ARRAY, points);
|
||||
// fragment.setArguments(args);
|
||||
// return fragment;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue