mirror of
https://github.com/gedoor/legado.git
synced 2025-01-05 10:17:15 +08:00
优化
This commit is contained in:
parent
233a6f01b2
commit
85e10a72a9
@ -86,8 +86,8 @@ class ItemTouchCallback(private val callback: Callback) : ItemTouchHelper.Callba
|
||||
srcViewHolder: RecyclerView.ViewHolder,
|
||||
targetViewHolder: RecyclerView.ViewHolder
|
||||
): Boolean {
|
||||
val fromPosition: Int = srcViewHolder.adapterPosition
|
||||
val toPosition: Int = targetViewHolder.adapterPosition
|
||||
val fromPosition: Int = srcViewHolder.bindingAdapterPosition
|
||||
val toPosition: Int = targetViewHolder.bindingAdapterPosition
|
||||
if (fromPosition < toPosition) {
|
||||
for (i in fromPosition until toPosition) {
|
||||
callback.swap(i, i + 1)
|
||||
@ -101,7 +101,7 @@ class ItemTouchCallback(private val callback: Callback) : ItemTouchHelper.Callba
|
||||
}
|
||||
|
||||
override fun onSwiped(viewHolder: RecyclerView.ViewHolder, direction: Int) {
|
||||
callback.onSwiped(viewHolder.adapterPosition)
|
||||
callback.onSwiped(viewHolder.bindingAdapterPosition)
|
||||
}
|
||||
|
||||
override fun onSelectedChanged(viewHolder: RecyclerView.ViewHolder?, actionState: Int) {
|
||||
|
@ -22,7 +22,6 @@ android.enableJetifier=false
|
||||
# Kotlin code style for this project: "official" or "obsolete":
|
||||
kotlin.code.style=official
|
||||
kotlin.incremental.useClasspathSnapshot=true
|
||||
kotlin.experimental.tryK2=true
|
||||
android.enableResourceOptimizations=true
|
||||
# android.enableNewResourceShrinker' is deprecated.
|
||||
# It was removed in version 8.0 of the Android Gradle plugin.
|
||||
|
Loading…
Reference in New Issue
Block a user