diff --git a/android/sdk/src/main/java/com/tencent/mtt/hippy/views/hippylist/PullHeaderRefreshHelper.java b/android/sdk/src/main/java/com/tencent/mtt/hippy/views/hippylist/PullHeaderRefreshHelper.java index dccc0b308..1e385add6 100644 --- a/android/sdk/src/main/java/com/tencent/mtt/hippy/views/hippylist/PullHeaderRefreshHelper.java +++ b/android/sdk/src/main/java/com/tencent/mtt/hippy/views/hippylist/PullHeaderRefreshHelper.java @@ -94,26 +94,6 @@ public class PullHeaderRefreshHelper extends PullRefreshHelper { } } - @Override - public void onRefreshCompleted() { - if (mRefreshStatus == PullRefreshStatus.PULL_STATUS_REFRESHING) { - // when only part of the header is visible, scroll it off the screen before hiding it - // to avoid inappropriate offsets of the list - if (HippyListUtils.isVerticalLayout(mRecyclerView)) { - int offsetY = mRecyclerView.getContentOffsetY(); - if (offsetY < 0 && offsetY > -mRenderNode.getHeight()) { - mRecyclerView.scrollBy(0, -offsetY); - } - } else { - int offsetX = mRecyclerView.getContentOffsetX(); - if (offsetX < 0 && offsetX > -mRenderNode.getWidth()) { - mRecyclerView.scrollBy(-offsetX, 0); - } - } - } - super.onRefreshCompleted(); - } - /** * scrollable distance from list start, value greater than or equal to 0 */ diff --git a/android/sdk/src/main/java/com/tencent/mtt/hippy/views/hippylist/PullRefreshHelper.java b/android/sdk/src/main/java/com/tencent/mtt/hippy/views/hippylist/PullRefreshHelper.java index b971ed7de..1e3d03517 100644 --- a/android/sdk/src/main/java/com/tencent/mtt/hippy/views/hippylist/PullRefreshHelper.java +++ b/android/sdk/src/main/java/com/tencent/mtt/hippy/views/hippylist/PullRefreshHelper.java @@ -72,13 +72,13 @@ public abstract class PullRefreshHelper { mRefreshStatus = PullRefreshStatus.PULL_STATUS_REFRESHING; sendReleasedEvent(); } - smoothScrollTo(getVisibleSize(), nodeSize, DURATION); + smoothResizeTo(getVisibleSize(), nodeSize, DURATION); } else { // only partially showing if (mRefreshStatus == PullRefreshStatus.PULL_STATUS_DRAGGING) { mRefreshStatus = PullRefreshStatus.PULL_STATUS_FOLDED; } if (visibleSize > 0) { - smoothScrollTo(getVisibleSize(), 0, DURATION); + smoothResizeTo(getVisibleSize(), 0, DURATION); } } } @@ -100,8 +100,7 @@ public abstract class PullRefreshHelper { public void onRefreshCompleted() { if (mRefreshStatus == PullRefreshStatus.PULL_STATUS_REFRESHING) { mRefreshStatus = PullRefreshStatus.PULL_STATUS_FOLDED; - endAnimation(); - setVisibleSize(0); + smoothResizeTo(getVisibleSize(), 0, DURATION); } } @@ -218,7 +217,7 @@ public abstract class PullRefreshHelper { mRecyclerView.dispatchLayout(); } - protected void smoothScrollTo(int fromValue, int toValue, int duration) { + protected void smoothResizeTo(int fromValue, int toValue, int duration) { endAnimation(); mAnimator = ValueAnimator.ofInt(fromValue, toValue); mAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {