优化
This commit is contained in:
1 parent
e7c2caaf13
commit
ea873b017a
1 file changed
+3
-3
@@ -56,10 +56,10 @@ class BookSourceViewModel(application: Application) : BaseViewModel(application)
|
||||
if (items.isEmpty()) return
|
||||
execute {
|
||||
val firstSortNumber = items[0].customOrder
|
||||
items.forEachIndexed { index, bookSource ->
|
||||
bookSource.customOrder = firstSortNumber + index
|
||||
val array = items.mapIndexed { index, bookSource ->
|
||||
bookSource.copy(customOrder = firstSortNumber + index)
|
||||
}
|
||||
appDb.bookSourceDao.upOrder(items)
|
||||
appDb.bookSourceDao.upOrder(array)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user