public static BottomSheetDialog bottomSheetDialogWithActionbar(final Context context, final View contentView, final CharSequence title) {

        final BottomsheetDialogWithActionbarBinding dialogView = BottomsheetDialogWithActionbarBinding.inflate(LayoutInflater.from(newContextThemeWrapper(context)));
        final BottomSheetDialog dialog = bottomSheetDialog(context, dialogView.getRoot());

        dialogView.toolbar.setTitle(title);
        dialogView.contentWrapper.addView(contentView);

        dialogView.toolbar.setNavigationOnClickListener(v -> {
            if (dialog.getBehavior().getState() == BottomSheetBehavior.STATE_EXPANDED) {
                dialog.dismiss();
            } else {
                dialog.getBehavior().setState(BottomSheetBehavior.STATE_EXPANDED);
            }
        });

        dialog.setOnShowListener(dialog1 -> {
            // provide rather much information directly without need to scroll up
            // this will expand the dialog even when being in landscape mode
            // and will set to expanded the state automatically if the dialog can't be expanded even further
            dialog.getBehavior().setHalfExpandedRatio(0.8f);
            dialog.getBehavior().setState(BottomSheetBehavior.STATE_HALF_EXPANDED);
            dialog.getBehavior().setSkipCollapsed(true);

            updateActionbarAfterStateChange(dialog, dialogView);
        });

        dialog.getBehavior().addBottomSheetCallback(new BottomSheetBehavior.BottomSheetCallback() {
            private boolean closeOnRelease = false;

            @Override
            public void onStateChanged(final @NonNull View bottomSheet, final int newState) {
                if (newState != BottomSheetBehavior.STATE_DRAGGING && closeOnRelease) {
                    dialog.dismiss();
                } else {
                    updateActionbarAfterStateChange(dialog, dialogView);
                }
            }

            @Override
            public void onSlide(final @NonNull View bottomSheet, final float slideOffset) {
                // make closing the dialog easier
                closeOnRelease = slideOffset < -0.2;
            }
        });

        return dialog;
    }
create a bottom sheet dialog with action bar
main/src/main/java/cgeo/geocaching/ui/dialog/Dialogs.java