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

[GitHub] YorkShen closed pull request #1896: Make scroller support on touch Event

YorkShen closed pull request #1896: Make scroller support on touch Event
URL: https://github.com/apache/incubator-weex/pull/1896
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

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 12c79e6ddd..2f6554d7ea 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 WXComponent createInstance(WXSDKInstance instance, WXVContainer parent, B
    **/
   private Map<String, Map<String, WXComponent>> mStickyMap = new HashMap<>();
   private FrameLayout mRealView;
+  private FrameLayout mScrollerView;
 
   private int mContentHeight = 0;
 
@@ -144,7 +145,7 @@ public WXScroller(WXSDKInstance instance, WXVContainer parent, BasicComponentDat
    */
   @Override
   public ViewGroup getRealView() {
-    return mRealView;
+    return mScrollerView;
   }
 
 
@@ -280,7 +281,7 @@ private boolean shouldReport(int x, int y) {
    */
   @Override
   public void addSubView(View child, int index) {
-    if (child == null || getRealView() == null) {
+    if (child == null || mRealView == null) {
       return;
     }
 
@@ -288,12 +289,12 @@ public void addSubView(View child, int index) {
       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 void onScrollChanged(WXHorizontalScrollView scrollView, int x, int y, int
               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 @@ else if(event.getAction() == MotionEvent.ACTION_UP || event.getAction() == Motio
       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));


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services