private void shiftColumnsViews ( final int fromColumn , final int toColumn ) { if ( mAdapter != null ) { // change data mAdapter . changeColumns ( getBindColumn ( fromColumn ) , getBindColumn ( toColumn ) ) ; // change view holders switchHeaders ( mHeaderColumnViewHolders , fromColumn , toColumn , ViewHolderType . COLUMN_HEADER ) ; // change indexes in array with widths mManager . switchTwoColumns ( fromColumn , toColumn ) ; Collection < ViewHolder > fromHolders = mViewHolders . getColumnItems ( fromColumn ) ; Collection < ViewHolder > toHolders = mViewHolders . getColumnItems ( toColumn ) ; removeViewHolders ( fromHolders ) ; removeViewHolders ( toHolders ) ; for ( ViewHolder holder : fromHolders ) { holder . setColumnIndex ( toColumn ) ; mViewHolders . put ( holder . getRowIndex ( ) , holder . getColumnIndex ( ) , holder ) ; } for ( ViewHolder holder : toHolders ) { holder . setColumnIndex ( fromColumn ) ; mViewHolders . put ( holder . getRowIndex ( ) , holder . getColumnIndex ( ) , holder ) ; } } }
Method change columns . Change view holders indexes kay in map init changing items in adapter .