當前位置: 首頁>>代碼示例>>Java>>正文


Java UpdateOp類代碼示例

本文整理匯總了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);
}
 
開發者ID:MLNO,項目名稱:airgram,代碼行數:21,代碼來源:OpReorderer.java

示例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);
    }
}
 
開發者ID:MLNO,項目名稱:airgram,代碼行數:9,代碼來源:OpReorderer.java

示例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;
    }
}
 
開發者ID:MLNO,項目名稱:airgram,代碼行數:16,代碼來源:OpReorderer.java

示例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);
    }
}
 
開發者ID:MLNO,項目名稱:airgram,代碼行數:37,代碼來源:OpReorderer.java

示例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;
}
 
開發者ID:MLNO,項目名稱:airgram,代碼行數:15,代碼來源:OpReorderer.java

示例6: obtainUpdateOp

import org.telegram.messenger.support.widget.AdapterHelper.UpdateOp; //導入依賴的package包/類
UpdateOp obtainUpdateOp(int cmd, int startPosition, int itemCount, Object payload); 
開發者ID:MLNO,項目名稱:airgram,代碼行數:2,代碼來源:OpReorderer.java

示例7: recycleUpdateOp

import org.telegram.messenger.support.widget.AdapterHelper.UpdateOp; //導入依賴的package包/類
void recycleUpdateOp(UpdateOp op); 
開發者ID:MLNO,項目名稱:airgram,代碼行數:2,代碼來源:OpReorderer.java


注:本文中的org.telegram.messenger.support.widget.AdapterHelper.UpdateOp類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。