Skip to content

Commit

Permalink
Minor improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
queuejw committed Sep 1, 2024
1 parent ddacb2e commit 5f33662
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ class NewStart: Fragment(), OnStartDragListener {
super.onViewCreated(view, savedInstanceState)
if(context != null) {
viewLifecycleOwner.lifecycleScope.launch(defaultDispatcher) {
lastItemPos = mainViewModel.getTileDao().getUserTiles().size + 6
lastItemPos = mainViewModel.getTileDao().getTileLastPosition().appPos!! + 6
tiles = mainViewModel.getTileDao().getTilesList()
setupRecyclerViewLayoutManager(requireContext())
setupAdapter()
Expand Down Expand Up @@ -831,7 +831,7 @@ class NewStart: Fragment(), OnStartDragListener {
mainViewModel.getTileDao().updateTile(item)
}
val updatedList = mainViewModel.getTileDao().getTilesList()
lastItemPos = mainViewModel.getTileDao().getUserTiles().last().appPos!! + 6
lastItemPos = mainViewModel.getTileDao().getTileLastPosition().appPos!! + 6
withContext(mainDispatcher) {
if (isEditMode) {
refreshData(updatedList)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,6 @@ interface TileDao {
fun getTileByID(id: Int): Tile
@Query("DELETE FROM tiles")
fun deleteAllTiles()
@Query("SELECT * FROM tiles WHERE tileType != -1 ORDER BY appPos DESC LIMIT 1")
fun getTileLastPosition(): Tile
}

0 comments on commit 5f33662

Please sign in to comment.