recycleadapter/src/main/java/com/kevadiyakrunalk/recycleadapter/utils/CustomRecyclerViewUtils.java
private static View findOneVisibleChildIncludesPadding(
            LinearLayoutManager lm, int fromIndex, int toIndex,
            boolean completelyVisible, boolean acceptPartiallyVisible) {
        boolean isVertical = (lm.getOrientation() == LinearLayoutManager.VERTICAL);
        final int start = 0;
        final int end = (isVertical) ? lm.getHeight() : lm.getWidth();
        final int next = toIndex > fromIndex ? 1 : -1;
        View partiallyVisible = null;
        for (int i = fromIndex; i != toIndex; i += next) {
            final View child = lm.getChildAt(i);
            final int childStart = (isVertical) ? child.getTop() : child.getLeft();
            final int childEnd = (isVertical) ? child.getBottom() : child.getRight();
            if (childStart < end && childEnd > start) {
                if (completelyVisible) {
                    if (childStart >= start && childEnd <= end) {
                        return child;
                    } else if (acceptPartiallyVisible && partiallyVisible == null) {
                        partiallyVisible = child;
                    }
                } else {
                    return child;
                }
            }
        }
        return partiallyVisible;
    }
// This method is a modified version of the LinearLayoutManager.findOneVisibleChild().
This method is a modified version of the LinearLayoutManager.findOneVisibleChild().
This method is a modified version of the LinearLayoutManager . findOneVisibleChild () .
private static View findOneVisibleChildIncludesPadding(
            LinearLayoutManager lm, int fromIndex, int toIndex,
            boolean completelyVisible, boolean acceptPartiallyVisible) {
        boolean isVertical = (lm.getOrientation() == LinearLayoutManager.VERTICAL);
        final int start = 0;
        final int end = (isVertical) ? lm.getHeight() : lm.getWidth();
        final int next = toIndex > fromIndex ? 1 : -1;
        View partiallyVisible = null;
        for (int i = fromIndex; i != toIndex; i += next) {
            final View child = lm.getChildAt(i);
            final int childStart = (isVertical) ? child.getTop() : child.getLeft();
            final int childEnd = (isVertical) ? child.getBottom() : child.getRight();
            if (childStart < end && childEnd > start) {
                if (completelyVisible) {
                    if (childStart >= start && childEnd <= end) {
                        return child;
                    } else if (acceptPartiallyVisible && partiallyVisible == null) {
                        partiallyVisible = child;
                    }
                } else {
                    return child;
                }
            }
        }
        return partiallyVisible;
    }
private static View findOneVisibleChildIncludesPadding ( LinearLayoutManager lm , int fromIndex , int toIndex , boolean completelyVisible , boolean acceptPartiallyVisible ) { boolean isVertical = ( lm . getOrientation ( ) == LinearLayoutManager . VERTICAL ) ; final int start = 0 ; final int end = ( isVertical ) ? lm . getHeight ( ) : lm . getWidth ( ) ; final int next = toIndex > fromIndex ? 1 : - 1 ; View partiallyVisible = null ; for ( int i = fromIndex ; i != toIndex ; i += next ) { final View child = lm . getChildAt ( i ) ; final int childStart = ( isVertical ) ? child . getTop ( ) : child . getLeft ( ) ; final int childEnd = ( isVertical ) ? child . getBottom ( ) : child . getRight ( ) ; if ( childStart < end && childEnd > start ) { if ( completelyVisible ) { if ( childStart >= start && childEnd <= end ) { return child ; } else if ( acceptPartiallyVisible && partiallyVisible == null ) { partiallyVisible = child ; } } else { return child ; } } } return partiallyVisible ; }
This method is a modified version of the LinearLayoutManager.findOneVisibleChild().
This method is a modified version of the LinearLayoutManager . findOneVisibleChild () .