当前位置: 首页>>代码示例>>Java>>正文


Java RecyclerViewSwipeManager.AFTER_SWIPE_REACTION_REMOVE_ITEM属性代码示例

本文整理汇总了Java中com.h6ah4i.android.widget.advrecyclerview.swipeable.RecyclerViewSwipeManager.AFTER_SWIPE_REACTION_REMOVE_ITEM属性的典型用法代码示例。如果您正苦于以下问题:Java RecyclerViewSwipeManager.AFTER_SWIPE_REACTION_REMOVE_ITEM属性的具体用法?Java RecyclerViewSwipeManager.AFTER_SWIPE_REACTION_REMOVE_ITEM怎么用?Java RecyclerViewSwipeManager.AFTER_SWIPE_REACTION_REMOVE_ITEM使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.h6ah4i.android.widget.advrecyclerview.swipeable.RecyclerViewSwipeManager的用法示例。


在下文中一共展示了RecyclerViewSwipeManager.AFTER_SWIPE_REACTION_REMOVE_ITEM属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onSwipeItem

@Override
public int onSwipeItem(MyViewHolder holder, int position, int result) {
    Log.d(TAG, "onSwipeItem(result = " + result + ")");

    switch (result) {
        // swipe right
        case RecyclerViewSwipeManager.RESULT_SWIPED_RIGHT:
            if (mProvider.get(position).isPinedToSwipeLeft()) {
                // pinned --- back to default position
                return RecyclerViewSwipeManager.AFTER_SWIPE_REACTION_DEFAULT;
            } else {
                // not pinned --- remove
                return RecyclerViewSwipeManager.AFTER_SWIPE_REACTION_REMOVE_ITEM;
            }
            // swipe left -- pin
        case RecyclerViewSwipeManager.RESULT_SWIPED_LEFT:
            return RecyclerViewSwipeManager.AFTER_SWIPE_REACTION_MOVE_TO_SWIPED_DIRECTION;
        // other --- do nothing
        case RecyclerViewSwipeManager.RESULT_CANCELED:
        default:
            return RecyclerViewSwipeManager.AFTER_SWIPE_REACTION_DEFAULT;
    }
}
 
开发者ID:hanks-zyh,项目名称:RecylerView,代码行数:23,代码来源:MyDraggableSwipeableItemAdapter.java

示例2: onPerformAfterSwipeReaction

@Override
public void onPerformAfterSwipeReaction(MyViewHolder holder, int position, int result, int reaction) {
    Log.d(TAG, "onPerformAfterSwipeReaction(result = " + result + ", reaction = " + reaction + ")");

    final MyItem item = mProvider.get(position);

    if (reaction == RecyclerViewSwipeManager.AFTER_SWIPE_REACTION_REMOVE_ITEM) {
        mProvider.remove(position);
        notifyItemRemoved(position);


    } else if (reaction == RecyclerViewSwipeManager.AFTER_SWIPE_REACTION_MOVE_TO_SWIPED_DIRECTION) {
        item.setPinedToSwipeLeft(true);
        notifyItemChanged(position);


    } else {
        item.setPinedToSwipeLeft(false);
    }
}
 
开发者ID:hanks-zyh,项目名称:RecylerView,代码行数:20,代码来源:MyDraggableSwipeableItemAdapter.java

示例3: onSwipeItem

@Override
public int onSwipeItem(MyViewHolder holder, int position, int result) {
    Log.d("zyh", "onSwipeItem(result = " + result + ")");

    switch (result) {
        // swipe right
        case RecyclerViewSwipeManager.RESULT_SWIPED_RIGHT:
            if (dataList.get(position).isPinedToSwipeLeft()) {
                // pinned --- back to default position
                return RecyclerViewSwipeManager.AFTER_SWIPE_REACTION_DEFAULT;
            } else {
                // not pinned --- remove
                return RecyclerViewSwipeManager.AFTER_SWIPE_REACTION_REMOVE_ITEM;
            }
            // swipe left -- pin
        case RecyclerViewSwipeManager.RESULT_SWIPED_LEFT:
            return RecyclerViewSwipeManager.AFTER_SWIPE_REACTION_MOVE_TO_SWIPED_DIRECTION;
        // other --- do nothing
        case RecyclerViewSwipeManager.RESULT_CANCELED:
        default:
            return RecyclerViewSwipeManager.AFTER_SWIPE_REACTION_DEFAULT;
    }
}
 
