Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fix #541
SwipeRefreshLayout 的reset方法在onDetachedFromWindow和mRefreshListener的onAnimationEnd都会调用,
void reset() {
mCircleView.clearAnimation();
mProgress.stop();
mCircleView.setVisibility(View.GONE);
setColorViewAlpha(MAX_ALPHA);
// Return the circle to its start position
if (mScale) {
setAnimationProgress(0 /* animation complete and view is hidden */);
} else {
setTargetOffsetTopAndBottom(mOriginalOffsetTop - mCurrentTargetOffsetTop);
}
mCurrentTargetOffsetTop = mCircleView.getTop();
}
mCircleView.clearAnimation后会回调onAnimationEnd,所以可能出现一种情况在onDetachedFromWindow后回调了监听器或者其他过程调用reset,里面都用到的了setAlpha,如果ActivityLeakFixer清除drawable资源就会导致外部的SwipeRefreshLayout调用出现异常。
SwipeRefreshLayout 这个库只是更多时候希望重置drawable,没有想要设置为null,因此ActivityLeakFixer忽略跳过删除drawable会比较好。