diff --git a/OsmAnd/res/drawable/bottom_sheet_buttons_bg_dark.xml b/OsmAnd/res/drawable/bottom_sheet_buttons_bg_dark.xml
new file mode 100644
index 0000000000..1322edb6cb
--- /dev/null
+++ b/OsmAnd/res/drawable/bottom_sheet_buttons_bg_dark.xml
@@ -0,0 +1,11 @@
+
+
+ -
+
+
+ -
+
+
+
+
+
\ No newline at end of file
diff --git a/OsmAnd/res/drawable/bottom_sheet_buttons_bg_light.xml b/OsmAnd/res/drawable/bottom_sheet_buttons_bg_light.xml
new file mode 100644
index 0000000000..cfc0b32c50
--- /dev/null
+++ b/OsmAnd/res/drawable/bottom_sheet_buttons_bg_light.xml
@@ -0,0 +1,11 @@
+
+
+ -
+
+
+ -
+
+
+
+
+
\ No newline at end of file
diff --git a/OsmAnd/res/layout/bottom_sheet_behaviour_base.xml b/OsmAnd/res/layout/bottom_sheet_behaviour_base.xml
new file mode 100644
index 0000000000..1f54a2b8d1
--- /dev/null
+++ b/OsmAnd/res/layout/bottom_sheet_behaviour_base.xml
@@ -0,0 +1,50 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
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 da5f1dff61..362dacf2c6 100644
--- a/OsmAnd/res/layout/bottom_sheet_plan_route_select_file.xml
+++ b/OsmAnd/res/layout/bottom_sheet_plan_route_select_file.xml
@@ -1,66 +1,59 @@
-
-
+
+
+
+
+ android:clipToPadding="false"
+ android:orientation="horizontal"
+ android:paddingStart="@dimen/content_padding"
+ android:paddingLeft="@dimen/content_padding"
+ android:paddingEnd="@dimen/content_padding"
+ android:paddingRight="@dimen/content_padding"
+ tools:itemCount="3"
+ tools:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
+ tools:listitem="@layout/point_editor_icon_category_item"
+ tools:orientation="horizontal" />
-
+
-
-
-
-
-
-
-
-
-
\ 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 a4aa9f312e..d43c589a9d 100644
--- a/OsmAnd/res/layout/bottom_sheet_plan_route_start.xml
+++ b/OsmAnd/res/layout/bottom_sheet_plan_route_start.xml
@@ -1,47 +1,40 @@
-
+ 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">
-
-
-
-
-
-
-
+ android:letterSpacing="@dimen/description_letter_spacing"
+ android:text="@string/plan_route_last_edited"
+ android:textColor="?attr/active_color_basic"
+ android:textSize="@dimen/default_desc_text_size"
+ osmand:typeface="@string/font_roboto_medium" />
-
\ No newline at end of file
+
+
+
\ No newline at end of file
diff --git a/OsmAnd/res/layout/fragment_route_between_points_bottom_sheet_dialog.xml b/OsmAnd/res/layout/fragment_route_between_points_bottom_sheet_dialog.xml
index 8e159a161e..49a09730d6 100644
--- a/OsmAnd/res/layout/fragment_route_between_points_bottom_sheet_dialog.xml
+++ b/OsmAnd/res/layout/fragment_route_between_points_bottom_sheet_dialog.xml
@@ -1,36 +1,32 @@
-
+ android:layout_height="wrap_content"
+ android:background="?attr/bg_color"
+ android:orientation="vertical">
+ android:orientation="vertical"
+ android:paddingBottom="@dimen/bottom_sheet_content_padding_small">
-
-
-
+ android:gravity="center_vertical"
+ android:paddingStart="@dimen/content_padding"
+ android:paddingLeft="@dimen/content_padding"
+ android:paddingTop="@dimen/measurement_tool_menu_title_padding_top"
+ android:paddingEnd="@dimen/content_padding"
+ android:paddingRight="@dimen/content_padding"
+ android:paddingBottom="@dimen/measurement_tool_menu_title_padding_bottom"
+ android:text="@string/route_between_points"
+ android:textAppearance="@style/TextAppearance.ListItemTitle"
+ osmand:typeface="@string/font_roboto_medium" />
-
+
-
-
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/OsmAnd/src/net/osmand/plus/base/BottomSheetBehaviourDialogFragment.java b/OsmAnd/src/net/osmand/plus/base/BottomSheetBehaviourDialogFragment.java
new file mode 100644
index 0000000000..332fb5be0e
--- /dev/null
+++ b/OsmAnd/src/net/osmand/plus/base/BottomSheetBehaviourDialogFragment.java
@@ -0,0 +1,282 @@
+package net.osmand.plus.base;
+
+import android.app.Activity;
+import android.app.Dialog;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.graphics.drawable.Drawable;
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.Window;
+import android.view.WindowManager;
+import android.widget.LinearLayout;
+
+import androidx.annotation.ColorInt;
+import androidx.annotation.ColorRes;
+import androidx.annotation.DrawableRes;
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.annotation.StringRes;
+import androidx.core.content.ContextCompat;
+import androidx.fragment.app.FragmentActivity;
+
+import com.google.android.material.bottomsheet.BottomSheetBehavior;
+
+import net.osmand.plus.OsmandApplication;
+import net.osmand.plus.R;
+import net.osmand.plus.UiUtilities;
+import net.osmand.plus.UiUtilities.DialogButtonType;
+import net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem;
+import net.osmand.plus.helpers.AndroidUiHelper;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public abstract class BottomSheetBehaviourDialogFragment extends BottomSheetDialogFragment {
+
+ private static final String USED_ON_MAP_KEY = "used_on_map";
+ private static final int DEFAULT_VALUE = -1;
+
+ protected List items = new ArrayList<>();
+
+ protected boolean usedOnMap = true;
+ protected boolean nightMode;
+ protected boolean portrait;
+
+ protected View dismissButton;
+ protected View rightButton;
+
+ private LinearLayout itemsContainer;
+
+ public void setUsedOnMap(boolean usedOnMap) {
+ this.usedOnMap = usedOnMap;
+ }
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ if (savedInstanceState != null) {
+ usedOnMap = savedInstanceState.getBoolean(USED_ON_MAP_KEY);
+ }
+ nightMode = isNightMode(requiredMyApplication());
+ portrait = AndroidUiHelper.isOrientationPortrait(requireActivity());
+ }
+
+ @Nullable
+ @Override
+ public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) {
+ LayoutInflater themedInflater = UiUtilities.getInflater(requireContext(), nightMode);
+ View mainView = themedInflater.inflate(R.layout.bottom_sheet_behaviour_base, parent, false);
+ itemsContainer = (LinearLayout) mainView.findViewById(R.id.items_container);
+
+ View scrollView = mainView.findViewById(R.id.bottom_sheet_scroll_view);
+ final BottomSheetBehavior behavior = BottomSheetBehavior.from(scrollView);
+ behavior.setPeekHeight(getPeekHeight());
+
+ LinearLayout buttonsContainer = (LinearLayout) mainView.findViewById(R.id.buttons_container);
+ buttonsContainer.setBackgroundResource(getButtonsContainerBg());
+
+ if (!portrait) {
+ Dialog dialog = getDialog();
+ if (dialog != null) {
+ dialog.setOnShowListener(new DialogInterface.OnShowListener() {
+ @Override
+ public void onShow(DialogInterface dialog) {
+ behavior.setState(BottomSheetBehavior.STATE_EXPANDED);
+ }
+ });
+ }
+ }
+
+ createMenuItems(savedInstanceState);
+ inflateMenuItems();
+
+ dismissButton = mainView.findViewById(R.id.dismiss_button);
+ UiUtilities.setupDialogButton(nightMode, dismissButton, getDismissButtonType(), getDismissButtonTextId());
+ dismissButton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ onDismissButtonClickAction();
+ dismiss();
+ }
+ });
+ if (hideButtonsContainer()) {
+ mainView.findViewById(R.id.buttons_container).setVisibility(View.GONE);
+ } else {
+ int rightBottomButtonTextId = getRightBottomButtonTextId();
+ if (rightBottomButtonTextId != DEFAULT_VALUE) {
+ mainView.findViewById(R.id.buttons_divider).setVisibility(View.VISIBLE);
+ rightButton = mainView.findViewById(R.id.right_bottom_button);
+ UiUtilities.setupDialogButton(nightMode, rightButton, getRightBottomButtonType(), rightBottomButtonTextId);
+ rightButton.setVisibility(View.VISIBLE);
+ rightButton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ onRightBottomButtonClick();
+ }
+ });
+ }
+ }
+ updateBackground();
+ updateBottomButtons();
+ return mainView;
+ }
+
+ @Override
+ public void onStart() {
+ super.onStart();
+ FragmentActivity activity = requireActivity();
+ if (!AndroidUiHelper.isOrientationPortrait(activity)) {
+ Dialog dialog = getDialog();
+ Window window = dialog != null ? dialog.getWindow() : null;
+ if (window != null) {
+ WindowManager.LayoutParams params = window.getAttributes();
+ params.width = activity.getResources().getDimensionPixelSize(R.dimen.landscape_bottom_sheet_dialog_fragment_width);
+ window.setAttributes(params);
+ }
+ }
+ }
+
+ @Override
+ public void onSaveInstanceState(@NonNull Bundle outState) {
+ super.onSaveInstanceState(outState);
+ outState.putBoolean(USED_ON_MAP_KEY, usedOnMap);
+ }
+
+ @Override
+ public void onDestroyView() {
+ super.onDestroyView();
+ items.clear();
+ if (itemsContainer != null) {
+ itemsContainer.removeAllViews();
+ }
+ }
+
+ public abstract void createMenuItems(Bundle savedInstanceState);
+
+ protected void inflateMenuItems() {
+ Activity activity = requireActivity();
+ for (BaseBottomSheetItem item : items) {
+ item.inflate(activity, itemsContainer, nightMode);
+ }
+ }
+
+ @Override
+ protected Drawable getContentIcon(@DrawableRes int id) {
+ return getIcon(id, nightMode ? R.color.icon_color_default_dark : R.color.icon_color_default_light);
+ }
+
+ protected Drawable getActiveIcon(@DrawableRes int id) {
+ return getIcon(id, getActiveColorId());
+ }
+
+ @ColorRes
+ protected int getActiveColorId() {
+ return nightMode ? R.color.osmand_orange : R.color.color_myloc_distance;
+ }
+
+ @ColorInt
+ protected int getResolvedColor(@ColorRes int colorId) {
+ Context ctx = getContext();
+ return ctx != null ? ContextCompat.getColor(ctx, colorId) : 0;
+ }
+
+ private void updateBackground() {
+ if (portrait) {
+ itemsContainer.setBackgroundResource(getPortraitBgResId());
+ } else {
+ itemsContainer.setBackgroundResource(getLandscapeTopsidesBgResId());
+ }
+ }
+
+ protected int getPeekHeight() {
+ return DEFAULT_VALUE;
+ }
+
+ protected boolean hideButtonsContainer() {
+ return false;
+ }
+
+ @StringRes
+ protected int getDismissButtonTextId() {
+ return R.string.shared_string_cancel;
+ }
+
+ protected DialogButtonType getDismissButtonType() {
+ return DialogButtonType.SECONDARY;
+ }
+
+ protected void onDismissButtonClickAction() {
+
+ }
+
+ @StringRes
+ protected int getRightBottomButtonTextId() {
+ return DEFAULT_VALUE;
+ }
+
+ protected DialogButtonType getRightBottomButtonType() {
+ return DialogButtonType.PRIMARY;
+ }
+
+ protected void onRightBottomButtonClick() {
+
+ }
+
+ protected boolean isDismissButtonEnabled() {
+ return true;
+ }
+
+ protected boolean isRightBottomButtonEnabled() {
+ return true;
+ }
+
+ protected void updateBottomButtons() {
+ if (dismissButton != null) {
+ boolean enabled = isDismissButtonEnabled();
+ dismissButton.setEnabled(enabled);
+ dismissButton.findViewById(R.id.button_text).setEnabled(enabled);
+ }
+ if (rightButton != null) {
+ boolean enabled = isRightBottomButtonEnabled();
+ rightButton.setEnabled(enabled);
+ rightButton.findViewById(R.id.button_text).setEnabled(enabled);
+ }
+ }
+
+ @ColorRes
+ protected int getBgColorId() {
+ return nightMode ? R.color.list_background_color_dark : R.color.list_background_color_light;
+ }
+
+ @DrawableRes
+ protected int getPortraitBgResId() {
+ return nightMode ? R.drawable.bg_bottom_menu_dark : R.drawable.bg_bottom_menu_light;
+ }
+
+ @DrawableRes
+ protected int getLandscapeTopsidesBgResId() {
+ return nightMode ? R.drawable.bg_bottom_sheet_topsides_landscape_dark : R.drawable.bg_bottom_sheet_topsides_landscape_light;
+ }
+
+ @DrawableRes
+ protected int getLandscapeSidesBgResId() {
+ return nightMode ? R.drawable.bg_bottom_sheet_sides_landscape_dark : R.drawable.bg_bottom_sheet_sides_landscape_light;
+ }
+
+ private int getButtonsContainerBg() {
+ if (portrait) {
+ return getBgColorId();
+ }
+ return nightMode ? R.drawable.bottom_sheet_buttons_bg_dark : R.drawable.bottom_sheet_buttons_bg_light;
+ }
+
+ protected boolean isNightMode(@NonNull OsmandApplication app) {
+ if (usedOnMap) {
+ return app.getDaynightHelper().isNightModeForMapControls();
+ }
+ return !app.getSettings().isLightContent();
+ }
+}
\ No newline at end of file
diff --git a/OsmAnd/src/net/osmand/plus/base/ContextMenuFragment.java b/OsmAnd/src/net/osmand/plus/base/ContextMenuFragment.java
index 57928eac50..5cb595f0ff 100644
--- a/OsmAnd/src/net/osmand/plus/base/ContextMenuFragment.java
+++ b/OsmAnd/src/net/osmand/plus/base/ContextMenuFragment.java
@@ -612,6 +612,10 @@ public abstract class ContextMenuFragment extends BaseOsmAndFragment {
}
}
+ protected boolean isHideable() {
+ return true;
+ }
+
private void processScreenHeight(ViewParent parent) {
View container = (View) parent;
MapActivity mapActivity = getMapActivity();
@@ -783,7 +787,7 @@ public abstract class ContextMenuFragment extends BaseOsmAndFragment {
private int getPosY(final int currentY, boolean needCloseMenu, int previousState) {
- if (needCloseMenu) {
+ if (needCloseMenu && isHideable()) {
return screenHeight;
}
MapActivity mapActivity = getMapActivity();
@@ -858,7 +862,7 @@ public abstract class ContextMenuFragment extends BaseOsmAndFragment {
@Override
public void onAnimationEnd(Animator animation) {
if (!canceled) {
- if (needCloseMenu) {
+ if (needCloseMenu && isHideable()) {
dismiss();
} else {
updateMainViewLayout(posY);
@@ -870,7 +874,7 @@ public abstract class ContextMenuFragment extends BaseOsmAndFragment {
}
}).start();
} else {
- if (needCloseMenu) {
+ if (needCloseMenu && isHideable()) {
dismiss();
} else {
mainView.setY(posY);
diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/GpxApproximationFragment.java b/OsmAnd/src/net/osmand/plus/measurementtool/GpxApproximationFragment.java
index 4217faf1c9..c2cdaf0ec1 100644
--- a/OsmAnd/src/net/osmand/plus/measurementtool/GpxApproximationFragment.java
+++ b/OsmAnd/src/net/osmand/plus/measurementtool/GpxApproximationFragment.java
@@ -56,6 +56,8 @@ public class GpxApproximationFragment extends ContextMenuScrollFragment
private View cancelButton;
private View applyButton;
+ private SliderCard sliderCard;
+
@Override
public int getMainLayoutId() {
return R.layout.fragment_gpx_approximation_bottom_sheet_dialog;
@@ -87,7 +89,7 @@ public class GpxApproximationFragment extends ContextMenuScrollFragment
@Override
public int getSupportedMenuStatesPortrait() {
- return MenuState.HALF_SCREEN | MenuState.FULL_SCREEN;
+ return MenuState.HEADER_ONLY | MenuState.HALF_SCREEN | MenuState.FULL_SCREEN;
}
@Override
@@ -175,11 +177,17 @@ public class GpxApproximationFragment extends ContextMenuScrollFragment
@Override
protected void calculateLayout(View view, boolean initLayout) {
+ int sliderHeight = sliderCard != null ? sliderCard.getViewHeight() : 0;
menuTitleHeight = view.findViewById(R.id.control_buttons).getHeight()
- - view.findViewById(R.id.buttons_shadow).getHeight();
+ - view.findViewById(R.id.buttons_shadow).getHeight() + sliderHeight;
super.calculateLayout(view, initLayout);
}
+ @Override
+ protected boolean isHideable() {
+ return false;
+ }
+
@Override
public void onSaveInstanceState(@NonNull Bundle outState) {
super.onSaveInstanceState(outState);
@@ -265,7 +273,7 @@ public class GpxApproximationFragment extends ContextMenuScrollFragment
cardsContainer.removeAllViews();
if (getTopView() != null) {
- SliderCard sliderCard = new SliderCard(mapActivity, distanceThreshold);
+ sliderCard = new SliderCard(mapActivity, distanceThreshold);
sliderCard.setListener(this);
getTopView().addView(sliderCard.build(mapActivity));
}
diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementEditingContext.java b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementEditingContext.java
index 88ec9f7975..e365348586 100644
--- a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementEditingContext.java
+++ b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementEditingContext.java
@@ -43,7 +43,7 @@ import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import static net.osmand.plus.measurementtool.MeasurementEditingContext.CalculationMode.WHOLE_TRACK;
-import static net.osmand.plus.measurementtool.command.MeasurementModeCommand.MeasurementCommandType.*;
+import static net.osmand.plus.measurementtool.command.MeasurementModeCommand.MeasurementCommandType.APPROXIMATE_POINTS;
public class MeasurementEditingContext {
@@ -249,8 +249,10 @@ public class MeasurementEditingContext {
Pair pair = new Pair<>(points.get(i), points.get(i + 1));
RoadSegmentData data = this.roadSegmentData.get(pair);
if (data == null) {
- distance += MapUtils.getDistance(pair.first.getLatitude(), pair.first.getLongitude(),
- pair.second.getLatitude(), pair.second.getLongitude());
+ if (appMode != MeasurementEditingContext.DEFAULT_APP_MODE || !pair.first.lastPoint || !pair.second.firstPoint) {
+ distance += MapUtils.getDistance(pair.first.getLatitude(), pair.first.getLongitude(),
+ pair.second.getLatitude(), pair.second.getLongitude());
+ }
} else {
distance += data.getDistance();
}
diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/RouteBetweenPointsBottomSheetDialogFragment.java b/OsmAnd/src/net/osmand/plus/measurementtool/RouteBetweenPointsBottomSheetDialogFragment.java
index abccad0131..77f3909e62 100644
--- a/OsmAnd/src/net/osmand/plus/measurementtool/RouteBetweenPointsBottomSheetDialogFragment.java
+++ b/OsmAnd/src/net/osmand/plus/measurementtool/RouteBetweenPointsBottomSheetDialogFragment.java
@@ -13,11 +13,12 @@ import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
+import net.osmand.AndroidUtils;
import net.osmand.PlatformUtil;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.UiUtilities;
-import net.osmand.plus.base.MenuBottomSheetDialogFragment;
+import net.osmand.plus.base.BottomSheetBehaviourDialogFragment;
import net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem;
import net.osmand.plus.settings.backend.ApplicationMode;
@@ -29,8 +30,9 @@ import java.util.List;
import static net.osmand.plus.UiUtilities.CustomRadioButtonType.LEFT;
import static net.osmand.plus.UiUtilities.CustomRadioButtonType.RIGHT;
import static net.osmand.plus.measurementtool.MeasurementEditingContext.DEFAULT_APP_MODE;
+import static net.osmand.plus.measurementtool.SelectFileBottomSheet.BOTTOM_SHEET_HEIGHT_DP;
-public class RouteBetweenPointsBottomSheetDialogFragment extends MenuBottomSheetDialogFragment {
+public class RouteBetweenPointsBottomSheetDialogFragment extends BottomSheetBehaviourDialogFragment {
private static final Log LOG = PlatformUtil.getLog(RouteBetweenPointsBottomSheetDialogFragment.class);
public static final String TAG = RouteBetweenPointsBottomSheetDialogFragment.class.getSimpleName();
@@ -225,6 +227,11 @@ public class RouteBetweenPointsBottomSheetDialogFragment extends MenuBottomSheet
items.add(new BaseBottomSheetItem.Builder().setCustomView(mainView).create());
}
+ @Override
+ protected int getPeekHeight() {
+ return AndroidUtils.dpToPx(getContext(), BOTTOM_SHEET_HEIGHT_DP);
+ }
+
@Override
protected int getDismissButtonTextId() {
return R.string.shared_string_close;
diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/SelectFileBottomSheet.java b/OsmAnd/src/net/osmand/plus/measurementtool/SelectFileBottomSheet.java
index b71ef4e267..c82bc1e9d5 100644
--- a/OsmAnd/src/net/osmand/plus/measurementtool/SelectFileBottomSheet.java
+++ b/OsmAnd/src/net/osmand/plus/measurementtool/SelectFileBottomSheet.java
@@ -15,7 +15,7 @@ import net.osmand.AndroidUtils;
import net.osmand.IndexConstants;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
-import net.osmand.plus.base.MenuBottomSheetDialogFragment;
+import net.osmand.plus.base.BottomSheetBehaviourDialogFragment;
import net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem;
import net.osmand.plus.helpers.GpxTrackAdapter;
import net.osmand.plus.helpers.GpxTrackAdapter.OnItemClickListener;
@@ -32,7 +32,7 @@ import java.util.Map;
import static net.osmand.plus.helpers.GpxUiHelper.getSortedGPXFilesInfo;
import static net.osmand.util.Algorithms.collectDirs;
-public class SelectFileBottomSheet extends MenuBottomSheetDialogFragment {
+public class SelectFileBottomSheet extends BottomSheetBehaviourDialogFragment {
enum Mode {
OPEN_TRACK(R.string.plan_route_open_existing_track, R.string.plan_route_select_track_file_for_open),
@@ -174,8 +174,8 @@ public class SelectFileBottomSheet extends MenuBottomSheetDialogFragment {
}
@Override
- protected int getCustomHeight() {
- return AndroidUtils.dpToPx(mainView.getContext(), BOTTOM_SHEET_HEIGHT_DP);
+ protected int getPeekHeight() {
+ return AndroidUtils.dpToPx(getContext(), BOTTOM_SHEET_HEIGHT_DP);
}
public static void showInstance(FragmentManager fragmentManager, SelectFileListener listener, Mode mode) {
diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/StartPlanRouteBottomSheet.java b/OsmAnd/src/net/osmand/plus/measurementtool/StartPlanRouteBottomSheet.java
index de235b0dc5..aedb65ee72 100644
--- a/OsmAnd/src/net/osmand/plus/measurementtool/StartPlanRouteBottomSheet.java
+++ b/OsmAnd/src/net/osmand/plus/measurementtool/StartPlanRouteBottomSheet.java
@@ -19,7 +19,7 @@ import net.osmand.IndexConstants;
import net.osmand.PlatformUtil;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
-import net.osmand.plus.base.MenuBottomSheetDialogFragment;
+import net.osmand.plus.base.BottomSheetBehaviourDialogFragment;
import net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem;
import net.osmand.plus.base.bottomsheetmenu.BottomSheetItemWithDescription;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerItem;
@@ -38,7 +38,7 @@ import java.util.List;
import static net.osmand.plus.helpers.GpxUiHelper.getSortedGPXFilesInfo;
-public class StartPlanRouteBottomSheet extends MenuBottomSheetDialogFragment {
+public class StartPlanRouteBottomSheet extends BottomSheetBehaviourDialogFragment {
public static final String TAG = StartPlanRouteBottomSheet.class.getSimpleName();
private static final Log LOG = PlatformUtil.getLog(StartPlanRouteBottomSheet.class);
@@ -136,8 +136,8 @@ public class StartPlanRouteBottomSheet extends MenuBottomSheetDialogFragment {
}
@Override
- protected int getCustomHeight() {
- return AndroidUtils.dpToPx(mainView.getContext(), BOTTOM_SHEET_HEIGHT_DP);
+ protected int getPeekHeight() {
+ return AndroidUtils.dpToPx(getContext(), BOTTOM_SHEET_HEIGHT_DP);
}
private void onItemClick(int position, List gpxInfoList) {