Skip to content

Commit 2d08e10

Browse files
committed
add comments
1 parent b6a82ad commit 2d08e10

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

flowlayoutmanager/src/main/java/com/xiaofeng/flowlayoutmanager/FlowLayoutManager.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,11 @@ private int contentMoveDown(int dy, RecyclerView.Recycler recycler) {
351351

352352
/**
353353
* Add new line of elements at top, to keep layout, have to virtually layout from beginning.
354+
* Here is an example to explain why: Say total width is 10, current line is [5, 2, 1], 3 numbers
355+
* before current line is 7, 2, 6. If you just look back, you could say previous line [2, 6], but there
356+
* is another possibility: [7, 2], [6]. You don't know which one is correct without knowing how the line
357+
* before previous one, same thing could happen to that line too, so you have to sort everything from beginning
358+
* or cache the result.
354359
*/
355360
private void addNewLineAtTop(RecyclerView.Recycler recycler) {
356361
int x = layoutStartPoint().x, bottom = getDecoratedTop(getChildAt(getMaxHeightLayoutPositionInLine(0))), y;

0 commit comments

Comments
 (0)