Skip to content

Commit

Permalink
perf: longPressDraggableHandle
Browse files Browse the repository at this point in the history
  • Loading branch information
lisonge committed Feb 15, 2024
1 parent 5e58901 commit 2eb76cd
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app/src/main/kotlin/li/songe/gkd/ui/home/SubsManagePage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ fun useSubsManagePage(): ScaffoldExt {
)
Card(
modifier = Modifier
.draggableHandle(onDragStopped = {
.longPressDraggableHandle(onDragStopped = {
val changeItems = mutableListOf<SubsItem>()
orderSubItems.forEachIndexed { i, subsItem ->
if (subItems[i] != subsItem) {
Expand All @@ -305,7 +305,9 @@ fun useSubsManagePage(): ScaffoldExt {
}
}
if (orderSubItems.isNotEmpty()) {
DbSet.subsItemDao.update(*changeItems.toTypedArray())
vm.viewModelScope.launchTry {
DbSet.subsItemDao.update(*changeItems.toTypedArray())
}
}
})
.shadow(elevation)
Expand Down

0 comments on commit 2eb76cd

Please sign in to comment.