mirror of
https://gitee.com/houstudio/Cdroid.git
synced 2024-12-05 13:48:02 +08:00
fix some crash while itemanimator is opened
This commit is contained in:
parent
744a8f2ab5
commit
04f05b94f5
@ -2897,12 +2897,12 @@ void RecyclerView::offsetPositionRecordsForRemove(int positionStart, int itemCou
|
||||
ViewHolder* holder = getChildViewHolderInt(mChildHelper->getUnfilteredChildAt(i));
|
||||
if (holder && !holder->shouldIgnore()) {
|
||||
if (holder->mPosition >= positionEnd) {
|
||||
LOGD("offsetPositionRecordsForRemove attached child %d hold %p now at position %d",i
|
||||
,holder, (holder->mPosition - itemCount));
|
||||
LOGD("offsetPositionRecordsForRemove attached child %d(%p) hold %p now at position %d",
|
||||
i,holder->itemView ,holder, (holder->mPosition - itemCount));
|
||||
holder->offsetPosition(-itemCount, applyToPreLayout);
|
||||
mState->mStructureChanged = true;
|
||||
} else if (holder->mPosition >= positionStart) {
|
||||
LOGD("offsetPositionRecordsForRemove attached child %d holder %p now REMOVED",i,holder);
|
||||
LOGD("offsetPositionRecordsForRemove attached child %d(%p) holder %p now REMOVED",i,holder->itemView,holder);
|
||||
holder->flagRemovedAndOffsetPosition(positionStart - 1, -itemCount,applyToPreLayout);
|
||||
mState->mStructureChanged = true;
|
||||
}
|
||||
@ -6009,6 +6009,8 @@ RecyclerView::ViewHolder::ViewHolder(View* itemView) {
|
||||
FATAL_IF(itemView == nullptr,"itemView may not be null");
|
||||
this->itemView = itemView;
|
||||
mFlags = 0;
|
||||
mIsRecyclableCount = 0;
|
||||
mInChangeScrap = false;
|
||||
mPosition = NO_POSITION;
|
||||
mOldPosition = NO_POSITION;
|
||||
mPreLayoutPosition = NO_POSITION;
|
||||
|
@ -23,10 +23,10 @@ bool SimpleItemAnimator::animateDisappearance(RecyclerView::ViewHolder& viewHold
|
||||
disappearingItemView->layout(newLeft, newTop,
|
||||
newLeft + disappearingItemView->getWidth(),
|
||||
newTop + disappearingItemView->getHeight());
|
||||
LOGD_IF(_DEBUG,"DISAPPEARING: %p with view %p",viewHolder,disappearingItemView);
|
||||
LOGD_IF(_DEBUG,"DISAPPEARING: %p with view %p",&viewHolder,disappearingItemView);
|
||||
return animateMove(viewHolder, oldLeft, oldTop, newLeft, newTop);
|
||||
} else {
|
||||
LOGD_IF(_DEBUG,"REMOVED: %p with view %p",viewHolder,disappearingItemView);
|
||||
LOGD_IF(_DEBUG,"REMOVED: %p with view %p",&viewHolder,disappearingItemView);
|
||||
return animateRemove(viewHolder);
|
||||
}
|
||||
}
|
||||
@ -36,7 +36,7 @@ bool SimpleItemAnimator::animateAppearance(RecyclerView::ViewHolder& viewHolder,
|
||||
if (preLayoutInfo != nullptr && (preLayoutInfo->left != postLayoutInfo.left
|
||||
|| preLayoutInfo->top != postLayoutInfo.top)) {
|
||||
// slide items in if before/after locations differ
|
||||
LOGD_IF(_DEBUG,"APPEARING: %p with view %p" ,viewHolder,viewHolder);
|
||||
LOGD_IF(_DEBUG,"APPEARING: %p with view %p" ,&viewHolder,viewHolder.itemView);
|
||||
return animateMove(viewHolder, preLayoutInfo->left, preLayoutInfo->top,
|
||||
postLayoutInfo.left, postLayoutInfo.top);
|
||||
} else {
|
||||
@ -48,7 +48,7 @@ bool SimpleItemAnimator::animateAppearance(RecyclerView::ViewHolder& viewHolder,
|
||||
bool SimpleItemAnimator::animatePersistence(RecyclerView::ViewHolder& viewHolder,
|
||||
ItemHolderInfo& preInfo, ItemHolderInfo& postInfo) {
|
||||
if (preInfo.left != postInfo.left || preInfo.top != postInfo.top) {
|
||||
LOGD_IF(_DEBUG,"PERSISTENT: %p with view %p",viewHolder,viewHolder.itemView);
|
||||
LOGD_IF(_DEBUG,"PERSISTENT: %p with view %p",&viewHolder,viewHolder.itemView);
|
||||
return animateMove(viewHolder, preInfo.left, preInfo.top, postInfo.left, postInfo.top);
|
||||
}
|
||||
dispatchMoveFinished(viewHolder);
|
||||
@ -57,7 +57,7 @@ bool SimpleItemAnimator::animatePersistence(RecyclerView::ViewHolder& viewHolder
|
||||
|
||||
bool SimpleItemAnimator::animateChange(RecyclerView::ViewHolder& oldHolder, RecyclerView::ViewHolder& newHolder,
|
||||
ItemHolderInfo& preInfo, ItemHolderInfo& postInfo) {
|
||||
LOGD_IF(_DEBUG,"CHANGED: %p with view %p",oldHolder,oldHolder.itemView);
|
||||
LOGD_IF(_DEBUG,"CHANGED: %p with view %p",&oldHolder,oldHolder.itemView);
|
||||
const int fromLeft = preInfo.left;
|
||||
const int fromTop = preInfo.top;
|
||||
int toLeft, toTop;
|
||||
|
Loading…
Reference in New Issue
Block a user