weex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cxf...@apache.org
Subject [02/25] incubator-weex git commit: * [android] add recycle column-count attribute
Date Thu, 02 Mar 2017 03:28:36 GMT
* [android] add recycle column-count attribute


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/aa807160
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/aa807160
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/aa807160

Branch: refs/heads/0.11-dev-recycler
Commit: aa80716051e03f1c49ac67d87a255325fe7d974d
Parents: a6a8283
Author: zshshr <zhengshihan918@gmail.com>
Authored: Fri Feb 17 17:51:06 2017 +0800
Committer: zshshr <zhengshihan918@gmail.com>
Committed: Fri Feb 17 17:51:06 2017 +0800

----------------------------------------------------------------------
 .../main/java/com/taobao/weex/WXSDKEngine.java  |  2 +-
 .../java/com/taobao/weex/common/Constants.java  |  6 +++
 .../main/java/com/taobao/weex/dom/WXAttr.java   | 39 +++++++++++++++++++-
 .../weex/ui/component/WXBasicComponentType.java |  1 +
 .../ui/component/list/BasicListComponent.java   |  5 +--
 .../ui/component/list/ListComponentView.java    |  3 --
 .../weex/ui/component/list/WXListComponent.java |  7 +++-
 .../weex/ui/view/listview/WXRecyclerView.java   | 11 +++---
 .../listview/adapter/ListBaseViewHolder.java    |  8 ++--
 .../adapter/RecyclerViewBaseAdapter.java        | 21 ++++++++---
 .../adapter/WXRecyclerViewOnScrollListener.java | 34 ++++++-----------
 .../ui/view/refresh/wrapper/BaseBounceView.java | 19 +++++-----
 .../refresh/wrapper/BounceRecyclerView.java     | 27 ++++++--------
 .../refresh/wrapper/BounceScrollerView.java     |  1 +
 14 files changed, 111 insertions(+), 73 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/aa807160/android/sdk/src/main/java/com/taobao/weex/WXSDKEngine.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/WXSDKEngine.java b/android/sdk/src/main/java/com/taobao/weex/WXSDKEngine.java
index a3266a9..973e52d 100755
--- a/android/sdk/src/main/java/com/taobao/weex/WXSDKEngine.java
+++ b/android/sdk/src/main/java/com/taobao/weex/WXSDKEngine.java
@@ -347,7 +347,7 @@ public class WXSDKEngine {
         WXBasicComponentType.SLIDER_NEIGHBOR
       );
       registerComponent(SimpleListComponent.class,false,"simplelist");
