Parses the layout ID annotation form the itemViewHolderClass
6460
public static Integer parseItemLayoutId(Class<? extends ItemViewHolder> itemViewHolderClass) {
        Integer itemLayoutId = ClassAnnotationParser.getLayoutId(itemViewHolderClass);
        if (itemLayoutId == null) {
            throw new LayoutIdMissingException();
        }
        return itemLayoutId;
    }
744524
@Override
    public void layoutViews(RecyclerView.Recycler recycler, RecyclerView.State state, LayoutStateWrapper layoutState, LayoutChunkResult result, LayoutManagerHelper helper) {
        // reach the end of this layout
        if (isOutOfRange(layoutState.getCurrentPosition())) {
            return;
        }

        boolean isStartLine = false, isEndLine = false;
        boolean isSecondStartLine = false, isSecondEndLine = false;
        final int currentPosition = layoutState.getCurrentPosition();
        GridRangeStyle rangeStyle = mRangeStyle.findRangeStyleByPosition(currentPosition);

        final int itemDirection = layoutState.getItemDirection();
        final boolean layingOutInPrimaryDirection =
            itemDirection == LayoutStateWrapper.ITEM_DIRECTION_TAIL;

        OrientationHelperEx orientationHelper = helper.getMainOrientationHelper();

        final boolean layoutInVertical = helper.getOrientation() == VERTICAL;

        if (layoutInVertical) {
            mTotalSize = helper.getContentWidth() - helper.getPaddingRight() - helper.getPaddingLeft() - rangeStyle
                .getFamilyHorizontalMargin() - rangeStyle.getFamilyHorizontalPadding();
            rangeStyle.mSizePerSpan = (int) ((mTotalSize - (
                rangeStyle.mSpanCount - 1) * rangeStyle.mHGap) * 1.0f / rangeStyle.mSpanCount + 0.5f);
        } else {
            mTotalSize = helper.getContentHeight() - helper.getPaddingBottom() - helper.getPaddingTop() - rangeStyle
                .getFamilyVerticalMargin() - rangeStyle.getFamilyVerticalPadding();
            rangeStyle.mSizePerSpan = (int) ((mTotalSize - (
                rangeStyle.mSpanCount - 1) * rangeStyle.mVGap) * 1.0f / rangeStyle.mSpanCount + 0.5f);
        }

        int count = 0;
        int consumedSpanCount = 0;
        int remainingSpan = rangeStyle.mSpanCount;

        rangeStyle.ensureSpanCount();

        if (!layingOutInPrimaryDirection) {
            // fill the remaining spacing this row
            int itemSpanIndex = getSpanIndex(rangeStyle.mSpanSizeLookup, rangeStyle.mSpanCount, recycler, state, layoutState.getCurrentPosition());
            int itemSpanSize = getSpanSize(rangeStyle.mSpanSizeLookup, recycler, state, layoutState.getCurrentPosition());


            remainingSpan = itemSpanIndex + itemSpanSize;

            // should find the last element of this row
            if (itemSpanIndex != rangeStyle.mSpanCount - 1) {
                int index = layoutState.getCurrentPosition();
                int revRemainingSpan = rangeStyle.mSpanCount - remainingSpan;
                while (count < rangeStyle.mSpanCount && revRemainingSpan > 0) {
                    // go reverse direction to find views fill current row
                    index -= itemDirection;
                    if (rangeStyle.isOutOfRange(index)) {
                        break;
                    }
                    final int spanSize = getSpanSize(rangeStyle.mSpanSizeLookup, recycler, state, index);
                    if (spanSize > rangeStyle.mSpanCount) {
                        throw new IllegalArgumentException("Item at position " + index + " requires " +
                            spanSize + " spans but RangeGridLayoutHelper has only " + rangeStyle.mSpanCount
                            + " spans.");
                    }

                    View view = layoutState.retrieve(recycler, index);
                    if (view == null) {
                        break;
                    }

                    if (!isStartLine) {
                        isStartLine = helper.getReverseLayout() ? index == mRangeStyle.getRange().getUpper().intValue()
                            : index == mRangeStyle.getRange().getLower().intValue();
                    }


                    if (!isEndLine) {
                        isEndLine = helper.getReverseLayout() ? index == mRangeStyle.getRange().getLower().intValue()
                            : index == mRangeStyle.getRange().getUpper().intValue();
                    }


                    revRemainingSpan -= spanSize;
                    if (revRemainingSpan < 0) {
                        break;
                    }


                    consumedSpanCount += spanSize;
                    rangeStyle.mSet[count] = view;
                    count++;
                }

                if (count > 0) {
                    // reverse array
                    int s = 0, e = count - 1;
                    while (s < e) {
                        View temp = rangeStyle.mSet[s];
                        rangeStyle.mSet[s] = rangeStyle.mSet[e];
                        rangeStyle.mSet[e] = temp;
                        s++;
                        e--;
                    }
                }
            }
        }

        while (count < rangeStyle.mSpanCount && layoutState.hasMore(state) && remainingSpan > 0) {
            int pos = layoutState.getCurrentPosition();
            if (rangeStyle.isOutOfRange(pos)) {
                if (DEBUG) {
                    Log.d(TAG, "pos [" + pos + "] is out of range");
                }
                break;
            }

            final int spanSize = getSpanSize(rangeStyle.mSpanSizeLookup, recycler, state, pos);
            if (spanSize > rangeStyle.mSpanCount) {
                throw new IllegalArgumentException("Item at position " + pos + " requires " +
                    spanSize + " spans but GridLayoutManager has only " + rangeStyle.mSpanCount
                    + " spans.");
            }
            remainingSpan -= spanSize;
            if (remainingSpan < 0) {
                break; // item did not fit into this row or column
            }

            View view = layoutState.next(recycler);
            if (view == null) {
                break;
            }

            if (!isStartLine) {
                isStartLine = helper.getReverseLayout() ? pos == mRangeStyle.getRange().getUpper().intValue()
                    : pos == mRangeStyle.getRange().getLower().intValue();
            }
            if (!isSecondStartLine) {
                if (!rangeStyle.equals(mRangeStyle)) {
                    if (mLayoutWithAnchor) {
                        pos = layoutState.getCurrentPosition();
                    }
                    isSecondStartLine = helper.getReverseLayout() ? pos == rangeStyle.getRange().getUpper()
                        .intValue() : pos == rangeStyle.getRange().getLower().intValue();
                }
            }

            if (!isEndLine) {
                isEndLine = helper.getReverseLayout() ? pos == mRangeStyle.getRange().getLower().intValue()
                    : pos == mRangeStyle.getRange().getUpper().intValue();
            }

            if (!isSecondEndLine) {
                if (!rangeStyle.equals(mRangeStyle)) {
                    if (mLayoutWithAnchor) {
                        pos = layoutState.getCurrentPosition();
                    }
                    isSecondEndLine = helper.getReverseLayout() ? pos == rangeStyle.getRange().getLower()
                        .intValue() : pos == rangeStyle.getRange().getUpper().intValue();
                }
            }

            consumedSpanCount += spanSize;
            rangeStyle.mSet[count] = view;
            count++;
        }


        if (count == 0) {
            return;
        }

        int maxSize = 0;


        // we should assign spans before item decor offsets are calculated
        assignSpans(rangeStyle, recycler, state, count, consumedSpanCount, layingOutInPrimaryDirection, helper);

        if (remainingSpan > 0 && (count == consumedSpanCount) && rangeStyle.mIsAutoExpand) {
            //autoExpand only support when each cell occupy one span.
            if (layoutInVertical) {
                rangeStyle.mSizePerSpan = (mTotalSize - (count - 1) * rangeStyle.mHGap) / count;
            } else {
                rangeStyle.mSizePerSpan = (mTotalSize - (count - 1) * rangeStyle.mVGap) / count;
            }
        } else if (!layingOutInPrimaryDirection && remainingSpan == 0 && (count == consumedSpanCount) && rangeStyle.mIsAutoExpand) {
            //autoExpand only support when each cell occupy one span.
            if (layoutInVertical) {
                rangeStyle.mSizePerSpan = (mTotalSize - (count - 1) * rangeStyle.mHGap) / count;
            } else {
                rangeStyle.mSizePerSpan = (mTotalSize - (count - 1) * rangeStyle.mVGap) / count;
            }
        }


        boolean weighted = false;
        if (rangeStyle.mWeights != null && rangeStyle.mWeights.length > 0) {
            weighted = true;
            int totalSpace;
            if (layoutInVertical) {
                totalSpace = mTotalSize - (count - 1) * rangeStyle.mHGap;
            } else {
                totalSpace = mTotalSize - (count - 1) * rangeStyle.mVGap;
            }

            // calculate width with weight in percentage

            int eqCnt = 0, remainingSpace = totalSpace;
            int colCnt = (remainingSpan > 0 && rangeStyle.mIsAutoExpand) ? count : rangeStyle.mSpanCount;
            for (int i = 0; i < colCnt; i++) {
                if (i < rangeStyle.mWeights.length && !Float.isNaN(rangeStyle.mWeights[i]) && rangeStyle.mWeights[i] >= 0) {
                    float weight = rangeStyle.mWeights[i];
                    rangeStyle.mSpanCols[i] = (int) (weight * 1.0f / 100 * totalSpace + 0.5f);
                    remainingSpace -= rangeStyle.mSpanCols[i];
                } else {
                    eqCnt++;
                    rangeStyle.mSpanCols[i] = -1;
                }
            }

            if (eqCnt > 0) {
                int eqLength = remainingSpace / eqCnt;
                for (int i = 0; i < colCnt; i++) {
                    if (rangeStyle.mSpanCols[i] < 0) {
                        rangeStyle.mSpanCols[i] = eqLength;
                    }
                }
            }
        }


        for (int i = 0; i < count; i++) {
            View view = rangeStyle.mSet[i];
            helper.addChildView(layoutState, view, layingOutInPrimaryDirection ? -1 : 0);

            int spanSize = getSpanSize(rangeStyle.mSpanSizeLookup, recycler, state, helper.getPosition(view)), spec;
            if (weighted) {
                final int index = rangeStyle.mSpanIndices[i];
                int spanLength = 0;
                for (int j = 0; j < spanSize; j++) {
                    spanLength += rangeStyle.mSpanCols[j + index];
                }

                spec = View.MeasureSpec.makeMeasureSpec(Math.max(0, spanLength), View.MeasureSpec.EXACTLY);
            } else {
                spec = View.MeasureSpec.makeMeasureSpec(rangeStyle.mSizePerSpan * spanSize +
                        Math.max(0, spanSize - 1) * (layoutInVertical ? rangeStyle.mHGap : rangeStyle.mVGap),
                    View.MeasureSpec.EXACTLY);
            }
            final LayoutParams lp = (LayoutParams) view.getLayoutParams();
            if (helper.getOrientation() == VERTICAL) {
                helper.measureChildWithMargins(view, spec, getMainDirSpec(rangeStyle, lp.height, mTotalSize,
                    View.MeasureSpec.getSize(spec), lp.mAspectRatio));
            } else {
                helper.measureChildWithMargins(view,
                    getMainDirSpec(rangeStyle, lp.width, mTotalSize, View.MeasureSpec.getSize(spec),
                        lp.mAspectRatio), View.MeasureSpec.getSize(spec));
            }
            final int size = orientationHelper.getDecoratedMeasurement(view);
            if (size > maxSize) {
                maxSize = size;
            }
        }

        // views that did not measure the maxSize has to be re-measured
        final int maxMeasureSpec = getMainDirSpec(rangeStyle, maxSize, mTotalSize, 0, Float.NaN);
        for (int i = 0; i < count; i++) {
            final View view = rangeStyle.mSet[i];
            if (orientationHelper.getDecoratedMeasurement(view) != maxSize) {
                int spanSize = getSpanSize(rangeStyle.mSpanSizeLookup, recycler, state, helper.getPosition(view)), spec;
                if (weighted) {
                    final int index = rangeStyle.mSpanIndices[i];
                    int spanLength = 0;
                    for (int j = 0; j < spanSize; j++) {
                        spanLength += rangeStyle.mSpanCols[j + index];
                    }

                    spec = View.MeasureSpec.makeMeasureSpec(Math.max(0, spanLength), View.MeasureSpec.EXACTLY);
                } else {
                    spec = View.MeasureSpec.makeMeasureSpec(rangeStyle.mSizePerSpan * spanSize +
                            Math.max(0, spanSize - 1) * (layoutInVertical ? rangeStyle.mHGap : rangeStyle.mVGap),
                        View.MeasureSpec.EXACTLY);
                }

                if (helper.getOrientation() == VERTICAL) {
                    helper.measureChildWithMargins(view, spec, maxMeasureSpec);
                } else {
                    helper.measureChildWithMargins(view, maxMeasureSpec, spec);
                }
            }
        }

        int startSpace = 0, endSpace = 0;

        int secondStartSpace = 0, secondEndSpace = 0;
        boolean isLayoutEnd = layoutState.getLayoutDirection() == VirtualLayoutManager.LayoutStateWrapper.LAYOUT_END;
        final boolean isOverLapMargin = helper.isEnableMarginOverLap();

        if (isStartLine) {
            startSpace = computeStartSpace(helper, layoutInVertical, isLayoutEnd, isOverLapMargin);
        }
        if (isSecondStartLine) {
            secondStartSpace = (layoutInVertical ? rangeStyle.getMarginTop() + rangeStyle.getPaddingTop()
                : rangeStyle.getMarginLeft() + rangeStyle.getPaddingLeft());
        }

        if (isEndLine) {
            endSpace = layoutInVertical ? mRangeStyle.getMarginBottom() + mRangeStyle.getPaddingBottom()
                : mRangeStyle.getMarginRight() + mRangeStyle.getPaddingRight();
        }
        if (isSecondEndLine) {
            secondEndSpace = (layoutInVertical ? rangeStyle.getMarginBottom() + rangeStyle.getPaddingBottom()
                : rangeStyle.getMarginRight() + rangeStyle.getPaddingRight());
        }


        result.mConsumed = maxSize + startSpace + endSpace + secondStartSpace + secondEndSpace;

        final boolean layoutStart = layoutState.getLayoutDirection() == LayoutStateWrapper.LAYOUT_START;
        int consumedGap = 0;
        if (!mLayoutWithAnchor) {
            if (!layoutStart) {
                if (!isStartLine) {
                    if (isSecondStartLine) {
                        consumedGap = (layoutInVertical ? rangeStyle.mParent.mVGap : rangeStyle.mParent.mHGap);
                        if (DEBUG) {
                            Log.d(TAG, "⬇ " + currentPosition + " 1 " + consumedGap + " gap");
                        }
                    } else {
                        consumedGap = (layoutInVertical ? rangeStyle.mVGap : rangeStyle.mHGap);
                        if (DEBUG) {
                            Log.d(TAG, "⬇ " + currentPosition + " 2 " + consumedGap + " gap");
                        }
                    }
                }
            } else {
                if (!isEndLine) {
                    if (isSecondEndLine) {
                        consumedGap = (layoutInVertical ? rangeStyle.mParent.mVGap : rangeStyle.mParent.mHGap);
                        if (DEBUG) {
                            Log.d(TAG, "⬆ " + currentPosition + " 3 " + consumedGap + " gap");
                        }
                    } else {
                        consumedGap = (layoutInVertical ? rangeStyle.mVGap : rangeStyle.mHGap);
                        if (DEBUG) {
                            Log.d(TAG, "⬆ " + currentPosition + " 4 " + consumedGap + " gap");
                        }
                    }
                }
            }
        }
        result.mConsumed += consumedGap;

        if (result.mConsumed <= 0) {
            result.mConsumed = 0;
        }

        int lastUnconsumedSpace = 0;
        /** layoutView() may be triggered by layoutManager's scrollInternalBy() or onFocusSearchFailed() or onLayoutChildren()
         *
         * In case of scrollInternalBy() or onFocusSearchFailed(), layoutState.isRefreshLayout() == false, and layoutState.mOffset = ChildClosestToExpose + alignOffset,
         * see {@link com.alibaba.android.vlayout.ExposeLinearLayoutManagerEx#updateLayoutStateExpose(int, int, boolean, State)},
         * this means last line's layout padding or margin is not really consumed, so considering it before layout new line.
         *
         * In case of onLayoutChildren(), layoutState.isRefreshLayout() == true, and layoutState.mOffset = anchorInfo.mCoordinate = anchorChild.start + alignOffset,
         * see {@link com.alibaba.android.vlayout.ExposeLinearLayoutManagerEx#updateAnchorInfoForLayoutExpose(State, AnchorInfo)},
         * this means last line's layout padding or margin is consumed.
         **/
        if (!layoutState.isRefreshLayout()) {
            if (layoutStart) {
                int lastLinePosition = currentPosition + 1;
                if (!isOutOfRange(lastLinePosition)) {
                    RangeStyle<GridRangeStyle> neighbourRange = mRangeStyle.findRangeStyleByPosition(lastLinePosition);
                    if (neighbourRange.isFirstPosition(lastLinePosition)) {
                        lastUnconsumedSpace = layoutInVertical ? neighbourRange.getMarginTop() + neighbourRange.getPaddingTop()
                            : neighbourRange.getMarginLeft() + neighbourRange.getPaddingLeft();
                        if (DEBUG) {
                            Log.d(TAG, "⬆ " + currentPosition + " 1 " + lastUnconsumedSpace + " last");
                        }
                    }
                }
            } else {
                int lastLinePosition = currentPosition - 1;
                if (!isOutOfRange(lastLinePosition)) {
                    RangeStyle<GridRangeStyle> neighbourRange = mRangeStyle.findRangeStyleByPosition(lastLinePosition);
                    if (neighbourRange.isLastPosition(lastLinePosition)) {
                        lastUnconsumedSpace = layoutInVertical ? neighbourRange.getMarginBottom() + neighbourRange.getPaddingBottom()
                            : neighbourRange.getMarginRight() + neighbourRange.getPaddingRight();
                        if (DEBUG) {
                            Log.d(TAG, "⬇ " + currentPosition + " 2 " + lastUnconsumedSpace + " last");
                        }
                    }
                }
            }
        }

        if (DEBUG) {
            Log.d(TAG,
                (layoutStart ? "⬆ " : "⬇ ") + currentPosition + " consumed " + result.mConsumed + " startSpace " + startSpace + " endSpace "
                    + endSpace + " secondStartSpace " + secondStartSpace + " secondEndSpace " + secondEndSpace + " lastUnconsumedSpace " + lastUnconsumedSpace);
        }

        int left = 0, right = 0, top = 0, bottom = 0;
        if (layoutInVertical) {
            if (layoutStart) {
                bottom = layoutState.getOffset() - endSpace - secondEndSpace - (consumedGap) - lastUnconsumedSpace;
                top = bottom - maxSize;
            } else {
                top = layoutState.getOffset() + startSpace + secondStartSpace + (consumedGap) + lastUnconsumedSpace;
                bottom = top + maxSize;
            }
        } else {
            if (layoutStart) {
                right = layoutState.getOffset() - endSpace - (consumedGap) - lastUnconsumedSpace;
                left = right - maxSize;
            } else {
                left = layoutState.getOffset() + startSpace + (consumedGap) + lastUnconsumedSpace;
                right = left + maxSize;
            }
        }

        for (int i = 0; i < count; i++) {
            View view = rangeStyle.mSet[i];
            final int index = rangeStyle.mSpanIndices[i];

            LayoutParams params = (LayoutParams) view.getLayoutParams();
            if (layoutInVertical) {
                if (weighted) {
                    left = helper.getPaddingLeft() + rangeStyle.getFamilyMarginLeft() + rangeStyle.getFamilyPaddingLeft();
                    for (int j = 0; j < index; j++) {
                        left += rangeStyle.mSpanCols[j] + rangeStyle.mHGap;
                    }
                } else {
                    left = helper.getPaddingLeft() + rangeStyle.getFamilyMarginLeft() + rangeStyle
                        .getFamilyPaddingLeft() + rangeStyle.mSizePerSpan * index + index * rangeStyle.mHGap;
                }

                right = left + orientationHelper.getDecoratedMeasurementInOther(view);
            } else {

                if (weighted) {
                    top = helper.getPaddingTop() + rangeStyle.getFamilyMarginTop() + rangeStyle.getFamilyPaddingTop();
                    for (int j = 0; j < index; j++) {
                        top += rangeStyle.mSpanCols[j] + rangeStyle.mVGap;
                    }
                } else {
                    top = helper.getPaddingTop() + rangeStyle.getFamilyMarginTop() + rangeStyle.getFamilyPaddingTop()
                        + rangeStyle.mSizePerSpan * index + index * rangeStyle.mVGap;
                }

                bottom = top + orientationHelper.getDecoratedMeasurementInOther(view);
            }

            if (DEBUG) {
                Log.d(TAG, "layout item in position: " + params.getViewPosition() + " with text with SpanIndex: " + index + " into (" +
                    left + ", " + top + ", " + right + ", " + bottom + " )");
            }

            // We calculate everything with View's bounding box (which includes decor and margins)
            // To calculate correct layout position, we subtract margins.
            rangeStyle.layoutChild(view, left, top, right, bottom, helper, false);

            // Consume the available space if the view is not removed OR changed
            if (params.isItemRemoved() || params.isItemChanged()) {
                result.mIgnoreConsumed = true;
            }

            result.mFocusable |= view.isFocusable();
        }


        mLayoutWithAnchor = false;
        Arrays.fill(rangeStyle.mSet, null);
        Arrays.fill(rangeStyle.mSpanIndices, 0);
        Arrays.fill(rangeStyle.mSpanCols, 0);
    }