开发者ID:hanks-zyh,项目名称:RecylerView,代码行数:23,代码来源:MyAdapter.java

示例4: onPerformAfterSwipeReaction

@Override
public void onPerformAfterSwipeReaction(MyViewHolder holder, int position, int result, int reaction) {
    Log.d("zyh", "onPerformAfterSwipeReaction(result = " + result + ", reaction = " + reaction + ")");

    final MyItem item = dataList.get(position);

    if (reaction == RecyclerViewSwipeManager.AFTER_SWIPE_REACTION_REMOVE_ITEM) {
        dataList.remove(position);
        notifyItemRemoved(position);

    } else if (reaction == RecyclerViewSwipeManager.AFTER_SWIPE_REACTION_MOVE_TO_SWIPED_DIRECTION) {
        item.setPinedToSwipeLeft(true);
        notifyItemChanged(position);

    } else {
        item.setPinedToSwipeLeft(false);
    }
}
 
开发者ID:hanks-zyh,项目名称:RecylerView,代码行数:18,代码来源:MyAdapter.java

示例5: onSwipeItem

@Override
public int onSwipeItem(TaskViewHolder holder, int position, int result) {
    switch (result) {
        // swipe right
        case RecyclerViewSwipeManager.RESULT_SWIPED_RIGHT:
            if (list.get(position).isPinedToSwipeLeft()) {
                // pinned --- back to default position
                return RecyclerViewSwipeManager.AFTER_SWIPE_REACTION_DEFAULT;
            } else {
                // not pinned --- remove
                deleteTask(position);
                return RecyclerViewSwipeManager.AFTER_SWIPE_REACTION_REMOVE_ITEM;
            }
            // swipe left -- pin
        case RecyclerViewSwipeManager.RESULT_SWIPED_LEFT:

            return RecyclerViewSwipeManager.AFTER_SWIPE_REACTION_MOVE_TO_SWIPED_DIRECTION;
        // other --- do nothing
        case RecyclerViewSwipeManager.RESULT_CANCELED:
        default:
            return RecyclerViewSwipeManager.AFTER_SWIPE_REACTION_DEFAULT;
    }
}
 
开发者ID:hanks-zyh,项目名称:Conquer,代码行数:23,代码来源:MyTaskAdapter.java

示例6: onPerformAfterSwipeReaction

@Override
public void onPerformAfterSwipeReaction(TaskViewHolder holder, int position, int result, int reaction) {
    final Task item = list.get(position);
    if (reaction == RecyclerViewSwipeManager.AFTER_SWIPE_REACTION_REMOVE_ITEM) {
        list.remove(position);
        notifyItemRemoved(position);
        if (mEventListener != null) {
            mEventListener.onItemRemoved(position);
        }
    } else if (reaction == RecyclerViewSwipeManager.AFTER_SWIPE_REACTION_MOVE_TO_SWIPED_DIRECTION) {
        item.setPinedToSwipeLeft(true);
        notifyItemChanged(position);
        if (mEventListener != null) {
            mEventListener.onItemPinned(position);
        }
    } else {
        item.setPinedToSwipeLeft(false);
    }
}
 
开发者ID:hanks-zyh,项目名称:Conquer,代码行数:19,代码来源:MyTaskAdapter.java

示例7: onSwipeItem

