Fix #6582
This commit is contained in:
parent
ac1d04896f
commit
00b135d881
19 changed files with 74 additions and 73 deletions
|
@ -163,6 +163,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
||||||
|
|
||||||
private MapViewTrackingUtilities mapViewTrackingUtilities;
|
private MapViewTrackingUtilities mapViewTrackingUtilities;
|
||||||
private static MapContextMenu mapContextMenu = new MapContextMenu();
|
private static MapContextMenu mapContextMenu = new MapContextMenu();
|
||||||
|
private static MapRouteInfoMenu mapRouteInfoMenu = new MapRouteInfoMenu();
|
||||||
private static Intent prevActivityIntent = null;
|
private static Intent prevActivityIntent = null;
|
||||||
|
|
||||||
private List<ActivityResultListener> activityResultListeners = new ArrayList<>();
|
private List<ActivityResultListener> activityResultListeners = new ArrayList<>();
|
||||||
|
@ -225,6 +226,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
||||||
landscapeLayout = !portraitMode && !largeDevice;
|
landscapeLayout = !portraitMode && !largeDevice;
|
||||||
mapViewTrackingUtilities = app.getMapViewTrackingUtilities();
|
mapViewTrackingUtilities = app.getMapViewTrackingUtilities();
|
||||||
mapContextMenu.setMapActivity(this);
|
mapContextMenu.setMapActivity(this);
|
||||||
|
mapRouteInfoMenu.setMapActivity(this);
|
||||||
|
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
// Full screen is not used here
|
// Full screen is not used here
|
||||||
|
@ -445,10 +447,10 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateProgress(int progress) {
|
public void updateProgress(int progress) {
|
||||||
mapLayers.getMapControlsLayer().getMapRouteInfoMenu().updateRouteCalculationProgress(progress);
|
mapRouteInfoMenu.updateRouteCalculationProgress(progress);
|
||||||
dashboardOnMap.updateRouteCalculationProgress(progress);
|
dashboardOnMap.updateRouteCalculationProgress(progress);
|
||||||
if (findViewById(R.id.MapHudButtonsOverlay).getVisibility() == View.VISIBLE) {
|
if (findViewById(R.id.MapHudButtonsOverlay).getVisibility() == View.VISIBLE) {
|
||||||
if (MapRouteInfoMenu.isVisible() || dashboardOnMap.isVisible()) {
|
if (mapRouteInfoMenu.isVisible() || dashboardOnMap.isVisible()) {
|
||||||
pb.setVisibility(View.GONE);
|
pb.setVisibility(View.GONE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -494,7 +496,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void finish() {
|
public void finish() {
|
||||||
mapLayers.getMapControlsLayer().getMapRouteInfoMenu().routeCalculationFinished();
|
mapRouteInfoMenu.routeCalculationFinished();
|
||||||
dashboardOnMap.routeCalculationFinished();
|
dashboardOnMap.routeCalculationFinished();
|
||||||
pb.setVisibility(View.GONE);
|
pb.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
@ -1117,9 +1119,9 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
||||||
TrackDetailsMenu trackDetailsMenu = mapLayers.getMapControlsLayer().getTrackDetailsMenu();
|
TrackDetailsMenu trackDetailsMenu = mapLayers.getMapControlsLayer().getTrackDetailsMenu();
|
||||||
trackDetailsMenu.setGpxItem((GpxDisplayItem) toShow);
|
trackDetailsMenu.setGpxItem((GpxDisplayItem) toShow);
|
||||||
trackDetailsMenu.show();
|
trackDetailsMenu.show();
|
||||||
} else if (MapRouteInfoMenu.isVisible()) {
|
} else if (mapRouteInfoMenu.isVisible()) {
|
||||||
mapContextMenu.showMinimized(latLonToShow, mapLabelToShow, toShow);
|
mapContextMenu.showMinimized(latLonToShow, mapLabelToShow, toShow);
|
||||||
mapLayers.getMapControlsLayer().getMapRouteInfoMenu().updateMenu();
|
mapRouteInfoMenu.updateMenu();
|
||||||
MapRouteInfoMenu.showLocationOnMap(this, latLonToShow.getLatitude(), latLonToShow.getLongitude());
|
MapRouteInfoMenu.showLocationOnMap(this, latLonToShow.getLatitude(), latLonToShow.getLongitude());
|
||||||
} else if (toShow instanceof QuadRect) {
|
} else if (toShow instanceof QuadRect) {
|
||||||
QuadRect qr = (QuadRect) toShow;
|
QuadRect qr = (QuadRect) toShow;
|
||||||
|
@ -1258,6 +1260,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
||||||
protected void onDestroy() {
|
protected void onDestroy() {
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
mapContextMenu.setMapActivity(null);
|
mapContextMenu.setMapActivity(null);
|
||||||
|
mapRouteInfoMenu.setMapActivity(null);
|
||||||
unregisterReceiver(screenOffReceiver);
|
unregisterReceiver(screenOffReceiver);
|
||||||
app.getAidlApi().onDestroyMapActivity(this);
|
app.getAidlApi().onDestroyMapActivity(this);
|
||||||
FailSafeFuntions.quitRouteRestoreDialog();
|
FailSafeFuntions.quitRouteRestoreDialog();
|
||||||
|
@ -1581,6 +1584,11 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
||||||
return mapContextMenu;
|
return mapContextMenu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
public MapRouteInfoMenu getMapRouteInfoMenu() {
|
||||||
|
return mapRouteInfoMenu;
|
||||||
|
}
|
||||||
|
|
||||||
public void openDrawer() {
|
public void openDrawer() {
|
||||||
mapActions.updateDrawerMenu();
|
mapActions.updateDrawerMenu();
|
||||||
boolean animate = !settings.DO_NOT_USE_ANIMATIONS.get();
|
boolean animate = !settings.DO_NOT_USE_ANIMATIONS.get();
|
||||||
|
@ -1768,8 +1776,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void newRouteIsCalculated(boolean newRoute, ValueHolder<Boolean> showToast) {
|
public void newRouteIsCalculated(boolean newRoute, ValueHolder<Boolean> showToast) {
|
||||||
MapRouteInfoMenu routeInfoMenu = mapLayers.getMapControlsLayer().getMapRouteInfoMenu();
|
if (mapRouteInfoMenu.isSelectFromMapTouch()) {
|
||||||
if (routeInfoMenu.isSelectFromMapTouch()) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1801,7 +1808,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
||||||
int tileBoxWidthPx = 0;
|
int tileBoxWidthPx = 0;
|
||||||
int tileBoxHeightPx = 0;
|
int tileBoxHeightPx = 0;
|
||||||
|
|
||||||
WeakReference<MapRouteInfoMenuFragment> fragmentRef = routeInfoMenu.findMenuFragment();
|
WeakReference<MapRouteInfoMenuFragment> fragmentRef = mapRouteInfoMenu.findMenuFragment();
|
||||||
if (fragmentRef != null) {
|
if (fragmentRef != null) {
|
||||||
MapRouteInfoMenuFragment f = fragmentRef.get();
|
MapRouteInfoMenuFragment f = fragmentRef.get();
|
||||||
if (landscapeLayout) {
|
if (landscapeLayout) {
|
||||||
|
|
|
@ -1516,8 +1516,8 @@ public class ShowRouteInfoDialogFragment extends BaseOsmAndFragment {
|
||||||
false,
|
false,
|
||||||
gpxItem);
|
gpxItem);
|
||||||
|
|
||||||
final MapRouteInfoMenu mapRouteInfoMenu = activity.getMapLayers().getMapControlsLayer().getMapRouteInfoMenu();
|
final MapRouteInfoMenu mapRouteInfoMenu = activity.getMapRouteInfoMenu();
|
||||||
if (MapRouteInfoMenu.isVisible()) {
|
if (mapRouteInfoMenu.isVisible()) {
|
||||||
// We arrived here by the route info menu.
|
// We arrived here by the route info menu.
|
||||||
// First, we close it and then show the details.
|
// First, we close it and then show the details.
|
||||||
mapRouteInfoMenu.setOnDismissListener(new OnDismissListener() {
|
mapRouteInfoMenu.setOnDismissListener(new OnDismissListener() {
|
||||||
|
|
|
@ -619,7 +619,7 @@ public class ExternalApiHelper {
|
||||||
}
|
}
|
||||||
mapActivity.getMapActions().enterRoutePlanningModeGivenGpx(gpx, from, fromDesc, true, false);
|
mapActivity.getMapActions().enterRoutePlanningModeGivenGpx(gpx, from, fromDesc, true, false);
|
||||||
if (!app.getTargetPointsHelper().checkPointToNavigateShort()) {
|
if (!app.getTargetPointsHelper().checkPointToNavigateShort()) {
|
||||||
mapActivity.getMapLayers().getMapControlsLayer().getMapRouteInfoMenu().show();
|
mapActivity.getMapRouteInfoMenu().show();
|
||||||
} else {
|
} else {
|
||||||
if (app.getSettings().APPLICATION_MODE.get() != routingHelper.getAppMode()) {
|
if (app.getSettings().APPLICATION_MODE.get() != routingHelper.getAppMode()) {
|
||||||
app.getSettings().APPLICATION_MODE.set(routingHelper.getAppMode());
|
app.getSettings().APPLICATION_MODE.set(routingHelper.getAppMode());
|
||||||
|
|
|
@ -234,7 +234,7 @@ public class WaypointDialogHelper {
|
||||||
|
|
||||||
private static void updateRouteInfoMenu(Activity ctx) {
|
private static void updateRouteInfoMenu(Activity ctx) {
|
||||||
if (ctx instanceof MapActivity) {
|
if (ctx instanceof MapActivity) {
|
||||||
((MapActivity) ctx).getMapLayers().getMapControlsLayer().getMapRouteInfoMenu().updateMenu();
|
((MapActivity) ctx).getMapRouteInfoMenu().updateMenu();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,6 @@ import net.osmand.plus.mapcontextmenu.MenuController.MenuState;
|
||||||
import net.osmand.plus.mapcontextmenu.MenuController.TitleButtonController;
|
import net.osmand.plus.mapcontextmenu.MenuController.TitleButtonController;
|
||||||
import net.osmand.plus.mapcontextmenu.MenuController.TitleProgressController;
|
import net.osmand.plus.mapcontextmenu.MenuController.TitleProgressController;
|
||||||
import net.osmand.plus.mapcontextmenu.controllers.TransportStopController;
|
import net.osmand.plus.mapcontextmenu.controllers.TransportStopController;
|
||||||
import net.osmand.plus.routepreparationmenu.MapRouteInfoMenu;
|
|
||||||
import net.osmand.plus.transport.TransportStopRoute;
|
import net.osmand.plus.transport.TransportStopRoute;
|
||||||
import net.osmand.plus.views.AnimateDraggingMapThread;
|
import net.osmand.plus.views.AnimateDraggingMapThread;
|
||||||
import net.osmand.plus.views.OsmandMapTileView;
|
import net.osmand.plus.views.OsmandMapTileView;
|
||||||
|
@ -1247,11 +1246,11 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
if (!menu.isActive() || MapRouteInfoMenu.isVisible()) {
|
MapActivity mapActivity = getMapActivity();
|
||||||
|
if (!menu.isActive() || (mapActivity != null && mapActivity.getMapRouteInfoMenu().isVisible())) {
|
||||||
dismissMenu();
|
dismissMenu();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
MapActivity mapActivity = getMapActivity();
|
|
||||||
if (mapActivity != null) {
|
if (mapActivity != null) {
|
||||||
updateLocationViewCache = mapActivity.getMyApplication().getUIUtilities().getUpdateLocationViewCache();
|
updateLocationViewCache = mapActivity.getMyApplication().getUIUtilities().getUpdateLocationViewCache();
|
||||||
mapActivity.getMapViewTrackingUtilities().setContextMenu(menu);
|
mapActivity.getMapViewTrackingUtilities().setContextMenu(menu);
|
||||||
|
|
|
@ -188,7 +188,7 @@ public class FavouritesBottomSheetMenuFragment extends MenuBottomSheetDialogFrag
|
||||||
Activity activity = getActivity();
|
Activity activity = getActivity();
|
||||||
if (activity instanceof MapActivity) {
|
if (activity instanceof MapActivity) {
|
||||||
MapActivity map = ((MapActivity) activity);
|
MapActivity map = ((MapActivity) activity);
|
||||||
return map.getMapLayers().getMapControlsLayer().getMapRouteInfoMenu();
|
return map.getMapRouteInfoMenu();
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -174,7 +174,7 @@ public class MapMultiSelectionMenuFragment extends Fragment implements MultiSele
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
if (MapRouteInfoMenu.isVisible()) {
|
if (menu.getMapActivity().getMapRouteInfoMenu().isVisible()) {
|
||||||
dismissMenu();
|
dismissMenu();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,7 @@ public class MapMarkerSelectionFragment extends BaseOsmAndDialogFragment {
|
||||||
MapActivity mapActivity = getMapActivity();
|
MapActivity mapActivity = getMapActivity();
|
||||||
OsmandApplication app = getMyApplication();
|
OsmandApplication app = getMyApplication();
|
||||||
if (mapActivity != null) {
|
if (mapActivity != null) {
|
||||||
MapRouteInfoMenu routeInfoMenu = mapActivity.getMapLayers().getMapControlsLayer().getMapRouteInfoMenu();
|
MapRouteInfoMenu routeInfoMenu = mapActivity.getMapRouteInfoMenu();
|
||||||
onClickListener = routeInfoMenu.getOnMarkerSelectListener();
|
onClickListener = routeInfoMenu.getOnMarkerSelectListener();
|
||||||
|
|
||||||
screenOrientation = app.getUIUtilities().getScreenOrientation();
|
screenOrientation = app.getUIUtilities().getScreenOrientation();
|
||||||
|
|
|
@ -235,7 +235,7 @@ public class AddPointBottomSheetDialog extends MenuBottomSheetDialogFragment {
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
MapActivity mapActivity = (MapActivity) getActivity();
|
MapActivity mapActivity = (MapActivity) getActivity();
|
||||||
if (mapActivity != null) {
|
if (mapActivity != null) {
|
||||||
MapRouteInfoMenu menu = mapActivity.getMapLayers().getMapControlsLayer().getMapRouteInfoMenu();
|
MapRouteInfoMenu menu = mapActivity.getMapRouteInfoMenu();
|
||||||
menu.selectOnScreen(pointType);
|
menu.selectOnScreen(pointType);
|
||||||
}
|
}
|
||||||
dismiss();
|
dismiss();
|
||||||
|
@ -300,7 +300,7 @@ public class AddPointBottomSheetDialog extends MenuBottomSheetDialogFragment {
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
MapActivity mapActivity = (MapActivity) getActivity();
|
MapActivity mapActivity = (MapActivity) getActivity();
|
||||||
if (mapActivity != null) {
|
if (mapActivity != null) {
|
||||||
MapRouteInfoMenu menu = mapActivity.getMapLayers().getMapControlsLayer().getMapRouteInfoMenu();
|
MapRouteInfoMenu menu = mapActivity.getMapRouteInfoMenu();
|
||||||
menu.selectMapMarker(-1, pointType);
|
menu.selectMapMarker(-1, pointType);
|
||||||
dismiss();
|
dismiss();
|
||||||
}
|
}
|
||||||
|
@ -311,7 +311,7 @@ public class AddPointBottomSheetDialog extends MenuBottomSheetDialogFragment {
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
MapActivity mapActivity = (MapActivity) getActivity();
|
MapActivity mapActivity = (MapActivity) getActivity();
|
||||||
if (mapActivity != null) {
|
if (mapActivity != null) {
|
||||||
MapRouteInfoMenu menu = mapActivity.getMapLayers().getMapControlsLayer().getMapRouteInfoMenu();
|
MapRouteInfoMenu menu = mapActivity.getMapRouteInfoMenu();
|
||||||
menu.selectMapMarker(0, pointType);
|
menu.selectMapMarker(0, pointType);
|
||||||
dismiss();
|
dismiss();
|
||||||
}
|
}
|
||||||
|
|
|
@ -137,7 +137,7 @@ public class AvoidRoadsBottomSheetDialogFragment extends MenuBottomSheetDialogFr
|
||||||
MapActivity mapActivity = getMapActivity();
|
MapActivity mapActivity = getMapActivity();
|
||||||
if (mapActivity != null) {
|
if (mapActivity != null) {
|
||||||
mapActivity.getDashboard().setDashboardVisibility(false, DashboardOnMap.DashboardType.ROUTE_PREFERENCES);
|
mapActivity.getDashboard().setDashboardVisibility(false, DashboardOnMap.DashboardType.ROUTE_PREFERENCES);
|
||||||
mapActivity.getMapLayers().getMapControlsLayer().getMapRouteInfoMenu().hide();
|
mapActivity.getMapRouteInfoMenu().hide();
|
||||||
app.getAvoidSpecificRoads().selectFromMap(mapActivity);
|
app.getAvoidSpecificRoads().selectFromMap(mapActivity);
|
||||||
Fragment fragment = getTargetFragment();
|
Fragment fragment = getTargetFragment();
|
||||||
if (fragment != null) {
|
if (fragment != null) {
|
||||||
|
@ -281,11 +281,9 @@ public class AvoidRoadsBottomSheetDialogFragment extends MenuBottomSheetDialogFr
|
||||||
|
|
||||||
MapActivity mapActivity = getMapActivity();
|
MapActivity mapActivity = getMapActivity();
|
||||||
if (mapActivity != null) {
|
if (mapActivity != null) {
|
||||||
final MapRouteInfoMenu mapRouteInfoMenu = mapActivity.getMapLayers().getMapControlsLayer().getMapRouteInfoMenu();
|
final MapRouteInfoMenu mapRouteInfoMenu = mapActivity.getMapRouteInfoMenu();
|
||||||
if (mapRouteInfoMenu != null) {
|
|
||||||
mapRouteInfoMenu.updateMenu();
|
mapRouteInfoMenu.updateMenu();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
dismiss();
|
dismiss();
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.support.annotation.DrawableRes;
|
import android.support.annotation.DrawableRes;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
|
import android.support.annotation.Nullable;
|
||||||
import android.support.transition.AutoTransition;
|
import android.support.transition.AutoTransition;
|
||||||
import android.support.transition.Scene;
|
import android.support.transition.Scene;
|
||||||
import android.support.transition.Transition;
|
import android.support.transition.Transition;
|
||||||
|
@ -68,7 +69,6 @@ import net.osmand.plus.routing.IRouteInformationListener;
|
||||||
import net.osmand.plus.routing.RoutingHelper;
|
import net.osmand.plus.routing.RoutingHelper;
|
||||||
import net.osmand.plus.routing.TransportRoutingHelper;
|
import net.osmand.plus.routing.TransportRoutingHelper;
|
||||||
import net.osmand.plus.search.QuickSearchHelper;
|
import net.osmand.plus.search.QuickSearchHelper;
|
||||||
import net.osmand.plus.views.MapControlsLayer;
|
|
||||||
import net.osmand.router.GeneralRouter;
|
import net.osmand.router.GeneralRouter;
|
||||||
import net.osmand.router.TransportRoutePlanner.TransportRouteResult;
|
import net.osmand.router.TransportRoutePlanner.TransportRouteResult;
|
||||||
import net.osmand.search.SearchUICore.SearchResultCollection;
|
import net.osmand.search.SearchUICore.SearchResultCollection;
|
||||||
|
@ -98,13 +98,12 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int directionInfo = -1;
|
public static int directionInfo = -1;
|
||||||
private static boolean visible;
|
|
||||||
public static boolean controlVisible = false;
|
public static boolean controlVisible = false;
|
||||||
public static boolean chooseRoutesVisible = false;
|
public static boolean chooseRoutesVisible = false;
|
||||||
|
|
||||||
private final RoutingHelper routingHelper;
|
private RoutingHelper routingHelper;
|
||||||
private final TransportRoutingHelper transportHelper;
|
private TransportRoutingHelper transportHelper;
|
||||||
private final RoutingOptionsHelper routingOptionsHelper;
|
private RoutingOptionsHelper routingOptionsHelper;
|
||||||
private GeocodingLookupService geocodingLookupService;
|
private GeocodingLookupService geocodingLookupService;
|
||||||
private boolean routeCalculationInProgress;
|
private boolean routeCalculationInProgress;
|
||||||
|
|
||||||
|
@ -116,7 +115,6 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
||||||
private MapActivity mapActivity;
|
private MapActivity mapActivity;
|
||||||
private OsmandApplication app;
|
private OsmandApplication app;
|
||||||
private Handler animationsHandler;
|
private Handler animationsHandler;
|
||||||
private MapControlsLayer mapControlsLayer;
|
|
||||||
private boolean nightMode;
|
private boolean nightMode;
|
||||||
private boolean switched;
|
private boolean switched;
|
||||||
|
|
||||||
|
@ -156,20 +154,25 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
||||||
WORK
|
WORK
|
||||||
}
|
}
|
||||||
|
|
||||||
public MapRouteInfoMenu(MapActivity mapActivity, MapControlsLayer mapControlsLayer) {
|
public MapRouteInfoMenu() {
|
||||||
this.mapActivity = mapActivity;
|
}
|
||||||
this.app = mapActivity.getMyApplication();
|
|
||||||
this.mapControlsLayer = mapControlsLayer;
|
|
||||||
this.routingHelper = mapActivity.getRoutingHelper();
|
|
||||||
this.transportHelper = routingHelper.getTransportRoutingHelper();
|
|
||||||
this.routingOptionsHelper = app.getRoutingOptionsHelper();
|
|
||||||
this.animationsHandler = new Handler();
|
|
||||||
|
|
||||||
routingHelper.addListener(this);
|
public void setMapActivity(@Nullable MapActivity mapActivity) {
|
||||||
|
this.mapActivity = mapActivity;
|
||||||
|
if (mapActivity != null) {
|
||||||
|
if (app == null) {
|
||||||
|
app = mapActivity.getMyApplication();
|
||||||
|
}
|
||||||
|
routingHelper = app.getRoutingHelper();
|
||||||
|
transportHelper = routingHelper.getTransportRoutingHelper();
|
||||||
|
routingOptionsHelper = app.getRoutingOptionsHelper();
|
||||||
portraitMode = AndroidUiHelper.isOrientationPortrait(mapActivity);
|
portraitMode = AndroidUiHelper.isOrientationPortrait(mapActivity);
|
||||||
|
geocodingLookupService = app.getGeocodingLookupService();
|
||||||
|
}
|
||||||
|
animationsHandler = new Handler();
|
||||||
|
routingHelper.addListener(this);
|
||||||
currentMenuState = getInitialMenuState();
|
currentMenuState = getInitialMenuState();
|
||||||
|
|
||||||
geocodingLookupService = mapActivity.getMyApplication().getGeocodingLookupService();
|
|
||||||
onMarkerSelectListener = new OnMarkerSelectListener() {
|
onMarkerSelectListener = new OnMarkerSelectListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onSelect(int index, PointType pointType) {
|
public void onSelect(int index, PointType pointType) {
|
||||||
|
@ -1013,12 +1016,12 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
||||||
if (isTransportRouteCalculated()) {
|
if (isTransportRouteCalculated()) {
|
||||||
ChooseRouteFragment.showInstance(mapActivity.getSupportFragmentManager());
|
ChooseRouteFragment.showInstance(mapActivity.getSupportFragmentManager());
|
||||||
} else {
|
} else {
|
||||||
mapControlsLayer.startNavigation();
|
mapActivity.getMapLayers().getMapControlsLayer().startNavigation();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void clickRouteCancel() {
|
private void clickRouteCancel() {
|
||||||
mapControlsLayer.stopNavigation();
|
mapActivity.getMapLayers().getMapControlsLayer().stopNavigation();
|
||||||
setRouteCalculationInProgress(false);
|
setRouteCalculationInProgress(false);
|
||||||
restoreCollapsedButtons();
|
restoreCollapsedButtons();
|
||||||
}
|
}
|
||||||
|
@ -1234,7 +1237,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
boolean started = false;
|
boolean started = false;
|
||||||
if (visible && mainView != null) {
|
if (isVisible() && mainView != null) {
|
||||||
ViewGroup container = (ViewGroup) mainView.findViewById(containerRes);
|
ViewGroup container = (ViewGroup) mainView.findViewById(containerRes);
|
||||||
View v = mainView.findViewById(viewRes);
|
View v = mainView.findViewById(viewRes);
|
||||||
if (container != null && v != null && v.getVisibility() == View.VISIBLE) {
|
if (container != null && v != null && v.getVisibility() == View.VISIBLE) {
|
||||||
|
@ -1244,7 +1247,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
||||||
@Override
|
@Override
|
||||||
public void onTransitionEnd(@NonNull Transition transition) {
|
public void onTransitionEnd(@NonNull Transition transition) {
|
||||||
if (listener != null) {
|
if (listener != null) {
|
||||||
listener.onButtonCollapsed(visible);
|
listener.onButtonCollapsed(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1373,8 +1376,8 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
||||||
return directionInfo;
|
return directionInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isVisible() {
|
public boolean isVisible() {
|
||||||
return visible;
|
return findMenuFragment() != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public WeakReference<MapRouteInfoMenuFragment> findMenuFragment() {
|
public WeakReference<MapRouteInfoMenuFragment> findMenuFragment() {
|
||||||
|
@ -1395,7 +1398,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
||||||
int tileBoxWidthPx = 0;
|
int tileBoxWidthPx = 0;
|
||||||
int tileBoxHeightPx = 0;
|
int tileBoxHeightPx = 0;
|
||||||
|
|
||||||
MapRouteInfoMenu routeInfoMenu = mapActivity.getMapLayers().getMapControlsLayer().getMapRouteInfoMenu();
|
MapRouteInfoMenu routeInfoMenu = mapActivity.getMapRouteInfoMenu();
|
||||||
WeakReference<MapRouteInfoMenuFragment> fragmentRef = routeInfoMenu.findMenuFragment();
|
WeakReference<MapRouteInfoMenuFragment> fragmentRef = routeInfoMenu.findMenuFragment();
|
||||||
if (fragmentRef != null) {
|
if (fragmentRef != null) {
|
||||||
MapRouteInfoMenuFragment f = fragmentRef.get();
|
MapRouteInfoMenuFragment f = fragmentRef.get();
|
||||||
|
@ -1536,14 +1539,13 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onDismiss() {
|
public void onDismiss() {
|
||||||
visible = false;
|
|
||||||
cancelButtonsAnimations();
|
cancelButtonsAnimations();
|
||||||
mapActivity.getMapView().setMapPositionX(0);
|
mapActivity.getMapView().setMapPositionX(0);
|
||||||
mapActivity.getMapView().refreshMap();
|
mapActivity.getMapView().refreshMap();
|
||||||
AndroidUiHelper.updateVisibility(mapActivity.findViewById(R.id.map_route_land_left_margin), false);
|
AndroidUiHelper.updateVisibility(mapActivity.findViewById(R.id.map_route_land_left_margin), false);
|
||||||
AndroidUiHelper.updateVisibility(mapActivity.findViewById(R.id.map_right_widgets_panel), true);
|
AndroidUiHelper.updateVisibility(mapActivity.findViewById(R.id.map_right_widgets_panel), true);
|
||||||
if (switched) {
|
if (switched) {
|
||||||
mapControlsLayer.switchToRouteFollowingLayout();
|
mapActivity.getMapLayers().getMapControlsLayer().switchToRouteFollowingLayout();
|
||||||
}
|
}
|
||||||
if (getTargets().getPointToNavigate() == null && !selectFromMapTouch) {
|
if (getTargets().getPointToNavigate() == null && !selectFromMapTouch) {
|
||||||
mapActivity.getMapActions().stopNavigationWithoutConfirm();
|
mapActivity.getMapActions().stopNavigationWithoutConfirm();
|
||||||
|
@ -1559,10 +1561,9 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
||||||
}
|
}
|
||||||
|
|
||||||
public void show(int menuState) {
|
public void show(int menuState) {
|
||||||
if (!visible) {
|
if (!isVisible()) {
|
||||||
currentMenuState = menuState;
|
currentMenuState = menuState;
|
||||||
visible = true;
|
switched = mapActivity.getMapLayers().getMapControlsLayer().switchToRoutePlanningLayout();
|
||||||
switched = mapControlsLayer.switchToRoutePlanningLayout();
|
|
||||||
boolean refreshMap = !switched;
|
boolean refreshMap = !switched;
|
||||||
boolean portrait = AndroidUiHelper.isOrientationPortrait(mapActivity);
|
boolean portrait = AndroidUiHelper.isOrientationPortrait(mapActivity);
|
||||||
if (!portrait) {
|
if (!portrait) {
|
||||||
|
@ -1590,8 +1591,6 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
||||||
WeakReference<MapRouteInfoMenuFragment> fragmentRef = findMenuFragment();
|
WeakReference<MapRouteInfoMenuFragment> fragmentRef = findMenuFragment();
|
||||||
if (fragmentRef != null) {
|
if (fragmentRef != null) {
|
||||||
fragmentRef.get().dismiss();
|
fragmentRef.get().dismiss();
|
||||||
} else {
|
|
||||||
visible = false;
|
|
||||||
}
|
}
|
||||||
routingHelper.removeListener(this);
|
routingHelper.removeListener(this);
|
||||||
removeTargetPointListener();
|
removeTargetPointListener();
|
||||||
|
|
|
@ -113,7 +113,7 @@ public class MapRouteInfoMenuFragment extends BaseOsmAndFragment {
|
||||||
|
|
||||||
portrait = AndroidUiHelper.isOrientationPortrait(mapActivity);
|
portrait = AndroidUiHelper.isOrientationPortrait(mapActivity);
|
||||||
|
|
||||||
menu = mapActivity.getMapLayers().getMapControlsLayer().getMapRouteInfoMenu();
|
menu = mapActivity.getMapRouteInfoMenu();
|
||||||
shadowHeight = AndroidUtils.getStatusBarHeight(mapActivity);
|
shadowHeight = AndroidUtils.getStatusBarHeight(mapActivity);
|
||||||
topScreenPosY = addStatusBarHeightIfNeeded(0);
|
topScreenPosY = addStatusBarHeightIfNeeded(0);
|
||||||
minHalfY = viewHeight - (int) (viewHeight * .75f);
|
minHalfY = viewHeight - (int) (viewHeight * .75f);
|
||||||
|
|
|
@ -13,8 +13,8 @@ import android.widget.TextView;
|
||||||
|
|
||||||
import net.osmand.AndroidUtils;
|
import net.osmand.AndroidUtils;
|
||||||
import net.osmand.CallbackWithObject;
|
import net.osmand.CallbackWithObject;
|
||||||
import net.osmand.plus.ApplicationMode;
|
|
||||||
import net.osmand.GPXUtilities;
|
import net.osmand.GPXUtilities;
|
||||||
|
import net.osmand.plus.ApplicationMode;
|
||||||
import net.osmand.plus.OsmAndLocationProvider;
|
import net.osmand.plus.OsmAndLocationProvider;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandPlugin;
|
import net.osmand.plus.OsmandPlugin;
|
||||||
|
@ -342,9 +342,9 @@ public class RouteOptionsBottomSheet extends MenuBottomSheetDialogFragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateMenu() {
|
private void updateMenu() {
|
||||||
final MapRouteInfoMenu mapRouteInfoMenu = getMapActivity().getMapLayers().getMapControlsLayer().getMapRouteInfoMenu();
|
MapActivity mapActivity = getMapActivity();
|
||||||
if (mapRouteInfoMenu != null) {
|
if (mapActivity != null) {
|
||||||
mapRouteInfoMenu.updateMenu();
|
mapActivity.getMapRouteInfoMenu().updateMenu();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -98,7 +98,7 @@ public class RoutingOptionsHelper {
|
||||||
|
|
||||||
public void selectRestrictedRoads(final MapActivity mapActivity) {
|
public void selectRestrictedRoads(final MapActivity mapActivity) {
|
||||||
mapActivity.getDashboard().setDashboardVisibility(false, DashboardOnMap.DashboardType.ROUTE_PREFERENCES);
|
mapActivity.getDashboard().setDashboardVisibility(false, DashboardOnMap.DashboardType.ROUTE_PREFERENCES);
|
||||||
mapActivity.getMapLayers().getMapControlsLayer().getMapRouteInfoMenu().hide();
|
mapActivity.getMapRouteInfoMenu().hide();
|
||||||
mapActivity.getMyApplication().getAvoidSpecificRoads().showDialog(mapActivity);
|
mapActivity.getMyApplication().getAvoidSpecificRoads().showDialog(mapActivity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -251,7 +251,7 @@ public class WaypointsFragment extends BaseOsmAndFragment implements ObservableS
|
||||||
if (activeObjects.isEmpty() || isContainsOnlyStart(activeObjects)) {
|
if (activeObjects.isEmpty() || isContainsOnlyStart(activeObjects)) {
|
||||||
mapActivity.getMapActions().stopNavigationWithoutConfirm();
|
mapActivity.getMapActions().stopNavigationWithoutConfirm();
|
||||||
mapActivity.getMyApplication().getTargetPointsHelper().removeAllWayPoints(false, true);
|
mapActivity.getMyApplication().getTargetPointsHelper().removeAllWayPoints(false, true);
|
||||||
mapActivity.getMapLayers().getMapControlsLayer().getMapRouteInfoMenu().hide();
|
mapActivity.getMapRouteInfoMenu().hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -130,10 +130,6 @@ public class MapControlsLayer extends OsmandMapLayer {
|
||||||
contextMenuLayer = mapActivity.getMapLayers().getContextMenuLayer();
|
contextMenuLayer = mapActivity.getMapLayers().getContextMenuLayer();
|
||||||
}
|
}
|
||||||
|
|
||||||
public MapRouteInfoMenu getMapRouteInfoMenu() {
|
|
||||||
return mapRouteInfoMenu;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TrackDetailsMenu getTrackDetailsMenu() {
|
public TrackDetailsMenu getTrackDetailsMenu() {
|
||||||
return trackDetailsMenu;
|
return trackDetailsMenu;
|
||||||
}
|
}
|
||||||
|
@ -300,7 +296,7 @@ public class MapControlsLayer extends OsmandMapLayer {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initRouteControls() {
|
private void initRouteControls() {
|
||||||
mapRouteInfoMenu = new MapRouteInfoMenu(mapActivity, this);
|
mapRouteInfoMenu = mapActivity.getMapRouteInfoMenu();
|
||||||
trackDetailsMenu = new TrackDetailsMenu(mapActivity);
|
trackDetailsMenu = new TrackDetailsMenu(mapActivity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -759,7 +755,7 @@ public class MapControlsLayer extends OsmandMapLayer {
|
||||||
routePlanningMode = true;
|
routePlanningMode = true;
|
||||||
}
|
}
|
||||||
boolean routeFollowingMode = !routePlanningMode && rh.isFollowingMode();
|
boolean routeFollowingMode = !routePlanningMode && rh.isFollowingMode();
|
||||||
boolean routeDialogOpened = MapRouteInfoMenu.isVisible();
|
boolean routeDialogOpened = mapRouteInfoMenu.isVisible();
|
||||||
boolean trackDialogOpened = TrackDetailsMenu.isVisible();
|
boolean trackDialogOpened = TrackDetailsMenu.isVisible();
|
||||||
boolean contextMenuOpened = !mapActivity.getContextMenu().shouldShowTopControls();
|
boolean contextMenuOpened = !mapActivity.getContextMenu().shouldShowTopControls();
|
||||||
boolean showRouteCalculationControls = routePlanningMode ||
|
boolean showRouteCalculationControls = routePlanningMode ||
|
||||||
|
|
|
@ -894,7 +894,7 @@ public class MapInfoWidgetsFactory {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
int di = MapRouteInfoMenu.getDirectionInfo();
|
int di = MapRouteInfoMenu.getDirectionInfo();
|
||||||
if (di >= 0 && MapRouteInfoMenu.isVisible() &&
|
if (di >= 0 && map.getMapRouteInfoMenu().isVisible() &&
|
||||||
di < routingHelper.getRouteDirections().size()) {
|
di < routingHelper.getRouteDirections().size()) {
|
||||||
showNextTurn = true;
|
showNextTurn = true;
|
||||||
RouteDirectionInfo next = routingHelper.getRouteDirections().get(di);
|
RouteDirectionInfo next = routingHelper.getRouteDirections().get(di);
|
||||||
|
|
|
@ -201,7 +201,7 @@ public class MapMarkersWidgetsFactory {
|
||||||
|| !map.getMyApplication().getSettings().MAP_MARKERS_MODE.get().isToolbar()
|
|| !map.getMyApplication().getSettings().MAP_MARKERS_MODE.get().isToolbar()
|
||||||
|| map.getMyApplication().getRoutingHelper().isFollowingMode()
|
|| map.getMyApplication().getRoutingHelper().isFollowingMode()
|
||||||
|| map.getMyApplication().getRoutingHelper().isRoutePlanningMode()
|
|| map.getMyApplication().getRoutingHelper().isRoutePlanningMode()
|
||||||
|| MapRouteInfoMenu.isVisible()
|
|| map.getMapRouteInfoMenu().isVisible()
|
||||||
|| addressTopBar.getVisibility() == View.VISIBLE
|
|| addressTopBar.getVisibility() == View.VISIBLE
|
||||||
|| map.isTopToolbarActive()
|
|| map.isTopToolbarActive()
|
||||||
|| !map.getContextMenu().shouldShowTopControls()
|
|| !map.getContextMenu().shouldShowTopControls()
|
||||||
|
|
|
@ -755,6 +755,7 @@ public class RouteInfoWidgetsFactory {
|
||||||
public static class LanesControl {
|
public static class LanesControl {
|
||||||
private MapViewTrackingUtilities trackingUtilities;
|
private MapViewTrackingUtilities trackingUtilities;
|
||||||
private OsmAndLocationProvider locationProvider;
|
private OsmAndLocationProvider locationProvider;
|
||||||
|
private MapRouteInfoMenu mapRouteInfoMenu;
|
||||||
private RoutingHelper rh;
|
private RoutingHelper rh;
|
||||||
private OsmandSettings settings;
|
private OsmandSettings settings;
|
||||||
private ImageView lanesView;
|
private ImageView lanesView;
|
||||||
|
@ -776,6 +777,7 @@ public class RouteInfoWidgetsFactory {
|
||||||
trackingUtilities = map.getMapViewTrackingUtilities();
|
trackingUtilities = map.getMapViewTrackingUtilities();
|
||||||
locationProvider = map.getMyApplication().getLocationProvider();
|
locationProvider = map.getMyApplication().getLocationProvider();
|
||||||
settings = map.getMyApplication().getSettings();
|
settings = map.getMyApplication().getSettings();
|
||||||
|
mapRouteInfoMenu = map.getMapRouteInfoMenu();
|
||||||
rh = map.getMyApplication().getRoutingHelper();
|
rh = map.getMyApplication().getRoutingHelper();
|
||||||
app = map.getMyApplication();
|
app = map.getMyApplication();
|
||||||
}
|
}
|
||||||
|
@ -817,7 +819,7 @@ public class RouteInfoWidgetsFactory {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
int di = MapRouteInfoMenu.getDirectionInfo();
|
int di = MapRouteInfoMenu.getDirectionInfo();
|
||||||
if (di >= 0 && MapRouteInfoMenu.isVisible()
|
if (di >= 0 && mapRouteInfoMenu.isVisible()
|
||||||
&& di < rh.getRouteDirections().size()) {
|
&& di < rh.getRouteDirections().size()) {
|
||||||
RouteDirectionInfo next = rh.getRouteDirections().get(di);
|
RouteDirectionInfo next = rh.getRouteDirections().get(di);
|
||||||
if (next != null) {
|
if (next != null) {
|
||||||
|
|
Loading…
Reference in a new issue