From bdabde2f56482cf17f12b214236d17c836f97967 Mon Sep 17 00:00:00 2001 From: "pengfei.zhou" Date: Fri, 15 Nov 2019 09:57:59 +0800 Subject: [PATCH] feat:add clearNode when reset listview's renderItem --- Android/doric/src/main/java/pub/doric/shader/SuperNode.java | 4 ++++ .../src/main/java/pub/doric/shader/list/ListAdapter.java | 2 +- .../doric/src/main/java/pub/doric/shader/list/ListNode.java | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Android/doric/src/main/java/pub/doric/shader/SuperNode.java b/Android/doric/src/main/java/pub/doric/shader/SuperNode.java index 76854f18..06c434cc 100644 --- a/Android/doric/src/main/java/pub/doric/shader/SuperNode.java +++ b/Android/doric/src/main/java/pub/doric/shader/SuperNode.java @@ -78,6 +78,10 @@ public abstract class SuperNode extends ViewNode { subNodes.put(id, model); } + public void clearSubModel() { + subNodes.clear(); + } + protected abstract void blendSubNode(JSObject subProperties); protected void blendSubLayoutConfig(ViewNode viewNode, JSObject jsObject) { diff --git a/Android/doric/src/main/java/pub/doric/shader/list/ListAdapter.java b/Android/doric/src/main/java/pub/doric/shader/list/ListAdapter.java index 30dcddf4..ca821c54 100644 --- a/Android/doric/src/main/java/pub/doric/shader/list/ListAdapter.java +++ b/Android/doric/src/main/java/pub/doric/shader/list/ListAdapter.java @@ -45,7 +45,7 @@ public class ListAdapter extends RecyclerView.Adapter itemValues = new SparseArray<>(); - public ListAdapter(ListNode listNode) { + ListAdapter(ListNode listNode) { this.listNode = listNode; } diff --git a/Android/doric/src/main/java/pub/doric/shader/list/ListNode.java b/Android/doric/src/main/java/pub/doric/shader/list/ListNode.java index 95da4a0d..bea96e47 100644 --- a/Android/doric/src/main/java/pub/doric/shader/list/ListNode.java +++ b/Android/doric/src/main/java/pub/doric/shader/list/ListNode.java @@ -76,6 +76,7 @@ public class ListNode extends SuperNode { this.listAdapter.renderItemFuncId = prop.asString().value(); // If reset renderItem,should reset native cache. this.listAdapter.itemValues.clear(); + clearSubModel(); break; case "batchCount": this.listAdapter.batchCount = 15;