app/src/main/java/nerd/tuxmobil/fahrplan/congress/schedule/FahrplanFragment.java
/**
     * Adds {@code roomCount} room column views as child views to the first child
     * (which is a row layout) of the given {@code horizontalScroller} layout.
     * Previously added child views are removed.
     */
Adds  roomCount room column views as child views to the first child
(which is a row layout) of the given  horizontalScroller layout.
Previously added child views are removed.
Adds roomCount room column views as child views to the first child ( which is a row layout ) of the given horizontalScroller layout . Previously added child views are removed .
private void addRoomColumns(
            @NonNull HorizontalSnapScrollView horizontalScroller,
            int columnWidth,
            @NonNull ScheduleData scheduleData,
            boolean forceReload
    ) {
        int columnIndexLeft = horizontalScroller.getColumnIndex();
        int columnIndexRight = horizontalScroller.getLastVisibleColumnIndex();
        if (!forceReload && !adapterByRoomIndex.isEmpty()) {
            for (int roomIndex = columnIndexLeft; roomIndex <= columnIndexRight; roomIndex++) {
                adapterByRoomIndex.get(roomIndex).notifyDataSetChanged();
            }
            return;
        }
        LinearLayout columnsLayout = (LinearLayout) horizontalScroller.getChildAt(0);
        columnsLayout.removeAllViews();
        adapterByRoomIndex.clear();
        int boxHeight = getNormalizedBoxHeight(getResources(), scale, LOG_TAG);
        LayoutCalculator layoutCalculator = new LayoutCalculator(boxHeight);
        List<RoomData> roomDataList = scheduleData.getRoomDataList();
        for (int roomIndex = 0; roomIndex < roomDataList.size(); roomIndex++) {
            RoomData roomData = roomDataList.get(roomIndex);
            Map<Session, LayoutParams> layoutParamsBySession = layoutCalculator.calculateLayoutParams(roomData, conference);
            RecyclerView columnRecyclerView = new RecyclerView(context);
            columnRecyclerView.setHasFixedSize(true);
            columnRecyclerView.setFadingEdgeLength(0);
            columnRecyclerView.setNestedScrollingEnabled(false); 
            columnRecyclerView.setLayoutManager(new LinearLayoutManager(context));
            columnRecyclerView.setLayoutParams(new RecyclerView.LayoutParams(columnWidth, ViewGroup.LayoutParams.WRAP_CONTENT));
            List<Session> roomSessions = roomData.getSessions();
            SessionViewColumnAdapter adapter = new SessionViewColumnAdapter(roomSessions, layoutParamsBySession, sessionViewDrawer, this);
            columnRecyclerView.setAdapter(adapter);
            adapterByRoomIndex.put(roomIndex, adapter);
            columnsLayout.addView(columnRecyclerView);
        }
    }
private void addRoomColumns ( @ NonNull HorizontalSnapScrollView horizontalScroller , int columnWidth , @ NonNull ScheduleData scheduleData , boolean forceReload ) { int columnIndexLeft = horizontalScroller . getColumnIndex ( ) ; int columnIndexRight = horizontalScroller . getLastVisibleColumnIndex ( ) ; if ( ! forceReload && ! adapterByRoomIndex . isEmpty ( ) ) { for ( int roomIndex = columnIndexLeft ; roomIndex <= columnIndexRight ; roomIndex ++ ) { adapterByRoomIndex . get ( roomIndex ) . notifyDataSetChanged ( ) ; } return ; } LinearLayout columnsLayout = ( LinearLayout ) horizontalScroller . getChildAt ( 0 ) ; columnsLayout . removeAllViews ( ) ; adapterByRoomIndex . clear ( ) ; int boxHeight = getNormalizedBoxHeight ( getResources ( ) , scale , LOG_TAG ) ; LayoutCalculator layoutCalculator = new LayoutCalculator ( boxHeight ) ; List < RoomData > roomDataList = scheduleData . getRoomDataList ( ) ; for ( int roomIndex = 0 ; roomIndex < roomDataList . size ( ) ; roomIndex ++ ) { RoomData roomData = roomDataList . get ( roomIndex ) ; Map < Session , LayoutParams > layoutParamsBySession = layoutCalculator . calculateLayoutParams ( roomData , conference ) ; RecyclerView columnRecyclerView = new RecyclerView ( context ) ; columnRecyclerView . setHasFixedSize ( true ) ; columnRecyclerView . setFadingEdgeLength ( 0 ) ; columnRecyclerView . setNestedScrollingEnabled ( false ) ; columnRecyclerView . setLayoutManager ( new LinearLayoutManager ( context ) ) ; columnRecyclerView . setLayoutParams ( new RecyclerView . LayoutParams ( columnWidth , ViewGroup . LayoutParams . WRAP_CONTENT ) ) ; List < Session > roomSessions = roomData . getSessions ( ) ; SessionViewColumnAdapter adapter = new SessionViewColumnAdapter ( roomSessions , layoutParamsBySession , sessionViewDrawer , this ) ; columnRecyclerView . setAdapter ( adapter ) ; adapterByRoomIndex . put ( roomIndex , adapter ) ; columnsLayout . addView ( columnRecyclerView ) ; } }
Adds {@code roomCount} room column views as child views to the first child
 (which is a row layout) of the given {@code horizontalScroller} layout.
Adds { @code roomCount } room column views as child views to the first child ( which is a row layout ) of the given { @code horizontalScroller } layout .
// whenever possible, just update recycler views //noinspection ConstantConditions // enables flinging