lucasr / twoway-view

[DEPRECATED] RecyclerView made simple
5.23k stars 1.02k forks source link

unused space after changing orientation and column count in StaggeredLayout #225

Open chpasha opened 9 years ago

chpasha commented 9 years ago

Hi, I hardly believe that you will ever work on this beautiful library again, but I hope for that, and if you ever will...consider following scenario: we have 2 columns in landscape and 1 column in portrait and 4 children with span = 1. When orientation is changed without destroying Activity, we set new column count on LayoutManager. When we change from landscape to portrait everything is fine (well not quite, but it is another story), but when we switch back to landscape there is unused space below all items as if the height was accommodated for 1 column and 4 children in 4 rows (portrait) and was not calculated again when we got 2 columns and only 2 rows. After some experiments and hacking with reflection I found a cause with a dirty workaround - (before setting column count) if we call resetLayoutEdges method of TwoWayLayoutManager base class via reflection (since it is private) - everything works as expected, so the error is obviously is in not resetting those layout edges if column count (and maybe row count as well ) is changed in runtime