Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2015-11-13 09:07:15 +01:00
commit 0804cff706
2 changed files with 23 additions and 6 deletions

View file

@ -397,7 +397,6 @@ public class GeoPointParserUtil {
actual = GeoPointParserUtil.parse(url);
assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon, z));
// TODO this URL does not work, where is it used?
// whatsapp
// https://maps.google.com/maps?q=loc:34.99393,-106.61568 (You)
z = GeoParsedPoint.NO_ZOOM;
@ -406,6 +405,14 @@ public class GeoPointParserUtil {
actual = GeoPointParserUtil.parse(url);
assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon, z));
// whatsapp
// https://maps.google.com/maps?q=loc:34.99393,-106.61568 (USERNAME)
z = GeoParsedPoint.NO_ZOOM;
url = "https://maps.google.com/maps?q=loc:" + dlat + "," + dlon + " (USER NAME)";
System.out.println("url: " + url);
actual = GeoPointParserUtil.parse(url);
assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon, z));
// http://www.google.com/maps/search/food/34,-106,14z
url = "http://www.google.com/maps/search/food/" + ilat + "," + ilon + "," + z + "z";
System.out.println("url: " + url);
@ -947,10 +954,9 @@ public class GeoPointParserUtil {
if(opath.contains(pref)) {
opath = opath.substring(opath.lastIndexOf(pref) + pref.length());
}
final String postf = " (You)";
if (opath.contains(postf)) {
opath = opath.substring(0, opath.indexOf(postf));
}
final String postf = "\\s\\((\\p{IsAlphabetic}|\\s)*\\)$";
opath = opath.replaceAll(postf, "");
System.out.println("opath=" + opath);
return parseGoogleMapsPath(opath, params);
}
if (fragment != null) {

View file

@ -18,6 +18,7 @@ import net.osmand.PlatformUtil;
import net.osmand.access.AccessibleToast;
import net.osmand.data.Amenity;
import net.osmand.osm.PoiType;
import net.osmand.osm.edit.Node;
import net.osmand.plus.ContextMenuAdapter;
import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick;
import net.osmand.plus.OsmandApplication;
@ -161,7 +162,15 @@ public class OsmEditingPlugin extends OsmandPlugin {
new EditPoiDialogFragment.ShowDeleteDialogAsyncTask(mapActivity)
.execute((Amenity) selectedObj);
} else if (resId == R.string.poi_context_menu_modify) {
if (selectedObj instanceof Amenity) {
EditPoiDialogFragment.showEditInstance((Amenity) selectedObj, mapActivity);
} else if (selectedObj instanceof OpenstreetmapPoint) {
final Node entity = ((OpenstreetmapPoint) selectedObj).getEntity();
EditPoiDialogFragment.createInstance(entity, false)
.show(mapActivity.getSupportFragmentManager(), "edit_poi");
} else {
throw new IllegalArgumentException("Selected object is not editable");
}
}
return true;
}
@ -171,6 +180,8 @@ public class OsmEditingPlugin extends OsmandPlugin {
Amenity amenity = (Amenity) selectedObj;
final PoiType poiType = amenity.getType().getPoiTypeByKeyName(amenity.getSubType());
isEditable = !amenity.getType().isWiki() && !poiType.isNotEditableOsm();
} else if (selectedObj instanceof OpenstreetmapPoint) {
isEditable = true;
}
if (isEditable) {
adapter.item(R.string.poi_context_menu_modify).iconColor(R.drawable.ic_action_edit_dark).listen(listener).position(1).reg();