requirements[myAxis] = calculateMajorAxisRequirements(myAxis, requirements[myAxis]); layoutMajorAxis(newSpan[myAxis], myAxis, offsets[myAxis],
layoutValid[myAxis] = false; span[myAxis] = newSpan[myAxis]; layoutMajorAxis(span[myAxis], myAxis, offsets[myAxis],
  protected void layout(int width, int height)  {    int[] newSpan = new int[]{ width, height };    int count = getViewCount();    // Update minor axis as appropriate. We need to first update the minor    // axis layout because that might affect the children's preferences along    // the major axis.    int minorAxis = myAxis == X_AXIS ? Y_AXIS : X_AXIS;    if ((! isLayoutValid(minorAxis)) || newSpan[minorAxis] != span[minorAxis])      {        requirements[minorAxis] = calculateMinorAxisRequirements(minorAxis,                                                      requirements[minorAxis]);        layoutMinorAxis(newSpan[minorAxis], minorAxis, offsets[minorAxis],                        spans[minorAxis]);        span[myAxis] = newSpan[myAxis];        // Update the child view's sizes.        for (int i = 0; i < count; ++i)          {            getView(i).setSize(spans[X_AXIS][i], spans[Y_AXIS][i]);          }        layoutValid[minorAxis] = true;      }    // Update major axis as appropriate.    if ((! isLayoutValid(myAxis)) || newSpan[myAxis] != span[myAxis])      {        requirements[myAxis] = calculateMajorAxisRequirements(myAxis,                                                         requirements[myAxis]);        layoutMajorAxis(newSpan[myAxis], myAxis, offsets[myAxis],                        spans[myAxis]);        span[myAxis] = newSpan[myAxis];        // Update the child view's sizes.        for (int i = 0; i < count; ++i)          {            getView(i).setSize(spans[X_AXIS][i], spans[Y_AXIS][i]);          }        layoutValid[myAxis] = true;      }    assert layoutValid[myAxis] == true           : "Major axis layout must be valid after layout";    assert layoutValid[minorAxis] == true    : "Minor axis layout must be valid after layout";  }