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:39:05 UTC

[38/50] [abbrv] incubator-weex git commit: appear

appear


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

Branch: refs/heads/0.16-dev
Commit: 863a8981e1c76c41805a83a380ec4168b51cf4ff
Parents: 3dd927e
Author: jianbai.gbj <ji...@alibaba-inc.com>
Authored: Thu Sep 21 16:09:47 2017 +0800
Committer: jianbai.gbj <ji...@alibaba-inc.com>
Committed: Thu Sep 21 16:09:47 2017 +0800

----------------------------------------------------------------------
 .../list/template/WXRecyclerTemplateList.java          | 13 +++++++++++++
 1 file changed, 13 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/863a8981/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 7a4c3e9..a135199 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
@@ -765,7 +765,13 @@ public class WXRecyclerTemplateList extends WXVContainer<BounceRecyclerView> imp
         if(listData == null || index >= listData.size()){
             return;
         }
+        int before = getItemViewType(index);
         listData.set(index, data);
+        int after = getItemViewType(index);
+        if(before != after){
+            cellLifecycleManager.onDestory(index);
+            cellLifecycleManager.onCreate(index);
+        }
         if(getHostView() != null && getHostView().getRecyclerViewBaseAdapter() != null){
             getHostView().getRecyclerViewBaseAdapter().notifyItemChanged(index);
         }
@@ -776,8 +782,15 @@ public class WXRecyclerTemplateList extends WXVContainer<BounceRecyclerView> imp
         if(listData == null || index >= listData.size()){
             return;
         }
+        int markPostion = listData.size() - 1;
         cellLifecycleManager.onDestory(index);
         listData.remove(index);
+        if(index < listData.size()){
+            cellLifecycleManager.getFiredCreateEvent().put(index, true);
+        }
+        if(markPostion >= 0){
+            cellLifecycleManager.getFiredCreateEvent().remove(markPostion);
+        }
         if(getHostView() != null && getHostView().getRecyclerViewBaseAdapter() != null){
             getHostView().getRecyclerViewBaseAdapter().notifyItemRemoved(index);
         }