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/10/19 12:52:26 UTC
[1/2] incubator-weex git commit: when touch use scroll handler,
when none touch use nonstop
Repository: incubator-weex
Updated Branches:
refs/heads/release-0.16 e391f39ff -> e2323d214
when touch use scroll handler, when none touch use nonstop
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/661e0a03
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/661e0a03
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/661e0a03
Branch: refs/heads/release-0.16
Commit: 661e0a03c921925c5e66fdcd23fbb70a209c7850
Parents: febb720
Author: jianbai.gbj <ji...@alibaba-inc.com>
Authored: Thu Oct 19 17:57:54 2017 +0800
Committer: jianbai.gbj <ji...@alibaba-inc.com>
Committed: Thu Oct 19 17:57:54 2017 +0800
----------------------------------------------------------------------
.../weex/ui/view/listview/WXRecyclerView.java | 24 +++++++++++++-------
1 file changed, 16 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/661e0a03/android/sdk/src/main/java/com/taobao/weex/ui/view/listview/WXRecyclerView.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/view/listview/WXRecyclerView.java b/android/sdk/src/main/java/com/taobao/weex/ui/view/listview/WXRecyclerView.java
index 20be140..b2a1793 100644
--- a/android/sdk/src/main/java/com/taobao/weex/ui/view/listview/WXRecyclerView.java
+++ b/android/sdk/src/main/java/com/taobao/weex/ui/view/listview/WXRecyclerView.java
@@ -42,6 +42,8 @@ public class WXRecyclerView extends RecyclerView implements WXGestureObservable
public static final int TYPE_STAGGERED_GRID_LAYOUT = 3;
private WXGesture mGesture;
private boolean scrollable = true;
+ private boolean hasTouch = false;
+
public WXRecyclerView(Context context) {
super(context);
@@ -91,6 +93,7 @@ public class WXRecyclerView extends RecyclerView implements WXGestureObservable
if(!scrollable) {
return true;
}
+ hasTouch = true;
boolean result = super.onTouchEvent(event);
if (mGesture != null) {
result |= mGesture.onTouch(this, event);
@@ -110,26 +113,31 @@ public class WXRecyclerView extends RecyclerView implements WXGestureObservable
}
//Any else?
} else {
+ smoothScrollToPosition(position);
if (offset != 0) {
setOnSmoothScrollEndListener(new ExtendedLinearLayoutManager.OnSmoothScrollEndListener() {
@Override
public void onStop() {
- if (orientation == Constants.Orientation.VERTICAL) {
- smoothScrollBy(0, offset);
- } else {
- smoothScrollBy(offset, 0);
- }
+ post(new Runnable() {
+ @Override
+ public void run() {
+ if (orientation == Constants.Orientation.VERTICAL) {
+ smoothScrollBy(0, offset);
+ } else {
+ smoothScrollBy(offset, 0);
+ }
+ }
+ });
}
});
}
- smoothScrollToPosition(position);
}
}
public void setOnSmoothScrollEndListener(final ExtendedLinearLayoutManager.OnSmoothScrollEndListener onSmoothScrollEndListener){
- if(getLayoutManager() instanceof ExtendedLinearLayoutManager){
+ if(getLayoutManager() instanceof ExtendedLinearLayoutManager && !hasTouch){
ExtendedLinearLayoutManager extendedLinearLayoutManager = (ExtendedLinearLayoutManager)getLayoutManager();
- extendedLinearLayoutManager.setOnScrollEndListener(onSmoothScrollEndListener);
+ extendedLinearLayoutManager.setOnScrollEndListener(onSmoothScrollEndListener);
}else{
addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
[2/2] incubator-weex git commit: * [android] when touch use scroll
handler, when none touch use nonstop
Posted by gu...@apache.org.
* [android] when touch use scroll handler, when none touch use nonstop
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/e2323d21
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/e2323d21
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/e2323d21
Branch: refs/heads/release-0.16
Commit: e2323d214f62ff5c1610909b34724aa4fcbb27db
Parents: e391f39 661e0a0
Author: gurisxie <27...@qq.com>
Authored: Thu Oct 19 20:51:50 2017 +0800
Committer: gurisxie <27...@qq.com>
Committed: Thu Oct 19 20:52:18 2017 +0800
----------------------------------------------------------------------
.../weex/ui/view/listview/WXRecyclerView.java | 24 +++++++++++++-------
1 file changed, 16 insertions(+), 8 deletions(-)
----------------------------------------------------------------------