From 779b67755130f6ac05ee649034cf92189bde9da8 Mon Sep 17 00:00:00 2001 From: sonora Date: Thu, 13 Jun 2013 00:43:53 +0200 Subject: [PATCH] replace navigatePointDialog by IntermediatePointsDialog in navpoint and searchadd fragments --- .../net/osmand/plus/activities/MapActivityActions.java | 2 ++ .../osmand/plus/activities/NavigatePointFragment.java | 9 ++++++++- .../plus/activities/search/SearchAddressFragment.java | 9 ++++++++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java index f5aac6f887..44ea7884f2 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java @@ -1269,6 +1269,7 @@ public class MapActivityActions implements DialogProvider { if (onShow != null) { onShow.onClick(v); } + // Issue 1929: Check where this dialohue appears and replace by IntermediatePointsDialog navigatePointDialogAndLaunchMap(activity, location.getLatitude(), location.getLongitude(), name); qa.dismiss(); } @@ -1279,6 +1280,7 @@ public class MapActivityActions implements DialogProvider { public static void navigatePointDialogAndLaunchMap(final Activity act, final double lat, final double lon, final String name){ + // Issue 1929: This dialog not needed anymore OsmandApplication ctx = (OsmandApplication) act.getApplication(); final TargetPointsHelper targetPointsHelper = ctx.getTargetPointsHelper(); final OsmandSettings settings = ctx.getSettings(); diff --git a/OsmAnd/src/net/osmand/plus/activities/NavigatePointFragment.java b/OsmAnd/src/net/osmand/plus/activities/NavigatePointFragment.java index 4d88f547d9..4f3e84055e 100644 --- a/OsmAnd/src/net/osmand/plus/activities/NavigatePointFragment.java +++ b/OsmAnd/src/net/osmand/plus/activities/NavigatePointFragment.java @@ -259,8 +259,15 @@ public class NavigatePointFragment extends SherlockFragment implements SearchAct targetPointsHelper.setSingleDestination(lat, lon, getString(R.string.point_on_map, lat, lon)); MapActivity.launchMapActivityMoveToTop(getActivity()); } else if (mode == ADD_WAYPOINT) { + //MapActivityActions.navigatePointDialogAndLaunchMap(getActivity(), lat, lon, getString(R.string.point_on_map, lat, lon)); // Issue 1929 TODO: show IntermediatePointsDialog here instead of navigatePointDialog, without subsequent Directions - MapActivityActions.navigatePointDialogAndLaunchMap(getActivity(), lat, lon, getString(R.string.point_on_map, lat, lon)); + if (targetPointsHelper.getIntermediatePoints().size() == 0) { + targetPointsHelper.navigateToPoint(new LatLon(lat, lon), true, -1); + } else { + targetPointsHelper.navigateToPoint(new LatLon(lat, lon), true, targetPointsHelper.getIntermediatePoints().size()); + } + IntermediatePointsDialog.openIntermediatePointsDialog(mapActivity); + MapActivity.launchMapActivityMoveToTop(getActivity()); } else if (mode == SHOW_ON_MAP){ OsmandApplication app = (OsmandApplication) getActivity().getApplication(); app.getSettings().setMapLocationToShow(lat, lon, Math.max(12, app.getSettings().getLastKnownMapZoom()), diff --git a/OsmAnd/src/net/osmand/plus/activities/search/SearchAddressFragment.java b/OsmAnd/src/net/osmand/plus/activities/search/SearchAddressFragment.java index 88604156ee..649a3994f5 100644 --- a/OsmAnd/src/net/osmand/plus/activities/search/SearchAddressFragment.java +++ b/OsmAnd/src/net/osmand/plus/activities/search/SearchAddressFragment.java @@ -296,8 +296,15 @@ public class SearchAddressFragment extends SherlockFragment { targetPointsHelper.setSingleDestination(searchPoint.getLatitude(), searchPoint.getLongitude(), historyName); MapActivity.launchMapActivityMoveToTop(getActivity()); } else if (mode == ADD_WAYPOINT) { + //MapActivityActions.navigatePointDialogAndLaunchMap(getActivity(), searchPoint.getLatitude(), searchPoint.getLongitude(), historyName); // Issue 1929 TODO: show IntermediatePointsDialog here instead of navigatePointDialog, without subsequent Directions - MapActivityActions.navigatePointDialogAndLaunchMap(getActivity(), searchPoint.getLatitude(), searchPoint.getLongitude(), historyName); + if (targetPointsHelper.getIntermediatePoints().size() == 0) { + targetPointsHelper.navigateToPoint(searchPoint, true, -1); + } else { + targetPointsHelper.navigateToPoint(searchPoint, true, targetPointsHelper.getIntermediatePoints().size()); + } + IntermediatePointsDialog.openIntermediatePointsDialog(mapActivity); + MapActivity.launchMapActivityMoveToTop(getActivity()); } else if (mode == SHOW_ON_MAP) { osmandSettings.setMapLocationToShow(searchPoint.getLatitude(), searchPoint.getLongitude(), zoom, historyName); MapActivity.launchMapActivityMoveToTop(getActivity());