@Override
public int onSwipeItem(MyViewHolder holder, int position, int result) {
    Log.d(TAG, "onSwipeItem(position = " + position + ", result = " + result + ")");

    switch (result) {
        // swipe right
        case RecyclerViewSwipeManager.RESULT_SWIPED_RIGHT:
            if (mProvider.getItem(position).isPinnedToSwipeLeft()) {
                // pinned --- back to default position
                return RecyclerViewSwipeManager.AFTER_SWIPE_REACTION_DEFAULT;
            } else {
                // not pinned --- remove
                return RecyclerViewSwipeManager.AFTER_SWIPE_REACTION_REMOVE_ITEM;
            }
        // swipe left -- pin
        case RecyclerViewSwipeManager.RESULT_SWIPED_LEFT:
            return RecyclerViewSwipeManager.AFTER_SWIPE_REACTION_MOVE_TO_SWIPED_DIRECTION;
        // other --- do nothing
        case RecyclerViewSwipeManager.RESULT_CANCELED:
        default:
            return RecyclerViewSwipeManager.AFTER_SWIPE_REACTION_DEFAULT;
    }
}
 
开发者ID:pczhu,项目名称:android-advancedrecyclerview-master,代码行数:23,代码来源:MySwipeableItemAdapter.java

示例8: onPerformAfterSwipeReaction

@Override
public void onPerformAfterSwipeReaction(MyViewHolder holder, int position, int result, int reaction) {
    Log.d(TAG, "onPerformAfterSwipeReaction(position = " + position + ", result = " + result + ", reaction = " + reaction + ")");

    final AbstractDataProvider.Data item = mProvider.getItem(position);

    if (reaction == RecyclerViewSwipeManager.AFTER_SWIPE_REACTION_REMOVE_ITEM) {
        mProvider.removeItem(position);
        notifyItemRemoved(position);

        if (mEventListener != null) {
            mEventListener.onItemRemoved(position);
        }
    } else if (reaction == RecyclerViewSwipeManager.AFTER_SWIPE_REACTION_MOVE_TO_SWIPED_DIRECTION) {
        item.setPinnedToSwipeLeft(true);
        notifyItemChanged(position);

        if (mEventListener != null) {
            mEventListener.onItemPinned(position);
        }
    } else {
        item.setPinnedToSwipeLeft(false);
    }
}
 
开发者ID:pczhu,项目名称:android-advancedrecyclerview-master,代码行数:24,代码来源:MySwipeableItemAdapter.java

示例9: onSwipeItem

@Override
public int onSwipeItem(MyViewHolder holder, int position, int result) {
    Log.d(TAG, "onSwipeItem(result = " + result + ")");

    switch (result) {
        // swipe right
        case RecyclerViewSwipeManager.RESULT_SWIPED_RIGHT:
            if (mProvider.getItem(position).isPinnedToSwipeLeft()) {
                // pinned --- back to default position
                return RecyclerViewSwipeManager.AFTER_SWIPE_REACTION_DEFAULT;
            } else {
                // not pinned --- remove
                return RecyclerViewSwipeManager.AFTER_SWIPE_REACTION_REMOVE_ITEM;
            }
        // swipe left -- pin
        case RecyclerViewSwipeManager.RESULT_SWIPED_LEFT:
            return RecyclerViewSwipeManager.AFTER_SWIPE_REACTION_MOVE_TO_SWIPED_DIRECTION;
        // other --- do nothing
        case RecyclerViewSwipeManager.RESULT_CANCELED:
        default:
            return RecyclerViewSwipeManager.AFTER_SWIPE_REACTION_DEFAULT;
    }
}
 
开发者ID:pczhu,项目名称:android-advancedrecyclerview-master,代码行数:23,代码来源:MyDraggableSwipeableItemAdapter.java

示例10: onPerformAfterSwipeReaction

@Override
public void onPerformAfterSwipeReaction(MyViewHolder holder, int position, int result, int reaction) {
    Log.d(TAG, "onPerformAfterSwipeReaction(result = " + result + ", reaction = " + reaction + ")");

    final AbstractDataProvider.Data item = mProvider.getItem(position);

    if (reaction == RecyclerViewSwipeManager.AFTER_SWIPE_REACTION_REMOVE_ITEM) {
        mProvider.removeItem(position);
        notifyItemRemoved(position);

        if (mEventListener != null) {
            mEventListener.onItemRemoved(position);
        }
    } else if (reaction == RecyclerViewSwipeManager.AFTER_SWIPE_REACTION_MOVE_TO_SWIPED_DIRECTION) {
        item.setPinnedToSwipeLeft(true);
        notifyItemChanged(position);

        if (mEventListener != null) {
            mEventListener.onItemPinned(position);
        }
    } else {
        item.setPinnedToSwipeLeft(false);
    }
}
 
