This commit is contained in:
parent
70366e6b76
commit
a14fd90eab
7 changed files with 58 additions and 34 deletions
|
@ -143,6 +143,7 @@ public class MapActivity extends AccessibleActivity implements DownloadEvents,
|
|||
private AppInitializeListener initListener;
|
||||
private IMapDownloaderCallback downloaderCallback;
|
||||
private DrawerLayout drawerLayout;
|
||||
private boolean drawerDisabled;
|
||||
|
||||
private Notification getNotification() {
|
||||
Intent notificationIndent = new Intent(this, getMyApplication().getAppCustomization().getMapActivity());
|
||||
|
@ -1034,13 +1035,19 @@ public class MapActivity extends AccessibleActivity implements DownloadEvents,
|
|||
}
|
||||
|
||||
public void disableDrawer() {
|
||||
drawerDisabled = true;
|
||||
drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
|
||||
}
|
||||
|
||||
public void enableDrawer() {
|
||||
drawerDisabled = false;
|
||||
drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED);
|
||||
}
|
||||
|
||||
public boolean isDrawerDisabled() {
|
||||
return drawerDisabled;
|
||||
}
|
||||
|
||||
public void closeDrawer() {
|
||||
drawerLayout.closeDrawer(Gravity.LEFT);
|
||||
}
|
||||
|
|
|
@ -416,9 +416,7 @@ public class MapActivityActions implements DialogProvider {
|
|||
app.getRoutingHelper().setFollowingMode(false);
|
||||
app.getRoutingHelper().setRoutePlanningMode(true);
|
||||
// reset start point
|
||||
if (targets.getPointToStart() == null) {
|
||||
targets.setStartPoint(from, false, fromName);
|
||||
}
|
||||
targets.setStartPoint(from, false, fromName);
|
||||
// then set gpx
|
||||
setGPXRouteParams(gpxFile);
|
||||
// then update start and destination point
|
||||
|
|
|
@ -168,7 +168,9 @@ public class FailSafeFuntions {
|
|||
app.getSettings().FOLLOW_THE_GPX_ROUTE.set(null);
|
||||
}
|
||||
routingHelper.setGpxParams(gpxRoute);
|
||||
app.getTargetPointsHelper().setStartPoint(null, false, null);
|
||||
if (app.getTargetPointsHelper().getPointToStart() == null) {
|
||||
app.getTargetPointsHelper().setStartPoint(null, false, null);
|
||||
}
|
||||
app.getSettings().FOLLOW_THE_ROUTE.set(true);
|
||||
routingHelper.setFollowingMode(true);
|
||||
app.getTargetPointsHelper().updateRouteAndRefresh(true);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package net.osmand.plus.base;
|
||||
|
||||
import java.util.List;
|
||||
import android.content.Context;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import net.osmand.Location;
|
||||
import net.osmand.StateChangedListener;
|
||||
|
@ -16,7 +17,6 @@ import net.osmand.plus.OsmandSettings;
|
|||
import net.osmand.plus.OsmandSettings.AutoZoomMap;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.TargetPointsHelper.TargetPoint;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.dashboard.DashboardOnMap;
|
||||
import net.osmand.plus.mapcontextmenu.MapContextMenu;
|
||||
import net.osmand.plus.routing.RoutingHelper;
|
||||
|
@ -24,8 +24,8 @@ import net.osmand.plus.routing.RoutingHelper.IRouteInformationListener;
|
|||
import net.osmand.plus.views.AnimateDraggingMapThread;
|
||||
import net.osmand.plus.views.OsmandMapTileView;
|
||||
import net.osmand.util.MapUtils;
|
||||
import android.content.Context;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class MapViewTrackingUtilities implements OsmAndLocationListener, IMapLocationListener, OsmAndCompassListener, IRouteInformationListener {
|
||||
private static final int AUTO_FOLLOW_MSG_ID = OsmAndConstants.UI_HANDLER_LOCATION_SERVICE + 4;
|
||||
|
@ -272,7 +272,7 @@ public class MapViewTrackingUtilities implements OsmAndLocationListener, IMapLoc
|
|||
app.runMessageInUIThreadAndCancelPrevious(AUTO_FOLLOW_MSG_ID, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (mapView != null && !isMapLinkedToLocation()) {
|
||||
if (mapView != null && !isMapLinkedToLocation() && contextMenu == null) {
|
||||
app.showToastMessage(R.string.auto_follow_location_enabled);
|
||||
backToLocationImpl();
|
||||
}
|
||||
|
@ -285,9 +285,9 @@ public class MapViewTrackingUtilities implements OsmAndLocationListener, IMapLoc
|
|||
}
|
||||
|
||||
public void setMapLinkedToLocation(boolean isMapLinkedToLocation) {
|
||||
if(!isMapLinkedToLocation){
|
||||
if (!isMapLinkedToLocation) {
|
||||
int autoFollow = settings.AUTO_FOLLOW_ROUTE.get();
|
||||
if(autoFollow > 0 && app.getRoutingHelper().isFollowingMode() && !routePlanningMode){
|
||||
if (autoFollow > 0 && app.getRoutingHelper().isFollowingMode() && !routePlanningMode) {
|
||||
backToLocationWithDelay(autoFollow);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -95,6 +95,7 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
|||
private boolean nightMode;
|
||||
private boolean centered;
|
||||
private boolean initLayout = true;
|
||||
private boolean wasDrawerDisabled;
|
||||
|
||||
private float skipHalfScreenStateLimit;
|
||||
|
||||
|
@ -657,14 +658,21 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
|||
return;
|
||||
}
|
||||
screenOrientation = DashLocationFragment.getScreenOrientation(getActivity());
|
||||
if (menu.displayDistanceDirection()) {
|
||||
getMapActivity().getMapViewTrackingUtilities().setContextMenu(menu);
|
||||
getMapActivity().getMapViewTrackingUtilities().setContextMenu(menu);
|
||||
getMapActivity().getMapViewTrackingUtilities().setMapLinkedToLocation(false);
|
||||
wasDrawerDisabled = getMapActivity().isDrawerDisabled();
|
||||
if (!wasDrawerDisabled) {
|
||||
getMapActivity().disableDrawer();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
getMapActivity().getMapViewTrackingUtilities().setContextMenu(null);
|
||||
getMapActivity().getMapViewTrackingUtilities().setMapLinkedToLocation(false);
|
||||
if (!wasDrawerDisabled) {
|
||||
getMapActivity().enableDrawer();
|
||||
}
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
|
|
|
@ -24,29 +24,30 @@ public class TargetPointMenuController extends MenuController {
|
|||
final int intermediatePointsCount = targetPointsHelper.getIntermediatePoints().size();
|
||||
RoutingHelper routingHelper = getMapActivity().getMyApplication().getRoutingHelper();
|
||||
final boolean nav = routingHelper.isRoutePlanningMode() || routingHelper.isFollowingMode();
|
||||
if (!targetPoint.start) {
|
||||
leftTitleButtonController = new TitleButtonController() {
|
||||
@Override
|
||||
public void buttonPressed() {
|
||||
TargetPoint tp = getTargetPoint();
|
||||
if (tp.intermediate) {
|
||||
targetPointsHelper.removeWayPoint(true, tp.index);
|
||||
} else {
|
||||
targetPointsHelper.removeWayPoint(true, -1);
|
||||
}
|
||||
getMapActivity().getContextMenu().close();
|
||||
if (nav && intermediatePointsCount == 0) {
|
||||
getMapActivity().getMapActions().stopNavigationWithoutConfirm();
|
||||
}
|
||||
leftTitleButtonController = new TitleButtonController() {
|
||||
@Override
|
||||
public void buttonPressed() {
|
||||
TargetPoint tp = getTargetPoint();
|
||||
if (tp.start) {
|
||||
getMapActivity().getMyApplication().getTargetPointsHelper().clearStartPoint(true);
|
||||
} else if (tp.intermediate) {
|
||||
targetPointsHelper.removeWayPoint(true, tp.index);
|
||||
} else {
|
||||
targetPointsHelper.removeWayPoint(true, -1);
|
||||
}
|
||||
getMapActivity().getContextMenu().close();
|
||||
if (nav && intermediatePointsCount == 0 && !tp.start) {
|
||||
getMapActivity().getMapActions().stopNavigationWithoutConfirm();
|
||||
getMapActivity().getMyApplication().getTargetPointsHelper().clearStartPoint(false);
|
||||
}
|
||||
};
|
||||
if (nav && intermediatePointsCount == 0) {
|
||||
leftTitleButtonController.caption = getMapActivity().getString(R.string.cancel_navigation);
|
||||
leftTitleButtonController.leftIconId = R.drawable.ic_action_remove_dark;
|
||||
} else {
|
||||
leftTitleButtonController.caption = getMapActivity().getString(R.string.shared_string_remove);
|
||||
leftTitleButtonController.leftIconId = R.drawable.ic_action_delete_dark;
|
||||
}
|
||||
};
|
||||
if (nav && intermediatePointsCount == 0 && !targetPoint.start) {
|
||||
leftTitleButtonController.caption = getMapActivity().getString(R.string.cancel_navigation);
|
||||
leftTitleButtonController.leftIconId = R.drawable.ic_action_remove_dark;
|
||||
} else {
|
||||
leftTitleButtonController.caption = getMapActivity().getString(R.string.shared_string_remove);
|
||||
leftTitleButtonController.leftIconId = R.drawable.ic_action_delete_dark;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@ public class MapMultiSelectionMenuFragment extends Fragment implements AdapterVi
|
|||
private ArrayAdapter<MenuObject> listAdapter;
|
||||
private MapMultiSelectionMenu menu;
|
||||
private boolean dismissing = false;
|
||||
private boolean wasDrawerDisabled;
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
|
@ -67,6 +68,10 @@ public class MapMultiSelectionMenuFragment extends Fragment implements AdapterVi
|
|||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
wasDrawerDisabled = menu.getMapActivity().isDrawerDisabled();
|
||||
if (!wasDrawerDisabled) {
|
||||
menu.getMapActivity().disableDrawer();
|
||||
}
|
||||
menu.getMapActivity().getMapLayers().getMapControlsLayer().setControlsClickable(false);
|
||||
menu.getMapActivity().getContextMenu().setBaseFragmentVisibility(false);
|
||||
}
|
||||
|
@ -79,6 +84,9 @@ public class MapMultiSelectionMenuFragment extends Fragment implements AdapterVi
|
|||
}
|
||||
menu.getMapActivity().getContextMenu().setBaseFragmentVisibility(true);
|
||||
menu.getMapActivity().getMapLayers().getMapControlsLayer().setControlsClickable(true);
|
||||
if (!wasDrawerDisabled) {
|
||||
menu.getMapActivity().enableDrawer();
|
||||
}
|
||||
}
|
||||
|
||||
public static void showInstance(final MapActivity mapActivity) {
|
||||
|
|
Loading…
Reference in a new issue