Merge pull request #9790 from osmandapp/Fix_9775

Fix_9775
This commit is contained in:
vshcherb 2020-09-11 16:29:27 +02:00 committed by GitHub
commit e90a7127ad
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 3 deletions

View file

@ -168,6 +168,10 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route
this.planRouteMode = planRouteMode;
}
private void setDirectionMode(boolean directionMode) {
this.directionMode = directionMode;
}
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
@ -1933,10 +1937,12 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route
return showFragment(fragment, fragmentManager);
}
public static boolean showInstance(FragmentManager fragmentManager, MeasurementEditingContext editingCtx, boolean planRoute) {
public static boolean showInstance(FragmentManager fragmentManager, MeasurementEditingContext editingCtx,
boolean planRoute, boolean directionMode) {
MeasurementToolFragment fragment = new MeasurementToolFragment();
fragment.setEditingCtx(editingCtx);
fragment.setPlanRouteMode(planRoute);
fragment.setDirectionMode(directionMode);
return showFragment(fragment, fragmentManager);
}

View file

@ -82,6 +82,7 @@ public class FollowTrackFragment extends ContextMenuScrollFragment implements Ca
private GPXFile gpxFile;
private boolean editingTrack;
private boolean selectingTrack;
private int menuTitleHeight;
@ -529,6 +530,7 @@ public class FollowTrackFragment extends ContextMenuScrollFragment implements Ca
public void openPlanRoute(boolean useAppMode) {
MapActivity mapActivity = getMapActivity();
if (mapActivity != null && gpxFile != null) {
editingTrack = true;
QuadRect rect = gpxFile.getRect();
TrkSegment segment = gpxFile.getNonEmptyTrkSegment();
ActionType actionType = segment == null ? ActionType.ADD_ROUTE_POINTS : ActionType.EDIT_SEGMENT;
@ -538,7 +540,7 @@ public class FollowTrackFragment extends ContextMenuScrollFragment implements Ca
if (useAppMode) {
editingContext.setAppMode(app.getRoutingHelper().getAppMode());
}
MeasurementToolFragment.showInstance(mapActivity.getSupportFragmentManager(), editingContext, true);
MeasurementToolFragment.showInstance(mapActivity.getSupportFragmentManager(), editingContext, true, true);
}
}
@ -609,7 +611,7 @@ public class FollowTrackFragment extends ContextMenuScrollFragment implements Ca
private void onDismiss() {
try {
MapActivity mapActivity = getMapActivity();
if (mapActivity != null) {
if (mapActivity != null && !editingTrack) {
if (!mapActivity.isChangingConfigurations()) {
mapActivity.getMapRouteInfoMenu().cancelSelectionFromTracks();
}

View file

@ -1566,6 +1566,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
if (mapActivity != null) {
GPXRouteParamsBuilder routeParams = mapActivity.getRoutingHelper().getCurrentGPXRoute();
if (routeParams != null) {
hide();
selectTrack();
}
}