开发者ID:pczhu,项目名称:android-advancedrecyclerview-master,代码行数:24,代码来源:MyDraggableSwipeableItemAdapter.java

示例11: onSwipeGroupItem

@Override
public int onSwipeGroupItem(MyGroupViewHolder holder, int groupPosition, int result) {
    Log.d(TAG, "onSwipeGroupItem(groupPosition = " + groupPosition + ", result = " + result + ")");

    switch (result) {
        // swipe right
        case RecyclerViewSwipeManager.RESULT_SWIPED_RIGHT:
            if (mProvider.getGroupItem(groupPosition).isPinnedToSwipeLeft()) {
                // pinned --- back to default position
                return RecyclerViewSwipeManager.AFTER_SWIPE_REACTION_DEFAULT;
            } else {
                // not pinned --- remove
                return RecyclerViewSwipeManager.AFTER_SWIPE_REACTION_REMOVE_ITEM;
            }
        // swipe left -- pin
        case RecyclerViewSwipeManager.RESULT_SWIPED_LEFT:
            return RecyclerViewSwipeManager.AFTER_SWIPE_REACTION_MOVE_TO_SWIPED_DIRECTION;
        // other --- do nothing
        case RecyclerViewSwipeManager.RESULT_CANCELED:
        default:
            return RecyclerViewSwipeManager.AFTER_SWIPE_REACTION_DEFAULT;
    }
}
 
开发者ID:pczhu,项目名称:android-advancedrecyclerview-master,代码行数:23,代码来源:MyExpandableDraggableSwipeableItemAdapter.java

示例12: onSwipeChildItem

@Override
public int onSwipeChildItem(MyChildViewHolder holder, int groupPosition, int childPosition, int result) {
    Log.d(TAG, "onSwipeChildItem(groupPosition = " + groupPosition + ", childPosition = " + childPosition + ", result = " + result + ")");

    switch (result) {
        // swipe right
        case RecyclerViewSwipeManager.RESULT_SWIPED_RIGHT:
            if (mProvider.getChildItem(groupPosition, childPosition).isPinnedToSwipeLeft()) {
                // pinned --- back to default position
                return RecyclerViewSwipeManager.AFTER_SWIPE_REACTION_DEFAULT;
            } else {
                // not pinned --- remove
                return RecyclerViewSwipeManager.AFTER_SWIPE_REACTION_REMOVE_ITEM;
            }
        // swipe left -- pin
        case RecyclerViewSwipeManager.RESULT_SWIPED_LEFT:
            return RecyclerViewSwipeManager.AFTER_SWIPE_REACTION_MOVE_TO_SWIPED_DIRECTION;
        // other --- do nothing
        case RecyclerViewSwipeManager.RESULT_CANCELED:
        default:
            return RecyclerViewSwipeManager.AFTER_SWIPE_REACTION_DEFAULT;
    }
}
 
开发者ID:pczhu,项目名称:android-advancedrecyclerview-master,代码行数:23,代码来源:MyExpandableDraggableSwipeableItemAdapter.java

示例13: onPerformAfterSwipeGroupReaction

@Override
public void onPerformAfterSwipeGroupReaction(MyGroupViewHolder holder, int groupPosition, int result, int reaction) {
    Log.d(TAG, "onPerformAfterSwipeGroupReaction(groupPosition = " + groupPosition + ", result = " + result + ", reaction = " + reaction + ")");

    final AbstractExpandableDataProvider.GroupData item = mProvider.getGroupItem(groupPosition);
    final long expandablePosition = RecyclerViewExpandableItemManager.getPackedPositionForGroup(groupPosition);
    final int flatPosition = mExpandableItemManager.getFlatPosition(expandablePosition);

    if (reaction == RecyclerViewSwipeManager.AFTER_SWIPE_REACTION_REMOVE_ITEM) {
        mProvider.removeGroupItem(groupPosition);
        notifyItemRemoved(flatPosition);

        if (mEventListener != null) {
            mEventListener.onGroupItemRemoved(groupPosition);
        }
    } else if (reaction == RecyclerViewSwipeManager.AFTER_SWIPE_REACTION_MOVE_TO_SWIPED_DIRECTION) {
        item.setPinnedToSwipeLeft(true);
        notifyItemChanged(flatPosition);

        if (mEventListener != null) {
            mEventListener.onGroupItemPinned(groupPosition);
        }
    } else {
        item.setPinnedToSwipeLeft(false);
    }
}
 
