protected boolean computeOffset ( final int dataIndex , CacheDataSet cache ) { float layoutOffset = getLayoutOffset ( ) ; int pos = cache . getPos ( dataIndex ) ; float startDataOffset = Float . NaN ; float endDataOffset = Float . NaN ; if ( pos > 0 ) { int id = cache . getId ( pos - 1 ) ; if ( id != - 1 ) { startDataOffset = cache . getEndDataOffset ( id ) ; if ( ! Float . isNaN ( startDataOffset ) ) { endDataOffset = cache . setDataAfter ( dataIndex , startDataOffset ) ; } } } else if ( pos == 0 ) { int id = cache . getId ( pos + 1 ) ; if ( id != - 1 ) { endDataOffset = cache . getStartDataOffset ( id ) ; if ( ! Float . isNaN ( endDataOffset ) ) { startDataOffset = cache . setDataBefore ( dataIndex , endDataOffset ) ; } } else { startDataOffset = getStartingOffset ( ( cache . getTotalSizeWithPadding ( ) ) ) ; endDataOffset = cache . setDataAfter ( dataIndex , startDataOffset ) ; } } Log . d ( LAYOUT , TAG , "computeOffset [%d, %d]: startDataOffset = %f endDataOffset = %f" , dataIndex , pos , startDataOffset , endDataOffset ) ; boolean inBounds = ! Float . isNaN ( cache . getDataOffset ( dataIndex ) ) && endDataOffset > layoutOffset && startDataOffset < - layoutOffset ; return inBounds ; }
Compute the offset for the item in the layout cache