mirror of
https://github.com/gedoor/legado.git
synced 2025-01-07 03:06:58 +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,
|
srcViewHolder: RecyclerView.ViewHolder,
|
||||||
targetViewHolder: RecyclerView.ViewHolder
|
targetViewHolder: RecyclerView.ViewHolder
|
||||||
): Boolean {
|
): Boolean {
|
||||||
val fromPosition: Int = srcViewHolder.adapterPosition
|
val fromPosition: Int = srcViewHolder.bindingAdapterPosition
|
||||||
val toPosition: Int = targetViewHolder.adapterPosition
|
val toPosition: Int = targetViewHolder.bindingAdapterPosition
|
||||||
if (fromPosition < toPosition) {
|
if (fromPosition < toPosition) {
|
||||||
for (i in fromPosition until toPosition) {
|
for (i in fromPosition until toPosition) {
|
||||||
callback.swap(i, i + 1)
|
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) {
|
override fun onSwiped(viewHolder: RecyclerView.ViewHolder, direction: Int) {
|
||||||
callback.onSwiped(viewHolder.adapterPosition)
|
callback.onSwiped(viewHolder.bindingAdapterPosition)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onSelectedChanged(viewHolder: RecyclerView.ViewHolder?, actionState: Int) {
|
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 for this project: "official" or "obsolete":
|
||||||
kotlin.code.style=official
|
kotlin.code.style=official
|
||||||
kotlin.incremental.useClasspathSnapshot=true
|
kotlin.incremental.useClasspathSnapshot=true
|
||||||
kotlin.experimental.tryK2=true
|
|
||||||
android.enableResourceOptimizations=true
|
android.enableResourceOptimizations=true
|
||||||
# android.enableNewResourceShrinker' is deprecated.
|
# android.enableNewResourceShrinker' is deprecated.
|
||||||
# It was removed in version 8.0 of the Android Gradle plugin.
|
# It was removed in version 8.0 of the Android Gradle plugin.
|
||||||
|
Loading…
Reference in New Issue
Block a user