-      registerComponent(WXListComponent.class, false,WXBasicComponentType.LIST,WXBasicComponentType.VLIST);
+      registerComponent(WXListComponent.class, false,WXBasicComponentType.LIST,WXBasicComponentType.VLIST,WXBasicComponentType.RECYCLER);
       registerComponent(HorizontalListComponent.class,false,WXBasicComponentType.HLIST);
       registerComponent(WXBasicComponentType.CELL, WXCell.class, true);
       registerComponent(WXBasicComponentType.INDICATOR, WXIndicator.class, true);

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/aa807160/android/sdk/src/main/java/com/taobao/weex/common/Constants.java
----------------------------------------------------------------------
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 206926c..ba55d2f 100755
--- a/android/sdk/src/main/java/com/taobao/weex/common/Constants.java
+++ b/android/sdk/src/main/java/com/taobao/weex/common/Constants.java
@@ -302,6 +302,12 @@ public class Constants {
     String LOADMOREOFFSET = "loadmoreoffset";
     String RECYCLE_IMAGE = "recycleImage";
     String LAYOUT = "layout";
+    String MULTI_COLUMN= "multi-column";
+    String COLUMN_WIDTH= "columnWidth";
+    String COLUMN_COUNT= "columnCount";
+    String COLUMN_GAP= "columnGap";
+
+    String GRID= "grid";
     String OVERFLOW = "overflow";
     String TYPE = "type";
     String PLACEHOLDER = "placeholder";

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/aa807160/android/sdk/src/main/java/com/taobao/weex/dom/WXAttr.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/dom/WXAttr.java b/android/sdk/src/main/java/com/taobao/weex/dom/WXAttr.java
index 3286694..6714b0e 100755
--- a/android/sdk/src/main/java/com/taobao/weex/dom/WXAttr.java
+++ b/android/sdk/src/main/java/com/taobao/weex/dom/WXAttr.java
@@ -440,6 +440,34 @@ public class WXAttr implements Map<String, Object>,Cloneable {
     return ret;
   }
 
+  public int getColumnWidth(){
+
+    Object obj = get(Constants.Name.COLUMN_WIDTH);
+    if (obj == null) {
+      return 0;
+    }
+
+    try {
+      return Integer.parseInt(String.valueOf(obj));
+    } catch (Exception e) {
+      WXLogUtils.e("[WXAttr] getColumnWidth:", e);
+    }
+    return 0;
+  }
+
+  public int getColumnCount() {
+
+    Object obj = get(Constants.Name.COLUMN_COUNT);
+    if (obj == null) {
+      return 1;
+    }
+    try {
+      return Integer.parseInt(String.valueOf(obj));
+    } catch (Exception e) {
+      WXLogUtils.e("[WXAttr] getColumnCount:", e);
+      return 1;
+    }
+  }
   public int getLayoutType(){
     Object obj = get(Constants.Name.LAYOUT);
     if (obj == null) {
@@ -447,9 +475,16 @@ public class WXAttr implements Map<String, Object>,Cloneable {
     }
 
     try {
-      return Integer.parseInt(String.valueOf(obj));
+      switch(String.valueOf(obj)){
+        case Constants.Name.MULTI_COLUMN :
+          return  WXRecyclerView.TYPE_STAGGERED_GRID_LAYOUT;
+        case Constants.Name.GRID :
+          return  WXRecyclerView.TYPE_GRID_LAYOUT;
+        default:
+          return WXRecyclerView.TYPE_LINEAR_LAYOUT;
+      }
     } catch (Exception e) {
-      WXLogUtils.e("[WXAttr] recycleImage:", e);
+      WXLogUtils.e("[WXAttr] getLayoutType:", e);
     }
     return WXRecyclerView.TYPE_LINEAR_LAYOUT;
   }

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/aa807160/android/sdk/src/main/java/com/taobao/weex/ui/component/WXBasicComponentType.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/component/WXBasicComponentType.java
b/android/sdk/src/main/java/com/taobao/weex/ui/component/WXBasicComponentType.java
index 6d8da28..7d68799 100755
--- a/android/sdk/src/main/java/com/taobao/weex/ui/component/WXBasicComponentType.java
+++ b/android/sdk/src/main/java/com/taobao/weex/ui/component/WXBasicComponentType.java
@@ -218,6 +218,7 @@ public class WXBasicComponentType {
   public static final String SLIDER = "slider";
   public static final String SLIDER_NEIGHBOR = "slider-neighbor";
   public static final String LIST = "list";
+  public static final String RECYCLER = "recycler";
   public static final String VLIST = "vlist";
   public static final String HLIST = "hlist";
   public static final String CELL = "cell";

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/aa807160/android/sdk/src/main/java/com/taobao/weex/ui/component/list/BasicListComponent.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/component/list/BasicListComponent.java
b/android/sdk/src/main/java/com/taobao/weex/ui/component/list/BasicListComponent.java
index ce050bc..714eaea 100644
--- a/android/sdk/src/main/java/com/taobao/weex/ui/component/list/BasicListComponent.java
+++ b/android/sdk/src/main/java/com/taobao/weex/ui/component/list/BasicListComponent.java
@@ -284,6 +284,7 @@ public abstract class BasicListComponent<T extends ViewGroup &
ListComponentView
   private static boolean mDownForBidCacheViewHolder = false;
 
   protected int mLayoutType = WXRecyclerView.TYPE_LINEAR_LAYOUT;
+  protected int mColumnCount = 1;
 
   /**
    * Map for storing component that is sticky.
@@ -295,9 +296,6 @@ public abstract class BasicListComponent<T extends ViewGroup &
ListComponentView
   public BasicListComponent(WXSDKInstance instance, WXDomObject node, WXVContainer parent)
{
     super(instance, node, parent);
     stickyHelper = new WXStickyHelper(this);
-    if(node!=null && node.getAttrs() !=null) {
-      mLayoutType = node.getAttrs().getLayoutType();
-    }
   }
 
   /**
@@ -823,7 +821,6 @@ public abstract class BasicListComponent<T extends ViewGroup &
ListComponentView
 
     if (holder.getComponent() != null && holder.getComponent() instanceof WXCell)
{
       holder.getComponent().bindData(component);
-//              holder.getComponent().refreshData(component);
     }
 
   }

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/aa807160/android/sdk/src/main/java/com/taobao/weex/ui/component/list/ListComponentView.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/component/list/ListComponentView.java
b/android/sdk/src/main/java/com/taobao/weex/ui/component/list/ListComponentView.java
index 648c747..b95ea9e 100644
--- a/android/sdk/src/main/java/com/taobao/weex/ui/component/list/ListComponentView.java
+++ b/android/sdk/src/main/java/com/taobao/weex/ui/component/list/ListComponentView.java
@@ -204,9 +204,6 @@
  */
 package com.taobao.weex.ui.component.list;
 
-import android.support.v7.widget.RecyclerView;
-import android.view.View;
-
 import com.taobao.weex.ui.view.listview.WXRecyclerView;
 import com.taobao.weex.ui.view.listview.adapter.RecyclerViewBaseAdapter;
 

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/aa807160/android/sdk/src/main/java/com/taobao/weex/ui/component/list/WXListComponent.java
----------------------------------------------------------------------
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 8faa862..42dd9ff 100755
--- 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
@@ -237,11 +237,16 @@ public class WXListComponent extends BasicListComponent<BounceRecyclerView>
{
 
   public WXListComponent(WXSDKInstance instance, WXDomObject node, WXVContainer parent, boolean
lazy) {
     super(instance, node, parent);
+    if(node!=null && node.getAttrs() !=null) {
+      mLayoutType = node.getAttrs().getLayoutType();
+      mColumnCount = node.getAttrs().getColumnCount();
+    }
   }
 
   @Override
   protected BounceRecyclerView generateListView(Context context, int orientation) {
-    return new BounceRecyclerView(context, orientation).setLayoutType(mLayoutType);
+
+    return new BounceRecyclerView(context,mLayoutType,mColumnCount,orientation);
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/aa807160/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 a3bd821..4065308 100755
--- 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
@@ -223,7 +223,6 @@ public class WXRecyclerView extends RecyclerView implements WXGestureObservable
   public static final int TYPE_GRID_LAYOUT = 2;
   public static final int TYPE_STAGGERED_GRID_LAYOUT = 3;
   private WXGesture mGesture;
-
   private boolean scrollable = true;
 
   public WXRecyclerView(Context context) {
@@ -242,18 +241,20 @@ public class WXRecyclerView extends RecyclerView implements WXGestureObservable
   public boolean postDelayed(Runnable action, long delayMillis) {
     return super.postDelayed(WXThread.secure(action), delayMillis);
   }
-
+  public void initView(Context context, int type,int orientation) {
+    initView(context,type,0,orientation);
+  }
   /**
    *
    * @param context
    * @param type
    * @param orientation should be {@link OrientationHelper#HORIZONTAL} or {@link OrientationHelper#VERTICAL}
    */
-  public void initView(Context context, int type,int orientation) {
+  public void initView(Context context, int type,int spanCount,int orientation) {
     if (type == TYPE_GRID_LAYOUT) {
-      setLayoutManager(new GridLayoutManager(context, 2,orientation,false));
+      setLayoutManager(new GridLayoutManager(context, spanCount,orientation,false));
     } else if (type == TYPE_STAGGERED_GRID_LAYOUT) {
-      setLayoutManager(new StaggeredGridLayoutManager(2, orientation));
+      setLayoutManager(new StaggeredGridLayoutManager(spanCount, orientation));
     } else if (type == TYPE_LINEAR_LAYOUT) {
       setLayoutManager(new LinearLayoutManager(context,orientation,false){
 

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/aa807160/android/sdk/src/main/java/com/taobao/weex/ui/view/listview/adapter/ListBaseViewHolder.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/view/listview/adapter/ListBaseViewHolder.java
b/android/sdk/src/main/java/com/taobao/weex/ui/view/listview/adapter/ListBaseViewHolder.java
index e78c10a..c63ae6e 100755
--- a/android/sdk/src/main/java/com/taobao/weex/ui/view/listview/adapter/ListBaseViewHolder.java
+++ b/android/sdk/src/main/java/com/taobao/weex/ui/view/listview/adapter/ListBaseViewHolder.java
@@ -208,6 +208,7 @@ import android.support.v7.widget.RecyclerView;
 import android.view.View;
 
 import com.taobao.weex.ui.component.WXComponent;
+import com.taobao.weex.ui.component.WXHeader;
 
 import java.lang.ref.WeakReference;
 
@@ -231,6 +232,10 @@ public class ListBaseViewHolder extends RecyclerView.ViewHolder {
     mViewType = viewType;
   }
 
+  public boolean isFullSpan() {
+
+    return mComponent != null && mComponent.get() instanceof WXHeader;
+  }
 
   public boolean canRecycled(){
     if (mComponent!=null && mComponent.get() != null) {
@@ -242,9 +247,6 @@ public class ListBaseViewHolder extends RecyclerView.ViewHolder {
     return itemView;
   }
 
-  public int getViewType() {
-    return mViewType;
-  }
   public void setComponentUsing(boolean using){
     if(mComponent!=null && mComponent.get() != null)
         mComponent.get().setUsing(using);

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/aa807160/android/sdk/src/main/java/com/taobao/weex/ui/view/listview/adapter/RecyclerViewBaseAdapter.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/view/listview/adapter/RecyclerViewBaseAdapter.java
b/android/sdk/src/main/java/com/taobao/weex/ui/view/listview/adapter/RecyclerViewBaseAdapter.java
index 9c89ed1..2b77146 100755
--- a/android/sdk/src/main/java/com/taobao/weex/ui/view/listview/adapter/RecyclerViewBaseAdapter.java
+++ b/android/sdk/src/main/java/com/taobao/weex/ui/view/listview/adapter/RecyclerViewBaseAdapter.java
@@ -205,6 +205,7 @@
 package com.taobao.weex.ui.view.listview.adapter;
 
 import android.support.v7.widget.RecyclerView;
+import android.support.v7.widget.StaggeredGridLayoutManager;
 import android.view.ViewGroup;
 
 
@@ -213,7 +214,6 @@ import android.view.ViewGroup;
  */
 public class RecyclerViewBaseAdapter<T extends ListBaseViewHolder> extends RecyclerView.Adapter<T>
{
 
-  private String TAG = "RecyclerViewBaseAdapter";
   private IRecyclerAdapterListener iRecyclerAdapterListener;
 
   public RecyclerViewBaseAdapter(IRecyclerAdapterListener Listener) {
@@ -222,7 +222,6 @@ public class RecyclerViewBaseAdapter<T extends ListBaseViewHolder>
extends Recyc
 
   @Override
   public T onCreateViewHolder(ViewGroup parent, int viewType) {
-    //        WXLogUtils.d(TAG, "onCreateViewHolder viewType:" + viewType);
     if (iRecyclerAdapterListener != null) {
       return (T) iRecyclerAdapterListener.onCreateViewHolder(parent, viewType);
     }
@@ -231,8 +230,21 @@ public class RecyclerViewBaseAdapter<T extends ListBaseViewHolder>
extends Recyc
   }
 
   @Override
+  public void onViewAttachedToWindow(T holder) {
+    super.onViewAttachedToWindow(holder);
+    if( holder !=null && holder.isFullSpan()){
+      ViewGroup.LayoutParams lp = holder.itemView.getLayoutParams();
+      if(lp != null
+              && lp instanceof StaggeredGridLayoutManager.LayoutParams
+              ) {
+        StaggeredGridLayoutManager.LayoutParams p = (StaggeredGridLayoutManager.LayoutParams)
lp;
+        p.setFullSpan(true);
+      }
+    }
+  }
+
+  @Override
   public void onBindViewHolder(T viewHolder, int i) {
-    //        WXLogUtils.d(TAG, "onBindViewHolder position: " + i);
     if (iRecyclerAdapterListener != null) {
       iRecyclerAdapterListener.onBindViewHolder(viewHolder, i);
     }
@@ -240,7 +252,6 @@ public class RecyclerViewBaseAdapter<T extends ListBaseViewHolder>
extends Recyc
 
   @Override
   public int getItemViewType(int position) {
-    //        WXLogUtils.d(TAG, "getItemViewType position:"+position);
     if (iRecyclerAdapterListener != null) {
       return iRecyclerAdapterListener.getItemViewType(position);
     }
@@ -262,7 +273,6 @@ public class RecyclerViewBaseAdapter<T extends ListBaseViewHolder>
extends Recyc
 
   @Override
   public void onViewRecycled(T holder) {
-    //        WXLogUtils.d(TAG, "onViewRecycled position ");
     if (iRecyclerAdapterListener != null) {
       iRecyclerAdapterListener.onViewRecycled(holder);
     }
@@ -271,7 +281,6 @@ public class RecyclerViewBaseAdapter<T extends ListBaseViewHolder>
extends Recyc
 
   @Override
   public boolean onFailedToRecycleView(T holder) {
-    //        WXLogUtils.d(TAG, "onFailedToRecycleView ");
     if (iRecyclerAdapterListener != null) {
       return iRecyclerAdapterListener.onFailedToRecycleView(holder);
     }

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/aa807160/android/sdk/src/main/java/com/taobao/weex/ui/view/listview/adapter/WXRecyclerViewOnScrollListener.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/view/listview/adapter/WXRecyclerViewOnScrollListener.java
b/android/sdk/src/main/java/com/taobao/weex/ui/view/listview/adapter/WXRecyclerViewOnScrollListener.java
index e9e0eb8..8587703 100755
--- a/android/sdk/src/main/java/com/taobao/weex/ui/view/listview/adapter/WXRecyclerViewOnScrollListener.java
+++ b/android/sdk/src/main/java/com/taobao/weex/ui/view/listview/adapter/WXRecyclerViewOnScrollListener.java
@@ -274,38 +274,26 @@ public class WXRecyclerViewOnScrollListener extends RecyclerView.OnScrollListene
     if (layoutManagerType == null) {
       if (layoutManager instanceof LinearLayoutManager) {
         layoutManagerType = LAYOUT_MANAGER_TYPE.LINEAR;
+        lastVisibleItemPosition = ((LinearLayoutManager) layoutManager).findLastVisibleItemPosition();
+        listener.get().notifyAppearStateChange(((LinearLayoutManager) layoutManager).findFirstVisibleItemPosition()
+                ,lastVisibleItemPosition
+                ,dx
+                ,dy);
       } else if (layoutManager instanceof GridLayoutManager) {
         layoutManagerType = LAYOUT_MANAGER_TYPE.GRID;
+        lastVisibleItemPosition = ((GridLayoutManager) layoutManager).findLastVisibleItemPosition();
       } else if (layoutManager instanceof StaggeredGridLayoutManager) {
         layoutManagerType = LAYOUT_MANAGER_TYPE.STAGGERED_GRID;
-      } else {
-        throw new RuntimeException(
-            "Unsupported LayoutManager used. Valid ones are LinearLayoutManager, GridLayoutManager
and StaggeredGridLayoutManager");
-      }
-    }
-
-    switch (layoutManagerType) {
-      case LINEAR:
-        lastVisibleItemPosition = ((LinearLayoutManager) layoutManager)
-            .findLastVisibleItemPosition();
-        listener.get().notifyAppearStateChange(((LinearLayoutManager) layoutManager).findFirstVisibleItemPosition()
-            ,lastVisibleItemPosition
-            ,dx
-            ,dy);
-        break;
-      case GRID:
-        lastVisibleItemPosition = ((GridLayoutManager) layoutManager)
-            .findLastVisibleItemPosition();
-        break;
-      case STAGGERED_GRID:
-        StaggeredGridLayoutManager staggeredGridLayoutManager
-            = (StaggeredGridLayoutManager) layoutManager;
+        StaggeredGridLayoutManager staggeredGridLayoutManager = (StaggeredGridLayoutManager)
layoutManager;
         if (lastPositions == null) {
           lastPositions = new int[staggeredGridLayoutManager.getSpanCount()];
         }
         staggeredGridLayoutManager.findLastVisibleItemPositions(lastPositions);
         lastVisibleItemPosition = findMax(lastPositions);
-        break;
+      } else {
+        throw new RuntimeException(
+            "Unsupported LayoutManager used. Valid ones are LinearLayoutManager, GridLayoutManager
and StaggeredGridLayoutManager");
+      }
     }
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/aa807160/android/sdk/src/main/java/com/taobao/weex/ui/view/refresh/wrapper/BaseBounceView.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/view/refresh/wrapper/BaseBounceView.java
b/android/sdk/src/main/java/com/taobao/weex/ui/view/refresh/wrapper/BaseBounceView.java
index e517ab1..55205e9 100644
--- a/android/sdk/src/main/java/com/taobao/weex/ui/view/refresh/wrapper/BaseBounceView.java
+++ b/android/sdk/src/main/java/com/taobao/weex/ui/view/refresh/wrapper/BaseBounceView.java
@@ -229,23 +229,22 @@ public abstract class BaseBounceView<T extends View> extends FrameLayout
{
 
     private int mOrientation = OrientationHelper.VERTICAL;
     protected WXSwipeLayout swipeLayout;
-    private T innerView;
+    private T mInnerView;
 
     public BaseBounceView(Context context,int orientation) {
         this(context, null,orientation);
     }
 
-    public BaseBounceView(Context context, AttributeSet attrs,int orientataion) {
+    public BaseBounceView(Context context, AttributeSet attrs,int orientation) {
         super(context, attrs);
-        mOrientation = orientataion;
-        init(context);
+        mOrientation = orientation;
     }
 
     public int getOrientation(){
         return mOrientation;
     }
 
-    private void init(Context context) {
+    public void init(Context context) {
         createBounceView(context);
     }
 
@@ -274,15 +273,15 @@ public abstract class BaseBounceView<T extends View> extends FrameLayout
{
     }
 
     /**
-     * Init Swipelayout
+     * Init wipelayout
      */
     private WXSwipeLayout createBounceView(Context context) {
         swipeLayout = new WXSwipeLayout(context);
         swipeLayout.setLayoutParams(new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT,
FrameLayout.LayoutParams.MATCH_PARENT));
-        innerView = setInnerView(context);
-        if (innerView == null)
+        mInnerView = setInnerView(context);
+        if (mInnerView == null)
             return null;
-        swipeLayout.addView(innerView, new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT,
FrameLayout.LayoutParams.MATCH_PARENT));
+        swipeLayout.addView(mInnerView, new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT,
FrameLayout.LayoutParams.MATCH_PARENT));
         addView(swipeLayout, LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
         return swipeLayout;
     }
@@ -291,7 +290,7 @@ public abstract class BaseBounceView<T extends View> extends FrameLayout
{
      * @return the child of swipelayout : recyclerview or scrollview
      */
     public T getInnerView() {
-        return innerView;
+        return mInnerView;
     }
 
     public abstract T setInnerView(Context context);

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/aa807160/android/sdk/src/main/java/com/taobao/weex/ui/view/refresh/wrapper/BounceRecyclerView.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/view/refresh/wrapper/BounceRecyclerView.java
b/android/sdk/src/main/java/com/taobao/weex/ui/view/refresh/wrapper/BounceRecyclerView.java
index 114bf8c..1709d24 100644
--- a/android/sdk/src/main/java/com/taobao/weex/ui/view/refresh/wrapper/BounceRecyclerView.java
+++ b/android/sdk/src/main/java/com/taobao/weex/ui/view/refresh/wrapper/BounceRecyclerView.java
@@ -206,8 +206,6 @@ package com.taobao.weex.ui.view.refresh.wrapper;
 
 import android.content.Context;
 import android.support.annotation.Nullable;
-import android.support.v7.widget.OrientationHelper;
-import android.util.AttributeSet;
 import android.view.MotionEvent;
 import android.view.View;
 import android.view.ViewGroup;
@@ -230,29 +228,28 @@ public class BounceRecyclerView extends BaseBounceView<WXRecyclerView>
implement
   private Stack<WXCell> headComponentStack = new Stack<>();
   private WXGesture mGesture;
   private int mLayoutType = WXRecyclerView.TYPE_LINEAR_LAYOUT;
-
-
-  public BounceRecyclerView setLayoutType(int layoutType){
-    mLayoutType = layoutType;
-    return this;
-  }
+  private int mSpanCount = 1;
 
   @Override
   public boolean postDelayed(Runnable action, long delayMillis) {
     return super.postDelayed(WXThread.secure(action), delayMillis);
   }
 
-  public BounceRecyclerView(Context context, int orientation) {
+  public BounceRecyclerView(Context context,int type,int spanCount,int orientation) {
     super(context, orientation);
+    mLayoutType = type;
+    mSpanCount = spanCount;
+    init(context);
   }
 
-  public BounceRecyclerView(Context context, int layoutType,int orientation) {
+  public BounceRecyclerView(Context context,int type,int orientation) {
     super(context, orientation);
-    mLayoutType = layoutType;
+    mLayoutType = type;
+    init(context);
   }
 
-  public BounceRecyclerView(Context context, AttributeSet attrs) {
-    super(context, attrs, OrientationHelper.VERTICAL);
+  public BounceRecyclerView(Context context, int orientation) {
+    super(context, orientation);
   }
 
   public void setRecyclerViewBaseAdapter(RecyclerViewBaseAdapter adapter) {
@@ -274,11 +271,11 @@ public class BounceRecyclerView extends BaseBounceView<WXRecyclerView>
implement
     }
     return result;
   }
-    
+
   @Override
   public WXRecyclerView setInnerView(Context context) {
     WXRecyclerView wxRecyclerView = new WXRecyclerView(context);
-    wxRecyclerView.initView(context, WXRecyclerView.TYPE_STAGGERED_GRID_LAYOUT, getOrientation());
+    wxRecyclerView.initView(context, mLayoutType,mSpanCount,getOrientation());
     return wxRecyclerView;
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/aa807160/android/sdk/src/main/java/com/taobao/weex/ui/view/refresh/wrapper/BounceScrollerView.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/view/refresh/wrapper/BounceScrollerView.java
b/android/sdk/src/main/java/com/taobao/weex/ui/view/refresh/wrapper/BounceScrollerView.java
index cc30556..7d8a990 100644
--- a/android/sdk/src/main/java/com/taobao/weex/ui/view/refresh/wrapper/BounceScrollerView.java
+++ b/android/sdk/src/main/java/com/taobao/weex/ui/view/refresh/wrapper/BounceScrollerView.java
@@ -219,6 +219,7 @@ public class BounceScrollerView extends BaseBounceView<WXScrollView>
{
 
     public BounceScrollerView(Context context, int orientation, WXScroller waScroller) {
         super(context,orientation);
+        init(context);
         if (getInnerView() != null)
             getInnerView().setWAScroller(waScroller);
     }


Mime
View raw message