Android: fix load anchor not reset in flow layout

This commit is contained in:
王劲鹏 2021-11-22 11:38:18 +08:00 committed by osborn
parent c3e05a39c0
commit 040823a8af
2 changed files with 2 additions and 1 deletions

View File

@ -45,7 +45,7 @@ class FlowAdapter extends RecyclerView.Adapter<FlowAdapter.DoricViewHolder> {
int itemCount = 0; int itemCount = 0;
int batchCount = 15; int batchCount = 15;
SparseArray<String> itemValues = new SparseArray<>(); SparseArray<String> itemValues = new SparseArray<>();
private int loadAnchor = 0; int loadAnchor = -1;
FlowAdapter(FlowLayoutNode flowLayoutNode) { FlowAdapter(FlowLayoutNode flowLayoutNode) {
this.flowLayoutNode = flowLayoutNode; this.flowLayoutNode = flowLayoutNode;

View File

@ -165,6 +165,7 @@ public class FlowLayoutNode extends SuperNode<RecyclerView> implements IDoricScr
} }
String funcId = prop.asString().value(); String funcId = prop.asString().value();
if (!funcId.equals(this.flowAdapter.renderItemFuncId)) { if (!funcId.equals(this.flowAdapter.renderItemFuncId)) {
this.flowAdapter.loadAnchor = -1;
this.flowAdapter.renderItemFuncId = funcId; this.flowAdapter.renderItemFuncId = funcId;
// If reset renderItem,should reset native cache. // If reset renderItem,should reset native cache.
for (int index = 0; index < this.flowAdapter.itemValues.size(); index++) { for (int index = 0; index < this.flowAdapter.itemValues.size(); index++) {