855904
private void addViewHolders(Rect filledArea) {
        //search indexes for columns and rows which NEED TO BE showed in this area
        int leftColumn = mManager.getColumnByXWithShift(filledArea.left, mSettings.getCellMargin());
        int rightColumn = mManager.getColumnByXWithShift(filledArea.right, mSettings.getCellMargin());
        int topRow = mManager.getRowByYWithShift(filledArea.top, mSettings.getCellMargin());
        int bottomRow = mManager.getRowByYWithShift(filledArea.bottom, mSettings.getCellMargin());

        for (int i = topRow; i <= bottomRow; i++) {
            for (int j = leftColumn; j <= rightColumn; j++) {
                // item view holders
                ViewHolder viewHolder = mViewHolders.get(i, j);
                if (viewHolder == null && mAdapter != null) {
                    addViewHolder(i, j, ViewHolderType.ITEM);
                }
            }

            // row view headers holders
            ViewHolder viewHolder = mHeaderRowViewHolders.get(i);
            if (viewHolder == null && mAdapter != null) {
                addViewHolder(i, isRTL() ? mManager.getColumnCount() : 0, ViewHolderType.ROW_HEADER);
            } else if (viewHolder != null && mAdapter != null) {
                refreshHeaderRowViewHolder(viewHolder);
            }
        }

        for (int i = leftColumn; i <= rightColumn; i++) {
            // column view header holders
            ViewHolder viewHolder = mHeaderColumnViewHolders.get(i);
            if (viewHolder == null && mAdapter != null) {
                addViewHolder(0, i, ViewHolderType.COLUMN_HEADER);
            } else if (viewHolder != null && mAdapter != null) {
                refreshHeaderColumnViewHolder(viewHolder);
            }
        }

        // add view left top view.
        if (mLeftTopViewHolder == null && mAdapter != null) {
            mLeftTopViewHolder = mAdapter.onCreateLeftTopHeaderViewHolder(AdaptiveTableLayout.this);
            mLeftTopViewHolder.setItemType(ViewHolderType.FIRST_HEADER);
            View view = mLeftTopViewHolder.getItemView();
            view.setTag(R.id.tag_view_holder, mLeftTopViewHolder);
            addView(view, 0);
            mAdapter.onBindLeftTopHeaderViewHolder(mLeftTopViewHolder);
            view.measure(
                    MeasureSpec.makeMeasureSpec(mManager.getHeaderRowWidth(), MeasureSpec.EXACTLY),
                    MeasureSpec.makeMeasureSpec(mManager.getHeaderColumnHeight(), MeasureSpec.EXACTLY));

            int viewPosLeft = mSettings.getCellMargin();
            if (isRTL()) {
                viewPosLeft += getRowHeaderStartX();
            }
            int viewPosRight = viewPosLeft + mManager.getHeaderRowWidth();
            int viewPosTop = mSettings.getCellMargin();
            int viewPosBottom = viewPosTop + mManager.getHeaderColumnHeight();

            view.layout(viewPosLeft,
                    viewPosTop,
                    viewPosRight,
                    viewPosBottom);
        } else if (mLeftTopViewHolder != null && mAdapter != null) {
            refreshLeftTopHeaderViewHolder(mLeftTopViewHolder);
        }
    }
