android: fix in flowlayout, the fullspaned item is being reused unproperly
This commit is contained in:
parent
6cae752456
commit
eaaa2c457a
@ -62,16 +62,20 @@ class FlowAdapter extends RecyclerView.Adapter<FlowAdapter.DoricViewHolder> {
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull DoricViewHolder holder, int position) {
|
||||
JSValue jsValue = getItemModel(position);
|
||||
boolean fullSpan = this.flowLayoutNode.loadMore && position >= this.itemCount;
|
||||
if (jsValue != null && jsValue.isObject()) {
|
||||
JSObject jsObject = jsValue.asObject();
|
||||
holder.flowLayoutItemNode.setId(jsObject.getProperty("id").asString().value());
|
||||
holder.flowLayoutItemNode.blend(jsObject.getProperty("props").asObject());
|
||||
JSObject props = jsObject.getProperty("props").asObject();
|
||||
holder.flowLayoutItemNode.blend(props);
|
||||
JSValue fullSpanValue = props.getProperty("fullSpan");
|
||||
if (fullSpanValue.isBoolean()) {
|
||||
fullSpan = fullSpanValue.asBoolean().value();
|
||||
}
|
||||
boolean fullSpan = this.flowLayoutNode.loadMore && position >= this.itemCount;
|
||||
if (holder.flowLayoutItemNode.fullSpan != null) {
|
||||
fullSpan = holder.flowLayoutItemNode.fullSpan;
|
||||
}
|
||||
if (fullSpan) {
|
||||
if (holder.itemView.getLayoutParams() instanceof StaggeredGridLayoutManager.LayoutParams) {
|
||||
((StaggeredGridLayoutManager.LayoutParams) holder.itemView.getLayoutParams()).setFullSpan(fullSpan);
|
||||
} else if (fullSpan) {
|
||||
StaggeredGridLayoutManager.LayoutParams layoutParams = new StaggeredGridLayoutManager.LayoutParams(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
holder.itemView.getLayoutParams().height
|
||||
|
@ -32,7 +32,6 @@ import pub.doric.shader.StackNode;
|
||||
@DoricPlugin(name = "FlowLayoutItem")
|
||||
public class FlowLayoutItemNode extends StackNode {
|
||||
public String identifier = "";
|
||||
public Boolean fullSpan = null;
|
||||
|
||||
public FlowLayoutItemNode(DoricContext doricContext) {
|
||||
super(doricContext);
|
||||
@ -44,7 +43,6 @@ public class FlowLayoutItemNode extends StackNode {
|
||||
if ("identifier".equals(name)) {
|
||||
this.identifier = prop.asString().value();
|
||||
} else if ("fullSpan".equals(name)) {
|
||||
this.fullSpan = prop.asBoolean().value();
|
||||
} else {
|
||||
super.blend(view, name, prop);
|
||||
}
|
||||
|
Reference in New Issue
Block a user