felipecsl/AsymmetricGridView

Dynamic resizing of elements in a grid

Opened this issue · 1 comments

Hi everyone
I try to change the individual elements in the grid colSpan and rowSpan.
If the element being changed has the same height as the others - all is more or less normal:

screenshot_1530090292
screenshot_1530090287

Otherwise, the item simply disappears:

screenshot_1530090298

But if I add a new element to the grid, the missing item appears:

screenshot_1530090313

After change colSpan and rowSpan values, i call method notifyDataSetChanged() in the adapter.

Question - this is normal behavior and I do something wrong?

UPD:
My code (Kotlin):
(GridDevicesView - My custom heir to the AsymmetricItem interface,
items: List = ArrayList())
asymGrid = mainView.findViewById(R.id.testAsymGrid) asymGrid.requestedHorizontalSpacing = AsymGridUtils.dpToPx(context, 2f) asymGrid.setRequestedColumnCount(3) asymGrid.isDebugging = true asymGrid.isAllowReordering = true asymGridAdapter = GridDevicesAdapter(context, items, asymGrid) // My custom heir of ArrayAdapter asymGridAdapter.add(GridDevicesView(GridTileSize(1/*rowSpan*/,1/*colSpan*/))) asymGridAdapter.add(GridDevicesView(GridTileSize(2,1))) asymGridAdapter.add(GridDevicesView(GridTileSize(2,1)))

UPD
After debugging the AsymmetricGridViewAdapter.getView(), I found that if the rowItems variable contains two or more elements of different heights, all elements that are smaller in height than the first one are simply discarded.