diff --git a/OsmAnd/src/net/osmand/plus/activities/FavouritesTreeFragment.java b/OsmAnd/src/net/osmand/plus/activities/FavouritesTreeFragment.java index 3d4649c53f..43d0c921f7 100644 --- a/OsmAnd/src/net/osmand/plus/activities/FavouritesTreeFragment.java +++ b/OsmAnd/src/net/osmand/plus/activities/FavouritesTreeFragment.java @@ -29,6 +29,7 @@ import net.osmand.plus.TargetPointsHelper; import net.osmand.plus.base.FavoriteImageDrawable; import net.osmand.plus.dialogs.DirectionsDialogs; import net.osmand.plus.helpers.ColorDialogs; +import net.osmand.plus.helpers.WaypointDialogHelper; import net.osmand.util.MapUtils; import android.app.Activity; import android.app.AlertDialog; diff --git a/OsmAnd/src/net/osmand/plus/activities/IntermediatePointsDialog.java b/OsmAnd/src/net/osmand/plus/activities/IntermediatePointsDialog.java index 3b2c53fcfe..9032a2dee1 100644 --- a/OsmAnd/src/net/osmand/plus/activities/IntermediatePointsDialog.java +++ b/OsmAnd/src/net/osmand/plus/activities/IntermediatePointsDialog.java @@ -14,6 +14,7 @@ import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; import net.osmand.plus.TargetPointsHelper; import net.osmand.plus.TargetPointsHelper.TargetPoint; +import net.osmand.plus.helpers.WaypointDialogHelper; import net.osmand.util.MapUtils; import android.app.Activity; import android.app.AlertDialog; @@ -41,7 +42,8 @@ public class IntermediatePointsDialog { public static void openIntermediatePointsDialog(MapActivity mapActivity){ - openIntermediatePointsDialog(mapActivity, (OsmandApplication) mapActivity.getApplication(), false); +// openIntermediatePointsDialog(mapActivity, (OsmandApplication) mapActivity.getApplication(), false); + WaypointDialogHelper.showWaypointsDialog(mapActivity, false); } public static void openIntermediatePointsDialog(final Activity activity, diff --git a/OsmAnd/src/net/osmand/plus/helpers/WaypointDialogHelper.java b/OsmAnd/src/net/osmand/plus/helpers/WaypointDialogHelper.java index 55f1ec78b4..d0ec8da9a0 100644 --- a/OsmAnd/src/net/osmand/plus/helpers/WaypointDialogHelper.java +++ b/OsmAnd/src/net/osmand/plus/helpers/WaypointDialogHelper.java @@ -132,7 +132,7 @@ public class WaypointDialogHelper implements OsmAndLocationListener { } } - private static void updatePointInfoView(final OsmandApplication app, final MapActivity ctx, + private static void updatePointInfoView(final OsmandApplication app, final Activity ctx, View localView, final LocationPointWrapper ps, final DialogFragment dialog) { WaypointHelper wh = app.getWaypointHelper(); final LocationPoint point = ps.getPoint(); @@ -147,8 +147,10 @@ public class WaypointDialogHelper implements OsmAndLocationListener { ((ImageView) localView.findViewById(R.id.waypoint_icon)).setImageDrawable(ps.getDrawable(ctx)); int dist = -1; if (!wh.isRouteCalculated()) { - dist = (int) MapUtils.getDistance(ctx.getMapView().getLatitude(), ctx.getMapView().getLongitude(), - point.getLatitude(), point.getLongitude()); + if (ctx instanceof MapActivity) { + dist = (int) MapUtils.getDistance(((MapActivity) ctx).getMapView().getLatitude(), ((MapActivity) ctx) + .getMapView().getLongitude(), point.getLatitude(), point.getLongitude()); + } } else { dist = wh.getRouteDistance(ps); } @@ -357,7 +359,7 @@ public class WaypointDialogHelper implements OsmAndLocationListener { if (v == null || v.findViewById(R.id.waypoint_icon) == null) { v = ctx.getLayoutInflater().inflate(R.layout.waypoint_reached, null); } - updatePointInfoView(app, (MapActivity) ctx, v, getItem(position), WaypointDialogFragment.this); + updatePointInfoView(app, ctx, v, getItem(position), WaypointDialogFragment.this); View remove = v.findViewById(R.id.info_close); if(!edit) { remove.setVisibility(View.GONE); @@ -434,7 +436,7 @@ public class WaypointDialogHelper implements OsmAndLocationListener { if(v == null || v.findViewById(R.id.info_close) == null) { v = ctx.getLayoutInflater().inflate(R.layout.waypoint_reached, null); } - updatePointInfoView(app, (MapActivity) ctx, v, (LocationPointWrapper) getItem(position), WaypointDialogFragment.this); + updatePointInfoView(app, ctx, v, (LocationPointWrapper) getItem(position), WaypointDialogFragment.this); View remove = v.findViewById(R.id.info_close); if (!edit) { remove.setVisibility(View.GONE);