src/main/java/ru/mail/dondokidon/extensions/PagerAdapterHandler.java
/**
     * Count relative to passed value positions (passed value included)
     *
     * @param position Middle position
     * @return ArrayList of relative positions
     */
Count relative to passed value positions (passed value included)
@param position Middle position
@return ArrayList of relative positions
Count relative to passed value positions ( passed value included ) @param position Middle position @return ArrayList of relative positions
private ArrayList<Integer> countRelativePositions(int position) {
        ArrayList<Integer> Positions = new ArrayList<>();
        int PosCount  = mAdapter.getCount();
        if (PosCount == 0)
            return Positions;
        for (int RelativePosition = -RelativityBorder; RelativePosition <= RelativityBorder; RelativePosition++) {
            int Position = position + RelativePosition;
            if (isCycled) {
                if (Position < 0) {
                    Position = PosCount + Position;
                    if (!Positions.contains(Position))
                        Positions.add(Position);
                    continue;
                }
                if (Position >= PosCount) {
                    Position = Position % PosCount;
                    if (!Positions.contains(Position))
                        Positions.add(Position);
                    continue;
                }
            }
            if (!Positions.contains(Position))
                Positions.add(Position);
        }
        if (Debug)
            Log.i(TAG, "Relative positions are: " + Positions);
        return Positions;
    }
private ArrayList < Integer > countRelativePositions ( int position ) { ArrayList < Integer > Positions = new ArrayList < > ( ) ; int PosCount = mAdapter . getCount ( ) ; if ( PosCount == 0 ) return Positions ; for ( int RelativePosition = - RelativityBorder ; RelativePosition <= RelativityBorder ; RelativePosition ++ ) { int Position = position + RelativePosition ; if ( isCycled ) { if ( Position < 0 ) { Position = PosCount + Position ; if ( ! Positions . contains ( Position ) ) Positions . add ( Position ) ; continue ; } if ( Position >= PosCount ) { Position = Position % PosCount ; if ( ! Positions . contains ( Position ) ) Positions . add ( Position ) ; continue ; } } if ( ! Positions . contains ( Position ) ) Positions . add ( Position ) ; } if ( Debug ) Log . i ( TAG , "Relative positions are: " + Positions ) ; return Positions ; }
Count relative to passed value positions (passed value included)
 @param position Middle position
 @return ArrayList of relative positions
Count relative to passed value positions ( passed value included ) @param position Middle position @return ArrayList of relative positions