572810
@Override
    public void bindView(ViewHolder holder, List<Object> payloads) {
        //set the selected state of this item. force this otherwise it may is missed when implementing an item
        holder.itemView.setSelected(isSelected());

        //set the name
        holder.name.setText(name);
    }
375881
private String parseOuterClassName() {
		StringBuilder sb = new StringBuilder();
		sb.append(parseJavaId());
		while (peekChar() == packageSeparator) { // '/' or '.'
			nextChar(packageSeparator);
			sb.append('.');
			sb.append(parseJavaId());
		}
		return sb.toString();
	}
778966
private void refreshViewHolders() {
        if (mAdapter != null) {

            for (ViewHolder holder : mViewHolders.getAll()) {
                if (holder != null) {
                    // cell item
                    refreshItemViewHolder(holder, mState.isRowDragging(), mState.isColumnDragging());
                }
            }

            if (mState.isColumnDragging()) {
                refreshAllColumnHeadersHolders();
                refreshAllRowHeadersHolders();
            } else {
                refreshAllRowHeadersHolders();
                refreshAllColumnHeadersHolders();
            }

            if (mLeftTopViewHolder != null) {
                refreshLeftTopHeaderViewHolder(mLeftTopViewHolder);
                mLeftTopViewHolder.getItemView().bringToFront();
            }


        }
    }
