ViewportManager

@ThreadSafe
class ViewportManager(currentFirstVisiblePosition: Int, currentLastVisiblePosition: Int, layoutInfo: LayoutInfo)

This class will handle all viewport changes due to both scrolling and ViewHolder removal that is not related to scrolling.

Classes that are interested to have its viewport changes handled by ViewportManager should set the OnScrollListener returned from ViewportManager.getScrollListener in the RecyclerView

Constructors

Link copied to clipboard
constructor(currentFirstVisiblePosition: Int, currentLastVisiblePosition: Int, layoutInfo: LayoutInfo)

Types

Properties

Functions

Link copied to clipboard
Link copied to clipboard
fun insertAffectsVisibleRange(position: Int, size: Int, viewportCount: Int): Boolean
Link copied to clipboard
fun moveAffectsVisibleRange(fromPosition: Int, toPosition: Int, viewportCount: Int): Boolean
Link copied to clipboard

Handles a change in viewport. This method should not be called outside of the method OnScrollListener.onScrolled

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun setShouldUpdate(shouldUpdate: Boolean)
Link copied to clipboard

Whether first/last visible positions should be updated. If this returns true, we should not do any computations based on current first/last visible positions until they are updated.

Link copied to clipboard