use a background thread for updating launcher order

This commit is contained in:
tibbi 2020-11-08 10:15:21 +01:00
parent da7acb2c9f
commit ab63fccac8

View File

@ -18,6 +18,7 @@ import com.simplemobiletools.commons.extensions.applyColorFilter
import com.simplemobiletools.commons.extensions.beInvisibleIf import com.simplemobiletools.commons.extensions.beInvisibleIf
import com.simplemobiletools.commons.extensions.beVisibleIf import com.simplemobiletools.commons.extensions.beVisibleIf
import com.simplemobiletools.commons.helpers.SORT_BY_CUSTOM import com.simplemobiletools.commons.helpers.SORT_BY_CUSTOM
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
import com.simplemobiletools.commons.interfaces.ItemMoveCallback import com.simplemobiletools.commons.interfaces.ItemMoveCallback
import com.simplemobiletools.commons.interfaces.ItemTouchHelperContract import com.simplemobiletools.commons.interfaces.ItemTouchHelperContract
import com.simplemobiletools.commons.interfaces.RefreshRecyclerViewListener import com.simplemobiletools.commons.interfaces.RefreshRecyclerViewListener
@ -99,8 +100,10 @@ class LaunchersAdapter(activity: SimpleActivity, val launchers: ArrayList<AppLau
appLauncher.order = index + 1 appLauncher.order = index + 1
} }
launchers.forEach { ensureBackgroundThread {
activity.dbHelper.updateLauncherOrder(it.id, it.order) launchers.forEach {
activity.dbHelper.updateLauncherOrder(it.id, it.order)
}
} }
} }