603974
@Override
    public void onBindViewHolder(RecyclerView.ViewHolder holder, int position, List payloads) {
        if (shouldInsertItemAtPosition(position)) {
            getItem(position).bindView(holder, payloads);
        } else {
            mAdapter.onBindViewHolder(holder, position - itemInsertedBeforeCount(position), payloads);
        }
    }
458826
protected
  Appender parseAppender (Element appenderElement) {
    String className = subst(appenderElement.getAttribute(CLASS_ATTR));
    LogLog.debug("Class name: [" + className+']');    
    try {
      Object instance 	= Loader.loadClass(className).newInstance();
      Appender appender	= (Appender)instance;
      PropertySetter propSetter = new PropertySetter(appender);

      appender.setName(subst(appenderElement.getAttribute(NAME_ATTR)));
      
      NodeList children	= appenderElement.getChildNodes();
      final int length 	= children.getLength();

      for (int loop = 0; loop < length; loop++) {
	Node currentNode = children.item(loop);

	/* We're only interested in Elements */
	if (currentNode.getNodeType() == Node.ELEMENT_NODE) {
	  Element currentElement = (Element)currentNode;

	  // Parse appender parameters 
	  if (currentElement.getTagName().equals(PARAM_TAG)) {
            setParameter(currentElement, propSetter);
	  }
	  // Set appender layout
	  else if (currentElement.getTagName().equals(LAYOUT_TAG)) {
	    appender.setLayout(parseLayout(currentElement));
	  }
	  // Add filters
	  else if (currentElement.getTagName().equals(FILTER_TAG)) {
	    parseFilters(currentElement, appender);
	  }
	  else if (currentElement.getTagName().equals(ERROR_HANDLER_TAG)) {
	    parseErrorHandler(currentElement, appender);
	  }
	  else if (currentElement.getTagName().equals(APPENDER_REF_TAG)) {
	    String refName = subst(currentElement.getAttribute(REF_ATTR));
	    if(appender instanceof AppenderAttachable) {
	      AppenderAttachable aa = (AppenderAttachable) appender;
	      LogLog.debug("Attaching appender named ["+ refName+
			   "] to appender named ["+ appender.getName()+"].");
	      aa.addAppender(findAppenderByReference(currentElement));
	    } else {
	      LogLog.error("Requesting attachment of appender named ["+
			   refName+ "] to appender named ["+ appender.getName()+
                "] which does not implement org.apache.log4j.spi.AppenderAttachable.");
	    }
	  } else {
          parseUnrecognizedElement(instance, currentElement, props);
      }
	}
      }
      propSetter.activate();
      return appender;
    }
    /* Yes, it's ugly.  But all of these exceptions point to the same
       problem: we can't create an Appender */
    catch (Exception oops) {
      LogLog.error("Could not create an Appender. Reported error follows.",
		   oops);
      return null;
    }
  }
