Only consider top level items when finding first empty cell
This commit is contained in:
parent
4f5fda2c52
commit
d9e333ddb0
|
@ -405,9 +405,9 @@ class MainActivity : SimpleActivity(), FlingListener {
|
|||
|
||||
private fun findFirstEmptyCell(): Pair<Int, Rect> {
|
||||
val gridItems = homeScreenGridItemsDB.getAllItems() as ArrayList<HomeScreenGridItem>
|
||||
val maxPage = gridItems.map { it.page }.max()
|
||||
val maxPage = gridItems.maxOf { it.page }
|
||||
val occupiedCells = ArrayList<Triple<Int, Int, Int>>()
|
||||
gridItems.forEach { item ->
|
||||
gridItems.filter { it.parentId == null }.forEach { item ->
|
||||
for (xCell in item.left..item.right) {
|
||||
for (yCell in item.top..item.bottom) {
|
||||
occupiedCells.add(Triple(item.page, xCell, yCell))
|
||||
|
|
Loading…
Reference in New Issue