开发者ID:pczhu,项目名称:android-advancedrecyclerview-master,代码行数:26,代码来源:MyExpandableDraggableSwipeableItemAdapter.java

示例14: isSwipeDismissed

private static boolean isSwipeDismissed(RecyclerView.ViewHolder item) {
    if (!(item instanceof SwipeableItemViewHolder)) {
        return false;
    }

    final SwipeableItemViewHolder item2 = (SwipeableItemViewHolder) item;
    final int result = item2.getSwipeResult();
    final int reaction = item2.getAfterSwipeReaction();

    return ((result == RecyclerViewSwipeManager.RESULT_SWIPED_LEFT) ||
            (result == RecyclerViewSwipeManager.RESULT_SWIPED_UP) ||
            (result == RecyclerViewSwipeManager.RESULT_SWIPED_RIGHT) ||
            (result == RecyclerViewSwipeManager.RESULT_SWIPED_DOWN)) &&
            (reaction == RecyclerViewSwipeManager.AFTER_SWIPE_REACTION_REMOVE_ITEM);
}
 
开发者ID:fabricethilaw,项目名称:expandable-recyclerview-with-gridlayout,代码行数:15,代码来源:SwipeDismissItemAnimator.java

示例15: invokeOnSwipeItem

@SuppressWarnings("unchecked")
public static SwipeResultAction invokeOnSwipeItem(
        BaseExpandableSwipeableItemAdapter<?, ?> adapter, RecyclerView.ViewHolder holder,
        int groupPosition, int childPosition, int result) {

    if (adapter instanceof LegacyExpandableSwipeableItemAdapter) {
        int reaction;

        if (childPosition == RecyclerView.NO_POSITION) {
            reaction = ((LegacyExpandableSwipeableItemAdapter) adapter).onSwipeGroupItem(
                    holder, groupPosition, result);
        } else {
            reaction = ((LegacyExpandableSwipeableItemAdapter) adapter).onSwipeChildItem(
                    holder, groupPosition, childPosition, result);
        }

        switch (reaction) {
            case RecyclerViewSwipeManager.AFTER_SWIPE_REACTION_DEFAULT:
            case RecyclerViewSwipeManager.AFTER_SWIPE_REACTION_MOVE_TO_SWIPED_DIRECTION:
            case RecyclerViewSwipeManager.AFTER_SWIPE_REACTION_REMOVE_ITEM:
                //noinspection deprecation
                return new LegacyExpandableSwipeResultAction<>(
                        (LegacyExpandableSwipeableItemAdapter<RecyclerView.ViewHolder, RecyclerView.ViewHolder>) adapter,
                        holder, groupPosition, childPosition, result, reaction);
            default:
                throw new IllegalStateException("Unexpected reaction type: " + reaction);
        }
    } else {
        if (childPosition == RecyclerView.NO_POSITION) {
            return ((ExpandableSwipeableItemAdapter) adapter).onSwipeGroupItem(holder, groupPosition, result);
        } else {
            return ((ExpandableSwipeableItemAdapter) adapter).onSwipeChildItem(holder, groupPosition, childPosition, result);
        }
    }
}
 
开发者ID:fabricethilaw,项目名称:expandable-recyclerview-with-gridlayout,代码行数:35,代码来源:ExpandableSwipeableItemInternalUtils.java


注:本文中的com.h6ah4i.android.widget.advrecyclerview.swipeable.RecyclerViewSwipeManager.AFTER_SWIPE_REACTION_REMOVE_ITEM属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。