681862
@Override
    public RecyclerView.ViewHolder onPostCreateViewHolder(FastAdapter<Item> fastAdapter, RecyclerView.ViewHolder viewHolder) {
        EventHookUtil.bind(viewHolder, fastAdapter.getEventHooks());
        return viewHolder;
    }
638156
public static ItemViewHolder createViewHolder(View view, Class<? extends ItemViewHolder> itemViewHolderClass) {
        try {
            Constructor<? extends ItemViewHolder> constructor = itemViewHolderClass.getConstructor(View.class);
            return constructor.newInstance(view);
        } catch (IllegalAccessException e) {
            throw new RuntimeException(e);
        } catch (NoSuchMethodException e) {
            throw new RuntimeException("Unable to find a public constructor that takes an argument View in " +
                    itemViewHolderClass.getSimpleName(), e);
        } catch (InvocationTargetException e) {
            throw new RuntimeException(e.getTargetException());
        } catch (InstantiationException e) {
            throw new RuntimeException("Unable to instantiate " + itemViewHolderClass.getSimpleName(),  e);
        }
    }
978321
@Override
    public VersionViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(parent.getContext())
                .inflate(R.layout.layout_change_item, parent, false);
        return new VersionViewHolder(view);
    }
1360143
private void inflateWidgetLayout(Context context, int layoutId) {
        inflate(context, layoutId, this);

        floatingLabel = (TextView) findViewById(R.id.flw_floating_label);
        if (floatingLabel == null) {
            throw new RuntimeException("Your layout must have a TextView whose ID is @id/flw_floating_label");
        }

        View iw = findViewById(R.id.flw_input_widget);
        if (iw == null) {
            throw new RuntimeException("Your layout must have an input widget whose ID is @id/flw_input_widget");
        }
        try {
            inputWidget = (InputWidgetT) iw;
        } catch (ClassCastException e) {
            throw new RuntimeException("The input widget is not of the expected type");
        }
    }
