Use bottom sheet behaviour for plan route dialogs

This commit is contained in:
Vitaliy 2020-09-10 14:07:05 +03:00
parent 029b555667
commit 463972f8a5
3 changed files with 55 additions and 62 deletions

View file

@ -1,16 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:osmand="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/title"
android:layout_width="wrap_content"
@ -62,5 +57,3 @@
tools:listitem="@layout/gpx_track_select_item" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>

View file

@ -18,7 +18,7 @@ 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;
@ -32,7 +32,7 @@ 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();
@ -228,7 +228,7 @@ public class RouteBetweenPointsBottomSheetDialogFragment extends MenuBottomSheet
}
@Override
protected int getCustomHeight() {
protected int getPeekHeight() {
return AndroidUtils.dpToPx(getContext(), BOTTOM_SHEET_HEIGHT_DP);
}

View file

@ -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),
@ -173,8 +173,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) {