This commit is contained in:
androiddevkotlin 2021-03-15 22:45:02 +02:00
parent b7dd8dca05
commit d6bd0e4145
3 changed files with 26 additions and 11 deletions

View file

@ -21,6 +21,7 @@ import net.osmand.GPXUtilities.WptPt;
import net.osmand.LocationsHolder;
import net.osmand.PlatformUtil;
import net.osmand.ResultMatcher;
import net.osmand.plus.LockableScrollView;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.UiUtilities;
@ -157,6 +158,15 @@ public class GpxApproximationFragment extends ContextMenuScrollFragment
updateCardsLayout();
}
updateCards();
final LockableScrollView profileContainer = mainView.findViewById(R.id.route_menu_bottom_scroll);
profileContainer.postDelayed(new Runnable() {
@Override
public void run() {
if (snapToRoadAppMode.getOrder() > 4) {
profileContainer.fullScroll(View.FOCUS_DOWN);
}
}
}, 100);
updateButtons(mainView);
progressBar = mainView.findViewById(R.id.progress_bar);

View file

@ -554,7 +554,6 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route
});
initMeasurementMode(gpxData, savedInstanceState == null);
if (savedInstanceState == null) {
if (fileName != null) {
addNewGpxData(getGpxFile(fileName));
@ -1959,10 +1958,13 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route
}
public static boolean showInstance(FragmentManager fragmentManager, MeasurementEditingContext editingCtx,
boolean followTrackMode) {
boolean followTrackMode, boolean isShowSnapWarning) {
MeasurementToolFragment fragment = new MeasurementToolFragment();
fragment.setEditingCtx(editingCtx);
fragment.setMode(FOLLOW_TRACK_MODE, followTrackMode);
Bundle bundle = new Bundle();
bundle.putBoolean("isShowSnapWarning", isShowSnapWarning);
fragment.setArguments(bundle);
return showFragment(fragment, fragmentManager);
}

View file

@ -446,15 +446,18 @@ public class FollowTrackFragment extends ContextMenuScrollFragment implements Ca
if (mapActivity != null) {
if (card instanceof ImportTrackCard) {
importTrack();
} else if (card instanceof TrackEditCard || card instanceof AttachTrackToRoadsCard) {
openPlanRoute();
} else if (card instanceof AttachTrackToRoadsCard) {
openPlanRoute(true);
close();
} else if (card instanceof TrackEditCard) {
openPlanRoute(false);
close();
} else if (card instanceof SelectTrackCard) {
updateSelectionMode(true);
} else if (card instanceof ReverseTrackCard
|| card instanceof NavigateTrackOptionsCard) {
updateMenu();
}
} else if (card instanceof SelectTrackCard) {
updateSelectionMode(true);
} else if (card instanceof ReverseTrackCard
|| card instanceof NavigateTrackOptionsCard) {
updateMenu();
}
}
@ -574,7 +577,7 @@ public class FollowTrackFragment extends ContextMenuScrollFragment implements Ca
}
}
public void openPlanRoute() {
public void openPlanRoute(boolean showSnapWarning) {
MapActivity mapActivity = getMapActivity();
if (mapActivity != null && gpxFile != null) {
editingTrack = true;
@ -583,7 +586,7 @@ public class FollowTrackFragment extends ContextMenuScrollFragment implements Ca
editingContext.setGpxData(gpxData);
editingContext.setAppMode(app.getRoutingHelper().getAppMode());
editingContext.setSelectedSegment(app.getSettings().GPX_ROUTE_SEGMENT.get());
MeasurementToolFragment.showInstance(mapActivity.getSupportFragmentManager(), editingContext, true);
MeasurementToolFragment.showInstance(mapActivity.getSupportFragmentManager(), editingContext, true, showSnapWarning);
}
}