You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by gu...@apache.org on 2017/11/15 03:26:52 UTC
[4/7] incubator-weex git commit: nested scroll helper
nested scroll helper
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/d4c004bd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/d4c004bd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/d4c004bd
Branch: refs/heads/master
Commit: d4c004bde700e5ccc7b5d2d1b974ede8ceb34c1f
Parents: 69f634a
Author: jianbai.gbj <ji...@alibaba-inc.com>
Authored: Mon Oct 30 20:20:57 2017 +0800
Committer: jianbai.gbj <ji...@alibaba-inc.com>
Committed: Mon Oct 30 20:20:57 2017 +0800
----------------------------------------------------------------------
.../ui/view/refresh/core/WXSwipeLayout.java | 32 ++++++++++++--------
1 file changed, 19 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/d4c004bd/android/sdk/src/main/java/com/taobao/weex/ui/view/refresh/core/WXSwipeLayout.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/view/refresh/core/WXSwipeLayout.java b/android/sdk/src/main/java/com/taobao/weex/ui/view/refresh/core/WXSwipeLayout.java
index 1676c99..e1ec10b 100644
--- a/android/sdk/src/main/java/com/taobao/weex/ui/view/refresh/core/WXSwipeLayout.java
+++ b/android/sdk/src/main/java/com/taobao/weex/ui/view/refresh/core/WXSwipeLayout.java
@@ -297,18 +297,6 @@ public class WXSwipeLayout extends FrameLayout implements NestedScrollingParent,
mNestedScrollInProgress = true;
}
- /**
- * Callback on TouchEvent.ACTION_CANCLE or TouchEvent.ACTION_UP
- * handler : refresh or loading
- * @param child : child view of SwipeLayout,RecyclerView or Scroller
- */
- @Override
- public void onStopNestedScroll(View child) {
- mNestedScrollingParentHelper.onStopNestedScroll(child);
- mNestedScrollInProgress = true;
- handlerAction();
- stopNestedScroll();
- }
/**
* With child view to processing move events
@@ -320,6 +308,12 @@ public class WXSwipeLayout extends FrameLayout implements NestedScrollingParent,
@Override
public void onNestedPreScroll(View target, int dx, int dy, int[] consumed) {
if ((!mPullRefreshEnable && !mPullLoadEnable)) {
+ // Now let our nested parent consume the leftovers
+ final int[] parentConsumed = mParentScrollConsumed;
+ if (dispatchNestedPreScroll(dx - consumed[0], dy - consumed[1], parentConsumed, null)) {
+ consumed[0] += parentConsumed[0];
+ consumed[1] += parentConsumed[1];
+ }
return;
}
@@ -338,7 +332,6 @@ public class WXSwipeLayout extends FrameLayout implements NestedScrollingParent,
if (moveSpinner(-dy)) {
consumed[1] += dy;
}
-
// Now let our nested parent consume the leftovers
final int[] parentConsumed = mParentScrollConsumed;
if (dispatchNestedPreScroll(dx - consumed[0], dy - consumed[1], parentConsumed, null)) {
@@ -353,6 +346,19 @@ public class WXSwipeLayout extends FrameLayout implements NestedScrollingParent,
}
+ /**
+ * Callback on TouchEvent.ACTION_CANCLE or TouchEvent.ACTION_UP
+ * handler : refresh or loading
+ * @param child : child view of SwipeLayout,RecyclerView or Scroller
+ */
+ @Override
+ public void onStopNestedScroll(View child) {
+ mNestedScrollingParentHelper.onStopNestedScroll(child);
+ mNestedScrollInProgress = true;
+ handlerAction();
+ stopNestedScroll();
+ }
+
@Override
public void onNestedScroll(View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed) {