car/src/main/java/androidx/car/app/CarListDialog.java
private void updateScrollbar() {
        RecyclerView recyclerView = mList.getRecyclerView();

        boolean isAtStart = mList.isAtStart();
        boolean isAtEnd = mList.isAtEnd();

        if ((isAtStart && isAtEnd)) {
            mScrollBarView.setVisibility(View.INVISIBLE);
            return;
        }

        mScrollBarView.setVisibility(View.VISIBLE);
        mScrollBarView.setUpEnabled(!isAtStart);
        mScrollBarView.setDownEnabled(!isAtEnd);

        // Assume the list scrolls vertically because we control the list and know the
        // LayoutManager cannot change.
        mScrollBarView.setParameters(
                recyclerView.computeVerticalScrollRange(),
                recyclerView.computeVerticalScrollOffset(),
                recyclerView.computeVerticalScrollExtent(),
                /* animate= */ false);

        getWindow().getDecorView().invalidate();
    }
/**
     * Determines if scrollbar should be visible or not and shows/hides it accordingly.
     *
     * <p>If this is being called as a result of adapter changes, it should be called after the new
     * layout has been calculated because the method of determining scrollbar visibility uses the
     * current layout.
     *
     * <p>If this is called after an adapter change but before the new layout, the visibility
     * determination may not be correct.
     */
Determines if scrollbar should be visible or not and shows/hides it accordingly.
If this is being called as a result of adapter changes, it should be called after the new
layout has been calculated because the method of determining scrollbar visibility uses the
current layout.

If this is called after an adapter change but before the new layout, the visibility
determination may not be correct.
Determines if scrollbar should be visible or not and shows / hides it accordingly . If this is being called as a result of adapter changes it should be called after the new layout has been calculated because the method of determining scrollbar visibility uses the current layout . If this is called after an adapter change but before the new layout the visibility determination may not be correct .
private void updateScrollbar() {
        RecyclerView recyclerView = mList.getRecyclerView();
        boolean isAtStart = mList.isAtStart();
        boolean isAtEnd = mList.isAtEnd();
        if ((isAtStart && isAtEnd)) {
            mScrollBarView.setVisibility(View.INVISIBLE);
            return;
        }
        mScrollBarView.setVisibility(View.VISIBLE);
        mScrollBarView.setUpEnabled(!isAtStart);
        mScrollBarView.setDownEnabled(!isAtEnd);
        mScrollBarView.setParameters(
                recyclerView.computeVerticalScrollRange(),
                recyclerView.computeVerticalScrollOffset(),
                recyclerView.computeVerticalScrollExtent(),
                /* animate= */ false);
        getWindow().getDecorView().invalidate();
    }
private void updateScrollbar ( ) { RecyclerView recyclerView = mList . getRecyclerView ( ) ; boolean isAtStart = mList . isAtStart ( ) ; boolean isAtEnd = mList . isAtEnd ( ) ; if ( ( isAtStart && isAtEnd ) ) { mScrollBarView . setVisibility ( View . INVISIBLE ) ; return ; } mScrollBarView . setVisibility ( View . VISIBLE ) ; mScrollBarView . setUpEnabled ( ! isAtStart ) ; mScrollBarView . setDownEnabled ( ! isAtEnd ) ; mScrollBarView . setParameters ( recyclerView . computeVerticalScrollRange ( ) , recyclerView . computeVerticalScrollOffset ( ) , recyclerView . computeVerticalScrollExtent ( ) , /* animate= */ false ) ; getWindow ( ) . getDecorView ( ) . invalidate ( ) ; }
Determines if scrollbar should be visible or not and shows/hides it accordingly.
Determines if scrollbar should be visible or not and shows / hides it accordingly .
// Assume the list scrolls vertically because we control the list and know the // LayoutManager cannot change.