This commit is contained in:
kunfei
2023-06-14 21:58:56 +08:00
parent e7c2caaf13
commit ea873b017a
@@ -56,10 +56,10 @@ class BookSourceViewModel(application: Application) : BaseViewModel(application)
if (items.isEmpty()) return if (items.isEmpty()) return
execute { execute {
val firstSortNumber = items[0].customOrder val firstSortNumber = items[0].customOrder
items.forEachIndexed { index, bookSource -> val array = items.mapIndexed { index, bookSource ->
bookSource.customOrder = firstSortNumber + index bookSource.copy(customOrder = firstSortNumber + index)
} }
appDb.bookSourceDao.upOrder(items) appDb.bookSourceDao.upOrder(array)
} }
} }