Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
D-clock committed Aug 11, 2016
2 parents bd3852f + bf97a7a commit e133ca4
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,16 @@ public int getItemCount() {
* @param toPosition
*/
public void moveItem(int fromPosition, int toPosition) {
Collections.swap(mAuthorInfoList, fromPosition, toPosition);//做数据的交换
//做数据的交换
if (fromPosition < toPosition) {
for (int index = fromPosition; index < toPosition; index++) {
Collections.swap(mAuthorInfoList, index, index + 1);
}
} else {
for (int index = fromPosition; index > toPosition; index--) {
Collections.swap(mAuthorInfoList, index, index - 1);
}
}
notifyItemMoved(fromPosition, toPosition);
}

Expand Down

0 comments on commit e133ca4

Please sign in to comment.