Fix move profile
This commit is contained in:
@@ -90,8 +90,10 @@ class ConfigurationFragment : Fragment() {
|
|||||||
RecyclerView.Adapter<Holder>() {
|
RecyclerView.Adapter<Holder>() {
|
||||||
|
|
||||||
internal var items: MutableList<Profile> = mutableListOf()
|
internal var items: MutableList<Profile> = mutableListOf()
|
||||||
|
private var isMoving = false
|
||||||
|
|
||||||
internal fun reload() {
|
internal fun reload() {
|
||||||
|
if (isMoving) return
|
||||||
scope.launch(Dispatchers.IO) {
|
scope.launch(Dispatchers.IO) {
|
||||||
items = ProfileManager.list().toMutableList()
|
items = ProfileManager.list().toMutableList()
|
||||||
withContext(Dispatchers.Main) {
|
withContext(Dispatchers.Main) {
|
||||||
@@ -124,8 +126,10 @@ class ConfigurationFragment : Fragment() {
|
|||||||
first.userOrder = previousOrder
|
first.userOrder = previousOrder
|
||||||
updated.add(first)
|
updated.add(first)
|
||||||
notifyItemMoved(from, to)
|
notifyItemMoved(from, to)
|
||||||
|
isMoving = true
|
||||||
GlobalScope.launch(Dispatchers.IO) {
|
GlobalScope.launch(Dispatchers.IO) {
|
||||||
ProfileManager.update(updated)
|
ProfileManager.update(updated)
|
||||||
|
isMoving = false
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user