Source:
<code>public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { final RecyclerView recyclerView = new RecyclerView(getContext()); final MapActivity mapActivity = (MapActivity) getActivity(); <START> boolean isSmartphone = getResources().getConfiguration().smallestScreenWidthDp < 600; <END> recyclerView.setPadding(0, 0, 0, AndroidUtils.dpToPx(mapActivity, isSmartphone ? 52 : 78)); recyclerView.setClipToPadding(false); recyclerView.setLayoutManager(new LinearLayoutManager(getContext())); adapter = new MapMarkersActiveAdapter(mapActivity); final ItemTouchHelper touchHelper = new ItemTouchHelper(new MapMarkersItemTouchHelperCallback(mapActivity, adapter)); touchHelper.attachToRecyclerView(recyclerView); adapter.setAdapterListener(new MapMarkersActiveAdapterListener() { private int fromPosition; private int toPosition; @Override public void onItemClick(View view) { int pos = recyclerView.getChildAdapterPosition(view); MapMarker marker = adapter.getItem(pos); mapActivity.getMyApplication().getSettings().setMapLocationToShow(marker.getLatitude(), marker.getLongitude(), 15, marker.getPointDescription(mapActivity), true, marker); MapActivity.launchMapActivityMoveToTop(mapActivity); ((DialogFragment) getParentFragment()).dismiss(); } @Override public void onDragStarted(RecyclerView.ViewHolder holder) { compassUpdateAllowed = false; fromPosition = holder.getAdapterPosition(); touchHelper.startDrag(holder); } @Override public void onDragOrSwipeEnded(RecyclerView.ViewHolder holder) { compassUpdateAllowed = true; toPosition = holder.getAdapterPosition(); if (toPosition >= 0 && fromPosition >= 0 && toPosition != fromPosition) { hideSnackbar(); mapActivity.getMyApplication().getMapMarkersHelper().reorderActiveMarkersIfNeeded(); adapter.notifyDataSetChanged(); mapActivity.getMyApplication().getSettings().MAP_MARKERS_ORDER_BY_MODE.set(OsmandSettings.MapMarkersOrderByMode.CUSTOM); } } @Override public void onSwipeStarted() { compassUpdateAllowed = false; } }); recyclerView.setAdapter(adapter); recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() { @Override public void onScrollStateChanged(RecyclerView recyclerView, int newState) { super.onScrollStateChanged(recyclerView, newState); compassUpdateAllowed = newState == RecyclerView.SCROLL_STATE_IDLE; } }); return recyclerView; }</code><technical_language>existing method extracted AndroidUtils</technical_language>

Target:
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { final RecyclerView recyclerView = new RecyclerView(getContext()); final MapActivity mapActivity = (MapActivity) getActivity(); recyclerView.setPadding(0, 0, 0, (int) mapActivity.getResources().getDimension(R.dimen.map_markers_recycler_view_padding_bottom)); recyclerView.setClipToPadding(false); recyclerView.setLayoutManager(new LinearLayoutManager(getContext())); adapter = new MapMarkersActiveAdapter(mapActivity); final ItemTouchHelper touchHelper = new ItemTouchHelper(new MapMarkersItemTouchHelperCallback(mapActivity, adapter)); touchHelper.attachToRecyclerView(recyclerView); adapter.setAdapterListener(new MapMarkersActiveAdapterListener() { private int fromPosition; private int toPosition; @Override public void onItemClick(View view) { int pos = recyclerView.getChildAdapterPosition(view); MapMarker marker = adapter.getItem(pos); mapActivity.getMyApplication().getSettings().setMapLocationToShow(marker.getLatitude(), marker.getLongitude(), 15, marker.getPointDescription(mapActivity), true, marker); MapActivity.launchMapActivityMoveToTop(mapActivity); ((DialogFragment) getParentFragment()).dismiss(); } @Override public void onDragStarted(RecyclerView.ViewHolder holder) { compassUpdateAllowed = false; fromPosition = holder.getAdapterPosition(); touchHelper.startDrag(holder); } @Override public void onDragOrSwipeEnded(RecyclerView.ViewHolder holder) { compassUpdateAllowed = true; toPosition = holder.getAdapterPosition(); if (toPosition >= 0 && fromPosition >= 0 && toPosition != fromPosition) { hideSnackbar(); mapActivity.getMyApplication().getMapMarkersHelper().reorderActiveMarkersIfNeeded(); adapter.notifyDataSetChanged(); mapActivity.getMyApplication().getSettings().MAP_MARKERS_ORDER_BY_MODE.set(OsmandSettings.MapMarkersOrderByMode.CUSTOM); } } @Override public void onSwipeStarted() { compassUpdateAllowed = false; } }); recyclerView.setAdapter(adapter); recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() { @Override public void onScrollStateChanged(RecyclerView recyclerView, int newState) { super.onScrollStateChanged(recyclerView, newState); compassUpdateAllowed = newState == RecyclerView.SCROLL_STATE_IDLE; } }); return recyclerView; }