Merge branch 'r2.2' of github.com:osmandapp/Osmand into r2.2

This commit is contained in:
Victor Shcherb 2015-11-25 12:11:45 +01:00
commit 3ac7bac83b
3 changed files with 30 additions and 16 deletions

View file

@ -229,13 +229,17 @@ public class MapContextMenu extends MenuTitleController {
public void show() { public void show() {
if (!isVisible()) { if (!isVisible()) {
MapContextMenuFragment.showInstance(mapActivity); if (!MapContextMenuFragment.showInstance(this, mapActivity)) {
active = false;
}
} }
} }
public void show(LatLon latLon, PointDescription pointDescription, Object object) { public void show(LatLon latLon, PointDescription pointDescription, Object object) {
if (init(latLon, pointDescription, object)) { if (init(latLon, pointDescription, object)) {
MapContextMenuFragment.showInstance(mapActivity); if (!MapContextMenuFragment.showInstance(this, mapActivity)) {
active = false;
}
} }
} }

View file

@ -943,12 +943,16 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
return (OsmandApplication) getActivity().getApplication(); return (OsmandApplication) getActivity().getApplication();
} }
public static void showInstance(final MapActivity mapActivity) { public static boolean showInstance(final MapContextMenu menu, final MapActivity mapActivity) {
try {
if (menu.getLatLon() == null) {
return false;
}
int slideInAnim = R.anim.slide_in_bottom; int slideInAnim = R.anim.slide_in_bottom;
int slideOutAnim = R.anim.slide_out_bottom; int slideOutAnim = R.anim.slide_out_bottom;
MapContextMenu menu = mapActivity.getContextMenu();
if (menu.isExtended()) { if (menu.isExtended()) {
slideInAnim = menu.getSlideInAnimation(); slideInAnim = menu.getSlideInAnimation();
slideOutAnim = menu.getSlideOutAnimation(); slideOutAnim = menu.getSlideOutAnimation();
@ -959,6 +963,12 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
.setCustomAnimations(slideInAnim, slideOutAnim, slideInAnim, slideOutAnim) .setCustomAnimations(slideInAnim, slideOutAnim, slideInAnim, slideOutAnim)
.add(R.id.fragmentContainer, fragment, TAG) .add(R.id.fragmentContainer, fragment, TAG)
.addToBackStack(TAG).commitAllowingStateLoss(); .addToBackStack(TAG).commitAllowingStateLoss();
return true;
} catch (RuntimeException e) {
return false;
}
} }
//DownloadEvents //DownloadEvents

View file

@ -213,7 +213,7 @@ public class OsmEditingPlugin extends OsmandPlugin {
if (selectedObj instanceof Amenity) { if (selectedObj instanceof Amenity) {
Amenity amenity = (Amenity) selectedObj; Amenity amenity = (Amenity) selectedObj;
final PoiType poiType = amenity.getType().getPoiTypeByKeyName(amenity.getSubType()); final PoiType poiType = amenity.getType().getPoiTypeByKeyName(amenity.getSubType());
isEditable = !amenity.getType().isWiki() && !poiType.isNotEditableOsm(); isEditable = poiType != null && !amenity.getType().isWiki() && !poiType.isNotEditableOsm();
} }
if (isEditable) { if (isEditable) {
adapter.item(R.string.poi_context_menu_modify).iconColor(R.drawable.ic_action_edit_dark).listen(listener).position(1).reg(); adapter.item(R.string.poi_context_menu_modify).iconColor(R.drawable.ic_action_edit_dark).listen(listener).position(1).reg();