public VisibilityReport computeStackVisibilityReport(ArrayList<T> data){
  if (data.size() <= 1) {
    return new VisibilityReport(1,1);
  }
  int taskHeight=mTaskRect.height();
  int numVisibleTasks=1;
  int numVisibleThumbnails=1;
  float progress=mTaskProgressMap.get(data.get(data.size() - 1)) - mInitialScrollP;
  int prevScreenY=curveProgressToScreenY(progress);
  for (int i=data.size() - 2; i >= 0; i--) {
    progress=mTaskProgressMap.get(data.get(i)) - mInitialScrollP;
    if (progress < 0) {
      break;
    }
    boolean isFrontMostTaskInGroup=true;
    if (isFrontMostTaskInGroup) {
      float scaleAtP=curveProgressToScale(progress);
      int scaleYOffsetAtP=(int)(((1f - scaleAtP) * taskHeight) / 2);
      int screenY=curveProgressToScreenY(progress) + scaleYOffsetAtP;
      boolean hasVisibleThumbnail=(prevScreenY - screenY) > mConfig.taskBarHeight;
      if (hasVisibleThumbnail) {
        numVisibleThumbnails++;
        numVisibleTasks++;
        prevScreenY=screenY;
      }
 else {
        for (int j=i; j >= 0; j--) {
          numVisibleTasks++;
          progress=mTaskProgressMap.get(data.get(i)) - mInitialScrollP;
          if (progress < 0) {
            break;
          }
        }
        break;
      }
    }
 else     if (!isFrontMostTaskInGroup) {
      numVisibleTasks++;
    }
  }
  return new VisibilityReport(numVisibleTasks,numVisibleThumbnails);
}

public VisibilityReport computeStackVisibilityReport ( ArrayList < T > data ) { if ( data . size ( ) <= 1 ) { return new VisibilityReport ( 1 , 1 ) ; } int taskHeight = mTaskRect . height ( ) ; int numVisibleTasks = 1 ; int numVisibleThumbnails = 1 ; float progress = mTaskProgressMap . get ( data . get ( data . size ( ) - 1 ) ) - mInitialScrollP ; int prevScreenY = curveProgressToScreenY ( progress ) ; for ( int i = data . size ( ) - 2 ; i >= 0 ; i -- ) { progress = mTaskProgressMap . get ( data . get ( i ) ) - mInitialScrollP ; if ( progress < 0 ) { break ; } boolean isFrontMostTaskInGroup = true ; if ( isFrontMostTaskInGroup ) { float scaleAtP = curveProgressToScale ( progress ) ; int scaleYOffsetAtP = ( int ) ( ( ( 1f - scaleAtP ) * taskHeight ) / 2 ) ; int screenY = curveProgressToScreenY ( progress ) + scaleYOffsetAtP ; boolean hasVisibleThumbnail = ( prevScreenY - screenY ) > mConfig . taskBarHeight ; if ( hasVisibleThumbnail ) { numVisibleThumbnails ++ ; numVisibleTasks ++ ; prevScreenY = screenY ; } else { for ( int j = i ; j >= 0 ; j -- ) { numVisibleTasks ++ ; progress = mTaskProgressMap . get ( data . get ( i ) ) - mInitialScrollP ; if ( progress < 0 ) { break ; } } break ; } } else if ( ! isFrontMostTaskInGroup ) { numVisibleTasks ++ ; } } return new VisibilityReport ( numVisibleTasks , numVisibleThumbnails ) ; }
computes the maximum number of visible tasks and thumbnails . requires that computeminmaxscroll ( ) is called first .
