zshshr closed pull request #1392: * [android] add  pagingEnabled ="true"  
attribute of list component
URL: https://github.com/apache/incubator-weex/pull/1392
 
 
   

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/common/Constants.java 
b/android/sdk/src/main/java/com/taobao/weex/common/Constants.java
index 1dc90190e6..d077dcdffa 100644
--- a/android/sdk/src/main/java/com/taobao/weex/common/Constants.java
+++ b/android/sdk/src/main/java/com/taobao/weex/common/Constants.java
@@ -217,6 +217,9 @@
     String INCLUDE_FONT_PADDING = "includeFontPadding";
     String ENABLE_COPY = "enableCopy";
 
+    String PAGE_ENABLED = "pagingEnabled";
+
+
 
     interface  Recycler{
       String LIST_DATA = "listData";
diff --git 
a/android/sdk/src/main/java/com/taobao/weex/ui/component/list/WXListComponent.java
 
b/android/sdk/src/main/java/com/taobao/weex/ui/component/list/WXListComponent.java
index 0439345cdd..195d2ae0db 100644
--- 
a/android/sdk/src/main/java/com/taobao/weex/ui/component/list/WXListComponent.java
+++ 
b/android/sdk/src/main/java/com/taobao/weex/ui/component/list/WXListComponent.java
@@ -26,6 +26,7 @@
 import com.alibaba.fastjson.JSON;
 
 import android.content.Context;
+import android.support.v7.widget.PagerSnapHelper;
 import android.text.TextUtils;
 import com.taobao.weex.WXSDKInstance;
 import com.taobao.weex.annotation.Component;
@@ -81,6 +82,15 @@ protected BounceRecyclerView generateListView(Context 
context, int orientation)
         bounceRecyclerView.getSwipeLayout().setNestedScrollingEnabled(true);
       }
     }
+
+    /**
+     *  enable pagingEnabled attr
+     */
+    if(WXUtils.getBoolean(getAttrs().get(Constants.Name.PAGE_ENABLED),false)){
+      PagerSnapHelper snapHelper = new PagerSnapHelper();
+      snapHelper.attachToRecyclerView(bounceRecyclerView.getInnerView());
+    }
+
     return bounceRecyclerView;
   }
 


 

----------------------------------------------------------------
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