From 742fb68f45b0a922dd8c80af8a5a303b107b915c Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Tue, 25 Aug 2020 19:03:56 +0300 Subject: [PATCH 1/3] Plan route fixes first part --- .../bottom_sheet_plan_route_select_file.xml | 108 +++++++++--------- .../layout/bottom_sheet_plan_route_start.xml | 60 +++++----- ...etweenPointsBottomSheetDialogFragment.java | 9 +- 3 files changed, 96 insertions(+), 81 deletions(-) diff --git a/OsmAnd/res/layout/bottom_sheet_plan_route_select_file.xml b/OsmAnd/res/layout/bottom_sheet_plan_route_select_file.xml index 2e00611e3d..da5f1dff61 100644 --- a/OsmAnd/res/layout/bottom_sheet_plan_route_select_file.xml +++ b/OsmAnd/res/layout/bottom_sheet_plan_route_select_file.xml @@ -1,60 +1,66 @@ - - - - - - + android:orientation="vertical"> - + - - \ No newline at end of file + + + + + + + + + \ No newline at end of file diff --git a/OsmAnd/res/layout/bottom_sheet_plan_route_start.xml b/OsmAnd/res/layout/bottom_sheet_plan_route_start.xml index 84900e29d2..a4aa9f312e 100644 --- a/OsmAnd/res/layout/bottom_sheet_plan_route_start.xml +++ b/OsmAnd/res/layout/bottom_sheet_plan_route_start.xml @@ -1,41 +1,47 @@ - + android:orientation="vertical"> - + android:orientation="horizontal" + android:paddingStart="@dimen/content_padding" + android:paddingLeft="@dimen/content_padding" + android:paddingTop="@dimen/bottom_sheet_title_padding_top" + android:paddingEnd="@dimen/content_padding" + android:paddingRight="@dimen/content_padding" + android:paddingBottom="@dimen/bottom_sheet_title_padding_bottom"> + + + + + + - - - - \ No newline at end of file + \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/RouteBetweenPointsBottomSheetDialogFragment.java b/OsmAnd/src/net/osmand/plus/measurementtool/RouteBetweenPointsBottomSheetDialogFragment.java index a6348963ca..29f1294a42 100644 --- a/OsmAnd/src/net/osmand/plus/measurementtool/RouteBetweenPointsBottomSheetDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/measurementtool/RouteBetweenPointsBottomSheetDialogFragment.java @@ -34,7 +34,8 @@ import org.apache.commons.logging.Log; import java.util.ArrayList; import java.util.List; -import static net.osmand.plus.UiUtilities.CustomRadioButtonType.*; +import static net.osmand.plus.UiUtilities.CustomRadioButtonType.LEFT; +import static net.osmand.plus.UiUtilities.CustomRadioButtonType.RIGHT; import static net.osmand.plus.measurementtool.MeasurementEditingContext.CalculationMode.NEXT_SEGMENT; import static net.osmand.plus.measurementtool.MeasurementEditingContext.CalculationMode.WHOLE_TRACK; import static net.osmand.plus.measurementtool.MeasurementEditingContext.DEFAULT_APP_MODE; @@ -120,8 +121,10 @@ public class RouteBetweenPointsBottomSheetDialogFragment extends BottomSheetDial for (int i = 0; i < modes.size(); i++) { ApplicationMode mode = modes.get(i); - icon = app.getUIUtilities().getIcon(mode.getIconRes(), mode.getIconColorInfo().getColor(nightMode)); - addProfileView(navigationType, onClickListener, i, icon, mode.toHumanString(), mode.equals(appMode)); + if (!"public_transport".equals(mode.getRoutingProfile())) { + icon = app.getUIUtilities().getIcon(mode.getIconRes(), mode.getIconColorInfo().getColor(nightMode)); + addProfileView(navigationType, onClickListener, i, icon, mode.toHumanString(), mode.equals(appMode)); + } } segmentBtn.setOnClickListener(new View.OnClickListener() { From ff93fbc274a4436c4bb0ce0383e2bd4dae3507f0 Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Tue, 25 Aug 2020 21:07:38 +0300 Subject: [PATCH 2/3] Fix threshold distance scroll --- ...agment_gpx_approximation_bottom_sheet_dialog.xml | 10 ++++++++-- .../net/osmand/plus/base/ContextMenuFragment.java | 8 +++++++- .../measurementtool/GpxApproximationFragment.java | 13 ++++++++++--- .../MapRouteInfoMenuFragment.java | 4 ++-- 4 files changed, 27 insertions(+), 8 deletions(-) diff --git a/OsmAnd/res/layout/fragment_gpx_approximation_bottom_sheet_dialog.xml b/OsmAnd/res/layout/fragment_gpx_approximation_bottom_sheet_dialog.xml index 086fb5a66f..0d85fb98e5 100644 --- a/OsmAnd/res/layout/fragment_gpx_approximation_bottom_sheet_dialog.xml +++ b/OsmAnd/res/layout/fragment_gpx_approximation_bottom_sheet_dialog.xml @@ -13,6 +13,14 @@ + + + + - - diff --git a/OsmAnd/src/net/osmand/plus/base/ContextMenuFragment.java b/OsmAnd/src/net/osmand/plus/base/ContextMenuFragment.java index 664c2a8afe..57928eac50 100644 --- a/OsmAnd/src/net/osmand/plus/base/ContextMenuFragment.java +++ b/OsmAnd/src/net/osmand/plus/base/ContextMenuFragment.java @@ -66,6 +66,7 @@ public abstract class ContextMenuFragment extends BaseOsmAndFragment { private View view; private OnLayoutChangeListener containerLayoutListener; private View topShadow; + private ViewGroup topView; private View bottomScrollView; private LinearLayout cardsContainer; private FrameLayout bottomContainer; @@ -167,6 +168,11 @@ public abstract class ContextMenuFragment extends BaseOsmAndFragment { return mainView; } + @Nullable + public ViewGroup getTopView() { + return topView; + } + public boolean isNightMode() { return nightMode; } @@ -290,7 +296,7 @@ public abstract class ContextMenuFragment extends BaseOsmAndFragment { final int touchSlop = vc.getScaledTouchSlop(); if (getTopViewId() != 0) { - View topView = view.findViewById(getTopViewId()); + topView = view.findViewById(getTopViewId()); AndroidUtils.setBackground(app, topView, nightMode, R.color.card_and_list_background_light, R.color.card_and_list_background_dark); } if (!portrait) { diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/GpxApproximationFragment.java b/OsmAnd/src/net/osmand/plus/measurementtool/GpxApproximationFragment.java index 7c19d0db33..4217faf1c9 100644 --- a/OsmAnd/src/net/osmand/plus/measurementtool/GpxApproximationFragment.java +++ b/OsmAnd/src/net/osmand/plus/measurementtool/GpxApproximationFragment.java @@ -61,6 +61,11 @@ public class GpxApproximationFragment extends ContextMenuScrollFragment return R.layout.fragment_gpx_approximation_bottom_sheet_dialog; } + @Override + public int getTopViewId() { + return R.id.gpx_approximation_top_shadow_all; + } + @Override public int getHeaderViewHeight() { return menuTitleHeight; @@ -259,9 +264,11 @@ public class GpxApproximationFragment extends ContextMenuScrollFragment ViewGroup cardsContainer = getCardsContainer(); cardsContainer.removeAllViews(); - SliderCard sliderCard = new SliderCard(mapActivity, distanceThreshold); - sliderCard.setListener(this); - cardsContainer.addView(sliderCard.build(mapActivity)); + if (getTopView() != null) { + SliderCard sliderCard = new SliderCard(mapActivity, distanceThreshold); + sliderCard.setListener(this); + getTopView().addView(sliderCard.build(mapActivity)); + } ProfileCard profileCard = new ProfileCard(mapActivity, snapToRoadAppMode); profileCard.setListener(this); diff --git a/OsmAnd/src/net/osmand/plus/routepreparationmenu/MapRouteInfoMenuFragment.java b/OsmAnd/src/net/osmand/plus/routepreparationmenu/MapRouteInfoMenuFragment.java index 0f7f812f48..65f1bab915 100644 --- a/OsmAnd/src/net/osmand/plus/routepreparationmenu/MapRouteInfoMenuFragment.java +++ b/OsmAnd/src/net/osmand/plus/routepreparationmenu/MapRouteInfoMenuFragment.java @@ -477,8 +477,8 @@ public class MapRouteInfoMenuFragment extends ContextMenuFragment { AndroidUtils.setBackground(ctx, getCardsContainer(), isNightMode(), R.color.activity_background_light, R.color.activity_background_dark); - if (getTopViewId() != 0) { - View topView = view.findViewById(getTopViewId()); + if (getTopView() != null) { + View topView = getTopView(); AndroidUtils.setBackground(ctx, topView, isNightMode(), R.color.card_and_list_background_light, R.color.card_and_list_background_dark); } From 2d2cb1505302f6d8b3882eb0126757411dd21552 Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Wed, 26 Aug 2020 10:13:06 +0300 Subject: [PATCH 3/3] Hide public transport from plan route --- ...gment_gpx_approximation_bottom_sheet_dialog.xml | 14 ++++++++++++-- .../osmand/plus/measurementtool/ProfileCard.java | 9 ++++++++- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/OsmAnd/res/layout/fragment_gpx_approximation_bottom_sheet_dialog.xml b/OsmAnd/res/layout/fragment_gpx_approximation_bottom_sheet_dialog.xml index 0d85fb98e5..d43c0435ad 100644 --- a/OsmAnd/res/layout/fragment_gpx_approximation_bottom_sheet_dialog.xml +++ b/OsmAnd/res/layout/fragment_gpx_approximation_bottom_sheet_dialog.xml @@ -11,9 +11,19 @@ android:layout_height="wrap_content" android:orientation="vertical"> - + - + + + + + modes = new ArrayList<>(ApplicationMode.values(app)); modes.remove(ApplicationMode.DEFAULT); + Iterator iterator = modes.iterator(); + while (iterator.hasNext()) { + ApplicationMode mode = iterator.next(); + if ("public_transport".equals(mode.getRoutingProfile())) { + iterator.remove(); + } + } for (int i = 0; i < modes.size(); i++) { ApplicationMode mode = modes.get(i); LinearLayout container = view.findViewById(R.id.content_container);