private View fillFromSelection(int selectedTop,int childrenTop,int childrenBottom){
  if (DEBUG)   Log.i(TAG,"fillFromSelection() selectedTop: " + selectedTop + " childrenTop: "+ childrenTop+ CHILDREN_BOTTOM+ childrenBottom+ M_FIRST_POSITION+ mFirstPosition);
  final int fadingEdgeLength=getVerticalFadingEdgeLength();
  final int selectedPosition=mSelectedPosition;
  final int numColumns=mNumColumns;
  final int verticalSpacing=mVerticalSpacing;
  int rowStart;
  int rowEnd=-1;
  if (!mStackFromBottom) {
    rowStart=selectedPosition - (selectedPosition % numColumns);
  }
 else {
    int invertedSelection=mItemCount - 1 - selectedPosition;
    rowEnd=mItemCount - 1 - (invertedSelection - (invertedSelection % numColumns));
    rowStart=Math.max(0,rowEnd - numColumns + 1);
  }
  View sel;
  View referenceView;
  int topSelectionPixel=getTopSelectionPixel(childrenTop,fadingEdgeLength,rowStart);
  int bottomSelectionPixel=getBottomSelectionPixel(childrenBottom,fadingEdgeLength,numColumns,rowStart);
  sel=makeRow(mStackFromBottom ? rowEnd : rowStart,selectedTop,true);
  mFirstPosition=rowStart;
  referenceView=mReferenceView;
  adjustForTopFadingEdge(referenceView,topSelectionPixel,bottomSelectionPixel);
  adjustForBottomFadingEdge(referenceView,topSelectionPixel,bottomSelectionPixel);
  if (!mStackFromBottom) {
    fillUp(rowStart - numColumns,referenceView.getTop() - verticalSpacing);
    adjustViewsUpOrDown();
    fillDown(rowStart + numColumns,referenceView.getBottom() + verticalSpacing);
  }
 else {
    fillDown(rowEnd + numColumns,referenceView.getBottom() + verticalSpacing);
    adjustViewsUpOrDown();
    fillUp(rowStart - 1,referenceView.getTop() - verticalSpacing);
  }
  return sel;
}

private View fillFromSelection ( int selectedTop , int childrenTop , int childrenBottom ) { if ( DEBUG ) Log . i ( TAG , "fillFromSelection() selectedTop: " + selectedTop + " childrenTop: " + childrenTop + CHILDREN_BOTTOM + childrenBottom + M_FIRST_POSITION + mFirstPosition ) ; final int fadingEdgeLength = getVerticalFadingEdgeLength ( ) ; final int selectedPosition = mSelectedPosition ; final int numColumns = mNumColumns ; final int verticalSpacing = mVerticalSpacing ; int rowStart ; int rowEnd = - 1 ; if ( ! mStackFromBottom ) { rowStart = selectedPosition - ( selectedPosition % numColumns ) ; } else { int invertedSelection = mItemCount - 1 - selectedPosition ; rowEnd = mItemCount - 1 - ( invertedSelection - ( invertedSelection % numColumns ) ) ; rowStart = Math . max ( 0 , rowEnd - numColumns + 1 ) ; } View sel ; View referenceView ; int topSelectionPixel = getTopSelectionPixel ( childrenTop , fadingEdgeLength , rowStart ) ; int bottomSelectionPixel = getBottomSelectionPixel ( childrenBottom , fadingEdgeLength , numColumns , rowStart ) ; sel = makeRow ( mStackFromBottom ? rowEnd : rowStart , selectedTop , true ) ; mFirstPosition = rowStart ; referenceView = mReferenceView ; adjustForTopFadingEdge ( referenceView , topSelectionPixel , bottomSelectionPixel ) ; adjustForBottomFadingEdge ( referenceView , topSelectionPixel , bottomSelectionPixel ) ; if ( ! mStackFromBottom ) { fillUp ( rowStart - numColumns , referenceView . getTop ( ) - verticalSpacing ) ; adjustViewsUpOrDown ( ) ; fillDown ( rowStart + numColumns , referenceView . getBottom ( ) + verticalSpacing ) ; } else { fillDown ( rowEnd + numColumns , referenceView . getBottom ( ) + verticalSpacing ) ; adjustViewsUpOrDown ( ) ; fillUp ( rowStart - 1 , referenceView . getTop ( ) - verticalSpacing ) ; } 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 .
