Java 类android.support.v7.widget.RecyclerView.ChildDrawingOrderCallback 实例源码

项目:letv    文件:ItemTouchHelper.java   
private void addChildDrawingOrderCallback() {
    if (VERSION.SDK_INT < 21) {
        if (this.mChildDrawingOrderCallback == null) {
            this.mChildDrawingOrderCallback = new ChildDrawingOrderCallback() {
                public int onGetChildDrawingOrder(int childCount, int i) {
                    if (ItemTouchHelper.this.mOverdrawChild == null) {
                        return i;
                    }
                    int childPosition = ItemTouchHelper.this.mOverdrawChildPosition;
                    if (childPosition == -1) {
                        childPosition = ItemTouchHelper.this.mRecyclerView.indexOfChild(ItemTouchHelper.this.mOverdrawChild);
                        ItemTouchHelper.this.mOverdrawChildPosition = childPosition;
                    }
                    if (i == childCount - 1) {
                        return childPosition;
                    }
                    return i >= childPosition ? i + 1 : i;
                }
            };
        }
        this.mRecyclerView.setChildDrawingOrderCallback(this.mChildDrawingOrderCallback);
    }
}
项目:boohee_v5.6    文件:ItemTouchHelper.java   
private void addChildDrawingOrderCallback() {
    if (VERSION.SDK_INT < 21) {
        if (this.mChildDrawingOrderCallback == null) {
            this.mChildDrawingOrderCallback = new ChildDrawingOrderCallback() {
                public int onGetChildDrawingOrder(int childCount, int i) {
                    if (ItemTouchHelper.this.mOverdrawChild == null) {
                        return i;
                    }
                    int childPosition = ItemTouchHelper.this.mOverdrawChildPosition;
                    if (childPosition == -1) {
                        childPosition = ItemTouchHelper.this.mRecyclerView.indexOfChild(ItemTouchHelper.this.mOverdrawChild);
                        ItemTouchHelper.this.mOverdrawChildPosition = childPosition;
                    }
                    if (i == childCount - 1) {
                        return childPosition;
                    }
                    return i >= childPosition ? i + 1 : i;
                }
            };
        }
        this.mRecyclerView.setChildDrawingOrderCallback(this.mChildDrawingOrderCallback);
    }
}