@Override protected boolean arrowScroll(int direction){
  final int selectedPosition=mSelectedPosition;
  final int numRows=mNumRows;
  int startOfColumnPos;
  int endOfColumnPos;
  boolean moved=false;
  if (!mStackFromBottom) {
    startOfColumnPos=(selectedPosition / numRows) * numRows;
    endOfColumnPos=Math.min(startOfColumnPos + numRows - 1,mItemCount - 1);
  }
 else {
    final int invertedSelection=mItemCount - 1 - selectedPosition;
    endOfColumnPos=mItemCount - 1 - (invertedSelection / numRows) * numRows;
    startOfColumnPos=Math.max(0,endOfColumnPos - numRows + 1);
  }
switch (direction) {
case FOCUS_LEFT:
    if (startOfColumnPos > 0) {
      mLayoutMode=LAYOUT_MOVE_SELECTION;
      setSelectionInt(Math.max(0,selectedPosition - numRows));
      moved=true;
    }
  break;
case FOCUS_RIGHT:
if (startOfColumnPos < mItemCount - 1) {
  mLayoutMode=LAYOUT_MOVE_SELECTION;
  setSelectionInt(Math.min(selectedPosition + numRows,mItemCount - 1));
  moved=true;
}
break;
case FOCUS_UP:
if (selectedPosition > startOfColumnPos) {
mLayoutMode=LAYOUT_MOVE_SELECTION;
setSelectionInt(Math.max(0,selectedPosition - 1));
moved=true;
}
break;
case FOCUS_DOWN:
if (selectedPosition < endOfColumnPos) {
mLayoutMode=LAYOUT_MOVE_SELECTION;
setSelectionInt(Math.min(selectedPosition + 1,mItemCount - 1));
moved=true;
}
break;
}
if (moved) {
playSoundEffect(SoundEffectConstants.getContantForFocusDirection(direction));
invokeOnItemScrollListener();
}
if (moved) {
}
return moved;
}

@ Override protected boolean arrowScroll ( int direction ) { final int selectedPosition = mSelectedPosition ; final int numRows = mNumRows ; int startOfColumnPos ; int endOfColumnPos ; boolean moved = false ; if ( ! mStackFromBottom ) { startOfColumnPos = ( selectedPosition / numRows ) * numRows ; endOfColumnPos = Math . min ( startOfColumnPos + numRows - 1 , mItemCount - 1 ) ; } else { final int invertedSelection = mItemCount - 1 - selectedPosition ; endOfColumnPos = mItemCount - 1 - ( invertedSelection / numRows ) * numRows ; startOfColumnPos = Math . max ( 0 , endOfColumnPos - numRows + 1 ) ; } switch ( direction ) { case FOCUS_LEFT : if ( startOfColumnPos > 0 ) { mLayoutMode = LAYOUT_MOVE_SELECTION ; setSelectionInt ( Math . max ( 0 , selectedPosition - numRows ) ) ; moved = true ; } break ; case FOCUS_RIGHT : if ( startOfColumnPos < mItemCount - 1 ) { mLayoutMode = LAYOUT_MOVE_SELECTION ; setSelectionInt ( Math . min ( selectedPosition + numRows , mItemCount - 1 ) ) ; moved = true ; } break ; case FOCUS_UP : if ( selectedPosition > startOfColumnPos ) { mLayoutMode = LAYOUT_MOVE_SELECTION ; setSelectionInt ( Math . max ( 0 , selectedPosition - 1 ) ) ; moved = true ; } break ; case FOCUS_DOWN : if ( selectedPosition < endOfColumnPos ) { mLayoutMode = LAYOUT_MOVE_SELECTION ; setSelectionInt ( Math . min ( selectedPosition + 1 , mItemCount - 1 ) ) ; moved = true ; } break ; } if ( moved ) { playSoundEffect ( SoundEffectConstants . getContantForFocusDirection ( direction ) ) ; invokeOnItemScrollListener ( ) ; } if ( moved ) { } return moved ; }
scrolls to the next or previous item , horizontally or vertically .
