private View fillFromSelection(int selectedLeft,int childrenLeft,int childrenRight){
  if (DEBUG)   Log.i(TAG,"fillFromSelection() selectedLeft: " + selectedLeft + " childrenLeft: "+ childrenLeft+ CHILDREN_RIGHT+ childrenRight+ M_FIRST_POSITION+ mFirstPosition);
  final int fadingEdgeLength=getHorizontalFadingEdgeLength();
  final int selectedPosition=mSelectedPosition;
  final int numRows=mNumRows;
  final int horizontalSpacing=mHorizontalSpacing;
  int columnStart;
  int columnEnd=-1;
  if (!mStackFromBottom) {
    columnStart=selectedPosition - (selectedPosition % numRows);
  }
 else {
    int invertedSelection=mItemCount - 1 - selectedPosition;
    columnEnd=mItemCount - 1 - (invertedSelection - (invertedSelection % numRows));
    columnStart=Math.max(0,columnEnd - numRows + 1);
  }
  View sel;
  View referenceView;
  int leftSelectionPixel=getLeftSelectionPixel(childrenLeft,fadingEdgeLength,columnStart);
  int rightSelectionPixel=getRightSelectionPixel(childrenRight,fadingEdgeLength,numRows,columnStart);
  sel=makeColumn(mStackFromBottom ? columnEnd : columnStart,selectedLeft,true);
  mFirstPosition=columnStart;
  referenceView=mReferenceView;
  adjustForLeftFadingEdge(referenceView,leftSelectionPixel,rightSelectionPixel);
  adjustForRightFadingEdge(referenceView,leftSelectionPixel,rightSelectionPixel);
  if (!mStackFromBottom) {
    fillLeft(columnStart - numRows,referenceView.getLeft() - horizontalSpacing);
    adjustViewsLeftOrRight();
    fillRight(columnStart + numRows,referenceView.getRight() + horizontalSpacing);
  }
 else {
    fillRight(columnEnd + numRows,referenceView.getRight() + horizontalSpacing);
    adjustViewsLeftOrRight();
    fillLeft(columnStart - 1,referenceView.getLeft() - horizontalSpacing);
  }
  return sel;
}

private View fillFromSelection ( int selectedLeft , int childrenLeft , int childrenRight ) { if ( DEBUG ) Log . i ( TAG , "fillFromSelection() selectedLeft: " + selectedLeft + " childrenLeft: " + childrenLeft + CHILDREN_RIGHT + childrenRight + M_FIRST_POSITION + mFirstPosition ) ; final int fadingEdgeLength = getHorizontalFadingEdgeLength ( ) ; final int selectedPosition = mSelectedPosition ; final int numRows = mNumRows ; final int horizontalSpacing = mHorizontalSpacing ; int columnStart ; int columnEnd = - 1 ; if ( ! mStackFromBottom ) { columnStart = selectedPosition - ( selectedPosition % numRows ) ; } else { int invertedSelection = mItemCount - 1 - selectedPosition ; columnEnd = mItemCount - 1 - ( invertedSelection - ( invertedSelection % numRows ) ) ; columnStart = Math . max ( 0 , columnEnd - numRows + 1 ) ; } View sel ; View referenceView ; int leftSelectionPixel = getLeftSelectionPixel ( childrenLeft , fadingEdgeLength , columnStart ) ; int rightSelectionPixel = getRightSelectionPixel ( childrenRight , fadingEdgeLength , numRows , columnStart ) ; sel = makeColumn ( mStackFromBottom ? columnEnd : columnStart , selectedLeft , true ) ; mFirstPosition = columnStart ; referenceView = mReferenceView ; adjustForLeftFadingEdge ( referenceView , leftSelectionPixel , rightSelectionPixel ) ; adjustForRightFadingEdge ( referenceView , leftSelectionPixel , rightSelectionPixel ) ; if ( ! mStackFromBottom ) { fillLeft ( columnStart - numRows , referenceView . getLeft ( ) - horizontalSpacing ) ; adjustViewsLeftOrRight ( ) ; fillRight ( columnStart + numRows , referenceView . getRight ( ) + horizontalSpacing ) ; } else { fillRight ( columnEnd + numRows , referenceView . getRight ( ) + horizontalSpacing ) ; adjustViewsLeftOrRight ( ) ; fillLeft ( columnStart - 1 , referenceView . getLeft ( ) - horizontalSpacing ) ; } return sel ; }
fills the grid based on positioning the new selection at a specific location . the selection may be moved so that it does not intersect the faded edges . the grid is then filled upwards and downwards from there .
