Fix context menu

This commit is contained in:
Victor Shcherb 2015-08-30 20:13:33 +02:00
parent f3f84da3b8
commit 52e3d93d99
3 changed files with 19 additions and 17 deletions

View file

@ -11,6 +11,10 @@
-->
<!-- Not translatable -->
<string name="last_release">
- New road indexes (including)
-
</string>
<string name="ga_api_key">UA-28342846-2</string>
<string name="ga_dispatchPeriod">10</string>
<string name="ga_debug">true</string>

View file

@ -171,10 +171,10 @@ public class OsmEditingPlugin extends OsmandPlugin {
.execute((Amenity) selectedObj);
// TODO implement delete
// getPoiActions(mapActivity).showDeleteDialog((Amenity) selectedObj);
}//} else if (resId == R.string.poi_context_menu_modify) {
} else if (resId == R.string.poi_context_menu_modify) {
// TODO implement edit
// getPoiActions(mapActivity).showEditDialog((Amenity) selectedObj);
// }
}
return true;
}
};

View file

@ -43,6 +43,7 @@ public class ContextMenuLayer extends OsmandMapLayer {
public PointDescription getObjectName(Object o);
public boolean disableSingleTap();
public boolean disableLongPressOnMap();
}
@ -229,20 +230,17 @@ public class ContextMenuLayer extends OsmandMapLayer {
}
if (disableLongPressOnMap()) {
LatLon latLon = selectObjectsForContextMenu(tileBox, point);
if (latLon != null) {
String description = getSelectedObjectDescription();
setLocation(latLon, description);
view.refreshMap();
return true;
} else {
return false;
}
return false;
}
LatLon latLon = selectObjectsForContextMenu(tileBox, point);
if (latLon != null) {
String description = getSelectedObjectDescription();
setLocation(latLon, description);
} else {
final double lat = tileBox.getLatFromPixel((int) point.x, (int) point.y);
final double lon = tileBox.getLonFromPixel((int) point.x, (int) point.y);
setLocation(new LatLon(lat, lon), null);
}
final double lat = tileBox.getLatFromPixel((int) point.x, (int) point.y);
final double lon = tileBox.getLonFromPixel((int) point.x, (int) point.y);
setLocation(new LatLon(lat, lon), null);
view.refreshMap();
return true;
}
@ -262,8 +260,8 @@ public class ContextMenuLayer extends OsmandMapLayer {
public boolean disableLongPressOnMap() {
boolean res = false;
for(OsmandMapLayer lt : view.getLayers()){
if(lt instanceof ContextMenuLayer.IContextMenuProvider) {
for (OsmandMapLayer lt : view.getLayers()) {
if (lt instanceof ContextMenuLayer.IContextMenuProvider) {
if (((IContextMenuProvider) lt).disableLongPressOnMap()) {
res = true;
break;