You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by ac...@apache.org on 2017/09/21 13:38:59 UTC
[32/50] [abbrv] incubator-weex git commit: update main bundle
update main bundle
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/e10881f6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/e10881f6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/e10881f6
Branch: refs/heads/0.16-dev
Commit: e10881f69e2661dcd084a17b386cd654127109e7
Parents: c8bed7e
Author: jianbai.gbj <ji...@alibaba-inc.com>
Authored: Thu Sep 21 11:57:43 2017 +0800
Committer: jianbai.gbj <ji...@alibaba-inc.com>
Committed: Thu Sep 21 11:57:43 2017 +0800
----------------------------------------------------------------------
.../java/com/taobao/weex/common/Constants.java | 3 +-
.../list/template/WXRecyclerTemplateList.java | 54 +-
pre-build/native-bundle-main.js | 1384 +++++++++---------
3 files changed, 700 insertions(+), 741 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/e10881f6/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 04d4387..7d3c45a 100644
--- a/android/sdk/src/main/java/com/taobao/weex/common/Constants.java
+++ b/android/sdk/src/main/java/com/taobao/weex/common/Constants.java
@@ -187,12 +187,11 @@ public class Constants {
String LIST_DATA_ITEM ="alias";
String LIST_DATA_ITEM_INDEX = "index";
String LIST_DATA_TEMPLATE_KEY = "templateKey";
+
String SLOT_TEMPLATE_TYPE = "templateType";
String LIST_DATA_ITEM_ID = "itemId";
String CELL_INDEX = "cellIndex";
String TYPE_INDEX = "typeIndex";
- String APPEND_LIST_DATA = "appendListData";
- String UPDATE_CELL = "updateCell";
}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/e10881f6/android/sdk/src/main/java/com/taobao/weex/ui/component/list/template/WXRecyclerTemplateList.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/component/list/template/WXRecyclerTemplateList.java b/android/sdk/src/main/java/com/taobao/weex/ui/component/list/template/WXRecyclerTemplateList.java
index 734e31d..56b4264 100644
--- a/android/sdk/src/main/java/com/taobao/weex/ui/component/list/template/WXRecyclerTemplateList.java
+++ b/android/sdk/src/main/java/com/taobao/weex/ui/component/list/template/WXRecyclerTemplateList.java
@@ -180,6 +180,7 @@ public class WXRecyclerTemplateList extends WXVContainer<BounceRecyclerView> imp
mStickyHelper = new TemplateStickyHelper(this);
cellLifecycleManager = new CellLifecycleManager(this);
orientation = mDomObject.getOrientation();
+ listDataTemplateKey = WXUtils.getString(getDomObject().getAttrs().get(Constants.Name.Recycler.LIST_DATA_TEMPLATE_KEY), Constants.Name.Recycler.SLOT_TEMPLATE_TYPE);
}
@Override
@@ -610,14 +611,6 @@ public class WXRecyclerTemplateList extends WXVContainer<BounceRecyclerView> imp
setListData(param);
}
return true;
- case Constants.Name.Recycler.APPEND_LIST_DATA:{
- appendListData(param);
- }
- return true;
- case Constants.Name.Recycler.UPDATE_CELL:{
- updateCell(param);
- }
- return true;
case Constants.Name.Recycler.LIST_DATA_ITEM:
listDataItemKey = WXUtils.getString(param, listDataItemKey);
return true;
@@ -675,6 +668,7 @@ public class WXRecyclerTemplateList extends WXVContainer<BounceRecyclerView> imp
}
}
}
+ listDataTemplateKey = WXUtils.getString(getDomObject().getAttrs().get(Constants.Name.Recycler.LIST_DATA_TEMPLATE_KEY), Constants.Name.Recycler.SLOT_TEMPLATE_TYPE);
if(update){
notifyUpdateList();
}
@@ -749,44 +743,37 @@ public class WXRecyclerTemplateList extends WXVContainer<BounceRecyclerView> imp
inner.setScrollable(scrollable);
}
- @WXComponentProp(name = Constants.Name.Recycler.APPEND_LIST_DATA)
- public void appendListData(Object arrayObject){
+ @JSMethod
+ public void appendListData(JSONArray arrayObject){
if(listData == null){
listData = new JSONArray();
}
- if(arrayObject instanceof JSONObject){
- listData.add(arrayObject);
- }else if(arrayObject instanceof JSONArray){
- listData.addAll((JSONArray)arrayObject);
+ if(arrayObject instanceof JSONArray){
+ listData.addAll(arrayObject);
}
notifyUpdateList();
}
- @WXComponentProp(name = Constants.Name.Recycler.UPDATE_CELL)
- public void updateCell(Object data){
- if(!(data instanceof JSONObject)){
- return;
- }
- if(listData == null){
- return;
- }
- JSONObject cellData = (JSONObject)data;
- if(cellData.get(Constants.Name.Recycler.LIST_DATA_ITEM) == null){
- return;
- }
- Integer cellIndex = cellData.getInteger(Constants.Name.Recycler.CELL_INDEX);
- if(cellIndex == null){
+ @JSMethod
+ public void updateData(Integer index, JSONObject data){
+ if(data == null || index == null){
return;
}
- if(cellIndex >= listData.size()){
+ if(listData == null || index >= listData.size()){
return;
}
- listData.set(cellIndex, cellData.get(Constants.Name.Recycler.LIST_DATA_ITEM));
+ listData.set(index, data);
if(getHostView() != null && getHostView().getRecyclerViewBaseAdapter() != null){
- getHostView().getRecyclerViewBaseAdapter().notifyItemChanged(cellIndex);
+ getHostView().getRecyclerViewBaseAdapter().notifyItemChanged(index);
}
}
+ @JSMethod
+ public void resetLoadmore() {
+ mForceLoadmoreNextTime = true;
+ mListCellCount = 0;
+ }
+
@Override
public void updateProperties(Map<String, Object> props) {
@@ -804,11 +791,6 @@ public class WXRecyclerTemplateList extends WXVContainer<BounceRecyclerView> imp
}
}
- @JSMethod
- public void resetLoadmore() {
- mForceLoadmoreNextTime = true;
- mListCellCount = 0;
- }
@Override