private void layoutWithHeightDetection()

in core/src/main/java/com/facebook/testing/screenshot/ViewHelpers.java [85:106]


  private void layoutWithHeightDetection() {
    ListView view = (ListView) mView;
    mHeightMeasureSpec = makeMeasureSpec(HEIGHT_LIMIT, MeasureSpec.EXACTLY);
    layoutInternal();

    if (view.getCount() != view.getChildCount()) {
      throw new IllegalStateException("the ListView is too big to be auto measured");
    }

    int bottom = 0;

    if (view.getCount() > 0) {
      bottom = view.getChildAt(view.getCount() - 1).getBottom();
    }

    if (bottom == 0) {
      bottom = 1;
    }

    mHeightMeasureSpec = makeMeasureSpec(bottom, MeasureSpec.EXACTLY);
    layoutInternal();
  }