private void shiftRowsViews ( final int fromRow , final int toRow ) { if ( mAdapter != null ) { // change data mAdapter . changeRows ( fromRow , toRow , mSettings . isSolidRowHeader ( ) ) ; // change view holders switchHeaders ( mHeaderRowViewHolders , fromRow , toRow , ViewHolderType . ROW_HEADER ) ; // change indexes in array with heights mManager . switchTwoRows ( fromRow , toRow ) ; Collection < ViewHolder > fromHolders = mViewHolders . getRowItems ( fromRow ) ; Collection < ViewHolder > toHolders = mViewHolders . getRowItems ( toRow ) ; removeViewHolders ( fromHolders ) ; removeViewHolders ( toHolders ) ; for ( ViewHolder holder : fromHolders ) { holder . setRowIndex ( toRow ) ; mViewHolders . put ( holder . getRowIndex ( ) , holder . getColumnIndex ( ) , holder ) ; } for ( ViewHolder holder : toHolders ) { holder . setRowIndex ( fromRow ) ; mViewHolders . put ( holder . getRowIndex ( ) , holder . getColumnIndex ( ) , holder ) ; } // update row headers if ( ! mSettings . isSolidRowHeader ( ) ) { ViewHolder fromViewHolder = mHeaderRowViewHolders . get ( fromRow ) ; ViewHolder toViewHolder = mHeaderRowViewHolders . get ( toRow ) ; if ( fromViewHolder != null ) { mAdapter . onBindHeaderRowViewHolder ( fromViewHolder , fromRow ) ; } if ( toViewHolder != null ) { mAdapter . onBindHeaderRowViewHolder ( toViewHolder , toRow ) ; } } } }
Method change rows . Change view holders indexes kay in map init changing items in adapter .