本文整理汇总了Java中org.telegram.messenger.support.widget.AdapterHelper.UpdateOp类的典型用法代码示例。如果您正苦于以下问题:Java UpdateOp类的具体用法?Java UpdateOp怎么用?Java UpdateOp使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UpdateOp类属于org.telegram.messenger.support.widget.AdapterHelper包,在下文中一共展示了UpdateOp类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: swapMoveAdd
import org.telegram.messenger.support.widget.AdapterHelper.UpdateOp; //导入依赖的package包/类
private void swapMoveAdd(List<UpdateOp> list, int move, UpdateOp moveOp, int add,
UpdateOp addOp) {
int offset = 0;
// going in reverse, first revert the effect of add
if (moveOp.itemCount < addOp.positionStart) {
offset--;
}
if (moveOp.positionStart < addOp.positionStart) {
offset++;
}
if (addOp.positionStart <= moveOp.positionStart) {
moveOp.positionStart += addOp.itemCount;
}
if (addOp.positionStart <= moveOp.itemCount) {
moveOp.itemCount += addOp.itemCount;
}
addOp.positionStart += offset;
list.set(move, addOp);
list.set(add, moveOp);
}
示例2: reorderOps
import org.telegram.messenger.support.widget.AdapterHelper.UpdateOp; //导入依赖的package包/类
void reorderOps(List<UpdateOp> ops) {
// since move operations breaks continuity, their effects on ADD/RM are hard to handle.
// we push them to the end of the list so that they can be handled easily.
int badMove;
while ((badMove = getLastMoveOutOfOrder(ops)) != -1) {
swapMoveOp(ops, badMove, badMove + 1);
}
}
示例3: swapMoveOp
import org.telegram.messenger.support.widget.AdapterHelper.UpdateOp; //导入依赖的package包/类
private void swapMoveOp(List<UpdateOp> list, int badMove, int next) {
final UpdateOp moveOp = list.get(badMove);
final UpdateOp nextOp = list.get(next);
switch (nextOp.cmd) {
case REMOVE:
swapMoveRemove(list, badMove, moveOp, next, nextOp);
break;
case ADD:
swapMoveAdd(list, badMove, moveOp, next, nextOp);
break;
case UPDATE:
swapMoveUpdate(list, badMove, moveOp, next, nextOp);
break;
}
}
示例4: swapMoveUpdate
import org.telegram.messenger.support.widget.AdapterHelper.UpdateOp; //导入依赖的package包/类
void swapMoveUpdate(List<UpdateOp> list, int move, UpdateOp moveOp, int update,
UpdateOp updateOp) {
UpdateOp extraUp1 = null;
UpdateOp extraUp2 = null;
// going in reverse, first revert the effect of add
if (moveOp.itemCount < updateOp.positionStart) {
updateOp.positionStart--;
} else if (moveOp.itemCount < updateOp.positionStart + updateOp.itemCount) {
// moved item is updated. add an update for it
updateOp.itemCount--;
extraUp1 = mCallback.obtainUpdateOp(UPDATE, moveOp.positionStart, 1, updateOp.payload);
}
// now affect of add is consumed. now apply effect of first remove
if (moveOp.positionStart <= updateOp.positionStart) {
updateOp.positionStart++;
} else if (moveOp.positionStart < updateOp.positionStart + updateOp.itemCount) {
final int remaining = updateOp.positionStart + updateOp.itemCount
- moveOp.positionStart;
extraUp2 = mCallback.obtainUpdateOp(UPDATE, moveOp.positionStart + 1, remaining,
updateOp.payload);
updateOp.itemCount -= remaining;
}
list.set(update, moveOp);
if (updateOp.itemCount > 0) {
list.set(move, updateOp);
} else {
list.remove(move);
mCallback.recycleUpdateOp(updateOp);
}
if (extraUp1 != null) {
list.add(move, extraUp1);
}
if (extraUp2 != null) {
list.add(move, extraUp2);
}
}
示例5: getLastMoveOutOfOrder
import org.telegram.messenger.support.widget.AdapterHelper.UpdateOp; //导入依赖的package包/类
private int getLastMoveOutOfOrder(List<UpdateOp> list) {
boolean foundNonMove = false;
for (int i = list.size() - 1; i >= 0; i--) {
final UpdateOp op1 = list.get(i);
if (op1.cmd == MOVE) {
if (foundNonMove) {
return i;
}
} else {
foundNonMove = true;
}
}
return -1;
}
示例6: obtainUpdateOp
import org.telegram.messenger.support.widget.AdapterHelper.UpdateOp; //导入依赖的package包/类
UpdateOp obtainUpdateOp(int cmd, int startPosition, int itemCount, Object payload);
示例7: recycleUpdateOp
import org.telegram.messenger.support.widget.AdapterHelper.UpdateOp; //导入依赖的package包/类
void recycleUpdateOp(UpdateOp op);