jmartinesp / SpannedGridLayoutManager

Android RecyclerView.LayoutManager that resizes and reorders views based on SpanSize
MIT License
600 stars 105 forks source link

method to change initial 'span' value? ie: GridLayoutManager.setSpanCount() #25

Open jpage4500 opened 6 years ago

jpage4500 commented 6 years ago

I want to change the number of columns/spans when the user rotates the device - I was doing this using GridLayoutManager#setSpanCount() but don't see a similar method available for SpannedGridLayoutManager. Does one exist and I'm just missing it?

I ended up re-creating the layout manager after device rotates but at least it seems like this would be good to add if it makes sense..

jmartinesp commented 6 years ago

Sorry for the late response. I don't think I understand your use case, since when the screen rotates the Activity / Fragment / any other view-based controller should be recreated and the RecyclerView and its LayoutManager with it.

Even if the RecyclerView didn't get recreated, there would be not much difference between just setting a new spanCount on the current LayoutManager and creating a new one with that new value, since resetting the spanCount would mean recalculating everything and recycling every view.