Fixes (poi type and favorites show on map crash)
This commit is contained in:
parent
f464673fad
commit
c635b8869d
6 changed files with 39 additions and 19 deletions
|
@ -545,13 +545,13 @@ public class MapActivity extends AccessibleActivity {
|
||||||
dashboardOnMap.hideDashboard();
|
dashboardOnMap.hideDashboard();
|
||||||
}
|
}
|
||||||
if (mapLabelToShow != null) {
|
if (mapLabelToShow != null) {
|
||||||
mapLayers.getContextMenuLayer().setSelectedObject(toShow);
|
// mapLayers.getContextMenuLayer().setSelectedObject(toShow);
|
||||||
if (toShow instanceof FavouritePoint) {
|
// if (toShow instanceof FavouritePoint) {
|
||||||
mapLayers.getContextMenuLayer().showContextMenuForSelectedObjects(latLonToShow);
|
// mapLayers.getContextMenuLayer().showContextMenuForSelectedObjects(latLonToShow);
|
||||||
} else {
|
// } else {
|
||||||
mapLayers.getContextMenuLayer().setLocation(latLonToShow,
|
mapLayers.getContextMenuLayer().setLocation(latLonToShow,
|
||||||
mapLabelToShow.getFullPlainName(this));
|
mapLabelToShow.getFullPlainName(this));
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
if (!latLonToShow.equals(cur)) {
|
if (!latLonToShow.equals(cur)) {
|
||||||
mapView.getAnimatedDraggingThread().startMoving(latLonToShow.getLatitude(),
|
mapView.getAnimatedDraggingThread().startMoving(latLonToShow.getLatitude(),
|
||||||
|
|
|
@ -424,15 +424,15 @@ public class WaypointDialogHelper {
|
||||||
if(ctx.getDashboard().isVisible()) {
|
if(ctx.getDashboard().isVisible()) {
|
||||||
ctx.getDashboard().hideDashboard();
|
ctx.getDashboard().hideDashboard();
|
||||||
ctx.getMapLayers().getContextMenuLayer().setSelectedObject(locationPoint);
|
ctx.getMapLayers().getContextMenuLayer().setSelectedObject(locationPoint);
|
||||||
if (locationPoint instanceof FavouritePoint) {
|
// if (locationPoint instanceof FavouritePoint) {
|
||||||
ctx.getMapLayers().getContextMenuLayer()
|
// ctx.getMapLayers().getContextMenuLayer()
|
||||||
.showContextMenuForSelectedObjects(new LatLon(locationPoint.getLatitude(), locationPoint.getLongitude()));
|
// .showContextMenuForSelectedObjects(new LatLon(locationPoint.getLatitude(), locationPoint.getLongitude()));
|
||||||
} else {
|
// } else {
|
||||||
ctx.getMapLayers()
|
ctx.getMapLayers()
|
||||||
.getContextMenuLayer()
|
.getContextMenuLayer()
|
||||||
.setLocation(new LatLon(locationPoint.getLatitude(), locationPoint.getLongitude()),
|
.setLocation(new LatLon(locationPoint.getLatitude(), locationPoint.getLongitude()),
|
||||||
PointDescription.getSimpleName(locationPoint, ctx));
|
PointDescription.getSimpleName(locationPoint, ctx));
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,6 +95,10 @@ public class MapContextMenu {
|
||||||
if (needStreetName()) {
|
if (needStreetName()) {
|
||||||
acquireStreetName(new LatLon(pointDescription.getLat(), pointDescription.getLon()));
|
acquireStreetName(new LatLon(pointDescription.getLat(), pointDescription.getLon()));
|
||||||
}
|
}
|
||||||
|
if (menuController != null) {
|
||||||
|
menuController.addPlainMenuItems(typeStr, this.pointDescription);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,17 +134,8 @@ public class MapContextMenu {
|
||||||
if (object != null) {
|
if (object != null) {
|
||||||
if (object instanceof Amenity) {
|
if (object instanceof Amenity) {
|
||||||
menuController = new AmenityMenuController(app, mapActivity, (Amenity)object);
|
menuController = new AmenityMenuController(app, mapActivity, (Amenity)object);
|
||||||
if (!Algorithms.isEmpty(typeStr)) {
|
|
||||||
menuController.addPlainMenuItem(R.drawable.ic_action_info_dark, typeStr);
|
|
||||||
}
|
|
||||||
if (pointDescription != null) {
|
|
||||||
menuController.addPlainMenuItem(R.drawable.map_my_location, pointDescription.getLocationName(mapActivity, true).replaceAll("\n", ""));
|
|
||||||
}
|
|
||||||
} else if (object instanceof FavouritePoint) {
|
} else if (object instanceof FavouritePoint) {
|
||||||
menuController = new FavouritePointMenuController(app, mapActivity, (FavouritePoint)object);
|
menuController = new FavouritePointMenuController(app, mapActivity, (FavouritePoint)object);
|
||||||
if (pointDescription != null) {
|
|
||||||
menuController.addPlainMenuItem(R.drawable.map_my_location, pointDescription.getLocationName(mapActivity, true).replaceAll("\n", ""));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
package net.osmand.plus.mapcontextmenu.details;
|
package net.osmand.plus.mapcontextmenu.details;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
import net.osmand.data.Amenity;
|
import net.osmand.data.Amenity;
|
||||||
|
import net.osmand.data.PointDescription;
|
||||||
import net.osmand.osm.PoiCategory;
|
import net.osmand.osm.PoiCategory;
|
||||||
import net.osmand.osm.PoiType;
|
import net.osmand.osm.PoiType;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.render.RenderingIcons;
|
import net.osmand.plus.render.RenderingIcons;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
|
@ -70,6 +73,16 @@ public class AmenityMenuController extends MenuController {
|
||||||
return typeStr;
|
return typeStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addPlainMenuItems(String typeStr, PointDescription pointDescription) {
|
||||||
|
if (!Algorithms.isEmpty(typeStr)) {
|
||||||
|
addPlainMenuItem(R.drawable.ic_action_info_dark, typeStr);
|
||||||
|
}
|
||||||
|
if (pointDescription != null) {
|
||||||
|
addPlainMenuItem(R.drawable.map_my_location, pointDescription.getLocationName(getMapActivity(), true).replaceAll("\n", ""));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getNameStr() {
|
public String getNameStr() {
|
||||||
return amenity.getName(getMapActivity().getMyApplication().getSettings().MAP_PREFERRED_LOCALE.get());
|
return amenity.getName(getMapActivity().getMyApplication().getSettings().MAP_PREFERRED_LOCALE.get());
|
||||||
|
|
|
@ -5,6 +5,7 @@ import android.os.Bundle;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
|
|
||||||
import net.osmand.data.FavouritePoint;
|
import net.osmand.data.FavouritePoint;
|
||||||
|
import net.osmand.data.PointDescription;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
|
@ -73,6 +74,13 @@ public class FavouritePointMenuController extends MenuController {
|
||||||
return fav.getName();
|
return fav.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addPlainMenuItems(String typeStr, PointDescription pointDescription) {
|
||||||
|
if (pointDescription != null) {
|
||||||
|
addPlainMenuItem(R.drawable.map_my_location, pointDescription.getLocationName(getMapActivity(), true).replaceAll("\n", ""));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void saveEntityState(Bundle bundle, String key) {
|
public void saveEntityState(Bundle bundle, String key) {
|
||||||
bundle.putSerializable(key, fav);
|
bundle.putSerializable(key, fav);
|
||||||
|
|
|
@ -4,6 +4,7 @@ import android.graphics.drawable.Drawable;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
|
import net.osmand.data.PointDescription;
|
||||||
import net.osmand.plus.IconsCache;
|
import net.osmand.plus.IconsCache;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
|
@ -43,6 +44,9 @@ public abstract class MenuController {
|
||||||
builder.addPlainMenuItem(iconId, text);
|
builder.addPlainMenuItem(iconId, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void addPlainMenuItems(String typeStr, PointDescription pointDescription) {
|
||||||
|
}
|
||||||
|
|
||||||
public int getInitialMenuState() {
|
public int getInitialMenuState() {
|
||||||
if (isLandscapeLayout()) {
|
if (isLandscapeLayout()) {
|
||||||
return MenuState.FULL_SCREEN;
|
return MenuState.FULL_SCREEN;
|
||||||
|
|
Loading…
Reference in a new issue