YorkShen closed pull request #1537: keep pageIndex if pageEnabled seted
URL: https://github.com/apache/incubator-weex/pull/1537
 
 
   

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 2bcdf21b65..814e8542cd 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
@@ -437,11 +437,15 @@ public void onScrollChanged(WXHorizontalScrollView 
scrollView, int x, int y, int
       scrollView.addView(mRealView, layoutParams);
       scrollView.setHorizontalScrollBarEnabled(false);
 
-      if(pageEnable && this.pageSize != 0) {
+      if(pageEnable) {
         mGestureDetector = new GestureDetector(new 
MyGestureDetector(scrollView));
         scrollView.setOnTouchListener(new View.OnTouchListener() {
           @Override
           public boolean onTouch(View v, MotionEvent event) {
+            if (pageSize == 0)  {
+              pageSize = v.getMeasuredWidth();
+            }
+
             if (mGestureDetector.onTouchEvent(event)) {
               return true;
             }
@@ -685,6 +689,11 @@ public void scrollTo(WXComponent component, Map<String, 
Object> options) {
       }
     }
 
+    if(pageEnable) {
+      mActiveFeature = mChildren.indexOf(component);
+    }
+
+
     int viewYInScroller=component.getAbsoluteY() - getAbsoluteY();
     int viewXInScroller=component.getAbsoluteX() - getAbsoluteX();
 


 

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to