mirror of
https://gitee.com/houstudio/Cdroid.git
synced 2024-12-02 04:07:42 +08:00
fix some memleak of itemtouchhelper
This commit is contained in:
parent
c5ebaa5009
commit
1a95f27a9a
@ -165,6 +165,7 @@ void ItemTouchHelper::destroyCallbacks() {
|
|||||||
for (int i = recoverAnimSize - 1; i >= 0; i--) {
|
for (int i = recoverAnimSize - 1; i >= 0; i--) {
|
||||||
RecoverAnimation* recoverAnimation = mRecoverAnimations.at(0);
|
RecoverAnimation* recoverAnimation = mRecoverAnimations.at(0);
|
||||||
mCallback->clearView(*mRecyclerView, *recoverAnimation->mViewHolder);
|
mCallback->clearView(*mRecyclerView, *recoverAnimation->mViewHolder);
|
||||||
|
delete recoverAnimation;
|
||||||
}
|
}
|
||||||
mRecoverAnimations.clear();
|
mRecoverAnimations.clear();
|
||||||
mOverdrawChild = nullptr;
|
mOverdrawChild = nullptr;
|
||||||
@ -557,6 +558,7 @@ void ItemTouchHelper::endRecoverAnimation(RecyclerView::ViewHolder& viewHolder,
|
|||||||
anim->cancel();
|
anim->cancel();
|
||||||
}
|
}
|
||||||
mRecoverAnimations.erase(mRecoverAnimations.begin()+i);//remove(i);
|
mRecoverAnimations.erase(mRecoverAnimations.begin()+i);//remove(i);
|
||||||
|
delete anim;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -174,7 +174,7 @@ public:
|
|||||||
int viewSize, int viewSizeOutOfBounds,int totalSize, long msSinceStartScroll);
|
int viewSize, int viewSizeOutOfBounds,int totalSize, long msSinceStartScroll);
|
||||||
};
|
};
|
||||||
|
|
||||||
class ItemTouchHelper::SimpleCallback:public ItemTouchHelper::Callback{// ItemTouchHelper::Callback {
|
class ItemTouchHelper::SimpleCallback:public ItemTouchHelper::Callback{
|
||||||
private:
|
private:
|
||||||
friend ItemTouchHelper;
|
friend ItemTouchHelper;
|
||||||
int mDefaultSwipeDirs;
|
int mDefaultSwipeDirs;
|
||||||
@ -232,5 +232,3 @@ public:
|
|||||||
};
|
};
|
||||||
}/*endof namespace*/
|
}/*endof namespace*/
|
||||||
#endif/*__ITEMTOUCH_HELPER_H__*/
|
#endif/*__ITEMTOUCH_HELPER_H__*/
|
||||||
|
|
||||||
|
|
||||||
|
@ -3,15 +3,15 @@ namespace cdroid{
|
|||||||
|
|
||||||
LinearSmoothScroller::LinearSmoothScroller(Context* context) {
|
LinearSmoothScroller::LinearSmoothScroller(Context* context) {
|
||||||
mDisplayMetrics = context->getDisplayMetrics();
|
mDisplayMetrics = context->getDisplayMetrics();
|
||||||
mLinearInterpolator = new LinearInterpolator();
|
mLinearInterpolator = LinearInterpolator::gLinearInterpolator.get();
|
||||||
mDecelerateInterpolator = new DecelerateInterpolator();
|
mDecelerateInterpolator = DecelerateInterpolator::gDecelerateInterpolator.get();
|
||||||
mTargetVectorUsable = false;
|
mTargetVectorUsable = false;
|
||||||
mHasCalculatedMillisPerPixel = false;
|
mHasCalculatedMillisPerPixel = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
LinearSmoothScroller::~LinearSmoothScroller(){
|
LinearSmoothScroller::~LinearSmoothScroller(){
|
||||||
delete mLinearInterpolator;
|
//delete mLinearInterpolator;
|
||||||
delete mDecelerateInterpolator;
|
//delete mDecelerateInterpolator;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LinearSmoothScroller::onStart() {
|
void LinearSmoothScroller::onStart() {
|
||||||
|
Loading…
Reference in New Issue
Block a user