From d6bd0e414567faa358d9d09d7d724a7acca1c935 Mon Sep 17 00:00:00 2001 From: androiddevkotlin <64539346+androiddevkotlin@users.noreply.github.com> Date: Mon, 15 Mar 2021 22:45:02 +0200 Subject: [PATCH] init --- .../GpxApproximationFragment.java | 10 +++++++++ .../MeasurementToolFragment.java | 6 ++++-- .../FollowTrackFragment.java | 21 +++++++++++-------- 3 files changed, 26 insertions(+), 11 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/GpxApproximationFragment.java b/OsmAnd/src/net/osmand/plus/measurementtool/GpxApproximationFragment.java index 132f48b6a5..cea8ff65a4 100644 --- a/OsmAnd/src/net/osmand/plus/measurementtool/GpxApproximationFragment.java +++ b/OsmAnd/src/net/osmand/plus/measurementtool/GpxApproximationFragment.java @@ -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); diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java index 74f636802a..fcc7f0ca03 100644 --- a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java +++ b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java @@ -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); } diff --git a/OsmAnd/src/net/osmand/plus/routepreparationmenu/FollowTrackFragment.java b/OsmAnd/src/net/osmand/plus/routepreparationmenu/FollowTrackFragment.java index b5abb80b65..a5209eac18 100644 --- a/OsmAnd/src/net/osmand/plus/routepreparationmenu/FollowTrackFragment.java +++ b/OsmAnd/src/net/osmand/plus/routepreparationmenu/FollowTrackFragment.java @@ -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); } }