You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by cx...@apache.org on 2017/03/02 03:28:35 UTC
[01/25] incubator-weex git commit: * [android] support layout
attribute
Repository: incubator-weex
Updated Branches:
refs/heads/0.11-dev-recycler fa1c8b085 -> 3ad72fb4e
* [android] support layout 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/a6a8283d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/a6a8283d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/a6a8283d
Branch: refs/heads/0.11-dev-recycler
Commit: a6a8283d5f2c34432516fdf974c2f59c1f3c325d
Parents: e30ba3c
Author: zshshr <zh...@gmail.com>
Authored: Tue Feb 14 11:38:50 2017 +0800
Committer: zshshr <zh...@gmail.com>
Committed: Tue Feb 14 11:38:50 2017 +0800
----------------------------------------------------------------------
.../java/com/taobao/weex/common/Constants.java | 1 +
.../main/java/com/taobao/weex/dom/WXAttr.java | 26 +++++++++++++++++---
.../ui/component/list/BasicListComponent.java | 5 ++++
.../ui/component/list/SimpleListComponent.java | 6 ++++-
.../weex/ui/component/list/WXListComponent.java | 2 +-
.../refresh/wrapper/BounceRecyclerView.java | 14 ++++++++++-
6 files changed, 47 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/a6a8283d/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 6cb8870..206926c 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
@@ -301,6 +301,7 @@ public class Constants {
String LOADMORERETRY = "loadmoreretry";
String LOADMOREOFFSET = "loadmoreoffset";
String RECYCLE_IMAGE = "recycleImage";
+ String LAYOUT = "layout";
String OVERFLOW = "overflow";
String TYPE = "type";
String PLACEHOLDER = "placeholder";
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/a6a8283d/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 a9ebf60..3286694 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
@@ -210,6 +210,7 @@ import android.text.TextUtils;
import com.taobao.weex.common.Constants;
import com.taobao.weex.common.WXImageSharpen;
+import com.taobao.weex.ui.view.listview.WXRecyclerView;
import com.taobao.weex.utils.WXLogUtils;
import com.taobao.weex.utils.WXUtils;
import com.taobao.weex.utils.WXViewUtils;
@@ -218,6 +219,8 @@ import java.util.Collection;
import java.util.Map;
import java.util.Set;
+import static java.lang.Boolean.parseBoolean;
+
/**
* store value of component attribute
*
@@ -332,7 +335,7 @@ public class WXAttr implements Map<String, Object>,Cloneable {
return true;
}
try {
- return Boolean.parseBoolean(String.valueOf(obj));
+ return parseBoolean(String.valueOf(obj));
} catch (Exception e) {
WXLogUtils.e("[WXAttr] recycle:", e);
}
@@ -346,7 +349,7 @@ public class WXAttr implements Map<String, Object>,Cloneable {
}
try {
- return Boolean.parseBoolean(String.valueOf(obj));
+ return parseBoolean(String.valueOf(obj));
} catch (Exception e) {
WXLogUtils.e("[WXAttr] showIndicators:", e);
}
@@ -360,7 +363,7 @@ public class WXAttr implements Map<String, Object>,Cloneable {
}
try {
- return Boolean.parseBoolean(String.valueOf(obj));
+ return parseBoolean(String.valueOf(obj));
} catch (Exception e) {
WXLogUtils.e("[WXAttr] autoPlay:", e);
}
@@ -409,7 +412,7 @@ public class WXAttr implements Map<String, Object>,Cloneable {
}
try {
- return Boolean.parseBoolean(String.valueOf(obj));
+ return parseBoolean(String.valueOf(obj));
} catch (Exception e) {
WXLogUtils.e("[WXAttr] recycleImage:", e);
}
@@ -437,6 +440,21 @@ public class WXAttr implements Map<String, Object>,Cloneable {
return ret;
}
+ public int getLayoutType(){
+ Object obj = get(Constants.Name.LAYOUT);
+ if (obj == null) {
+ return WXRecyclerView.TYPE_LINEAR_LAYOUT;
+ }
+
+ try {
+ return Integer.parseInt(String.valueOf(obj));
+ } catch (Exception e) {
+ WXLogUtils.e("[WXAttr] recycleImage:", e);
+ }
+ return WXRecyclerView.TYPE_LINEAR_LAYOUT;
+ }
+
+
@Override
public boolean equals(Object o) {
return map.equals(o);
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/a6a8283d/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 2b31428..ce050bc 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
@@ -283,6 +283,8 @@ public abstract class BasicListComponent<T extends ViewGroup & ListComponentView
private static boolean mAllowCacheViewHolder = true;
private static boolean mDownForBidCacheViewHolder = false;
+ protected int mLayoutType = WXRecyclerView.TYPE_LINEAR_LAYOUT;
+
/**
* Map for storing component that is sticky.
**/
@@ -293,6 +295,9 @@ 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();
+ }
}
/**
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/a6a8283d/android/sdk/src/main/java/com/taobao/weex/ui/component/list/SimpleListComponent.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/component/list/SimpleListComponent.java b/android/sdk/src/main/java/com/taobao/weex/ui/component/list/SimpleListComponent.java
index 4fb0e80..36b9ebb 100644
--- a/android/sdk/src/main/java/com/taobao/weex/ui/component/list/SimpleListComponent.java
+++ b/android/sdk/src/main/java/com/taobao/weex/ui/component/list/SimpleListComponent.java
@@ -224,8 +224,12 @@ public class SimpleListComponent extends BasicListComponent<SimpleRecyclerView>{
@Override
protected SimpleRecyclerView generateListView(Context context, int orientation) {
+ return generateListView(context,WXRecyclerView.TYPE_LINEAR_LAYOUT,orientation);
+ }
+
+ protected SimpleRecyclerView generateListView(Context context, int type,int orientation) {
SimpleRecyclerView view = new SimpleRecyclerView(context);
- view.initView(context, WXRecyclerView.TYPE_LINEAR_LAYOUT, orientation);
+ view.initView(context, type, orientation);
return view;
}
}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/a6a8283d/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 3e68de1..8faa862 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
@@ -241,7 +241,7 @@ public class WXListComponent extends BasicListComponent<BounceRecyclerView> {
@Override
protected BounceRecyclerView generateListView(Context context, int orientation) {
- return new BounceRecyclerView(context, orientation);
+ return new BounceRecyclerView(context, orientation).setLayoutType(mLayoutType);
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/a6a8283d/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 2d81b37..114bf8c 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
@@ -229,6 +229,13 @@ public class BounceRecyclerView extends BaseBounceView<WXRecyclerView> implement
private Stack<View> headerViewStack = new Stack<>();
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;
+ }
@Override
public boolean postDelayed(Runnable action, long delayMillis) {
@@ -239,6 +246,11 @@ public class BounceRecyclerView extends BaseBounceView<WXRecyclerView> implement
super(context, orientation);
}
+ public BounceRecyclerView(Context context, int layoutType,int orientation) {
+ super(context, orientation);
+ mLayoutType = layoutType;
+ }
+
public BounceRecyclerView(Context context, AttributeSet attrs) {
super(context, attrs, OrientationHelper.VERTICAL);
}
@@ -266,7 +278,7 @@ public class BounceRecyclerView extends BaseBounceView<WXRecyclerView> implement
@Override
public WXRecyclerView setInnerView(Context context) {
WXRecyclerView wxRecyclerView = new WXRecyclerView(context);
- wxRecyclerView.initView(context, WXRecyclerView.TYPE_LINEAR_LAYOUT, getOrientation());
+ wxRecyclerView.initView(context, WXRecyclerView.TYPE_STAGGERED_GRID_LAYOUT, getOrientation());
return wxRecyclerView;
}
[25/25] incubator-weex git commit: Merge remote-tracking branch
'upstream/0.11-dev-suppport-recycler-component' into 0.11-dev-recycler
Posted by cx...@apache.org.
Merge remote-tracking branch 'upstream/0.11-dev-suppport-recycler-component' into 0.11-dev-recycler
# Conflicts:
# android/sdk/src/main/java/com/taobao/weex/common/Constants.java
# ios/sdk/WeexSDK/Sources/Component/WXCellComponent.h
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/3ad72fb4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/3ad72fb4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/3ad72fb4
Branch: refs/heads/0.11-dev-recycler
Commit: 3ad72fb4ee901e3538f30acb959ffd3f2bdf836f
Parents: fa1c8b0 02920b6
Author: cxfeng <yi...@alibaba-inc.com>
Authored: Thu Mar 2 11:27:51 2017 +0800
Committer: cxfeng <yi...@alibaba-inc.com>
Committed: Thu Mar 2 11:27:51 2017 +0800
----------------------------------------------------------------------
.../main/java/com/taobao/weex/WXSDKEngine.java | 9 +-
.../java/com/taobao/weex/common/Constants.java | 13 +-
.../main/java/com/taobao/weex/dom/WXAttr.java | 96 +++-
.../java/com/taobao/weex/dom/WXDomHandler.java | 2 +
.../java/com/taobao/weex/dom/WXDomManager.java | 1 +
.../java/com/taobao/weex/dom/WXDomModule.java | 8 +-
.../taobao/weex/dom/WXRecyclerDomObject.java | 317 +++++++++++
.../weex/ui/component/WXBasicComponentType.java | 2 +
.../com/taobao/weex/ui/component/WXHeader.java | 4 +-
.../ui/component/list/BasicListComponent.java | 29 +-
.../ui/component/list/ListComponentView.java | 3 -
.../ui/component/list/SimpleListComponent.java | 6 +-
.../weex/ui/component/list/WXListComponent.java | 91 +++-
.../listview/ExtendedLinearLayoutManager.java | 25 +
.../weex/ui/view/listview/WXRecyclerView.java | 43 +-
.../listview/adapter/ListBaseViewHolder.java | 8 +-
.../adapter/RecyclerViewBaseAdapter.java | 21 +-
.../adapter/WXRecyclerViewOnScrollListener.java | 107 ++--
.../ui/view/refresh/wrapper/BaseBounceView.java | 19 +-
.../refresh/wrapper/BounceRecyclerView.java | 23 +-
.../refresh/wrapper/BounceScrollerView.java | 1 +
examples/vue/components/waterfall.vue | 455 ++++++++++++++++
examples/vue/index.vue | 1 +
ios/playground/WeexDemo/DemoDefine.h | 2 +-
ios/playground/WeexDemo/UIView+UIThreadCheck.m | 2 +-
ios/playground/WeexDemo/WXDemoViewController.m | 3 +-
ios/sdk/WeexSDK.xcodeproj/project.pbxproj | 75 ++-
.../Component/Recycler/WXMultiColumnLayout.h | 42 ++
.../Component/Recycler/WXMultiColumnLayout.m | 385 ++++++++++++++
.../Component/Recycler/WXRecyclerComponent.h | 12 +
.../Component/Recycler/WXRecyclerComponent.m | 525 +++++++++++++++++++
.../Recycler/WXRecyclerDataController.h | 34 ++
.../Recycler/WXRecyclerDataController.m | 114 ++++
.../Recycler/WXRecyclerUpdateController.h | 32 ++
.../Recycler/WXRecyclerUpdateController.m | 239 +++++++++
.../Recycler/WXSectionDataController.h | 33 ++
.../Recycler/WXSectionDataController.m | 81 +++
.../WeexSDK/Sources/Component/WXCellComponent.h | 22 +-
.../WeexSDK/Sources/Component/WXCellComponent.m | 27 +-
.../Component/WXComponent+GradientColor.h | 15 +-
.../Component/WXComponent+GradientColor.m | 15 +-
.../Sources/Component/WXFooterComponent.h | 13 +
.../Sources/Component/WXFooterComponent.m | 13 +
.../Sources/Component/WXHeaderComponent.h | 27 +
.../Sources/Component/WXHeaderComponent.m | 68 +++
.../WeexSDK/Sources/Component/WXListComponent.h | 12 -
.../WeexSDK/Sources/Component/WXListComponent.m | 71 +--
ios/sdk/WeexSDK/Sources/Component/WXTransform.m | 18 +-
ios/sdk/WeexSDK/Sources/Engine/WXSDKEngine.m | 2 +
ios/sdk/WeexSDK/Sources/Model/WXComponent.m | 2 +-
.../WeexSDK/Sources/Module/WXAnimationModule.m | 8 +-
ios/sdk/WeexSDK/Sources/Module/WXMetaModule.m | 4 +-
ios/sdk/WeexSDK/Sources/Utility/WXConvert.h | 2 +
ios/sdk/WeexSDK/Sources/Utility/WXConvert.m | 29 +
ios/sdk/WeexSDK/Sources/Utility/WXDiffUtil.h | 38 ++
ios/sdk/WeexSDK/Sources/Utility/WXDiffUtil.m | 186 +++++++
ios/sdk/WeexSDK/Sources/Utility/WXLength.h | 13 +-
ios/sdk/WeexSDK/Sources/Utility/WXLength.m | 45 +-
58 files changed, 3256 insertions(+), 237 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/3ad72fb4/android/sdk/src/main/java/com/taobao/weex/common/Constants.java
----------------------------------------------------------------------
diff --cc android/sdk/src/main/java/com/taobao/weex/common/Constants.java
index e6e61e9,eed5191..125ae3a
--- a/android/sdk/src/main/java/com/taobao/weex/common/Constants.java
+++ b/android/sdk/src/main/java/com/taobao/weex/common/Constants.java
@@@ -349,9 -351,8 +353,11 @@@ public class Constants
String RETURN_KEY_TYPE = "returnKeyType";
String OFFSET = "offset";
String ANIMATED = "animated";
+
+ String INSERT_CELL_ANIMATION = "insertAnimation";
+ String DELETE_CELL_ANIMATION = "deleteAnimation";
+ String AUTO = "auto";
+ String NORMAL = "normal";
}
public interface Value {
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/3ad72fb4/android/sdk/src/main/java/com/taobao/weex/ui/component/list/BasicListComponent.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/3ad72fb4/ios/playground/WeexDemo/WXDemoViewController.m
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/3ad72fb4/ios/sdk/WeexSDK.xcodeproj/project.pbxproj
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/3ad72fb4/ios/sdk/WeexSDK/Sources/Component/WXCellComponent.h
----------------------------------------------------------------------
diff --cc ios/sdk/WeexSDK/Sources/Component/WXCellComponent.h
index 2c40cd8,d3358fd..aff5ab1
--- a/ios/sdk/WeexSDK/Sources/Component/WXCellComponent.h
+++ b/ios/sdk/WeexSDK/Sources/Component/WXCellComponent.h
@@@ -13,9 -28,9 +28,10 @@@
@property (nonatomic, strong) NSString *scope;
@property (nonatomic, assign) BOOL isRecycle;
+ @property (nonatomic, assign) BOOL isLayoutComplete;
@property (nonatomic, assign) UITableViewRowAnimation insertAnimation;
@property (nonatomic, assign) UITableViewRowAnimation deleteAnimation;
- @property (nonatomic, weak) WXListComponent *list;
+@property (nonatomic, assign) BOOL keepScrollPosition;
+ @property (nonatomic, weak) id<WXCellRenderDelegate> delegate;
@end
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/3ad72fb4/ios/sdk/WeexSDK/Sources/Component/WXCellComponent.m
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/3ad72fb4/ios/sdk/WeexSDK/Sources/Component/WXListComponent.m
----------------------------------------------------------------------
[22/25] incubator-weex git commit: * [android] recycler component
support scrollable attribute
Posted by cx...@apache.org.
* [android] recycler component support scrollable 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/e37d14f7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/e37d14f7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/e37d14f7
Branch: refs/heads/0.11-dev-recycler
Commit: e37d14f7f8c1bda1a569d46762a14e69d15ca3fa
Parents: dee9b6d
Author: zshshr <zh...@gmail.com>
Authored: Mon Feb 27 11:43:08 2017 +0800
Committer: zshshr <zh...@gmail.com>
Committed: Mon Feb 27 11:43:08 2017 +0800
----------------------------------------------------------------------
.../com/taobao/weex/ui/component/list/WXListComponent.java | 6 ++++++
1 file changed, 6 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/e37d14f7/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 b8c0a31..7e1d86d 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
@@ -352,6 +352,12 @@ public class WXListComponent extends BasicListComponent<BounceRecyclerView> {
}
}
+ @WXComponentProp(name = Constants.Name.SCROLLABLE)
+ public void setScrollable(boolean scrollable) {
+ WXRecyclerView inner = getHostView().getInnerView();
+ inner.setScrollable(scrollable);
+ }
+
@Override
public void updateProperties(Map<String, Object> props) {
super.updateProperties(props);
[19/25] incubator-weex git commit: Merge commit
'6b7f1eabdc3c4545707d5287715cb378ca29bf6a' into
0.11-dev-suppport-recycler-component
Posted by cx...@apache.org.
Merge commit '6b7f1eabdc3c4545707d5287715cb378ca29bf6a' into 0.11-dev-suppport-recycler-component
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/1d01df18
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/1d01df18
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/1d01df18
Branch: refs/heads/0.11-dev-recycler
Commit: 1d01df18c55887c0b07820182471caa62c082817
Parents: dee9b6d 6b7f1ea
Author: cxfeng <cx...@gmail.com>
Authored: Mon Feb 27 10:47:14 2017 +0800
Committer: cxfeng <cx...@gmail.com>
Committed: Mon Feb 27 10:47:14 2017 +0800
----------------------------------------------------------------------
.travis.yml | 2 +
.../commons/adapter/JSExceptionAdapter.java | 222 ++
.../java/com/alibaba/weex/WXApplication.java | 2 +
.../zxing/client/android/CaptureActivity.java | 1 +
android/run-ci.sh | 2 +-
android/sdk/libs/armeabi/libweexv8.so | Bin 3583820 -> 3583820 bytes
android/sdk/libs/x86/libweexv8.so | Bin 4340864 -> 4340864 bytes
.../main/java/com/taobao/weex/InitConfig.java | 13 +
.../main/java/com/taobao/weex/WXSDKEngine.java | 5 +
.../java/com/taobao/weex/WXSDKInstance.java | 4 +-
.../main/java/com/taobao/weex/WXSDKManager.java | 14 +
.../weex/adapter/IWXJSExceptionAdapter.java | 218 ++
.../appfram/navigator/WXNavigatorModule.java | 82 +-
.../com/taobao/weex/bridge/WXBridgeManager.java | 68 +-
.../com/taobao/weex/bridge/WXModuleManager.java | 29 +-
.../taobao/weex/bridge/WXServiceManager.java | 31 +-
.../taobao/weex/common/WXJSExceptionInfo.java | 331 ++
.../com/taobao/weex/common/WXJSService.java | 229 ++
.../com/taobao/weex/http/WXStreamModule.java | 2 +-
.../java/com/taobao/weex/ui/component/WXA.java | 10 +-
.../taobao/weex/ui/component/WXComponent.java | 3 +-
.../com/taobao/weex/ui/component/WXImage.java | 14 +-
.../weex/ui/component/WXSliderNeighbor.java | 70 +-
.../main/java/com/taobao/weex/utils/WXHack.java | 527 ---
.../java/com/taobao/weex/utils/WXUtils.java | 200 +-
.../java/com/taobao/weex/utils/WXViewUtils.java | 8 +-
.../java/com/taobao/weex/utils/WXUtilsTest.java | 125 +-
doc/advanced/extend-to-android.md | 175 +
doc/package.json | 5 +-
doc/source/cn/guide/intro/app-architecture.md | 34 +-
doc/source/cn/guide/intro/devtools.md | 99 +
doc/source/cn/guide/intro/how-it-works.md | 38 +-
doc/source/cn/guide/intro/page-architecture.md | 18 +-
doc/source/cn/guide/intro/using-vue.md | 79 +-
doc/source/cn/guide/intro/web-dev-experience.md | 20 +-
.../cn/references/advanced/extend-to-android.md | 26 +
.../cn/references/advanced/extend-to-ios.md | 45 +-
doc/source/cn/references/common-style.md | 157 +
doc/source/cn/references/components/image.md | 4 +-
doc/source/cn/references/components/input.md | 11 +-
doc/source/cn/references/components/textarea.md | 7 +
.../cn/v-0.10/advanced/extend-to-android.md | 27 +-
doc/source/cn/v-0.10/advanced/extend-to-ios.md | 154 +-
doc/source/guide/intro/app-architecture.md | 57 +-
doc/source/guide/intro/devtools.md | 100 +
doc/source/guide/intro/how-it-works.md | 62 +-
doc/source/guide/intro/index.md | 4 +-
doc/source/guide/intro/page-architecture.md | 42 +-
doc/source/guide/intro/using-vue.md | 52 +-
doc/source/guide/intro/web-dev-experience.md | 29 +-
doc/source/guide/intro/write-once.md | 19 +-
doc/source/references/advanced/extend-jsfm.md | 2 +-
.../references/advanced/extend-to-android.md | 29 +-
.../references/advanced/extend-to-html5.md | 2 +-
doc/source/references/advanced/extend-to-ios.md | 80 +-
doc/source/references/advanced/index.md | 2 +-
.../advanced/integrate-devtool-to-android.md | 2 +-
.../advanced/integrate-devtool-to-ios.md | 2 +-
doc/source/references/common-style.md | 159 +
doc/source/references/components/cell.md | 6 +-
doc/source/references/components/image.md | 3 +-
doc/source/references/components/input.md | 7 +
doc/source/references/components/textarea.md | 7 +
doc/source/references/gesture.md | 9 +-
doc/source/references/js-service/index.md | 114 +
doc/source/references/vue/difference-of-vuex.md | 2 +-
.../references/vue/difference-with-web.md | 2 +-
doc/source/references/vue/index.md | 2 +-
doc/source/v-0.10/advanced/extend-to-android.md | 57 +-
doc/source/v-0.10/advanced/extend-to-ios.md | 39 +
examples/index.we | 1 +
examples/linear-gradient.we | 70 +
html5/frameworks/legacy/app/ctrl/init.js | 2 -
html5/frameworks/legacy/app/ctrl/misc.js | 55 +-
html5/frameworks/legacy/app/instance.js | 14 +-
html5/frameworks/legacy/static/create.js | 6 +-
html5/runtime/config.js | 4 +-
html5/runtime/init.js | 4 -
html5/runtime/task-center.js | 57 +
html5/services/amd/index.js | 18 +-
html5/test/case/prepare.js | 6 +-
html5/test/case/tester.js | 48 +-
html5/test/unit/default/app/ctrl.js | 14 +-
html5/test/unit/default/app/index.js | 28 +-
.../WeexDemo.xcodeproj/project.pbxproj | 11 +-
.../AppIcon.appiconset/Icon-29.png | Bin 1682 -> 1614 bytes
.../AppIcon.appiconset/Icon-29@2x-1.png | Bin 2709 -> 2421 bytes
.../AppIcon.appiconset/Icon-29@2x.png | Bin 2709 -> 2421 bytes
.../AppIcon.appiconset/Icon-29@3x.png | Bin 3724 -> 3236 bytes
.../AppIcon.appiconset/Icon-40.png | Bin 2018 -> 1946 bytes
.../AppIcon.appiconset/Icon-40@2x-1.png | Bin 3368 -> 3016 bytes
.../AppIcon.appiconset/Icon-40@2x.png | Bin 3368 -> 3016 bytes
.../AppIcon.appiconset/Icon-40@3x.png | Bin 4715 -> 4172 bytes
.../AppIcon.appiconset/Icon-60@2x.png | Bin 4715 -> 4172 bytes
.../AppIcon.appiconset/Icon-60@3x.png | Bin 6892 -> 6017 bytes
.../AppIcon.appiconset/Icon-76.png | Bin 3324 -> 2918 bytes
.../AppIcon.appiconset/Icon-76@2x.png | Bin 5937 -> 5088 bytes
.../AppIcon.appiconset/Icon-83.5@2x.png | Bin 6942 -> 5537 bytes
ios/playground/WeexDemo/Info.plist | 11 +-
ios/playground/bundlejs/animation.js | 3 +-
ios/playground/bundlejs/component/a-demo.js | 3 +-
.../bundlejs/component/countdown-demo.js | 3 +-
ios/playground/bundlejs/component/image-demo.js | 3 +-
ios/playground/bundlejs/component/input-demo.js | 3 +-
.../bundlejs/component/list/list-demo.js | 3 +-
.../bundlejs/component/marquee-demo.js | 3 +-
.../bundlejs/component/navigator-demo.js | 8 +-
.../bundlejs/component/process-bar-demo.js | 3 +-
.../bundlejs/component/scroller-demo.js | 3 +-
.../bundlejs/component/slider-neighbor/index.js | 264 ++
.../slider-neighbor/silder-neighbor.js | 287 --
.../bundlejs/component/slider/index.js | 36 +-
.../bundlejs/component/tabbar/tabbar-demo.js | 5 +-
ios/playground/bundlejs/component/text-demo.js | 111 +-
ios/playground/bundlejs/component/video-demo.js | 3 +-
ios/playground/bundlejs/component/web-demo.js | 11 +-
ios/playground/bundlejs/error.js | 3 +-
ios/playground/bundlejs/index.js | 7 +-
ios/playground/bundlejs/linear-gradient.js | 367 ++
ios/playground/bundlejs/module/clipboard.js | 20 +-
ios/playground/bundlejs/module/componentRect.js | 563 +++
ios/playground/bundlejs/module/instance-api.js | 18 +-
ios/playground/bundlejs/module/modal.js | 22 +-
ios/playground/bundlejs/module/picker-demo.js | 22 +-
ios/playground/bundlejs/module/storage-demo.js | 18 +-
ios/playground/bundlejs/module/stream-demo.js | 22 +-
.../bundlejs/module/websocket-demo.js | 2409 +++++++++++++
ios/playground/bundlejs/showcase/calculator.js | 25 +-
.../bundlejs/showcase/dropdown/dropdown-demo.js | 30 +-
.../bundlejs/showcase/dropdown/we-dropdown.js | 12 +-
ios/playground/bundlejs/showcase/minesweeper.js | 18 +-
.../bundlejs/showcase/new-fashion/banner.js | 8 +-
.../bundlejs/showcase/new-fashion/banners.js | 20 +-
.../bundlejs/showcase/new-fashion/brand.js | 36 +-
.../bundlejs/showcase/new-fashion/category.js | 24 +-
.../bundlejs/showcase/new-fashion/coupon.js | 12 +-
.../bundlejs/showcase/new-fashion/fashion.js | 38 +-
.../bundlejs/showcase/new-fashion/goods.js | 24 +-
.../bundlejs/showcase/new-fashion/headlines.js | 48 +-
.../bundlejs/showcase/new-fashion/image-demo.js | 3 +-
.../bundlejs/showcase/new-fashion/index.js | 27 +-
.../bundlejs/showcase/new-fashion/link.js | 8 +-
.../showcase/new-fashion/list/list-demo.js | 3 +-
.../bundlejs/showcase/new-fashion/main.js | 213 +-
.../bundlejs/showcase/new-fashion/match.js | 24 +-
.../bundlejs/showcase/new-fashion/resource.js | 38 +-
.../bundlejs/showcase/new-fashion/scene.js | 24 +-
.../bundlejs/showcase/pseudo-class.js | 2422 +++++++++++++
ios/playground/bundlejs/showcase/ui.js | 28 +-
ios/playground/bundlejs/style/index.js | 80 +-
ios/playground/bundlejs/style/style-box.js | 44 +-
ios/playground/bundlejs/style/style-flex.js | 52 +-
ios/playground/bundlejs/style/style-item.js | 12 +-
ios/playground/bundlejs/syntax/hello-world-1.js | 4 +-
ios/playground/bundlejs/syntax/hello-world-2.js | 6 +-
ios/playground/bundlejs/syntax/hello-world-3.js | 10 +-
ios/playground/bundlejs/syntax/hello-world-4.js | 14 +-
ios/playground/bundlejs/syntax/hello-world-5.js | 14 +-
ios/playground/bundlejs/syntax/hello-world.js | 14 +-
ios/playground/bundlejs/syntax/index.js | 28 +-
.../bundlejs/syntax/script-component.js | 24 +-
ios/playground/bundlejs/syntax/script-data.js | 12 +-
ios/playground/bundlejs/syntax/script-events.js | 12 +-
.../bundlejs/syntax/script-instance.js | 12 +-
.../bundlejs/syntax/script-lifecycle.js | 12 +-
ios/playground/bundlejs/syntax/script-module.js | 12 +-
.../bundlejs/syntax/script-options.js | 12 +-
.../bundlejs/syntax/template-class.js | 12 +-
.../bundlejs/syntax/template-content.js | 20 +-
.../bundlejs/syntax/template-event.js | 12 +-
ios/playground/bundlejs/syntax/template-if.js | 12 +-
.../bundlejs/syntax/template-repeat-update.js | 12 +-
.../bundlejs/syntax/template-repeat.js | 12 +-
.../bundlejs/syntax/template-style.js | 8 +-
ios/playground/bundlejs/template.js | 15 +-
ios/playground/bundlejs/test.js | 128 +
ios/playground/bundlejs/vue/animation.js | 709 ++++
ios/playground/bundlejs/vue/components/a.js | 438 +++
.../bundlejs/vue/components/countdown.js | 640 ++++
ios/playground/bundlejs/vue/components/image.js | 641 ++++
ios/playground/bundlejs/vue/components/input.js | 364 ++
ios/playground/bundlejs/vue/components/list.js | 246 ++
.../bundlejs/vue/components/marquee.js | 534 +++
.../bundlejs/vue/components/navigator.js | 1059 ++++++
.../bundlejs/vue/components/scroller.js | 304 ++
.../bundlejs/vue/components/slider.js | 898 +++++
.../bundlejs/vue/components/tabbar.js | 599 ++++
ios/playground/bundlejs/vue/components/text.js | 513 +++
ios/playground/bundlejs/vue/components/video.js | 396 +++
ios/playground/bundlejs/vue/components/web.js | 459 +++
ios/playground/bundlejs/vue/hello.js | 99 +
ios/playground/bundlejs/vue/iconfont.js | 204 ++
ios/playground/bundlejs/vue/index.js | 496 +++
.../bundlejs/vue/modules/clipboard.js | 691 ++++
.../bundlejs/vue/modules/instance-api.js | 304 ++
ios/playground/bundlejs/vue/modules/modal.js | 581 +++
ios/playground/bundlejs/vue/modules/storage.js | 381 ++
ios/playground/bundlejs/vue/modules/stream.js | 477 +++
.../bundlejs/vue/showcase/calculator.js | 340 ++
.../bundlejs/vue/showcase/itemlist.js | 1062 ++++++
.../bundlejs/vue/showcase/new-fashion.js | 3302 ++++++++++++++++++
.../bundlejs/vue/showcase/progress.js | 336 ++
ios/playground/bundlejs/vue/style/index.js | 1566 +++++++++
ios/playground/bundlejs/vue/style/style-box.js | 780 +++++
ios/playground/bundlejs/vue/style/style-flex.js | 919 +++++
ios/playground/bundlejs/vue/style/style-item.js | 155 +
.../bundlejs/vue/syntax/hello-world-1.js | 95 +
.../bundlejs/vue/syntax/hello-world-2.js | 112 +
.../bundlejs/vue/syntax/hello-world-3.js | 127 +
.../bundlejs/vue/syntax/hello-world-4.js | 167 +
.../bundlejs/vue/syntax/hello-world-5.js | 173 +
.../bundlejs/vue/syntax/hello-world.js | 183 +
.../bundlejs/vue/syntax/script-component.js | 224 ++
.../bundlejs/vue/syntax/script-data.js | 214 ++
.../bundlejs/vue/syntax/script-events.js | 161 +
.../bundlejs/vue/syntax/script-instance.js | 196 ++
.../bundlejs/vue/syntax/script-lifecycle.js | 155 +
.../bundlejs/vue/syntax/script-module.js | 156 +
.../bundlejs/vue/syntax/script-options.js | 182 +
.../bundlejs/vue/syntax/template-class.js | 161 +
.../bundlejs/vue/syntax/template-content.js | 189 +
.../bundlejs/vue/syntax/template-event.js | 197 ++
.../bundlejs/vue/syntax/template-if.js | 165 +
.../vue/syntax/template-repeat-update.js | 195 ++
.../bundlejs/vue/syntax/template-repeat.js | 170 +
.../bundlejs/vue/syntax/template-style.js | 144 +
ios/playground/bundlejs/vue/template.js | 796 +++++
ios/sdk/WeexSDK.podspec | 2 +-
ios/sdk/WeexSDK.xcodeproj/project.pbxproj | 24 +
ios/sdk/WeexSDK/Sources/Bridge/WXJSCoreBridge.m | 8 +
.../Sources/Component/WXComponent_internal.h | 3 +
.../WeexSDK/Sources/Component/WXEditComponent.h | 21 +
.../WeexSDK/Sources/Component/WXEditComponent.m | 761 ++++
.../Sources/Component/WXSliderComponent.m | 35 +-
.../Sources/Component/WXTextAreaComponent.h | 5 +-
.../Sources/Component/WXTextAreaComponent.m | 609 +---
.../Sources/Component/WXTextInputComponent.h | 8 +-
.../Sources/Component/WXTextInputComponent.m | 605 +---
.../Sources/Display/WXComponent+BoxShadow.h | 37 +
.../Sources/Display/WXComponent+BoxShadow.m | 91 +
ios/sdk/WeexSDK/Sources/Display/WXInnerLayer.h | 19 +
ios/sdk/WeexSDK/Sources/Display/WXInnerLayer.m | 87 +
ios/sdk/WeexSDK/Sources/Engine/WXSDKEngine.m | 20 +-
.../WeexSDK/Sources/Layout/WXComponent+Layout.m | 4 +
ios/sdk/WeexSDK/Sources/Model/WXComponent.m | 9 +-
.../WeexSDK/Sources/Module/WXAnimationModule.m | 5 +
ios/sdk/WeexSDK/Sources/Utility/WXBoxShadow.h | 31 +
ios/sdk/WeexSDK/Sources/Utility/WXBoxShadow.m | 108 +
ios/sdk/WeexSDK/Sources/Utility/WXConvert.h | 3 +
ios/sdk/WeexSDK/Sources/Utility/WXConvert.m | 17 +
ios/sdk/WeexSDK/Sources/Utility/WXUtility.m | 12 +-
.../Sources/View/WXComponent+ViewManagement.m | 15 +
package.json | 6 +-
test/run.sh | 2 +-
test/scripts/components/scroll-event.test.js | 32 +-
test/scripts/dom.test.js | 14 +-
test/scripts/index.test.js | 14 +-
test/scripts/util.js | 24 +
258 files changed, 35444 insertions(+), 3106 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/1d01df18/android/sdk/src/main/java/com/taobao/weex/WXSDKEngine.java
----------------------------------------------------------------------
[07/25] incubator-weex git commit: + [ios] support waterfall layout *
Add recycler component to be based component of UICollectionView * Support
column-count/column-gap/column-width for multi-column layout
Posted by cx...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/1c96da7a/ios/sdk/WeexSDK/Sources/Component/Recycler/WXSectionDataController.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/Recycler/WXSectionDataController.m b/ios/sdk/WeexSDK/Sources/Component/Recycler/WXSectionDataController.m
new file mode 100644
index 0000000..c4270d7
--- /dev/null
+++ b/ios/sdk/WeexSDK/Sources/Component/Recycler/WXSectionDataController.m
@@ -0,0 +1,85 @@
+/**
+ * Created by Weex.
+ * Copyright (c) 2016, Alibaba, Inc. All rights reserved.
+ *
+ * This source code is licensed under the Apache Licence 2.0.
+ * For the full copyright and license information,please view the LICENSE file in the root directory of this source tree.
+ */
+
+#import "WXSectionDataController.h"
+#import "WXCellComponent.h"
+#import "WXHeaderComponent.h"
+#import "WXAssert.h"
+
+@interface WXSectionDataController ()
+
+@end
+
+@implementation WXSectionDataController
+
+- (NSInteger)numberOfItems
+{
+ return self.cellComponents.count;
+}
+
+- (UIView *)cellForItemAtIndex:(NSInteger)index
+{
+ WXAssertMainThread();
+
+ WXCellComponent *cellComponent = self.cellComponents[index];
+ return cellComponent.view;
+}
+
+- (CGSize)sizeForItemAtIndex:(NSInteger)index
+{
+ WXAssertMainThread();
+
+ WXCellComponent *cellComponent = self.cellComponents[index];
+ return cellComponent.calculatedFrame.size;
+}
+
+- (UIView *)viewForHeaderAtIndex:(NSInteger)index;
+{
+ return self.headerComponent.view;
+}
+
+- (CGSize)sizeForHeaderAtIndex:(NSInteger)index
+{
+ return self.headerComponent.calculatedFrame.size;
+}
+
+- (BOOL)isStickyForHeaderAtIndex:(NSInteger)index
+{
+ return self.headerComponent.isSticky;
+}
+
+- (NSUInteger)hash
+{
+ return [super hash];
+}
+
+- (BOOL)isEqual:(id)object
+{
+ if ([object isKindOfClass:[WXSectionDataController class]]) {
+ WXSectionDataController *controller = (WXSectionDataController *)object;
+ BOOL headerEqual = (self.headerComponent && controller.headerComponent && self.headerComponent == controller.headerComponent) || (!self.headerComponent && !controller.headerComponent);
+ BOOL footerEqual = (self.footerComponent && controller.footerComponent && self.footerComponent == controller.footerComponent) || (!self.footerComponent && !controller.footerComponent);
+ BOOL cellEqual = self.cellComponents && controller.cellComponents && self.cellComponents.count == controller.cellComponents.count;
+ if (cellEqual) {
+ for (int i = 0; i < self.cellComponents.count; i ++) {
+ if (self.cellComponents[i] != controller.cellComponents[i]) {
+ cellEqual = NO;
+ break;
+ }
+ }
+ } else {
+ cellEqual = !self.cellComponents && controller.cellComponents;
+ }
+
+ return headerEqual && footerEqual && cellEqual;
+ } else {
+ return NO;
+ }
+}
+
+@end
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/1c96da7a/ios/sdk/WeexSDK/Sources/Component/WXCellComponent.h
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/WXCellComponent.h b/ios/sdk/WeexSDK/Sources/Component/WXCellComponent.h
index 2e5bf59..29aa1c6 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXCellComponent.h
+++ b/ios/sdk/WeexSDK/Sources/Component/WXCellComponent.h
@@ -7,14 +7,29 @@
*/
#import "WXComponent.h"
-@class WXListComponent;
+@class WXCellComponent;
+
+@protocol WXCellRenderDelegate <NSObject>
+
+- (float)cellWidthForLayout:(WXCellComponent *)cell;
+
+- (void)cellDidLayout:(WXCellComponent *)cell;
+
+- (void)cellDidRendered:(WXCellComponent *)cell;
+
+- (void)cellDidRemove:(WXCellComponent *)cell;
+
+- (void)cell:(WXCellComponent *)cell didMoveToIndex:(NSUInteger)index;
+
+@end
@interface WXCellComponent : WXComponent
@property (nonatomic, strong) NSString *scope;
@property (nonatomic, assign) BOOL isRecycle;
+@property (nonatomic, assign) BOOL isLayoutComplete;
@property (nonatomic, assign) UITableViewRowAnimation insertAnimation;
@property (nonatomic, assign) UITableViewRowAnimation deleteAnimation;
-@property (nonatomic, weak) WXListComponent *list;
+@property (nonatomic, weak) id<WXCellRenderDelegate> delegate;
@end
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/1c96da7a/ios/sdk/WeexSDK/Sources/Component/WXCellComponent.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/WXCellComponent.m b/ios/sdk/WeexSDK/Sources/Component/WXCellComponent.m
index adf91a8..593628a 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXCellComponent.m
+++ b/ios/sdk/WeexSDK/Sources/Component/WXCellComponent.m
@@ -15,6 +15,7 @@
@implementation WXCellComponent
{
NSIndexPath *_indexPathBeforeMove;
+ BOOL _isUseContainerWidth;
}
- (instancetype)initWithRef:(NSString *)ref type:(NSString *)type styles:(NSDictionary *)styles attributes:(NSDictionary *)attributes events:(NSArray *)events weexInstance:(WXSDKInstance *)weexInstance
@@ -38,12 +39,18 @@
}
+- (BOOL)isEqual:(id)object
+{
+ WXCellComponent *cell = object;
+ return self == cell && self.isLayoutComplete == cell.isLayoutComplete && CGRectEqualToRect(self.calculatedFrame, cell.calculatedFrame);
+}
+
- (void)_frameDidCalculated:(BOOL)isChanged
{
[super _frameDidCalculated:isChanged];
if (isChanged) {
- [self.list cellDidLayout:self];
+ [self.delegate cellDidLayout:self];
}
}
@@ -54,7 +61,7 @@
[super displayCompletionBlock](layer, finished);
}
- [self.list cellDidRendered:self];
+ [self.delegate cellDidRendered:self];
};
}
@@ -79,8 +86,8 @@
- (void)_moveToSupercomponent:(WXComponent *)newSupercomponent atIndex:(NSUInteger)index
{
- if (self.list == newSupercomponent) {
- [self.list cell:self didMoveToIndex:index];
+ if (self.delegate == newSupercomponent) {
+ [self.delegate cell:self didMoveToIndex:index];
[super _removeFromSupercomponent];
[newSupercomponent _insertSubcomponent:self atIndex:index];
} else {
@@ -92,7 +99,7 @@
{
[super _removeFromSupercomponent];
- [self.list cellDidRemove:self];
+ [self.delegate cellDidRemove:self];
}
- (void)removeFromSuperview
@@ -102,8 +109,10 @@
- (void)_calculateFrameWithSuperAbsolutePosition:(CGPoint)superAbsolutePosition gatherDirtyComponents:(NSMutableSet<WXComponent *> *)dirtyComponents
{
- if (isUndefined(self.cssNode->style.dimensions[CSS_WIDTH]) && self.list) {
- self.cssNode->style.dimensions[CSS_WIDTH] = self.list.scrollerCSSNode->style.dimensions[CSS_WIDTH];
+ if (self.delegate && (isUndefined(self.cssNode->style.dimensions[CSS_WIDTH]) || _isUseContainerWidth)) {
+ self.cssNode->style.dimensions[CSS_WIDTH] = [self.delegate cellWidthForLayout:self];
+ //TODO: set _isUseContainerWidth to NO if updateStyles have width
+ _isUseContainerWidth = YES;
}
if ([self needsLayout]) {
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/1c96da7a/ios/sdk/WeexSDK/Sources/Component/WXComponent+GradientColor.h
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/WXComponent+GradientColor.h b/ios/sdk/WeexSDK/Sources/Component/WXComponent+GradientColor.h
index 0706eed..92b7596 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXComponent+GradientColor.h
+++ b/ios/sdk/WeexSDK/Sources/Component/WXComponent+GradientColor.h
@@ -1,10 +1,11 @@
-//
-// WXComponent+GradientColor.h
-// Pods
-//
-// Created by bobning on 16/12/23.
-//
-//
+/**
+ * Created by Weex.
+ * Copyright (c) 2016, Alibaba, Inc. All rights reserved.
+ *
+ * This source code is licensed under the Apache Licence 2.0.
+ * For the full copyright and license information,please view the LICENSE file in the root directory of this source tree.
+ */
+
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/1c96da7a/ios/sdk/WeexSDK/Sources/Component/WXComponent+GradientColor.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/WXComponent+GradientColor.m b/ios/sdk/WeexSDK/Sources/Component/WXComponent+GradientColor.m
index e710ed0..86c3379 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXComponent+GradientColor.m
+++ b/ios/sdk/WeexSDK/Sources/Component/WXComponent+GradientColor.m
@@ -1,10 +1,11 @@
-//
-// WXComponent+GradientColor.m
-// Pods
-//
-// Created by bobning on 16/12/23.
-//
-//
+/**
+ * Created by Weex.
+ * Copyright (c) 2016, Alibaba, Inc. All rights reserved.
+ *
+ * This source code is licensed under the Apache Licence 2.0.
+ * For the full copyright and license information,please view the LICENSE file in the root directory of this source tree.
+ */
+
#import "WXComponent+GradientColor.h"
#import "WXComponent_internal.h"
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/1c96da7a/ios/sdk/WeexSDK/Sources/Component/WXFooterComponent.h
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/WXFooterComponent.h b/ios/sdk/WeexSDK/Sources/Component/WXFooterComponent.h
new file mode 100644
index 0000000..e9c801c
--- /dev/null
+++ b/ios/sdk/WeexSDK/Sources/Component/WXFooterComponent.h
@@ -0,0 +1,13 @@
+/**
+ * Created by Weex.
+ * Copyright (c) 2016, Alibaba, Inc. All rights reserved.
+ *
+ * This source code is licensed under the Apache Licence 2.0.
+ * For the full copyright and license information,please view the LICENSE file in the root directory of this source tree.
+ */
+
+#import <WeexSDK/WeexSDK.h>
+
+@interface WXFooterComponent : WXComponent
+
+@end
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/1c96da7a/ios/sdk/WeexSDK/Sources/Component/WXFooterComponent.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/WXFooterComponent.m b/ios/sdk/WeexSDK/Sources/Component/WXFooterComponent.m
new file mode 100644
index 0000000..f139eaf
--- /dev/null
+++ b/ios/sdk/WeexSDK/Sources/Component/WXFooterComponent.m
@@ -0,0 +1,13 @@
+/**
+ * Created by Weex.
+ * Copyright (c) 2016, Alibaba, Inc. All rights reserved.
+ *
+ * This source code is licensed under the Apache Licence 2.0.
+ * For the full copyright and license information,please view the LICENSE file in the root directory of this source tree.
+ */
+
+#import "WXFooterComponent.h"
+
+@implementation WXFooterComponent
+
+@end
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/1c96da7a/ios/sdk/WeexSDK/Sources/Component/WXHeaderComponent.h
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/WXHeaderComponent.h b/ios/sdk/WeexSDK/Sources/Component/WXHeaderComponent.h
new file mode 100644
index 0000000..5aaf616
--- /dev/null
+++ b/ios/sdk/WeexSDK/Sources/Component/WXHeaderComponent.h
@@ -0,0 +1,25 @@
+/**
+ * Created by Weex.
+ * Copyright (c) 2016, Alibaba, Inc. All rights reserved.
+ *
+ * This source code is licensed under the Apache Licence 2.0.
+ * For the full copyright and license information,please view the LICENSE file in the root directory of this source tree.
+ */
+
+#import <WeexSDK/WeexSDK.h>
+@class WXHeaderComponent;
+
+@protocol WXHeaderRenderDelegate <NSObject>
+
+- (float)headerWidthForLayout:(WXHeaderComponent *)cell;
+
+- (void)headerDidLayout:(WXHeaderComponent *)cell;
+
+@end
+
+@interface WXHeaderComponent : WXComponent
+
+@property (nonatomic, weak) id<WXHeaderRenderDelegate> delegate;
+@property (nonatomic, assign, readonly) BOOL isSticky;
+
+@end
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/1c96da7a/ios/sdk/WeexSDK/Sources/Component/WXHeaderComponent.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/WXHeaderComponent.m b/ios/sdk/WeexSDK/Sources/Component/WXHeaderComponent.m
new file mode 100644
index 0000000..f54938d
--- /dev/null
+++ b/ios/sdk/WeexSDK/Sources/Component/WXHeaderComponent.m
@@ -0,0 +1,62 @@
+/**
+ * Created by Weex.
+ * Copyright (c) 2016, Alibaba, Inc. All rights reserved.
+ *
+ * This source code is licensed under the Apache Licence 2.0.
+ * For the full copyright and license information,please view the LICENSE file in the root directory of this source tree.
+ */
+
+#import "WXHeaderComponent.h"
+#import "WXComponent_internal.h"
+
+@implementation WXHeaderComponent
+{
+ BOOL _isUseContainerWidth;
+}
+
+//TODO: header remove->need reload
+- (instancetype)initWithRef:(NSString *)ref type:(NSString *)type styles:(NSDictionary *)styles attributes:(NSDictionary *)attributes events:(NSArray *)events weexInstance:(WXSDKInstance *)weexInstance
+{
+ self = [super initWithRef:ref type:type styles:styles attributes:attributes events:events weexInstance:weexInstance];
+
+ if (self) {
+ _async = YES;
+ _isNeedJoinLayoutSystem = NO;
+ }
+
+ return self;
+}
+
+- (BOOL)isSticky
+{
+ return _positionType == WXPositionTypeSticky;
+}
+
+- (void)_frameDidCalculated:(BOOL)isChanged
+{
+ [super _frameDidCalculated:isChanged];
+
+ if (isChanged) {
+ [self.delegate headerDidLayout:self];
+ }
+}
+
+- (void)_calculateFrameWithSuperAbsolutePosition:(CGPoint)superAbsolutePosition gatherDirtyComponents:(NSMutableSet<WXComponent *> *)dirtyComponents
+{
+ if (self.delegate && (isUndefined(self.cssNode->style.dimensions[CSS_WIDTH]) || _isUseContainerWidth)) {
+ self.cssNode->style.dimensions[CSS_WIDTH] = [self.delegate headerWidthForLayout:self];
+ //TODO: set _isUseContainerWidth to NO if updateStyles have width
+ _isUseContainerWidth = YES;
+ }
+
+ if ([self needsLayout]) {
+ layoutNode(self.cssNode, CSS_UNDEFINED, CSS_UNDEFINED, CSS_DIRECTION_INHERIT);
+ if ([WXLog logLevel] >= WXLogLevelDebug) {
+ print_css_node(self.cssNode, CSS_PRINT_LAYOUT | CSS_PRINT_STYLE | CSS_PRINT_CHILDREN);
+ }
+ }
+
+ [super _calculateFrameWithSuperAbsolutePosition:superAbsolutePosition gatherDirtyComponents:dirtyComponents];
+}
+
+@end
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/1c96da7a/ios/sdk/WeexSDK/Sources/Component/WXListComponent.h
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/WXListComponent.h b/ios/sdk/WeexSDK/Sources/Component/WXListComponent.h
index 007f502..2497c3b 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXListComponent.h
+++ b/ios/sdk/WeexSDK/Sources/Component/WXListComponent.h
@@ -8,18 +8,6 @@
#import "WXScrollerComponent.h"
-@class WXCellComponent;
-@class WXHeaderComponent;
@interface WXListComponent : WXScrollerComponent
-- (void)cellDidRemove:(WXCellComponent *)cell;
-
-- (void)cellDidLayout:(WXCellComponent *)cell;
-
-- (void)headerDidLayout:(WXHeaderComponent *)header;
-
-- (void)cellDidRendered:(WXCellComponent *)cell;
-
-- (void)cell:(WXCellComponent *)cell didMoveToIndex:(NSUInteger)index;
-
@end
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/1c96da7a/ios/sdk/WeexSDK/Sources/Component/WXListComponent.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/WXListComponent.m b/ios/sdk/WeexSDK/Sources/Component/WXListComponent.m
index 4ab6b2c..943bcf8 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXListComponent.m
+++ b/ios/sdk/WeexSDK/Sources/Component/WXListComponent.m
@@ -8,6 +8,7 @@
#import "WXListComponent.h"
#import "WXCellComponent.h"
+#import "WXHeaderComponent.h"
#import "WXComponent.h"
#import "WXComponent_internal.h"
#import "NSArray+Weex.h"
@@ -52,53 +53,6 @@
@end
-@interface WXHeaderComponent : WXComponent
-
-@property (nonatomic, weak) WXListComponent *list;
-
-@end
-
-@implementation WXHeaderComponent
-
-//TODO: header remove->need reload
-- (instancetype)initWithRef:(NSString *)ref type:(NSString *)type styles:(NSDictionary *)styles attributes:(NSDictionary *)attributes events:(NSArray *)events weexInstance:(WXSDKInstance *)weexInstance
-{
- self = [super initWithRef:ref type:type styles:styles attributes:attributes events:events weexInstance:weexInstance];
-
- if (self) {
- _async = YES;
- _isNeedJoinLayoutSystem = NO;
- }
-
- return self;
-}
-
-- (void)_frameDidCalculated:(BOOL)isChanged
-{
- [super _frameDidCalculated:isChanged];
-
- if (isChanged) {
- [self.list headerDidLayout:self];
- }
-}
-
-- (void)_calculateFrameWithSuperAbsolutePosition:(CGPoint)superAbsolutePosition gatherDirtyComponents:(NSMutableSet<WXComponent *> *)dirtyComponents
-{
- if (isUndefined(self.cssNode->style.dimensions[CSS_WIDTH]) && self.list) {
- self.cssNode->style.dimensions[CSS_WIDTH] = self.list.scrollerCSSNode->style.dimensions[CSS_WIDTH];
- }
-
- if ([self needsLayout]) {
- layoutNode(self.cssNode, CSS_UNDEFINED, CSS_UNDEFINED, CSS_DIRECTION_INHERIT);
- if ([WXLog logLevel] >= WXLogLevelDebug) {
- print_css_node(self.cssNode, CSS_PRINT_LAYOUT | CSS_PRINT_STYLE | CSS_PRINT_CHILDREN);
- }
- }
-
- [super _calculateFrameWithSuperAbsolutePosition:superAbsolutePosition gatherDirtyComponents:dirtyComponents];
-}
-
-@end
@interface WXSection : NSObject<NSCopying>
@@ -133,7 +87,7 @@
}
@end
-@interface WXListComponent () <UITableViewDataSource, UITableViewDelegate>
+@interface WXListComponent () <UITableViewDataSource, UITableViewDelegate, WXCellRenderDelegate, WXHeaderRenderDelegate>
@end
@@ -246,9 +200,9 @@
- (void)_insertSubcomponent:(WXComponent *)subcomponent atIndex:(NSInteger)index
{
if ([subcomponent isKindOfClass:[WXCellComponent class]]) {
- ((WXCellComponent *)subcomponent).list = self;
+ ((WXCellComponent *)subcomponent).delegate = self;
} else if ([subcomponent isKindOfClass:[WXHeaderComponent class]]) {
- ((WXHeaderComponent *)subcomponent).list = self;
+ ((WXHeaderComponent *)subcomponent).delegate = self;
} else if (![subcomponent isKindOfClass:[WXRefreshComponent class]]
&& ![subcomponent isKindOfClass:[WXLoadingComponent class]]
&& subcomponent->_positionType != WXPositionTypeFixed) {
@@ -295,6 +249,13 @@
}
}
+#pragma mark - WXHeaderRenderDelegate
+
+- (float)headerWidthForLayout:(WXHeaderComponent *)cell
+{
+ return self.scrollerCSSNode->style.dimensions[CSS_WIDTH];
+}
+
- (void)headerDidLayout:(WXHeaderComponent *)header
{
[self.weexInstance.componentManager _addUITask:^{
@@ -302,10 +263,16 @@
[_tableView beginUpdates];
[_tableView endUpdates];
}];
-
}
+#pragma mark - WXCellRenderDelegate
+
+- (float)cellWidthForLayout:(WXCellComponent *)cell
+{
+ return self.scrollerCSSNode->style.dimensions[CSS_WIDTH];
+}
+
- (void)cellDidRemove:(WXCellComponent *)cell
{
WXAssertComponentThread();
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/1c96da7a/ios/sdk/WeexSDK/Sources/Component/WXTransform.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/WXTransform.m b/ios/sdk/WeexSDK/Sources/Component/WXTransform.m
index a72f39b..e5ed68b 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXTransform.m
+++ b/ios/sdk/WeexSDK/Sources/Component/WXTransform.m
@@ -87,7 +87,7 @@
}
if (_translateX || _translateY) {
- nativeTransform = CGAffineTransformTranslate(nativeTransform, _translateX ? [_translateX valueForMaximumValue:view.bounds.size.width] : 0, _translateY ? [_translateY valueForMaximumValue:view.bounds.size.height] : 0);
+ nativeTransform = CGAffineTransformTranslate(nativeTransform, _translateX ? [_translateX valueForMaximum:view.bounds.size.width] : 0, _translateY ? [_translateY valueForMaximum:view.bounds.size.height] : 0);
}
nativeTransform = CGAffineTransformScale(nativeTransform, _scaleX, _scaleY);
@@ -131,8 +131,8 @@
* http://ronnqvi.st/translate-rotate-translate/
**/
CGPoint anchorPoint = CGPointMake(
- _originX ? [_originX valueForMaximumValue:view.bounds.size.width] / view.bounds.size.width : 0.5,
- _originY ? [_originY valueForMaximumValue:view.bounds.size.width] / view.bounds.size.height : 0.5);
+ _originX ? [_originX valueForMaximum:view.bounds.size.width] / view.bounds.size.width : 0.5,
+ _originY ? [_originY valueForMaximum:view.bounds.size.width] / view.bounds.size.height : 0.5);
[self setAnchorPoint:anchorPoint forView:view];
}
@@ -220,8 +220,8 @@
}
}
- _originX = [WXLength lengthWithValue:originX type:typeX];
- _originY = [WXLength lengthWithValue:originY type:typeY];
+ _originX = [WXLength lengthWithFloat:originX type:typeX];
+ _originY = [WXLength lengthWithFloat:originY type:typeY];
}
- (void)parseRotate:(NSArray *)value
@@ -235,20 +235,20 @@
WXLength *translateX;
double x = [value[0] doubleValue];
if ([value[0] hasSuffix:@"%"]) {
- translateX = [WXLength lengthWithValue:x type:WXLengthTypePercent];
+ translateX = [WXLength lengthWithFloat:x type:WXLengthTypePercent];
} else {
x = WXPixelScale(x, self.weexInstance.pixelScaleFactor);
- translateX = [WXLength lengthWithValue:x type:WXLengthTypeFixed];
+ translateX = [WXLength lengthWithFloat:x type:WXLengthTypeFixed];
}
WXLength *translateY;
if (value.count > 1) {
double y = [value[1] doubleValue];
if ([value[1] hasSuffix:@"%"]) {
- translateY = [WXLength lengthWithValue:y type:WXLengthTypePercent];
+ translateY = [WXLength lengthWithFloat:y type:WXLengthTypePercent];
} else {
y = WXPixelScale(y, self.weexInstance.pixelScaleFactor);
- translateY = [WXLength lengthWithValue:y type:WXLengthTypeFixed];
+ translateY = [WXLength lengthWithFloat:y type:WXLengthTypeFixed];
}
}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/1c96da7a/ios/sdk/WeexSDK/Sources/Engine/WXSDKEngine.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Engine/WXSDKEngine.m b/ios/sdk/WeexSDK/Sources/Engine/WXSDKEngine.m
index e804aea..cd9f50e 100644
--- a/ios/sdk/WeexSDK/Sources/Engine/WXSDKEngine.m
+++ b/ios/sdk/WeexSDK/Sources/Engine/WXSDKEngine.m
@@ -72,6 +72,8 @@
[self registerComponent:@"image" withClass:NSClassFromString(@"WXImageComponent") withProperties:nil];
[self registerComponent:@"scroller" withClass:NSClassFromString(@"WXScrollerComponent") withProperties:nil];
[self registerComponent:@"list" withClass:NSClassFromString(@"WXListComponent") withProperties:nil];
+ [self registerComponent:@"recycler" withClass:NSClassFromString(@"WXRecyclerComponent") withProperties:nil];
+ [self registerComponent:@"waterfall" withClass:NSClassFromString(@"WXRecyclerComponent") withProperties:nil];
[self registerComponent:@"header" withClass:NSClassFromString(@"WXHeaderComponent")];
[self registerComponent:@"cell" withClass:NSClassFromString(@"WXCellComponent")];
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/1c96da7a/ios/sdk/WeexSDK/Sources/Module/WXAnimationModule.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Module/WXAnimationModule.m b/ios/sdk/WeexSDK/Sources/Module/WXAnimationModule.m
index 3eafce0..81fd481 100644
--- a/ios/sdk/WeexSDK/Sources/Module/WXAnimationModule.m
+++ b/ios/sdk/WeexSDK/Sources/Module/WXAnimationModule.m
@@ -167,16 +167,16 @@ WX_EXPORT_METHOD(@selector(transition:args:callback:))
if ((wxTransform.translateX && ![wxTransform.translateX isEqualToLength:oldTransform.translateX]) || (!wxTransform.translateX && oldTransform.translateX)) {
WXAnimationInfo *newInfo = [info copy];
newInfo.propertyName = @"transform.translation.x";
- newInfo.fromValue = @([oldTransform.translateX valueForMaximumValue:view.bounds.size.width]);
- newInfo.toValue = @([wxTransform.translateX valueForMaximumValue:view.bounds.size.width]);
+ newInfo.fromValue = @([oldTransform.translateX valueForMaximum:view.bounds.size.width]);
+ newInfo.toValue = @([wxTransform.translateX valueForMaximum:view.bounds.size.width]);
[infos addObject:newInfo];
}
if ((wxTransform.translateY && ![wxTransform.translateY isEqualToLength:oldTransform.translateY]) || (!wxTransform.translateY && oldTransform.translateY)) {
WXAnimationInfo *newInfo = [info copy];
newInfo.propertyName = @"transform.translation.y";
- newInfo.fromValue = @([oldTransform.translateY valueForMaximumValue:view.bounds.size.height]);
- newInfo.toValue = @([wxTransform.translateY valueForMaximumValue:view.bounds.size.height]);
+ newInfo.fromValue = @([oldTransform.translateY valueForMaximum:view.bounds.size.height]);
+ newInfo.toValue = @([wxTransform.translateY valueForMaximum:view.bounds.size.height]);
[infos addObject:newInfo];
}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/1c96da7a/ios/sdk/WeexSDK/Sources/Utility/WXConvert.h
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Utility/WXConvert.h b/ios/sdk/WeexSDK/Sources/Utility/WXConvert.h
index 75658c6..bef72d0 100644
--- a/ios/sdk/WeexSDK/Sources/Utility/WXConvert.h
+++ b/ios/sdk/WeexSDK/Sources/Utility/WXConvert.h
@@ -11,6 +11,7 @@
#import "WXLog.h"
#import "WXLayoutDefine.h"
#import "WXType.h"
+#import "WXLength.h"
@interface WXConvert : NSObject
@@ -68,6 +69,8 @@ typedef BOOL WXClipType;
+ (WXGradientType)gradientType:(id)value;
++ (WXLength *)WXLength:(id)value isFloat:(BOOL)isFloat scaleFactor:(CGFloat)scaleFactor;
+
@end
@interface WXConvert (Deprecated)
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/1c96da7a/ios/sdk/WeexSDK/Sources/Utility/WXConvert.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Utility/WXConvert.m b/ios/sdk/WeexSDK/Sources/Utility/WXConvert.m
index 15c5f6c..b72d7df 100644
--- a/ios/sdk/WeexSDK/Sources/Utility/WXConvert.m
+++ b/ios/sdk/WeexSDK/Sources/Utility/WXConvert.m
@@ -8,6 +8,7 @@
#import "WXConvert.h"
#import "WXUtility.h"
+#import "WXAssert.h"
@implementation WXConvert
@@ -723,6 +724,34 @@ WX_NUMBER_CONVERT(NSUInteger, unsignedIntegerValue)
return type;
}
+#pragma mark - Length
+
++ (WXLength *)WXLength:(id)value isFloat:(BOOL)isFloat scaleFactor:(CGFloat)scaleFactor
+{
+ if (!value) {
+ return nil;
+ }
+
+ WXLengthType type = WXLengthTypeFixed;
+ if ([value isKindOfClass:[NSString class]]) {
+ if ([value isEqualToString:@"auto"]) {
+ type = WXLengthTypeAuto;
+ } else if ([value isEqualToString:@"normal"]){
+ type = WXLengthTypeNormal;
+ } else if ([value hasSuffix:@"%"]) {
+ type = WXLengthTypePercent;
+ }
+ } else if (![value isKindOfClass:[NSNumber class]]) {
+ WXAssert(NO, @"Unsupported type:%@ for WXLength", NSStringFromClass([value class]));
+ }
+
+ if (isFloat) {
+ return [WXLength lengthWithFloat:([value floatValue] * scaleFactor) type:type];
+ } else {
+ return [WXLength lengthWithInt:([value intValue] * scaleFactor) type:type];
+ }
+}
+
@end
@implementation WXConvert (Deprecated)
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/1c96da7a/ios/sdk/WeexSDK/Sources/Utility/WXDiffUtil.h
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Utility/WXDiffUtil.h b/ios/sdk/WeexSDK/Sources/Utility/WXDiffUtil.h
new file mode 100644
index 0000000..c7edda9
--- /dev/null
+++ b/ios/sdk/WeexSDK/Sources/Utility/WXDiffUtil.h
@@ -0,0 +1,32 @@
+/**
+ * Created by Weex.
+ * Copyright (c) 2016, Alibaba, Inc. All rights reserved.
+ *
+ * This source code is licensed under the Apache Licence 2.0.
+ * For the full copyright and license information,please view the LICENSE file in the root directory of this source tree.
+ */
+
+#import <Foundation/Foundation.h>
+
+@interface WXDiffUpdateIndex : NSObject
+
+@property (nonatomic, assign, readonly) NSUInteger oldIndex;
+@property (nonatomic, assign, readonly) NSUInteger newIndex;
+
+@end
+
+@interface WXDiffResult : NSObject
+
+@property (nonatomic, strong, readonly) NSIndexSet *inserts;
+@property (nonatomic, strong, readonly) NSIndexSet *deletes;
+@property (nonatomic, strong, readonly) NSArray<WXDiffUpdateIndex *> *updates;
+
+- (BOOL)hasChanges;
+
+@end
+
+@interface WXDiffUtil : NSObject
+
++ (WXDiffResult *)diffWithMinimumDistance:(NSArray *)newArray oldArray:(NSArray *)oldArray;
+
+@end
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/1c96da7a/ios/sdk/WeexSDK/Sources/Utility/WXDiffUtil.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Utility/WXDiffUtil.m b/ios/sdk/WeexSDK/Sources/Utility/WXDiffUtil.m
new file mode 100644
index 0000000..44bd737
--- /dev/null
+++ b/ios/sdk/WeexSDK/Sources/Utility/WXDiffUtil.m
@@ -0,0 +1,165 @@
+/**
+ * Created by Weex.
+ * Copyright (c) 2016, Alibaba, Inc. All rights reserved.
+ *
+ * This source code is licensed under the Apache Licence 2.0.
+ * For the full copyright and license information,please view the LICENSE file in the root directory of this source tree.
+ */
+
+#import "WXDiffUtil.h"
+
+typedef enum : NSUInteger {
+ WXDiffOperationDoNothing,
+ WXDiffOperationUpdate,
+ WXDiffOperationDelete,
+ WXDiffOperationInsert
+} WXDiffOperation;
+
+@implementation WXDiffUpdateIndex
+
+- (instancetype)initWithOldIndex:(NSUInteger)oldIndex newIndex:(NSUInteger)newIndex
+{
+ if (self = [super init]) {
+ _oldIndex = oldIndex;
+ _newIndex = newIndex;
+ }
+
+ return self;
+}
+
+@end
+
+@implementation WXDiffResult
+
+- (instancetype)initWithInserts:(NSIndexSet *)inserts
+ deletes:(NSIndexSet *)deletes
+ updates:(NSArray<WXDiffUpdateIndex *> *)updates
+{
+ if (self = [super init]) {
+ _inserts = [inserts copy];
+ _deletes = [deletes copy];
+ _updates = [updates copy];
+ }
+
+ return self;
+}
+
+- (BOOL)hasChanges
+{
+ return _updates.count > 0 || _inserts.count > 0 || _deletes.count > 0;
+}
+
+- (NSString *)description
+{
+ return [NSString stringWithFormat:@"<%@: %p; %zi inserts; %zi deletes; %zi updates", NSStringFromClass([self class]), self, _inserts.count, _deletes.count, _updates.count];
+}
+
+
+@end
+
+@implementation WXDiffUtil
+
++ (WXDiffResult *)diffWithMinimumDistance:(NSArray *)newArray oldArray:(NSArray *)oldArray
+{
+ // Using the levenshtein algorithm
+ // https://en.wikipedia.org/wiki/Levenshtein_distance
+
+ int oldSize = (int)(oldArray.count + 1);
+ int newSize = (int)(newArray.count + 1);
+
+ int **matrix = malloc(oldSize * sizeof(int *));
+ for (int i = 0; i < oldSize; i++) {
+ matrix[i] = malloc(newSize * sizeof(int));
+ }
+
+ matrix[0][0] = 0;
+
+ for (int i = 1; i < oldSize; i++) {
+ matrix[i][0] = i;
+ }
+
+ for (int j = 1; j < newSize; j++) {
+ matrix[0][j] = j;
+ }
+
+ for (int oldIndex = 1; oldIndex < oldSize; oldIndex ++) {
+ for (int newIndex = 1; newIndex < newSize; newIndex ++) {
+ if ([oldArray[oldIndex - 1] isEqual:newArray[newIndex - 1]]) {
+ matrix[oldIndex][newIndex] = matrix[oldIndex - 1][newIndex - 1];
+ } else {
+ int updateCost = matrix[oldIndex - 1][newIndex - 1] + 1;
+ int insertCost = matrix[oldIndex][newIndex - 1] + 1;
+ int deleteCost = matrix[oldIndex - 1][newIndex] + 1;
+ matrix[oldIndex][newIndex] = MIN(MIN(insertCost, deleteCost), updateCost);
+ }
+ }
+ }
+
+ NSMutableArray *updates = [NSMutableArray array];
+ NSMutableIndexSet *inserts = [NSMutableIndexSet indexSet];
+ NSMutableIndexSet *deletes = [NSMutableIndexSet indexSet];
+ int oldIndex = oldSize - 1;
+ int newIndex = newSize - 1;
+ while (oldIndex != 0 || newIndex != 0) {
+ WXDiffOperation operation = [self _operationInMatrix:matrix newIndex:newIndex oldIndex:oldIndex];
+ switch (operation) {
+ case WXDiffOperationUpdate:
+ newIndex --;
+ oldIndex --;
+ [updates addObject:[[WXDiffUpdateIndex alloc] initWithOldIndex:oldIndex newIndex:newIndex]];
+ break;
+ case WXDiffOperationDelete:
+ oldIndex --;
+ [deletes addIndex:oldIndex];
+ break;
+ case WXDiffOperationInsert:
+ newIndex --;
+ [inserts addIndex:newIndex];
+ break;
+ case WXDiffOperationDoNothing:
+ newIndex --;
+ oldIndex --;
+ break;
+ }
+ }
+
+ for (int i = 0; i < oldSize; i++) {
+ free(matrix[i]);
+ }
+ free(matrix);
+
+ WXDiffResult *result = [[WXDiffResult alloc] initWithInserts:inserts deletes:deletes updates:updates];
+ return result;
+}
+
++ (WXDiffOperation)_operationInMatrix:(int **)matrix newIndex:(int)newIndex oldIndex:(int)oldIndex
+{
+ if (newIndex == 0) {
+ return WXDiffOperationDelete;
+ }
+
+ if (oldIndex == 0) {
+ return WXDiffOperationInsert;
+ }
+
+ int cost = matrix[oldIndex][newIndex];
+
+ int costBeforeInsert = matrix[oldIndex][newIndex - 1];
+ if (costBeforeInsert + 1 == cost) {
+ return WXDiffOperationInsert;
+ }
+
+ int costBeforDelete = matrix[oldIndex - 1][newIndex];
+ if (costBeforDelete + 1 == cost) {
+ return WXDiffOperationDelete;
+ }
+
+ int costBeforUpdate = matrix[oldIndex - 1][newIndex - 1];
+ if (costBeforUpdate + 1 == cost) {
+ return WXDiffOperationUpdate;
+ }
+
+ return WXDiffOperationDoNothing;
+}
+
+@end
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/1c96da7a/ios/sdk/WeexSDK/Sources/Utility/WXLength.h
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Utility/WXLength.h b/ios/sdk/WeexSDK/Sources/Utility/WXLength.h
index b8480ea..491d2d7 100644
--- a/ios/sdk/WeexSDK/Sources/Utility/WXLength.h
+++ b/ios/sdk/WeexSDK/Sources/Utility/WXLength.h
@@ -12,13 +12,20 @@ typedef enum : NSUInteger {
WXLengthTypeFixed,
WXLengthTypePercent,
WXLengthTypeAuto,
+ WXLengthTypeNormal
} WXLengthType;
@interface WXLength : NSObject
-+ (instancetype)lengthWithValue:(float)value type:(WXLengthType)type;
++ (instancetype)lengthWithFloat:(float)value type:(WXLengthType)type;
-- (float)valueForMaximumValue:(float)maximumValue;
++ (instancetype)lengthWithInt:(int)value type:(WXLengthType)type;
+
+- (float)valueForMaximum:(float)maximumValue;
+
+- (int)intValue;
+
+- (float)floatValue;
- (BOOL)isEqualToLength:(WXLength *)length;
@@ -28,4 +35,6 @@ typedef enum : NSUInteger {
- (BOOL)isAuto;
+- (BOOL)isNormal;
+
@end
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/1c96da7a/ios/sdk/WeexSDK/Sources/Utility/WXLength.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Utility/WXLength.m b/ios/sdk/WeexSDK/Sources/Utility/WXLength.m
index 30cf57e..e64526d 100644
--- a/ios/sdk/WeexSDK/Sources/Utility/WXLength.m
+++ b/ios/sdk/WeexSDK/Sources/Utility/WXLength.m
@@ -11,25 +11,38 @@
@implementation WXLength
{
- float _value;
+ float _floatValue;
+ int _intValue;
WXLengthType _type;
+ BOOL _isFloat;
}
-+ (instancetype)lengthWithValue:(float)value type:(WXLengthType)type
++ (instancetype)lengthWithFloat:(float)value type:(WXLengthType)type
{
WXLength *length = [WXLength new];
- length->_value = value;
+ length->_floatValue = value;
length->_type = type;
+ length->_isFloat = YES;
return length;
}
-- (float)valueForMaximumValue:(float)maximumValue
++ (instancetype)lengthWithInt:(int)value type:(WXLengthType)type
{
+ WXLength *length = [WXLength new];
+ length->_intValue = value;
+ length->_type = type;
+ length->_isFloat = NO;
+ return length;
+}
+
+- (float)valueForMaximum:(float)maximumValue
+{
+
switch (_type) {
case WXLengthTypeFixed:
- return _value;
+ return _isFloat ? _floatValue : _intValue;
case WXLengthTypePercent:
- return maximumValue * _value / 100.0;
+ return maximumValue * (_isFloat ? _floatValue : _intValue) / 100.0;
case WXLengthTypeAuto:
return maximumValue;
default:
@@ -38,9 +51,22 @@
}
}
+- (int)intValue
+{
+ WXAssert(!_isFloat, @"call `intValue` for non-int length");
+ return _intValue;
+}
+
+- (float)floatValue
+{
+ WXAssert(_isFloat, @"call `floatValue` for non-float length");
+ return _floatValue;
+}
+
- (BOOL)isEqualToLength:(WXLength *)length
{
- return length && _type == length->_type && _value == length->_value;
+ return length && _type == length->_type && _isFloat == length->_isFloat
+ && _floatValue == length->_floatValue && _intValue == length->_intValue;
}
- (BOOL)isFixed
@@ -58,4 +84,9 @@
return _type == WXLengthTypeAuto;
}
+- (BOOL)isNormal
+{
+ return _type == WXLengthTypeNormal;
+}
+
@end
[06/25] incubator-weex git commit: * [android] support waterfall
Posted by cx...@apache.org.
* [android] support waterfall
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/4f2b772f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/4f2b772f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/4f2b772f
Branch: refs/heads/0.11-dev-recycler
Commit: 4f2b772f7b52de4c9365bf4d353265aa5f524681
Parents: 7984c9b
Author: zshshr <zh...@gmail.com>
Authored: Thu Feb 23 16:20:56 2017 +0800
Committer: zshshr <zh...@gmail.com>
Committed: Thu Feb 23 16:20:56 2017 +0800
----------------------------------------------------------------------
android/sdk/src/main/java/com/taobao/weex/WXSDKEngine.java | 2 +-
.../java/com/taobao/weex/ui/component/WXBasicComponentType.java | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/4f2b772f/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 c7a5245..ff5ce84 100755
--- a/android/sdk/src/main/java/com/taobao/weex/WXSDKEngine.java
+++ b/android/sdk/src/main/java/com/taobao/weex/WXSDKEngine.java
@@ -348,7 +348,7 @@ public class WXSDKEngine {
WXBasicComponentType.SLIDER_NEIGHBOR
);
registerComponent(SimpleListComponent.class,false,"simplelist");
- registerComponent(WXListComponent.class, false,WXBasicComponentType.LIST,WXBasicComponentType.VLIST,WXBasicComponentType.RECYCLER);
+ registerComponent(WXListComponent.class, false,WXBasicComponentType.LIST,WXBasicComponentType.VLIST,WXBasicComponentType.RECYCLER,WXBasicComponentType.WATERFALL);
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/4f2b772f/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 7d68799..0d47232 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
@@ -219,6 +219,7 @@ public class WXBasicComponentType {
public static final String SLIDER_NEIGHBOR = "slider-neighbor";
public static final String LIST = "list";
public static final String RECYCLER = "recycler";
+ public static final String WATERFALL = "waterfall";
public static final String VLIST = "vlist";
public static final String HLIST = "hlist";
public static final String CELL = "cell";
[18/25] incubator-weex git commit: * [android] bugfix for recycler
columnGap
Posted by cx...@apache.org.
* [android] bugfix for recycler columnGap
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/dee9b6d0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/dee9b6d0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/dee9b6d0
Branch: refs/heads/0.11-dev-recycler
Commit: dee9b6d0aade4761db1987e6d51c4fdd1e4ee91d
Parents: c6db620
Author: zshshr <zh...@gmail.com>
Authored: Sun Feb 26 22:48:43 2017 +0800
Committer: zshshr <zh...@gmail.com>
Committed: Sun Feb 26 22:48:43 2017 +0800
----------------------------------------------------------------------
.../java/com/taobao/weex/common/Constants.java | 1 +
.../main/java/com/taobao/weex/dom/WXAttr.java | 2 +-
.../taobao/weex/dom/WXRecyclerDomObject.java | 10 -
.../ui/component/list/BasicListComponent.java | 3 +-
.../weex/ui/view/listview/WXRecyclerView.java | 5 +-
.../ui/view/listview/WXSpaceItemDecoration.java | 257 -------------------
.../listview/WXStaggeredGridLayoutManager.java | 218 ----------------
7 files changed, 5 insertions(+), 491 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/dee9b6d0/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 8b92ca1..eed5191 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
@@ -352,6 +352,7 @@ public class Constants {
String OFFSET = "offset";
String ANIMATED = "animated";
String AUTO = "auto";
+ String NORMAL = "normal";
}
public interface Value {
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/dee9b6d0/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 73e8393..3846319 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
@@ -490,7 +490,7 @@ public class WXAttr implements Map<String, Object>,Cloneable {
}
String value = String.valueOf(obj);
- if (Constants.Name.AUTO.equals(value)) {
+ if (Constants.Name.NORMAL.equals(value)) {
return Constants.Value.COLUMN_GAP_NORMAL;
}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/dee9b6d0/android/sdk/src/main/java/com/taobao/weex/dom/WXRecyclerDomObject.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/dom/WXRecyclerDomObject.java b/android/sdk/src/main/java/com/taobao/weex/dom/WXRecyclerDomObject.java
index 3ffaee4..3ee0e06 100644
--- a/android/sdk/src/main/java/com/taobao/weex/dom/WXRecyclerDomObject.java
+++ b/android/sdk/src/main/java/com/taobao/weex/dom/WXRecyclerDomObject.java
@@ -306,16 +306,6 @@ public class WXRecyclerDomObject extends WXDomObject{
}
@Override
- public void updateStyle(Map<String, Object> styles) {
- super.updateStyle(styles);
- if(styles.containsKey(Constants.Name.PADDING)
- ||styles.containsKey(Constants.Name.PADDING_LEFT)
- || styles.containsKey(Constants.Name.PADDING_RIGHT)){
- preCalculateCellWidth();
- }
- }
-
- @Override
public void updateStyle(Map<String, Object> styles, boolean byPesudo) {
super.updateStyle(styles, byPesudo);
if(styles.containsKey(Constants.Name.PADDING)
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/dee9b6d0/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 1345757..45cffaa 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
@@ -319,7 +319,7 @@ public abstract class BasicListComponent<T extends ViewGroup & ListComponentView
int screenH = WXViewUtils.getScreenHeight(WXEnvironment.sApplication);
int weexH = WXViewUtils.getWeexHeight(getInstanceId());
int outHeight = height > (weexH >= screenH ? screenH : weexH) ? weexH - getAbsoluteY() : height;
- return super.measure(width, outHeight);
+ return super.measure((int)(width+mColumnGap), outHeight);
}
public int getOrientation() {
@@ -1198,7 +1198,6 @@ public abstract class BasicListComponent<T extends ViewGroup & ListComponentView
contentOffset.put(Constants.Name.X, - WXViewUtils.getWebPxByWidth(offsetX, getInstance().getViewPortWidth()));
contentOffset.put(Constants.Name.Y, - WXViewUtils.getWebPxByWidth(offsetY, getInstance().getViewPortWidth()));
-
event.put(Constants.Name.CONTENT_SIZE, contentSize);
event.put(Constants.Name.CONTENT_OFFSET, contentOffset);
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/dee9b6d0/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 adffd9b..4352cfe 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
@@ -211,6 +211,7 @@ import android.support.annotation.Nullable;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.OrientationHelper;
import android.support.v7.widget.RecyclerView;
+import android.support.v7.widget.StaggeredGridLayoutManager;
import android.view.MotionEvent;
import com.taobao.weex.common.Constants;
@@ -258,9 +259,7 @@ public class WXRecyclerView extends RecyclerView implements WXGestureObservable
if (type == TYPE_GRID_LAYOUT) {
setLayoutManager(new GridLayoutManager(context, columnCount,orientation,false));
} else if (type == TYPE_STAGGERED_GRID_LAYOUT) {
- setLayoutManager(new WXStaggeredGridLayoutManager(columnCount, orientation));
- addItemDecoration(new WXSpaceItemDecoration(columnCount,columnGap));
-
+ setLayoutManager(new StaggeredGridLayoutManager(columnCount, orientation));
} else if (type == TYPE_LINEAR_LAYOUT) {
setLayoutManager(new ExtendedLinearLayoutManager(context,orientation,false));
}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/dee9b6d0/android/sdk/src/main/java/com/taobao/weex/ui/view/listview/WXSpaceItemDecoration.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/view/listview/WXSpaceItemDecoration.java b/android/sdk/src/main/java/com/taobao/weex/ui/view/listview/WXSpaceItemDecoration.java
deleted file mode 100644
index dd9015c..0000000
--- a/android/sdk/src/main/java/com/taobao/weex/ui/view/listview/WXSpaceItemDecoration.java
+++ /dev/null
@@ -1,257 +0,0 @@
-/**
- *
- * Apache License
- * Version 2.0, January 2004
- * http://www.apache.org/licenses/
- *
- * TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
- *
- * 1. Definitions.
- *
- * "License" shall mean the terms and conditions for use, reproduction,
- * and distribution as defined by Sections 1 through 9 of this document.
- *
- * "Licensor" shall mean the copyright owner or entity authorized by
- * the copyright owner that is granting the License.
- *
- * "Legal Entity" shall mean the union of the acting entity and all
- * other entities that control, are controlled by, or are under common
- * control with that entity. For the purposes of this definition,
- * "control" means (i) the power, direct or indirect, to cause the
- * direction or management of such entity, whether by contract or
- * otherwise, or (ii) ownership of fifty percent (50%) or more of the
- * outstanding shares, or (iii) beneficial ownership of such entity.
- *
- * "You" (or "Your") shall mean an individual or Legal Entity
- * exercising permissions granted by this License.
- *
- * "Source" form shall mean the preferred form for making modifications,
- * including but not limited to software source code, documentation
- * source, and configuration files.
- *
- * "Object" form shall mean any form resulting from mechanical
- * transformation or translation of a Source form, including but
- * not limited to compiled object code, generated documentation,
- * and conversions to other media types.
- *
- * "Work" shall mean the work of authorship, whether in Source or
- * Object form, made available under the License, as indicated by a
- * copyright notice that is included in or attached to the work
- * (an example is provided in the Appendix below).
- *
- * "Derivative Works" shall mean any work, whether in Source or Object
- * form, that is based on (or derived from) the Work and for which the
- * editorial revisions, annotations, elaborations, or other modifications
- * represent, as a whole, an original work of authorship. For the purposes
- * of this License, Derivative Works shall not include works that remain
- * separable from, or merely link (or bind by name) to the interfaces of,
- * the Work and Derivative Works thereof.
- *
- * "Contribution" shall mean any work of authorship, including
- * the original version of the Work and any modifications or additions
- * to that Work or Derivative Works thereof, that is intentionally
- * submitted to Licensor for inclusion in the Work by the copyright owner
- * or by an individual or Legal Entity authorized to submit on behalf of
- * the copyright owner. For the purposes of this definition, "submitted"
- * means any form of electronic, verbal, or written communication sent
- * to the Licensor or its representatives, including but not limited to
- * communication on electronic mailing lists, source code control systems,
- * and issue tracking systems that are managed by, or on behalf of, the
- * Licensor for the purpose of discussing and improving the Work, but
- * excluding communication that is conspicuously marked or otherwise
- * designated in writing by the copyright owner as "Not a Contribution."
- *
- * "Contributor" shall mean Licensor and any individual or Legal Entity
- * on behalf of whom a Contribution has been received by Licensor and
- * subsequently incorporated within the Work.
- *
- * 2. Grant of Copyright License. Subject to the terms and conditions of
- * this License, each Contributor hereby grants to You a perpetual,
- * worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- * copyright license to reproduce, prepare Derivative Works of,
- * publicly display, publicly perform, sublicense, and distribute the
- * Work and such Derivative Works in Source or Object form.
- *
- * 3. Grant of Patent License. Subject to the terms and conditions of
- * this License, each Contributor hereby grants to You a perpetual,
- * worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- * (except as stated in this section) patent license to make, have made,
- * use, offer to sell, sell, import, and otherwise transfer the Work,
- * where such license applies only to those patent claims licensable
- * by such Contributor that are necessarily infringed by their
- * Contribution(s) alone or by combination of their Contribution(s)
- * with the Work to which such Contribution(s) was submitted. If You
- * institute patent litigation against any entity (including a
- * cross-claim or counterclaim in a lawsuit) alleging that the Work
- * or a Contribution incorporated within the Work constitutes direct
- * or contributory patent infringement, then any patent licenses
- * granted to You under this License for that Work shall terminate
- * as of the date such litigation is filed.
- *
- * 4. Redistribution. You may reproduce and distribute copies of the
- * Work or Derivative Works thereof in any medium, with or without
- * modifications, and in Source or Object form, provided that You
- * meet the following conditions:
- *
- * (a) You must give any other recipients of the Work or
- * Derivative Works a copy of this License; and
- *
- * (b) You must cause any modified files to carry prominent notices
- * stating that You changed the files; and
- *
- * (c) You must retain, in the Source form of any Derivative Works
- * that You distribute, all copyright, patent, trademark, and
- * attribution notices from the Source form of the Work,
- * excluding those notices that do not pertain to any part of
- * the Derivative Works; and
- *
- * (d) If the Work includes a "NOTICE" text file as part of its
- * distribution, then any Derivative Works that You distribute must
- * include a readable copy of the attribution notices contained
- * within such NOTICE file, excluding those notices that do not
- * pertain to any part of the Derivative Works, in at least one
- * of the following places: within a NOTICE text file distributed
- * as part of the Derivative Works; within the Source form or
- * documentation, if provided along with the Derivative Works; or,
- * within a display generated by the Derivative Works, if and
- * wherever such third-party notices normally appear. The contents
- * of the NOTICE file are for informational purposes only and
- * do not modify the License. You may add Your own attribution
- * notices within Derivative Works that You distribute, alongside
- * or as an addendum to the NOTICE text from the Work, provided
- * that such additional attribution notices cannot be construed
- * as modifying the License.
- *
- * You may add Your own copyright statement to Your modifications and
- * may provide additional or different license terms and conditions
- * for use, reproduction, or distribution of Your modifications, or
- * for any such Derivative Works as a whole, provided Your use,
- * reproduction, and distribution of the Work otherwise complies with
- * the conditions stated in this License.
- *
- * 5. Submission of Contributions. Unless You explicitly state otherwise,
- * any Contribution intentionally submitted for inclusion in the Work
- * by You to the Licensor shall be under the terms and conditions of
- * this License, without any additional terms or conditions.
- * Notwithstanding the above, nothing herein shall supersede or modify
- * the terms of any separate license agreement you may have executed
- * with Licensor regarding such Contributions.
- *
- * 6. Trademarks. This License does not grant permission to use the trade
- * names, trademarks, service marks, or product names of the Licensor,
- * except as required for reasonable and customary use in describing the
- * origin of the Work and reproducing the content of the NOTICE file.
- *
- * 7. Disclaimer of Warranty. Unless required by applicable law or
- * agreed to in writing, Licensor provides the Work (and each
- * Contributor provides its Contributions) on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied, including, without limitation, any warranties or conditions
- * of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- * PARTICULAR PURPOSE. You are solely responsible for determining the
- * appropriateness of using or redistributing the Work and assume any
- * risks associated with Your exercise of permissions under this License.
- *
- * 8. Limitation of Liability. In no event and under no legal theory,
- * whether in tort (including negligence), contract, or otherwise,
- * unless required by applicable law (such as deliberate and grossly
- * negligent acts) or agreed to in writing, shall any Contributor be
- * liable to You for damages, including any direct, indirect, special,
- * incidental, or consequential damages of any character arising as a
- * result of this License or out of the use or inability to use the
- * Work (including but not limited to damages for loss of goodwill,
- * work stoppage, computer failure or malfunction, or any and all
- * other commercial damages or losses), even if such Contributor
- * has been advised of the possibility of such damages.
- *
- * 9. Accepting Warranty or Additional Liability. While redistributing
- * the Work or Derivative Works thereof, You may choose to offer,
- * and charge a fee for, acceptance of support, warranty, indemnity,
- * or other liability obligations and/or rights consistent with this
- * License. However, in accepting such obligations, You may act only
- * on Your own behalf and on Your sole responsibility, not on behalf
- * of any other Contributor, and only if You agree to indemnify,
- * defend, and hold each Contributor harmless for any liability
- * incurred by, or claims asserted against, such Contributor by reason
- * of your accepting any such warranty or additional liability.
- *
- * END OF TERMS AND CONDITIONS
- *
- * APPENDIX: How to apply the Apache License to your work.
- *
- * To apply the Apache License to your work, attach the following
- * boilerplate notice, with the fields enclosed by brackets "[]"
- * replaced with your own identifying information. (Don't include
- * the brackets!) The text should be enclosed in the appropriate
- * comment syntax for the file format. We also recommend that a
- * file or class name and description of purpose be included on the
- * same "printed page" as the copyright notice for easier
- * identification within third-party archives.
- *
- * Copyright 2016 Alibaba Group
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.taobao.weex.ui.view.listview;
-
-import android.annotation.TargetApi;
-import android.graphics.Rect;
-import android.os.Build;
-import android.support.v7.widget.RecyclerView;
-import android.support.v7.widget.StaggeredGridLayoutManager;
-import android.view.View;
-
-/**
- * Created by zhengshihan on 2017/2/20.
- */
-
-public class WXSpaceItemDecoration extends RecyclerView.ItemDecoration {
- private float mColumnGap;
- private int mColumnCount;
-
- public WXSpaceItemDecoration(int columnCount, float columnGap) {
- mColumnGap = columnGap;
- mColumnCount = columnCount;
- }
-
- @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
- @Override
- public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
-
- StaggeredGridLayoutManager.LayoutParams layoutParams
- = (StaggeredGridLayoutManager.LayoutParams) view.getLayoutParams();
-
- if (!layoutParams.isFullSpan()) {
- int position = parent.getChildLayoutPosition(view);
-
- if (position < 0) {
- return;
- }
- int spanIndex = layoutParams.getSpanIndex();
- spanIndex++;
-
- int margin = (int) (mColumnGap / mColumnCount);
- if(spanIndex % mColumnCount == 1){
- layoutParams.setMarginStart(0);
- layoutParams.setMarginEnd(margin);
- }else if (spanIndex % mColumnCount ==0){
- layoutParams.setMarginStart(margin);
- layoutParams.setMarginEnd(0);
- } else {
- layoutParams.setMarginEnd(margin);
- layoutParams.setMarginStart(margin);
- }
-
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/dee9b6d0/android/sdk/src/main/java/com/taobao/weex/ui/view/listview/WXStaggeredGridLayoutManager.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/view/listview/WXStaggeredGridLayoutManager.java b/android/sdk/src/main/java/com/taobao/weex/ui/view/listview/WXStaggeredGridLayoutManager.java
deleted file mode 100644
index 6bbb78e..0000000
--- a/android/sdk/src/main/java/com/taobao/weex/ui/view/listview/WXStaggeredGridLayoutManager.java
+++ /dev/null
@@ -1,218 +0,0 @@
-/**
- *
- * Apache License
- * Version 2.0, January 2004
- * http://www.apache.org/licenses/
- *
- * TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
- *
- * 1. Definitions.
- *
- * "License" shall mean the terms and conditions for use, reproduction,
- * and distribution as defined by Sections 1 through 9 of this document.
- *
- * "Licensor" shall mean the copyright owner or entity authorized by
- * the copyright owner that is granting the License.
- *
- * "Legal Entity" shall mean the union of the acting entity and all
- * other entities that control, are controlled by, or are under common
- * control with that entity. For the purposes of this definition,
- * "control" means (i) the power, direct or indirect, to cause the
- * direction or management of such entity, whether by contract or
- * otherwise, or (ii) ownership of fifty percent (50%) or more of the
- * outstanding shares, or (iii) beneficial ownership of such entity.
- *
- * "You" (or "Your") shall mean an individual or Legal Entity
- * exercising permissions granted by this License.
- *
- * "Source" form shall mean the preferred form for making modifications,
- * including but not limited to software source code, documentation
- * source, and configuration files.
- *
- * "Object" form shall mean any form resulting from mechanical
- * transformation or translation of a Source form, including but
- * not limited to compiled object code, generated documentation,
- * and conversions to other media types.
- *
- * "Work" shall mean the work of authorship, whether in Source or
- * Object form, made available under the License, as indicated by a
- * copyright notice that is included in or attached to the work
- * (an example is provided in the Appendix below).
- *
- * "Derivative Works" shall mean any work, whether in Source or Object
- * form, that is based on (or derived from) the Work and for which the
- * editorial revisions, annotations, elaborations, or other modifications
- * represent, as a whole, an original work of authorship. For the purposes
- * of this License, Derivative Works shall not include works that remain
- * separable from, or merely link (or bind by name) to the interfaces of,
- * the Work and Derivative Works thereof.
- *
- * "Contribution" shall mean any work of authorship, including
- * the original version of the Work and any modifications or additions
- * to that Work or Derivative Works thereof, that is intentionally
- * submitted to Licensor for inclusion in the Work by the copyright owner
- * or by an individual or Legal Entity authorized to submit on behalf of
- * the copyright owner. For the purposes of this definition, "submitted"
- * means any form of electronic, verbal, or written communication sent
- * to the Licensor or its representatives, including but not limited to
- * communication on electronic mailing lists, source code control systems,
- * and issue tracking systems that are managed by, or on behalf of, the
- * Licensor for the purpose of discussing and improving the Work, but
- * excluding communication that is conspicuously marked or otherwise
- * designated in writing by the copyright owner as "Not a Contribution."
- *
- * "Contributor" shall mean Licensor and any individual or Legal Entity
- * on behalf of whom a Contribution has been received by Licensor and
- * subsequently incorporated within the Work.
- *
- * 2. Grant of Copyright License. Subject to the terms and conditions of
- * this License, each Contributor hereby grants to You a perpetual,
- * worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- * copyright license to reproduce, prepare Derivative Works of,
- * publicly display, publicly perform, sublicense, and distribute the
- * Work and such Derivative Works in Source or Object form.
- *
- * 3. Grant of Patent License. Subject to the terms and conditions of
- * this License, each Contributor hereby grants to You a perpetual,
- * worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- * (except as stated in this section) patent license to make, have made,
- * use, offer to sell, sell, import, and otherwise transfer the Work,
- * where such license applies only to those patent claims licensable
- * by such Contributor that are necessarily infringed by their
- * Contribution(s) alone or by combination of their Contribution(s)
- * with the Work to which such Contribution(s) was submitted. If You
- * institute patent litigation against any entity (including a
- * cross-claim or counterclaim in a lawsuit) alleging that the Work
- * or a Contribution incorporated within the Work constitutes direct
- * or contributory patent infringement, then any patent licenses
- * granted to You under this License for that Work shall terminate
- * as of the date such litigation is filed.
- *
- * 4. Redistribution. You may reproduce and distribute copies of the
- * Work or Derivative Works thereof in any medium, with or without
- * modifications, and in Source or Object form, provided that You
- * meet the following conditions:
- *
- * (a) You must give any other recipients of the Work or
- * Derivative Works a copy of this License; and
- *
- * (b) You must cause any modified files to carry prominent notices
- * stating that You changed the files; and
- *
- * (c) You must retain, in the Source form of any Derivative Works
- * that You distribute, all copyright, patent, trademark, and
- * attribution notices from the Source form of the Work,
- * excluding those notices that do not pertain to any part of
- * the Derivative Works; and
- *
- * (d) If the Work includes a "NOTICE" text file as part of its
- * distribution, then any Derivative Works that You distribute must
- * include a readable copy of the attribution notices contained
- * within such NOTICE file, excluding those notices that do not
- * pertain to any part of the Derivative Works, in at least one
- * of the following places: within a NOTICE text file distributed
- * as part of the Derivative Works; within the Source form or
- * documentation, if provided along with the Derivative Works; or,
- * within a display generated by the Derivative Works, if and
- * wherever such third-party notices normally appear. The contents
- * of the NOTICE file are for informational purposes only and
- * do not modify the License. You may add Your own attribution
- * notices within Derivative Works that You distribute, alongside
- * or as an addendum to the NOTICE text from the Work, provided
- * that such additional attribution notices cannot be construed
- * as modifying the License.
- *
- * You may add Your own copyright statement to Your modifications and
- * may provide additional or different license terms and conditions
- * for use, reproduction, or distribution of Your modifications, or
- * for any such Derivative Works as a whole, provided Your use,
- * reproduction, and distribution of the Work otherwise complies with
- * the conditions stated in this License.
- *
- * 5. Submission of Contributions. Unless You explicitly state otherwise,
- * any Contribution intentionally submitted for inclusion in the Work
- * by You to the Licensor shall be under the terms and conditions of
- * this License, without any additional terms or conditions.
- * Notwithstanding the above, nothing herein shall supersede or modify
- * the terms of any separate license agreement you may have executed
- * with Licensor regarding such Contributions.
- *
- * 6. Trademarks. This License does not grant permission to use the trade
- * names, trademarks, service marks, or product names of the Licensor,
- * except as required for reasonable and customary use in describing the
- * origin of the Work and reproducing the content of the NOTICE file.
- *
- * 7. Disclaimer of Warranty. Unless required by applicable law or
- * agreed to in writing, Licensor provides the Work (and each
- * Contributor provides its Contributions) on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied, including, without limitation, any warranties or conditions
- * of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- * PARTICULAR PURPOSE. You are solely responsible for determining the
- * appropriateness of using or redistributing the Work and assume any
- * risks associated with Your exercise of permissions under this License.
- *
- * 8. Limitation of Liability. In no event and under no legal theory,
- * whether in tort (including negligence), contract, or otherwise,
- * unless required by applicable law (such as deliberate and grossly
- * negligent acts) or agreed to in writing, shall any Contributor be
- * liable to You for damages, including any direct, indirect, special,
- * incidental, or consequential damages of any character arising as a
- * result of this License or out of the use or inability to use the
- * Work (including but not limited to damages for loss of goodwill,
- * work stoppage, computer failure or malfunction, or any and all
- * other commercial damages or losses), even if such Contributor
- * has been advised of the possibility of such damages.
- *
- * 9. Accepting Warranty or Additional Liability. While redistributing
- * the Work or Derivative Works thereof, You may choose to offer,
- * and charge a fee for, acceptance of support, warranty, indemnity,
- * or other liability obligations and/or rights consistent with this
- * License. However, in accepting such obligations, You may act only
- * on Your own behalf and on Your sole responsibility, not on behalf
- * of any other Contributor, and only if You agree to indemnify,
- * defend, and hold each Contributor harmless for any liability
- * incurred by, or claims asserted against, such Contributor by reason
- * of your accepting any such warranty or additional liability.
- *
- * END OF TERMS AND CONDITIONS
- *
- * APPENDIX: How to apply the Apache License to your work.
- *
- * To apply the Apache License to your work, attach the following
- * boilerplate notice, with the fields enclosed by brackets "[]"
- * replaced with your own identifying information. (Don't include
- * the brackets!) The text should be enclosed in the appropriate
- * comment syntax for the file format. We also recommend that a
- * file or class name and description of purpose be included on the
- * same "printed page" as the copyright notice for easier
- * identification within third-party archives.
- *
- * Copyright 2016 Alibaba Group
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.taobao.weex.ui.view.listview;
-
-import android.support.v7.widget.StaggeredGridLayoutManager;
-
-/**
- * Created by zhengshihan on 2017/2/24.
- */
-
-public class WXStaggeredGridLayoutManager extends StaggeredGridLayoutManager {
- public WXStaggeredGridLayoutManager(int spanCount, int orientation) {
- super(spanCount, orientation);
- setGapStrategy(GAP_HANDLING_NONE);
- }
-}
[23/25] incubator-weex git commit: Merge branch
'0.11-dev-suppport-recycler-component' of https://github.com/alibaba/weex
into 0.11-dev-suppport-recycler-component
Posted by cx...@apache.org.
Merge branch '0.11-dev-suppport-recycler-component' of https://github.com/alibaba/weex into 0.11-dev-suppport-recycler-component
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/5139da89
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/5139da89
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/5139da89
Branch: refs/heads/0.11-dev-recycler
Commit: 5139da89b5a34d68d38cb13244920f91f375fdeb
Parents: e37d14f bf32a40
Author: zshshr <zh...@gmail.com>
Authored: Mon Feb 27 11:43:22 2017 +0800
Committer: zshshr <zh...@gmail.com>
Committed: Mon Feb 27 11:43:22 2017 +0800
----------------------------------------------------------------------
.travis.yml | 2 +
.../commons/adapter/JSExceptionAdapter.java | 222 ++
.../java/com/alibaba/weex/WXApplication.java | 2 +
.../zxing/client/android/CaptureActivity.java | 1 +
android/run-ci.sh | 2 +-
android/sdk/libs/armeabi/libweexv8.so | Bin 3583820 -> 3583820 bytes
android/sdk/libs/x86/libweexv8.so | Bin 4340864 -> 4340864 bytes
.../main/java/com/taobao/weex/InitConfig.java | 13 +
.../main/java/com/taobao/weex/WXSDKEngine.java | 5 +
.../java/com/taobao/weex/WXSDKInstance.java | 4 +-
.../main/java/com/taobao/weex/WXSDKManager.java | 14 +
.../weex/adapter/IWXJSExceptionAdapter.java | 218 ++
.../appfram/navigator/WXNavigatorModule.java | 82 +-
.../com/taobao/weex/bridge/WXBridgeManager.java | 68 +-
.../com/taobao/weex/bridge/WXModuleManager.java | 29 +-
.../taobao/weex/bridge/WXServiceManager.java | 31 +-
.../taobao/weex/common/WXJSExceptionInfo.java | 331 ++
.../com/taobao/weex/common/WXJSService.java | 229 ++
.../com/taobao/weex/http/WXStreamModule.java | 2 +-
.../java/com/taobao/weex/ui/component/WXA.java | 10 +-
.../taobao/weex/ui/component/WXComponent.java | 3 +-
.../com/taobao/weex/ui/component/WXImage.java | 14 +-
.../weex/ui/component/WXSliderNeighbor.java | 70 +-
.../main/java/com/taobao/weex/utils/WXHack.java | 527 ---
.../java/com/taobao/weex/utils/WXUtils.java | 200 +-
.../java/com/taobao/weex/utils/WXViewUtils.java | 8 +-
.../java/com/taobao/weex/utils/WXUtilsTest.java | 125 +-
doc/advanced/extend-to-android.md | 175 +
doc/package.json | 5 +-
doc/source/cn/guide/intro/app-architecture.md | 34 +-
doc/source/cn/guide/intro/devtools.md | 99 +
doc/source/cn/guide/intro/how-it-works.md | 38 +-
doc/source/cn/guide/intro/page-architecture.md | 18 +-
doc/source/cn/guide/intro/using-vue.md | 79 +-
doc/source/cn/guide/intro/web-dev-experience.md | 20 +-
.../cn/references/advanced/extend-to-android.md | 26 +
.../cn/references/advanced/extend-to-ios.md | 45 +-
doc/source/cn/references/common-style.md | 157 +
doc/source/cn/references/components/image.md | 4 +-
doc/source/cn/references/components/input.md | 11 +-
doc/source/cn/references/components/textarea.md | 7 +
.../cn/v-0.10/advanced/extend-to-android.md | 27 +-
doc/source/cn/v-0.10/advanced/extend-to-ios.md | 154 +-
doc/source/guide/intro/app-architecture.md | 57 +-
doc/source/guide/intro/devtools.md | 100 +
doc/source/guide/intro/how-it-works.md | 62 +-
doc/source/guide/intro/index.md | 4 +-
doc/source/guide/intro/page-architecture.md | 42 +-
doc/source/guide/intro/using-vue.md | 52 +-
doc/source/guide/intro/web-dev-experience.md | 29 +-
doc/source/guide/intro/write-once.md | 19 +-
doc/source/references/advanced/extend-jsfm.md | 2 +-
.../references/advanced/extend-to-android.md | 29 +-
.../references/advanced/extend-to-html5.md | 2 +-
doc/source/references/advanced/extend-to-ios.md | 80 +-
doc/source/references/advanced/index.md | 2 +-
.../advanced/integrate-devtool-to-android.md | 2 +-
.../advanced/integrate-devtool-to-ios.md | 2 +-
doc/source/references/common-style.md | 159 +
doc/source/references/components/cell.md | 6 +-
doc/source/references/components/image.md | 3 +-
doc/source/references/components/input.md | 7 +
doc/source/references/components/textarea.md | 7 +
doc/source/references/gesture.md | 9 +-
doc/source/references/js-service/index.md | 114 +
doc/source/references/vue/difference-of-vuex.md | 2 +-
.../references/vue/difference-with-web.md | 2 +-
doc/source/references/vue/index.md | 2 +-
doc/source/v-0.10/advanced/extend-to-android.md | 57 +-
doc/source/v-0.10/advanced/extend-to-ios.md | 39 +
examples/index.we | 1 +
examples/linear-gradient.we | 70 +
examples/vue/components/waterfall.vue | 455 +++
examples/vue/index.vue | 1 +
html5/frameworks/legacy/app/ctrl/init.js | 2 -
html5/frameworks/legacy/app/ctrl/misc.js | 55 +-
html5/frameworks/legacy/app/instance.js | 14 +-
html5/frameworks/legacy/static/create.js | 6 +-
html5/runtime/config.js | 4 +-
html5/runtime/init.js | 4 -
html5/runtime/task-center.js | 57 +
html5/services/amd/index.js | 18 +-
html5/test/case/prepare.js | 6 +-
html5/test/case/tester.js | 48 +-
html5/test/unit/default/app/ctrl.js | 14 +-
html5/test/unit/default/app/index.js | 28 +-
.../WeexDemo.xcodeproj/project.pbxproj | 11 +-
.../AppIcon.appiconset/Icon-29.png | Bin 1682 -> 1614 bytes
.../AppIcon.appiconset/Icon-29@2x-1.png | Bin 2709 -> 2421 bytes
.../AppIcon.appiconset/Icon-29@2x.png | Bin 2709 -> 2421 bytes
.../AppIcon.appiconset/Icon-29@3x.png | Bin 3724 -> 3236 bytes
.../AppIcon.appiconset/Icon-40.png | Bin 2018 -> 1946 bytes
.../AppIcon.appiconset/Icon-40@2x-1.png | Bin 3368 -> 3016 bytes
.../AppIcon.appiconset/Icon-40@2x.png | Bin 3368 -> 3016 bytes
.../AppIcon.appiconset/Icon-40@3x.png | Bin 4715 -> 4172 bytes
.../AppIcon.appiconset/Icon-60@2x.png | Bin 4715 -> 4172 bytes
.../AppIcon.appiconset/Icon-60@3x.png | Bin 6892 -> 6017 bytes
.../AppIcon.appiconset/Icon-76.png | Bin 3324 -> 2918 bytes
.../AppIcon.appiconset/Icon-76@2x.png | Bin 5937 -> 5088 bytes
.../AppIcon.appiconset/Icon-83.5@2x.png | Bin 6942 -> 5537 bytes
ios/playground/WeexDemo/DemoDefine.h | 2 +-
ios/playground/WeexDemo/Info.plist | 11 +-
ios/playground/WeexDemo/UIView+UIThreadCheck.m | 2 +-
ios/playground/WeexDemo/WXDemoViewController.m | 3 +-
ios/playground/bundlejs/animation.js | 3 +-
ios/playground/bundlejs/component/a-demo.js | 3 +-
.../bundlejs/component/countdown-demo.js | 3 +-
ios/playground/bundlejs/component/image-demo.js | 3 +-
ios/playground/bundlejs/component/input-demo.js | 3 +-
.../bundlejs/component/list/list-demo.js | 3 +-
.../bundlejs/component/marquee-demo.js | 3 +-
.../bundlejs/component/navigator-demo.js | 8 +-
.../bundlejs/component/process-bar-demo.js | 3 +-
.../bundlejs/component/scroller-demo.js | 3 +-
.../bundlejs/component/slider-neighbor/index.js | 264 ++
.../slider-neighbor/silder-neighbor.js | 287 --
.../bundlejs/component/slider/index.js | 36 +-
.../bundlejs/component/tabbar/tabbar-demo.js | 5 +-
ios/playground/bundlejs/component/text-demo.js | 111 +-
ios/playground/bundlejs/component/video-demo.js | 3 +-
ios/playground/bundlejs/component/web-demo.js | 11 +-
ios/playground/bundlejs/error.js | 3 +-
ios/playground/bundlejs/index.js | 7 +-
ios/playground/bundlejs/linear-gradient.js | 367 ++
ios/playground/bundlejs/module/clipboard.js | 20 +-
ios/playground/bundlejs/module/componentRect.js | 563 +++
ios/playground/bundlejs/module/instance-api.js | 18 +-
ios/playground/bundlejs/module/modal.js | 22 +-
ios/playground/bundlejs/module/picker-demo.js | 22 +-
ios/playground/bundlejs/module/storage-demo.js | 18 +-
ios/playground/bundlejs/module/stream-demo.js | 22 +-
.../bundlejs/module/websocket-demo.js | 2409 +++++++++++++
ios/playground/bundlejs/showcase/calculator.js | 25 +-
.../bundlejs/showcase/dropdown/dropdown-demo.js | 30 +-
.../bundlejs/showcase/dropdown/we-dropdown.js | 12 +-
ios/playground/bundlejs/showcase/minesweeper.js | 18 +-
.../bundlejs/showcase/new-fashion/banner.js | 8 +-
.../bundlejs/showcase/new-fashion/banners.js | 20 +-
.../bundlejs/showcase/new-fashion/brand.js | 36 +-
.../bundlejs/showcase/new-fashion/category.js | 24 +-
.../bundlejs/showcase/new-fashion/coupon.js | 12 +-
.../bundlejs/showcase/new-fashion/fashion.js | 38 +-
.../bundlejs/showcase/new-fashion/goods.js | 24 +-
.../bundlejs/showcase/new-fashion/headlines.js | 48 +-
.../bundlejs/showcase/new-fashion/image-demo.js | 3 +-
.../bundlejs/showcase/new-fashion/index.js | 27 +-
.../bundlejs/showcase/new-fashion/link.js | 8 +-
.../showcase/new-fashion/list/list-demo.js | 3 +-
.../bundlejs/showcase/new-fashion/main.js | 213 +-
.../bundlejs/showcase/new-fashion/match.js | 24 +-
.../bundlejs/showcase/new-fashion/resource.js | 38 +-
.../bundlejs/showcase/new-fashion/scene.js | 24 +-
.../bundlejs/showcase/pseudo-class.js | 2422 +++++++++++++
ios/playground/bundlejs/showcase/ui.js | 28 +-
ios/playground/bundlejs/style/index.js | 80 +-
ios/playground/bundlejs/style/style-box.js | 44 +-
ios/playground/bundlejs/style/style-flex.js | 52 +-
ios/playground/bundlejs/style/style-item.js | 12 +-
ios/playground/bundlejs/syntax/hello-world-1.js | 4 +-
ios/playground/bundlejs/syntax/hello-world-2.js | 6 +-
ios/playground/bundlejs/syntax/hello-world-3.js | 10 +-
ios/playground/bundlejs/syntax/hello-world-4.js | 14 +-
ios/playground/bundlejs/syntax/hello-world-5.js | 14 +-
ios/playground/bundlejs/syntax/hello-world.js | 14 +-
ios/playground/bundlejs/syntax/index.js | 28 +-
.../bundlejs/syntax/script-component.js | 24 +-
ios/playground/bundlejs/syntax/script-data.js | 12 +-
ios/playground/bundlejs/syntax/script-events.js | 12 +-
.../bundlejs/syntax/script-instance.js | 12 +-
.../bundlejs/syntax/script-lifecycle.js | 12 +-
ios/playground/bundlejs/syntax/script-module.js | 12 +-
.../bundlejs/syntax/script-options.js | 12 +-
.../bundlejs/syntax/template-class.js | 12 +-
.../bundlejs/syntax/template-content.js | 20 +-
.../bundlejs/syntax/template-event.js | 12 +-
ios/playground/bundlejs/syntax/template-if.js | 12 +-
.../bundlejs/syntax/template-repeat-update.js | 12 +-
.../bundlejs/syntax/template-repeat.js | 12 +-
.../bundlejs/syntax/template-style.js | 8 +-
ios/playground/bundlejs/template.js | 15 +-
ios/playground/bundlejs/test.js | 128 +
ios/playground/bundlejs/vue/animation.js | 709 ++++
ios/playground/bundlejs/vue/components/a.js | 438 +++
.../bundlejs/vue/components/countdown.js | 640 ++++
ios/playground/bundlejs/vue/components/image.js | 641 ++++
ios/playground/bundlejs/vue/components/input.js | 364 ++
ios/playground/bundlejs/vue/components/list.js | 246 ++
.../bundlejs/vue/components/marquee.js | 534 +++
.../bundlejs/vue/components/navigator.js | 1059 ++++++
.../bundlejs/vue/components/scroller.js | 304 ++
.../bundlejs/vue/components/slider.js | 898 +++++
.../bundlejs/vue/components/tabbar.js | 599 ++++
ios/playground/bundlejs/vue/components/text.js | 513 +++
ios/playground/bundlejs/vue/components/video.js | 396 +++
ios/playground/bundlejs/vue/components/web.js | 459 +++
ios/playground/bundlejs/vue/hello.js | 99 +
ios/playground/bundlejs/vue/iconfont.js | 204 ++
ios/playground/bundlejs/vue/index.js | 496 +++
.../bundlejs/vue/modules/clipboard.js | 691 ++++
.../bundlejs/vue/modules/instance-api.js | 304 ++
ios/playground/bundlejs/vue/modules/modal.js | 581 +++
ios/playground/bundlejs/vue/modules/storage.js | 381 ++
ios/playground/bundlejs/vue/modules/stream.js | 477 +++
.../bundlejs/vue/showcase/calculator.js | 340 ++
.../bundlejs/vue/showcase/itemlist.js | 1062 ++++++
.../bundlejs/vue/showcase/new-fashion.js | 3302 ++++++++++++++++++
.../bundlejs/vue/showcase/progress.js | 336 ++
ios/playground/bundlejs/vue/style/index.js | 1566 +++++++++
ios/playground/bundlejs/vue/style/style-box.js | 780 +++++
ios/playground/bundlejs/vue/style/style-flex.js | 919 +++++
ios/playground/bundlejs/vue/style/style-item.js | 155 +
.../bundlejs/vue/syntax/hello-world-1.js | 95 +
.../bundlejs/vue/syntax/hello-world-2.js | 112 +
.../bundlejs/vue/syntax/hello-world-3.js | 127 +
.../bundlejs/vue/syntax/hello-world-4.js | 167 +
.../bundlejs/vue/syntax/hello-world-5.js | 173 +
.../bundlejs/vue/syntax/hello-world.js | 183 +
.../bundlejs/vue/syntax/script-component.js | 224 ++
.../bundlejs/vue/syntax/script-data.js | 214 ++
.../bundlejs/vue/syntax/script-events.js | 161 +
.../bundlejs/vue/syntax/script-instance.js | 196 ++
.../bundlejs/vue/syntax/script-lifecycle.js | 155 +
.../bundlejs/vue/syntax/script-module.js | 156 +
.../bundlejs/vue/syntax/script-options.js | 182 +
.../bundlejs/vue/syntax/template-class.js | 161 +
.../bundlejs/vue/syntax/template-content.js | 189 +
.../bundlejs/vue/syntax/template-event.js | 197 ++
.../bundlejs/vue/syntax/template-if.js | 165 +
.../vue/syntax/template-repeat-update.js | 195 ++
.../bundlejs/vue/syntax/template-repeat.js | 170 +
.../bundlejs/vue/syntax/template-style.js | 144 +
ios/playground/bundlejs/vue/template.js | 796 +++++
ios/sdk/WeexSDK.podspec | 2 +-
ios/sdk/WeexSDK.xcodeproj/project.pbxproj | 99 +-
ios/sdk/WeexSDK/Sources/Bridge/WXJSCoreBridge.m | 8 +
.../Component/Recycler/WXMultiColumnLayout.h | 42 +
.../Component/Recycler/WXMultiColumnLayout.m | 385 ++
.../Component/Recycler/WXRecyclerComponent.h | 12 +
.../Component/Recycler/WXRecyclerComponent.m | 525 +++
.../Recycler/WXRecyclerDataController.h | 34 +
.../Recycler/WXRecyclerDataController.m | 114 +
.../Recycler/WXRecyclerUpdateController.h | 32 +
.../Recycler/WXRecyclerUpdateController.m | 239 ++
.../Recycler/WXSectionDataController.h | 33 +
.../Recycler/WXSectionDataController.m | 81 +
.../WeexSDK/Sources/Component/WXCellComponent.h | 22 +-
.../WeexSDK/Sources/Component/WXCellComponent.m | 27 +-
.../Component/WXComponent+GradientColor.h | 15 +-
.../Component/WXComponent+GradientColor.m | 15 +-
.../Sources/Component/WXComponent_internal.h | 3 +
.../WeexSDK/Sources/Component/WXEditComponent.h | 21 +
.../WeexSDK/Sources/Component/WXEditComponent.m | 761 ++++
.../Sources/Component/WXFooterComponent.h | 13 +
.../Sources/Component/WXFooterComponent.m | 13 +
.../Sources/Component/WXHeaderComponent.h | 27 +
.../Sources/Component/WXHeaderComponent.m | 68 +
.../WeexSDK/Sources/Component/WXListComponent.h | 12 -
.../WeexSDK/Sources/Component/WXListComponent.m | 69 +-
.../Sources/Component/WXSliderComponent.m | 35 +-
.../Sources/Component/WXTextAreaComponent.h | 5 +-
.../Sources/Component/WXTextAreaComponent.m | 609 +---
.../Sources/Component/WXTextInputComponent.h | 8 +-
.../Sources/Component/WXTextInputComponent.m | 605 +---
ios/sdk/WeexSDK/Sources/Component/WXTransform.m | 18 +-
.../Sources/Display/WXComponent+BoxShadow.h | 37 +
.../Sources/Display/WXComponent+BoxShadow.m | 91 +
ios/sdk/WeexSDK/Sources/Display/WXInnerLayer.h | 19 +
ios/sdk/WeexSDK/Sources/Display/WXInnerLayer.m | 87 +
ios/sdk/WeexSDK/Sources/Engine/WXSDKEngine.m | 22 +-
.../WeexSDK/Sources/Layout/WXComponent+Layout.m | 4 +
ios/sdk/WeexSDK/Sources/Model/WXComponent.m | 11 +-
.../WeexSDK/Sources/Module/WXAnimationModule.m | 13 +-
ios/sdk/WeexSDK/Sources/Module/WXMetaModule.m | 4 +-
ios/sdk/WeexSDK/Sources/Utility/WXBoxShadow.h | 31 +
ios/sdk/WeexSDK/Sources/Utility/WXBoxShadow.m | 108 +
ios/sdk/WeexSDK/Sources/Utility/WXConvert.h | 5 +
ios/sdk/WeexSDK/Sources/Utility/WXConvert.m | 45 +
ios/sdk/WeexSDK/Sources/Utility/WXDiffUtil.h | 38 +
ios/sdk/WeexSDK/Sources/Utility/WXDiffUtil.m | 186 +
ios/sdk/WeexSDK/Sources/Utility/WXLength.h | 13 +-
ios/sdk/WeexSDK/Sources/Utility/WXLength.m | 45 +-
ios/sdk/WeexSDK/Sources/Utility/WXUtility.m | 12 +-
.../Sources/View/WXComponent+ViewManagement.m | 15 +
package.json | 6 +-
test/run.sh | 2 +-
test/scripts/components/scroll-event.test.js | 32 +-
test/scripts/dom.test.js | 14 +-
test/scripts/index.test.js | 14 +-
test/scripts/util.js | 24 +
289 files changed, 37990 insertions(+), 3222 deletions(-)
----------------------------------------------------------------------
[13/25] incubator-weex git commit: * [ios] support cell move and
remove and reload
Posted by cx...@apache.org.
* [ios] support cell move and remove and reload
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/0ce0cb50
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/0ce0cb50
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/0ce0cb50
Branch: refs/heads/0.11-dev-recycler
Commit: 0ce0cb50166e220058696e52a70cfeb6455cae86
Parents: 4c8127c
Author: \u9690\u98ce <cx...@gmail.com>
Authored: Fri Feb 24 14:42:58 2017 +0800
Committer: \u9690\u98ce <cx...@gmail.com>
Committed: Fri Feb 24 14:42:58 2017 +0800
----------------------------------------------------------------------
examples/vue/components/waterfall.vue | 47 +++++++++++++++-----
.../Component/Recycler/WXRecyclerComponent.m | 35 ++++++++++-----
.../Recycler/WXRecyclerDataController.m | 2 -
.../Recycler/WXRecyclerUpdateController.h | 3 ++
.../Recycler/WXRecyclerUpdateController.m | 22 +++++++--
.../Recycler/WXSectionDataController.h | 3 +-
.../Recycler/WXSectionDataController.m | 6 +--
.../WeexSDK/Sources/Component/WXCellComponent.h | 5 ++-
.../WeexSDK/Sources/Component/WXCellComponent.m | 12 +++--
.../Sources/Component/WXHeaderComponent.h | 6 ++-
.../Sources/Component/WXHeaderComponent.m | 8 +++-
.../WeexSDK/Sources/Component/WXListComponent.m | 2 +-
ios/sdk/WeexSDK/Sources/Model/WXComponent.m | 2 +-
ios/sdk/WeexSDK/Sources/Utility/WXDiffUtil.h | 8 +++-
ios/sdk/WeexSDK/Sources/Utility/WXDiffUtil.m | 25 ++++++++++-
15 files changed, 140 insertions(+), 46 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/0ce0cb50/examples/vue/components/waterfall.vue
----------------------------------------------------------------------
diff --git a/examples/vue/components/waterfall.vue b/examples/vue/components/waterfall.vue
index fe6cd91..ac34919 100644
--- a/examples/vue/components/waterfall.vue
+++ b/examples/vue/components/waterfall.vue
@@ -5,7 +5,7 @@
:show-scrollbar="showScrollbar" :scrollable="scrollable"
@scroll="recylerScroll"
>
- <header class="header" ref="header">
+ <header class="header" ref="header" v-if="showHeader">
<image class="banner" src="https://gw.alicdn.com/tps/TB1ESN1PFXXXXX1apXXXXXXXXXX-1000-600.jpg" resize="cover">
<div class="bannerInfo">
<image class="avatar" src="https://gw.alicdn.com/tps/TB1EP9bPFXXXXbpXVXXXXXXXXXX-150-110.jpg" resize="cover"></image>
@@ -19,7 +19,7 @@
</div>
</image>
</header>
- <header class="stickyHeader">
+ <header class="stickyHeader" @click="showOrRemoveHeader">
<div v-if="stickyHeaderType === 'none'" class="stickyWrapper">
<text class="stickyText">Sticky Header</text>
</div>
@@ -37,8 +37,8 @@
<text class="stickyText">Content Offset:{{contentOffset}}</text>
</div>
</header>
- <cell v-for="item in items" class="cell">
- <div class="item" @click="onItemclick(item.behaviour)" @appear="itemAppear(item.src)" @disappear="itemDisappear(item.src)">
+ <cell v-for="(item, index) in items" :key="item.src" class="cell">
+ <div class="item" @click="onItemclick(item.behaviour, index)" @appear="itemAppear(item.src)" @disappear="itemDisappear(item.src)">
<text v-if="item.name" class="itemName">{{item.name}}</text>
<image class="itemPhoto" :src="item.src"></image>
<text v-if="item.desc" class="itemDesc">{{item.desc}}</text>
@@ -257,17 +257,19 @@
},
{
src:'https://gw.alicdn.com/tps/TB1ux2vPFXXXXbkXXXXXXXXXXXX-240-240.jpg',
- behaviourName: 'listen scroll',
- behaviour: 'listenScroll',
+ behaviourName: 'Remove cell',
+ behaviour: 'removeCell',
},
{
- src:'https://gw.alicdn.com/tps/TB1tCCWPFXXXXa7aXXXXXXXXXXX-240-240.jpg'
+ src:'https://gw.alicdn.com/tps/TB1tCCWPFXXXXa7aXXXXXXXXXXX-240-240.jpg',
+ behaviourName: 'Move cell',
+ behaviour: 'moveCell',
}
]
let repeatItems = [];
- for (let i = 0; i < 5; i++) {
- repeatItems.push(...items);
+ for (let i = 0; i < 3; i++) {
+ repeatItems.push(...items)
}
return {
@@ -276,6 +278,7 @@
columnGap: 12,
columnWidth: 'auto',
contentOffset: '0',
+ showHeader: true,
showScrollbar: false,
scrollable: true,
showStickyHeader: false,
@@ -300,8 +303,11 @@
recylerScroll: function(e) {
this.contentOffset = e.contentOffset.y
},
- onItemclick: function (behaviour) {
- console.log(`click...${behaviour}`)
+ showOrRemoveHeader: function() {
+ this.showHeader = !this.showHeader
+ },
+ onItemclick: function (behaviour, index) {
+ console.log(`click...${behaviour} at index ${index}`)
switch (behaviour) {
case 'changeColumnCount':
this.changeColumnCount()
@@ -326,6 +332,13 @@
break
case 'listenScroll':
this.listenScrollEvent()
+ break
+ case 'removeCell':
+ this.removeCell(index)
+ break
+ case 'moveCell':
+ this.moveCell(index)
+ break
}
},
@@ -383,6 +396,18 @@
setRecyclerPadding: function() {
this.padding = (this.padding == 0 ? 12 : 0);
+ },
+
+ removeCell: function(index) {
+ this.items.splice(index, 1)
+ },
+
+ moveCell: function(index) {
+ if (index == 0) {
+ this.items.splice(this.items.length - 1, 0, this.items.splice(index, 1)[0]);
+ } else {
+ this.items.splice(0, 0, this.items.splice(index, 1)[0]);
+ }
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/0ce0cb50/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerComponent.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerComponent.m b/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerComponent.m
index d7e1fac..7dffe8c 100644
--- a/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerComponent.m
+++ b/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerComponent.m
@@ -214,6 +214,8 @@ typedef enum : NSUInteger {
{
WXAssertMainThread();
+ //TODO: support completion
+
if (![self isViewLoaded]) {
completion(NO);
}
@@ -261,7 +263,9 @@ typedef enum : NSUInteger {
- (void)updateController:(WXRecyclerUpdateController *)controller willPerformUpdateWithNewData:(NSArray<WXSectionDataController *> *)newData
{
- [self.dataController updateData:newData];
+ if (newData) {
+ [self.dataController updateData:newData];
+ }
}
- (void)updateController:(WXRecyclerUpdateController *)controller didPerformUpdateWithFinished:(BOOL)finished
@@ -370,7 +374,7 @@ typedef enum : NSUInteger {
#pragma mark - WXHeaderRenderDelegate
-- (float)headerWidthForLayout:(WXHeaderComponent *)cell
+- (float)headerWidthForLayout:(WXHeaderComponent *)header
{
if (_layoutType == WXRecyclerLayoutTypeMultiColumn) {
return ((WXMultiColumnLayout *)_collectionViewlayout).computedHeaderWidth;
@@ -379,16 +383,25 @@ typedef enum : NSUInteger {
return 0.0;
}
-- (void)headerDidLayout:(WXHeaderComponent *)cell
+- (void)headerDidLayout:(WXHeaderComponent *)header
{
WXPerformBlockOnMainThread(^{
[self.collectionView.collectionViewLayout invalidateLayout];
});
}
+- (void)headerDidRemove:(WXHeaderComponent *)header
+{
+ WXPerformBlockOnMainThread(^{
+ [self performUpdatesWithCompletion:^(BOOL finished) {
+
+ }];
+ });
+}
+
#pragma mark - WXCellRenderDelegate
-- (float)cellWidthForLayout:(WXCellComponent *)cell
+- (float)containerWidthForLayout:(WXCellComponent *)cell
{
if (_layoutType == WXRecyclerLayoutTypeMultiColumn) {
return ((WXMultiColumnLayout *)_collectionViewlayout).computedColumnWidth;
@@ -399,11 +412,15 @@ typedef enum : NSUInteger {
- (void)cellDidLayout:(WXCellComponent *)cell
{
+ BOOL previousLayoutComplete = cell.isLayoutComplete;
cell.isLayoutComplete = YES;
WXPerformBlockOnMainThread(^{
- [self.collectionView.collectionViewLayout invalidateLayout];
- [self performUpdatesWithCompletion:^(BOOL finished) {
- }];
+ if (previousLayoutComplete) {
+ [self.updateController reloadItemsAtIndexPath:[self.dataController indexPathForCell:cell]];
+ } else {
+ [self performUpdatesWithCompletion:^(BOOL finished) {
+ }];
+ }
});
}
@@ -416,7 +433,6 @@ typedef enum : NSUInteger {
{
if (cell.isLayoutComplete) {
WXPerformBlockOnMainThread(^{
- [self.collectionView.collectionViewLayout invalidateLayout];
[self performUpdatesWithCompletion:^(BOOL finished) {
}];
});
@@ -427,7 +443,6 @@ typedef enum : NSUInteger {
{
if (cell.isLayoutComplete) {
WXPerformBlockOnMainThread(^{
- [self.collectionView.collectionViewLayout invalidateLayout];
[self performUpdatesWithCompletion:^(BOOL finished) {
}];
});
@@ -499,7 +514,7 @@ typedef enum : NSUInteger {
}
if (i == components.count - 1 && cellArray.count > 0) {
- currentSection.cellComponents = cellArray;
+ currentSection.cellComponents = [cellArray copy];
[sectionArray addObject:currentSection];
}
}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/0ce0cb50/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerDataController.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerDataController.m b/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerDataController.m
index c75987c..aa5732d 100644
--- a/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerDataController.m
+++ b/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerDataController.m
@@ -14,8 +14,6 @@
@interface WXRecyclerDataController ()
@property (nonatomic, strong, readwrite) NSArray<WXSectionDataController *> *sections;
-@property (nonatomic, strong, readonly) NSMapTable<WXSectionDataController *, NSNumber *> *sectionControllerToSectionIndexTable;
-@property (nonatomic, strong, readonly) NSMapTable<NSNumber *, WXSectionDataController *> *sectionToSectionControllerIndexTable;
@property (nonatomic, strong, readonly) NSMapTable<WXCellComponent *, NSIndexPath*> *cellToIndexPathTable;
@end
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/0ce0cb50/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerUpdateController.h
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerUpdateController.h b/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerUpdateController.h
index c015c09..e376c19 100644
--- a/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerUpdateController.h
+++ b/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerUpdateController.h
@@ -25,5 +25,8 @@
- (void)performUpdatesWithNewData:(NSArray<WXSectionDataController *> *)newData
oldData:(NSArray<WXSectionDataController *> *)oldData
view:(UICollectionView *)collectionView;
+
+- (void)reloadItemsAtIndexPath:(NSIndexPath *)indexPath;
+
@end
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/0ce0cb50/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerUpdateController.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerUpdateController.m b/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerUpdateController.m
index ae521ea..17090b0 100644
--- a/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerUpdateController.m
+++ b/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerUpdateController.m
@@ -65,6 +65,7 @@
@property (nonatomic, copy) NSArray<WXSectionDataController *> *theNewData;
@property (nonatomic, copy) NSArray<WXSectionDataController *> *theOldData;
@property (nonatomic, weak) UICollectionView *collectionView;
+@property (nonatomic, strong) NSMutableSet<NSIndexPath *> *reloadIndexPaths;
@property (nonatomic, assign) BOOL isUpdating;
@end
@@ -84,10 +85,21 @@
[self checkUpdates];
}
+- (void)reloadItemsAtIndexPath:(NSIndexPath *)indexPath
+{
+ if (!_reloadIndexPaths) {
+ _reloadIndexPaths = [NSMutableSet set];
+ }
+
+ [_reloadIndexPaths addObject:indexPath];
+
+ [self checkUpdates];
+}
+
- (void)checkUpdates
{
dispatch_async(dispatch_get_main_queue(), ^{
- if (self.isUpdating || (!self.theOldData && !self.theNewData)) {
+ if (self.isUpdating) {
return ;
}
@@ -111,7 +123,7 @@
[self cleanup];
WXRecyclerDiffResult *diffResult = [self diffWithNewData:newData oldData:oldData];
- if (![diffResult hasChanges]) {
+ if (![diffResult hasChanges] && self.reloadIndexPaths.count == 0) {
return;
}
@@ -125,6 +137,7 @@
[UIView setAnimationsEnabled:YES];
self.isUpdating = NO;
[self.delegate updateController:self didPerformUpdateWithFinished:finished];
+ [self.reloadIndexPaths removeAllObjects];
[self checkUpdates];
};
@@ -213,7 +226,10 @@
[collectionView deleteItemsAtIndexPaths:[diffResult.deleteIndexPaths allObjects]];
[collectionView insertItemsAtIndexPaths:[diffResult.insertIndexPaths allObjects]];
- [collectionView reloadItemsAtIndexPaths:[diffResult.reloadIndexPaths allObjects]];
+
+ NSSet *reloadIndexPaths = self.reloadIndexPaths ? [diffResult.reloadIndexPaths setByAddingObjectsFromSet:self.reloadIndexPaths] : diffResult.reloadIndexPaths;
+
+ [collectionView reloadItemsAtIndexPaths:[reloadIndexPaths allObjects]];
[collectionView deleteSections:diffResult.deleteSections];
[collectionView insertSections:diffResult.insertSections];
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/0ce0cb50/ios/sdk/WeexSDK/Sources/Component/Recycler/WXSectionDataController.h
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/Recycler/WXSectionDataController.h b/ios/sdk/WeexSDK/Sources/Component/Recycler/WXSectionDataController.h
index d6fe7d6..ae257b3 100644
--- a/ios/sdk/WeexSDK/Sources/Component/Recycler/WXSectionDataController.h
+++ b/ios/sdk/WeexSDK/Sources/Component/Recycler/WXSectionDataController.h
@@ -7,11 +7,12 @@
*/
#import <Foundation/Foundation.h>
+#import "WXDiffUtil.h"
@class WXComponent;
@class WXCellComponent;
@class WXHeaderComponent;
-@interface WXSectionDataController : NSObject
+@interface WXSectionDataController : NSObject <WXDiffable>
@property (nonatomic, strong) NSArray<WXCellComponent *> *cellComponents;
@property (nonatomic, strong) WXHeaderComponent *headerComponent;
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/0ce0cb50/ios/sdk/WeexSDK/Sources/Component/Recycler/WXSectionDataController.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/Recycler/WXSectionDataController.m b/ios/sdk/WeexSDK/Sources/Component/Recycler/WXSectionDataController.m
index c4270d7..8aaa031 100644
--- a/ios/sdk/WeexSDK/Sources/Component/Recycler/WXSectionDataController.m
+++ b/ios/sdk/WeexSDK/Sources/Component/Recycler/WXSectionDataController.m
@@ -11,10 +11,6 @@
#import "WXHeaderComponent.h"
#import "WXAssert.h"
-@interface WXSectionDataController ()
-
-@end
-
@implementation WXSectionDataController
- (NSInteger)numberOfItems
@@ -58,7 +54,7 @@
return [super hash];
}
-- (BOOL)isEqual:(id)object
+- (BOOL)isEqualToWXObject:(id<WXDiffable>)object
{
if ([object isKindOfClass:[WXSectionDataController class]]) {
WXSectionDataController *controller = (WXSectionDataController *)object;
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/0ce0cb50/ios/sdk/WeexSDK/Sources/Component/WXCellComponent.h
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/WXCellComponent.h b/ios/sdk/WeexSDK/Sources/Component/WXCellComponent.h
index 29aa1c6..d3358fd 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXCellComponent.h
+++ b/ios/sdk/WeexSDK/Sources/Component/WXCellComponent.h
@@ -7,11 +7,12 @@
*/
#import "WXComponent.h"
+#import "WXDiffUtil.h"
@class WXCellComponent;
@protocol WXCellRenderDelegate <NSObject>
-- (float)cellWidthForLayout:(WXCellComponent *)cell;
+- (float)containerWidthForLayout:(WXCellComponent *)cell;
- (void)cellDidLayout:(WXCellComponent *)cell;
@@ -23,7 +24,7 @@
@end
-@interface WXCellComponent : WXComponent
+@interface WXCellComponent : WXComponent <WXDiffable>
@property (nonatomic, strong) NSString *scope;
@property (nonatomic, assign) BOOL isRecycle;
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/0ce0cb50/ios/sdk/WeexSDK/Sources/Component/WXCellComponent.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/WXCellComponent.m b/ios/sdk/WeexSDK/Sources/Component/WXCellComponent.m
index 593628a..652754e 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXCellComponent.m
+++ b/ios/sdk/WeexSDK/Sources/Component/WXCellComponent.m
@@ -11,6 +11,11 @@
#import "WXCellComponent.h"
#import "WXListComponent.h"
#import "WXComponent_internal.h"
+#import "WXDiffUtil.h"
+
+@interface WXCellComponent ()
+
+@end
@implementation WXCellComponent
{
@@ -39,10 +44,9 @@
}
-- (BOOL)isEqual:(id)object
+- (BOOL)isEqualToWXObject:(id<WXDiffable>)object
{
- WXCellComponent *cell = object;
- return self == cell && self.isLayoutComplete == cell.isLayoutComplete && CGRectEqualToRect(self.calculatedFrame, cell.calculatedFrame);
+ return self == object;
}
- (void)_frameDidCalculated:(BOOL)isChanged
@@ -110,7 +114,7 @@
- (void)_calculateFrameWithSuperAbsolutePosition:(CGPoint)superAbsolutePosition gatherDirtyComponents:(NSMutableSet<WXComponent *> *)dirtyComponents
{
if (self.delegate && (isUndefined(self.cssNode->style.dimensions[CSS_WIDTH]) || _isUseContainerWidth)) {
- self.cssNode->style.dimensions[CSS_WIDTH] = [self.delegate cellWidthForLayout:self];
+ self.cssNode->style.dimensions[CSS_WIDTH] = [self.delegate containerWidthForLayout:self];
//TODO: set _isUseContainerWidth to NO if updateStyles have width
_isUseContainerWidth = YES;
}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/0ce0cb50/ios/sdk/WeexSDK/Sources/Component/WXHeaderComponent.h
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/WXHeaderComponent.h b/ios/sdk/WeexSDK/Sources/Component/WXHeaderComponent.h
index 5aaf616..1ac21cc 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXHeaderComponent.h
+++ b/ios/sdk/WeexSDK/Sources/Component/WXHeaderComponent.h
@@ -11,9 +11,11 @@
@protocol WXHeaderRenderDelegate <NSObject>
-- (float)headerWidthForLayout:(WXHeaderComponent *)cell;
+- (float)headerWidthForLayout:(WXHeaderComponent *)header;
-- (void)headerDidLayout:(WXHeaderComponent *)cell;
+- (void)headerDidLayout:(WXHeaderComponent *)header;
+
+- (void)headerDidRemove:(WXHeaderComponent *)header;
@end
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/0ce0cb50/ios/sdk/WeexSDK/Sources/Component/WXHeaderComponent.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/WXHeaderComponent.m b/ios/sdk/WeexSDK/Sources/Component/WXHeaderComponent.m
index f54938d..33b3040 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXHeaderComponent.m
+++ b/ios/sdk/WeexSDK/Sources/Component/WXHeaderComponent.m
@@ -14,7 +14,6 @@
BOOL _isUseContainerWidth;
}
-//TODO: header remove->need reload
- (instancetype)initWithRef:(NSString *)ref type:(NSString *)type styles:(NSDictionary *)styles attributes:(NSDictionary *)attributes events:(NSArray *)events weexInstance:(WXSDKInstance *)weexInstance
{
self = [super initWithRef:ref type:type styles:styles attributes:attributes events:events weexInstance:weexInstance];
@@ -41,6 +40,13 @@
}
}
+- (void)_removeFromSupercomponent
+{
+ [super _removeFromSupercomponent];
+
+ [self.delegate headerDidRemove:self];
+}
+
- (void)_calculateFrameWithSuperAbsolutePosition:(CGPoint)superAbsolutePosition gatherDirtyComponents:(NSMutableSet<WXComponent *> *)dirtyComponents
{
if (self.delegate && (isUndefined(self.cssNode->style.dimensions[CSS_WIDTH]) || _isUseContainerWidth)) {
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/0ce0cb50/ios/sdk/WeexSDK/Sources/Component/WXListComponent.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/WXListComponent.m b/ios/sdk/WeexSDK/Sources/Component/WXListComponent.m
index 943bcf8..b683f63 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXListComponent.m
+++ b/ios/sdk/WeexSDK/Sources/Component/WXListComponent.m
@@ -268,7 +268,7 @@
#pragma mark - WXCellRenderDelegate
-- (float)cellWidthForLayout:(WXCellComponent *)cell
+- (float)containerWidthForLayout:(WXCellComponent *)cell
{
return self.scrollerCSSNode->style.dimensions[CSS_WIDTH];
}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/0ce0cb50/ios/sdk/WeexSDK/Sources/Model/WXComponent.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Model/WXComponent.m b/ios/sdk/WeexSDK/Sources/Model/WXComponent.m
index 76ca9b0..e10c70d 100644
--- a/ios/sdk/WeexSDK/Sources/Model/WXComponent.m
+++ b/ios/sdk/WeexSDK/Sources/Model/WXComponent.m
@@ -167,7 +167,7 @@
- (NSString *)description
{
- return [NSString stringWithFormat:@"<%@ ref=%@> %@", _type, _ref, _view];
+ return [NSString stringWithFormat:@"<%@:%p ref=%@> %@", _type, self, _ref, _view];
}
#pragma mark Property
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/0ce0cb50/ios/sdk/WeexSDK/Sources/Utility/WXDiffUtil.h
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Utility/WXDiffUtil.h b/ios/sdk/WeexSDK/Sources/Utility/WXDiffUtil.h
index c7edda9..e407469 100644
--- a/ios/sdk/WeexSDK/Sources/Utility/WXDiffUtil.h
+++ b/ios/sdk/WeexSDK/Sources/Utility/WXDiffUtil.h
@@ -8,6 +8,12 @@
#import <Foundation/Foundation.h>
+@protocol WXDiffable <NSObject>
+
+- (BOOL)isEqualToWXObject:(id<WXDiffable>)object;
+
+@end
+
@interface WXDiffUpdateIndex : NSObject
@property (nonatomic, assign, readonly) NSUInteger oldIndex;
@@ -27,6 +33,6 @@
@interface WXDiffUtil : NSObject
-+ (WXDiffResult *)diffWithMinimumDistance:(NSArray *)newArray oldArray:(NSArray *)oldArray;
++ (WXDiffResult *)diffWithMinimumDistance:(NSArray<id<WXDiffable>> *)newArray oldArray:(NSArray<id<WXDiffable>> *)oldArray;
@end
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/0ce0cb50/ios/sdk/WeexSDK/Sources/Utility/WXDiffUtil.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Utility/WXDiffUtil.m b/ios/sdk/WeexSDK/Sources/Utility/WXDiffUtil.m
index 44bd737..01cab02 100644
--- a/ios/sdk/WeexSDK/Sources/Utility/WXDiffUtil.m
+++ b/ios/sdk/WeexSDK/Sources/Utility/WXDiffUtil.m
@@ -7,6 +7,7 @@
*/
#import "WXDiffUtil.h"
+#import "WXLog.h"
typedef enum : NSUInteger {
WXDiffOperationDoNothing,
@@ -59,7 +60,7 @@ typedef enum : NSUInteger {
@implementation WXDiffUtil
-+ (WXDiffResult *)diffWithMinimumDistance:(NSArray *)newArray oldArray:(NSArray *)oldArray
++ (WXDiffResult *)diffWithMinimumDistance:(NSArray<id<WXDiffable>> *)newArray oldArray:(NSArray<id<WXDiffable>> *)oldArray
{
// Using the levenshtein algorithm
// https://en.wikipedia.org/wiki/Levenshtein_distance
@@ -84,7 +85,7 @@ typedef enum : NSUInteger {
for (int oldIndex = 1; oldIndex < oldSize; oldIndex ++) {
for (int newIndex = 1; newIndex < newSize; newIndex ++) {
- if ([oldArray[oldIndex - 1] isEqual:newArray[newIndex - 1]]) {
+ if ([oldArray[oldIndex - 1] isEqualToWXObject:newArray[newIndex - 1]]) {
matrix[oldIndex][newIndex] = matrix[oldIndex - 1][newIndex - 1];
} else {
int updateCost = matrix[oldIndex - 1][newIndex - 1] + 1;
@@ -95,6 +96,8 @@ typedef enum : NSUInteger {
}
}
+ [self _printMatrix:matrix rowSize:oldSize columnSize:newSize];
+
NSMutableArray *updates = [NSMutableArray array];
NSMutableIndexSet *inserts = [NSMutableIndexSet indexSet];
NSMutableIndexSet *deletes = [NSMutableIndexSet indexSet];
@@ -162,4 +165,22 @@ typedef enum : NSUInteger {
return WXDiffOperationDoNothing;
}
++ (void)_printMatrix:(int **)matrix rowSize:(int)rowSize columnSize:(int)columnSize
+{
+ for (int i = 0; i < rowSize; i ++) {
+ NSMutableArray *array = [NSMutableArray array];
+ for (int j = 0; j < columnSize; j ++) {
+ int value = matrix[i][j];
+ NSString *result;
+ if (value < 10) {
+ result = [NSString stringWithFormat:@"0%zi", value];
+ } else {
+ result = [NSString stringWithFormat:@"%zi", value];
+ }
+ [array addObject:result];
+ }
+ WXLogDebug(@"%@", [array componentsJoinedByString:@" "]);
+ }
+}
+
@end
[04/25] incubator-weex git commit: * [android] recycler component
feature
Posted by cx...@apache.org.
* [android] recycler component feature
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/61cfd37e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/61cfd37e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/61cfd37e
Branch: refs/heads/0.11-dev-recycler
Commit: 61cfd37e000595d70ea870538016e3fbbe4df70b
Parents: e2ecfea
Author: zshshr <zh...@gmail.com>
Authored: Thu Feb 23 11:36:58 2017 +0800
Committer: zshshr <zh...@gmail.com>
Committed: Thu Feb 23 11:36:58 2017 +0800
----------------------------------------------------------------------
.../main/java/com/taobao/weex/WXSDKEngine.java | 6 +-
.../java/com/taobao/weex/common/Constants.java | 12 +-
.../main/java/com/taobao/weex/dom/WXAttr.java | 53 +++-
.../java/com/taobao/weex/dom/WXDomHandler.java | 2 +
.../java/com/taobao/weex/dom/WXDomManager.java | 1 +
.../taobao/weex/dom/WXRecyclerDomObject.java | 303 +++++++++++++++++++
.../com/taobao/weex/ui/component/WXHeader.java | 4 +-
.../ui/component/list/BasicListComponent.java | 13 +-
.../weex/ui/component/list/WXListComponent.java | 42 ++-
.../listview/ExtendedLinearLayoutManager.java | 25 ++
.../weex/ui/view/listview/WXRecyclerView.java | 47 +--
.../ui/view/listview/WXSpaceItemDecoration.java | 227 ++++++++++++++
.../listview/WXStaggeredGridLayoutManager.java | 237 +++++++++++++++
.../adapter/WXRecyclerViewOnScrollListener.java | 4 +-
.../refresh/wrapper/BounceRecyclerView.java | 16 +-
15 files changed, 930 insertions(+), 62 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/61cfd37e/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 550ccec..c7a5245 100755
--- a/android/sdk/src/main/java/com/taobao/weex/WXSDKEngine.java
+++ b/android/sdk/src/main/java/com/taobao/weex/WXSDKEngine.java
@@ -142,11 +142,10 @@ import com.taobao.weex.dom.TextAreaEditTextDomObject;
import com.taobao.weex.dom.WXDomObject;
import com.taobao.weex.dom.WXDomRegistry;
import com.taobao.weex.dom.WXListDomObject;
+import com.taobao.weex.dom.WXRecyclerDomObject;
import com.taobao.weex.dom.WXScrollerDomObject;
import com.taobao.weex.dom.WXSwitchDomObject;
import com.taobao.weex.dom.WXTextDomObject;
-import com.taobao.weex.ui.component.list.SimpleListComponent;
-import com.taobao.weex.ui.module.WXModalUIModule;
import com.taobao.weex.http.WXStreamModule;
import com.taobao.weex.ui.ExternalLoaderComponentHolder;
import com.taobao.weex.ui.IExternalComponentGetter;
@@ -175,9 +174,11 @@ import com.taobao.weex.ui.component.WXText;
import com.taobao.weex.ui.component.WXVideo;
import com.taobao.weex.ui.component.WXWeb;
import com.taobao.weex.ui.component.list.HorizontalListComponent;
+import com.taobao.weex.ui.component.list.SimpleListComponent;
import com.taobao.weex.ui.component.list.WXCell;
import com.taobao.weex.ui.component.list.WXListComponent;
import com.taobao.weex.ui.module.WXMetaModule;
+import com.taobao.weex.ui.module.WXModalUIModule;
import com.taobao.weex.ui.module.WXTimerModule;
import com.taobao.weex.ui.module.WXWebViewModule;
import com.taobao.weex.utils.WXLogUtils;
@@ -387,6 +388,7 @@ public class WXSDKEngine {
registerDomObject(WXBasicComponentType.VLIST, WXListDomObject.class);
registerDomObject(WXBasicComponentType.HLIST, WXListDomObject.class);
registerDomObject(WXBasicComponentType.SCROLLER, WXScrollerDomObject.class);
+ registerDomObject(WXBasicComponentType.RECYCLER, WXRecyclerDomObject.class);
} catch (WXException e) {
WXLogUtils.e("[WXSDKEngine] register:", e);
}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/61cfd37e/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 92e3eb6..8b92ca1 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
@@ -294,7 +294,6 @@ public class Constants {
String RESIZE_MODE = "resizeMode";
String SHOW_INDICATORS = "showIndicators";
String AUTO_PLAY = "autoPlay";
- String SHOW_SCROLLBAR = "showScrollbar";
String SCROLL_DIRECTION = "scrollDirection";
String SCOPE = "scope";
String RECYCLE = "recycle";
@@ -302,12 +301,10 @@ 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 SHOW_SCROLLBAR= "showScrollbar";
String OVERFLOW = "overflow";
String TYPE = "type";
String PLACEHOLDER = "placeholder";
@@ -354,12 +351,18 @@ public class Constants {
String RETURN_KEY_TYPE = "returnKeyType";
String OFFSET = "offset";
String ANIMATED = "animated";
+ String AUTO = "auto";
}
public interface Value {
int NAV_BAR_SHOWN = 0;
int NAV_BAR_HIDDEN = 1;
+ int AUTO = -1;
+ int COLUMN_GAP_NORMAL = 32;
+ int COLUMN_COUNT_NORMAL = 1;
+ String MULTI_COLUMN= "multi-column";
+ String GRID= "grid";
String STICKY = "sticky";
String FIXED = "fixed";
String LEFT = "left";
@@ -388,6 +391,7 @@ public class Constants {
String DIRECTION_RIGHT = "right";
String DIRECTION_UP = "up";
String DIRECTION_DOWN = "down";
+
}
public interface Event {
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/61cfd37e/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 6714b0e..73e8393 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,34 +440,69 @@ public class WXAttr implements Map<String, Object>,Cloneable {
return ret;
}
- public int getColumnWidth(){
+ public float getColumnWidth(){
Object obj = get(Constants.Name.COLUMN_WIDTH);
if (obj == null) {
- return 0;
+ return Constants.Value.AUTO;
+ }
+
+ String value = String.valueOf(obj);
+ if(Constants.Name.AUTO.equals(value)){
+ return Constants.Value.AUTO;
}
try {
- return Integer.parseInt(String.valueOf(obj));
+ float columnWidth = Float.parseFloat(value);
+ return columnWidth > 0 ? columnWidth : 0;
} catch (Exception e) {
WXLogUtils.e("[WXAttr] getColumnWidth:", e);
}
- return 0;
+ return Constants.Value.AUTO;
}
public int getColumnCount() {
Object obj = get(Constants.Name.COLUMN_COUNT);
if (obj == null) {
- return 1;
+ return Constants.Value.AUTO;
}
+
+ String value = String.valueOf(obj);
+ if(Constants.Name.AUTO.equals(value)){
+ return Constants.Value.AUTO;
+ }
+
try {
- return Integer.parseInt(String.valueOf(obj));
+ int columnCount = Integer.parseInt(value);
+ return columnCount > 0 ? columnCount : Constants.Value.AUTO;
} catch (Exception e) {
WXLogUtils.e("[WXAttr] getColumnCount:", e);
- return 1;
+ return Constants.Value.AUTO;
}
}
+
+ public float getColumnGap() {
+
+ Object obj = get(Constants.Name.COLUMN_GAP);
+ if (obj == null) {
+ return Constants.Value.COLUMN_GAP_NORMAL;
+ }
+
+ String value = String.valueOf(obj);
+ if (Constants.Name.AUTO.equals(value)) {
+ return Constants.Value.COLUMN_GAP_NORMAL;
+ }
+
+ try {
+ float columnGap = Float.parseFloat(value);
+ return columnGap >= 0 ? columnGap : Constants.Value.AUTO;
+ } catch (Exception e) {
+ WXLogUtils.e("[WXAttr] getColumnGap:", e);
+ }
+ return Constants.Value.COLUMN_GAP_NORMAL;
+ }
+
public int getLayoutType(){
Object obj = get(Constants.Name.LAYOUT);
if (obj == null) {
@@ -476,9 +511,9 @@ public class WXAttr implements Map<String, Object>,Cloneable {
try {
switch(String.valueOf(obj)){
- case Constants.Name.MULTI_COLUMN :
+ case Constants.Value.MULTI_COLUMN :
return WXRecyclerView.TYPE_STAGGERED_GRID_LAYOUT;
- case Constants.Name.GRID :
+ case Constants.Value.GRID :
return WXRecyclerView.TYPE_GRID_LAYOUT;
default:
return WXRecyclerView.TYPE_LINEAR_LAYOUT;
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/61cfd37e/android/sdk/src/main/java/com/taobao/weex/dom/WXDomHandler.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/dom/WXDomHandler.java b/android/sdk/src/main/java/com/taobao/weex/dom/WXDomHandler.java
index dc8495e..987d71b 100755
--- a/android/sdk/src/main/java/com/taobao/weex/dom/WXDomHandler.java
+++ b/android/sdk/src/main/java/com/taobao/weex/dom/WXDomHandler.java
@@ -210,6 +210,7 @@ import android.os.Message;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.taobao.weex.bridge.JSCallback;
+import com.taobao.weex.utils.WXLogUtils;
/**
* Handler for dom operations.
@@ -290,6 +291,7 @@ public class WXDomHandler implements Handler.Callback {
(String) task.args.get(2));
break;
case MsgType.WX_DOM_BATCH:
+
mWXDomManager.batch();
mHasBatch = false;
break;
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/61cfd37e/android/sdk/src/main/java/com/taobao/weex/dom/WXDomManager.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/dom/WXDomManager.java b/android/sdk/src/main/java/com/taobao/weex/dom/WXDomManager.java
index d7ebaa7..6a8f534 100755
--- a/android/sdk/src/main/java/com/taobao/weex/dom/WXDomManager.java
+++ b/android/sdk/src/main/java/com/taobao/weex/dom/WXDomManager.java
@@ -335,6 +335,7 @@ public final class WXDomManager {
* Batch the execution of {@link WXDomStatement}
*/
void batch() {
+
throwIfNotDomThread();
Iterator<Entry<String, WXDomStatement>> iterator = mDomRegistries.entrySet().iterator();
while (iterator.hasNext()) {
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/61cfd37e/android/sdk/src/main/java/com/taobao/weex/dom/WXRecyclerDomObject.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/dom/WXRecyclerDomObject.java b/android/sdk/src/main/java/com/taobao/weex/dom/WXRecyclerDomObject.java
new file mode 100644
index 0000000..b1c0e19
--- /dev/null
+++ b/android/sdk/src/main/java/com/taobao/weex/dom/WXRecyclerDomObject.java
@@ -0,0 +1,303 @@
+/**
+ *
+ * Apache License
+ * Version 2.0, January 2004
+ * http://www.apache.org/licenses/
+ *
+ * TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+ *
+ * 1. Definitions.
+ *
+ * "License" shall mean the terms and conditions for use, reproduction,
+ * and distribution as defined by Sections 1 through 9 of this document.
+ *
+ * "Licensor" shall mean the copyright owner or entity authorized by
+ * the copyright owner that is granting the License.
+ *
+ * "Legal Entity" shall mean the union of the acting entity and all
+ * other entities that control, are controlled by, or are under common
+ * control with that entity. For the purposes of this definition,
+ * "control" means (i) the power, direct or indirect, to cause the
+ * direction or management of such entity, whether by contract or
+ * otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ * outstanding shares, or (iii) beneficial ownership of such entity.
+ *
+ * "You" (or "Your") shall mean an individual or Legal Entity
+ * exercising permissions granted by this License.
+ *
+ * "Source" form shall mean the preferred form for making modifications,
+ * including but not limited to software source code, documentation
+ * source, and configuration files.
+ *
+ * "Object" form shall mean any form resulting from mechanical
+ * transformation or translation of a Source form, including but
+ * not limited to compiled object code, generated documentation,
+ * and conversions to other media types.
+ *
+ * "Work" shall mean the work of authorship, whether in Source or
+ * Object form, made available under the License, as indicated by a
+ * copyright notice that is included in or attached to the work
+ * (an example is provided in the Appendix below).
+ *
+ * "Derivative Works" shall mean any work, whether in Source or Object
+ * form, that is based on (or derived from) the Work and for which the
+ * editorial revisions, annotations, elaborations, or other modifications
+ * represent, as a whole, an original work of authorship. For the purposes
+ * of this License, Derivative Works shall not include works that remain
+ * separable from, or merely link (or bind by name) to the interfaces of,
+ * the Work and Derivative Works thereof.
+ *
+ * "Contribution" shall mean any work of authorship, including
+ * the original version of the Work and any modifications or additions
+ * to that Work or Derivative Works thereof, that is intentionally
+ * submitted to Licensor for inclusion in the Work by the copyright owner
+ * or by an individual or Legal Entity authorized to submit on behalf of
+ * the copyright owner. For the purposes of this definition, "submitted"
+ * means any form of electronic, verbal, or written communication sent
+ * to the Licensor or its representatives, including but not limited to
+ * communication on electronic mailing lists, source code control systems,
+ * and issue tracking systems that are managed by, or on behalf of, the
+ * Licensor for the purpose of discussing and improving the Work, but
+ * excluding communication that is conspicuously marked or otherwise
+ * designated in writing by the copyright owner as "Not a Contribution."
+ *
+ * "Contributor" shall mean Licensor and any individual or Legal Entity
+ * on behalf of whom a Contribution has been received by Licensor and
+ * subsequently incorporated within the Work.
+ *
+ * 2. Grant of Copyright License. Subject to the terms and conditions of
+ * this License, each Contributor hereby grants to You a perpetual,
+ * worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ * copyright license to reproduce, prepare Derivative Works of,
+ * publicly display, publicly perform, sublicense, and distribute the
+ * Work and such Derivative Works in Source or Object form.
+ *
+ * 3. Grant of Patent License. Subject to the terms and conditions of
+ * this License, each Contributor hereby grants to You a perpetual,
+ * worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ * (except as stated in this section) patent license to make, have made,
+ * use, offer to sell, sell, import, and otherwise transfer the Work,
+ * where such license applies only to those patent claims licensable
+ * by such Contributor that are necessarily infringed by their
+ * Contribution(s) alone or by combination of their Contribution(s)
+ * with the Work to which such Contribution(s) was submitted. If You
+ * institute patent litigation against any entity (including a
+ * cross-claim or counterclaim in a lawsuit) alleging that the Work
+ * or a Contribution incorporated within the Work constitutes direct
+ * or contributory patent infringement, then any patent licenses
+ * granted to You under this License for that Work shall terminate
+ * as of the date such litigation is filed.
+ *
+ * 4. Redistribution. You may reproduce and distribute copies of the
+ * Work or Derivative Works thereof in any medium, with or without
+ * modifications, and in Source or Object form, provided that You
+ * meet the following conditions:
+ *
+ * (a) You must give any other recipients of the Work or
+ * Derivative Works a copy of this License; and
+ *
+ * (b) You must cause any modified files to carry prominent notices
+ * stating that You changed the files; and
+ *
+ * (c) You must retain, in the Source form of any Derivative Works
+ * that You distribute, all copyright, patent, trademark, and
+ * attribution notices from the Source form of the Work,
+ * excluding those notices that do not pertain to any part of
+ * the Derivative Works; and
+ *
+ * (d) If the Work includes a "NOTICE" text file as part of its
+ * distribution, then any Derivative Works that You distribute must
+ * include a readable copy of the attribution notices contained
+ * within such NOTICE file, excluding those notices that do not
+ * pertain to any part of the Derivative Works, in at least one
+ * of the following places: within a NOTICE text file distributed
+ * as part of the Derivative Works; within the Source form or
+ * documentation, if provided along with the Derivative Works; or,
+ * within a display generated by the Derivative Works, if and
+ * wherever such third-party notices normally appear. The contents
+ * of the NOTICE file are for informational purposes only and
+ * do not modify the License. You may add Your own attribution
+ * notices within Derivative Works that You distribute, alongside
+ * or as an addendum to the NOTICE text from the Work, provided
+ * that such additional attribution notices cannot be construed
+ * as modifying the License.
+ *
+ * You may add Your own copyright statement to Your modifications and
+ * may provide additional or different license terms and conditions
+ * for use, reproduction, or distribution of Your modifications, or
+ * for any such Derivative Works as a whole, provided Your use,
+ * reproduction, and distribution of the Work otherwise complies with
+ * the conditions stated in this License.
+ *
+ * 5. Submission of Contributions. Unless You explicitly state otherwise,
+ * any Contribution intentionally submitted for inclusion in the Work
+ * by You to the Licensor shall be under the terms and conditions of
+ * this License, without any additional terms or conditions.
+ * Notwithstanding the above, nothing herein shall supersede or modify
+ * the terms of any separate license agreement you may have executed
+ * with Licensor regarding such Contributions.
+ *
+ * 6. Trademarks. This License does not grant permission to use the trade
+ * names, trademarks, service marks, or product names of the Licensor,
+ * except as required for reasonable and customary use in describing the
+ * origin of the Work and reproducing the content of the NOTICE file.
+ *
+ * 7. Disclaimer of Warranty. Unless required by applicable law or
+ * agreed to in writing, Licensor provides the Work (and each
+ * Contributor provides its Contributions) on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied, including, without limitation, any warranties or conditions
+ * of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ * PARTICULAR PURPOSE. You are solely responsible for determining the
+ * appropriateness of using or redistributing the Work and assume any
+ * risks associated with Your exercise of permissions under this License.
+ *
+ * 8. Limitation of Liability. In no event and under no legal theory,
+ * whether in tort (including negligence), contract, or otherwise,
+ * unless required by applicable law (such as deliberate and grossly
+ * negligent acts) or agreed to in writing, shall any Contributor be
+ * liable to You for damages, including any direct, indirect, special,
+ * incidental, or consequential damages of any character arising as a
+ * result of this License or out of the use or inability to use the
+ * Work (including but not limited to damages for loss of goodwill,
+ * work stoppage, computer failure or malfunction, or any and all
+ * other commercial damages or losses), even if such Contributor
+ * has been advised of the possibility of such damages.
+ *
+ * 9. Accepting Warranty or Additional Liability. While redistributing
+ * the Work or Derivative Works thereof, You may choose to offer,
+ * and charge a fee for, acceptance of support, warranty, indemnity,
+ * or other liability obligations and/or rights consistent with this
+ * License. However, in accepting such obligations, You may act only
+ * on Your own behalf and on Your sole responsibility, not on behalf
+ * of any other Contributor, and only if You agree to indemnify,
+ * defend, and hold each Contributor harmless for any liability
+ * incurred by, or claims asserted against, such Contributor by reason
+ * of your accepting any such warranty or additional liability.
+ *
+ * END OF TERMS AND CONDITIONS
+ *
+ * APPENDIX: How to apply the Apache License to your work.
+ *
+ * To apply the Apache License to your work, attach the following
+ * boilerplate notice, with the fields enclosed by brackets "[]"
+ * replaced with your own identifying information. (Don't include
+ * the brackets!) The text should be enclosed in the appropriate
+ * comment syntax for the file format. We also recommend that a
+ * file or class name and description of purpose be included on the
+ * same "printed page" as the copyright notice for easier
+ * identification within third-party archives.
+ *
+ * Copyright 2016 Alibaba Group
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.taobao.weex.dom;
+
+import com.taobao.weex.common.Constants;
+import com.taobao.weex.dom.flex.Spacing;
+import com.taobao.weex.ui.component.WXBasicComponentType;
+import com.taobao.weex.utils.WXLogUtils;
+import com.taobao.weex.utils.WXViewUtils;
+
+import java.util.Map;
+
+/**
+ * Created by zhengshihan on 2017/2/21.
+ */
+
+public class WXRecyclerDomObject extends WXDomObject{
+
+
+ private int mColumnCount = Constants.Value.COLUMN_COUNT_NORMAL;
+ private float mColumnWidth = Constants.Value.AUTO;
+ private float mColumnGap = Constants.Value.COLUMN_GAP_NORMAL;
+ private boolean mIsPreCalculateCellWidth =false;
+
+ public int getLayoutType(){
+ return getAttrs().getLayoutType();
+ }
+
+ public float getColumnGap() {
+ return mColumnGap;
+ }
+
+ public int getColumnCount() {
+ return mColumnCount;
+ }
+
+ @Override
+ public void add(WXDomObject child, int index) {
+ super.add(child, index);
+
+ if (WXBasicComponentType.CELL.equals(child.getType())) {
+ if (!mIsPreCalculateCellWidth) {
+ preCalculateCellWidth();
+ }
+ child.getStyles().put(Constants.Name.WIDTH, mColumnWidth);
+ }
+ }
+
+ public void preCalculateCellWidth(){
+
+ if (getAttrs() != null) {
+ mColumnCount = getAttrs().getColumnCount();
+ mColumnWidth = getAttrs().getColumnWidth();
+ mColumnGap = getAttrs().getColumnGap();
+
+ float availableWidth = getStyleWidth()-getPadding().get(Spacing.LEFT)-getPadding().get(Spacing.RIGHT);
+ availableWidth = WXViewUtils.getWebPxByWidth(availableWidth,getViewPortWidth());
+
+ if (Constants.Value.AUTO == mColumnCount && Constants.Value.AUTO == mColumnWidth) {
+ mColumnCount = Constants.Value.COLUMN_COUNT_NORMAL;
+ } else if (Constants.Value.AUTO == mColumnWidth && Constants.Value.AUTO != mColumnCount) {
+ mColumnWidth = (availableWidth - ((mColumnCount - 1) * mColumnGap)) / mColumnCount;
+ mColumnWidth = mColumnWidth > 0 ? mColumnWidth :0;
+ } else if (Constants.Value.AUTO != mColumnWidth && Constants.Value.AUTO == mColumnCount) {
+ mColumnCount = Math.round((availableWidth + mColumnGap) / (mColumnWidth + mColumnGap)-0.5f);
+ mColumnCount = mColumnCount > 0 ? mColumnCount :1;
+ mColumnWidth =((availableWidth + mColumnGap) / mColumnCount) - mColumnGap;
+ } else if(Constants.Value.AUTO != mColumnWidth && Constants.Value.AUTO != mColumnCount){
+ int columnCount = Math.round((availableWidth + mColumnGap) / (mColumnWidth + mColumnGap)-0.5f);
+ mColumnCount = columnCount > mColumnCount ? mColumnCount :columnCount;
+ mColumnWidth= ((availableWidth + mColumnGap) / mColumnCount) - mColumnGap;
+ }
+ mIsPreCalculateCellWidth = true;
+
+ }
+ }
+
+ @Override
+ public void updateAttr(Map<String, Object> attrs) {
+ super.updateAttr(attrs);
+ if(attrs.containsKey(Constants.Name.COLUMN_COUNT)
+ || attrs.containsKey(Constants.Name.COLUMN_GAP)
+ || attrs.containsKey(Constants.Name.COLUMN_WIDTH)){
+ preCalculateCellWidth();
+
+ int count = getChildCount();
+ for(int i=0;i<count; i++){
+ WXDomObject domObject = getChild(i);
+ if(WXBasicComponentType.CELL.equals(domObject.getType())) {
+ getChild(i).getStyles().put(Constants.Name.WIDTH, mColumnWidth);
+// Message message = Message.obtain();
+// message.what = WXDomHandler.MsgType.WX_DOM_BATCH;
+// WXSDKManager.getInstance().getWXDomManager().sendMessage(message);
+ WXLogUtils.w("zshshr","updateAttr : "+i+"thread:"+Thread.currentThread().getName());
+
+ }
+ }
+
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/61cfd37e/android/sdk/src/main/java/com/taobao/weex/ui/component/WXHeader.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/component/WXHeader.java b/android/sdk/src/main/java/com/taobao/weex/ui/component/WXHeader.java
index e988d46..010dd5a 100755
--- a/android/sdk/src/main/java/com/taobao/weex/ui/component/WXHeader.java
+++ b/android/sdk/src/main/java/com/taobao/weex/ui/component/WXHeader.java
@@ -223,7 +223,9 @@ public class WXHeader extends WXCell {
public WXHeader(WXSDKInstance instance, WXDomObject node, WXVContainer parent, boolean lazy) {
super(instance, node, parent, lazy);
- setSticky(Constants.Value.STICKY);
+ if(WXBasicComponentType.LIST.equals((parent.getDomObject().getType()))){
+ setSticky(Constants.Value.STICKY);
+ }
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/61cfd37e/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 98bf693..0d5f0b1 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
@@ -213,6 +213,7 @@ import android.os.Build;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.util.ArrayMap;
+import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.StaggeredGridLayoutManager;
@@ -288,6 +289,7 @@ public abstract class BasicListComponent<T extends ViewGroup & ListComponentView
protected int mLayoutType = WXRecyclerView.TYPE_LINEAR_LAYOUT;
protected int mColumnCount = 1;
+ protected float mColumnGap = 0;
private int mOffsetAccuracy = 10;
private Point mLastReport = new Point(-1, -1);
@@ -678,13 +680,22 @@ public abstract class BasicListComponent<T extends ViewGroup & ListComponentView
RecyclerView.LayoutManager layoutManager;
boolean beforeFirstVisibleItem = false;
- if ((layoutManager = getHostView().getInnerView().getLayoutManager()) instanceof LinearLayoutManager) {
+ layoutManager = getHostView().getInnerView().getLayoutManager();
+ if (layoutManager instanceof LinearLayoutManager || layoutManager instanceof GridLayoutManager) {
int fVisible = ((LinearLayoutManager) layoutManager).findFirstVisibleItemPosition();
int pos = mChildren.indexOf(cell);
if (pos <= fVisible) {
beforeFirstVisibleItem = true;
}
+ } else if(layoutManager instanceof StaggeredGridLayoutManager){
+ int [] firstItems= new int[3];
+ int fVisible = ((StaggeredGridLayoutManager) layoutManager).findFirstVisibleItemPositions(firstItems)[0];
+ int pos = mChildren.indexOf(cell);
+
+ if (pos <= fVisible) {
+ beforeFirstVisibleItem = true;
+ }
}
int[] location = new int[2];
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/61cfd37e/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 42dd9ff..5299945 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
@@ -208,12 +208,16 @@ import android.content.Context;
import com.taobao.weex.WXSDKInstance;
import com.taobao.weex.annotation.Component;
+import com.taobao.weex.common.Constants;
import com.taobao.weex.dom.WXDomObject;
+import com.taobao.weex.dom.WXRecyclerDomObject;
import com.taobao.weex.ui.component.WXBaseRefresh;
import com.taobao.weex.ui.component.WXComponent;
+import com.taobao.weex.ui.component.WXComponentProp;
import com.taobao.weex.ui.component.WXLoading;
import com.taobao.weex.ui.component.WXRefresh;
import com.taobao.weex.ui.component.WXVContainer;
+import com.taobao.weex.ui.view.listview.WXRecyclerView;
import com.taobao.weex.ui.view.listview.adapter.ListBaseViewHolder;
import com.taobao.weex.ui.view.refresh.wrapper.BounceRecyclerView;
import com.taobao.weex.utils.WXLogUtils;
@@ -235,18 +239,23 @@ public class WXListComponent extends BasicListComponent<BounceRecyclerView> {
this(instance, dom, parent, isLazy);
}
+
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();
+ if (node != null && node instanceof WXRecyclerDomObject) {
+ WXRecyclerDomObject domObject = (WXRecyclerDomObject) node;
+ domObject.preCalculateCellWidth();
+ mLayoutType = domObject.getLayoutType();
+ mColumnCount = domObject.getColumnCount();
+ mColumnGap = domObject.getColumnGap();
+
}
}
@Override
protected BounceRecyclerView generateListView(Context context, int orientation) {
- return new BounceRecyclerView(context,mLayoutType,mColumnCount,orientation);
+ return new BounceRecyclerView(context,mLayoutType,mColumnCount,mColumnGap,orientation);
}
@Override
@@ -295,6 +304,31 @@ public class WXListComponent extends BasicListComponent<BounceRecyclerView> {
return false;
}
+ @WXComponentProp(name = Constants.Name.COLUMN_COUNT)
+ public void setColumnCount(int columnCount) throws InterruptedException {
+ WXLogUtils.w("zshshr","setColumnCount : "+"htread:"+Thread.currentThread().getName());
+ mColumnCount = columnCount;
+ WXRecyclerView wxRecyclerView = getHostView().getInnerView();
+ wxRecyclerView.initView(getContext(), mLayoutType,mColumnCount,mColumnGap,getOrientation());
+ }
+
+ @WXComponentProp(name = Constants.Name.COLUMN_GAP)
+ public void setColumnGap(float columnGap) throws InterruptedException {
+ mColumnGap = columnGap;
+ WXRecyclerView wxRecyclerView = getHostView().getInnerView();
+ wxRecyclerView.initView(getContext(), mLayoutType,mColumnCount,mColumnGap,getOrientation());
+ }
+
+ @WXComponentProp(name = Constants.Name.SHOW_SCROLLBAR)
+ public void showScrollbar(boolean isShow) throws InterruptedException {
+ WXRecyclerView wxRecyclerView = getHostView().getInnerView();
+ wxRecyclerView.setScrollbarFadingEnabled(isShow);
+ wxRecyclerView.setVerticalScrollBarEnabled(isShow);
+
+ wxRecyclerView.initView(getContext(), mLayoutType,mColumnCount,mColumnGap,getOrientation());
+ }
+
+
@Override
public void createChildViewAt(int index) {
int indexToCreate = index;
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/61cfd37e/android/sdk/src/main/java/com/taobao/weex/ui/view/listview/ExtendedLinearLayoutManager.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/view/listview/ExtendedLinearLayoutManager.java b/android/sdk/src/main/java/com/taobao/weex/ui/view/listview/ExtendedLinearLayoutManager.java
index be8afae..80feb71 100644
--- a/android/sdk/src/main/java/com/taobao/weex/ui/view/listview/ExtendedLinearLayoutManager.java
+++ b/android/sdk/src/main/java/com/taobao/weex/ui/view/listview/ExtendedLinearLayoutManager.java
@@ -227,6 +227,31 @@ public class ExtendedLinearLayoutManager extends LinearLayoutManager{
}
@Override
+ public boolean supportsPredictiveItemAnimations() {
+ return false;
+ }
+
+ public void onLayoutChildren(RecyclerView.Recycler recycler, RecyclerView.State state) {
+ try {
+ super.onLayoutChildren(recycler, state);
+ } catch (IndexOutOfBoundsException e) {
+ e.printStackTrace();
+
+ }
+ }
+
+ @Override
+ public int scrollVerticallyBy(int dy, RecyclerView.Recycler recycler, RecyclerView.State state) {
+ try {
+ return super.scrollVerticallyBy(dy, recycler, state);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return 0;
+ }
+
+
+ @Override
public void smoothScrollToPosition(RecyclerView recyclerView, RecyclerView.State state,
int position) {
if (smoothScroller == null) {
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/61cfd37e/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 f3f9460..dc8a209 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
@@ -204,14 +204,16 @@
*/
package com.taobao.weex.ui.view.listview;
+import android.annotation.TargetApi;
import android.content.Context;
+import android.os.Build;
import android.support.annotation.Nullable;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.OrientationHelper;
import android.support.v7.widget.RecyclerView;
-import android.support.v7.widget.StaggeredGridLayoutManager;
import android.view.MotionEvent;
+import com.taobao.weex.common.Constants;
import com.taobao.weex.common.WXThread;
import com.taobao.weex.ui.view.gesture.WXGesture;
import com.taobao.weex.ui.view.gesture.WXGestureObservable;
@@ -241,48 +243,31 @@ public class WXRecyclerView extends RecyclerView implements WXGestureObservable
return super.postDelayed(WXThread.secure(action), delayMillis);
}
public void initView(Context context, int type,int orientation) {
- initView(context,type,0,orientation);
+ initView(context,type, Constants.Value.COLUMN_COUNT_NORMAL,Constants.Value.COLUMN_GAP_NORMAL,orientation);
}
+
+
/**
*
* @param context
* @param type
* @param orientation should be {@link OrientationHelper#HORIZONTAL} or {@link OrientationHelper#VERTICAL}
*/
- public void initView(Context context, int type,int spanCount,int orientation) {
+ @TargetApi(Build.VERSION_CODES.JELLY_BEAN)
+ public void initView(Context context, int type, int spanCount, float columnGap, int orientation) {
if (type == TYPE_GRID_LAYOUT) {
setLayoutManager(new GridLayoutManager(context, spanCount,orientation,false));
} else if (type == TYPE_STAGGERED_GRID_LAYOUT) {
- setLayoutManager(new StaggeredGridLayoutManager(spanCount, orientation));
- } else if (type == TYPE_LINEAR_LAYOUT) {
- setLayoutManager(new ExtendedLinearLayoutManager(context,orientation,false){
-
- @Override
- public boolean supportsPredictiveItemAnimations() {
- return false;
- }
-
- public void onLayoutChildren(RecyclerView.Recycler recycler, RecyclerView.State state) {
- try {
- super.onLayoutChildren(recycler, state);
- } catch (IndexOutOfBoundsException e) {
- e.printStackTrace();
+ setLayoutManager(new WXStaggeredGridLayoutManager(spanCount, orientation));
+ addItemDecoration(new WXSpaceItemDecoration(columnGap));
- }
- }
-
- @Override
- public int scrollVerticallyBy(int dy, RecyclerView.Recycler recycler, RecyclerView.State state) {
- try {
- return super.scrollVerticallyBy(dy, recycler, state);
- } catch (Exception e) {
- e.printStackTrace();
- }
- return 0;
- }
-
- });
+ } else if (type == TYPE_LINEAR_LAYOUT) {
+ setLayoutManager(new ExtendedLinearLayoutManager(context,orientation,false));
}
+
+ setVerticalScrollBarEnabled(true);
+ setScrollable(true);
+ setScrollBarSize(10);
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/61cfd37e/android/sdk/src/main/java/com/taobao/weex/ui/view/listview/WXSpaceItemDecoration.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/view/listview/WXSpaceItemDecoration.java b/android/sdk/src/main/java/com/taobao/weex/ui/view/listview/WXSpaceItemDecoration.java
new file mode 100644
index 0000000..57122cf
--- /dev/null
+++ b/android/sdk/src/main/java/com/taobao/weex/ui/view/listview/WXSpaceItemDecoration.java
@@ -0,0 +1,227 @@
+/**
+ *
+ * Apache License
+ * Version 2.0, January 2004
+ * http://www.apache.org/licenses/
+ *
+ * TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+ *
+ * 1. Definitions.
+ *
+ * "License" shall mean the terms and conditions for use, reproduction,
+ * and distribution as defined by Sections 1 through 9 of this document.
+ *
+ * "Licensor" shall mean the copyright owner or entity authorized by
+ * the copyright owner that is granting the License.
+ *
+ * "Legal Entity" shall mean the union of the acting entity and all
+ * other entities that control, are controlled by, or are under common
+ * control with that entity. For the purposes of this definition,
+ * "control" means (i) the power, direct or indirect, to cause the
+ * direction or management of such entity, whether by contract or
+ * otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ * outstanding shares, or (iii) beneficial ownership of such entity.
+ *
+ * "You" (or "Your") shall mean an individual or Legal Entity
+ * exercising permissions granted by this License.
+ *
+ * "Source" form shall mean the preferred form for making modifications,
+ * including but not limited to software source code, documentation
+ * source, and configuration files.
+ *
+ * "Object" form shall mean any form resulting from mechanical
+ * transformation or translation of a Source form, including but
+ * not limited to compiled object code, generated documentation,
+ * and conversions to other media types.
+ *
+ * "Work" shall mean the work of authorship, whether in Source or
+ * Object form, made available under the License, as indicated by a
+ * copyright notice that is included in or attached to the work
+ * (an example is provided in the Appendix below).
+ *
+ * "Derivative Works" shall mean any work, whether in Source or Object
+ * form, that is based on (or derived from) the Work and for which the
+ * editorial revisions, annotations, elaborations, or other modifications
+ * represent, as a whole, an original work of authorship. For the purposes
+ * of this License, Derivative Works shall not include works that remain
+ * separable from, or merely link (or bind by name) to the interfaces of,
+ * the Work and Derivative Works thereof.
+ *
+ * "Contribution" shall mean any work of authorship, including
+ * the original version of the Work and any modifications or additions
+ * to that Work or Derivative Works thereof, that is intentionally
+ * submitted to Licensor for inclusion in the Work by the copyright owner
+ * or by an individual or Legal Entity authorized to submit on behalf of
+ * the copyright owner. For the purposes of this definition, "submitted"
+ * means any form of electronic, verbal, or written communication sent
+ * to the Licensor or its representatives, including but not limited to
+ * communication on electronic mailing lists, source code control systems,
+ * and issue tracking systems that are managed by, or on behalf of, the
+ * Licensor for the purpose of discussing and improving the Work, but
+ * excluding communication that is conspicuously marked or otherwise
+ * designated in writing by the copyright owner as "Not a Contribution."
+ *
+ * "Contributor" shall mean Licensor and any individual or Legal Entity
+ * on behalf of whom a Contribution has been received by Licensor and
+ * subsequently incorporated within the Work.
+ *
+ * 2. Grant of Copyright License. Subject to the terms and conditions of
+ * this License, each Contributor hereby grants to You a perpetual,
+ * worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ * copyright license to reproduce, prepare Derivative Works of,
+ * publicly display, publicly perform, sublicense, and distribute the
+ * Work and such Derivative Works in Source or Object form.
+ *
+ * 3. Grant of Patent License. Subject to the terms and conditions of
+ * this License, each Contributor hereby grants to You a perpetual,
+ * worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ * (except as stated in this section) patent license to make, have made,
+ * use, offer to sell, sell, import, and otherwise transfer the Work,
+ * where such license applies only to those patent claims licensable
+ * by such Contributor that are necessarily infringed by their
+ * Contribution(s) alone or by combination of their Contribution(s)
+ * with the Work to which such Contribution(s) was submitted. If You
+ * institute patent litigation against any entity (including a
+ * cross-claim or counterclaim in a lawsuit) alleging that the Work
+ * or a Contribution incorporated within the Work constitutes direct
+ * or contributory patent infringement, then any patent licenses
+ * granted to You under this License for that Work shall terminate
+ * as of the date such litigation is filed.
+ *
+ * 4. Redistribution. You may reproduce and distribute copies of the
+ * Work or Derivative Works thereof in any medium, with or without
+ * modifications, and in Source or Object form, provided that You
+ * meet the following conditions:
+ *
+ * (a) You must give any other recipients of the Work or
+ * Derivative Works a copy of this License; and
+ *
+ * (b) You must cause any modified files to carry prominent notices
+ * stating that You changed the files; and
+ *
+ * (c) You must retain, in the Source form of any Derivative Works
+ * that You distribute, all copyright, patent, trademark, and
+ * attribution notices from the Source form of the Work,
+ * excluding those notices that do not pertain to any part of
+ * the Derivative Works; and
+ *
+ * (d) If the Work includes a "NOTICE" text file as part of its
+ * distribution, then any Derivative Works that You distribute must
+ * include a readable copy of the attribution notices contained
+ * within such NOTICE file, excluding those notices that do not
+ * pertain to any part of the Derivative Works, in at least one
+ * of the following places: within a NOTICE text file distributed
+ * as part of the Derivative Works; within the Source form or
+ * documentation, if provided along with the Derivative Works; or,
+ * within a display generated by the Derivative Works, if and
+ * wherever such third-party notices normally appear. The contents
+ * of the NOTICE file are for informational purposes only and
+ * do not modify the License. You may add Your own attribution
+ * notices within Derivative Works that You distribute, alongside
+ * or as an addendum to the NOTICE text from the Work, provided
+ * that such additional attribution notices cannot be construed
+ * as modifying the License.
+ *
+ * You may add Your own copyright statement to Your modifications and
+ * may provide additional or different license terms and conditions
+ * for use, reproduction, or distribution of Your modifications, or
+ * for any such Derivative Works as a whole, provided Your use,
+ * reproduction, and distribution of the Work otherwise complies with
+ * the conditions stated in this License.
+ *
+ * 5. Submission of Contributions. Unless You explicitly state otherwise,
+ * any Contribution intentionally submitted for inclusion in the Work
+ * by You to the Licensor shall be under the terms and conditions of
+ * this License, without any additional terms or conditions.
+ * Notwithstanding the above, nothing herein shall supersede or modify
+ * the terms of any separate license agreement you may have executed
+ * with Licensor regarding such Contributions.
+ *
+ * 6. Trademarks. This License does not grant permission to use the trade
+ * names, trademarks, service marks, or product names of the Licensor,
+ * except as required for reasonable and customary use in describing the
+ * origin of the Work and reproducing the content of the NOTICE file.
+ *
+ * 7. Disclaimer of Warranty. Unless required by applicable law or
+ * agreed to in writing, Licensor provides the Work (and each
+ * Contributor provides its Contributions) on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied, including, without limitation, any warranties or conditions
+ * of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ * PARTICULAR PURPOSE. You are solely responsible for determining the
+ * appropriateness of using or redistributing the Work and assume any
+ * risks associated with Your exercise of permissions under this License.
+ *
+ * 8. Limitation of Liability. In no event and under no legal theory,
+ * whether in tort (including negligence), contract, or otherwise,
+ * unless required by applicable law (such as deliberate and grossly
+ * negligent acts) or agreed to in writing, shall any Contributor be
+ * liable to You for damages, including any direct, indirect, special,
+ * incidental, or consequential damages of any character arising as a
+ * result of this License or out of the use or inability to use the
+ * Work (including but not limited to damages for loss of goodwill,
+ * work stoppage, computer failure or malfunction, or any and all
+ * other commercial damages or losses), even if such Contributor
+ * has been advised of the possibility of such damages.
+ *
+ * 9. Accepting Warranty or Additional Liability. While redistributing
+ * the Work or Derivative Works thereof, You may choose to offer,
+ * and charge a fee for, acceptance of support, warranty, indemnity,
+ * or other liability obligations and/or rights consistent with this
+ * License. However, in accepting such obligations, You may act only
+ * on Your own behalf and on Your sole responsibility, not on behalf
+ * of any other Contributor, and only if You agree to indemnify,
+ * defend, and hold each Contributor harmless for any liability
+ * incurred by, or claims asserted against, such Contributor by reason
+ * of your accepting any such warranty or additional liability.
+ *
+ * END OF TERMS AND CONDITIONS
+ *
+ * APPENDIX: How to apply the Apache License to your work.
+ *
+ * To apply the Apache License to your work, attach the following
+ * boilerplate notice, with the fields enclosed by brackets "[]"
+ * replaced with your own identifying information. (Don't include
+ * the brackets!) The text should be enclosed in the appropriate
+ * comment syntax for the file format. We also recommend that a
+ * file or class name and description of purpose be included on the
+ * same "printed page" as the copyright notice for easier
+ * identification within third-party archives.
+ *
+ * Copyright 2016 Alibaba Group
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.taobao.weex.ui.view.listview;
+
+import android.graphics.Rect;
+import android.support.v7.widget.RecyclerView;
+import android.view.View;
+
+/**
+ * Created by zhengshihan on 2017/2/20.
+ */
+
+public class WXSpaceItemDecoration extends RecyclerView.ItemDecoration {
+ private float space;
+
+ public WXSpaceItemDecoration(float space) {
+ this.space = space;
+ }
+
+ @Override
+ public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
+ outRect.right = (int)space/2;
+ outRect.left = (int)space/2;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/61cfd37e/android/sdk/src/main/java/com/taobao/weex/ui/view/listview/WXStaggeredGridLayoutManager.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/view/listview/WXStaggeredGridLayoutManager.java b/android/sdk/src/main/java/com/taobao/weex/ui/view/listview/WXStaggeredGridLayoutManager.java
new file mode 100644
index 0000000..a2f6926
--- /dev/null
+++ b/android/sdk/src/main/java/com/taobao/weex/ui/view/listview/WXStaggeredGridLayoutManager.java
@@ -0,0 +1,237 @@
+/**
+ *
+ * Apache License
+ * Version 2.0, January 2004
+ * http://www.apache.org/licenses/
+ *
+ * TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+ *
+ * 1. Definitions.
+ *
+ * "License" shall mean the terms and conditions for use, reproduction,
+ * and distribution as defined by Sections 1 through 9 of this document.
+ *
+ * "Licensor" shall mean the copyright owner or entity authorized by
+ * the copyright owner that is granting the License.
+ *
+ * "Legal Entity" shall mean the union of the acting entity and all
+ * other entities that control, are controlled by, or are under common
+ * control with that entity. For the purposes of this definition,
+ * "control" means (i) the power, direct or indirect, to cause the
+ * direction or management of such entity, whether by contract or
+ * otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ * outstanding shares, or (iii) beneficial ownership of such entity.
+ *
+ * "You" (or "Your") shall mean an individual or Legal Entity
+ * exercising permissions granted by this License.
+ *
+ * "Source" form shall mean the preferred form for making modifications,
+ * including but not limited to software source code, documentation
+ * source, and configuration files.
+ *
+ * "Object" form shall mean any form resulting from mechanical
+ * transformation or translation of a Source form, including but
+ * not limited to compiled object code, generated documentation,
+ * and conversions to other media types.
+ *
+ * "Work" shall mean the work of authorship, whether in Source or
+ * Object form, made available under the License, as indicated by a
+ * copyright notice that is included in or attached to the work
+ * (an example is provided in the Appendix below).
+ *
+ * "Derivative Works" shall mean any work, whether in Source or Object
+ * form, that is based on (or derived from) the Work and for which the
+ * editorial revisions, annotations, elaborations, or other modifications
+ * represent, as a whole, an original work of authorship. For the purposes
+ * of this License, Derivative Works shall not include works that remain
+ * separable from, or merely link (or bind by name) to the interfaces of,
+ * the Work and Derivative Works thereof.
+ *
+ * "Contribution" shall mean any work of authorship, including
+ * the original version of the Work and any modifications or additions
+ * to that Work or Derivative Works thereof, that is intentionally
+ * submitted to Licensor for inclusion in the Work by the copyright owner
+ * or by an individual or Legal Entity authorized to submit on behalf of
+ * the copyright owner. For the purposes of this definition, "submitted"
+ * means any form of electronic, verbal, or written communication sent
+ * to the Licensor or its representatives, including but not limited to
+ * communication on electronic mailing lists, source code control systems,
+ * and issue tracking systems that are managed by, or on behalf of, the
+ * Licensor for the purpose of discussing and improving the Work, but
+ * excluding communication that is conspicuously marked or otherwise
+ * designated in writing by the copyright owner as "Not a Contribution."
+ *
+ * "Contributor" shall mean Licensor and any individual or Legal Entity
+ * on behalf of whom a Contribution has been received by Licensor and
+ * subsequently incorporated within the Work.
+ *
+ * 2. Grant of Copyright License. Subject to the terms and conditions of
+ * this License, each Contributor hereby grants to You a perpetual,
+ * worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ * copyright license to reproduce, prepare Derivative Works of,
+ * publicly display, publicly perform, sublicense, and distribute the
+ * Work and such Derivative Works in Source or Object form.
+ *
+ * 3. Grant of Patent License. Subject to the terms and conditions of
+ * this License, each Contributor hereby grants to You a perpetual,
+ * worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ * (except as stated in this section) patent license to make, have made,
+ * use, offer to sell, sell, import, and otherwise transfer the Work,
+ * where such license applies only to those patent claims licensable
+ * by such Contributor that are necessarily infringed by their
+ * Contribution(s) alone or by combination of their Contribution(s)
+ * with the Work to which such Contribution(s) was submitted. If You
+ * institute patent litigation against any entity (including a
+ * cross-claim or counterclaim in a lawsuit) alleging that the Work
+ * or a Contribution incorporated within the Work constitutes direct
+ * or contributory patent infringement, then any patent licenses
+ * granted to You under this License for that Work shall terminate
+ * as of the date such litigation is filed.
+ *
+ * 4. Redistribution. You may reproduce and distribute copies of the
+ * Work or Derivative Works thereof in any medium, with or without
+ * modifications, and in Source or Object form, provided that You
+ * meet the following conditions:
+ *
+ * (a) You must give any other recipients of the Work or
+ * Derivative Works a copy of this License; and
+ *
+ * (b) You must cause any modified files to carry prominent notices
+ * stating that You changed the files; and
+ *
+ * (c) You must retain, in the Source form of any Derivative Works
+ * that You distribute, all copyright, patent, trademark, and
+ * attribution notices from the Source form of the Work,
+ * excluding those notices that do not pertain to any part of
+ * the Derivative Works; and
+ *
+ * (d) If the Work includes a "NOTICE" text file as part of its
+ * distribution, then any Derivative Works that You distribute must
+ * include a readable copy of the attribution notices contained
+ * within such NOTICE file, excluding those notices that do not
+ * pertain to any part of the Derivative Works, in at least one
+ * of the following places: within a NOTICE text file distributed
+ * as part of the Derivative Works; within the Source form or
+ * documentation, if provided along with the Derivative Works; or,
+ * within a display generated by the Derivative Works, if and
+ * wherever such third-party notices normally appear. The contents
+ * of the NOTICE file are for informational purposes only and
+ * do not modify the License. You may add Your own attribution
+ * notices within Derivative Works that You distribute, alongside
+ * or as an addendum to the NOTICE text from the Work, provided
+ * that such additional attribution notices cannot be construed
+ * as modifying the License.
+ *
+ * You may add Your own copyright statement to Your modifications and
+ * may provide additional or different license terms and conditions
+ * for use, reproduction, or distribution of Your modifications, or
+ * for any such Derivative Works as a whole, provided Your use,
+ * reproduction, and distribution of the Work otherwise complies with
+ * the conditions stated in this License.
+ *
+ * 5. Submission of Contributions. Unless You explicitly state otherwise,
+ * any Contribution intentionally submitted for inclusion in the Work
+ * by You to the Licensor shall be under the terms and conditions of
+ * this License, without any additional terms or conditions.
+ * Notwithstanding the above, nothing herein shall supersede or modify
+ * the terms of any separate license agreement you may have executed
+ * with Licensor regarding such Contributions.
+ *
+ * 6. Trademarks. This License does not grant permission to use the trade
+ * names, trademarks, service marks, or product names of the Licensor,
+ * except as required for reasonable and customary use in describing the
+ * origin of the Work and reproducing the content of the NOTICE file.
+ *
+ * 7. Disclaimer of Warranty. Unless required by applicable law or
+ * agreed to in writing, Licensor provides the Work (and each
+ * Contributor provides its Contributions) on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied, including, without limitation, any warranties or conditions
+ * of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ * PARTICULAR PURPOSE. You are solely responsible for determining the
+ * appropriateness of using or redistributing the Work and assume any
+ * risks associated with Your exercise of permissions under this License.
+ *
+ * 8. Limitation of Liability. In no event and under no legal theory,
+ * whether in tort (including negligence), contract, or otherwise,
+ * unless required by applicable law (such as deliberate and grossly
+ * negligent acts) or agreed to in writing, shall any Contributor be
+ * liable to You for damages, including any direct, indirect, special,
+ * incidental, or consequential damages of any character arising as a
+ * result of this License or out of the use or inability to use the
+ * Work (including but not limited to damages for loss of goodwill,
+ * work stoppage, computer failure or malfunction, or any and all
+ * other commercial damages or losses), even if such Contributor
+ * has been advised of the possibility of such damages.
+ *
+ * 9. Accepting Warranty or Additional Liability. While redistributing
+ * the Work or Derivative Works thereof, You may choose to offer,
+ * and charge a fee for, acceptance of support, warranty, indemnity,
+ * or other liability obligations and/or rights consistent with this
+ * License. However, in accepting such obligations, You may act only
+ * on Your own behalf and on Your sole responsibility, not on behalf
+ * of any other Contributor, and only if You agree to indemnify,
+ * defend, and hold each Contributor harmless for any liability
+ * incurred by, or claims asserted against, such Contributor by reason
+ * of your accepting any such warranty or additional liability.
+ *
+ * END OF TERMS AND CONDITIONS
+ *
+ * APPENDIX: How to apply the Apache License to your work.
+ *
+ * To apply the Apache License to your work, attach the following
+ * boilerplate notice, with the fields enclosed by brackets "[]"
+ * replaced with your own identifying information. (Don't include
+ * the brackets!) The text should be enclosed in the appropriate
+ * comment syntax for the file format. We also recommend that a
+ * file or class name and description of purpose be included on the
+ * same "printed page" as the copyright notice for easier
+ * identification within third-party archives.
+ *
+ * Copyright 2016 Alibaba Group
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.taobao.weex.ui.view.listview;
+
+import android.support.v7.widget.RecyclerView;
+import android.support.v7.widget.StaggeredGridLayoutManager;
+
+/**
+ * Created by zhengshihan on 2017/2/20.
+ */
+
+public class WXStaggeredGridLayoutManager extends StaggeredGridLayoutManager {
+
+ public WXStaggeredGridLayoutManager(int spanCount, int orientation) {
+ super(spanCount, orientation);
+ offsetChildrenHorizontal(200);
+ }
+
+ @Override
+ public void onLayoutChildren(RecyclerView.Recycler recycler, RecyclerView.State state) {
+ super.onLayoutChildren(recycler, state);
+
+ }
+
+ @Override
+ public void onItemsAdded(RecyclerView recyclerView, int positionStart, int itemCount) {
+ super.onItemsAdded(recyclerView, positionStart, itemCount);
+
+ }
+
+ @Override
+ public void onItemsUpdated(RecyclerView recyclerView, int positionStart, int itemCount, Object payload) {
+ super.onItemsUpdated(recyclerView, positionStart, itemCount, payload);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/61cfd37e/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 8587703..ad60ade 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
@@ -281,7 +281,9 @@ public class WXRecyclerViewOnScrollListener extends RecyclerView.OnScrollListene
,dy);
} else if (layoutManager instanceof GridLayoutManager) {
layoutManagerType = LAYOUT_MANAGER_TYPE.GRID;
- lastVisibleItemPosition = ((GridLayoutManager) layoutManager).findLastVisibleItemPosition();
+ GridLayoutManager gridLayoutManager = ((GridLayoutManager) layoutManager);
+ lastVisibleItemPosition = gridLayoutManager.findLastVisibleItemPosition();
+
} else if (layoutManager instanceof StaggeredGridLayoutManager) {
layoutManagerType = LAYOUT_MANAGER_TYPE.STAGGERED_GRID;
StaggeredGridLayoutManager staggeredGridLayoutManager = (StaggeredGridLayoutManager) layoutManager;
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/61cfd37e/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 1709d24..abbdf0d 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
@@ -221,6 +221,7 @@ import com.taobao.weex.ui.view.listview.adapter.RecyclerViewBaseAdapter;
import java.util.Stack;
+
public class BounceRecyclerView extends BaseBounceView<WXRecyclerView> implements ListComponentView,WXGestureObservable {
private RecyclerViewBaseAdapter adapter = null;
@@ -228,30 +229,27 @@ public class BounceRecyclerView extends BaseBounceView<WXRecyclerView> implement
private Stack<WXCell> headComponentStack = new Stack<>();
private WXGesture mGesture;
private int mLayoutType = WXRecyclerView.TYPE_LINEAR_LAYOUT;
- private int mSpanCount = 1;
+ private int mColumnCount = 1;
+ private float mColumnGap = 1;
@Override
public boolean postDelayed(Runnable action, long delayMillis) {
return super.postDelayed(WXThread.secure(action), delayMillis);
}
- public BounceRecyclerView(Context context,int type,int spanCount,int orientation) {
+ public BounceRecyclerView(Context context,int type,int columnCount,float columnGap,int orientation) {
super(context, orientation);
mLayoutType = type;
- mSpanCount = spanCount;
+ mColumnCount = columnCount;
+ mColumnGap = columnGap;
init(context);
}
-
public BounceRecyclerView(Context context,int type,int orientation) {
super(context, orientation);
mLayoutType = type;
init(context);
}
- public BounceRecyclerView(Context context, int orientation) {
- super(context, orientation);
- }
-
public void setRecyclerViewBaseAdapter(RecyclerViewBaseAdapter adapter) {
this.adapter = adapter;
if (getInnerView() != null) {
@@ -275,7 +273,7 @@ public class BounceRecyclerView extends BaseBounceView<WXRecyclerView> implement
@Override
public WXRecyclerView setInnerView(Context context) {
WXRecyclerView wxRecyclerView = new WXRecyclerView(context);
- wxRecyclerView.initView(context, mLayoutType,mSpanCount,getOrientation());
+ wxRecyclerView.initView(context, mLayoutType,mColumnCount,mColumnGap,getOrientation());
return wxRecyclerView;
}
[12/25] incubator-weex git commit: * [ios] support cell move and
remove
Posted by cx...@apache.org.
* [ios] support cell move and remove
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/4c8127ce
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/4c8127ce
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/4c8127ce
Branch: refs/heads/0.11-dev-recycler
Commit: 4c8127ce0290066765c85f829f63d4afa91aaf17
Parents: 202321a
Author: \u9690\u98ce <cx...@gmail.com>
Authored: Thu Feb 23 19:59:53 2017 +0800
Committer: \u9690\u98ce <cx...@gmail.com>
Committed: Thu Feb 23 19:59:53 2017 +0800
----------------------------------------------------------------------
.../Component/Recycler/WXRecyclerComponent.m | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/4c8127ce/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerComponent.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerComponent.m b/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerComponent.m
index f4cf51e..d7e1fac 100644
--- a/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerComponent.m
+++ b/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerComponent.m
@@ -273,7 +273,7 @@ typedef enum : NSUInteger {
- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView
{
- WXLogError(@"section number:%zi", [self.dataController numberOfSections]);
+ WXLogDebug(@"section number:%zi", [self.dataController numberOfSections]);
return [self.dataController numberOfSections];
}
@@ -414,12 +414,24 @@ typedef enum : NSUInteger {
- (void)cellDidRemove:(WXCellComponent *)cell
{
-
+ if (cell.isLayoutComplete) {
+ WXPerformBlockOnMainThread(^{
+ [self.collectionView.collectionViewLayout invalidateLayout];
+ [self performUpdatesWithCompletion:^(BOOL finished) {
+ }];
+ });
+ }
}
- (void)cell:(WXCellComponent *)cell didMoveToIndex:(NSUInteger)index
{
-
+ if (cell.isLayoutComplete) {
+ WXPerformBlockOnMainThread(^{
+ [self.collectionView.collectionViewLayout invalidateLayout];
+ [self performUpdatesWithCompletion:^(BOOL finished) {
+ }];
+ });
+ }
}
#pragma makrk - private
[10/25] incubator-weex git commit: Merge remote-tracking branch
'upstream/0.11-dev' into ios-feature-grid
Posted by cx...@apache.org.
Merge remote-tracking branch 'upstream/0.11-dev' into ios-feature-grid
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/2e2b3b49
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/2e2b3b49
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/2e2b3b49
Branch: refs/heads/0.11-dev-recycler
Commit: 2e2b3b494c6798890580aeec8fc75b7043f92f05
Parents: 0277571 9cb0030
Author: \u9690\u98ce <cx...@gmail.com>
Authored: Thu Feb 23 16:37:25 2017 +0800
Committer: \u9690\u98ce <cx...@gmail.com>
Committed: Thu Feb 23 16:37:25 2017 +0800
----------------------------------------------------------------------
.travis.yml | 2 +
.../commons/adapter/JSExceptionAdapter.java | 222 ++
.../java/com/alibaba/weex/WXApplication.java | 2 +
.../zxing/client/android/CaptureActivity.java | 1 +
android/run-ci.sh | 2 +-
android/sdk/libs/armeabi/libweexv8.so | Bin 3583820 -> 3583820 bytes
android/sdk/libs/x86/libweexv8.so | Bin 4340864 -> 4340864 bytes
.../main/java/com/taobao/weex/InitConfig.java | 13 +
.../main/java/com/taobao/weex/WXSDKEngine.java | 5 +
.../java/com/taobao/weex/WXSDKInstance.java | 4 +-
.../main/java/com/taobao/weex/WXSDKManager.java | 14 +
.../weex/adapter/IWXJSExceptionAdapter.java | 218 ++
.../appfram/navigator/WXNavigatorModule.java | 82 +-
.../com/taobao/weex/bridge/WXBridgeManager.java | 68 +-
.../com/taobao/weex/bridge/WXModuleManager.java | 29 +-
.../taobao/weex/bridge/WXServiceManager.java | 31 +-
.../java/com/taobao/weex/common/Constants.java | 1 +
.../taobao/weex/common/WXJSExceptionInfo.java | 331 ++
.../com/taobao/weex/common/WXJSService.java | 229 ++
.../main/java/com/taobao/weex/dom/WXAttr.java | 13 +
.../java/com/taobao/weex/dom/WXDomObject.java | 5 +-
.../com/taobao/weex/http/WXStreamModule.java | 2 +-
.../ui/component/AbstractEditComponent.java | 3 +
.../java/com/taobao/weex/ui/component/WXA.java | 10 +-
.../taobao/weex/ui/component/WXComponent.java | 12 +-
.../com/taobao/weex/ui/component/WXImage.java | 14 +-
.../weex/ui/component/WXSliderNeighbor.java | 31 +-
.../ui/component/list/BasicListComponent.java | 6 +-
.../listview/adapter/ListBaseViewHolder.java | 10 +-
.../main/java/com/taobao/weex/utils/WXHack.java | 527 ---
.../java/com/taobao/weex/utils/WXUtils.java | 200 +-
.../java/com/taobao/weex/utils/WXViewUtils.java | 8 +-
.../java/com/taobao/weex/utils/WXUtilsTest.java | 125 +-
doc/advanced/extend-to-android.md | 175 +
doc/package.json | 5 +-
doc/source/cn/guide/intro/app-architecture.md | 34 +-
doc/source/cn/guide/intro/devtools.md | 99 +
doc/source/cn/guide/intro/how-it-works.md | 38 +-
doc/source/cn/guide/intro/page-architecture.md | 18 +-
doc/source/cn/guide/intro/using-vue.md | 79 +-
doc/source/cn/guide/intro/web-dev-experience.md | 20 +-
.../cn/references/advanced/extend-to-android.md | 26 +
.../cn/references/advanced/extend-to-ios.md | 45 +-
doc/source/cn/references/common-style.md | 157 +
doc/source/cn/references/components/image.md | 4 +-
doc/source/cn/references/components/input.md | 11 +-
doc/source/cn/references/components/textarea.md | 7 +
.../cn/v-0.10/advanced/extend-to-android.md | 27 +-
doc/source/cn/v-0.10/advanced/extend-to-ios.md | 154 +-
doc/source/guide/intro/app-architecture.md | 57 +-
doc/source/guide/intro/devtools.md | 100 +
doc/source/guide/intro/how-it-works.md | 62 +-
doc/source/guide/intro/index.md | 4 +-
doc/source/guide/intro/page-architecture.md | 42 +-
doc/source/guide/intro/using-vue.md | 52 +-
doc/source/guide/intro/web-dev-experience.md | 29 +-
doc/source/guide/intro/write-once.md | 19 +-
doc/source/references/advanced/extend-jsfm.md | 2 +-
.../references/advanced/extend-to-android.md | 29 +-
.../references/advanced/extend-to-html5.md | 2 +-
doc/source/references/advanced/extend-to-ios.md | 80 +-
doc/source/references/advanced/index.md | 2 +-
.../advanced/integrate-devtool-to-android.md | 2 +-
.../advanced/integrate-devtool-to-ios.md | 2 +-
doc/source/references/common-style.md | 159 +
doc/source/references/components/cell.md | 6 +-
doc/source/references/components/image.md | 3 +-
doc/source/references/components/input.md | 7 +
doc/source/references/components/textarea.md | 7 +
doc/source/references/gesture.md | 9 +-
doc/source/references/js-service/index.md | 114 +
doc/source/references/vue/difference-of-vuex.md | 2 +-
.../references/vue/difference-with-web.md | 2 +-
doc/source/references/vue/index.md | 2 +-
doc/source/v-0.10/advanced/extend-to-android.md | 57 +-
doc/source/v-0.10/advanced/extend-to-ios.md | 39 +
examples/index.we | 1 +
examples/linear-gradient.we | 70 +
html5/frameworks/legacy/app/ctrl/init.js | 2 -
html5/frameworks/legacy/app/ctrl/misc.js | 55 +-
html5/frameworks/legacy/app/instance.js | 14 +-
html5/frameworks/legacy/static/create.js | 6 +-
html5/runtime/config.js | 4 +-
html5/runtime/init.js | 4 -
html5/runtime/task-center.js | 57 +
html5/services/amd/index.js | 18 +-
html5/test/case/prepare.js | 6 +-
html5/test/case/tester.js | 48 +-
html5/test/unit/default/app/ctrl.js | 14 +-
html5/test/unit/default/app/index.js | 28 +-
.../WeexDemo.xcodeproj/project.pbxproj | 11 +-
.../AppIcon.appiconset/Icon-29.png | Bin 1682 -> 1614 bytes
.../AppIcon.appiconset/Icon-29@2x-1.png | Bin 2709 -> 2421 bytes
.../AppIcon.appiconset/Icon-29@2x.png | Bin 2709 -> 2421 bytes
.../AppIcon.appiconset/Icon-29@3x.png | Bin 3724 -> 3236 bytes
.../AppIcon.appiconset/Icon-40.png | Bin 2018 -> 1946 bytes
.../AppIcon.appiconset/Icon-40@2x-1.png | Bin 3368 -> 3016 bytes
.../AppIcon.appiconset/Icon-40@2x.png | Bin 3368 -> 3016 bytes
.../AppIcon.appiconset/Icon-40@3x.png | Bin 4715 -> 4172 bytes
.../AppIcon.appiconset/Icon-60@2x.png | Bin 4715 -> 4172 bytes
.../AppIcon.appiconset/Icon-60@3x.png | Bin 6892 -> 6017 bytes
.../AppIcon.appiconset/Icon-76.png | Bin 3324 -> 2918 bytes
.../AppIcon.appiconset/Icon-76@2x.png | Bin 5937 -> 5088 bytes
.../AppIcon.appiconset/Icon-83.5@2x.png | Bin 6942 -> 5537 bytes
ios/playground/WeexDemo/Info.plist | 11 +-
ios/playground/bundlejs/animation.js | 3 +-
ios/playground/bundlejs/component/a-demo.js | 3 +-
.../bundlejs/component/countdown-demo.js | 3 +-
ios/playground/bundlejs/component/image-demo.js | 3 +-
ios/playground/bundlejs/component/input-demo.js | 3 +-
.../bundlejs/component/list/list-demo.js | 3 +-
.../bundlejs/component/marquee-demo.js | 3 +-
.../bundlejs/component/navigator-demo.js | 8 +-
.../bundlejs/component/process-bar-demo.js | 3 +-
.../bundlejs/component/scroller-demo.js | 3 +-
.../bundlejs/component/slider-neighbor/index.js | 264 ++
.../slider-neighbor/silder-neighbor.js | 287 --
.../bundlejs/component/slider/index.js | 36 +-
.../bundlejs/component/tabbar/tabbar-demo.js | 5 +-
ios/playground/bundlejs/component/text-demo.js | 111 +-
ios/playground/bundlejs/component/video-demo.js | 3 +-
ios/playground/bundlejs/component/web-demo.js | 11 +-
ios/playground/bundlejs/error.js | 3 +-
ios/playground/bundlejs/index.js | 7 +-
ios/playground/bundlejs/linear-gradient.js | 367 ++
ios/playground/bundlejs/module/clipboard.js | 20 +-
ios/playground/bundlejs/module/componentRect.js | 563 +++
ios/playground/bundlejs/module/instance-api.js | 18 +-
ios/playground/bundlejs/module/modal.js | 22 +-
ios/playground/bundlejs/module/picker-demo.js | 22 +-
ios/playground/bundlejs/module/storage-demo.js | 18 +-
ios/playground/bundlejs/module/stream-demo.js | 22 +-
.../bundlejs/module/websocket-demo.js | 2409 +++++++++++++
ios/playground/bundlejs/showcase/calculator.js | 25 +-
.../bundlejs/showcase/dropdown/dropdown-demo.js | 30 +-
.../bundlejs/showcase/dropdown/we-dropdown.js | 12 +-
ios/playground/bundlejs/showcase/minesweeper.js | 18 +-
.../bundlejs/showcase/new-fashion/banner.js | 8 +-
.../bundlejs/showcase/new-fashion/banners.js | 20 +-
.../bundlejs/showcase/new-fashion/brand.js | 36 +-
.../bundlejs/showcase/new-fashion/category.js | 24 +-
.../bundlejs/showcase/new-fashion/coupon.js | 12 +-
.../bundlejs/showcase/new-fashion/fashion.js | 38 +-
.../bundlejs/showcase/new-fashion/goods.js | 24 +-
.../bundlejs/showcase/new-fashion/headlines.js | 48 +-
.../bundlejs/showcase/new-fashion/image-demo.js | 3 +-
.../bundlejs/showcase/new-fashion/index.js | 27 +-
.../bundlejs/showcase/new-fashion/link.js | 8 +-
.../showcase/new-fashion/list/list-demo.js | 3 +-
.../bundlejs/showcase/new-fashion/main.js | 213 +-
.../bundlejs/showcase/new-fashion/match.js | 24 +-
.../bundlejs/showcase/new-fashion/resource.js | 38 +-
.../bundlejs/showcase/new-fashion/scene.js | 24 +-
.../bundlejs/showcase/pseudo-class.js | 2422 +++++++++++++
ios/playground/bundlejs/showcase/ui.js | 28 +-
ios/playground/bundlejs/style/index.js | 80 +-
ios/playground/bundlejs/style/style-box.js | 44 +-
ios/playground/bundlejs/style/style-flex.js | 52 +-
ios/playground/bundlejs/style/style-item.js | 12 +-
ios/playground/bundlejs/syntax/hello-world-1.js | 4 +-
ios/playground/bundlejs/syntax/hello-world-2.js | 6 +-
ios/playground/bundlejs/syntax/hello-world-3.js | 10 +-
ios/playground/bundlejs/syntax/hello-world-4.js | 14 +-
ios/playground/bundlejs/syntax/hello-world-5.js | 14 +-
ios/playground/bundlejs/syntax/hello-world.js | 14 +-
ios/playground/bundlejs/syntax/index.js | 28 +-
.../bundlejs/syntax/script-component.js | 24 +-
ios/playground/bundlejs/syntax/script-data.js | 12 +-
ios/playground/bundlejs/syntax/script-events.js | 12 +-
.../bundlejs/syntax/script-instance.js | 12 +-
.../bundlejs/syntax/script-lifecycle.js | 12 +-
ios/playground/bundlejs/syntax/script-module.js | 12 +-
.../bundlejs/syntax/script-options.js | 12 +-
.../bundlejs/syntax/template-class.js | 12 +-
.../bundlejs/syntax/template-content.js | 20 +-
.../bundlejs/syntax/template-event.js | 12 +-
ios/playground/bundlejs/syntax/template-if.js | 12 +-
.../bundlejs/syntax/template-repeat-update.js | 12 +-
.../bundlejs/syntax/template-repeat.js | 12 +-
.../bundlejs/syntax/template-style.js | 8 +-
ios/playground/bundlejs/template.js | 15 +-
ios/playground/bundlejs/test.js | 128 +
ios/playground/bundlejs/vue/animation.js | 709 ++++
ios/playground/bundlejs/vue/components/a.js | 438 +++
.../bundlejs/vue/components/countdown.js | 640 ++++
ios/playground/bundlejs/vue/components/image.js | 641 ++++
ios/playground/bundlejs/vue/components/input.js | 364 ++
ios/playground/bundlejs/vue/components/list.js | 246 ++
.../bundlejs/vue/components/marquee.js | 534 +++
.../bundlejs/vue/components/navigator.js | 1059 ++++++
.../bundlejs/vue/components/scroller.js | 304 ++
.../bundlejs/vue/components/slider.js | 898 +++++
.../bundlejs/vue/components/tabbar.js | 599 ++++
ios/playground/bundlejs/vue/components/text.js | 513 +++
ios/playground/bundlejs/vue/components/video.js | 396 +++
ios/playground/bundlejs/vue/components/web.js | 459 +++
ios/playground/bundlejs/vue/hello.js | 99 +
ios/playground/bundlejs/vue/iconfont.js | 204 ++
ios/playground/bundlejs/vue/index.js | 496 +++
.../bundlejs/vue/modules/clipboard.js | 691 ++++
.../bundlejs/vue/modules/instance-api.js | 304 ++
ios/playground/bundlejs/vue/modules/modal.js | 581 +++
ios/playground/bundlejs/vue/modules/storage.js | 381 ++
ios/playground/bundlejs/vue/modules/stream.js | 477 +++
.../bundlejs/vue/showcase/calculator.js | 340 ++
.../bundlejs/vue/showcase/itemlist.js | 1062 ++++++
.../bundlejs/vue/showcase/new-fashion.js | 3302 ++++++++++++++++++
.../bundlejs/vue/showcase/progress.js | 336 ++
ios/playground/bundlejs/vue/style/index.js | 1566 +++++++++
ios/playground/bundlejs/vue/style/style-box.js | 780 +++++
ios/playground/bundlejs/vue/style/style-flex.js | 919 +++++
ios/playground/bundlejs/vue/style/style-item.js | 155 +
.../bundlejs/vue/syntax/hello-world-1.js | 95 +
.../bundlejs/vue/syntax/hello-world-2.js | 112 +
.../bundlejs/vue/syntax/hello-world-3.js | 127 +
.../bundlejs/vue/syntax/hello-world-4.js | 167 +
.../bundlejs/vue/syntax/hello-world-5.js | 173 +
.../bundlejs/vue/syntax/hello-world.js | 183 +
.../bundlejs/vue/syntax/script-component.js | 224 ++
.../bundlejs/vue/syntax/script-data.js | 214 ++
.../bundlejs/vue/syntax/script-events.js | 161 +
.../bundlejs/vue/syntax/script-instance.js | 196 ++
.../bundlejs/vue/syntax/script-lifecycle.js | 155 +
.../bundlejs/vue/syntax/script-module.js | 156 +
.../bundlejs/vue/syntax/script-options.js | 182 +
.../bundlejs/vue/syntax/template-class.js | 161 +
.../bundlejs/vue/syntax/template-content.js | 189 +
.../bundlejs/vue/syntax/template-event.js | 197 ++
.../bundlejs/vue/syntax/template-if.js | 165 +
.../vue/syntax/template-repeat-update.js | 195 ++
.../bundlejs/vue/syntax/template-repeat.js | 170 +
.../bundlejs/vue/syntax/template-style.js | 144 +
ios/playground/bundlejs/vue/template.js | 796 +++++
ios/sdk/WeexSDK.podspec | 2 +-
ios/sdk/WeexSDK/Sources/Bridge/WXBridgeMethod.m | 40 +-
ios/sdk/WeexSDK/Sources/Bridge/WXJSCoreBridge.m | 8 +
.../WeexSDK/Sources/Component/WXEditComponent.h | 21 +
.../WeexSDK/Sources/Component/WXEditComponent.m | 762 ++++
.../Sources/Component/WXSliderComponent.m | 35 +-
.../Sources/Component/WXTextAreaComponent.h | 5 +-
.../Sources/Component/WXTextAreaComponent.m | 597 +---
.../Sources/Component/WXTextInputComponent.h | 8 +-
.../Sources/Component/WXTextInputComponent.m | 605 +---
ios/sdk/WeexSDK/Sources/Engine/WXSDKEngine.m | 9 +-
.../WeexSDK/Sources/Module/WXAnimationModule.m | 5 +
ios/sdk/WeexSDK/Sources/Utility/WXUtility.m | 12 +-
package.json | 6 +-
test/run.sh | 2 +-
test/scripts/components/scroll-event.test.js | 32 +-
test/scripts/dom.test.js | 14 +-
test/scripts/index.test.js | 14 +-
test/scripts/util.js | 33 +-
252 files changed, 35024 insertions(+), 3113 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/2e2b3b49/ios/sdk/WeexSDK/Sources/Engine/WXSDKEngine.m
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/2e2b3b49/ios/sdk/WeexSDK/Sources/Module/WXAnimationModule.m
----------------------------------------------------------------------
[09/25] incubator-weex git commit: * [ios] when viewport is
device-width, the width to be adapted should not multiply by scale
Posted by cx...@apache.org.
* [ios] when viewport is device-width, the width to be adapted should not multiply by scale
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/02775712
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/02775712
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/02775712
Branch: refs/heads/0.11-dev-recycler
Commit: 027757128684d15b6742284dbe42f8bae200a237
Parents: 1c96da7
Author: \u9690\u98ce <cx...@gmail.com>
Authored: Thu Feb 23 16:24:23 2017 +0800
Committer: \u9690\u98ce <cx...@gmail.com>
Committed: Thu Feb 23 16:24:23 2017 +0800
----------------------------------------------------------------------
ios/sdk/WeexSDK/Sources/Module/WXMetaModule.m | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/02775712/ios/sdk/WeexSDK/Sources/Module/WXMetaModule.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Module/WXMetaModule.m b/ios/sdk/WeexSDK/Sources/Module/WXMetaModule.m
index 3fa4f66..af8c2d0 100644
--- a/ios/sdk/WeexSDK/Sources/Module/WXMetaModule.m
+++ b/ios/sdk/WeexSDK/Sources/Module/WXMetaModule.m
@@ -22,9 +22,9 @@ WX_EXPORT_METHOD(@selector(setViewport:))
id viewportWidth = viewportArguments[@"width"];
if ([viewportWidth isKindOfClass:[NSString class]]) {
if ([viewportWidth isEqualToString:@"device-width"]) {
- viewportWidthFloat = [WXUtility portraitScreenSize].width * WXScreenScale();
+ viewportWidthFloat = [WXUtility portraitScreenSize].width;
} else if ([viewportWidth isEqualToString:@"device-height"]) {
- viewportWidthFloat = [WXUtility portraitScreenSize].height * WXScreenScale();
+ viewportWidthFloat = [WXUtility portraitScreenSize].height;
} else {
viewportWidthFloat = [WXConvert CGFloat:viewportWidth];
}
[20/25] incubator-weex git commit: Merge branch
'0.11-dev-suppport-recycler-component' into ios-feature-grid
Posted by cx...@apache.org.
Merge branch '0.11-dev-suppport-recycler-component' into ios-feature-grid
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/ba73ba7c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/ba73ba7c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/ba73ba7c
Branch: refs/heads/0.11-dev-recycler
Commit: ba73ba7c9daeb69baeea2289cc891ac7fb84f797
Parents: c0dce9b 1d01df1
Author: \u9690\u5c0f\u98ce <cx...@gmail.com>
Authored: Mon Feb 27 10:49:45 2017 +0800
Committer: GitHub <no...@github.com>
Committed: Mon Feb 27 10:49:45 2017 +0800
----------------------------------------------------------------------
.../main/java/com/taobao/weex/WXSDKEngine.java | 9 +-
.../java/com/taobao/weex/common/Constants.java | 14 +-
.../main/java/com/taobao/weex/dom/WXAttr.java | 96 +++++-
.../java/com/taobao/weex/dom/WXDomHandler.java | 2 +
.../java/com/taobao/weex/dom/WXDomManager.java | 1 +
.../java/com/taobao/weex/dom/WXDomModule.java | 8 +-
.../taobao/weex/dom/WXRecyclerDomObject.java | 317 +++++++++++++++++++
.../weex/ui/component/WXBasicComponentType.java | 2 +
.../com/taobao/weex/ui/component/WXHeader.java | 4 +-
.../weex/ui/component/WXSliderNeighbor.java | 39 ++-
.../ui/component/list/BasicListComponent.java | 29 +-
.../ui/component/list/ListComponentView.java | 3 -
.../ui/component/list/SimpleListComponent.java | 6 +-
.../weex/ui/component/list/WXListComponent.java | 85 ++++-
.../listview/ExtendedLinearLayoutManager.java | 25 ++
.../weex/ui/view/listview/WXRecyclerView.java | 43 +--
.../listview/adapter/ListBaseViewHolder.java | 8 +-
.../adapter/RecyclerViewBaseAdapter.java | 21 +-
.../adapter/WXRecyclerViewOnScrollListener.java | 107 ++++---
.../ui/view/refresh/wrapper/BaseBounceView.java | 19 +-
.../refresh/wrapper/BounceRecyclerView.java | 23 +-
.../refresh/wrapper/BounceScrollerView.java | 1 +
ios/sdk/WeexSDK.xcodeproj/project.pbxproj | 24 ++
.../Sources/Component/WXComponent_internal.h | 3 +
.../WeexSDK/Sources/Component/WXEditComponent.m | 1 -
.../Sources/Component/WXTextAreaComponent.m | 16 +-
.../Sources/Display/WXComponent+BoxShadow.h | 37 +++
.../Sources/Display/WXComponent+BoxShadow.m | 91 ++++++
ios/sdk/WeexSDK/Sources/Display/WXInnerLayer.h | 19 ++
ios/sdk/WeexSDK/Sources/Display/WXInnerLayer.m | 87 +++++
ios/sdk/WeexSDK/Sources/Engine/WXSDKEngine.m | 11 +-
.../WeexSDK/Sources/Layout/WXComponent+Layout.m | 4 +
ios/sdk/WeexSDK/Sources/Model/WXComponent.m | 9 +-
ios/sdk/WeexSDK/Sources/Utility/WXBoxShadow.h | 31 ++
ios/sdk/WeexSDK/Sources/Utility/WXBoxShadow.m | 108 +++++++
ios/sdk/WeexSDK/Sources/Utility/WXConvert.h | 2 +
ios/sdk/WeexSDK/Sources/Utility/WXConvert.m | 16 +
.../Sources/View/WXComponent+ViewManagement.m | 15 +
38 files changed, 1197 insertions(+), 139 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/ba73ba7c/ios/sdk/WeexSDK.xcodeproj/project.pbxproj
----------------------------------------------------------------------
diff --cc ios/sdk/WeexSDK.xcodeproj/project.pbxproj
index 2111b76,0f2ff1e..d6a68f7
--- a/ios/sdk/WeexSDK.xcodeproj/project.pbxproj
+++ b/ios/sdk/WeexSDK.xcodeproj/project.pbxproj
@@@ -1537,9 -1490,9 +1559,10 @@@
74862F7E1E03A0F300B7A041 /* WXModuleMethod.m in Sources */,
742AD7341DF98C45007DC46C /* WXResourceResponse.m in Sources */,
77E65A161C155EB5008B8775 /* WXTextComponent.m in Sources */,
+ C4D872261E5DDF7500E39BC1 /* WXBoxShadow.m in Sources */,
746319031C60AFC100EFEBD4 /* WXThreadSafeCounter.m in Sources */,
74A4BAA71CB4F98300195969 /* WXStreamModule.m in Sources */,
+ 744D610D1E49978200B624B3 /* WXHeaderComponent.m in Sources */,
59597F991D2A041700EE9317 /* WXDebugLoggerBridge.m in Sources */,
77E659F21C0C3612008B8775 /* WXModuleFactory.m in Sources */,
DCF343681E49CAEE00A2FB34 /* WXJSExceptionInfo.m in Sources */,
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/ba73ba7c/ios/sdk/WeexSDK/Sources/Engine/WXSDKEngine.m
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/ba73ba7c/ios/sdk/WeexSDK/Sources/Model/WXComponent.m
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/ba73ba7c/ios/sdk/WeexSDK/Sources/Utility/WXConvert.h
----------------------------------------------------------------------
diff --cc ios/sdk/WeexSDK/Sources/Utility/WXConvert.h
index bef72d0,d9312bc..eb80aa6
--- a/ios/sdk/WeexSDK/Sources/Utility/WXConvert.h
+++ b/ios/sdk/WeexSDK/Sources/Utility/WXConvert.h
@@@ -11,7 -11,7 +11,8 @@@
#import "WXLog.h"
#import "WXLayoutDefine.h"
#import "WXType.h"
+#import "WXLength.h"
+ #import "WXBoxShadow.h"
@interface WXConvert : NSObject
@@@ -69,7 -69,7 +70,8 @@@ typedef BOOL WXClipType
+ (WXGradientType)gradientType:(id)value;
++ (WXLength *)WXLength:(id)value isFloat:(BOOL)isFloat scaleFactor:(CGFloat)scaleFactor;
+ + (WXBoxShadow *)WXBoxShadow:(id)value scaleFactor:(CGFloat)scaleFactor;
@end
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/ba73ba7c/ios/sdk/WeexSDK/Sources/Utility/WXConvert.m
----------------------------------------------------------------------
diff --cc ios/sdk/WeexSDK/Sources/Utility/WXConvert.m
index b72d7df,c497d28..ad9ba51
--- a/ios/sdk/WeexSDK/Sources/Utility/WXConvert.m
+++ b/ios/sdk/WeexSDK/Sources/Utility/WXConvert.m
@@@ -724,32 -723,21 +724,48 @@@ WX_NUMBER_CONVERT(NSUInteger, unsignedI
return type;
}
+#pragma mark - Length
+
++ (WXLength *)WXLength:(id)value isFloat:(BOOL)isFloat scaleFactor:(CGFloat)scaleFactor
+{
+ if (!value) {
+ return nil;
+ }
+
+ WXLengthType type = WXLengthTypeFixed;
+ if ([value isKindOfClass:[NSString class]]) {
+ if ([value isEqualToString:@"auto"]) {
+ type = WXLengthTypeAuto;
+ } else if ([value isEqualToString:@"normal"]){
+ type = WXLengthTypeNormal;
+ } else if ([value hasSuffix:@"%"]) {
+ type = WXLengthTypePercent;
+ }
+ } else if (![value isKindOfClass:[NSNumber class]]) {
+ WXAssert(NO, @"Unsupported type:%@ for WXLength", NSStringFromClass([value class]));
+ }
+
+ if (isFloat) {
+ return [WXLength lengthWithFloat:([value floatValue] * scaleFactor) type:type];
+ } else {
+ return [WXLength lengthWithInt:([value intValue] * scaleFactor) type:type];
+ }
++
+ + (WXBoxShadow *)WXBoxShadow:(id)value scaleFactor:(CGFloat)scaleFactor
+ {
+ NSString *boxShadow = @"";
+ if([value isKindOfClass:[NSString class]]){
+ boxShadow = value;
+ } else if([value isKindOfClass:[NSNumber class]]){
+ boxShadow = [((NSNumber *)value) stringValue];
+ } else if (value != nil) {
+ boxShadow = nil;
+ WXLogError(@"Convert Error:%@ can not be converted to boxshadow type", value);
+ }
+ if (boxShadow) {
+ return [WXBoxShadow getBoxShadowFromString:boxShadow scaleFactor:scaleFactor];
+ }
+ return nil;
}
@end
[03/25] incubator-weex git commit: Merge branch '0.11-dev' into
0.11-dev-suppport-recycler-component
Posted by cx...@apache.org.
Merge branch '0.11-dev' into 0.11-dev-suppport-recycler-component
# Conflicts:
# android/sdk/src/main/java/com/taobao/weex/ui/component/list/BasicListComponent.java
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/e2ecfeaa
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/e2ecfeaa
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/e2ecfeaa
Branch: refs/heads/0.11-dev-recycler
Commit: e2ecfeaa10bbdbfd03f04eb9a3798fb8d42719e1
Parents: aa80716 99b854a
Author: zshshr <zh...@gmail.com>
Authored: Tue Feb 21 11:12:30 2017 +0800
Committer: zshshr <zh...@gmail.com>
Committed: Tue Feb 21 11:12:30 2017 +0800
----------------------------------------------------------------------
.eslintignore | 4 +
.eslintrc | 1 +
.github/ISSUE_TEMPLATE.md | 30 +-
.github/PULL_REQUEST_TEMPLATE.md | 26 +-
.gitignore | 10 +
.travis.yml | 18 +-
.wwprc | 3 +-
Gemfile.lock | 10 +-
README.md | 39 +-
android/.gitignore | 3 +-
android/playground/app/build.gradle | 6 +-
.../com.taobao.taobao_2016.11.21_17.35.li | Bin 2415126 -> 0 bytes
android/run-ci.sh | 2 +-
.../main/java/com/taobao/weex/WXSDKEngine.java | 2 +-
.../com/taobao/weex/bridge/WXBridgeManager.java | 44 +-
.../java/com/taobao/weex/common/Constants.java | 13 +-
.../java/com/taobao/weex/dom/WXDomHandler.java | 2 +-
.../java/com/taobao/weex/dom/WXDomManager.java | 6 +-
.../main/java/com/taobao/weex/dom/WXStyle.java | 4 +-
.../com/taobao/weex/ui/WXRenderStatement.java | 14 +-
.../weex/ui/animation/WXAnimationModule.java | 4 +-
.../ui/component/AbstractEditComponent.java | 126 ++-
.../taobao/weex/ui/component/Scrollable.java | 4 +-
.../taobao/weex/ui/component/WXComponent.java | 6 +-
.../taobao/weex/ui/component/WXScroller.java | 126 ++-
.../weex/ui/component/WXSliderNeighbor.java | 12 +-
.../ui/component/list/BasicListComponent.java | 136 ++-
.../weex/ui/component/pesudo/PesudoStatus.java | 18 +-
.../taobao/weex/ui/module/WXTimerModule.java | 139 ++-
.../taobao/weex/ui/view/WXCircleViewPager.java | 38 +-
.../com/taobao/weex/ui/view/WXScrollView.java | 4 +
.../weex/ui/view/border/BorderDrawable.java | 30 +-
.../taobao/weex/ui/view/border/BorderEdge.java | 6 +-
.../weex/ui/view/border/BorderRadiusType.java | 222 +++++
.../view/border/BorderWidthStyleColorType.java | 224 +++++
.../listview/ExtendedLinearLayoutManager.java | 256 +++++
.../weex/ui/view/listview/WXRecyclerView.java | 3 +-
.../ui/component/list/WXListComponentTest.java | 19 +-
.../weex/ui/module/WXTimerModuleTest.java | 151 ++-
.../weex/ui/view/border/BorderDrawableTest.java | 4 +-
bin/dist-browser.sh | 2 +-
build/build.js | 5 +
build/config.js | 5 +-
build/karma.vue.conf.js | 44 +
build/webpack.examples.web.config.js | 68 ++
build/webpack.vue.config.js | 52 ++
doc/.gitignore | 5 -
doc/INSTALL.md | 38 -
doc/LICENSE | 202 ----
doc/NOTICE | 5 -
doc/README.md | 9 -
doc/SUMMARY.md | 95 --
doc/_config.yml | 323 +++++++
doc/_layouts/header.html | 269 ------
doc/_legacy/core-concepts/animation.md | 34 -
doc/_legacy/integrating.md | 3 -
doc/_legacy/syntax/javascript.md | 53 --
doc/advanced/extend-to-android.md | 160 ----
doc/advanced/extend-to-html5.md | 252 -----
doc/advanced/extend-to-ios.md | 262 ------
doc/advanced/how-data-binding-works.md | 32 -
doc/advanced/how-it-works.md | 140 ---
doc/advanced/integrate-to-android.md | 197 ----
doc/advanced/integrate-to-html5.md | 70 --
doc/advanced/integrate-to-ios.md | 109 ---
doc/advanced/main.md | 3 -
doc/ali_addition/weex_doc.css | 146 ---
doc/ali_addition/weex_doc.js | 78 --
doc/book.json | 19 -
doc/components/a.md | 25 -
doc/components/cell.md | 36 -
doc/components/div.md | 42 -
doc/components/image.md | 49 -
doc/components/indicator.md | 92 --
doc/components/input.md | 79 --
doc/components/list.md | 57 --
doc/components/main.md | 3 -
doc/components/refresh-loading.md | 27 -
doc/components/scroller.md | 70 --
doc/components/slider.md | 65 --
doc/components/special-element.md | 29 -
doc/components/switch.md | 55 --
doc/components/text.md | 60 --
doc/components/textarea.md | 74 --
doc/components/video.md | 49 -
doc/components/web.md | 49 -
doc/components/wxc-navpage.md | 68 --
doc/components/wxc-tabbar.md | 91 --
doc/demo/animation.md | 10 -
doc/demo/clipboard.md | 9 -
doc/demo/hello-world.md | 16 -
doc/demo/list.md | 9 -
doc/demo/main.md | 3 -
doc/demo/modal.md | 9 -
doc/demo/slider.md | 9 -
doc/faq.md | 127 ---
doc/guide.md | 3 -
doc/how-to/customize-a-native-component.md | 49 -
doc/how-to/cuszomize-native-apis.md | 73 --
doc/how-to/debug-with-html5.md | 40 -
doc/how-to/debug-with-remote-tools.md | 34 -
doc/how-to/main.md | 3 -
doc/how-to/preview-in-browser.md | 31 -
doc/how-to/preview-in-playground-app.md | 13 -
doc/how-to/require-3rd-party-libs.md | 50 -
doc/how-to/transform-code-into-js-bundle.md | 98 --
doc/images/css-boxmodel.png | Bin 12581 -> 0 bytes
doc/images/css-flexbox-align.jpg | Bin 35005 -> 0 bytes
doc/images/css-flexbox-justify.svg | 59 --
doc/images/css-flexbox-sample.png | Bin 3210 -> 0 bytes
doc/images/how-arch.png | Bin 62303 -> 0 bytes
doc/images/how-render.png | Bin 42957 -> 0 bytes
doc/images/snapshot-animation.gif | Bin 521431 -> 0 bytes
doc/images/snapshot-calculator.jpg | Bin 28504 -> 0 bytes
doc/images/snapshot-helloworld.png | Bin 6092 -> 0 bytes
doc/images/snapshot-minesweeper.jpg | Bin 53257 -> 0 bytes
doc/images/snapshot-modals.jpg | Bin 27458 -> 0 bytes
doc/images/snapshot-skeletons.gif | Bin 518271 -> 0 bytes
doc/images/tut-cli-qrcode.png | Bin 45480 -> 0 bytes
doc/images/tut-first.png | Bin 51434 -> 0 bytes
doc/images/tut-second.png | Bin 78519 -> 0 bytes
doc/images/tut1.jpg | Bin 47442 -> 0 bytes
doc/images/tut2.jpg | Bin 52428 -> 0 bytes
doc/images/tut3.png | Bin 52198 -> 0 bytes
doc/images/tut4.gif | Bin 218245 -> 0 bytes
doc/modules/animation.md | 64 --
doc/modules/clipboard.md | 48 -
doc/modules/dom.md | 109 ---
doc/modules/globalevent.md | 76 --
doc/modules/main.md | 13 -
doc/modules/modal.md | 114 ---
doc/modules/navigator.md | 52 --
doc/modules/storage.md | 104 ---
doc/modules/stream.md | 52 --
doc/modules/timer.md | 66 --
doc/modules/webview.md | 62 --
doc/package.json | 24 +
doc/references/api.md | 78 --
doc/references/bootstrap.md | 41 -
doc/references/cheatsheet.md | 102 --
doc/references/color-names.md | 175 ----
doc/references/common-attrs.md | 80 --
doc/references/common-event.md | 121 ---
doc/references/common-style.md | 202 ----
doc/references/component-defs.md | 125 ---
doc/references/events/appear.md | 28 -
doc/references/events/blur.md | 42 -
doc/references/events/change.md | 47 -
doc/references/events/click.md | 43 -
doc/references/events/disappear.md | 28 -
doc/references/events/focus.md | 42 -
doc/references/events/input.md | 45 -
doc/references/gesture.md | 66 --
doc/references/main.md | 3 -
doc/references/replace.md | 57 --
doc/references/styles/background-color.md | 25 -
doc/references/styles/color.md | 26 -
doc/references/styles/font-family.md | 27 -
doc/references/styles/font-size.md | 31 -
doc/references/styles/font-style.md | 25 -
doc/references/styles/font-weight.md | 26 -
doc/references/styles/line-height.md | 27 -
doc/references/styles/lines.md | 27 -
doc/references/styles/main.md | 42 -
doc/references/styles/opacity.md | 22 -
doc/references/styles/position.md | 26 -
doc/references/styles/text-align.md | 26 -
doc/references/styles/text-decoration.md | 26 -
doc/references/styles/text-overflow.md | 32 -
doc/references/styles/units/color.md | 30 -
doc/references/styles/units/length.md | 12 -
doc/references/styles/units/number.md | 7 -
doc/references/styles/units/percentage.md | 5 -
doc/references/text-style.md | 36 -
doc/scaffolds/draft.md | 4 +
doc/scaffolds/page.md | 4 +
doc/scaffolds/post.md | 5 +
doc/source/_posts/cn/hello.md | 6 +
doc/source/_posts/hello_world.md | 6 +
doc/source/blog/index.md | 4 +
doc/source/cn/blog/index.md | 4 +
doc/source/cn/download.ejs | 3 +
doc/source/cn/faq.md | 227 +++++
doc/source/cn/guide/.gitkeep | 0
doc/source/cn/guide/dev-with-weexpack.md | 11 +
doc/source/cn/guide/images/flow.png | Bin 0 -> 57741 bytes
doc/source/cn/guide/images/tut-cli-qrcode.png | Bin 0 -> 45480 bytes
doc/source/cn/guide/images/tut-first.png | Bin 0 -> 51434 bytes
doc/source/cn/guide/images/tut-second.png | Bin 0 -> 78519 bytes
doc/source/cn/guide/images/tut1.jpg | Bin 0 -> 47442 bytes
doc/source/cn/guide/images/tut2.jpg | Bin 0 -> 52428 bytes
doc/source/cn/guide/images/tut3.png | Bin 0 -> 52198 bytes
doc/source/cn/guide/images/tut4.gif | Bin 0 -> 218245 bytes
doc/source/cn/guide/index.md | 125 +++
doc/source/cn/guide/integrate-to-your-app.md | 321 +++++++
doc/source/cn/guide/intro/app-architecture.md | 77 ++
doc/source/cn/guide/intro/how-it-works.md | 66 ++
doc/source/cn/guide/intro/index.md | 15 +
doc/source/cn/guide/intro/page-architecture.md | 48 +
doc/source/cn/guide/intro/using-vue.md | 101 ++
doc/source/cn/guide/intro/web-dev-experience.md | 42 +
doc/source/cn/guide/intro/write-once.md | 25 +
doc/source/cn/index.md | 4 +
doc/source/cn/playground.ejs | 3 +
.../cn/references/advanced/extend-jsfm.md | 172 ++++
.../cn/references/advanced/extend-to-android.md | 144 +++
.../cn/references/advanced/extend-to-html5.md | 103 +++
.../cn/references/advanced/extend-to-ios.md | 235 +++++
doc/source/cn/references/advanced/index.md | 15 +
.../advanced/integrate-devtool-to-android.md | 271 ++++++
.../advanced/integrate-devtool-to-ios.md | 229 +++++
doc/source/cn/references/android-apis.md | 214 +++++
doc/source/cn/references/color-names.md | 180 ++++
doc/source/cn/references/common-event.md | 138 +++
doc/source/cn/references/common-style.md | 312 +++++++
doc/source/cn/references/components/a.md | 104 +++
doc/source/cn/references/components/cell.md | 105 +++
doc/source/cn/references/components/div.md | 116 +++
doc/source/cn/references/components/image.md | 159 ++++
doc/source/cn/references/components/index.md | 24 +
.../cn/references/components/indicator.md | 135 +++
doc/source/cn/references/components/input.md | 172 ++++
doc/source/cn/references/components/list.md | 158 ++++
doc/source/cn/references/components/loading.md | 125 +++
doc/source/cn/references/components/refresh.md | 125 +++
doc/source/cn/references/components/scroller.md | 174 ++++
doc/source/cn/references/components/slider.md | 105 +++
doc/source/cn/references/components/switch.md | 133 +++
doc/source/cn/references/components/text.md | 101 ++
doc/source/cn/references/components/textarea.md | 155 ++++
doc/source/cn/references/components/video.md | 94 ++
doc/source/cn/references/components/web.md | 154 ++++
doc/source/cn/references/gesture.md | 59 ++
doc/source/cn/references/html5-apis.md | 10 +
doc/source/cn/references/images/Artboard.jpg | Bin 0 -> 36223 bytes
.../cn/references/images/coding_weex_1.jpg | Bin 0 -> 56225 bytes
.../cn/references/images/css-boxmodel.png | Bin 0 -> 12581 bytes
.../cn/references/images/css-flexbox-align.jpg | Bin 0 -> 35005 bytes
.../references/images/css-flexbox-justify.svg | 59 ++
.../cn/references/images/css-flexbox-sample.png | Bin 0 -> 3210 bytes
doc/source/cn/references/images/div_1.jpg | Bin 0 -> 59561 bytes
doc/source/cn/references/images/div_2.jpg | Bin 0 -> 62574 bytes
doc/source/cn/references/images/div_3.jpg | Bin 0 -> 82345 bytes
doc/source/cn/references/images/div_4.jpg | Bin 0 -> 200642 bytes
doc/source/cn/references/images/image_1.jpg | Bin 0 -> 163705 bytes
doc/source/cn/references/images/image_2.jpg | Bin 0 -> 255560 bytes
doc/source/cn/references/images/list_2.jpg | Bin 0 -> 56635 bytes
doc/source/cn/references/images/list_3.jpg | Bin 0 -> 128082 bytes
doc/source/cn/references/images/list_4.jpg | Bin 0 -> 339799 bytes
doc/source/cn/references/images/nav.jpg | Bin 0 -> 124441 bytes
doc/source/cn/references/images/nav.png | Bin 0 -> 83497 bytes
doc/source/cn/references/images/scroller_1.jpg | Bin 0 -> 344783 bytes
doc/source/cn/references/images/style_1.jpg | Bin 0 -> 59366 bytes
doc/source/cn/references/images/style_2.jpg | Bin 0 -> 59696 bytes
doc/source/cn/references/index.md | 17 +
doc/source/cn/references/ios-apis.md | 91 ++
doc/source/cn/references/jsfm-apis.md | 66 ++
.../cn/references/migration/difference.md | 249 +++++
doc/source/cn/references/migration/index.md | 11 +
.../references/migration/migration-from-weex.md | 116 +++
doc/source/cn/references/modules/animation.md | 96 ++
doc/source/cn/references/modules/clipboard.md | 101 ++
doc/source/cn/references/modules/dom.md | 210 +++++
doc/source/cn/references/modules/globalevent.md | 88 ++
doc/source/cn/references/modules/index.md | 30 +
doc/source/cn/references/modules/modal.md | 139 +++
doc/source/cn/references/modules/navigator.md | 90 ++
doc/source/cn/references/modules/picker.md | 129 +++
doc/source/cn/references/modules/storage.md | 184 ++++
doc/source/cn/references/modules/stream.md | 124 +++
doc/source/cn/references/modules/webview.md | 137 +++
doc/source/cn/references/native-dom-api.md | 223 +++++
doc/source/cn/references/path.md | 37 +
doc/source/cn/references/platform-difference.md | 70 ++
doc/source/cn/references/text-style.md | 46 +
doc/source/cn/references/unit.md | 64 ++
.../cn/references/vue/difference-of-vuex.md | 87 ++
.../cn/references/vue/difference-with-web.md | 138 +++
doc/source/cn/references/vue/index.md | 12 +
doc/source/cn/references/web-standards.md | 584 ++++++++++++
doc/source/cn/references/weex-variable.md | 47 +
.../cn/v-0.10/advanced/create-a-weex-project.md | 271 ++++++
.../advanced/customize-a-native-component.md | 168 ++++
.../cn/v-0.10/advanced/cuszomize-native-apis.md | 85 ++
.../cn/v-0.10/advanced/extend-to-android.md | 145 +++
.../cn/v-0.10/advanced/extend-to-html5.md | 253 +++++
doc/source/cn/v-0.10/advanced/extend-to-ios.md | 129 +++
.../v-0.10/advanced/how-data-binding-works.md | 39 +
.../cn/v-0.10/advanced/images/how-arch.png | Bin 0 -> 62303 bytes
.../cn/v-0.10/advanced/images/how-render.png | Bin 0 -> 42957 bytes
doc/source/cn/v-0.10/advanced/index.md | 146 +++
.../advanced/integrate-devtools-to-android.md | 272 ++++++
.../advanced/integrate-devtools-to-ios.md | 230 +++++
.../cn/v-0.10/advanced/integrate-to-android.md | 201 ++++
.../cn/v-0.10/advanced/integrate-to-html5.md | 69 ++
.../cn/v-0.10/advanced/integrate-to-ios.md | 110 +++
doc/source/cn/v-0.10/blog/index.md | 4 +
.../guide/develop-on-your-local-machine.md | 175 ++++
.../cn/v-0.10/guide/how-to/debug-with-html5.md | 47 +
doc/source/cn/v-0.10/guide/how-to/index.md | 185 ++++
.../guide/how-to/require-3rd-party-libs.md | 57 ++
.../how-to/transform-code-into-js-bundle.md | 112 +++
doc/source/cn/v-0.10/guide/index.md | 60 ++
doc/source/cn/v-0.10/guide/syntax/comm.md | 134 +++
.../v-0.10/guide/syntax/composed-component.md | 158 ++++
.../cn/v-0.10/guide/syntax/config-n-data.md | 72 ++
.../cn/v-0.10/guide/syntax/data-binding.md | 332 +++++++
.../cn/v-0.10/guide/syntax/display-logic.md | 252 +++++
doc/source/cn/v-0.10/guide/syntax/events.md | 103 +++
doc/source/cn/v-0.10/guide/syntax/id.md | 124 +++
doc/source/cn/v-0.10/guide/syntax/index.md | 134 +++
.../cn/v-0.10/guide/syntax/render-logic.md | 44 +
.../cn/v-0.10/guide/syntax/style-n-class.md | 117 +++
doc/source/cn/v-0.10/index.md | 5 +
doc/source/cn/v-0.10/references/api.md | 67 ++
doc/source/cn/v-0.10/references/cheatsheet.md | 114 +++
doc/source/cn/v-0.10/references/color-names.md | 180 ++++
doc/source/cn/v-0.10/references/common-attrs.md | 166 ++++
doc/source/cn/v-0.10/references/common-event.md | 492 ++++++++++
doc/source/cn/v-0.10/references/common-style.md | 322 +++++++
.../cn/v-0.10/references/component-defs.md | 126 +++
doc/source/cn/v-0.10/references/components/a.md | 273 ++++++
.../cn/v-0.10/references/components/cell.md | 191 ++++
.../cn/v-0.10/references/components/div.md | 245 +++++
.../cn/v-0.10/references/components/image.md | 161 ++++
.../cn/v-0.10/references/components/index.md | 24 +
.../v-0.10/references/components/indicator.md | 124 +++
.../cn/v-0.10/references/components/input.md | 143 +++
.../cn/v-0.10/references/components/list.md | 375 ++++++++
.../cn/v-0.10/references/components/loading.md | 118 +++
.../cn/v-0.10/references/components/refresh.md | 204 ++++
.../cn/v-0.10/references/components/scroller.md | 324 +++++++
.../cn/v-0.10/references/components/slider.md | 121 +++
.../cn/v-0.10/references/components/switch.md | 98 ++
.../cn/v-0.10/references/components/text.md | 116 +++
.../cn/v-0.10/references/components/textarea.md | 115 +++
.../cn/v-0.10/references/components/video.md | 82 ++
.../cn/v-0.10/references/components/web.md | 143 +++
doc/source/cn/v-0.10/references/gesture.md | 79 ++
.../cn/v-0.10/references/images/Artboard.jpg | Bin 0 -> 36223 bytes
.../v-0.10/references/images/coding_weex_1.jpg | Bin 0 -> 56225 bytes
.../v-0.10/references/images/css-boxmodel.png | Bin 0 -> 12581 bytes
.../references/images/css-flexbox-align.jpg | Bin 0 -> 35005 bytes
.../references/images/css-flexbox-justify.svg | 59 ++
.../cn/v-0.10/references/images/div_1.jpg | Bin 0 -> 59561 bytes
.../cn/v-0.10/references/images/div_2.jpg | Bin 0 -> 62574 bytes
.../cn/v-0.10/references/images/div_3.jpg | Bin 0 -> 82345 bytes
.../cn/v-0.10/references/images/div_4.jpg | Bin 0 -> 200642 bytes
.../cn/v-0.10/references/images/image_1.jpg | Bin 0 -> 163705 bytes
.../cn/v-0.10/references/images/image_2.jpg | Bin 0 -> 255560 bytes
.../cn/v-0.10/references/images/list_2.jpg | Bin 0 -> 56635 bytes
.../cn/v-0.10/references/images/list_3.jpg | Bin 0 -> 128082 bytes
.../cn/v-0.10/references/images/list_4.jpg | Bin 0 -> 339799 bytes
doc/source/cn/v-0.10/references/images/nav.jpg | Bin 0 -> 124441 bytes
.../cn/v-0.10/references/images/scroller_1.jpg | Bin 0 -> 344783 bytes
.../cn/v-0.10/references/images/style_1.jpg | Bin 0 -> 59366 bytes
.../cn/v-0.10/references/images/style_2.jpg | Bin 0 -> 59696 bytes
doc/source/cn/v-0.10/references/index.md | 46 +
.../cn/v-0.10/references/modules/animation.md | 90 ++
.../cn/v-0.10/references/modules/clipboard.md | 112 +++
doc/source/cn/v-0.10/references/modules/dom.md | 79 ++
.../cn/v-0.10/references/modules/globalevent.md | 87 ++
.../cn/v-0.10/references/modules/index.md | 20 +
.../cn/v-0.10/references/modules/modal.md | 196 ++++
.../cn/v-0.10/references/modules/navigator.md | 110 +++
.../cn/v-0.10/references/modules/storage.md | 224 +++++
.../cn/v-0.10/references/modules/stream.md | 220 +++++
.../cn/v-0.10/references/modules/webview.md | 66 ++
doc/source/cn/v-0.10/references/replace.md | 57 ++
.../cn/v-0.10/references/special-element.md | 38 +
doc/source/cn/v-0.10/references/specs/index.md | 309 +++++++
.../references/specs/js-framework-apis.md | 190 ++++
.../v-0.10/references/specs/virtual-dom-apis.md | 148 +++
doc/source/cn/v-0.10/references/text-style.md | 40 +
doc/source/cn/v-0.10/references/units.md | 66 ++
doc/source/cn/v-0.10/references/wxc/index.md | 44 +
.../cn/v-0.10/references/wxc/wxc-navpage.md | 192 ++++
.../cn/v-0.10/references/wxc/wxc-tabbar.md | 176 ++++
doc/source/cn/v-0.10/tools/devtools-android.md | 123 +++
doc/source/cn/v-0.10/tools/devtools-ios.md | 65 ++
doc/source/cn/v-0.10/tools/devtools.md | 99 ++
doc/source/cn/v-0.10/tools/index.md | 96 ++
doc/source/cn/v-0.10/tools/playground.md | 22 +
doc/source/cn/v-0.10/tools/transformer.md | 38 +
doc/source/download.ejs | 3 +
doc/source/examples/a.md | 39 +
doc/source/examples/animation.md | 47 +
doc/source/examples/clipboard.md | 64 ++
doc/source/examples/div.md | 27 +
doc/source/examples/dom-rect.md | 67 ++
doc/source/examples/dom-scroll.md | 93 ++
doc/source/examples/image.md | 58 ++
doc/source/examples/indicator.md | 80 ++
doc/source/examples/input.md | 68 ++
doc/source/examples/list.md | 64 ++
doc/source/examples/modal.md | 81 ++
doc/source/examples/navigator.md | 54 ++
doc/source/examples/refresh.md | 74 ++
doc/source/examples/scroller.md | 92 ++
doc/source/examples/slider.md | 53 ++
doc/source/examples/storage.md | 103 +++
doc/source/examples/stream.md | 74 ++
doc/source/examples/switch.md | 69 ++
doc/source/examples/text.md | 44 +
doc/source/examples/textarea.md | 68 ++
doc/source/examples/video.md | 55 ++
doc/source/examples/web.md | 97 ++
doc/source/faq.md | 210 +++++
doc/source/guide/.gitkeep | 0
doc/source/guide/dev-with-weexpack.md | 12 +
doc/source/guide/images/flow.png | Bin 0 -> 57741 bytes
doc/source/guide/images/tut-cli-qrcode.png | Bin 0 -> 45480 bytes
doc/source/guide/images/tut-first.png | Bin 0 -> 51434 bytes
doc/source/guide/images/tut-second.png | Bin 0 -> 78519 bytes
doc/source/guide/images/tut1.jpg | Bin 0 -> 47442 bytes
doc/source/guide/images/tut2.jpg | Bin 0 -> 52428 bytes
doc/source/guide/images/tut3.png | Bin 0 -> 52198 bytes
doc/source/guide/images/tut4.gif | Bin 0 -> 218245 bytes
doc/source/guide/index.md | 11 +
doc/source/guide/integrate-to-your-app.md | 11 +
doc/source/guide/intro/app-architecture.md | 10 +
doc/source/guide/intro/how-it-works.md | 12 +
doc/source/guide/intro/index.md | 17 +
doc/source/guide/intro/page-architecture.md | 10 +
doc/source/guide/intro/using-vue.md | 10 +
doc/source/guide/intro/web-dev-experience.md | 11 +
doc/source/guide/intro/write-once.md | 10 +
doc/source/index.md | 4 +
doc/source/playground.ejs | 3 +
doc/source/references/advanced/extend-jsfm.md | 10 +
.../references/advanced/extend-to-android.md | 160 ++++
.../references/advanced/extend-to-html5.md | 10 +
doc/source/references/advanced/extend-to-ios.md | 262 ++++++
doc/source/references/advanced/index.md | 15 +
.../advanced/integrate-devtool-to-android.md | 11 +
.../advanced/integrate-devtool-to-ios.md | 10 +
doc/source/references/android-apis.md | 10 +
doc/source/references/color-names.md | 182 ++++
doc/source/references/common-event.md | 129 +++
doc/source/references/common-style.md | 208 +++++
doc/source/references/components/a.md | 71 ++
doc/source/references/components/cell.md | 42 +
doc/source/references/components/div.md | 64 ++
doc/source/references/components/image.md | 106 +++
doc/source/references/components/index.md | 24 +
doc/source/references/components/indicator.md | 121 +++
doc/source/references/components/input.md | 149 +++
doc/source/references/components/list.md | 175 ++++
doc/source/references/components/refresh.md | 216 +++++
doc/source/references/components/scroller.md | 152 +++
doc/source/references/components/slider.md | 93 ++
doc/source/references/components/switch.md | 117 +++
doc/source/references/components/text.md | 98 ++
doc/source/references/components/textarea.md | 135 +++
doc/source/references/components/video.md | 89 ++
doc/source/references/components/web.md | 149 +++
doc/source/references/gesture.md | 53 ++
doc/source/references/html5-apis.md | 10 +
doc/source/references/images/css-boxmodel.png | Bin 0 -> 12581 bytes
.../references/images/css-flexbox-align.jpg | Bin 0 -> 35005 bytes
.../references/images/css-flexbox-justify.svg | 59 ++
.../references/images/css-flexbox-sample.png | Bin 0 -> 3210 bytes
doc/source/references/images/nav.png | Bin 0 -> 83497 bytes
doc/source/references/index.md | 17 +
doc/source/references/ios-apis.md | 12 +
doc/source/references/jsfm-apis.md | 66 ++
doc/source/references/migration/difference.md | 10 +
doc/source/references/migration/index.md | 11 +
.../references/migration/migration-from-weex.md | 10 +
doc/source/references/modules/animation.md | 106 +++
doc/source/references/modules/clipboard.md | 98 ++
doc/source/references/modules/dom.md | 204 ++++
doc/source/references/modules/globalevent.md | 89 ++
doc/source/references/modules/index.md | 29 +
doc/source/references/modules/modal.md | 144 +++
doc/source/references/modules/navigator.md | 89 ++
doc/source/references/modules/picker.md | 129 +++
doc/source/references/modules/storage.md | 172 ++++
doc/source/references/modules/stream.md | 131 +++
doc/source/references/modules/webview.md | 155 ++++
doc/source/references/native-dom-api.md | 11 +
doc/source/references/path.md | 37 +
doc/source/references/text-style.md | 50 +
doc/source/references/unit.md | 11 +
doc/source/references/vue/difference-of-vuex.md | 10 +
.../references/vue/difference-with-web.md | 10 +
doc/source/references/vue/index.md | 11 +
doc/source/references/web-standards.md | 584 ++++++++++++
doc/source/references/weex-variable.md | 10 +
doc/source/v-0.10/advanced/extend-to-android.md | 162 ++++
doc/source/v-0.10/advanced/extend-to-html5.md | 258 ++++++
doc/source/v-0.10/advanced/extend-to-ios.md | 272 ++++++
.../v-0.10/advanced/how-data-binding-works.md | 39 +
doc/source/v-0.10/advanced/images/how-arch.png | Bin 0 -> 62303 bytes
.../v-0.10/advanced/images/how-render.png | Bin 0 -> 42957 bytes
doc/source/v-0.10/advanced/index.md | 148 +++
.../v-0.10/advanced/integrate-to-android.md | 204 ++++
.../v-0.10/advanced/integrate-to-html5.md | 77 ++
doc/source/v-0.10/advanced/integrate-to-ios.md | 118 +++
doc/source/v-0.10/guide/.gitkeep | 0
.../how-to/customize-a-native-component.md | 58 ++
.../guide/how-to/cuszomize-native-apis.md | 80 ++
.../v-0.10/guide/how-to/debug-with-html5.md | 47 +
doc/source/v-0.10/guide/how-to/index.md | 40 +
.../guide/how-to/preview-in-playground-app.md | 20 +
.../guide/how-to/require-3rd-party-libs.md | 56 ++
.../how-to/transform-code-into-js-bundle.md | 110 +++
.../v-0.10/guide/images/tut-cli-qrcode.png | Bin 0 -> 45480 bytes
doc/source/v-0.10/guide/images/tut-first.png | Bin 0 -> 51434 bytes
doc/source/v-0.10/guide/images/tut-second.png | Bin 0 -> 78519 bytes
doc/source/v-0.10/guide/images/tut1.jpg | Bin 0 -> 47442 bytes
doc/source/v-0.10/guide/images/tut2.jpg | Bin 0 -> 52428 bytes
doc/source/v-0.10/guide/images/tut3.png | Bin 0 -> 52198 bytes
doc/source/v-0.10/guide/images/tut4.gif | Bin 0 -> 218245 bytes
doc/source/v-0.10/guide/index.md | 211 +++++
doc/source/v-0.10/guide/syntax/comm.md | 228 +++++
.../v-0.10/guide/syntax/composed-component.md | 114 +++
doc/source/v-0.10/guide/syntax/config-n-data.md | 61 ++
doc/source/v-0.10/guide/syntax/data-binding.md | 248 +++++
doc/source/v-0.10/guide/syntax/display-logic.md | 173 ++++
doc/source/v-0.10/guide/syntax/events.md | 59 ++
doc/source/v-0.10/guide/syntax/id.md | 65 ++
doc/source/v-0.10/guide/syntax/index.md | 122 +++
doc/source/v-0.10/guide/syntax/render-logic.md | 35 +
doc/source/v-0.10/guide/syntax/style-n-class.md | 118 +++
doc/source/v-0.10/references/api.md | 84 ++
doc/source/v-0.10/references/cheatsheet.md | 102 ++
doc/source/v-0.10/references/color-names.md | 182 ++++
doc/source/v-0.10/references/common-attrs.md | 78 ++
doc/source/v-0.10/references/common-event.md | 120 +++
doc/source/v-0.10/references/common-style.md | 208 +++++
doc/source/v-0.10/references/component-defs.md | 131 +++
doc/source/v-0.10/references/components/a.md | 50 +
doc/source/v-0.10/references/components/cell.md | 42 +
doc/source/v-0.10/references/components/div.md | 48 +
.../v-0.10/references/components/image.md | 55 ++
.../v-0.10/references/components/index.md | 24 +
.../v-0.10/references/components/indicator.md | 98 ++
.../v-0.10/references/components/input.md | 124 +++
doc/source/v-0.10/references/components/list.md | 293 ++++++
.../references/components/refresh-loading.md | 298 ++++++
.../v-0.10/references/components/scroller.md | 136 +++
.../v-0.10/references/components/slider.md | 107 +++
.../v-0.10/references/components/switch.md | 81 ++
doc/source/v-0.10/references/components/text.md | 94 ++
.../v-0.10/references/components/textarea.md | 81 ++
.../v-0.10/references/components/video.md | 75 ++
doc/source/v-0.10/references/components/web.md | 152 +++
.../v-0.10/references/components/wxc-navpage.md | 74 ++
.../v-0.10/references/components/wxc-tabbar.md | 94 ++
doc/source/v-0.10/references/gesture.md | 74 ++
.../v-0.10/references/images/css-boxmodel.png | Bin 0 -> 12581 bytes
.../references/images/css-flexbox-align.jpg | Bin 0 -> 35005 bytes
.../references/images/css-flexbox-justify.svg | 59 ++
.../references/images/css-flexbox-sample.png | Bin 0 -> 3210 bytes
doc/source/v-0.10/references/images/nav.png | Bin 0 -> 83497 bytes
doc/source/v-0.10/references/index.md | 49 +
.../v-0.10/references/modules/animation.md | 63 ++
.../v-0.10/references/modules/clipboard.md | 53 ++
doc/source/v-0.10/references/modules/dom.md | 114 +++
.../v-0.10/references/modules/globalevent.md | 89 ++
doc/source/v-0.10/references/modules/index.md | 28 +
doc/source/v-0.10/references/modules/modal.md | 192 ++++
.../v-0.10/references/modules/navigator.md | 198 ++++
doc/source/v-0.10/references/modules/storage.md | 111 +++
doc/source/v-0.10/references/modules/stream.md | 86 ++
doc/source/v-0.10/references/modules/timer.md | 60 ++
doc/source/v-0.10/references/modules/webview.md | 160 ++++
doc/source/v-0.10/references/special-element.md | 36 +
doc/source/v-0.10/references/specs/index.md | 309 +++++++
.../v-0.10/references/specs/js-bundle-format.md | 307 ++++++
.../references/specs/js-framework-apis.md | 191 ++++
.../v-0.10/references/specs/virtual-dom-apis.md | 147 +++
doc/source/v-0.10/references/text-style.md | 43 +
doc/source/v-0.10/tools/devtools-android.md | 123 +++
doc/source/v-0.10/tools/devtools-ios.md | 76 ++
doc/source/v-0.10/tools/devtools.md | 102 ++
doc/source/v-0.10/tools/index.md | 97 ++
doc/source/v-0.10/tools/playground.md | 24 +
doc/source/v-0.10/tools/transformer.md | 38 +
doc/specs/js-bundle-format.md | 300 ------
doc/specs/js-framework-apis.md | 184 ----
doc/specs/virtual-dom-apis.md | 140 ---
doc/syntax/comm.md | 222 -----
doc/syntax/composed-component.md | 108 ---
doc/syntax/config-n-data.md | 55 --
doc/syntax/data-binding.md | 241 -----
doc/syntax/display-logic.md | 169 ----
doc/syntax/events.md | 54 --
doc/syntax/id.md | 59 --
doc/syntax/main.md | 116 ---
doc/syntax/render-logic.md | 29 -
doc/syntax/style-n-class.md | 106 ---
doc/themes/weex/_config.yml | 42 +
doc/themes/weex/languages/cn.yml | 103 +++
doc/themes/weex/languages/en.yml | 104 +++
.../weex/layout/_partial/after-footer.ejs | 3 +
.../weex/layout/_partial/archive-post.ejs | 11 +
doc/themes/weex/layout/_partial/archive.ejs | 19 +
doc/themes/weex/layout/_partial/article.ejs | 11 +
doc/themes/weex/layout/_partial/footer.ejs | 28 +
doc/themes/weex/layout/_partial/head.ejs | 36 +
doc/themes/weex/layout/_partial/header.ejs | 49 +
.../weex/layout/_partial/post/category.ejs | 10 +
doc/themes/weex/layout/_partial/post/nav.ejs | 8 +
.../weex/layout/_partial/post/summary.ejs | 43 +
doc/themes/weex/layout/_partial/post/title.ejs | 18 +
doc/themes/weex/layout/_partial/search-form.ejs | 8 +
doc/themes/weex/layout/_partial/sidebar.ejs | 56 ++
doc/themes/weex/layout/_partial/slider.ejs | 17 +
doc/themes/weex/layout/archive.ejs | 3 +
doc/themes/weex/layout/blog.ejs | 3 +
doc/themes/weex/layout/category.ejs | 1 +
doc/themes/weex/layout/download.ejs | 20 +
doc/themes/weex/layout/example.ejs | 40 +
doc/themes/weex/layout/index.ejs | 211 +++++
doc/themes/weex/layout/layout.ejs | 17 +
doc/themes/weex/layout/page.ejs | 6 +
doc/themes/weex/layout/playground.ejs | 30 +
doc/themes/weex/layout/post.ejs | 3 +
doc/themes/weex/layout/tag.ejs | 1 +
doc/themes/weex/scripts/helper.js | 38 +
doc/themes/weex/source/css/animation.scss | 250 +++++
doc/themes/weex/source/css/atom-one-dark.scss | 96 ++
doc/themes/weex/source/css/blog.scss | 36 +
doc/themes/weex/source/css/common.scss | 250 +++++
doc/themes/weex/source/css/example.scss | 103 +++
doc/themes/weex/source/css/index.scss | 540 +++++++++++
doc/themes/weex/source/css/media-queries.scss | 190 ++++
.../weex/source/css/partial/article-title.scss | 28 +
doc/themes/weex/source/css/partial/article.scss | 68 ++
doc/themes/weex/source/css/partial/footer.scss | 62 ++
doc/themes/weex/source/css/partial/header.scss | 104 +++
.../weex/source/css/partial/highlight.scss | 108 +++
.../weex/source/css/partial/search-form.scss | 74 ++
doc/themes/weex/source/css/partial/sidebar.scss | 74 ++
doc/themes/weex/source/css/partial/summary.scss | 48 +
doc/themes/weex/source/css/playground.scss | 50 +
doc/themes/weex/source/css/post.scss | 66 ++
doc/themes/weex/source/css/style.scss | 28 +
doc/themes/weex/source/css/swiper.min.css | 15 +
doc/themes/weex/source/css/variable.scss | 40 +
doc/themes/weex/source/images/_slide1.png | Bin 0 -> 381001 bytes
.../weex/source/images/ali-open-source.png | Bin 0 -> 2193 bytes
doc/themes/weex/source/images/alibaba.png | Bin 0 -> 2107 bytes
doc/themes/weex/source/images/aliyun.png | Bin 0 -> 1292 bytes
doc/themes/weex/source/images/android.png | Bin 0 -> 5973 bytes
doc/themes/weex/source/images/avatar.png | Bin 0 -> 32736 bytes
doc/themes/weex/source/images/cainiao.png | Bin 0 -> 3353 bytes
doc/themes/weex/source/images/ding.png | Bin 0 -> 5929 bytes
doc/themes/weex/source/images/extendable.svg | 51 +
doc/themes/weex/source/images/feature.png | Bin 0 -> 1090905 bytes
doc/themes/weex/source/images/feizhu.jpg | Bin 0 -> 5988 bytes
doc/themes/weex/source/images/flow.png | Bin 0 -> 14440 bytes
doc/themes/weex/source/images/galaxy_1.svg | 53 ++
doc/themes/weex/source/images/galaxy_2.svg | 53 ++
doc/themes/weex/source/images/ios.png | Bin 0 -> 6272 bytes
doc/themes/weex/source/images/level1.png | Bin 0 -> 14951 bytes
doc/themes/weex/source/images/level2.png | Bin 0 -> 101449 bytes
doc/themes/weex/source/images/level3.png | Bin 0 -> 101212 bytes
doc/themes/weex/source/images/level4.png | Bin 0 -> 339831 bytes
doc/themes/weex/source/images/lightweight.svg | 31 +
doc/themes/weex/source/images/logo.png | Bin 0 -> 5398 bytes
doc/themes/weex/source/images/logo.svg | 29 +
doc/themes/weex/source/images/performance.svg | 29 +
doc/themes/weex/source/images/playground.png | Bin 0 -> 12659 bytes
doc/themes/weex/source/images/qr.png | Bin 0 -> 1801 bytes
doc/themes/weex/source/images/slide1.png | Bin 0 -> 226303 bytes
doc/themes/weex/source/images/taobao.png | Bin 0 -> 3074 bytes
doc/themes/weex/source/images/tmall.png | Bin 0 -> 8562 bytes
doc/themes/weex/source/images/vue-logo.png | Bin 0 -> 5346 bytes
doc/themes/weex/source/images/vue.png | Bin 0 -> 16582 bytes
doc/themes/weex/source/images/web.png | Bin 0 -> 9297 bytes
doc/themes/weex/source/images/xiami.png | Bin 0 -> 2615 bytes
doc/themes/weex/source/images/youku.png | Bin 0 -> 2178 bytes
doc/themes/weex/source/js/common.js | 522 +++++++++++
doc/themes/weex/source/js/example.js | 37 +
doc/themes/weex/source/js/examples/a.web.js | 528 +++++++++++
doc/themes/weex/source/js/examples/a.weex.js | 198 ++++
.../weex/source/js/examples/animation.web.js | 569 ++++++++++++
.../weex/source/js/examples/animation.weex.js | 224 +++++
.../weex/source/js/examples/clipboard.web.js | 583 ++++++++++++
.../weex/source/js/examples/clipboard.weex.js | 249 +++++
doc/themes/weex/source/js/examples/div.web.js | 523 +++++++++++
doc/themes/weex/source/js/examples/div.weex.js | 183 ++++
.../weex/source/js/examples/dom-rect.web.js | 589 ++++++++++++
.../weex/source/js/examples/dom-rect.weex.js | 254 +++++
.../weex/source/js/examples/dom-scroll.web.js | 598 ++++++++++++
.../weex/source/js/examples/dom-scroll.weex.js | 288 ++++++
doc/themes/weex/source/js/examples/image.web.js | 542 +++++++++++
.../weex/source/js/examples/image.weex.js | 225 +++++
.../weex/source/js/examples/indicator.web.js | 618 +++++++++++++
.../weex/source/js/examples/indicator.weex.js | 307 ++++++
doc/themes/weex/source/js/examples/input.web.js | 586 ++++++++++++
.../weex/source/js/examples/input.weex.js | 251 +++++
doc/themes/weex/source/js/examples/list.web.js | 584 ++++++++++++
doc/themes/weex/source/js/examples/list.weex.js | 252 +++++
doc/themes/weex/source/js/examples/modal.web.js | 604 ++++++++++++
.../weex/source/js/examples/modal.weex.js | 272 ++++++
.../weex/source/js/examples/navigator.web.js | 562 +++++++++++
.../weex/source/js/examples/navigator.weex.js | 230 +++++
.../weex/source/js/examples/refresh.web.js | 594 ++++++++++++
.../weex/source/js/examples/refresh.weex.js | 267 ++++++
.../weex/source/js/examples/scroller.web.js | 598 ++++++++++++
.../weex/source/js/examples/scroller.weex.js | 288 ++++++
.../weex/source/js/examples/slider.web.js | 587 ++++++++++++
.../weex/source/js/examples/slider.weex.js | 255 +++++
.../weex/source/js/examples/storage.web.js | 634 +++++++++++++
.../weex/source/js/examples/storage.weex.js | 317 +++++++
.../weex/source/js/examples/stream.web.js | 590 ++++++++++++
.../weex/source/js/examples/stream.weex.js | 259 ++++++
.../weex/source/js/examples/switch.web.js | 605 ++++++++++++
.../weex/source/js/examples/switch.weex.js | 280 ++++++
doc/themes/weex/source/js/examples/text.web.js | 535 +++++++++++
doc/themes/weex/source/js/examples/text.weex.js | 208 +++++
.../weex/source/js/examples/textarea.web.js | 582 ++++++++++++
.../weex/source/js/examples/textarea.weex.js | 247 +++++
doc/themes/weex/source/js/examples/video.web.js | 593 ++++++++++++
.../weex/source/js/examples/video.weex.js | 254 +++++
doc/themes/weex/source/js/examples/web.web.js | 923 +++++++++++++++++++
doc/themes/weex/source/js/examples/web.weex.js | 600 ++++++++++++
doc/themes/weex/source/js/highlight.pack.js | 2 +
doc/themes/weex/source/js/mobile-detect.js | 3 +
doc/themes/weex/source/js/qrcode.min.js | 1 +
doc/themes/weex/source/js/reqwest.js | 7 +
doc/themes/weex/source/js/swiper.min.js | 18 +
doc/themes/weex/source/js/velocity.js | 5 +
doc/tools/README.md | 6 -
doc/tools/cli.md | 90 --
doc/tools/devtools-android.md | 116 ---
doc/tools/devtools-ios.md | 69 --
doc/tools/devtools.md | 94 --
doc/tools/how-to-debug.md | 45 -
doc/tools/main.md | 10 -
doc/tools/playground-app.md | 17 -
doc/tools/transformer.md | 30 -
doc/tutorial.md | 206 -----
doc/tutorial_source/tech_list.we | 22 -
doc/tutorial_source/tech_list_0.we | 15 -
doc/tutorial_source/tech_list_1.we | 24 -
doc/tutorial_source/tech_list_2.we | 62 --
examples/component/lengthunitwx-demo.we | 68 ++
examples/component/scroller-demo.we | 2 +-
examples/vue/animation.vue | 2 +-
examples/vue/components/input.vue | 2 +-
examples/vue/components/navigator.vue | 2 +-
examples/vue/components/slider.vue | 18 +-
examples/vue/components/text.vue | 4 +-
examples/vue/components/video.vue | 2 +-
examples/vue/components/web.vue | 2 +-
examples/vue/iconfont.vue | 2 +-
examples/vue/include/base-url.js | 2 +-
examples/vue/include/example-list-item.vue | 2 +-
examples/vue/include/marquee.vue | 2 +-
examples/vue/index.vue | 53 +-
examples/vue/modules/clipboard.vue | 4 +-
examples/vue/modules/modal.vue | 2 +-
examples/vue/modules/storage.vue | 2 +-
examples/vue/modules/stream.vue | 2 +-
examples/vue/showcase/calculator.vue | 2 +-
examples/vue/showcase/include/banner.vue | 2 +-
examples/vue/showcase/include/coupon.vue | 2 +-
examples/vue/showcase/include/link.vue | 2 +-
examples/vue/showcase/itemlist.vue | 2 +-
examples/vue/showcase/new-fashion.vue | 4 +-
examples/vue/syntax/script-instance.vue | 2 +-
examples/vue/syntax/script-module.vue | 4 +-
examples/vue/template.vue | 2 +-
html5/render/browser/base/component/operate.js | 105 ++-
.../browser/base/component/valueFilter.js | 26 +-
html5/render/browser/extend/api/globalEvent.js | 2 +-
.../browser/extend/components/richtext.js | 95 ++
html5/render/browser/extend/components/text.js | 2 +-
html5/render/browser/render/index.js | 3 +-
html5/render/vue/.eslintrc | 5 +
html5/render/vue/README.md | 9 +
html5/render/vue/components/a.js | 24 +
html5/render/vue/components/div.js | 25 +
html5/render/vue/components/image.js | 39 +
html5/render/vue/components/index.js | 42 +
html5/render/vue/components/input.js | 53 ++
.../render/vue/components/scrollable/header.js | 63 ++
.../vue/components/scrollable/list/cell.js | 18 +
.../vue/components/scrollable/list/index.js | 71 ++
.../vue/components/scrollable/list/listMixin.js | 117 +++
.../components/scrollable/loading-indicator.js | 10 +
.../render/vue/components/scrollable/loading.js | 50 +
.../render/vue/components/scrollable/refresh.js | 51 +
.../vue/components/scrollable/scroller.js | 91 ++
.../render/vue/components/scrollable/shared.js | 22 +
html5/render/vue/components/slider/index.js | 141 +++
html5/render/vue/components/slider/indicator.js | 64 ++
.../render/vue/components/slider/slideMixin.js | 113 +++
html5/render/vue/components/switch.js | 57 ++
html5/render/vue/components/text.js | 44 +
html5/render/vue/components/textarea.js | 43 +
html5/render/vue/components/video.js | 54 ++
html5/render/vue/components/warning.js | 11 +
html5/render/vue/components/web.js | 52 ++
html5/render/vue/env/WXEnvironment.js | 39 +
html5/render/vue/env/index.js | 24 +
html5/render/vue/env/viewport.js | 44 +
html5/render/vue/env/weex.js | 63 ++
html5/render/vue/index.js | 43 +
html5/render/vue/mixins/base.js | 22 +
html5/render/vue/mixins/event.js | 76 ++
html5/render/vue/mixins/index.js | 9 +
html5/render/vue/mixins/scrollable.js | 37 +
html5/render/vue/mixins/style.js | 167 ++++
html5/render/vue/modules/animation.js | 44 +
html5/render/vue/modules/dom.js | 86 ++
html5/render/vue/modules/index.js | 38 +
html5/render/vue/modules/modal/alert.js | 44 +
html5/render/vue/modules/modal/confirm.js | 55 ++
html5/render/vue/modules/modal/index.js | 48 +
html5/render/vue/modules/modal/modal.js | 62 ++
html5/render/vue/modules/modal/prompt.js | 76 ++
html5/render/vue/modules/modal/toast.js | 78 ++
html5/render/vue/modules/navigator.js | 16 +
html5/render/vue/modules/webview.js | 21 +
html5/render/vue/styles/components.css | 506 ++++++++++
html5/render/vue/styles/reset.css | 64 ++
html5/render/vue/utils/component.js | 61 ++
html5/render/vue/utils/event.js | 57 ++
html5/render/vue/utils/func.js | 41 +
html5/render/vue/utils/index.js | 103 +++
html5/render/vue/validator/check.js | 88 ++
html5/render/vue/validator/index.js | 74 ++
html5/render/vue/validator/prop.js | 4 +
html5/render/vue/validator/style.js | 109 +++
html5/test/render/index.js | 3 +
html5/test/render/vue/components/image.js | 49 +
html5/test/render/vue/components/list.js | 21 +
html5/test/render/vue/components/switch.js | 87 ++
html5/test/render/vue/components/text.js | 72 ++
html5/test/render/vue/components/web.js | 29 +
html5/test/render/vue/examples/list-cell.js | 37 +
html5/test/render/vue/helper.js | 31 +
html5/test/render/vue/utils.js | 48 +
html5/test/render/vue/validator/check.js | 38 +
html5/test/render/vue/validator/index.js | 43 +
html5/test/render/vue/validator/prop.js | 14 +
html5/test/render/vue/validator/style.js | 271 ++++++
html5/test/render/vue/vender/vue-2.0.0.js | 7 +
html5/test/render/vue/vender/vue-2.1.0.js | 8 +
ios/playground/Podfile | 2 +-
ios/playground/WeexDemo.app.zip | Bin 0 -> 2561323 bytes
ios/sdk/WeexSDK.xcodeproj/project.pbxproj | 12 +
ios/sdk/WeexSDK/Resources/main.js | 14 +-
.../WeexSDK/Sources/Bridge/WXBridgeContext.m | 2 +
ios/sdk/WeexSDK/Sources/Bridge/WXBridgeMethod.m | 38 +
.../WeexSDK/Sources/Component/WXCellComponent.h | 1 +
.../WeexSDK/Sources/Component/WXCellComponent.m | 5 +
.../Sources/Component/WXImageComponent.m | 2 +-
.../WeexSDK/Sources/Component/WXListComponent.m | 35 +-
.../Sources/Component/WXLoadingComponent.m | 2 +-
.../Sources/Component/WXLoadingIndicator.h | 1 -
.../Sources/Component/WXLoadingIndicator.m | 81 +-
.../Sources/Component/WXRefreshComponent.m | 2 +-
.../Sources/Component/WXScrollerComponent.m | 19 +-
.../Sources/Component/WXSliderComponent.m | 73 +-
.../Sources/Component/WXTextAreaComponent.m | 28 +
.../WeexSDK/Sources/Component/WXTextComponent.m | 12 +
.../Sources/Component/WXTextInputComponent.m | 40 +-
.../Sources/Component/WXVideoComponent.m | 2 +-
.../Sources/Controller/WXBaseViewController.m | 10 +-
ios/sdk/WeexSDK/Sources/Debug/WXDebugTool.m | 3 +-
ios/sdk/WeexSDK/Sources/Engine/WXSDKEngine.h | 5 +
ios/sdk/WeexSDK/Sources/Engine/WXSDKEngine.m | 29 +-
ios/sdk/WeexSDK/Sources/Engine/WXSDKError.h | 2 +-
.../WeexSDK/Sources/Events/WXComponent+Events.m | 4 +-
.../WeexSDK/Sources/Manager/WXBridgeManager.m | 4 +-
.../Sources/Manager/WXComponentFactory.m | 1 +
.../Sources/Manager/WXComponentManager.m | 4 +-
.../WeexSDK/Sources/Model/WXJSExceptionInfo.h | 60 ++
.../WeexSDK/Sources/Model/WXJSExceptionInfo.m | 39 +
ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m | 2 +-
.../WeexSDK/Sources/Module/WXAnimationModule.m | 4 +-
.../WeexSDK/Sources/Module/WXClipboardModule.m | 4 +-
ios/sdk/WeexSDK/Sources/Module/WXDomModule.m | 8 +-
.../Sources/Module/WXGlobalEventModule.m | 8 +-
.../WeexSDK/Sources/Module/WXModalUIModule.m | 4 +-
.../WeexSDK/Sources/Module/WXNavigatorModule.m | 12 +-
ios/sdk/WeexSDK/Sources/Module/WXPickerModule.m | 34 +-
.../WeexSDK/Sources/Module/WXStorageModule.m | 72 +-
ios/sdk/WeexSDK/Sources/Module/WXStreamModule.m | 4 +-
.../WeexSDK/Sources/Module/WXWebSocketModule.m | 4 +-
.../Sources/Protocol/WXJSExceptionProtocol.h | 21 +
ios/sdk/WeexSDK/Sources/Utility/WXConvert.h | 1 +
ios/sdk/WeexSDK/Sources/Utility/WXConvert.m | 25 +-
ios/sdk/WeexSDK/Sources/Utility/WXDefine.h | 2 +-
.../Utility/WXSimulatorShortcutManager.m | 12 +-
ios/sdk/WeexSDK/Sources/Utility/WXUtility.h | 10 +-
ios/sdk/WeexSDK/Sources/Utility/WXUtility.m | 77 +-
.../Sources/View/WXComponent+ViewManagement.m | 5 +-
ios/sdk/WeexSDK/Sources/WeexSDK.h | 3 +
package.json | 36 +-
packages/weex-html5/LICENSE | 201 ++++
packages/weex-html5/NOTICE | 7 +
packages/weex-html5/README.md | 158 ++++
packages/weex-html5/demo/build/index.js | 111 +++
packages/weex-html5/demo/index.we | 29 +
packages/weex-html5/index.html | 57 ++
packages/weex-html5/package.json | 23 +
packages/weex-vue-render/README.md | 5 +
packages/weex-vue-render/package.json | 24 +
test/ci-funcs.sh | 110 +++
test/mocha.opts | 2 +
test/pages/dom-operation.we | 32 +
test/pages/list-scroll.we | 31 +
test/pages/scroller-scroll.we | 31 +
test/run.sh | 20 +-
test/scripts/components/scroll-event.test.js | 92 ++
test/scripts/dom.test.js | 73 ++
test/scripts/index.test.js | 14 +-
test/scripts/util.js | 21 +-
vue.html | 43 +
917 files changed, 67344 insertions(+), 9544 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/e2ecfeaa/android/sdk/src/main/java/com/taobao/weex/WXSDKEngine.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/e2ecfeaa/android/sdk/src/main/java/com/taobao/weex/common/Constants.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/e2ecfeaa/android/sdk/src/main/java/com/taobao/weex/ui/component/list/BasicListComponent.java
----------------------------------------------------------------------
diff --cc android/sdk/src/main/java/com/taobao/weex/ui/component/list/BasicListComponent.java
index 714eaea,65993f4..98bf693
--- 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
@@@ -283,9 -285,9 +285,13 @@@ public abstract class BasicListComponen
private static boolean mAllowCacheViewHolder = true;
private static boolean mDownForBidCacheViewHolder = false;
++
+ protected int mLayoutType = WXRecyclerView.TYPE_LINEAR_LAYOUT;
+ protected int mColumnCount = 1;
+
+ private int mOffsetAccuracy = 10;
+ private Point mLastReport = new Point(-1, -1);
+
/**
* Map for storing component that is sticky.
**/
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/e2ecfeaa/android/sdk/src/main/java/com/taobao/weex/ui/view/listview/WXRecyclerView.java
----------------------------------------------------------------------
diff --cc android/sdk/src/main/java/com/taobao/weex/ui/view/listview/WXRecyclerView.java
index 4065308,fe912af..f3f9460
--- 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
@@@ -250,13 -248,13 +249,13 @@@ public class WXRecyclerView extends Rec
* @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){
+ setLayoutManager(new ExtendedLinearLayoutManager(context,orientation,false){
@Override
public boolean supportsPredictiveItemAnimations() {
[14/25] incubator-weex git commit: * [android] adapter
scrollToElement with one arg
Posted by cx...@apache.org.
* [android] adapter scrollToElement with one arg
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/48d58d36
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/48d58d36
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/48d58d36
Branch: refs/heads/0.11-dev-recycler
Commit: 48d58d366530201d3d108c3dea85d78e56b00413
Parents: 4f2b772
Author: zshshr <zh...@gmail.com>
Authored: Fri Feb 24 18:21:07 2017 +0800
Committer: zshshr <zh...@gmail.com>
Committed: Fri Feb 24 18:21:07 2017 +0800
----------------------------------------------------------------------
.../sdk/src/main/java/com/taobao/weex/dom/WXDomModule.java | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/48d58d36/android/sdk/src/main/java/com/taobao/weex/dom/WXDomModule.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/dom/WXDomModule.java b/android/sdk/src/main/java/com/taobao/weex/dom/WXDomModule.java
index 9444fa4..c52f071 100755
--- a/android/sdk/src/main/java/com/taobao/weex/dom/WXDomModule.java
+++ b/android/sdk/src/main/java/com/taobao/weex/dom/WXDomModule.java
@@ -347,7 +347,11 @@ public final class WXDomModule extends WXModule {
if (args == null) {
return null;
}
- scrollToElement((String) args.get(0), (JSONObject) args.get(1));
+ JSONObject option =null;
+ if(args.size()>1) {
+ option = (JSONObject) args.get(1);
+ }
+ scrollToElement((String) args.get(0),option);
break;
case ADD_RULE:
if (args == null) {
@@ -609,7 +613,7 @@ public final class WXDomModule extends WXModule {
* @param options scroll option, like {offset:0, duration:300}
*/
public void scrollToElement(String ref, JSONObject options) {
- if (TextUtils.isEmpty(ref) || options == null) {
+ if (TextUtils.isEmpty(ref) ) {
return;
}
[15/25] incubator-weex git commit: * [android] support refresh some
attributes of recycler component
Posted by cx...@apache.org.
* [android] support refresh some attributes of recycler component
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/50698980
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/50698980
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/50698980
Branch: refs/heads/0.11-dev-recycler
Commit: 50698980ff0f96ae071ffb06170b2f3becb8e024
Parents: 48d58d3
Author: zshshr <zh...@gmail.com>
Authored: Fri Feb 24 18:24:35 2017 +0800
Committer: zshshr <zh...@gmail.com>
Committed: Fri Feb 24 18:24:35 2017 +0800
----------------------------------------------------------------------
.../main/java/com/taobao/weex/WXSDKEngine.java | 1 +
.../taobao/weex/dom/WXRecyclerDomObject.java | 12 +-
.../ui/component/list/BasicListComponent.java | 1 +
.../weex/ui/component/list/WXListComponent.java | 62 ++---
.../weex/ui/view/listview/WXRecyclerView.java | 9 +-
.../ui/view/listview/WXSpaceItemDecoration.java | 42 +++-
.../listview/WXStaggeredGridLayoutManager.java | 237 -------------------
.../adapter/WXRecyclerViewOnScrollListener.java | 9 +-
8 files changed, 91 insertions(+), 282 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/50698980/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 ff5ce84..3e8a7ef 100755
--- a/android/sdk/src/main/java/com/taobao/weex/WXSDKEngine.java
+++ b/android/sdk/src/main/java/com/taobao/weex/WXSDKEngine.java
@@ -389,6 +389,7 @@ public class WXSDKEngine {
registerDomObject(WXBasicComponentType.HLIST, WXListDomObject.class);
registerDomObject(WXBasicComponentType.SCROLLER, WXScrollerDomObject.class);
registerDomObject(WXBasicComponentType.RECYCLER, WXRecyclerDomObject.class);
+ registerDomObject(WXBasicComponentType.WATERFALL, WXRecyclerDomObject.class);
} catch (WXException e) {
WXLogUtils.e("[WXSDKEngine] register:", e);
}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/50698980/android/sdk/src/main/java/com/taobao/weex/dom/WXRecyclerDomObject.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/dom/WXRecyclerDomObject.java b/android/sdk/src/main/java/com/taobao/weex/dom/WXRecyclerDomObject.java
index b1c0e19..61fda35 100644
--- a/android/sdk/src/main/java/com/taobao/weex/dom/WXRecyclerDomObject.java
+++ b/android/sdk/src/main/java/com/taobao/weex/dom/WXRecyclerDomObject.java
@@ -204,6 +204,7 @@
*/
package com.taobao.weex.dom;
+import com.taobao.weex.WXEnvironment;
import com.taobao.weex.common.Constants;
import com.taobao.weex.dom.flex.Spacing;
import com.taobao.weex.ui.component.WXBasicComponentType;
@@ -236,6 +237,9 @@ public class WXRecyclerDomObject extends WXDomObject{
return mColumnCount;
}
+ public float getColumnWidth() {
+ return mColumnWidth;
+ }
@Override
public void add(WXDomObject child, int index) {
super.add(child, index);
@@ -273,6 +277,9 @@ public class WXRecyclerDomObject extends WXDomObject{
mColumnWidth= ((availableWidth + mColumnGap) / mColumnCount) - mColumnGap;
}
mIsPreCalculateCellWidth = true;
+ if(WXEnvironment.isApkDebugable()) {
+ WXLogUtils.d("preCalculateCellWidth mColumnGap :" + mColumnGap + " mColumnWidth:" + mColumnWidth + " mColumnCount:" + mColumnCount);
+ }
}
}
@@ -290,11 +297,6 @@ public class WXRecyclerDomObject extends WXDomObject{
WXDomObject domObject = getChild(i);
if(WXBasicComponentType.CELL.equals(domObject.getType())) {
getChild(i).getStyles().put(Constants.Name.WIDTH, mColumnWidth);
-// Message message = Message.obtain();
-// message.what = WXDomHandler.MsgType.WX_DOM_BATCH;
-// WXSDKManager.getInstance().getWXDomManager().sendMessage(message);
- WXLogUtils.w("zshshr","updateAttr : "+i+"thread:"+Thread.currentThread().getName());
-
}
}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/50698980/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 0d5f0b1..36d55c8 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
@@ -290,6 +290,7 @@ public abstract class BasicListComponent<T extends ViewGroup & ListComponentView
protected int mLayoutType = WXRecyclerView.TYPE_LINEAR_LAYOUT;
protected int mColumnCount = 1;
protected float mColumnGap = 0;
+ protected float mColumnWidth = 0;
private int mOffsetAccuracy = 10;
private Point mLastReport = new Point(-1, -1);
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/50698980/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 fa91d1c..9828d70 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
@@ -212,6 +212,7 @@ import com.taobao.weex.common.Constants;
import com.taobao.weex.dom.WXDomObject;
import com.taobao.weex.dom.WXRecyclerDomObject;
import com.taobao.weex.ui.component.WXBaseRefresh;
+import com.taobao.weex.ui.component.WXBasicComponentType;
import com.taobao.weex.ui.component.WXComponent;
import com.taobao.weex.ui.component.WXComponentProp;
import com.taobao.weex.ui.component.WXLoading;
@@ -233,6 +234,7 @@ import com.taobao.weex.utils.WXLogUtils;
public class WXListComponent extends BasicListComponent<BounceRecyclerView> {
private String TAG = "WXListComponent";
+ private WXRecyclerDomObject mDomObject;
@Deprecated
public WXListComponent(WXSDKInstance instance, WXDomObject dom, WXVContainer parent, String instanceId, boolean isLazy) {
@@ -243,11 +245,17 @@ public class WXListComponent extends BasicListComponent<BounceRecyclerView> {
public WXListComponent(WXSDKInstance instance, WXDomObject node, WXVContainer parent, boolean lazy) {
super(instance, node, parent);
if (node != null && node instanceof WXRecyclerDomObject) {
- WXRecyclerDomObject domObject = (WXRecyclerDomObject) node;
- domObject.preCalculateCellWidth();
- mLayoutType = domObject.getLayoutType();
- mColumnCount = domObject.getColumnCount();
- mColumnGap = domObject.getColumnGap();
+ mDomObject = (WXRecyclerDomObject) node;
+ mDomObject.preCalculateCellWidth();
+
+ if(WXBasicComponentType.WATERFALL.equals(node.getType())){
+ mLayoutType = WXRecyclerView.TYPE_STAGGERED_GRID_LAYOUT;
+ }else{
+ mLayoutType = mDomObject.getLayoutType();
+ }
+
+ mColumnCount = mDomObject.getColumnCount();
+ mColumnGap = mDomObject.getColumnGap();
}
}
@@ -304,34 +312,34 @@ public class WXListComponent extends BasicListComponent<BounceRecyclerView> {
return false;
}
- @WXComponentProp(name = Constants.Name.COLUMN_COUNT)
- public void setColumnCount(int columnCount) throws InterruptedException {
- WXLogUtils.w("zshshr","setColumnCount : "+"htread:"+Thread.currentThread().getName());
-// mColumnCount = columnCount;
-// WXRecyclerView wxRecyclerView = getHostView().getInnerView();
-// wxRecyclerView.initView(getContext(), mLayoutType,mColumnCount,mColumnGap,getOrientation());
+ @WXComponentProp(name = Constants.Name.COLUMN_WIDTH)
+ public void setColumnWidth(int columnCount) {
+ if(mDomObject.getColumnWidth() != mColumnWidth){
+ WXRecyclerView wxRecyclerView = getHostView().getInnerView();
+ wxRecyclerView.initView(getContext(), mLayoutType,mColumnCount,mColumnGap,getOrientation());
+ mColumnCount = mDomObject.getColumnCount();
+ }
}
- @WXComponentProp(name = Constants.Name.COLUMN_GAP)
- public void setColumnGap(float columnGap) throws InterruptedException {
-// mColumnGap = columnGap;
-// WXRecyclerView wxRecyclerView = getHostView().getInnerView();
-// wxRecyclerView.initView(getContext(), mLayoutType,mColumnCount,mColumnGap,getOrientation());
- }
+ @WXComponentProp(name = Constants.Name.COLUMN_COUNT)
+ public void setColumnCount(int columnCount){
- @WXComponentProp(name = Constants.Name.SHOW_SCROLLBAR)
- public void showScrollbar(boolean isShow) throws InterruptedException {
- WXRecyclerView wxRecyclerView = getHostView().getInnerView();
- wxRecyclerView.setScrollbarFadingEnabled(isShow);
- wxRecyclerView.setVerticalScrollBarEnabled(isShow);
+ if(mDomObject.getColumnCount() != mColumnCount){
+ mColumnCount = mDomObject.getColumnCount();
+ WXRecyclerView wxRecyclerView = getHostView().getInnerView();
+ wxRecyclerView.initView(getContext(), mLayoutType,mColumnCount,mColumnGap,getOrientation());
+
+ }
- wxRecyclerView.initView(getContext(), mLayoutType,mColumnCount,mColumnGap,getOrientation());
}
- @WXComponentProp(name = Constants.Name.SCROLLABLE)
- public void setScrollable(boolean scrollable) {
- WXRecyclerView wxRecyclerView = getHostView().getInnerView();
- wxRecyclerView.setScrollable(scrollable);
+ @WXComponentProp(name = Constants.Name.COLUMN_GAP)
+ public void setColumnGap(float columnGap) throws InterruptedException {
+ if(mDomObject.getColumnGap() != mColumnGap) {
+ mColumnGap = mDomObject.getColumnGap();
+ WXRecyclerView wxRecyclerView = getHostView().getInnerView();
+ wxRecyclerView.initView(getContext(), mLayoutType, mColumnCount, mColumnGap, getOrientation());
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/50698980/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 09bedbb..e46fbe0 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
@@ -211,6 +211,7 @@ import android.support.annotation.Nullable;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.OrientationHelper;
import android.support.v7.widget.RecyclerView;
+import android.support.v7.widget.StaggeredGridLayoutManager;
import android.view.MotionEvent;
import com.taobao.weex.common.Constants;
@@ -254,12 +255,12 @@ public class WXRecyclerView extends RecyclerView implements WXGestureObservable
* @param orientation should be {@link OrientationHelper#HORIZONTAL} or {@link OrientationHelper#VERTICAL}
*/
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
- public void initView(Context context, int type, int spanCount, float columnGap, int orientation) {
+ public void initView(Context context, int type, int columnCount, float columnGap, int orientation) {
if (type == TYPE_GRID_LAYOUT) {
- setLayoutManager(new GridLayoutManager(context, spanCount,orientation,false));
+ setLayoutManager(new GridLayoutManager(context, columnCount,orientation,false));
} else if (type == TYPE_STAGGERED_GRID_LAYOUT) {
- setLayoutManager(new WXStaggeredGridLayoutManager(spanCount, orientation));
- addItemDecoration(new WXSpaceItemDecoration(columnGap));
+ setLayoutManager(new StaggeredGridLayoutManager(columnCount, orientation));
+ addItemDecoration(new WXSpaceItemDecoration(columnCount,columnGap));
} else if (type == TYPE_LINEAR_LAYOUT) {
setLayoutManager(new ExtendedLinearLayoutManager(context,orientation,false));
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/50698980/android/sdk/src/main/java/com/taobao/weex/ui/view/listview/WXSpaceItemDecoration.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/view/listview/WXSpaceItemDecoration.java b/android/sdk/src/main/java/com/taobao/weex/ui/view/listview/WXSpaceItemDecoration.java
index 57122cf..c067c1a 100644
--- a/android/sdk/src/main/java/com/taobao/weex/ui/view/listview/WXSpaceItemDecoration.java
+++ b/android/sdk/src/main/java/com/taobao/weex/ui/view/listview/WXSpaceItemDecoration.java
@@ -204,24 +204,56 @@
*/
package com.taobao.weex.ui.view.listview;
+import android.annotation.TargetApi;
import android.graphics.Rect;
+import android.os.Build;
import android.support.v7.widget.RecyclerView;
+import android.support.v7.widget.StaggeredGridLayoutManager;
import android.view.View;
+import com.taobao.weex.utils.WXLogUtils;
+
/**
* Created by zhengshihan on 2017/2/20.
*/
public class WXSpaceItemDecoration extends RecyclerView.ItemDecoration {
- private float space;
+ private float mColumnGap;
+ private int mColumnCount;
- public WXSpaceItemDecoration(float space) {
- this.space = space;
+ public WXSpaceItemDecoration(int columnCount, float columnGap) {
+ mColumnGap = columnGap;
+ mColumnCount = columnCount;
}
+ @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
@Override
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
- outRect.right = (int)space/2;
- outRect.left = (int)space/2;
+
+ StaggeredGridLayoutManager.LayoutParams layoutParams
+ = (StaggeredGridLayoutManager.LayoutParams) view.getLayoutParams();
+
+ if (!layoutParams.isFullSpan()) {
+ int position = parent.getChildLayoutPosition(view);
+
+ if (position < 0) {
+ return;
+ }
+ int spanIndex = layoutParams.getSpanIndex();
+ spanIndex++;
+
+ int margin = (int) (mColumnGap / mColumnCount);
+ if(spanIndex % mColumnCount == 1){
+ layoutParams.setMarginEnd(margin);
+
+ }else if (spanIndex % mColumnCount ==0){
+ layoutParams.setMarginStart(margin);
+
+ } else {
+ layoutParams.setMarginEnd(margin);
+ layoutParams.setMarginStart(margin);
+ }
+
+ }
}
}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/50698980/android/sdk/src/main/java/com/taobao/weex/ui/view/listview/WXStaggeredGridLayoutManager.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/view/listview/WXStaggeredGridLayoutManager.java b/android/sdk/src/main/java/com/taobao/weex/ui/view/listview/WXStaggeredGridLayoutManager.java
deleted file mode 100644
index a2f6926..0000000
--- a/android/sdk/src/main/java/com/taobao/weex/ui/view/listview/WXStaggeredGridLayoutManager.java
+++ /dev/null
@@ -1,237 +0,0 @@
-/**
- *
- * Apache License
- * Version 2.0, January 2004
- * http://www.apache.org/licenses/
- *
- * TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
- *
- * 1. Definitions.
- *
- * "License" shall mean the terms and conditions for use, reproduction,
- * and distribution as defined by Sections 1 through 9 of this document.
- *
- * "Licensor" shall mean the copyright owner or entity authorized by
- * the copyright owner that is granting the License.
- *
- * "Legal Entity" shall mean the union of the acting entity and all
- * other entities that control, are controlled by, or are under common
- * control with that entity. For the purposes of this definition,
- * "control" means (i) the power, direct or indirect, to cause the
- * direction or management of such entity, whether by contract or
- * otherwise, or (ii) ownership of fifty percent (50%) or more of the
- * outstanding shares, or (iii) beneficial ownership of such entity.
- *
- * "You" (or "Your") shall mean an individual or Legal Entity
- * exercising permissions granted by this License.
- *
- * "Source" form shall mean the preferred form for making modifications,
- * including but not limited to software source code, documentation
- * source, and configuration files.
- *
- * "Object" form shall mean any form resulting from mechanical
- * transformation or translation of a Source form, including but
- * not limited to compiled object code, generated documentation,
- * and conversions to other media types.
- *
- * "Work" shall mean the work of authorship, whether in Source or
- * Object form, made available under the License, as indicated by a
- * copyright notice that is included in or attached to the work
- * (an example is provided in the Appendix below).
- *
- * "Derivative Works" shall mean any work, whether in Source or Object
- * form, that is based on (or derived from) the Work and for which the
- * editorial revisions, annotations, elaborations, or other modifications
- * represent, as a whole, an original work of authorship. For the purposes
- * of this License, Derivative Works shall not include works that remain
- * separable from, or merely link (or bind by name) to the interfaces of,
- * the Work and Derivative Works thereof.
- *
- * "Contribution" shall mean any work of authorship, including
- * the original version of the Work and any modifications or additions
- * to that Work or Derivative Works thereof, that is intentionally
- * submitted to Licensor for inclusion in the Work by the copyright owner
- * or by an individual or Legal Entity authorized to submit on behalf of
- * the copyright owner. For the purposes of this definition, "submitted"
- * means any form of electronic, verbal, or written communication sent
- * to the Licensor or its representatives, including but not limited to
- * communication on electronic mailing lists, source code control systems,
- * and issue tracking systems that are managed by, or on behalf of, the
- * Licensor for the purpose of discussing and improving the Work, but
- * excluding communication that is conspicuously marked or otherwise
- * designated in writing by the copyright owner as "Not a Contribution."
- *
- * "Contributor" shall mean Licensor and any individual or Legal Entity
- * on behalf of whom a Contribution has been received by Licensor and
- * subsequently incorporated within the Work.
- *
- * 2. Grant of Copyright License. Subject to the terms and conditions of
- * this License, each Contributor hereby grants to You a perpetual,
- * worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- * copyright license to reproduce, prepare Derivative Works of,
- * publicly display, publicly perform, sublicense, and distribute the
- * Work and such Derivative Works in Source or Object form.
- *
- * 3. Grant of Patent License. Subject to the terms and conditions of
- * this License, each Contributor hereby grants to You a perpetual,
- * worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- * (except as stated in this section) patent license to make, have made,
- * use, offer to sell, sell, import, and otherwise transfer the Work,
- * where such license applies only to those patent claims licensable
- * by such Contributor that are necessarily infringed by their
- * Contribution(s) alone or by combination of their Contribution(s)
- * with the Work to which such Contribution(s) was submitted. If You
- * institute patent litigation against any entity (including a
- * cross-claim or counterclaim in a lawsuit) alleging that the Work
- * or a Contribution incorporated within the Work constitutes direct
- * or contributory patent infringement, then any patent licenses
- * granted to You under this License for that Work shall terminate
- * as of the date such litigation is filed.
- *
- * 4. Redistribution. You may reproduce and distribute copies of the
- * Work or Derivative Works thereof in any medium, with or without
- * modifications, and in Source or Object form, provided that You
- * meet the following conditions:
- *
- * (a) You must give any other recipients of the Work or
- * Derivative Works a copy of this License; and
- *
- * (b) You must cause any modified files to carry prominent notices
- * stating that You changed the files; and
- *
- * (c) You must retain, in the Source form of any Derivative Works
- * that You distribute, all copyright, patent, trademark, and
- * attribution notices from the Source form of the Work,
- * excluding those notices that do not pertain to any part of
- * the Derivative Works; and
- *
- * (d) If the Work includes a "NOTICE" text file as part of its
- * distribution, then any Derivative Works that You distribute must
- * include a readable copy of the attribution notices contained
- * within such NOTICE file, excluding those notices that do not
- * pertain to any part of the Derivative Works, in at least one
- * of the following places: within a NOTICE text file distributed
- * as part of the Derivative Works; within the Source form or
- * documentation, if provided along with the Derivative Works; or,
- * within a display generated by the Derivative Works, if and
- * wherever such third-party notices normally appear. The contents
- * of the NOTICE file are for informational purposes only and
- * do not modify the License. You may add Your own attribution
- * notices within Derivative Works that You distribute, alongside
- * or as an addendum to the NOTICE text from the Work, provided
- * that such additional attribution notices cannot be construed
- * as modifying the License.
- *
- * You may add Your own copyright statement to Your modifications and
- * may provide additional or different license terms and conditions
- * for use, reproduction, or distribution of Your modifications, or
- * for any such Derivative Works as a whole, provided Your use,
- * reproduction, and distribution of the Work otherwise complies with
- * the conditions stated in this License.
- *
- * 5. Submission of Contributions. Unless You explicitly state otherwise,
- * any Contribution intentionally submitted for inclusion in the Work
- * by You to the Licensor shall be under the terms and conditions of
- * this License, without any additional terms or conditions.
- * Notwithstanding the above, nothing herein shall supersede or modify
- * the terms of any separate license agreement you may have executed
- * with Licensor regarding such Contributions.
- *
- * 6. Trademarks. This License does not grant permission to use the trade
- * names, trademarks, service marks, or product names of the Licensor,
- * except as required for reasonable and customary use in describing the
- * origin of the Work and reproducing the content of the NOTICE file.
- *
- * 7. Disclaimer of Warranty. Unless required by applicable law or
- * agreed to in writing, Licensor provides the Work (and each
- * Contributor provides its Contributions) on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied, including, without limitation, any warranties or conditions
- * of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- * PARTICULAR PURPOSE. You are solely responsible for determining the
- * appropriateness of using or redistributing the Work and assume any
- * risks associated with Your exercise of permissions under this License.
- *
- * 8. Limitation of Liability. In no event and under no legal theory,
- * whether in tort (including negligence), contract, or otherwise,
- * unless required by applicable law (such as deliberate and grossly
- * negligent acts) or agreed to in writing, shall any Contributor be
- * liable to You for damages, including any direct, indirect, special,
- * incidental, or consequential damages of any character arising as a
- * result of this License or out of the use or inability to use the
- * Work (including but not limited to damages for loss of goodwill,
- * work stoppage, computer failure or malfunction, or any and all
- * other commercial damages or losses), even if such Contributor
- * has been advised of the possibility of such damages.
- *
- * 9. Accepting Warranty or Additional Liability. While redistributing
- * the Work or Derivative Works thereof, You may choose to offer,
- * and charge a fee for, acceptance of support, warranty, indemnity,
- * or other liability obligations and/or rights consistent with this
- * License. However, in accepting such obligations, You may act only
- * on Your own behalf and on Your sole responsibility, not on behalf
- * of any other Contributor, and only if You agree to indemnify,
- * defend, and hold each Contributor harmless for any liability
- * incurred by, or claims asserted against, such Contributor by reason
- * of your accepting any such warranty or additional liability.
- *
- * END OF TERMS AND CONDITIONS
- *
- * APPENDIX: How to apply the Apache License to your work.
- *
- * To apply the Apache License to your work, attach the following
- * boilerplate notice, with the fields enclosed by brackets "[]"
- * replaced with your own identifying information. (Don't include
- * the brackets!) The text should be enclosed in the appropriate
- * comment syntax for the file format. We also recommend that a
- * file or class name and description of purpose be included on the
- * same "printed page" as the copyright notice for easier
- * identification within third-party archives.
- *
- * Copyright 2016 Alibaba Group
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.taobao.weex.ui.view.listview;
-
-import android.support.v7.widget.RecyclerView;
-import android.support.v7.widget.StaggeredGridLayoutManager;
-
-/**
- * Created by zhengshihan on 2017/2/20.
- */
-
-public class WXStaggeredGridLayoutManager extends StaggeredGridLayoutManager {
-
- public WXStaggeredGridLayoutManager(int spanCount, int orientation) {
- super(spanCount, orientation);
- offsetChildrenHorizontal(200);
- }
-
- @Override
- public void onLayoutChildren(RecyclerView.Recycler recycler, RecyclerView.State state) {
- super.onLayoutChildren(recycler, state);
-
- }
-
- @Override
- public void onItemsAdded(RecyclerView recyclerView, int positionStart, int itemCount) {
- super.onItemsAdded(recyclerView, positionStart, itemCount);
-
- }
-
- @Override
- public void onItemsUpdated(RecyclerView recyclerView, int positionStart, int itemCount, Object payload) {
- super.onItemsUpdated(recyclerView, positionStart, itemCount, payload);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/50698980/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 6e93d4f..1cc3dbe 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
@@ -300,11 +300,12 @@ public class WXRecyclerViewOnScrollListener extends RecyclerView.OnScrollListene
} else if (layoutManager instanceof StaggeredGridLayoutManager) {
layoutManagerType = LAYOUT_MANAGER_TYPE.STAGGERED_GRID;
StaggeredGridLayoutManager staggeredGridLayoutManager = (StaggeredGridLayoutManager) layoutManager;
- if (mLastPositions == null) {
- mLastPositions = new int[staggeredGridLayoutManager.getSpanCount()];
+ int newspanCount = staggeredGridLayoutManager.getSpanCount();
+ if (mLastPositions == null || newspanCount != mLastPositions.length ) {
+ mLastPositions = new int[newspanCount];
}
- if (mFirstPositions == null) {
- mFirstPositions = new int[staggeredGridLayoutManager.getSpanCount()];
+ if (mFirstPositions == null || newspanCount != mFirstPositions.length) {
+ mFirstPositions = new int[newspanCount];
}
staggeredGridLayoutManager.findFirstVisibleItemPositions(mFirstPositions);
mFirstVisibleItemPosition = findMin(mFirstPositions);
[08/25] incubator-weex git commit: + [ios] support waterfall layout *
Add recycler component to be based component of UICollectionView * Support
column-count/column-gap/column-width for multi-column layout
Posted by cx...@apache.org.
+ [ios] support waterfall layout
* Add recycler component to be based component of UICollectionView
* Support column-count/column-gap/column-width for multi-column layout
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/1c96da7a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/1c96da7a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/1c96da7a
Branch: refs/heads/0.11-dev-recycler
Commit: 1c96da7a1e23170cd14531037450f8c2510f32c5
Parents: a902100
Author: \u9690\u98ce <cx...@gmail.com>
Authored: Thu Feb 23 16:23:04 2017 +0800
Committer: \u9690\u98ce <cx...@gmail.com>
Committed: Thu Feb 23 16:23:04 2017 +0800
----------------------------------------------------------------------
examples/vue/components/waterfall.vue | 389 +++++++++++++++
examples/vue/index.vue | 1 +
ios/playground/WeexDemo/DemoDefine.h | 2 +-
ios/playground/WeexDemo/UIView+UIThreadCheck.m | 2 +-
ios/playground/WeexDemo/WXDemoViewController.m | 3 +-
ios/sdk/WeexSDK.xcodeproj/project.pbxproj | 75 ++-
.../Component/Recycler/WXMultiColumnLayout.h | 42 ++
.../Component/Recycler/WXMultiColumnLayout.m | 386 ++++++++++++++
.../Component/Recycler/WXRecyclerComponent.h | 12 +
.../Component/Recycler/WXRecyclerComponent.m | 497 +++++++++++++++++++
.../Recycler/WXRecyclerDataController.h | 34 ++
.../Recycler/WXRecyclerDataController.m | 116 +++++
.../Recycler/WXRecyclerUpdateController.h | 29 ++
.../Recycler/WXRecyclerUpdateController.m | 223 +++++++++
.../Recycler/WXSectionDataController.h | 32 ++
.../Recycler/WXSectionDataController.m | 85 ++++
.../WeexSDK/Sources/Component/WXCellComponent.h | 19 +-
.../WeexSDK/Sources/Component/WXCellComponent.m | 23 +-
.../Component/WXComponent+GradientColor.h | 15 +-
.../Component/WXComponent+GradientColor.m | 15 +-
.../Sources/Component/WXFooterComponent.h | 13 +
.../Sources/Component/WXFooterComponent.m | 13 +
.../Sources/Component/WXHeaderComponent.h | 25 +
.../Sources/Component/WXHeaderComponent.m | 62 +++
.../WeexSDK/Sources/Component/WXListComponent.h | 12 -
.../WeexSDK/Sources/Component/WXListComponent.m | 69 +--
ios/sdk/WeexSDK/Sources/Component/WXTransform.m | 18 +-
ios/sdk/WeexSDK/Sources/Engine/WXSDKEngine.m | 2 +
.../WeexSDK/Sources/Module/WXAnimationModule.m | 8 +-
ios/sdk/WeexSDK/Sources/Utility/WXConvert.h | 3 +
ios/sdk/WeexSDK/Sources/Utility/WXConvert.m | 29 ++
ios/sdk/WeexSDK/Sources/Utility/WXDiffUtil.h | 32 ++
ios/sdk/WeexSDK/Sources/Utility/WXDiffUtil.m | 165 ++++++
ios/sdk/WeexSDK/Sources/Utility/WXLength.h | 13 +-
ios/sdk/WeexSDK/Sources/Utility/WXLength.m | 45 +-
35 files changed, 2397 insertions(+), 112 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/1c96da7a/examples/vue/components/waterfall.vue
----------------------------------------------------------------------
diff --git a/examples/vue/components/waterfall.vue b/examples/vue/components/waterfall.vue
new file mode 100644
index 0000000..fe6cd91
--- /dev/null
+++ b/examples/vue/components/waterfall.vue
@@ -0,0 +1,389 @@
+<template>
+ <waterfall class="page"
+ v-bind:style="{padding:padding}"
+ :column-width="columnWidth" :column-count="columnCount" :column-gap="columnGap"
+ :show-scrollbar="showScrollbar" :scrollable="scrollable"
+ @scroll="recylerScroll"
+ >
+ <header class="header" ref="header">
+ <image class="banner" src="https://gw.alicdn.com/tps/TB1ESN1PFXXXXX1apXXXXXXXXXX-1000-600.jpg" resize="cover">
+ <div class="bannerInfo">
+ <image class="avatar" src="https://gw.alicdn.com/tps/TB1EP9bPFXXXXbpXVXXXXXXXXXX-150-110.jpg" resize="cover"></image>
+ <text class="name">Adam Cat</text>
+ <div class="titleWrap">
+ <text class="title">Genius</text>
+ </div>
+ </div>
+ <div class="bannerPhotoWrap">
+ <image class="bannerPhoto" v-for="photo in banner.photos" :src="photo.src"></image>
+ </div>
+ </image>
+ </header>
+ <header class="stickyHeader">
+ <div v-if="stickyHeaderType === 'none'" class="stickyWrapper">
+ <text class="stickyText">Sticky Header</text>
+ </div>
+ <div v-if="stickyHeaderType === 'appear'" class="stickyWrapper">
+ <div class="stickyTextImageWrapper">
+ <text class="stickyText">Last Appear:</text>
+ <image class="stickyImage" :src="appearImage"></image>
+ </div>
+ <div class="stickyTextImageWrapper">
+ <text class="stickyText">Last Disappear:</text>
+ <image class="stickyImage" :src="disappearImage"></image>
+ </div>
+ </div>
+ <div v-if="stickyHeaderType === 'scroll'" class="stickyWrapper">
+ <text class="stickyText">Content Offset:{{contentOffset}}</text>
+ </div>
+ </header>
+ <cell v-for="item in items" class="cell">
+ <div class="item" @click="onItemclick(item.behaviour)" @appear="itemAppear(item.src)" @disappear="itemDisappear(item.src)">
+ <text v-if="item.name" class="itemName">{{item.name}}</text>
+ <image class="itemPhoto" :src="item.src"></image>
+ <text v-if="item.desc" class="itemDesc">{{item.desc}}</text>
+ <text v-if="item.behaviourName" class="itemClickBehaviour"> {{item.behaviourName}}</text>
+ </div>
+ </cell>
+ <div class="fixedItem" @click="scrollToTop">
+ <text class="fixedText">Top</text>
+ </div>
+ </waterfall>
+</template>
+
+<style>
+ .page {
+ background-color: #EFEFEF;
+ }
+ .header {
+ }
+ .banner {
+ height: 377;
+ flex-direction: row;
+ }
+ .bannerInfo {
+ width:270;
+ align-items: center;
+ justify-content: center;
+ }
+ .avatar {
+ width: 148;
+ height: 108;
+ border-radius: 54;
+ border-width: 4;
+ border-color: #FFFFFF;
+ margin-bottom: 14;
+ }
+ .name {
+ font-weight: bold;
+ font-size:32;
+ color:#ffffff;
+ line-height:32;
+ text-align:center;
+ margin-bottom: 16;
+ }
+ .titleWrap {
+ width: 100;
+ height: 24;
+ margin-bottom: 10;
+ background-color: rgba(255,255,255,0.80);
+ border-radius: 12;
+ justify-content: center;
+ align-items: center;
+ }
+ .title {
+ font-size: 20;
+ color: #000000;
+ }
+ .bannerPhotoWrap {
+ width: 449;
+ height: 305;
+ background-color: #FFFFFF;
+ border-radius: 12;
+ margin-top: 35;
+ padding: 12;
+ flex-direction: row;
+ justify-content: space-between;
+ flex-wrap:wrap;
+ }
+ .bannerPhoto {
+ width: 137;
+ height: 137;
+ margin-bottom: 6;
+ }
+ .stickyHeader {
+ position: sticky;
+ height: 94;
+ flex-direction: row;
+ padding-bottom:6;
+ }
+ .stickyWrapper {
+ flex-direction: row;
+ background-color:#00cc99;
+ justify-content: center;
+ align-items: center;
+ flex:1;
+ }
+ .stickyTextImageWrapper {
+ flex:1;
+ justify-content: center;
+ align-items: center;
+ flex-direction: row;
+ }
+ .stickyText {
+ color: #FFFFFF;
+ font-weight: bold;
+ font-size:32;
+ margin-right: 12;
+ }
+ .stickyImage {
+ width: 64;
+ height: 64;
+ border-radius: 32;
+ }
+
+ .cell {
+ padding-top: 6;
+ padding-bottom: 6;
+ }
+ .item {
+ background-color: #FFFFFF;
+ align-items: center;
+ }
+ .itemName {
+ font-size:28;
+ color:#333333;
+ line-height:42;
+ text-align:left;
+ margin-top: 24;
+ }
+ .itemPhoto {
+ margin-top: 18;
+ width: 220;
+ height: 220;
+ margin-bottom: 18;
+ }
+ .itemDesc {
+ font-size:24;
+ margin:12;
+ color:#999999;
+ line-height:36;
+ text-align:left;
+ }
+ .itemClickBehaviour {
+ font-size:36;
+ color:#00cc99;
+ line-height:36;
+ text-align:center;
+ margin-top: 6;
+ margin-left: 24;
+ margin-right: 24;
+ margin-bottom: 30;
+ }
+
+ .fixedItem {
+ position: fixed;
+ width:78;
+ height:78;
+ background-color:#00cc99;
+ right: 32;
+ bottom: 32;
+ border-radius: 39;
+ align-items: center;
+ justify-content: center;
+ }
+ .fixedText {
+ font-size: 36;
+ color: white;
+ line-height: 36;
+ }
+
+</style>
+
+<script>
+ export default {
+ data: function() {
+ const items = [
+ {
+ src:'https://gw.alicdn.com/tps/TB1Jl1CPFXXXXcJXXXXXXXXXXXX-370-370.jpg',
+ name: 'Thomas Carlyle',
+ desc:'Genius only means hard-working all one\'s life',
+ behaviourName: 'Change count',
+ behaviour: 'changeColumnCount'
+ },
+ {
+ src:'https://gw.alicdn.com/tps/TB1Hv1JPFXXXXa3XXXXXXXXXXXX-370-370.jpg',
+ desc:'The man who has made up his mind to win will never say "impossible "',
+ behaviourName: 'Change gap',
+ behaviour: 'changeColumnGap'
+ },
+ {
+ src:'https://gw.alicdn.com/tps/TB1eNKuPFXXXXc_XpXXXXXXXXXX-370-370.jpg',
+ desc:'There is no such thing as a great talent without great will - power',
+ behaviourName: 'Show scrollbar',
+ behaviour: 'showScrollbar',
+ },
+ {
+ src:'https://gw.alicdn.com/tps/TB1DCh8PFXXXXX7aXXXXXXXXXXX-370-370.jpg',
+ name:'Addison',
+ desc:'Cease to struggle and you cease to live',
+ behaviourName: 'Change width',
+ behaviour: 'changeColumnWidth',
+ },
+ {
+ src:'https://gw.alicdn.com/tps/TB1ACygPFXXXXXwXVXXXXXXXXXX-370-370.jpg',
+ desc:'A strong man will struggle with the storms of fate',
+ behaviourName: 'Listen appear',
+ behaviour: 'listenAppear',
+ },
+ {
+ src:'https://gw.alicdn.com/tps/TB1IGShPFXXXXaqXVXXXXXXXXXX-370-370.jpg',
+ name:'Ruskin',
+ desc:'Living without an aim is like sailing without a compass',
+ behaviourName: 'Set scrollable',
+ behaviour: 'setScrollable',
+ },
+ {
+ src:'https://gw.alicdn.com/tps/TB1xU93PFXXXXXHaXXXXXXXXXXX-240-240.jpg',
+ behaviourName: 'waterfall padding',
+ behaviour: 'setPadding',
+ },
+ {
+ src:'https://gw.alicdn.com/tps/TB19hu0PFXXXXaXaXXXXXXXXXXX-240-240.jpg',
+ name:'Balzac',
+ desc:'There is no such thing as a great talent without great will - power',
+ behaviourName: 'listen scroll',
+ behaviour: 'listenScroll',
+ },
+ {
+ src:'https://gw.alicdn.com/tps/TB1ux2vPFXXXXbkXXXXXXXXXXXX-240-240.jpg',
+ behaviourName: 'listen scroll',
+ behaviour: 'listenScroll',
+ },
+ {
+ src:'https://gw.alicdn.com/tps/TB1tCCWPFXXXXa7aXXXXXXXXXXX-240-240.jpg'
+ }
+ ]
+
+ let repeatItems = [];
+ for (let i = 0; i < 5; i++) {
+ repeatItems.push(...items);
+ }
+
+ return {
+ padding: 0,
+ columnCount: 2,
+ columnGap: 12,
+ columnWidth: 'auto',
+ contentOffset: '0',
+ showScrollbar: false,
+ scrollable: true,
+ showStickyHeader: false,
+ appearImage: null,
+ disappearImage: null,
+ stickyHeaderType: 'none',
+ banner: {
+ photos: [
+ {src:'https://gw.alicdn.com/tps/TB1JyaCPFXXXXc9XXXXXXXXXXXX-140-140.jpg'},
+ {src:'https://gw.alicdn.com/tps/TB1MwSFPFXXXXbdXXXXXXXXXXXX-140-140.jpg'},
+ {src:'https://gw.alicdn.com/tps/TB1U8avPFXXXXaDXpXXXXXXXXXX-140-140.jpg'},
+ {src:'https://gw.alicdn.com/tps/TB17Xh8PFXXXXbkaXXXXXXXXXXX-140-140.jpg'},
+ {src:'https://gw.alicdn.com/tps/TB1cTmLPFXXXXXRXXXXXXXXXXXX-140-140.jpg'},
+ {src:'https://gw.alicdn.com/tps/TB1oCefPFXXXXbVXVXXXXXXXXXX-140-140.jpg'}
+ ]
+ },
+ items: repeatItems
+ }
+ },
+
+ methods: {
+ recylerScroll: function(e) {
+ this.contentOffset = e.contentOffset.y
+ },
+ onItemclick: function (behaviour) {
+ console.log(`click...${behaviour}`)
+ switch (behaviour) {
+ case 'changeColumnCount':
+ this.changeColumnCount()
+ break
+ case 'changeColumnGap':
+ this.changeColumnGap()
+ break
+ case 'changeColumnWidth':
+ this.changeColumnWidth()
+ break
+ case 'showScrollbar':
+ this.showOrHideScrollbar()
+ break
+ case 'listenAppear':
+ this.listenAppearAndDisappear()
+ break
+ case 'setScrollable':
+ this.setScrollable()
+ break
+ case 'setPadding':
+ this.setRecyclerPadding()
+ break
+ case 'listenScroll':
+ this.listenScrollEvent()
+ }
+ },
+
+ itemAppear: function(src) {
+ this.appearImage = src;
+ },
+
+ itemDisappear: function(src) {
+ this.disappearImage = src;
+ },
+
+ changeColumnCount: function() {
+ if (this.columnCount === 2) {
+ this.columnCount = 3
+ } else {
+ this.columnCount = 2
+ }
+ },
+
+ changeColumnGap: function() {
+ if (this.columnGap === 12) {
+ this.columnGap = 'normal'
+ } else {
+ this.columnGap = 12
+ }
+ },
+
+ changeColumnWidth: function() {
+ if (this.columnWidth === 'auto') {
+ this.columnWidth = 600
+ } else {
+ this.columnWidth = 'auto'
+ }
+ },
+
+ showOrHideScrollbar: function() {
+ this.showScrollbar = !this.showScrollbar
+ },
+
+ setScrollable: function() {
+ this.scrollable = !this.scrollable
+ },
+
+ listenAppearAndDisappear: function() {
+ this.stickyHeaderType = (this.stickyHeaderType === 'appear' ? 'none' : 'appear')
+ },
+
+ listenScrollEvent: function() {
+ this.stickyHeaderType = (this.stickyHeaderType === 'scroll' ? 'none' : 'scroll')
+ },
+
+ scrollToTop: function() {
+ weex.requireModule('dom').scrollToElement(this.$refs.header)
+ },
+
+ setRecyclerPadding: function() {
+ this.padding = (this.padding == 0 ? 12 : 0);
+ }
+ }
+ }
+</script>
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/1c96da7a/examples/vue/index.vue
----------------------------------------------------------------------
diff --git a/examples/vue/index.vue b/examples/vue/index.vue
index 80af3b8..dffc5f3 100644
--- a/examples/vue/index.vue
+++ b/examples/vue/index.vue
@@ -19,6 +19,7 @@
{name: root + '/components/input', title: 'Input'},
{name: root + '/components/scroller', title: 'Scroller'},
{name: root + '/components/list', title: 'List'},
+ {name: root + '/components/waterfall', title: 'Waterfall'},
{name: root + '/components/slider', title: 'Slider'},
{name: root + '/components/a', title: 'A'},
{name: root + '/components/video', title: 'Video'},
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/1c96da7a/ios/playground/WeexDemo/DemoDefine.h
----------------------------------------------------------------------
diff --git a/ios/playground/WeexDemo/DemoDefine.h b/ios/playground/WeexDemo/DemoDefine.h
index 478ecb5..fe07a7b 100644
--- a/ios/playground/WeexDemo/DemoDefine.h
+++ b/ios/playground/WeexDemo/DemoDefine.h
@@ -18,7 +18,7 @@
#define DEMO_URL(path) [NSString stringWithFormat:@"http://%@:12580/%s", DEMO_HOST, #path]
-#define HOME_URL [NSString stringWithFormat:@"http://%@:12580/examples/build/index.js", DEMO_HOST]
+#define HOME_URL [NSString stringWithFormat:@"http://%@:12580/examples/build/vue/index.js", DEMO_HOST]
#define BUNDLE_URL [NSString stringWithFormat:@"file://%@/bundlejs/index.js",[NSBundle mainBundle].bundlePath]
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/1c96da7a/ios/playground/WeexDemo/UIView+UIThreadCheck.m
----------------------------------------------------------------------
diff --git a/ios/playground/WeexDemo/UIView+UIThreadCheck.m b/ios/playground/WeexDemo/UIView+UIThreadCheck.m
index e499f53..579eab9 100644
--- a/ios/playground/WeexDemo/UIView+UIThreadCheck.m
+++ b/ios/playground/WeexDemo/UIView+UIThreadCheck.m
@@ -10,7 +10,7 @@
#import <WeexSDK/NSObject+WXSwizzle.h>
#define WXCheckUIThread() NSAssert([NSThread isMainThread], \
-@"You can not change UI on main thread!")
+@"You must change UI on main thread!")
@implementation UIView (UIThreadCheck)
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/1c96da7a/ios/playground/WeexDemo/WXDemoViewController.m
----------------------------------------------------------------------
diff --git a/ios/playground/WeexDemo/WXDemoViewController.m b/ios/playground/WeexDemo/WXDemoViewController.m
index d354078..f962df0 100644
--- a/ios/playground/WeexDemo/WXDemoViewController.m
+++ b/ios/playground/WeexDemo/WXDemoViewController.m
@@ -94,7 +94,8 @@
- (void)dealloc
{
[_instance destroyInstance];
-#if DEBUG
+
+#ifdef DEBUG
[_instance forceGarbageCollection];
#endif
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/1c96da7a/ios/sdk/WeexSDK.xcodeproj/project.pbxproj
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK.xcodeproj/project.pbxproj b/ios/sdk/WeexSDK.xcodeproj/project.pbxproj
index 6330741..2111b76 100644
--- a/ios/sdk/WeexSDK.xcodeproj/project.pbxproj
+++ b/ios/sdk/WeexSDK.xcodeproj/project.pbxproj
@@ -115,6 +115,22 @@
744BEA561D05178F00452B5D /* WXComponent+Display.m in Sources */ = {isa = PBXBuildFile; fileRef = 744BEA541D05178F00452B5D /* WXComponent+Display.m */; };
744BEA591D0520F300452B5D /* WXComponent+Layout.h in Headers */ = {isa = PBXBuildFile; fileRef = 744BEA571D0520F300452B5D /* WXComponent+Layout.h */; };
744BEA5A1D0520F300452B5D /* WXComponent+Layout.m in Sources */ = {isa = PBXBuildFile; fileRef = 744BEA581D0520F300452B5D /* WXComponent+Layout.m */; };
+ 744D610C1E49978200B624B3 /* WXHeaderComponent.h in Headers */ = {isa = PBXBuildFile; fileRef = 744D610A1E49978200B624B3 /* WXHeaderComponent.h */; };
+ 744D610D1E49978200B624B3 /* WXHeaderComponent.m in Sources */ = {isa = PBXBuildFile; fileRef = 744D610B1E49978200B624B3 /* WXHeaderComponent.m */; };
+ 744D61101E49979000B624B3 /* WXFooterComponent.h in Headers */ = {isa = PBXBuildFile; fileRef = 744D610E1E49979000B624B3 /* WXFooterComponent.h */; };
+ 744D61111E49979000B624B3 /* WXFooterComponent.m in Sources */ = {isa = PBXBuildFile; fileRef = 744D610F1E49979000B624B3 /* WXFooterComponent.m */; };
+ 744D61141E4AF23E00B624B3 /* WXDiffUtil.h in Headers */ = {isa = PBXBuildFile; fileRef = 744D61121E4AF23E00B624B3 /* WXDiffUtil.h */; };
+ 744D61151E4AF23E00B624B3 /* WXDiffUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = 744D61131E4AF23E00B624B3 /* WXDiffUtil.m */; };
+ 745B2D681E5A8E1E0092D38A /* WXMultiColumnLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 745B2D5E1E5A8E1E0092D38A /* WXMultiColumnLayout.h */; };
+ 745B2D691E5A8E1E0092D38A /* WXMultiColumnLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = 745B2D5F1E5A8E1E0092D38A /* WXMultiColumnLayout.m */; };
+ 745B2D6A1E5A8E1E0092D38A /* WXRecyclerComponent.h in Headers */ = {isa = PBXBuildFile; fileRef = 745B2D601E5A8E1E0092D38A /* WXRecyclerComponent.h */; };
+ 745B2D6B1E5A8E1E0092D38A /* WXRecyclerComponent.m in Sources */ = {isa = PBXBuildFile; fileRef = 745B2D611E5A8E1E0092D38A /* WXRecyclerComponent.m */; };
+ 745B2D6C1E5A8E1E0092D38A /* WXRecyclerDataController.h in Headers */ = {isa = PBXBuildFile; fileRef = 745B2D621E5A8E1E0092D38A /* WXRecyclerDataController.h */; };
+ 745B2D6D1E5A8E1E0092D38A /* WXRecyclerDataController.m in Sources */ = {isa = PBXBuildFile; fileRef = 745B2D631E5A8E1E0092D38A /* WXRecyclerDataController.m */; };
+ 745B2D6E1E5A8E1E0092D38A /* WXRecyclerUpdateController.h in Headers */ = {isa = PBXBuildFile; fileRef = 745B2D641E5A8E1E0092D38A /* WXRecyclerUpdateController.h */; };
+ 745B2D6F1E5A8E1E0092D38A /* WXRecyclerUpdateController.m in Sources */ = {isa = PBXBuildFile; fileRef = 745B2D651E5A8E1E0092D38A /* WXRecyclerUpdateController.m */; };
+ 745B2D701E5A8E1E0092D38A /* WXSectionDataController.h in Headers */ = {isa = PBXBuildFile; fileRef = 745B2D661E5A8E1E0092D38A /* WXSectionDataController.h */; };
+ 745B2D711E5A8E1E0092D38A /* WXSectionDataController.m in Sources */ = {isa = PBXBuildFile; fileRef = 745B2D671E5A8E1E0092D38A /* WXSectionDataController.m */; };
745ED2DA1C5F2C7E002DB5A8 /* WXView.h in Headers */ = {isa = PBXBuildFile; fileRef = 745ED2D61C5F2C7E002DB5A8 /* WXView.h */; };
745ED2DB1C5F2C7E002DB5A8 /* WXView.m in Sources */ = {isa = PBXBuildFile; fileRef = 745ED2D71C5F2C7E002DB5A8 /* WXView.m */; };
7461F8901CFB373100F62D44 /* WXDisplayQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = 7461F88C1CFB373100F62D44 /* WXDisplayQueue.h */; };
@@ -399,6 +415,22 @@
744BEA541D05178F00452B5D /* WXComponent+Display.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "WXComponent+Display.m"; sourceTree = "<group>"; };
744BEA571D0520F300452B5D /* WXComponent+Layout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "WXComponent+Layout.h"; path = "Layout/WXComponent+Layout.h"; sourceTree = "<group>"; };
744BEA581D0520F300452B5D /* WXComponent+Layout.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "WXComponent+Layout.m"; path = "Layout/WXComponent+Layout.m"; sourceTree = "<group>"; };
+ 744D610A1E49978200B624B3 /* WXHeaderComponent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WXHeaderComponent.h; sourceTree = "<group>"; };
+ 744D610B1E49978200B624B3 /* WXHeaderComponent.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WXHeaderComponent.m; sourceTree = "<group>"; };
+ 744D610E1E49979000B624B3 /* WXFooterComponent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WXFooterComponent.h; sourceTree = "<group>"; };
+ 744D610F1E49979000B624B3 /* WXFooterComponent.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WXFooterComponent.m; sourceTree = "<group>"; };
+ 744D61121E4AF23E00B624B3 /* WXDiffUtil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WXDiffUtil.h; sourceTree = "<group>"; };
+ 744D61131E4AF23E00B624B3 /* WXDiffUtil.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WXDiffUtil.m; sourceTree = "<group>"; };
+ 745B2D5E1E5A8E1E0092D38A /* WXMultiColumnLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WXMultiColumnLayout.h; path = WeexSDK/Sources/Component/Recycler/WXMultiColumnLayout.h; sourceTree = SOURCE_ROOT; };
+ 745B2D5F1E5A8E1E0092D38A /* WXMultiColumnLayout.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = WXMultiColumnLayout.m; path = WeexSDK/Sources/Component/Recycler/WXMultiColumnLayout.m; sourceTree = SOURCE_ROOT; };
+ 745B2D601E5A8E1E0092D38A /* WXRecyclerComponent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WXRecyclerComponent.h; path = WeexSDK/Sources/Component/Recycler/WXRecyclerComponent.h; sourceTree = SOURCE_ROOT; };
+ 745B2D611E5A8E1E0092D38A /* WXRecyclerComponent.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = WXRecyclerComponent.m; path = WeexSDK/Sources/Component/Recycler/WXRecyclerComponent.m; sourceTree = SOURCE_ROOT; };
+ 745B2D621E5A8E1E0092D38A /* WXRecyclerDataController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WXRecyclerDataController.h; path = WeexSDK/Sources/Component/Recycler/WXRecyclerDataController.h; sourceTree = SOURCE_ROOT; };
+ 745B2D631E5A8E1E0092D38A /* WXRecyclerDataController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = WXRecyclerDataController.m; path = WeexSDK/Sources/Component/Recycler/WXRecyclerDataController.m; sourceTree = SOURCE_ROOT; };
+ 745B2D641E5A8E1E0092D38A /* WXRecyclerUpdateController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WXRecyclerUpdateController.h; path = WeexSDK/Sources/Component/Recycler/WXRecyclerUpdateController.h; sourceTree = SOURCE_ROOT; };
+ 745B2D651E5A8E1E0092D38A /* WXRecyclerUpdateController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = WXRecyclerUpdateController.m; path = WeexSDK/Sources/Component/Recycler/WXRecyclerUpdateController.m; sourceTree = SOURCE_ROOT; };
+ 745B2D661E5A8E1E0092D38A /* WXSectionDataController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WXSectionDataController.h; path = WeexSDK/Sources/Component/Recycler/WXSectionDataController.h; sourceTree = SOURCE_ROOT; };
+ 745B2D671E5A8E1E0092D38A /* WXSectionDataController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = WXSectionDataController.m; path = WeexSDK/Sources/Component/Recycler/WXSectionDataController.m; sourceTree = SOURCE_ROOT; };
745ED2D61C5F2C7E002DB5A8 /* WXView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WXView.h; sourceTree = "<group>"; };
745ED2D71C5F2C7E002DB5A8 /* WXView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WXView.m; sourceTree = "<group>"; };
7461F88C1CFB373100F62D44 /* WXDisplayQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WXDisplayQueue.h; sourceTree = "<group>"; };
@@ -758,6 +790,24 @@
path = WeexSDKTests;
sourceTree = "<group>";
};
+ 74D8DB401E4825920078B667 /* Recycler */ = {
+ isa = PBXGroup;
+ children = (
+ 745B2D5E1E5A8E1E0092D38A /* WXMultiColumnLayout.h */,
+ 745B2D5F1E5A8E1E0092D38A /* WXMultiColumnLayout.m */,
+ 745B2D601E5A8E1E0092D38A /* WXRecyclerComponent.h */,
+ 745B2D611E5A8E1E0092D38A /* WXRecyclerComponent.m */,
+ 745B2D621E5A8E1E0092D38A /* WXRecyclerDataController.h */,
+ 745B2D631E5A8E1E0092D38A /* WXRecyclerDataController.m */,
+ 745B2D641E5A8E1E0092D38A /* WXRecyclerUpdateController.h */,
+ 745B2D651E5A8E1E0092D38A /* WXRecyclerUpdateController.m */,
+ 745B2D661E5A8E1E0092D38A /* WXSectionDataController.h */,
+ 745B2D671E5A8E1E0092D38A /* WXSectionDataController.m */,
+ );
+ name = Recycler;
+ path = Grid;
+ sourceTree = "<group>";
+ };
74EF31C11DE6932900667A07 /* handler */ = {
isa = PBXGroup;
children = (
@@ -968,6 +1018,8 @@
74896F2F1D1AC79400D1D593 /* NSObject+WXSwizzle.m */,
747DF6801E31AEE4005C53A8 /* WXLength.h */,
747DF6811E31AEE4005C53A8 /* WXLength.m */,
+ 744D61121E4AF23E00B624B3 /* WXDiffUtil.h */,
+ 744D61131E4AF23E00B624B3 /* WXDiffUtil.m */,
);
path = Utility;
sourceTree = "<group>";
@@ -1012,6 +1064,7 @@
77E65A0A1C155E6E008B8775 /* Component */ = {
isa = PBXGroup;
children = (
+ 74D8DB401E4825920078B667 /* Recycler */,
2A837AAC1CD9DE9200AEDF03 /* WXLoadingComponent.h */,
2A837AAD1CD9DE9200AEDF03 /* WXLoadingComponent.m */,
2A837AAE1CD9DE9200AEDF03 /* WXLoadingIndicator.h */,
@@ -1036,12 +1089,12 @@
77E65A181C155F25008B8775 /* WXScrollerComponent.m */,
2A44AB0F1C1AD5B00067A7EA /* WXSliderComponent.h */,
59D3CA461CFC3CC0008835DC /* WXSliderComponent.m */,
- 74CC7A1A1C2BC5F800829368 /* WXCellComponent.h */,
74CC7A1B1C2BC5F800829368 /* WXCellComponent.m */,
74CC7A1E1C2BF9DC00829368 /* WXListComponent.h */,
74CC7A1F1C2BF9DC00829368 /* WXListComponent.m */,
2AC750221C7565690041D390 /* WXIndicatorComponent.h */,
2AC750231C7565690041D390 /* WXIndicatorComponent.m */,
+ 74CC7A1A1C2BC5F800829368 /* WXCellComponent.h */,
2A1F57B51C75C6A600B58017 /* WXTextInputComponent.h */,
2A1F57B61C75C6A600B58017 /* WXTextInputComponent.m */,
DC03ADB81D508719003F76E7 /* WXTextAreaComponent.h */,
@@ -1059,6 +1112,10 @@
D33451071D3E19480083598A /* WXCanvasComponent.m */,
59970D2C1E0D228D0049F535 /* WXComponent+GradientColor.h */,
59970D2D1E0D228D0049F535 /* WXComponent+GradientColor.m */,
+ 744D610A1E49978200B624B3 /* WXHeaderComponent.h */,
+ 744D610B1E49978200B624B3 /* WXHeaderComponent.m */,
+ 744D610E1E49979000B624B3 /* WXFooterComponent.h */,
+ 744D610F1E49979000B624B3 /* WXFooterComponent.m */,
);
path = Component;
sourceTree = "<group>";
@@ -1157,9 +1214,12 @@
77D161621C02ED790010B15B /* WXLog.h in Headers */,
77D1614B1C02E3790010B15B /* WXConvert.h in Headers */,
59A596221CB6311F0012CD52 /* WXNavigatorModule.h in Headers */,
+ 745B2D6A1E5A8E1E0092D38A /* WXRecyclerComponent.h in Headers */,
749DC27B1D40827B009E1C91 /* WXMonitor.h in Headers */,
77E659DA1C07F594008B8775 /* WXDomModule.h in Headers */,
74EF31AD1DE58BE200667A07 /* WXURLRewriteDefaultImpl.h in Headers */,
+ 744D61101E49979000B624B3 /* WXFooterComponent.h in Headers */,
+ 744D61141E4AF23E00B624B3 /* WXDiffUtil.h in Headers */,
74862F791E02B88D00B7A041 /* JSValue+Weex.h in Headers */,
2A1F57B71C75C6A600B58017 /* WXTextInputComponent.h in Headers */,
C4F012791E1502A6003378D0 /* SRWebSocket+Weex.h in Headers */,
@@ -1173,6 +1233,8 @@
74A4BA961CB365D100195969 /* WXAppConfiguration.h in Headers */,
7461F8921CFB373100F62D44 /* WXLayer.h in Headers */,
594C28931CF9E61A009793A4 /* WXAnimationModule.h in Headers */,
+ 745B2D701E5A8E1E0092D38A /* WXSectionDataController.h in Headers */,
+ 745B2D6E1E5A8E1E0092D38A /* WXRecyclerUpdateController.h in Headers */,
D3FC0DF71C508B2A002B9E31 /* WXTimerModule.h in Headers */,
D312CE3B1C730DEB00046D68 /* WXWebComponent.h in Headers */,
741081261CEDB4EC001BC6E5 /* WXComponent_internal.h in Headers */,
@@ -1213,9 +1275,12 @@
D33451081D3E19480083598A /* WXCanvasComponent.h in Headers */,
74B8BEFE1DC47B72004A6027 /* WXRootView.h in Headers */,
77E65A111C155EA8008B8775 /* WXImageComponent.h in Headers */,
+ 745B2D6C1E5A8E1E0092D38A /* WXRecyclerDataController.h in Headers */,
+ 745B2D681E5A8E1E0092D38A /* WXMultiColumnLayout.h in Headers */,
2A60CE9C1C91733E00857B9F /* WXSwitchComponent.h in Headers */,
2A4445BF1CA8FD56009E7C6D /* WXTextComponentProtocol.h in Headers */,
746319021C60AFC100EFEBD4 /* WXThreadSafeCounter.h in Headers */,
+ 744D610C1E49978200B624B3 /* WXHeaderComponent.h in Headers */,
77D1613C1C02DEA60010B15B /* WXJSCoreBridge.h in Headers */,
74D205201E091B8000128F44 /* WXCallJSMethod.h in Headers */,
741DFE061DDD9B30009B020F /* UIBezierPath+Weex.h in Headers */,
@@ -1432,6 +1497,9 @@
C4F0127C1E1502A6003378D0 /* WXWebSocketDefaultImpl.m in Sources */,
77E65A0E1C155E99008B8775 /* WXDivComponent.m in Sources */,
2A60CE9D1C91733E00857B9F /* WXSwitchComponent.m in Sources */,
+ 744D61111E49979000B624B3 /* WXFooterComponent.m in Sources */,
+ 745B2D6F1E5A8E1E0092D38A /* WXRecyclerUpdateController.m in Sources */,
+ 745B2D6B1E5A8E1E0092D38A /* WXRecyclerComponent.m in Sources */,
2A837AB71CD9DE9200AEDF03 /* WXRefreshComponent.m in Sources */,
74A4BA9B1CB3BAA100195969 /* WXThreadSafeMutableDictionary.m in Sources */,
77E65A1A1C155F25008B8775 /* WXScrollerComponent.m in Sources */,
@@ -1459,6 +1527,7 @@
74AD99851D5B0E59008F0336 /* WXPolyfillSet.m in Sources */,
D317338D1C57257000BB7539 /* WXTransform.m in Sources */,
7461F8A91CFC33A800F62D44 /* WXThreadSafeMutableArray.m in Sources */,
+ 745B2D6D1E5A8E1E0092D38A /* WXRecyclerDataController.m in Sources */,
2AC750251C7565690041D390 /* WXIndicatorComponent.m in Sources */,
591DD3311D23AD5800BE8709 /* WXErrorView.m in Sources */,
59D3CA4B1CFC3CE1008835DC /* NSTimer+Weex.m in Sources */,
@@ -1470,6 +1539,7 @@
77E65A161C155EB5008B8775 /* WXTextComponent.m in Sources */,
746319031C60AFC100EFEBD4 /* WXThreadSafeCounter.m in Sources */,
74A4BAA71CB4F98300195969 /* WXStreamModule.m in Sources */,
+ 744D610D1E49978200B624B3 /* WXHeaderComponent.m in Sources */,
59597F991D2A041700EE9317 /* WXDebugLoggerBridge.m in Sources */,
77E659F21C0C3612008B8775 /* WXModuleFactory.m in Sources */,
DCF343681E49CAEE00A2FB34 /* WXJSExceptionInfo.m in Sources */,
@@ -1478,6 +1548,7 @@
2A919DA71E321F1F006EB6B5 /* WXBridgeMethod.m in Sources */,
DCAB35FF1D658EB700C0EA70 /* WXRuleManager.m in Sources */,
77D161251C02DDD10010B15B /* WXSDKInstance.m in Sources */,
+ 744D61151E4AF23E00B624B3 /* WXDiffUtil.m in Sources */,
74EF31AE1DE58BE200667A07 /* WXURLRewriteDefaultImpl.m in Sources */,
C4C30DE81E1B833D00786B6C /* WXComponent+PseudoClassManagement.m in Sources */,
74915F481C8EB02B00BEBCC0 /* WXAssert.m in Sources */,
@@ -1488,6 +1559,7 @@
D334510D1D3E19B80083598A /* WXCanvasModule.m in Sources */,
741081241CED6756001BC6E5 /* WXComponentFactory.m in Sources */,
D362F9501C83EDA20003F546 /* WXWebViewModule.m in Sources */,
+ 745B2D711E5A8E1E0092D38A /* WXSectionDataController.m in Sources */,
2A1F57B81C75C6A600B58017 /* WXTextInputComponent.m in Sources */,
74CC7A1D1C2BC5F800829368 /* WXCellComponent.m in Sources */,
74862F821E03A24500B7A041 /* WXComponentMethod.m in Sources */,
@@ -1522,6 +1594,7 @@
C4B834271DE69B09007AD27E /* WXPickerModule.m in Sources */,
C4F0127A1E1502A6003378D0 /* SRWebSocket+Weex.m in Sources */,
59970D2F1E0D228D0049F535 /* WXComponent+GradientColor.m in Sources */,
+ 745B2D691E5A8E1E0092D38A /* WXMultiColumnLayout.m in Sources */,
77D161391C02DE940010B15B /* WXBridgeManager.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/1c96da7a/ios/sdk/WeexSDK/Sources/Component/Recycler/WXMultiColumnLayout.h
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/Recycler/WXMultiColumnLayout.h b/ios/sdk/WeexSDK/Sources/Component/Recycler/WXMultiColumnLayout.h
new file mode 100644
index 0000000..c28180d
--- /dev/null
+++ b/ios/sdk/WeexSDK/Sources/Component/Recycler/WXMultiColumnLayout.h
@@ -0,0 +1,42 @@
+/**
+ * Created by Weex.
+ * Copyright (c) 2016, Alibaba, Inc. All rights reserved.
+ *
+ * This source code is licensed under the Apache Licence 2.0.
+ * For the full copyright and license information,please view the LICENSE file in the root directory of this source tree.
+ */
+
+#import <UIKit/UIKit.h>
+#import "WXLength.h"
+
+extern NSString * const kCollectionSupplementaryViewKindHeader;
+
+@protocol WXMultiColumnLayoutDelegate <NSObject>
+
+- (UIEdgeInsets)collectionView:(UICollectionView *)collectionView insetForLayout:(UICollectionViewLayout *)collectionViewLayout;
+
+- (CGFloat)collectionView:(UICollectionView *)collectionView contentWidthForLayout:(UICollectionViewLayout *)collectionViewLayout;
+
+- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout heightForItemAtIndexPath:(NSIndexPath *)indexPath;
+
+- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout heightForHeaderInSection:(NSInteger)section;
+
+- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout isNeedStickyForHeaderInSection:(NSInteger)section;
+
+@end
+
+@interface WXMultiColumnLayout : UICollectionViewLayout
+
+@property (nonatomic, assign) id<WXMultiColumnLayoutDelegate> delegate;
+
+@property (nonatomic, strong) WXLength *columnCount;
+
+@property (nonatomic, strong) WXLength *columnWidth;
+
+@property (nonatomic, assign) float columnGap;
+
+@property (nonatomic, assign, readonly) CGFloat computedColumnWidth;
+@property (nonatomic, assign, readonly) int computedColumnCount;
+@property (nonatomic, assign, readonly) CGFloat computedHeaderWidth;
+
+@end
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/1c96da7a/ios/sdk/WeexSDK/Sources/Component/Recycler/WXMultiColumnLayout.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/Recycler/WXMultiColumnLayout.m b/ios/sdk/WeexSDK/Sources/Component/Recycler/WXMultiColumnLayout.m
new file mode 100644
index 0000000..d5a1512
--- /dev/null
+++ b/ios/sdk/WeexSDK/Sources/Component/Recycler/WXMultiColumnLayout.m
@@ -0,0 +1,386 @@
+/**
+ * Created by Weex.
+ * Copyright (c) 2016, Alibaba, Inc. All rights reserved.
+ *
+ * This source code is licensed under the Apache Licence 2.0.
+ * For the full copyright and license information,please view the LICENSE file in the root directory of this source tree.
+ */
+
+#import "WXMultiColumnLayout.h"
+#import "NSArray+Weex.h"
+#import "WXUtility.h"
+#import "WXAssert.h"
+
+void computeColumnWidthAndCount(float availableWidth, WXLength *columnCount, WXLength *columnWidth, float columnGap, int *N, float *W)
+{
+ /* Pseudo-algorithm according to
+ * https://www.w3.org/TR/css3-multicol/
+ * Note that, in most cases, only one of \u2018column-width\u2019 and \u2018column-count\u2019 affect the layout.
+ * If \u2018column-width\u2019 has a value other than \u2018auto\u2019, \u2018column-count\u2019 indicates the maximum number of columns.
+ **/
+ if (columnWidth.isAuto && columnCount.isAuto) {
+ WXAssert(NO, @"Unsupport both of column-width and column-count being auto.");
+ return;
+ }
+
+ if (columnWidth.isAuto && !columnCount.isAuto) {
+ *N = columnCount.intValue;
+ *W = MAX(0, (availableWidth - ((*N -1) * columnGap)) / *N);
+ }
+
+ if (!columnWidth.isAuto && columnCount.isAuto) {
+ *N = MAX(1, WXFloorPixelValue((availableWidth + columnGap) / (columnWidth.floatValue + columnGap)));
+ *W = ((availableWidth + columnGap) / *N) - columnGap;
+ }
+
+ if (!columnWidth.isAuto && !columnCount.isAuto) {
+ *N = MIN(columnCount.intValue, WXFloorPixelValue((availableWidth + columnGap) / (columnWidth.floatValue + columnGap)));
+ *W = ((availableWidth + columnGap) / *N) - columnGap;
+ }
+}
+
+NSString * const kCollectionSupplementaryViewKindHeader = @"WXCollectionSupplementaryViewKindHeader";
+NSString * const kMultiColumnLayoutHeader = @"WXMultiColumnLayoutHeader";
+NSString * const kMultiColumnLayoutCell = @"WXMultiColumnLayoutCell";
+
+@interface WXMultiColumnLayoutHeaderAttributes : UICollectionViewLayoutAttributes
+
+@property (nonatomic, assign) BOOL isSticky;
+
+@end
+
+@implementation WXMultiColumnLayoutHeaderAttributes
+
+- (id)copyWithZone:(NSZone *)zone
+{
+ WXMultiColumnLayoutHeaderAttributes *copy = [super copyWithZone:zone];
+ copy.isSticky = self.isSticky;
+
+ return copy;
+}
+
+@end
+
+@interface WXMultiColumnLayout ()
+
+@property (nonatomic, strong) NSMutableDictionary<NSString *, NSDictionary<id, UICollectionViewLayoutAttributes *> *> *layoutAttributes;
+@property (nonatomic, strong) NSMutableArray<NSNumber *> *columnsMaxHeights;
+
+@property (nonatomic, assign, readwrite) CGFloat computedColumnWidth;
+@property (nonatomic, assign, readwrite) int computedColumnCount;
+
+@end
+
+@implementation WXMultiColumnLayout
+
+- (instancetype)init
+{
+ if (self = [super init]) {
+ _layoutAttributes = [NSMutableDictionary dictionary];
+ _columnsMaxHeights = [NSMutableArray array];
+ }
+
+ return self;
+}
+
+#pragma mark - Public Accessors
+
+- (void)setColumnCount:(WXLength *)columnCount
+{
+ if (!(columnCount.isAuto && _columnCount.isAuto) || _columnCount.intValue != columnCount.intValue) {
+ _columnCount = columnCount;
+ [self _cleanComputed];
+ }
+}
+
+- (void)setColumnWidth:(WXLength *)columnWidth
+{
+ if (!(columnWidth.isAuto && _columnWidth.isAuto) || _columnWidth.floatValue != columnWidth.floatValue) {
+ _columnWidth = columnWidth;
+ [self _cleanComputed];
+ }
+}
+
+- (void)setColumnGap:(float)columnGap
+{
+ if (_columnGap != columnGap) {
+ _columnGap = columnGap;
+ [self _cleanComputed];
+ }
+}
+
+- (CGFloat)computedColumnWidth
+{
+ if (!_computedColumnWidth && !_computedColumnCount) {
+ [self _computeColumnWidthAndCount];
+ }
+
+ return _computedColumnWidth;
+}
+
+- (int)computedColumnCount
+{
+ if (!_computedColumnWidth && !_computedColumnCount) {
+ [self _computeColumnWidthAndCount];
+ }
+
+ return _computedColumnCount;
+}
+
+- (CGFloat)computedHeaderWidth
+{
+ UIEdgeInsets insets = [self.delegate collectionView:self.collectionView insetForLayout:self];
+ return self.contentWidth - (insets.left + insets.right);
+}
+
+#pragma mark - Methods to Override for UICollectionViewLayout
+
+- (void)prepareLayout
+{
+ [super prepareLayout];
+
+ [self _cleanup];
+
+ NSInteger numberOfSections = [self.collectionView numberOfSections];
+ UIEdgeInsets insets = [self.delegate collectionView:self.collectionView insetForLayout:self];
+
+ float columnWidth = self.computedColumnWidth;
+ int columnCount = self.computedColumnCount;
+ float columnGap = self.columnGap;
+
+ CGFloat currentHeight = insets.top;
+ NSMutableDictionary *headersAttributes = [NSMutableDictionary dictionaryWithCapacity:numberOfSections];
+ NSMutableDictionary *cellAttributes = [NSMutableDictionary dictionary];
+ for (NSInteger i = 0; i < columnCount; i++) {
+ [self.columnsMaxHeights addObject:@(currentHeight)];
+ }
+
+ for (NSInteger section = 0; section < numberOfSections; section++) {
+ CGFloat headerHeight = [self.delegate collectionView:self.collectionView layout:self heightForHeaderInSection:section];
+ // header
+ if (headerHeight > 0) {
+ WXMultiColumnLayoutHeaderAttributes *headerAttributes = [WXMultiColumnLayoutHeaderAttributes layoutAttributesForSupplementaryViewOfKind:kCollectionSupplementaryViewKindHeader withIndexPath:[NSIndexPath indexPathForItem:0 inSection:section]];
+ headerAttributes.frame = CGRectMake(insets.left, currentHeight, self.contentWidth - (insets.left + insets.right), headerHeight);
+ headerAttributes.isSticky = [self.delegate collectionView:self.collectionView layout:self isNeedStickyForHeaderInSection:section];
+ headerAttributes.zIndex = headerAttributes.isSticky ? 1 : 0;
+ headersAttributes[@(section)] = headerAttributes;
+
+ currentHeight = CGRectGetMaxY(headerAttributes.frame);
+ [self _columnsReachToHeight:currentHeight];
+ }
+
+ // cells
+ for (NSInteger item = 0; item < [self.collectionView numberOfItemsInSection:section]; item++) {
+ NSIndexPath *indexPath = [NSIndexPath indexPathForItem:item inSection:section];
+ CGFloat itemHeight = [self.delegate collectionView:self.collectionView layout:self heightForItemAtIndexPath:indexPath];
+ UICollectionViewLayoutAttributes *itemAttributes = [UICollectionViewLayoutAttributes layoutAttributesForCellWithIndexPath:indexPath];
+ NSUInteger column = [self _minHeightColumnForAllColumns];
+ CGFloat x = insets.left + (columnWidth + columnGap) * column;
+ CGFloat y = [self.columnsMaxHeights[column] floatValue];
+ itemAttributes.frame = CGRectMake(x, y, columnWidth, itemHeight);
+ itemAttributes.zIndex = 0;
+ cellAttributes[indexPath] = itemAttributes;
+
+ self.columnsMaxHeights[column] = @(CGRectGetMaxY(itemAttributes.frame));
+ }
+ }
+
+ currentHeight = [self _maxHeightForAllColumns] + insets.bottom;
+ [self _columnsReachToHeight:currentHeight];
+
+ self.layoutAttributes[kMultiColumnLayoutHeader] = headersAttributes;
+ self.layoutAttributes[kMultiColumnLayoutCell] = cellAttributes;
+}
+
+- (CGSize)collectionViewContentSize
+{
+ NSInteger numberOfSections = [self.collectionView numberOfSections];
+ if (numberOfSections == 0) {
+ return CGSizeZero;
+ }
+
+ return CGSizeMake(self.contentWidth, self.contentHeight);
+}
+
+- (NSArray<UICollectionViewLayoutAttributes *> *)layoutAttributesForElementsInRect:(CGRect)rect
+{
+ NSMutableArray<WXMultiColumnLayoutHeaderAttributes *> *stickyHeaders = [NSMutableArray array];
+ NSMutableArray<UICollectionViewLayoutAttributes *> *result = [NSMutableArray array];
+
+ [self.layoutAttributes enumerateKeysAndObjectsUsingBlock:^(NSString * _Nonnull kind, NSDictionary<id,UICollectionViewLayoutAttributes *> * _Nonnull dictionary, BOOL * _Nonnull stop) {
+ [dictionary enumerateKeysAndObjectsUsingBlock:^(id _Nonnull key, UICollectionViewLayoutAttributes * _Nonnull attributes, BOOL * _Nonnull stop) {
+ if (attributes.representedElementKind == kCollectionSupplementaryViewKindHeader
+ && [self.delegate collectionView:self.collectionView layout:self isNeedStickyForHeaderInSection:attributes.indexPath.section]) {
+ [stickyHeaders addObject:(WXMultiColumnLayoutHeaderAttributes *)attributes];
+ } else if (CGRectIntersectsRect(rect, attributes.frame)) {
+ [result addObject:attributes];
+ }
+ }];
+ }];
+
+ [stickyHeaders sortUsingComparator:^NSComparisonResult(WXMultiColumnLayoutHeaderAttributes *obj1, WXMultiColumnLayoutHeaderAttributes *obj2) {
+ if (obj1.indexPath.section < obj2.indexPath.section) {
+ return NSOrderedAscending;
+ } else {
+ return NSOrderedDescending;
+ }
+ }];
+
+ for (int i = 0; i < stickyHeaders.count; i++) {
+ WXMultiColumnLayoutHeaderAttributes *header = stickyHeaders[i];
+ [self _adjustStickyForHeaderAttributes:header next:(i == stickyHeaders.count - 1) ? nil : stickyHeaders[i + 1]];
+ [result addObject:header];
+ }
+
+ WXLogDebug(@"return result attributes:%@ for rect:%@", result, NSStringFromCGRect(rect));
+
+ return result;
+}
+
+- (void)_adjustStickyForHeaderAttributes:(WXMultiColumnLayoutHeaderAttributes *)header
+ next:(WXMultiColumnLayoutHeaderAttributes *)nextHeader
+{
+ CGRect bounds = self.collectionView.bounds;
+ CGFloat originY = header.frame.origin.y;
+ CGFloat maxY = nextHeader ? (nextHeader.frame.origin.y - header.frame.size.height) : (CGRectGetMaxY(bounds) - header.frame.size.height);
+ CGFloat currentY = CGRectGetMaxY(bounds) - bounds.size.height + self.collectionView.contentInset.top;
+
+ CGFloat resultY = MIN(MAX(currentY, originY), maxY);
+ CGPoint origin = header.frame.origin;
+ origin.y = resultY;
+
+ header.frame = (CGRect){origin, header.frame.size};
+ header.hidden = NO;
+}
+
+- (UICollectionViewLayoutAttributes *)layoutAttributesForSupplementaryViewOfKind:(NSString *)elementKind atIndexPath:(NSIndexPath *)indexPath
+{
+ if ([elementKind isEqualToString:kCollectionSupplementaryViewKindHeader]) {
+ UICollectionViewLayoutAttributes *attributes = self.layoutAttributes[kMultiColumnLayoutHeader][@(indexPath.section)];
+ WXLogDebug(@"return header attributes:%@ for index path:%@", attributes, indexPath);
+
+ return attributes;
+ }
+
+ return nil;
+}
+
+- (UICollectionViewLayoutAttributes *)layoutAttributesForItemAtIndexPath:(NSIndexPath *)indexPath
+{
+ if (self.layoutAttributes.count == 0) {
+ [self prepareLayout];
+ }
+
+ UICollectionViewLayoutAttributes *attributes = self.layoutAttributes[kMultiColumnLayoutCell][indexPath];
+ WXLogDebug(@"return item attributes:%@ for index path:%@", attributes, indexPath);
+ return attributes;
+}
+
+- (BOOL)shouldInvalidateLayoutForBoundsChange:(CGRect)newBounds
+{
+ __block BOOL hasStickyHeader = NO;
+ [self.layoutAttributes[kMultiColumnLayoutHeader] enumerateKeysAndObjectsUsingBlock:^(id _Nonnull key, UICollectionViewLayoutAttributes * _Nonnull obj, BOOL * _Nonnull stop) {
+ WXMultiColumnLayoutHeaderAttributes *attribute = (WXMultiColumnLayoutHeaderAttributes *)obj;
+ if (attribute.isSticky) {
+ hasStickyHeader = YES;
+ *stop = YES;
+ }
+ }];
+
+ if (hasStickyHeader) {
+ // always return yes no trigger resetting sticky header's frame.
+ return YES;
+ } else {
+ CGRect oldBounds = self.collectionView.bounds;
+ if (CGRectGetWidth(newBounds) != CGRectGetWidth(oldBounds)) {
+ return YES;
+ }
+ }
+
+ return NO;
+}
+
+#pragma mark - Private
+
+- (CGFloat)contentWidth
+{
+ return [self.delegate collectionView:self.collectionView contentWidthForLayout:self];
+}
+
+- (CGFloat)contentHeight
+{
+ return [self _maxHeightForAllColumns];
+}
+
+- (void)_computeColumnWidthAndCount
+{
+ UIEdgeInsets insets = [self.delegate collectionView:self.collectionView insetForLayout:self];
+
+ int columnCount;
+ float columnWidth ;
+ float availableWidth = self.contentWidth - (insets.left + insets.right);
+ computeColumnWidthAndCount(availableWidth, self.columnCount, self.columnWidth, self.columnGap, &columnCount, &columnWidth);
+ WXAssert(columnCount > 0, @"invalid column count");
+ WXAssert(columnWidth > 0, @"invalid column width");
+
+ _computedColumnWidth = columnWidth;
+ _computedColumnCount = columnCount;
+}
+
+- (CGFloat)_maxHeightForAllColumns
+{
+ CGFloat maxHeight = 0.0;
+ for (NSNumber *number in self.columnsMaxHeights) {
+ CGFloat height = [number floatValue];
+ if (height > maxHeight) {
+ maxHeight = height;
+ }
+ }
+
+ return maxHeight;
+}
+
+- (NSUInteger)_minHeightColumnForAllColumns
+{
+ __block NSUInteger index = 0;
+ __block CGFloat minHeight = FLT_MAX;
+
+ [self.columnsMaxHeights enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
+ CGFloat height = [obj floatValue];
+ if (height < minHeight) {
+ minHeight = height;
+ index = idx;
+ }
+ }];
+
+ return index;
+}
+
+- (void)_columnsReachToHeight:(CGFloat)height
+{
+ for (NSInteger i = 0; i < self.columnsMaxHeights.count; i ++) {
+ self.columnsMaxHeights[i] = @(height);
+ }
+}
+
+- (void)_cleanup
+{
+ [self.layoutAttributes removeAllObjects];
+ [self.columnsMaxHeights removeAllObjects];
+}
+
+- (void)_cleanComputed
+{
+ _computedColumnWidth = 0;
+ _computedColumnCount = 0;
+}
+
+- (void)invalidateLayout
+{
+ [super invalidateLayout];
+
+ [self _cleanComputed];
+}
+
+
+@end
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/1c96da7a/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerComponent.h
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerComponent.h b/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerComponent.h
new file mode 100644
index 0000000..2b13e4b
--- /dev/null
+++ b/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerComponent.h
@@ -0,0 +1,12 @@
+/**
+ * Created by Weex.
+ * Copyright (c) 2016, Alibaba, Inc. All rights reserved.
+ *
+ * This source code is licensed under the Apache Licence 2.0.
+ * For the full copyright and license information,please view the LICENSE file in the root directory of this source tree.
+ */
+#import <WeexSDK/WeexSDK.h>
+
+@interface WXRecyclerComponent : WXScrollerComponent
+
+@end
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/1c96da7a/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerComponent.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerComponent.m b/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerComponent.m
new file mode 100644
index 0000000..318900f
--- /dev/null
+++ b/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerComponent.m
@@ -0,0 +1,497 @@
+/**
+ * Created by Weex.
+ * Copyright (c) 2016, Alibaba, Inc. All rights reserved.
+ *
+ * This source code is licensed under the Apache Licence 2.0.
+ * For the full copyright and license information,please view the LICENSE file in the root directory of this source tree.
+ */
+
+#import "WXRecyclerComponent.h"
+#import "WXComponent_internal.h"
+#import "WXSDKInstance_private.h"
+#import "WXRecyclerDataController.h"
+#import "WXRecyclerUpdateController.h"
+#import "WXMultiColumnLayout.h"
+#import "WXHeaderComponent.h"
+#import "WXFooterComponent.h"
+#import "WXCellComponent.h"
+#import "WXAssert.h"
+#import "WXConvert.h"
+
+static NSString * const kCollectionCellReuseIdentifier = @"WXRecyclerCell";
+static NSString * const kCollectionHeaderReuseIdentifier = @"WXRecyclerHeader";
+static float const kRecyclerNormalColumnGap = 32;
+
+typedef enum : NSUInteger {
+ WXRecyclerLayoutTypeMultiColumn,
+ WXRecyclerLayoutTypeFlex,
+ WXRecyclerLayoutTypeGrid,
+} WXRecyclerLayoutType;
+
+@interface WXCollectionView : UICollectionView
+
+@end
+
+@implementation WXCollectionView
+
+- (void)insertSubview:(UIView *)view atIndex:(NSInteger)index
+{
+ [super insertSubview:view atIndex:index];
+}
+
+- (void)layoutSubviews
+{
+ [super layoutSubviews];
+ [self.wx_component layoutDidFinish];
+}
+
+@end
+
+@interface WXCollectionViewCell : UICollectionViewCell
+
+@end
+
+@implementation WXCollectionViewCell
+
+- (void)prepareForReuse
+{
+ [super prepareForReuse];
+
+ WXCellComponent *cellComponent = (WXCellComponent *)self.wx_component;
+ if (cellComponent.isRecycle && [cellComponent isViewLoaded] && [self.contentView.subviews containsObject:cellComponent.view]) {
+ [cellComponent _unloadViewWithReusing:YES];
+ }
+}
+
+@end
+
+@interface WXRecyclerComponent () <UICollectionViewDataSource, UICollectionViewDelegate, WXMultiColumnLayoutDelegate, WXRecyclerUpdateControllerDelegate, WXCellRenderDelegate, WXHeaderRenderDelegate>
+
+@property (nonatomic, strong, readonly) WXRecyclerDataController *dataController;
+@property (nonatomic, strong, readonly) WXRecyclerUpdateController *updateController;
+@property (nonatomic, weak, readonly) UICollectionView *collectionView;
+
+@end
+
+@implementation WXRecyclerComponent
+{
+ WXRecyclerLayoutType _layoutType;
+ UICollectionViewLayout *_collectionViewlayout;
+
+ UIEdgeInsets _padding;
+}
+
+- (instancetype)initWithRef:(NSString *)ref type:(NSString *)type styles:(NSDictionary *)styles attributes:(NSDictionary *)attributes events:(NSArray *)events weexInstance:(WXSDKInstance *)weexInstance
+{
+ if (self = [super initWithRef:ref type:type styles:styles attributes:attributes events:events weexInstance:weexInstance]) {
+ [self _fillPadding];
+
+ if ([type isEqualToString:@"waterfall"] || (attributes[@"layout"] && [attributes[@"layout"] isEqualToString:@"multi-column"])) {
+ // TODO: abstraction
+ _layoutType = WXRecyclerLayoutTypeMultiColumn;
+ CGFloat scaleFactor = weexInstance.pixelScaleFactor;
+ _collectionViewlayout = [WXMultiColumnLayout new];
+ WXMultiColumnLayout *layout = (WXMultiColumnLayout *)_collectionViewlayout;
+ layout.columnWidth = [WXConvert WXLength:attributes[@"columnWidth"] isFloat:YES scaleFactor:scaleFactor] ? : [WXLength lengthWithFloat:0.0 type:WXLengthTypeAuto];
+ layout.columnCount = [WXConvert WXLength:attributes[@"columnCount"] isFloat:NO scaleFactor:1.0] ? : [WXLength lengthWithInt:1 type:WXLengthTypeFixed];
+ layout.columnGap = [self _floatValueForColumnGap:([WXConvert WXLength:attributes[@"columnGap"] isFloat:YES scaleFactor:scaleFactor] ? : [WXLength lengthWithFloat:0.0 type:WXLengthTypeNormal])];
+
+ layout.delegate = self;
+ }
+
+ _dataController = [WXRecyclerDataController new];
+ _updateController = [WXRecyclerUpdateController new];
+ _updateController.delegate = self;
+ }
+
+ return self;
+}
+
+- (void)dealloc
+{
+ _collectionView.delegate = nil;
+ _collectionView.dataSource = nil;
+}
+
+#pragma mark - Public Subclass Methods
+
+- (UIView *)loadView
+{
+ return [[WXCollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:_collectionViewlayout];
+}
+
+- (void)viewDidLoad
+{
+ [super viewDidLoad];
+
+ _collectionView = (UICollectionView *)self.view;
+ _collectionView.allowsSelection = NO;
+ _collectionView.allowsMultipleSelection = NO;
+ _collectionView.dataSource = self;
+ _collectionView.delegate = self;
+
+ [_collectionView registerClass:[WXCollectionViewCell class] forCellWithReuseIdentifier:kCollectionCellReuseIdentifier];
+ [_collectionView registerClass:[UICollectionReusableView class] forSupplementaryViewOfKind:kCollectionSupplementaryViewKindHeader withReuseIdentifier:kCollectionHeaderReuseIdentifier];
+
+ [self performUpdatesWithCompletion:^(BOOL finished) {
+
+ }];
+}
+
+- (void)viewWillUnload
+{
+ [super viewWillUnload];
+
+ _collectionView.dataSource = nil;
+ _collectionView.delegate = nil;
+}
+
+- (void)updateAttributes:(NSDictionary *)attributes
+{
+ [super updateAttributes:attributes];
+
+ if (_layoutType == WXRecyclerLayoutTypeMultiColumn) {
+ CGFloat scaleFactor = self.weexInstance.pixelScaleFactor;
+ WXMultiColumnLayout *layout = (WXMultiColumnLayout *)_collectionViewlayout;
+ BOOL needUpdateLayout = NO;
+ if (attributes[@"columnWidth"]) {
+ layout.columnWidth = [WXConvert WXLength:attributes[@"columnWidth"] isFloat:YES scaleFactor:scaleFactor];
+ needUpdateLayout = YES;
+ }
+
+ if (attributes[@"columnCount"]) {
+ layout.columnCount = [WXConvert WXLength:attributes[@"columnCount"] isFloat:NO scaleFactor:1.0];
+
+ needUpdateLayout = YES;
+ }
+ if (attributes[@"columnGap"]) {
+ layout.columnGap = [self _floatValueForColumnGap:([WXConvert WXLength:attributes[@"columnGap"] isFloat:YES scaleFactor:scaleFactor])];
+ needUpdateLayout = YES;
+ }
+
+ if (needUpdateLayout) {
+ for (WXComponent *component in self.subcomponents) {
+ [component setNeedsLayout];
+ }
+
+ [self.collectionView.collectionViewLayout invalidateLayout];
+ }
+ }
+
+}
+
+- (void)setContentSize:(CGSize)contentSize
+{
+ // Do Nothing
+}
+
+- (void)adjustSticky
+{
+ // Do Nothing, sticky is adjusted by layout
+}
+
+#pragma mark - Private Subclass Methods
+
+- (void)_updateStylesOnComponentThread:(NSDictionary *)styles resetStyles:(NSMutableArray *)resetStyles isUpdateStyles:(BOOL)isUpdateStyles
+{
+ [super _updateStylesOnComponentThread:styles resetStyles:resetStyles isUpdateStyles:isUpdateStyles];
+
+ [self _fillPadding];
+}
+
+- (void)_handleFirstScreenTime
+{
+ // Do Nothing\uff0c firstScreenTime is set by cellDidRendered:
+}
+
+- (void)scrollToComponent:(WXComponent *)component withOffset:(CGFloat)offset animated:(BOOL)animated
+{
+ [super scrollToComponent:component withOffset:offset animated:animated];
+}
+
+- (void)performUpdatesWithCompletion:(void (^)(BOOL finished))completion
+{
+ WXAssertMainThread();
+
+ if (![self isViewLoaded]) {
+ completion(NO);
+ }
+
+ NSArray *oldData = [self.dataController.sections copy];
+ NSArray *newData = [self _sectionArrayFromComponents:self.subcomponents];
+
+ [_updateController performUpdatesWithNewData:newData oldData:oldData view:_collectionView];
+}
+
+- (void)_insertSubcomponent:(WXComponent *)subcomponent atIndex:(NSInteger)index
+{
+ // TODO: refresh loading fixed
+ if ([subcomponent isKindOfClass:[WXCellComponent class]]) {
+ ((WXCellComponent *)subcomponent).delegate = self;
+ } else if ([subcomponent isKindOfClass:[WXHeaderComponent class]]) {
+ ((WXHeaderComponent *)subcomponent).delegate = self;
+ }
+
+ [super _insertSubcomponent:subcomponent atIndex:index];
+
+ if (![subcomponent isKindOfClass:[WXHeaderComponent class]]
+ && ![subcomponent isKindOfClass:[WXCellComponent class]]) {
+ return;
+ }
+
+ WXPerformBlockOnMainThread(^{
+ [self performUpdatesWithCompletion:^(BOOL finished) {
+
+ }];
+ });
+}
+
+- (void)insertSubview:(WXComponent *)subcomponent atIndex:(NSInteger)index
+{
+ //Here will not insert cell/header/footer's view again
+ if (![subcomponent isKindOfClass:[WXCellComponent class]]
+ && ![subcomponent isKindOfClass:[WXHeaderComponent class]]
+ && ![subcomponent isKindOfClass:[WXFooterComponent class]]) {
+ [super insertSubview:subcomponent atIndex:index];
+ }
+}
+
+#pragma mark - WXRecyclerUpdateControllerDelegate
+
+- (void)updateController:(WXRecyclerUpdateController *)controller willPerformUpdateWithNewData:(NSArray<WXSectionDataController *> *)newData
+{
+ [self.dataController updateData:newData];
+}
+
+- (void)updateController:(WXRecyclerUpdateController *)controller didPerformUpdateWithFinished:(BOOL)finished
+{
+
+}
+
+#pragma mark - UICollectionViewDataSource
+
+- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView
+{
+ WXLogError(@"section number:%zi", [self.dataController numberOfSections]);
+ return [self.dataController numberOfSections];
+}
+
+- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
+{
+ NSInteger numberOfItems = [self.dataController numberOfItemsInSection:section];
+
+ WXLogDebug(@"Number of items is %ld in section:%ld", numberOfItems, section);
+
+ return numberOfItems;
+}
+
+- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
+{
+ WXLogDebug(@"Getting cell at indexPath:%@", indexPath);
+
+ WXCollectionViewCell *cellView = [_collectionView dequeueReusableCellWithReuseIdentifier:kCollectionCellReuseIdentifier forIndexPath:indexPath];
+
+ UIView *contentView = [self.dataController cellForItemAtIndexPath:indexPath];
+
+ cellView.wx_component = contentView.wx_component;
+
+ if (contentView.superview == cellView.contentView) {
+ return cellView;
+ }
+
+ for (UIView *view in cellView.contentView.subviews) {
+ [view removeFromSuperview];
+ }
+
+ [cellView.contentView addSubview:contentView];
+
+ return cellView;
+}
+
+- (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath
+{
+ UICollectionReusableView *reusableView = nil;
+ if ([kind isEqualToString:kCollectionSupplementaryViewKindHeader]) {
+ reusableView = [collectionView dequeueReusableSupplementaryViewOfKind:kind withReuseIdentifier:kCollectionHeaderReuseIdentifier forIndexPath:indexPath];
+ UIView *contentView = [self.dataController viewForHeaderAtIndexPath:indexPath];
+ if (contentView.superview != reusableView) {
+ for (UIView *view in reusableView.subviews) {
+ [view removeFromSuperview];
+ }
+
+ [reusableView addSubview:contentView];
+ }
+ }
+
+ return reusableView;
+}
+
+#pragma mark - UICollectionViewDelegate
+
+- (void)collectionView:(UICollectionView *)collectionView willDisplayCell:(UICollectionViewCell *)cell forItemAtIndexPath:(NSIndexPath *)indexPath
+{
+ WXLogDebug(@"will display cell:%@, at index path:%@", cell, indexPath);
+}
+
+- (void)collectionView:(UICollectionView *)collectionView didEndDisplayingCell:(UICollectionViewCell *)cell forItemAtIndexPath:(NSIndexPath *)indexPath
+{
+ WXLogDebug(@"Did end displaying cell:%@, at index path:%@", cell, indexPath);
+}
+
+#pragma mark - WXMultiColumnLayoutDelegate
+
+- (UIEdgeInsets)collectionView:(UICollectionView *)collectionView insetForLayout:(UICollectionViewLayout *)collectionViewLayout
+{
+ return _padding;
+}
+
+- (CGFloat)collectionView:(UICollectionView *)collectionView contentWidthForLayout:(UICollectionViewLayout *)collectionViewLayout
+{
+ return self.scrollerCSSNode->style.dimensions[CSS_WIDTH];
+}
+
+- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout heightForItemAtIndexPath:(NSIndexPath *)indexPath
+{
+ CGSize itemSize = [self.dataController sizeForItemAtIndexPath:indexPath];
+ return itemSize.height;
+}
+
+- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout heightForHeaderInSection:(NSInteger)section
+{
+ CGSize headerSize = [self.dataController sizeForHeaderAtIndexPath:[NSIndexPath indexPathForItem:0 inSection:section]];
+ return headerSize.height;
+}
+
+- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout isNeedStickyForHeaderInSection:(NSInteger)section
+{
+ return [self.dataController isStickyForHeaderAtIndexPath:[NSIndexPath indexPathForItem:0 inSection:section]];
+}
+
+#pragma mark - WXHeaderRenderDelegate
+
+- (float)headerWidthForLayout:(WXHeaderComponent *)cell
+{
+ if (_layoutType == WXRecyclerLayoutTypeMultiColumn) {
+ return ((WXMultiColumnLayout *)_collectionViewlayout).computedHeaderWidth;
+ }
+
+ return 0.0;
+}
+
+- (void)headerDidLayout:(WXHeaderComponent *)cell
+{
+ WXPerformBlockOnMainThread(^{
+ [self.collectionView.collectionViewLayout invalidateLayout];
+ });
+}
+
+#pragma mark - WXCellRenderDelegate
+
+- (float)cellWidthForLayout:(WXCellComponent *)cell
+{
+ if (_layoutType == WXRecyclerLayoutTypeMultiColumn) {
+ return ((WXMultiColumnLayout *)_collectionViewlayout).computedColumnWidth;
+ }
+
+ return 0.0;
+}
+
+- (void)cellDidLayout:(WXCellComponent *)cell
+{
+ cell.isLayoutComplete = YES;
+ WXPerformBlockOnMainThread(^{
+ [self.collectionView.collectionViewLayout invalidateLayout];
+ [self performUpdatesWithCompletion:^(BOOL finished) {
+ }];
+ });
+}
+
+- (void)cellDidRendered:(WXCellComponent *)cell
+{
+
+}
+
+- (void)cellDidRemove:(WXCellComponent *)cell
+{
+
+}
+
+- (void)cell:(WXCellComponent *)cell didMoveToIndex:(NSUInteger)index
+{
+
+}
+
+#pragma makrk - private
+
+- (float)_floatValueForColumnGap:(WXLength *)gap
+{
+ if (gap.isNormal) {
+ return kRecyclerNormalColumnGap * self.weexInstance.pixelScaleFactor;
+ } else {
+ return gap.floatValue;
+ }
+}
+
+- (void)_fillPadding
+{
+ UIEdgeInsets padding = {
+ WXFloorPixelValue(self.cssNode->style.padding[CSS_TOP] + self.cssNode->style.border[CSS_TOP]),
+ WXFloorPixelValue(self.cssNode->style.padding[CSS_LEFT] + self.cssNode->style.border[CSS_LEFT]),
+ WXFloorPixelValue(self.cssNode->style.padding[CSS_BOTTOM] + self.cssNode->style.border[CSS_BOTTOM]),
+ WXFloorPixelValue(self.cssNode->style.padding[CSS_RIGHT] + self.cssNode->style.border[CSS_RIGHT])
+ };
+
+ if (!UIEdgeInsetsEqualToEdgeInsets(padding, _padding)) {
+ _padding = padding;
+ [self setNeedsLayout];
+
+ for (WXComponent *component in self.subcomponents) {
+ [component setNeedsLayout];
+ }
+
+ if (_collectionView) {
+ WXPerformBlockOnMainThread(^{
+ [_collectionView.collectionViewLayout invalidateLayout];
+ });
+ }
+ }
+}
+
+- (NSArray<WXSectionDataController *> *)_sectionArrayFromComponents:(NSArray<WXComponent *> *)components
+{
+ NSMutableArray<WXSectionDataController *> *sectionArray = [NSMutableArray array];
+ NSMutableArray<WXCellComponent *> *cellArray = [NSMutableArray array];
+ WXSectionDataController *currentSection;
+
+ for (int i = 0; i < components.count; i++) {
+ if (!currentSection) {
+ currentSection = [WXSectionDataController new];
+ }
+
+ WXComponent* component = components[i];
+
+ if ([component isKindOfClass:[WXHeaderComponent class]]) {
+ if (i != 0) {
+ currentSection.cellComponents = [cellArray copy];
+ [sectionArray addObject:currentSection];
+ currentSection = [WXSectionDataController new];
+ [cellArray removeAllObjects];
+ }
+ currentSection.headerComponent = (WXHeaderComponent *)component;
+ } else if ([component isKindOfClass:[WXCellComponent class]]
+ && ((WXCellComponent *)component).isLayoutComplete) {
+ [cellArray addObject:(WXCellComponent *)component];
+ } else if ([component isKindOfClass:[WXFooterComponent class]]) {
+ currentSection.footerComponent = component;
+ }
+
+ if (i == components.count - 1 && cellArray.count > 0) {
+ currentSection.cellComponents = cellArray;
+ [sectionArray addObject:currentSection];
+ }
+ }
+
+ return sectionArray;
+}
+
+@end
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/1c96da7a/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerDataController.h
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerDataController.h b/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerDataController.h
new file mode 100644
index 0000000..3b85155
--- /dev/null
+++ b/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerDataController.h
@@ -0,0 +1,34 @@
+/**
+ * Created by Weex.
+ * Copyright (c) 2016, Alibaba, Inc. All rights reserved.
+ *
+ * This source code is licensed under the Apache Licence 2.0.
+ * For the full copyright and license information,please view the LICENSE file in the root directory of this source tree.
+ */
+
+#import <Foundation/Foundation.h>
+#import "WXSectionDataController.h"
+
+@interface WXRecyclerDataController : NSObject
+
+@property (nonatomic, strong, readonly) NSArray<WXSectionDataController *> *sections;
+
+- (void)updateData:(NSArray<WXSectionDataController *> *)newData;
+
+- (NSInteger)numberOfSections;
+
+- (NSInteger)numberOfItemsInSection:(NSInteger)section;
+
+- (UIView *)cellForItemAtIndexPath:(NSIndexPath *)indexPath;
+
+- (CGSize)sizeForItemAtIndexPath:(NSIndexPath *)indexPath;
+
+- (UIView *)viewForHeaderAtIndexPath:(NSIndexPath *)indexPath;
+
+- (CGSize)sizeForHeaderAtIndexPath:(NSIndexPath *)indexPath;
+
+- (BOOL)isStickyForHeaderAtIndexPath:(NSIndexPath *)indexPath;
+
+- (NSIndexPath *)indexPathForCell:(WXCellComponent *)cell;
+
+@end
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/1c96da7a/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerDataController.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerDataController.m b/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerDataController.m
new file mode 100644
index 0000000..c75987c
--- /dev/null
+++ b/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerDataController.m
@@ -0,0 +1,116 @@
+/**
+ * Created by Weex.
+ * Copyright (c) 2016, Alibaba, Inc. All rights reserved.
+ *
+ * This source code is licensed under the Apache Licence 2.0.
+ * For the full copyright and license information,please view the LICENSE file in the root directory of this source tree.
+ */
+
+#import "WXRecyclerDataController.h"
+#import "WXCellComponent.h"
+#import "NSArray+Weex.h"
+#import "WXAssert.h"
+
+@interface WXRecyclerDataController ()
+
+@property (nonatomic, strong, readwrite) NSArray<WXSectionDataController *> *sections;
+@property (nonatomic, strong, readonly) NSMapTable<WXSectionDataController *, NSNumber *> *sectionControllerToSectionIndexTable;
+@property (nonatomic, strong, readonly) NSMapTable<NSNumber *, WXSectionDataController *> *sectionToSectionControllerIndexTable;
+@property (nonatomic, strong, readonly) NSMapTable<WXCellComponent *, NSIndexPath*> *cellToIndexPathTable;
+
+@end
+
+@implementation WXRecyclerDataController
+
+- (instancetype)init
+{
+ if (self = [super init]) {
+ _sections = [NSArray new];
+ _cellToIndexPathTable = [NSMapTable weakToStrongObjectsMapTable];
+ }
+
+ return self;
+}
+
+#pragma mark - Public
+
+- (void)updateData:(NSArray<WXSectionDataController *> *)newData
+{
+ WXAssertMainThread();
+
+ [self cleanup];
+ _sections = [newData copy];
+
+ [newData enumerateObjectsUsingBlock:^(WXSectionDataController * _Nonnull controller, NSUInteger idx, BOOL * _Nonnull stop) {
+ [controller.cellComponents enumerateObjectsUsingBlock:^(WXCellComponent * _Nonnull obj, NSUInteger idx2, BOOL * _Nonnull stop) {
+ NSIndexPath *indexPath = [NSIndexPath indexPathForItem:idx2 inSection:idx];
+ [_cellToIndexPathTable setObject:indexPath forKey:obj];
+ }];
+ }];
+}
+
+- (NSInteger)numberOfSections
+{
+ WXAssertMainThread();
+ return self.sections.count;
+}
+
+- (NSInteger)numberOfItemsInSection:(NSInteger)section
+{
+ WXSectionDataController *sectionController = [self dataControllerForSection:section];
+ WXAssert(sectionController, @"No section controller found for section:%ld", section);
+
+ return [sectionController numberOfItems];
+}
+
+- (UIView *)cellForItemAtIndexPath:(NSIndexPath *)indexPath
+{
+ WXSectionDataController *sectionController = [self dataControllerForSection:indexPath.section];
+ UIView *contentView = [sectionController cellForItemAtIndex:indexPath.item];
+
+ return contentView;
+}
+
+- (CGSize)sizeForItemAtIndexPath:(NSIndexPath *)indexPath
+{
+ WXSectionDataController *sectionController = [self dataControllerForSection:indexPath.section];
+ return [sectionController sizeForItemAtIndex:indexPath.item];
+}
+
+- (UIView *)viewForHeaderAtIndexPath:(NSIndexPath *)indexPath;
+{
+ WXSectionDataController *sectionController = [self dataControllerForSection:indexPath.section];
+ return [sectionController viewForHeaderAtIndex:indexPath.item];
+}
+
+- (CGSize)sizeForHeaderAtIndexPath:(NSIndexPath *)indexPath
+{
+ WXSectionDataController *sectionController = [self dataControllerForSection:indexPath.section];
+ return [sectionController sizeForHeaderAtIndex:indexPath.item];
+}
+
+- (BOOL)isStickyForHeaderAtIndexPath:(NSIndexPath *)indexPath
+{
+ WXSectionDataController *sectionController = [self dataControllerForSection:indexPath.section];
+ return [sectionController isStickyForHeaderAtIndex:indexPath.item];
+}
+
+- (NSIndexPath *)indexPathForCell:(WXCellComponent *)cell
+{
+ return [_cellToIndexPathTable objectForKey:cell];
+}
+
+#pragma mark - Private
+
+- (WXSectionDataController *)dataControllerForSection:(NSInteger)section
+{
+ WXAssertMainThread();
+ return [self.sections wx_safeObjectAtIndex:section];
+}
+
+- (void)cleanup
+{
+ [_cellToIndexPathTable removeAllObjects];
+}
+
+@end
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/1c96da7a/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerUpdateController.h
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerUpdateController.h b/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerUpdateController.h
new file mode 100644
index 0000000..c015c09
--- /dev/null
+++ b/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerUpdateController.h
@@ -0,0 +1,29 @@
+/**
+ * Created by Weex.
+ * Copyright (c) 2016, Alibaba, Inc. All rights reserved.
+ *
+ * This source code is licensed under the Apache Licence 2.0.
+ * For the full copyright and license information,please view the LICENSE file in the root directory of this source tree.
+ */
+
+#import <Foundation/Foundation.h>
+#import "WXSectionDataController.h"
+@class WXRecyclerUpdateController;
+
+@protocol WXRecyclerUpdateControllerDelegate <NSObject>
+
+- (void)updateController:(WXRecyclerUpdateController *)controller willPerformUpdateWithNewData:(NSArray<WXSectionDataController *> *)newData;
+
+- (void)updateController:(WXRecyclerUpdateController *)controller didPerformUpdateWithFinished:(BOOL)finished;
+
+@end
+
+@interface WXRecyclerUpdateController : NSObject
+
+@property (nonatomic, weak) id<WXRecyclerUpdateControllerDelegate> delegate;
+
+- (void)performUpdatesWithNewData:(NSArray<WXSectionDataController *> *)newData
+ oldData:(NSArray<WXSectionDataController *> *)oldData
+ view:(UICollectionView *)collectionView;
+@end
+
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/1c96da7a/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerUpdateController.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerUpdateController.m b/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerUpdateController.m
new file mode 100644
index 0000000..ae521ea
--- /dev/null
+++ b/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerUpdateController.m
@@ -0,0 +1,223 @@
+/**
+ * Created by Weex.
+ * Copyright (c) 2016, Alibaba, Inc. All rights reserved.
+ *
+ * This source code is licensed under the Apache Licence 2.0.
+ * For the full copyright and license information,please view the LICENSE file in the root directory of this source tree.
+ */
+
+#import "WXRecyclerUpdateController.h"
+#import "WXCellComponent.h"
+#import "WXAssert.h"
+#import "WXLog.h"
+#import "WXDiffUtil.h"
+#import "NSArray+Weex.h"
+
+@interface WXRecyclerDiffResult : NSObject
+
+@property (nonatomic, strong, readonly) NSIndexSet *insertSections;
+@property (nonatomic, strong, readonly) NSIndexSet *deleteSections;
+@property (nonatomic, strong, readonly) NSIndexSet *reloadSections;
+
+@property (nonatomic, strong, readonly) NSMutableSet<NSIndexPath *> *deleteIndexPaths;
+@property (nonatomic, strong, readonly) NSMutableSet<NSIndexPath *> *insertIndexPaths;
+@property (nonatomic, strong, readonly) NSMutableSet<NSIndexPath *> *reloadIndexPaths;
+
+- (BOOL)hasChanges;
+
+@end
+
+@implementation WXRecyclerDiffResult
+
+- (instancetype)initWithInsertSections:(NSIndexSet *)insertSections
+ deleteSections:(NSIndexSet *)deletesSections
+ reloadSections:(NSIndexSet *)reloadSections
+ insertIndexPaths:(NSMutableSet<NSIndexPath *> *)insertIndexPaths
+ deleteIndexPaths:(NSMutableSet<NSIndexPath *> *)deleteIndexPaths
+ reloadIndexPaths:(NSMutableSet<NSIndexPath *> *)reloadIndexPaths
+{
+ if (self = [super init]) {
+ _insertSections = [insertSections copy];
+ _deleteSections = [deletesSections copy];
+ _reloadSections = [reloadSections copy];
+ _insertIndexPaths = [insertIndexPaths copy];
+ _deleteIndexPaths = [deleteIndexPaths copy];
+ _reloadIndexPaths = [reloadIndexPaths copy];
+ }
+
+ return self;
+}
+
+- (BOOL)hasChanges
+{
+ return _insertSections.count > 0 || _deleteSections.count > 0 || _reloadSections.count > 0 || _insertIndexPaths.count > 0 || _deleteIndexPaths.count > 0 || _reloadIndexPaths.count > 0;
+}
+
+- (NSString *)description
+{
+ return [NSString stringWithFormat:@"<%@: %p; insert sections: %@; delete sections: %@; reload sections: %@; insert index paths: %@; delete index paths: %@; reload index paths: %@", NSStringFromClass([self class]), self,_insertSections, _deleteSections, _reloadSections, _insertIndexPaths, _deleteIndexPaths, _reloadIndexPaths];
+}
+
+@end
+
+@interface WXRecyclerUpdateController ()
+
+@property (nonatomic, copy) NSArray<WXSectionDataController *> *theNewData;
+@property (nonatomic, copy) NSArray<WXSectionDataController *> *theOldData;
+@property (nonatomic, weak) UICollectionView *collectionView;
+@property (nonatomic, assign) BOOL isUpdating;
+
+@end
+
+@implementation WXRecyclerUpdateController
+
+- (void)performUpdatesWithNewData:(NSArray<WXSectionDataController *> *)newData oldData:(NSArray<WXSectionDataController *> *)oldData view:(UICollectionView *)collectionView
+{
+ if (!collectionView) {
+ return;
+ }
+
+ self.theNewData = newData;
+ self.theOldData = oldData;
+ self.collectionView = collectionView;
+
+ [self checkUpdates];
+}
+
+- (void)checkUpdates
+{
+ dispatch_async(dispatch_get_main_queue(), ^{
+ if (self.isUpdating || (!self.theOldData && !self.theNewData)) {
+ return ;
+ }
+
+ [self performBatchUpdates];
+ });
+}
+
+- (void)performBatchUpdates
+{
+ WXAssertMainThread();
+ WXAssert(!self.isUpdating, @"Can not perform updates while an updating is being performed");
+
+ UICollectionView *collectionView = self.collectionView;
+ if (!collectionView) {
+ return;
+ }
+
+ NSArray<WXSectionDataController *> *newData = [self.theNewData copy];
+ NSArray<WXSectionDataController *> *oldData = [self.theOldData copy];
+
+ [self cleanup];
+
+ WXRecyclerDiffResult *diffResult = [self diffWithNewData:newData oldData:oldData];
+ if (![diffResult hasChanges]) {
+ return;
+ }
+
+ void (^updates)() = ^{
+ [UIView setAnimationsEnabled:NO];
+ WXLogDebug(@"UICollectionView update:%@", diffResult);
+ [self applyUpdate:diffResult toCollectionView:self.collectionView];
+ };
+
+ void (^completion)(BOOL) = ^(BOOL finished) {
+ [UIView setAnimationsEnabled:YES];
+ self.isUpdating = NO;
+ [self.delegate updateController:self didPerformUpdateWithFinished:finished];
+ [self checkUpdates];
+ };
+
+ self.isUpdating = YES;
+
+ [self.delegate updateController:self willPerformUpdateWithNewData:newData];
+
+ [collectionView performBatchUpdates:updates completion:completion];
+}
+
+- (void)cleanup
+{
+ self.theNewData = nil;
+ self.theOldData = nil;
+}
+
+- (WXRecyclerDiffResult *)diffWithNewData:(NSArray<WXSectionDataController *> *)newData
+ oldData:(NSArray<WXSectionDataController *> *)oldData
+{
+ NSMutableIndexSet *reloadSections = [NSMutableIndexSet indexSet];
+ NSMutableSet<NSIndexPath *> *reloadIndexPaths = [NSMutableSet set];
+ NSMutableSet<NSIndexPath *> *deleteIndexPaths = [NSMutableSet set];
+ NSMutableSet<NSIndexPath *> *insertIndexPaths = [NSMutableSet set];
+
+ WXDiffResult *sectionDiffResult = [WXDiffUtil diffWithMinimumDistance:newData oldArray:oldData];
+
+ WXLogDebug(@"section diff result:%@", sectionDiffResult);
+
+ [sectionDiffResult.inserts enumerateIndexesUsingBlock:^(NSUInteger idx, BOOL * _Nonnull stop) {
+ WXSectionDataController *newSection = [newData wx_safeObjectAtIndex:idx];
+ [newSection.cellComponents enumerateObjectsUsingBlock:^(WXCellComponent * _Nonnull obj, NSUInteger idx2, BOOL * _Nonnull stop) {
+ if (obj.isLayoutComplete) {
+ NSIndexPath *insertIndexPath = [NSIndexPath indexPathForItem:idx2 inSection:idx];
+ [insertIndexPaths addObject:insertIndexPath];
+ }
+ }];
+ WXAssert(newSection, @"No section found in new index:%ld");
+ }];
+
+ for (WXDiffUpdateIndex *sectionUpdate in sectionDiffResult.updates) {
+ WXSectionDataController *oldSection = [oldData wx_safeObjectAtIndex:sectionUpdate.oldIndex];
+ WXSectionDataController *newSection = [newData wx_safeObjectAtIndex:sectionUpdate.newIndex];
+ WXAssert(newSection && oldSection, @"No section found in old index:%ld, new index:%ld", sectionUpdate.oldIndex, sectionUpdate.newIndex);
+
+ WXDiffResult *itemDiffResult = [WXDiffUtil diffWithMinimumDistance:newSection.cellComponents oldArray:oldSection.cellComponents];
+ if (![itemDiffResult hasChanges]) {
+ // header or footer need to be updated
+ [reloadSections addIndex:sectionUpdate.oldIndex];
+ } else {
+ for (WXDiffUpdateIndex *update in itemDiffResult.updates) {
+ NSIndexPath *reloadIndexPath = [NSIndexPath indexPathForItem:update.oldIndex inSection:sectionUpdate.oldIndex];
+ [reloadIndexPaths addObject:reloadIndexPath];
+ }
+
+ [itemDiffResult.inserts enumerateIndexesUsingBlock:^(NSUInteger idx, BOOL * _Nonnull stop) {
+ WXCellComponent *cell = [newSection.cellComponents wx_safeObjectAtIndex:idx];
+ if (cell.isLayoutComplete) {
+ NSIndexPath *insertIndexPath = [NSIndexPath indexPathForItem:idx inSection:sectionUpdate.oldIndex];
+ [insertIndexPaths addObject:insertIndexPath];
+ }
+ }];
+
+ [itemDiffResult.deletes enumerateIndexesUsingBlock:^(NSUInteger idx, BOOL * _Nonnull stop) {
+ NSIndexPath *deleteIndexPath = [NSIndexPath indexPathForItem:idx inSection:sectionUpdate.oldIndex];
+ [deleteIndexPaths addObject:deleteIndexPath];
+ }];
+ }
+
+ }
+
+ WXRecyclerDiffResult *result = [[WXRecyclerDiffResult alloc] initWithInsertSections:sectionDiffResult.inserts
+ deleteSections:sectionDiffResult.deletes
+ reloadSections:reloadSections
+ insertIndexPaths:insertIndexPaths
+ deleteIndexPaths:deleteIndexPaths
+ reloadIndexPaths:reloadIndexPaths];
+
+ return result;
+}
+
+- (void)applyUpdate:(WXRecyclerDiffResult *)diffResult toCollectionView:(UICollectionView *)collectionView
+{
+ if (!collectionView) {
+ return;
+ }
+
+ [collectionView deleteItemsAtIndexPaths:[diffResult.deleteIndexPaths allObjects]];
+ [collectionView insertItemsAtIndexPaths:[diffResult.insertIndexPaths allObjects]];
+ [collectionView reloadItemsAtIndexPaths:[diffResult.reloadIndexPaths allObjects]];
+
+ [collectionView deleteSections:diffResult.deleteSections];
+ [collectionView insertSections:diffResult.insertSections];
+ [collectionView reloadSections:diffResult.reloadSections];
+}
+
+@end
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/1c96da7a/ios/sdk/WeexSDK/Sources/Component/Recycler/WXSectionDataController.h
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/Recycler/WXSectionDataController.h b/ios/sdk/WeexSDK/Sources/Component/Recycler/WXSectionDataController.h
new file mode 100644
index 0000000..d6fe7d6
--- /dev/null
+++ b/ios/sdk/WeexSDK/Sources/Component/Recycler/WXSectionDataController.h
@@ -0,0 +1,32 @@
+/**
+ * Created by Weex.
+ * Copyright (c) 2016, Alibaba, Inc. All rights reserved.
+ *
+ * This source code is licensed under the Apache Licence 2.0.
+ * For the full copyright and license information,please view the LICENSE file in the root directory of this source tree.
+ */
+
+#import <Foundation/Foundation.h>
+@class WXComponent;
+@class WXCellComponent;
+@class WXHeaderComponent;
+
+@interface WXSectionDataController : NSObject
+
+@property (nonatomic, strong) NSArray<WXCellComponent *> *cellComponents;
+@property (nonatomic, strong) WXHeaderComponent *headerComponent;
+@property (nonatomic, strong) WXComponent *footerComponent;
+
+- (NSInteger)numberOfItems;
+
+- (UIView *)cellForItemAtIndex:(NSInteger)index;
+
+- (CGSize)sizeForItemAtIndex:(NSInteger)index;
+
+- (UIView *)viewForHeaderAtIndex:(NSInteger)index;
+
+- (CGSize)sizeForHeaderAtIndex:(NSInteger)index;
+
+- (BOOL)isStickyForHeaderAtIndex:(NSInteger)index;
+
+@end
[24/25] incubator-weex git commit: * [ios] fix compile error
Posted by cx...@apache.org.
* [ios] fix compile error
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/02920b63
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/02920b63
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/02920b63
Branch: refs/heads/0.11-dev-recycler
Commit: 02920b63116cccd0b88e4ca69748b91a745ba03c
Parents: 5139da8
Author: cxfeng <cx...@gmail.com>
Authored: Wed Mar 1 12:16:52 2017 +0800
Committer: cxfeng <cx...@gmail.com>
Committed: Wed Mar 1 12:16:52 2017 +0800
----------------------------------------------------------------------
ios/sdk/WeexSDK/Sources/Component/WXListComponent.m | 4 ++++
ios/sdk/WeexSDK/Sources/Utility/WXConvert.m | 1 +
2 files changed, 5 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/02920b63/ios/sdk/WeexSDK/Sources/Component/WXListComponent.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/WXListComponent.m b/ios/sdk/WeexSDK/Sources/Component/WXListComponent.m
index b683f63..ef3e841 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXListComponent.m
+++ b/ios/sdk/WeexSDK/Sources/Component/WXListComponent.m
@@ -265,6 +265,10 @@
}];
}
+- (void)headerDidRemove:(WXHeaderComponent *)header
+{
+
+}
#pragma mark - WXCellRenderDelegate
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/02920b63/ios/sdk/WeexSDK/Sources/Utility/WXConvert.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Utility/WXConvert.m b/ios/sdk/WeexSDK/Sources/Utility/WXConvert.m
index ad9ba51..0cb620c 100644
--- a/ios/sdk/WeexSDK/Sources/Utility/WXConvert.m
+++ b/ios/sdk/WeexSDK/Sources/Utility/WXConvert.m
@@ -750,6 +750,7 @@ WX_NUMBER_CONVERT(NSUInteger, unsignedIntegerValue)
} else {
return [WXLength lengthWithInt:([value intValue] * scaleFactor) type:type];
}
+}
+ (WXBoxShadow *)WXBoxShadow:(id)value scaleFactor:(CGFloat)scaleFactor
{
[11/25] incubator-weex git commit: * [ios] reloadData to reload cells
whose layout attributes are invalid
Posted by cx...@apache.org.
* [ios] reloadData to reload cells whose layout attributes are invalid
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/202321a8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/202321a8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/202321a8
Branch: refs/heads/0.11-dev-recycler
Commit: 202321a805529619c4dd56c3c60cc75aa82c10ea
Parents: 2e2b3b4
Author: \u9690\u98ce <cx...@gmail.com>
Authored: Thu Feb 23 17:53:16 2017 +0800
Committer: \u9690\u98ce <cx...@gmail.com>
Committed: Thu Feb 23 17:53:16 2017 +0800
----------------------------------------------------------------------
ios/sdk/WeexSDK/Sources/Component/Recycler/WXMultiColumnLayout.m | 1 -
ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerComponent.m | 1 +
2 files changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/202321a8/ios/sdk/WeexSDK/Sources/Component/Recycler/WXMultiColumnLayout.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/Recycler/WXMultiColumnLayout.m b/ios/sdk/WeexSDK/Sources/Component/Recycler/WXMultiColumnLayout.m
index d5a1512..d6f9cdb 100644
--- a/ios/sdk/WeexSDK/Sources/Component/Recycler/WXMultiColumnLayout.m
+++ b/ios/sdk/WeexSDK/Sources/Component/Recycler/WXMultiColumnLayout.m
@@ -178,7 +178,6 @@ NSString * const kMultiColumnLayoutCell = @"WXMultiColumnLayoutCell";
CGFloat x = insets.left + (columnWidth + columnGap) * column;
CGFloat y = [self.columnsMaxHeights[column] floatValue];
itemAttributes.frame = CGRectMake(x, y, columnWidth, itemHeight);
- itemAttributes.zIndex = 0;
cellAttributes[indexPath] = itemAttributes;
self.columnsMaxHeights[column] = @(CGRectGetMaxY(itemAttributes.frame));
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/202321a8/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerComponent.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerComponent.m b/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerComponent.m
index 318900f..f4cf51e 100644
--- a/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerComponent.m
+++ b/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerComponent.m
@@ -174,6 +174,7 @@ typedef enum : NSUInteger {
[component setNeedsLayout];
}
+ [self.collectionView reloadData];
[self.collectionView.collectionViewLayout invalidateLayout];
}
}
[21/25] incubator-weex git commit: Merge pull request #2788 from
cxfeng1/ios-feature-grid
Posted by cx...@apache.org.
Merge pull request #2788 from cxfeng1/ios-feature-grid
Ios feature grid
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/bf32a403
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/bf32a403
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/bf32a403
Branch: refs/heads/0.11-dev-recycler
Commit: bf32a403136587f95a52dad096ed0c7ab30e967c
Parents: 1d01df1 ba73ba7
Author: \u9690\u5c0f\u98ce <cx...@gmail.com>
Authored: Mon Feb 27 10:51:36 2017 +0800
Committer: GitHub <no...@github.com>
Committed: Mon Feb 27 10:51:36 2017 +0800
----------------------------------------------------------------------
examples/vue/components/waterfall.vue | 455 ++++++++++++++++
examples/vue/index.vue | 1 +
ios/playground/WeexDemo/DemoDefine.h | 2 +-
ios/playground/WeexDemo/UIView+UIThreadCheck.m | 2 +-
ios/playground/WeexDemo/WXDemoViewController.m | 3 +-
ios/sdk/WeexSDK.xcodeproj/project.pbxproj | 75 ++-
.../Component/Recycler/WXMultiColumnLayout.h | 42 ++
.../Component/Recycler/WXMultiColumnLayout.m | 385 ++++++++++++++
.../Component/Recycler/WXRecyclerComponent.h | 12 +
.../Component/Recycler/WXRecyclerComponent.m | 525 +++++++++++++++++++
.../Recycler/WXRecyclerDataController.h | 34 ++
.../Recycler/WXRecyclerDataController.m | 114 ++++
.../Recycler/WXRecyclerUpdateController.h | 32 ++
.../Recycler/WXRecyclerUpdateController.m | 239 +++++++++
.../Recycler/WXSectionDataController.h | 33 ++
.../Recycler/WXSectionDataController.m | 81 +++
.../WeexSDK/Sources/Component/WXCellComponent.h | 22 +-
.../WeexSDK/Sources/Component/WXCellComponent.m | 27 +-
.../Component/WXComponent+GradientColor.h | 15 +-
.../Component/WXComponent+GradientColor.m | 15 +-
.../Sources/Component/WXFooterComponent.h | 13 +
.../Sources/Component/WXFooterComponent.m | 13 +
.../Sources/Component/WXHeaderComponent.h | 27 +
.../Sources/Component/WXHeaderComponent.m | 68 +++
.../WeexSDK/Sources/Component/WXListComponent.h | 12 -
.../WeexSDK/Sources/Component/WXListComponent.m | 69 +--
ios/sdk/WeexSDK/Sources/Component/WXTransform.m | 18 +-
ios/sdk/WeexSDK/Sources/Engine/WXSDKEngine.m | 2 +
ios/sdk/WeexSDK/Sources/Model/WXComponent.m | 2 +-
.../WeexSDK/Sources/Module/WXAnimationModule.m | 8 +-
ios/sdk/WeexSDK/Sources/Module/WXMetaModule.m | 4 +-
ios/sdk/WeexSDK/Sources/Utility/WXConvert.h | 2 +
ios/sdk/WeexSDK/Sources/Utility/WXConvert.m | 28 +
ios/sdk/WeexSDK/Sources/Utility/WXDiffUtil.h | 38 ++
ios/sdk/WeexSDK/Sources/Utility/WXDiffUtil.m | 186 +++++++
ios/sdk/WeexSDK/Sources/Utility/WXLength.h | 13 +-
ios/sdk/WeexSDK/Sources/Utility/WXLength.m | 45 +-
37 files changed, 2546 insertions(+), 116 deletions(-)
----------------------------------------------------------------------
[17/25] incubator-weex git commit: * [android] fix the gap to margin
Posted by cx...@apache.org.
* [android] fix the gap to margin
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/c6db620e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/c6db620e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/c6db620e
Branch: refs/heads/0.11-dev-recycler
Commit: c6db620e47dd4824a9b12449ecdb5c93345f0a80
Parents: 5069898
Author: zshshr <zh...@gmail.com>
Authored: Sun Feb 26 15:55:59 2017 +0800
Committer: zshshr <zh...@gmail.com>
Committed: Sun Feb 26 15:55:59 2017 +0800
----------------------------------------------------------------------
.../taobao/weex/dom/WXRecyclerDomObject.java | 38 +++-
.../ui/component/list/BasicListComponent.java | 7 +-
.../weex/ui/component/list/WXListComponent.java | 48 +++-
.../weex/ui/view/listview/WXRecyclerView.java | 3 +-
.../ui/view/listview/WXSpaceItemDecoration.java | 6 +-
.../listview/WXStaggeredGridLayoutManager.java | 218 +++++++++++++++++++
6 files changed, 295 insertions(+), 25 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/c6db620e/android/sdk/src/main/java/com/taobao/weex/dom/WXRecyclerDomObject.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/dom/WXRecyclerDomObject.java b/android/sdk/src/main/java/com/taobao/weex/dom/WXRecyclerDomObject.java
index 61fda35..3ffaee4 100644
--- a/android/sdk/src/main/java/com/taobao/weex/dom/WXRecyclerDomObject.java
+++ b/android/sdk/src/main/java/com/taobao/weex/dom/WXRecyclerDomObject.java
@@ -284,22 +284,44 @@ public class WXRecyclerDomObject extends WXDomObject{
}
}
+ public void updateRecyclerAttr(){
+ preCalculateCellWidth();
+ int count = getChildCount();
+ for(int i=0;i<count; i++){
+ WXDomObject domObject = getChild(i);
+ if(WXBasicComponentType.CELL.equals(domObject.getType())) {
+ getChild(i).getStyles().put(Constants.Name.WIDTH, mColumnWidth);
+ }
+ }
+ }
+
@Override
public void updateAttr(Map<String, Object> attrs) {
super.updateAttr(attrs);
if(attrs.containsKey(Constants.Name.COLUMN_COUNT)
|| attrs.containsKey(Constants.Name.COLUMN_GAP)
|| attrs.containsKey(Constants.Name.COLUMN_WIDTH)){
- preCalculateCellWidth();
+ updateRecyclerAttr();
+ }
+ }
- int count = getChildCount();
- for(int i=0;i<count; i++){
- WXDomObject domObject = getChild(i);
- if(WXBasicComponentType.CELL.equals(domObject.getType())) {
- getChild(i).getStyles().put(Constants.Name.WIDTH, mColumnWidth);
- }
- }
+ @Override
+ public void updateStyle(Map<String, Object> styles) {
+ super.updateStyle(styles);
+ if(styles.containsKey(Constants.Name.PADDING)
+ ||styles.containsKey(Constants.Name.PADDING_LEFT)
+ || styles.containsKey(Constants.Name.PADDING_RIGHT)){
+ preCalculateCellWidth();
+ }
+ }
+ @Override
+ public void updateStyle(Map<String, Object> styles, boolean byPesudo) {
+ super.updateStyle(styles, byPesudo);
+ if(styles.containsKey(Constants.Name.PADDING)
+ ||styles.containsKey(Constants.Name.PADDING_LEFT)
+ || styles.containsKey(Constants.Name.PADDING_RIGHT)){
+ preCalculateCellWidth();
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/c6db620e/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 36d55c8..1345757 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
@@ -878,9 +878,14 @@ public abstract class BasicListComponent<T extends ViewGroup & ListComponentView
}
+ protected void markComponentUsable(){
+ for (WXComponent component : mChildren){
+ component.setUsing(false);
+ }
+ }
/**
* Create an instance of {@link ListBaseViewHolder} for the given viewType (not for the given
- * index). This method will look up for the first component that fits the viewType requirement and
+ * index). This markComponentUsable();method will look up for the first component that fits the viewType requirement and
* doesn't be used. Then create the certain type of view, detach the view f[rom the component.
*
* @param parent the ViewGroup into which the new view will be inserted
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/c6db620e/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 9828d70..b8c0a31 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
@@ -211,6 +211,7 @@ import com.taobao.weex.annotation.Component;
import com.taobao.weex.common.Constants;
import com.taobao.weex.dom.WXDomObject;
import com.taobao.weex.dom.WXRecyclerDomObject;
+import com.taobao.weex.dom.flex.Spacing;
import com.taobao.weex.ui.component.WXBaseRefresh;
import com.taobao.weex.ui.component.WXBasicComponentType;
import com.taobao.weex.ui.component.WXComponent;
@@ -223,6 +224,8 @@ import com.taobao.weex.ui.view.listview.adapter.ListBaseViewHolder;
import com.taobao.weex.ui.view.refresh.wrapper.BounceRecyclerView;
import com.taobao.weex.utils.WXLogUtils;
+import java.util.Map;
+
/**
* Unlike other components, there is immutable bi-directional association between View and
* ViewHolder, while only mutable and temporal uni-directional association between view and
@@ -235,6 +238,8 @@ import com.taobao.weex.utils.WXLogUtils;
public class WXListComponent extends BasicListComponent<BounceRecyclerView> {
private String TAG = "WXListComponent";
private WXRecyclerDomObject mDomObject;
+ private float mPaddingLeft;
+ private float mPaddingRight;
@Deprecated
public WXListComponent(WXSDKInstance instance, WXDomObject dom, WXVContainer parent, String instanceId, boolean isLazy) {
@@ -253,9 +258,7 @@ public class WXListComponent extends BasicListComponent<BounceRecyclerView> {
}else{
mLayoutType = mDomObject.getLayoutType();
}
-
- mColumnCount = mDomObject.getColumnCount();
- mColumnGap = mDomObject.getColumnGap();
+ updateRecyclerAttr();
}
}
@@ -308,40 +311,65 @@ public class WXListComponent extends BasicListComponent<BounceRecyclerView> {
}, 100);
return true;
}
-
return false;
}
+ private void updateRecyclerAttr(){
+ mColumnCount = mDomObject.getColumnCount();
+ mColumnGap = mDomObject.getColumnGap();
+ mColumnWidth = mDomObject.getColumnWidth();
+ mPaddingLeft =mDomObject.getPadding().get(Spacing.LEFT);
+ mPaddingRight =mDomObject.getPadding().get(Spacing.RIGHT);
+ }
+
@WXComponentProp(name = Constants.Name.COLUMN_WIDTH)
public void setColumnWidth(int columnCount) {
if(mDomObject.getColumnWidth() != mColumnWidth){
+ markComponentUsable();
+ updateRecyclerAttr();
WXRecyclerView wxRecyclerView = getHostView().getInnerView();
wxRecyclerView.initView(getContext(), mLayoutType,mColumnCount,mColumnGap,getOrientation());
- mColumnCount = mDomObject.getColumnCount();
}
}
@WXComponentProp(name = Constants.Name.COLUMN_COUNT)
public void setColumnCount(int columnCount){
-
if(mDomObject.getColumnCount() != mColumnCount){
- mColumnCount = mDomObject.getColumnCount();
+ markComponentUsable();
+ updateRecyclerAttr();
WXRecyclerView wxRecyclerView = getHostView().getInnerView();
wxRecyclerView.initView(getContext(), mLayoutType,mColumnCount,mColumnGap,getOrientation());
-
}
-
}
@WXComponentProp(name = Constants.Name.COLUMN_GAP)
public void setColumnGap(float columnGap) throws InterruptedException {
if(mDomObject.getColumnGap() != mColumnGap) {
- mColumnGap = mDomObject.getColumnGap();
+ markComponentUsable();
+ updateRecyclerAttr();
WXRecyclerView wxRecyclerView = getHostView().getInnerView();
wxRecyclerView.initView(getContext(), mLayoutType, mColumnCount, mColumnGap, getOrientation());
}
}
+ @Override
+ public void updateProperties(Map<String, Object> props) {
+ super.updateProperties(props);
+ if(props.containsKey(Constants.Name.PADDING)
+ ||props.containsKey(Constants.Name.PADDING_LEFT)
+ || props.containsKey(Constants.Name.PADDING_RIGHT)){
+
+ if(mPaddingLeft !=mDomObject.getPadding().get(Spacing.LEFT)
+ || mPaddingRight !=mDomObject.getPadding().get(Spacing.RIGHT)) {
+
+ markComponentUsable();
+ updateRecyclerAttr();
+ WXRecyclerView wxRecyclerView = getHostView().getInnerView();
+ wxRecyclerView.initView(getContext(), mLayoutType, mColumnCount, mColumnGap, getOrientation());
+ }
+ }
+
+ }
@Override
public void createChildViewAt(int index) {
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/c6db620e/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 e46fbe0..adffd9b 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
@@ -211,7 +211,6 @@ import android.support.annotation.Nullable;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.OrientationHelper;
import android.support.v7.widget.RecyclerView;
-import android.support.v7.widget.StaggeredGridLayoutManager;
import android.view.MotionEvent;
import com.taobao.weex.common.Constants;
@@ -259,7 +258,7 @@ public class WXRecyclerView extends RecyclerView implements WXGestureObservable
if (type == TYPE_GRID_LAYOUT) {
setLayoutManager(new GridLayoutManager(context, columnCount,orientation,false));
} else if (type == TYPE_STAGGERED_GRID_LAYOUT) {
- setLayoutManager(new StaggeredGridLayoutManager(columnCount, orientation));
+ setLayoutManager(new WXStaggeredGridLayoutManager(columnCount, orientation));
addItemDecoration(new WXSpaceItemDecoration(columnCount,columnGap));
} else if (type == TYPE_LINEAR_LAYOUT) {
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/c6db620e/android/sdk/src/main/java/com/taobao/weex/ui/view/listview/WXSpaceItemDecoration.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/view/listview/WXSpaceItemDecoration.java b/android/sdk/src/main/java/com/taobao/weex/ui/view/listview/WXSpaceItemDecoration.java
index c067c1a..dd9015c 100644
--- a/android/sdk/src/main/java/com/taobao/weex/ui/view/listview/WXSpaceItemDecoration.java
+++ b/android/sdk/src/main/java/com/taobao/weex/ui/view/listview/WXSpaceItemDecoration.java
@@ -211,8 +211,6 @@ import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.StaggeredGridLayoutManager;
import android.view.View;
-import com.taobao.weex.utils.WXLogUtils;
-
/**
* Created by zhengshihan on 2017/2/20.
*/
@@ -244,11 +242,11 @@ public class WXSpaceItemDecoration extends RecyclerView.ItemDecoration {
int margin = (int) (mColumnGap / mColumnCount);
if(spanIndex % mColumnCount == 1){
+ layoutParams.setMarginStart(0);
layoutParams.setMarginEnd(margin);
-
}else if (spanIndex % mColumnCount ==0){
layoutParams.setMarginStart(margin);
-
+ layoutParams.setMarginEnd(0);
} else {
layoutParams.setMarginEnd(margin);
layoutParams.setMarginStart(margin);
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/c6db620e/android/sdk/src/main/java/com/taobao/weex/ui/view/listview/WXStaggeredGridLayoutManager.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/view/listview/WXStaggeredGridLayoutManager.java b/android/sdk/src/main/java/com/taobao/weex/ui/view/listview/WXStaggeredGridLayoutManager.java
new file mode 100644
index 0000000..6bbb78e
--- /dev/null
+++ b/android/sdk/src/main/java/com/taobao/weex/ui/view/listview/WXStaggeredGridLayoutManager.java
@@ -0,0 +1,218 @@
+/**
+ *
+ * Apache License
+ * Version 2.0, January 2004
+ * http://www.apache.org/licenses/
+ *
+ * TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+ *
+ * 1. Definitions.
+ *
+ * "License" shall mean the terms and conditions for use, reproduction,
+ * and distribution as defined by Sections 1 through 9 of this document.
+ *
+ * "Licensor" shall mean the copyright owner or entity authorized by
+ * the copyright owner that is granting the License.
+ *
+ * "Legal Entity" shall mean the union of the acting entity and all
+ * other entities that control, are controlled by, or are under common
+ * control with that entity. For the purposes of this definition,
+ * "control" means (i) the power, direct or indirect, to cause the
+ * direction or management of such entity, whether by contract or
+ * otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ * outstanding shares, or (iii) beneficial ownership of such entity.
+ *
+ * "You" (or "Your") shall mean an individual or Legal Entity
+ * exercising permissions granted by this License.
+ *
+ * "Source" form shall mean the preferred form for making modifications,
+ * including but not limited to software source code, documentation
+ * source, and configuration files.
+ *
+ * "Object" form shall mean any form resulting from mechanical
+ * transformation or translation of a Source form, including but
+ * not limited to compiled object code, generated documentation,
+ * and conversions to other media types.
+ *
+ * "Work" shall mean the work of authorship, whether in Source or
+ * Object form, made available under the License, as indicated by a
+ * copyright notice that is included in or attached to the work
+ * (an example is provided in the Appendix below).
+ *
+ * "Derivative Works" shall mean any work, whether in Source or Object
+ * form, that is based on (or derived from) the Work and for which the
+ * editorial revisions, annotations, elaborations, or other modifications
+ * represent, as a whole, an original work of authorship. For the purposes
+ * of this License, Derivative Works shall not include works that remain
+ * separable from, or merely link (or bind by name) to the interfaces of,
+ * the Work and Derivative Works thereof.
+ *
+ * "Contribution" shall mean any work of authorship, including
+ * the original version of the Work and any modifications or additions
+ * to that Work or Derivative Works thereof, that is intentionally
+ * submitted to Licensor for inclusion in the Work by the copyright owner
+ * or by an individual or Legal Entity authorized to submit on behalf of
+ * the copyright owner. For the purposes of this definition, "submitted"
+ * means any form of electronic, verbal, or written communication sent
+ * to the Licensor or its representatives, including but not limited to
+ * communication on electronic mailing lists, source code control systems,
+ * and issue tracking systems that are managed by, or on behalf of, the
+ * Licensor for the purpose of discussing and improving the Work, but
+ * excluding communication that is conspicuously marked or otherwise
+ * designated in writing by the copyright owner as "Not a Contribution."
+ *
+ * "Contributor" shall mean Licensor and any individual or Legal Entity
+ * on behalf of whom a Contribution has been received by Licensor and
+ * subsequently incorporated within the Work.
+ *
+ * 2. Grant of Copyright License. Subject to the terms and conditions of
+ * this License, each Contributor hereby grants to You a perpetual,
+ * worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ * copyright license to reproduce, prepare Derivative Works of,
+ * publicly display, publicly perform, sublicense, and distribute the
+ * Work and such Derivative Works in Source or Object form.
+ *
+ * 3. Grant of Patent License. Subject to the terms and conditions of
+ * this License, each Contributor hereby grants to You a perpetual,
+ * worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ * (except as stated in this section) patent license to make, have made,
+ * use, offer to sell, sell, import, and otherwise transfer the Work,
+ * where such license applies only to those patent claims licensable
+ * by such Contributor that are necessarily infringed by their
+ * Contribution(s) alone or by combination of their Contribution(s)
+ * with the Work to which such Contribution(s) was submitted. If You
+ * institute patent litigation against any entity (including a
+ * cross-claim or counterclaim in a lawsuit) alleging that the Work
+ * or a Contribution incorporated within the Work constitutes direct
+ * or contributory patent infringement, then any patent licenses
+ * granted to You under this License for that Work shall terminate
+ * as of the date such litigation is filed.
+ *
+ * 4. Redistribution. You may reproduce and distribute copies of the
+ * Work or Derivative Works thereof in any medium, with or without
+ * modifications, and in Source or Object form, provided that You
+ * meet the following conditions:
+ *
+ * (a) You must give any other recipients of the Work or
+ * Derivative Works a copy of this License; and
+ *
+ * (b) You must cause any modified files to carry prominent notices
+ * stating that You changed the files; and
+ *
+ * (c) You must retain, in the Source form of any Derivative Works
+ * that You distribute, all copyright, patent, trademark, and
+ * attribution notices from the Source form of the Work,
+ * excluding those notices that do not pertain to any part of
+ * the Derivative Works; and
+ *
+ * (d) If the Work includes a "NOTICE" text file as part of its
+ * distribution, then any Derivative Works that You distribute must
+ * include a readable copy of the attribution notices contained
+ * within such NOTICE file, excluding those notices that do not
+ * pertain to any part of the Derivative Works, in at least one
+ * of the following places: within a NOTICE text file distributed
+ * as part of the Derivative Works; within the Source form or
+ * documentation, if provided along with the Derivative Works; or,
+ * within a display generated by the Derivative Works, if and
+ * wherever such third-party notices normally appear. The contents
+ * of the NOTICE file are for informational purposes only and
+ * do not modify the License. You may add Your own attribution
+ * notices within Derivative Works that You distribute, alongside
+ * or as an addendum to the NOTICE text from the Work, provided
+ * that such additional attribution notices cannot be construed
+ * as modifying the License.
+ *
+ * You may add Your own copyright statement to Your modifications and
+ * may provide additional or different license terms and conditions
+ * for use, reproduction, or distribution of Your modifications, or
+ * for any such Derivative Works as a whole, provided Your use,
+ * reproduction, and distribution of the Work otherwise complies with
+ * the conditions stated in this License.
+ *
+ * 5. Submission of Contributions. Unless You explicitly state otherwise,
+ * any Contribution intentionally submitted for inclusion in the Work
+ * by You to the Licensor shall be under the terms and conditions of
+ * this License, without any additional terms or conditions.
+ * Notwithstanding the above, nothing herein shall supersede or modify
+ * the terms of any separate license agreement you may have executed
+ * with Licensor regarding such Contributions.
+ *
+ * 6. Trademarks. This License does not grant permission to use the trade
+ * names, trademarks, service marks, or product names of the Licensor,
+ * except as required for reasonable and customary use in describing the
+ * origin of the Work and reproducing the content of the NOTICE file.
+ *
+ * 7. Disclaimer of Warranty. Unless required by applicable law or
+ * agreed to in writing, Licensor provides the Work (and each
+ * Contributor provides its Contributions) on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied, including, without limitation, any warranties or conditions
+ * of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ * PARTICULAR PURPOSE. You are solely responsible for determining the
+ * appropriateness of using or redistributing the Work and assume any
+ * risks associated with Your exercise of permissions under this License.
+ *
+ * 8. Limitation of Liability. In no event and under no legal theory,
+ * whether in tort (including negligence), contract, or otherwise,
+ * unless required by applicable law (such as deliberate and grossly
+ * negligent acts) or agreed to in writing, shall any Contributor be
+ * liable to You for damages, including any direct, indirect, special,
+ * incidental, or consequential damages of any character arising as a
+ * result of this License or out of the use or inability to use the
+ * Work (including but not limited to damages for loss of goodwill,
+ * work stoppage, computer failure or malfunction, or any and all
+ * other commercial damages or losses), even if such Contributor
+ * has been advised of the possibility of such damages.
+ *
+ * 9. Accepting Warranty or Additional Liability. While redistributing
+ * the Work or Derivative Works thereof, You may choose to offer,
+ * and charge a fee for, acceptance of support, warranty, indemnity,
+ * or other liability obligations and/or rights consistent with this
+ * License. However, in accepting such obligations, You may act only
+ * on Your own behalf and on Your sole responsibility, not on behalf
+ * of any other Contributor, and only if You agree to indemnify,
+ * defend, and hold each Contributor harmless for any liability
+ * incurred by, or claims asserted against, such Contributor by reason
+ * of your accepting any such warranty or additional liability.
+ *
+ * END OF TERMS AND CONDITIONS
+ *
+ * APPENDIX: How to apply the Apache License to your work.
+ *
+ * To apply the Apache License to your work, attach the following
+ * boilerplate notice, with the fields enclosed by brackets "[]"
+ * replaced with your own identifying information. (Don't include
+ * the brackets!) The text should be enclosed in the appropriate
+ * comment syntax for the file format. We also recommend that a
+ * file or class name and description of purpose be included on the
+ * same "printed page" as the copyright notice for easier
+ * identification within third-party archives.
+ *
+ * Copyright 2016 Alibaba Group
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.taobao.weex.ui.view.listview;
+
+import android.support.v7.widget.StaggeredGridLayoutManager;
+
+/**
+ * Created by zhengshihan on 2017/2/24.
+ */
+
+public class WXStaggeredGridLayoutManager extends StaggeredGridLayoutManager {
+ public WXStaggeredGridLayoutManager(int spanCount, int orientation) {
+ super(spanCount, orientation);
+ setGapStrategy(GAP_HANDLING_NONE);
+ }
+}
[16/25] incubator-weex git commit: * [ios] add refresh demo
Posted by cx...@apache.org.
* [ios] add refresh demo
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/c0dce9b6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/c0dce9b6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/c0dce9b6
Branch: refs/heads/0.11-dev-recycler
Commit: c0dce9b60b5f2ab72ee8fc8d6d5f7b84808348e3
Parents: 0ce0cb5
Author: \u9690\u98ce <cx...@gmail.com>
Authored: Fri Feb 24 19:10:19 2017 +0800
Committer: \u9690\u98ce <cx...@gmail.com>
Committed: Fri Feb 24 19:10:19 2017 +0800
----------------------------------------------------------------------
examples/vue/components/waterfall.vue | 41 ++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/c0dce9b6/examples/vue/components/waterfall.vue
----------------------------------------------------------------------
diff --git a/examples/vue/components/waterfall.vue b/examples/vue/components/waterfall.vue
index ac34919..7bf42f9 100644
--- a/examples/vue/components/waterfall.vue
+++ b/examples/vue/components/waterfall.vue
@@ -5,6 +5,10 @@
:show-scrollbar="showScrollbar" :scrollable="scrollable"
@scroll="recylerScroll"
>
+ <refresh class="refresh" @refresh="onrefresh" @pullingdown="onpullingdown" :display="refreshing ? 'show' : 'hide'">
+ <loading-indicator class="indicator"></loading-indicator>
+ <text class="refreshText">{{refreshText}}</text>
+ </refresh>
<header class="header" ref="header" v-if="showHeader">
<image class="banner" src="https://gw.alicdn.com/tps/TB1ESN1PFXXXXX1apXXXXXXXXXX-1000-600.jpg" resize="cover">
<div class="bannerInfo">
@@ -55,6 +59,23 @@
.page {
background-color: #EFEFEF;
}
+ .refresh {
+ height: 128;
+ width: 750;
+ flex-direction: row;
+ align-items: center;
+ justify-content: center;
+ }
+ .refreshText {
+ color: #888888;
+ font-weight: bold;
+ }
+ .indicator {
+ color: #888888;
+ height: 40;
+ width: 40;
+ margin-right: 30;
+ }
.header {
}
.banner {
@@ -274,6 +295,8 @@
return {
padding: 0,
+ refreshing: false,
+ refreshText: '\u2193 pull to refresh...',
columnCount: 2,
columnGap: 12,
columnWidth: 'auto',
@@ -408,6 +431,24 @@
} else {
this.items.splice(0, 0, this.items.splice(index, 1)[0]);
}
+ },
+
+ onrefresh (event) {
+ this.refreshing = true
+ this.refreshText = "loading..."
+ setTimeout(() => {
+ this.refreshing = false
+ this.refreshText = '\u2193 pull to refresh...'
+ }, 2000)
+ },
+
+ onpullingdown (event) {
+ // console.log(`${event.pullingDistance}`)
+ if (event.pullingDistance < -64) {
+ this.refreshText = '\u2191 release to refresh...'
+ } else {
+ this.refreshText = '\u2193 pull to refresh...'
+ }
}
}
}
[05/25] incubator-weex git commit: * [android] recycler component
adapter appear event
Posted by cx...@apache.org.
* [android] recycler component adapter appear event
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/7984c9b5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/7984c9b5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/7984c9b5
Branch: refs/heads/0.11-dev-recycler
Commit: 7984c9b59b63652720f45b4241f39b1bfe70600e
Parents: 61cfd37
Author: zshshr <zh...@gmail.com>
Authored: Thu Feb 23 15:49:37 2017 +0800
Committer: zshshr <zh...@gmail.com>
Committed: Thu Feb 23 15:49:37 2017 +0800
----------------------------------------------------------------------
.../weex/ui/component/list/WXListComponent.java | 18 ++--
.../weex/ui/view/listview/WXRecyclerView.java | 4 -
.../adapter/WXRecyclerViewOnScrollListener.java | 94 +++++++++++++-------
3 files changed, 75 insertions(+), 41 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/7984c9b5/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 5299945..fa91d1c 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
@@ -307,16 +307,16 @@ public class WXListComponent extends BasicListComponent<BounceRecyclerView> {
@WXComponentProp(name = Constants.Name.COLUMN_COUNT)
public void setColumnCount(int columnCount) throws InterruptedException {
WXLogUtils.w("zshshr","setColumnCount : "+"htread:"+Thread.currentThread().getName());
- mColumnCount = columnCount;
- WXRecyclerView wxRecyclerView = getHostView().getInnerView();
- wxRecyclerView.initView(getContext(), mLayoutType,mColumnCount,mColumnGap,getOrientation());
+// mColumnCount = columnCount;
+// WXRecyclerView wxRecyclerView = getHostView().getInnerView();
+// wxRecyclerView.initView(getContext(), mLayoutType,mColumnCount,mColumnGap,getOrientation());
}
@WXComponentProp(name = Constants.Name.COLUMN_GAP)
public void setColumnGap(float columnGap) throws InterruptedException {
- mColumnGap = columnGap;
- WXRecyclerView wxRecyclerView = getHostView().getInnerView();
- wxRecyclerView.initView(getContext(), mLayoutType,mColumnCount,mColumnGap,getOrientation());
+// mColumnGap = columnGap;
+// WXRecyclerView wxRecyclerView = getHostView().getInnerView();
+// wxRecyclerView.initView(getContext(), mLayoutType,mColumnCount,mColumnGap,getOrientation());
}
@WXComponentProp(name = Constants.Name.SHOW_SCROLLBAR)
@@ -328,6 +328,12 @@ public class WXListComponent extends BasicListComponent<BounceRecyclerView> {
wxRecyclerView.initView(getContext(), mLayoutType,mColumnCount,mColumnGap,getOrientation());
}
+ @WXComponentProp(name = Constants.Name.SCROLLABLE)
+ public void setScrollable(boolean scrollable) {
+ WXRecyclerView wxRecyclerView = getHostView().getInnerView();
+ wxRecyclerView.setScrollable(scrollable);
+ }
+
@Override
public void createChildViewAt(int index) {
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/7984c9b5/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 dc8a209..09bedbb 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
@@ -264,10 +264,6 @@ public class WXRecyclerView extends RecyclerView implements WXGestureObservable
} else if (type == TYPE_LINEAR_LAYOUT) {
setLayoutManager(new ExtendedLinearLayoutManager(context,orientation,false));
}
-
- setVerticalScrollBarEnabled(true);
- setScrollable(true);
- setScrollBarSize(10);
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/7984c9b5/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 ad60ade..6e93d4f 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
@@ -225,17 +225,27 @@ public class WXRecyclerViewOnScrollListener extends RecyclerView.OnScrollListene
/**
* The last position
*/
- private int[] lastPositions;
+ private int[] mLastPositions;
+ /**
+ * The first position
+ */
+ private int[] mFirstPositions;
+
+
+ /**
+ * The location of last visible item
+ */
+ private int mLastVisibleItemPosition;
/**
* The location of last visible item
*/
- private int lastVisibleItemPosition;
+ private int mFirstVisibleItemPosition;
/**
* The state of scroll status
*/
- private int currentScrollState = 0;
+ private int mCurrentScrollState = 0;
private WeakReference<IOnLoadMoreListener> listener;
@@ -246,14 +256,14 @@ public class WXRecyclerViewOnScrollListener extends RecyclerView.OnScrollListene
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
super.onScrollStateChanged(recyclerView, newState);
- currentScrollState = newState;
+ mCurrentScrollState = newState;
RecyclerView.LayoutManager layoutManager = recyclerView.getLayoutManager();
int visibleItemCount = layoutManager.getChildCount();
int totalItemCount = layoutManager.getItemCount();
if (visibleItemCount != 0) {
- int bottomOffset = (totalItemCount - lastVisibleItemPosition - 1) * (recyclerView.getHeight()) / visibleItemCount;
- if (visibleItemCount > 0 && currentScrollState == RecyclerView.SCROLL_STATE_IDLE) {
+ int bottomOffset = (totalItemCount - mLastVisibleItemPosition - 1) * (recyclerView.getHeight()) / visibleItemCount;
+ if (visibleItemCount > 0 && mCurrentScrollState == RecyclerView.SCROLL_STATE_IDLE) {
if (listener != null && listener.get() != null) {
listener.get().onLoadMore(bottomOffset);
}
@@ -266,36 +276,48 @@ public class WXRecyclerViewOnScrollListener extends RecyclerView.OnScrollListene
super.onScrolled(recyclerView, dx, dy);
RecyclerView.LayoutManager layoutManager = recyclerView.getLayoutManager();
IOnLoadMoreListener l;
- if((l = listener.get()) != null){
- l.onBeforeScroll(dx,dy);
+ if ((l = listener.get()) != null) {
+ l.onBeforeScroll(dx, dy);
}
// int lastVisibleItemPosition = -1;
- 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;
- GridLayoutManager gridLayoutManager = ((GridLayoutManager) layoutManager);
- lastVisibleItemPosition = gridLayoutManager.findLastVisibleItemPosition();
+ if (layoutManager instanceof LinearLayoutManager) {
+ layoutManagerType = LAYOUT_MANAGER_TYPE.LINEAR;
+ mLastVisibleItemPosition = ((LinearLayoutManager) layoutManager).findLastVisibleItemPosition();
+ listener.get().notifyAppearStateChange(((LinearLayoutManager) layoutManager).findFirstVisibleItemPosition()
+ , mLastVisibleItemPosition
+ , dx
+ , dy);
+ } else if (layoutManager instanceof GridLayoutManager) {
+ layoutManagerType = LAYOUT_MANAGER_TYPE.GRID;
+ GridLayoutManager gridLayoutManager = ((GridLayoutManager) layoutManager);
+ mLastVisibleItemPosition = gridLayoutManager.findLastVisibleItemPosition();
+ listener.get().notifyAppearStateChange(((GridLayoutManager) layoutManager).findFirstVisibleItemPosition()
+ , mLastVisibleItemPosition
+ , dx
+ , dy);
- } else if (layoutManager instanceof StaggeredGridLayoutManager) {
- layoutManagerType = LAYOUT_MANAGER_TYPE.STAGGERED_GRID;
- StaggeredGridLayoutManager staggeredGridLayoutManager = (StaggeredGridLayoutManager) layoutManager;
- if (lastPositions == null) {
- lastPositions = new int[staggeredGridLayoutManager.getSpanCount()];
- }
- staggeredGridLayoutManager.findLastVisibleItemPositions(lastPositions);
- lastVisibleItemPosition = findMax(lastPositions);
- } else {
- throw new RuntimeException(
- "Unsupported LayoutManager used. Valid ones are LinearLayoutManager, GridLayoutManager and StaggeredGridLayoutManager");
+ } else if (layoutManager instanceof StaggeredGridLayoutManager) {
+ layoutManagerType = LAYOUT_MANAGER_TYPE.STAGGERED_GRID;
+ StaggeredGridLayoutManager staggeredGridLayoutManager = (StaggeredGridLayoutManager) layoutManager;
+ if (mLastPositions == null) {
+ mLastPositions = new int[staggeredGridLayoutManager.getSpanCount()];
+ }
+ if (mFirstPositions == null) {
+ mFirstPositions = new int[staggeredGridLayoutManager.getSpanCount()];
}
+ staggeredGridLayoutManager.findFirstVisibleItemPositions(mFirstPositions);
+ mFirstVisibleItemPosition = findMin(mFirstPositions);
+ staggeredGridLayoutManager.findLastVisibleItemPositions(mLastPositions);
+ mLastVisibleItemPosition = findMax(mLastPositions);
+ listener.get().notifyAppearStateChange(
+ mFirstVisibleItemPosition
+ , mLastVisibleItemPosition
+ , dx
+ , dy);
+ } else {
+ throw new RuntimeException(
+ "Unsupported LayoutManager used. Valid ones are LinearLayoutManager, GridLayoutManager and StaggeredGridLayoutManager");
}
}
@@ -309,6 +331,16 @@ public class WXRecyclerViewOnScrollListener extends RecyclerView.OnScrollListene
return max;
}
+ private int findMin(int[] firstPositions) {
+ int min = firstPositions[0];
+ for (int value : firstPositions) {
+ if (value < min) {
+ min = value;
+ }
+ }
+ return min;
+ }
+
public enum LAYOUT_MANAGER_TYPE {
LINEAR,
GRID,
[02/25] incubator-weex git commit: * [android] add recycle
column-count attribute
Posted by cx...@apache.org.
* [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 <zh...@gmail.com>
Authored: Fri Feb 17 17:51:06 2017 +0800
Committer: zshshr <zh...@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);
}