mirror of
https://gitee.com/houstudio/Cdroid.git
synced 2024-12-04 21:27:41 +08:00
fix somebug of defaultitemanimator&viewinfostore
This commit is contained in:
parent
decdfdacbf
commit
512e066a15
@ -284,13 +284,14 @@ void DefaultItemAnimator::onChangeAnimationEnd(bool old,ChangeInfo*changeInfo,An
|
||||
View*view = holder == nullptr ? nullptr : holder->itemView;
|
||||
if(view&&holder){
|
||||
ViewPropertyAnimator& animator = view->animate();
|
||||
animator.setListener({});
|
||||
animator.setListener({});
|
||||
view->setAlpha(1);
|
||||
view->setTranslationX(0);
|
||||
view->setTranslationY(0);
|
||||
dispatchChangeFinished(*holder, old);
|
||||
auto it = std::find(mChangeAnimations.begin(),mChangeAnimations.end(),holder);
|
||||
mChangeAnimations.erase(it);//remove(*changeInfo.oldHolder);
|
||||
if(it!=mChangeAnimations.end())
|
||||
mChangeAnimations.erase(it);
|
||||
dispatchFinishedWhenDone();
|
||||
}
|
||||
|
||||
@ -438,7 +439,7 @@ void DefaultItemAnimator::endAnimation(RecyclerView::ViewHolder& item) {
|
||||
|
||||
//noinspection PointlessBooleanExpression,ConstantConditions
|
||||
itItem = std::find(mAddAnimations.begin(),mAddAnimations.end(),&item);
|
||||
if ( it!=mAddAnimations.end() ) {
|
||||
if ( itItem!=mAddAnimations.end() ) {
|
||||
mAddAnimations.erase(itItem);
|
||||
LOGE_IF(_DEBUG,"after animation is cancelled, item should not be in mAddAnimations list");
|
||||
}
|
||||
@ -452,7 +453,7 @@ void DefaultItemAnimator::endAnimation(RecyclerView::ViewHolder& item) {
|
||||
|
||||
//noinspection PointlessBooleanExpression,ConstantConditions
|
||||
itItem = std::find(mMoveAnimations.begin(),mMoveAnimations.end(),&item);
|
||||
if ( it!=mMoveAnimations.end() ) {
|
||||
if ( itItem!=mMoveAnimations.end() ) {
|
||||
mMoveAnimations.erase(itItem);
|
||||
LOGE_IF(_DEBUG,"after animation is cancelled, item should not be in mMoveAnimations list");
|
||||
}
|
||||
|
@ -2524,7 +2524,6 @@ void RecyclerView::dispatchLayoutStep3() {
|
||||
mViewInfoStore->addToPostLayout(holder, &animationInfo);
|
||||
} else {
|
||||
ItemAnimator::ItemHolderInfo* preInfo = mViewInfoStore->popFromPreLayout(oldChangeViewHolder);
|
||||
mViewInfoStore->popFromPreLayout(holder);//added by chenyang
|
||||
// we add and remove so that any post info is merged.
|
||||
mViewInfoStore->addToPostLayout(holder, &animationInfo);
|
||||
ItemAnimator::ItemHolderInfo* postInfo = mViewInfoStore->popFromPostLayout(holder);
|
||||
|
@ -162,7 +162,7 @@ void ViewInfoStore::process(ProcessCallback callback) {
|
||||
}
|
||||
|
||||
void ViewInfoStore::removeViewHolder(RecyclerView::ViewHolder* holder) {
|
||||
for (int i =mOldChangedHolders.size()-1;i>=0;i++){
|
||||
for (int i = mOldChangedHolders.size()-1;i>=0;i--){
|
||||
if (holder == mOldChangedHolders.valueAt(i)) {
|
||||
mOldChangedHolders.removeAt(i);
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user