/**
   * This is called with the size of the space not including the top or right insets, or the search
   * bar height in portrait (but including the search bar width in landscape, since we want to draw
   * under it.
   */
  @Override
  protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
    // Layout each of the children
    int childCount = getChildCount();
    for (int i = 0; i < childCount; i++) {
      TaskView tv = (TaskView) getChildAt(i);
      if (tv.isFullScreenView()) {
        tv.layout(left, top, left + tv.getMeasuredWidth(), top + tv.getMeasuredHeight());
      } else {
        if (tv.getBackground() != null) {
          tv.getBackground().getPadding(mTmpRect);
        } else {
          mTmpRect.setEmpty();
        }
        tv.layout(
            mLayoutAlgorithm.mTaskRect.left - mTmpRect.left,
            mLayoutAlgorithm.mTaskRect.top - mTmpRect.top,
            mLayoutAlgorithm.mTaskRect.right + mTmpRect.right,
            mLayoutAlgorithm.mTaskRect.bottom + mTmpRect.bottom + tv.getMaxFooterHeight());
      }
    }

    if (mAwaitingFirstLayout) {
      mAwaitingFirstLayout = false;
      onFirstLayout();
    }
  }