You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by ky...@apache.org on 2018/12/12 07:52:50 UTC

[incubator-weex] branch master updated: Make scroller support on touch Event (#1896)

This is an automated email from the ASF dual-hosted git repository.

kyork pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-weex.git


The following commit(s) were added to refs/heads/master by this push:
     new 93a09d4  Make scroller support on touch Event (#1896)
93a09d4 is described below

commit 93a09d4bf5a768cce94eb85159c59fb1133dbf21
Author: darin <dy...@qq.com>
AuthorDate: Wed Dec 12 15:52:45 2018 +0800

    Make scroller support on touch Event (#1896)
---
 .../main/java/com/taobao/weex/ui/component/WXScroller.java | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/component/WXScroller.java b/android/sdk/src/main/java/com/taobao/weex/ui/component/WXScroller.java
index 12c79e6..2f6554d 100644
--- a/android/sdk/src/main/java/com/taobao/weex/ui/component/WXScroller.java
+++ b/android/sdk/src/main/java/com/taobao/weex/ui/component/WXScroller.java
@@ -120,6 +120,7 @@ public class WXScroller extends WXVContainer<ViewGroup> implements WXScrollViewL
    **/
   private Map<String, Map<String, WXComponent>> mStickyMap = new HashMap<>();
   private FrameLayout mRealView;
+  private FrameLayout mScrollerView;
 
   private int mContentHeight = 0;
 
@@ -144,7 +145,7 @@ public class WXScroller extends WXVContainer<ViewGroup> implements WXScrollViewL
    */
   @Override
   public ViewGroup getRealView() {
-    return mRealView;
+    return mScrollerView;
   }
 
 
@@ -280,7 +281,7 @@ public class WXScroller extends WXVContainer<ViewGroup> implements WXScrollViewL
    */
   @Override
   public void addSubView(View child, int index) {
-    if (child == null || getRealView() == null) {
+    if (child == null || mRealView == null) {
       return;
     }
 
@@ -288,12 +289,12 @@ public class WXScroller extends WXVContainer<ViewGroup> implements WXScrollViewL
       return;
     }
 
-    int count = getRealView().getChildCount();
+    int count = mRealView.getChildCount();
     index = index >= count ? -1 : index;
     if (index == -1) {
-      getRealView().addView(child);
+      mRealView.addView(child);
     } else {
-      getRealView().addView(child, index);
+      mRealView.addView(child, index);
     }
   }
 
@@ -480,7 +481,7 @@ public class WXScroller extends WXVContainer<ViewGroup> implements WXScrollViewL
               LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
       scrollView.addView(mRealView, layoutParams);
       scrollView.setHorizontalScrollBarEnabled(false);
-
+      mScrollerView = scrollView;
         final WXScroller component = this;
         final View.OnLayoutChangeListener listener = new View.OnLayoutChangeListener() {
           @Override
@@ -549,6 +550,7 @@ public class WXScroller extends WXVContainer<ViewGroup> implements WXScrollViewL
       innerView.addScrollViewListener(this);
       FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(
               LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
+      mScrollerView = innerView;
       innerView.addView(mRealView, layoutParams);
       innerView.setVerticalScrollBarEnabled(true);
       innerView.setNestedScrollingEnabled(WXUtils.getBoolean(getAttrs().get(Constants.Name.NEST_SCROLLING_ENABLED), true));