public void SetItemSize(int itemIndex, float size) { int groupIndex = itemIndex / mItemMaxCountPerGroup; int indexInGroup = itemIndex % mItemMaxCountPerGroup; ItemSizeGroup tGroup = this.mItemSizeGroupList[groupIndex]; float changedSize = tGroup.SetItemSize(indexInGroup, size); if (changedSize != 0f) { if (groupIndex < this.mDirtyBeginIndex) { this.mDirtyBeginIndex = groupIndex; } } this.mTotalSize += changedSize; }
public void SetItemSize(int itemIndex, float size) { int groupIndex = itemIndex / mItemMaxCountPerGroup; int indexInGroup = itemIndex % mItemMaxCountPerGroup; ItemSizeGroup tGroup = mItemSizeGroupList[groupIndex]; float changedSize = tGroup.SetItemSize(indexInGroup, size); if (changedSize != 0f) { if (groupIndex < mDirtyBeginIndex) { mDirtyBeginIndex = groupIndex; } } mTotalSize += changedSize; if (groupIndex > mMaxNotEmptyGroupIndex && size > 0) { mMaxNotEmptyGroupIndex = groupIndex; } }
//根据总Item索引设置size大小 public void SetItemSize(int itemIndex, float size) { int groupIndex = itemIndex / mItemMaxCountPerGroup; //Item所在组的索引 int indexInGroup = itemIndex % mItemMaxCountPerGroup; //在组内的索引 ItemSizeGroup tGroup = mItemSizeGroupList[groupIndex]; float changedSize = tGroup.SetItemSize(indexInGroup, size); //更新总索引为itemIndex出的数据-》size,并返回新的Item大小减去之前的大小的差值 if (changedSize != 0f) { if (groupIndex < mDirtyBeginIndex) {//更新 mDirtyBeginIndex = groupIndex; } } mTotalSize += changedSize;//更新大小 if (groupIndex > mMaxNotEmptyGroupIndex && size > 0) { //更新最大不为空的组在链表中的索引 mMaxNotEmptyGroupIndex = groupIndex; } }