From 040823a8af8e4af59dcd935af3481c60da532886 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=8A=B2=E9=B9=8F?= Date: Mon, 22 Nov 2021 11:38:18 +0800 Subject: [PATCH] Android: fix load anchor not reset in flow layout --- .../src/main/java/pub/doric/shader/flowlayout/FlowAdapter.java | 2 +- .../main/java/pub/doric/shader/flowlayout/FlowLayoutNode.java | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/doric-android/doric/src/main/java/pub/doric/shader/flowlayout/FlowAdapter.java b/doric-android/doric/src/main/java/pub/doric/shader/flowlayout/FlowAdapter.java index a810f5c1..6e8f77a1 100644 --- a/doric-android/doric/src/main/java/pub/doric/shader/flowlayout/FlowAdapter.java +++ b/doric-android/doric/src/main/java/pub/doric/shader/flowlayout/FlowAdapter.java @@ -45,7 +45,7 @@ class FlowAdapter extends RecyclerView.Adapter { int itemCount = 0; int batchCount = 15; SparseArray itemValues = new SparseArray<>(); - private int loadAnchor = 0; + int loadAnchor = -1; FlowAdapter(FlowLayoutNode flowLayoutNode) { this.flowLayoutNode = flowLayoutNode; diff --git a/doric-android/doric/src/main/java/pub/doric/shader/flowlayout/FlowLayoutNode.java b/doric-android/doric/src/main/java/pub/doric/shader/flowlayout/FlowLayoutNode.java index cd62e7a3..6909b63f 100644 --- a/doric-android/doric/src/main/java/pub/doric/shader/flowlayout/FlowLayoutNode.java +++ b/doric-android/doric/src/main/java/pub/doric/shader/flowlayout/FlowLayoutNode.java @@ -165,6 +165,7 @@ public class FlowLayoutNode extends SuperNode implements IDoricScr } String funcId = prop.asString().value(); if (!funcId.equals(this.flowAdapter.renderItemFuncId)) { + this.flowAdapter.loadAnchor = -1; this.flowAdapter.renderItemFuncId = funcId; // If reset renderItem,should reset native cache. for (int index = 0; index < this.flowAdapter.itemValues.size(); index++) {