938360
public function getLayoutPlaceHolderNames()
	{
		$layout = $this->getLayout();

		if ($layout === null) {
			return null;
		}

		return $this->getLayoutProcessor()
				->getPlaces($layout->getFileName());
	}
367540
@Override
    public VH getViewHolder(ViewGroup parent) {
        return getViewHolder(LayoutInflater.from(parent.getContext()).inflate(getLayoutRes(), parent, false));
    }
1300493
@Nullable
    private ViewHolder createViewHolder(int itemType) {
        if (itemType == ViewHolderType.ITEM) {
            return mAdapter.onCreateItemViewHolder(AdaptiveTableLayout.this);
        } else if (itemType == ViewHolderType.ROW_HEADER) {
            return mAdapter.onCreateRowHeaderViewHolder(AdaptiveTableLayout.this);
        } else if (itemType == ViewHolderType.COLUMN_HEADER) {
            return mAdapter.onCreateColumnHeaderViewHolder(AdaptiveTableLayout.this);
        }
        return null;
    }
339476
function mapLayoutToPageData(pageData, layoutData) {
  // quickly (and shallowly) go through the layout's properties,
  // finding strings that map to page properties
  _.each(layoutData, function (list, key) {
    if (_.isString(list)) {
      if (_.isArray(pageData[key])) {
        // if you find a match and the data exists,
        // replace the property in the layout data
        layoutData[key] = _.map(pageData[key], refToObj);
      } else {
        // otherwise replace it with an empty list
        // as all layout properties are component lists
        layoutData[key] = [];
      }
    }
  });

  return layoutData;
}
1103664
public ViewHolder getChildViewHolder(View child) {
        final ViewParent parent = child.getParent();
        if (parent != null && parent != this) {
            throw new IllegalArgumentException("View " + child + " is not a direct child of " +
                    this);
        }
        return getChildViewHolderInt(child);
    }