android: fix when flowlayout'item height is just,cannot show rowSpace properly

This commit is contained in:
pengfei.zhou 2022-08-10 10:28:08 +08:00 committed by osborn
parent 46d34e3288
commit b4a704a613
2 changed files with 10 additions and 6 deletions

View File

@ -59,5 +59,13 @@ public class FlowLayoutItemNode extends StackNode {
super.blend(jsObject); super.blend(jsObject);
getNodeView().getLayoutParams().width = getLayoutParams().width; getNodeView().getLayoutParams().width = getLayoutParams().width;
getNodeView().getLayoutParams().height = getLayoutParams().height; getNodeView().getLayoutParams().height = getLayoutParams().height;
if (mSuperNode instanceof FlowLayoutNode) {
if (getNodeView().getLayoutParams().width > 0) {
getNodeView().getLayoutParams().width += ((FlowLayoutNode) mSuperNode).columnSpace;
}
if (getNodeView().getLayoutParams().height > 0) {
getNodeView().getLayoutParams().height += ((FlowLayoutNode) mSuperNode).rowSpace;
}
}
} }
} }

View File

@ -96,8 +96,8 @@ public class FlowLayoutNode extends SuperNode<RecyclerView> implements IDoricScr
} }
} }
}; };
private int columnSpace = 0; int columnSpace = 0;
private int rowSpace = 0; int rowSpace = 0;
private final Rect padding = new Rect(); private final Rect padding = new Rect();
private final RecyclerView.ItemDecoration spacingItemDecoration = new RecyclerView.ItemDecoration() { private final RecyclerView.ItemDecoration spacingItemDecoration = new RecyclerView.ItemDecoration() {
@Override @Override
@ -337,10 +337,6 @@ public class FlowLayoutNode extends SuperNode<RecyclerView> implements IDoricScr
listeners.remove(listener); listeners.remove(listener);
} }
private int calibratePosition(int position) {
return position;
}
@DoricMethod @DoricMethod
public JSONArray findVisibleItems() { public JSONArray findVisibleItems() {
int[] firstPositions = staggeredGridLayoutManager.findFirstVisibleItemPositions(null); int[] firstPositions = staggeredGridLayoutManager.findFirstVisibleItemPositions(null);