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 ee88ca92..cbe3d7c4 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 @@ -62,16 +62,20 @@ class FlowAdapter extends RecyclerView.Adapter { @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 diff --git a/doric-android/doric/src/main/java/pub/doric/shader/flowlayout/FlowLayoutItemNode.java b/doric-android/doric/src/main/java/pub/doric/shader/flowlayout/FlowLayoutItemNode.java index fcee9c11..decce634 100644 --- a/doric-android/doric/src/main/java/pub/doric/shader/flowlayout/FlowLayoutItemNode.java +++ b/doric-android/doric/src/main/java/pub/doric/shader/flowlayout/FlowLayoutItemNode.java @@ -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); }