|
|
@ -49,11 +49,20 @@ class ReplaceRuleAdapter(context: Context, var callBack: CallBack) : |
|
|
|
val srcItem = getItem(srcPosition) |
|
|
|
val srcItem = getItem(srcPosition) |
|
|
|
val targetItem = getItem(targetPosition) |
|
|
|
val targetItem = getItem(targetPosition) |
|
|
|
if (srcItem != null && targetItem != null) { |
|
|
|
if (srcItem != null && targetItem != null) { |
|
|
|
|
|
|
|
if (srcItem.order == targetItem.order) { |
|
|
|
|
|
|
|
if (targetPosition > srcPosition) { |
|
|
|
|
|
|
|
srcItem.order = srcItem.order + 1 |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
srcItem.order = srcItem.order - 1 |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
callBack.update(srcItem) |
|
|
|
|
|
|
|
} else { |
|
|
|
val srcOrder = srcItem.order |
|
|
|
val srcOrder = srcItem.order |
|
|
|
srcItem.order = targetItem.order |
|
|
|
srcItem.order = targetItem.order |
|
|
|
targetItem.order = srcOrder |
|
|
|
targetItem.order = srcOrder |
|
|
|
callBack.update(srcItem, targetItem) |
|
|
|
callBack.update(srcItem, targetItem) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
return true |
|
|
|
return true |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|