本文整理汇总了Java中com.h6ah4i.android.widget.advrecyclerview.swipeable.RecyclerViewSwipeManager类的典型用法代码示例。如果您正苦于以下问题:Java RecyclerViewSwipeManager类的具体用法?Java RecyclerViewSwipeManager怎么用?Java RecyclerViewSwipeManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RecyclerViewSwipeManager类属于com.h6ah4i.android.widget.advrecyclerview.swipeable包,在下文中一共展示了RecyclerViewSwipeManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onGetSwipeReactionType
import com.h6ah4i.android.widget.advrecyclerview.swipeable.RecyclerViewSwipeManager; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public int onGetSwipeReactionType(RecyclerView.ViewHolder holder, int position, int x, int y) {
if (!(mExpandableItemAdapter instanceof BaseExpandableSwipeableItemAdapter)) {
return RecyclerViewSwipeManager.REACTION_CAN_NOT_SWIPE_ANY;
}
final BaseExpandableSwipeableItemAdapter adapter = (BaseExpandableSwipeableItemAdapter) mExpandableItemAdapter;
final int flatPosition = position;
final long expandablePosition = mPositionTranslator.getExpandablePosition(flatPosition);
final int groupPosition = ExpandableAdapterHelper.getPackedPositionGroup(expandablePosition);
final int childPosition = ExpandableAdapterHelper.getPackedPositionChild(expandablePosition);
if (childPosition == RecyclerView.NO_POSITION) {
return adapter.onGetGroupItemSwipeReactionType(holder, groupPosition, x, y);
} else {
return adapter.onGetChildItemSwipeReactionType(holder, groupPosition, childPosition, x, y);
}
}
开发者ID:fabricethilaw,项目名称:expandable-recyclerview-with-gridlayout,代码行数:21,代码来源:ExpandableRecyclerViewWrapperAdapter.java
示例2: onSetSwipeBackground
import com.h6ah4i.android.widget.advrecyclerview.swipeable.RecyclerViewSwipeManager; //导入依赖的package包/类
@Override
public void onSetSwipeBackground(MyViewHolder holder, int position, int type) {
int bgRes = 0;
switch (type) {
case RecyclerViewSwipeManager.DRAWABLE_SWIPE_NEUTRAL_BACKGROUND:
bgRes = R.drawable.bg_swipe_item_neutral;
break;
case RecyclerViewSwipeManager.DRAWABLE_SWIPE_LEFT_BACKGROUND:
bgRes = R.drawable.bg_swipe_item_left;
break;
case RecyclerViewSwipeManager.DRAWABLE_SWIPE_RIGHT_BACKGROUND:
bgRes = R.drawable.bg_swipe_item_right;
break;
}
holder.itemView.setBackgroundResource(bgRes);
}
示例3: onSwipeItem
import com.h6ah4i.android.widget.advrecyclerview.swipeable.RecyclerViewSwipeManager; //导入依赖的package包/类
@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;
}
}
示例4: onPerformAfterSwipeReaction
import com.h6ah4i.android.widget.advrecyclerview.swipeable.RecyclerViewSwipeManager; //导入依赖的package包/类
@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);
}
}
示例5: onSetSwipeBackground
import com.h6ah4i.android.widget.advrecyclerview.swipeable.RecyclerViewSwipeManager; //导入依赖的package包/类
@Override
public void onSetSwipeBackground(MyViewHolder holder, int position, int type) {
Log.d("zyh", "onSetSwipeBackground---," + position + "," + type);
int bgRes = 0;
switch (type) {
case RecyclerViewSwipeManager.DRAWABLE_SWIPE_NEUTRAL_BACKGROUND:
bgRes = R.drawable.bg_swipe_item_neutral;
break;
case RecyclerViewSwipeManager.DRAWABLE_SWIPE_LEFT_BACKGROUND:
bgRes = R.drawable.bg_swipe_item_left;
break;
case RecyclerViewSwipeManager.DRAWABLE_SWIPE_RIGHT_BACKGROUND:
bgRes = R.drawable.bg_swipe_item_right;
break;
}
holder.itemView.setBackgroundResource(bgRes);
}
示例6: onSwipeItem
import com.h6ah4i.android.widget.advrecyclerview.swipeable.RecyclerViewSwipeManager; //导入依赖的package包/类
@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;
}
}
示例7: onPerformAfterSwipeReaction
import com.h6ah4i.android.widget.advrecyclerview.swipeable.RecyclerViewSwipeManager; //导入依赖的package包/类
@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);
}
}
示例8: onGetSwipeReactionType
import com.h6ah4i.android.widget.advrecyclerview.swipeable.RecyclerViewSwipeManager; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public int onGetSwipeReactionType(RecyclerView.ViewHolder holder, int position, int x, int y) {
if (!(mExpandableItemAdapter instanceof ExpandableSwipeableItemAdapter)) {
return RecyclerViewSwipeManager.REACTION_CAN_NOT_SWIPE_BOTH;
}
final ExpandableSwipeableItemAdapter adapter = (ExpandableSwipeableItemAdapter) mExpandableItemAdapter;
final int flatPosition = position;
final long expandablePosition = mPositionTranslator.getExpandablePosition(flatPosition);
final int groupPosition = ExpandableAdapterHelper.getPackedPositionGroup(expandablePosition);
final int childPosition = ExpandableAdapterHelper.getPackedPositionChild(expandablePosition);
if (childPosition == RecyclerView.NO_POSITION) {
return adapter.onGetGroupItemSwipeReactionType(holder, groupPosition, x, y);
} else {
return adapter.onGetChildItemSwipeReactionType(holder, groupPosition, childPosition, x, y);
}
}
示例9: onSwipeItem
import com.h6ah4i.android.widget.advrecyclerview.swipeable.RecyclerViewSwipeManager; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public int onSwipeItem(RecyclerView.ViewHolder holder, int position, int result) {
if (!(mExpandableItemAdapter instanceof ExpandableSwipeableItemAdapter)) {
return RecyclerViewSwipeManager.AFTER_SWIPE_REACTION_DEFAULT;
}
final ExpandableSwipeableItemAdapter adapter = (ExpandableSwipeableItemAdapter) mExpandableItemAdapter;
final int flatPosition = position;
final long expandablePosition = mPositionTranslator.getExpandablePosition(flatPosition);
final int groupPosition = ExpandableAdapterHelper.getPackedPositionGroup(expandablePosition);
final int childPosition = ExpandableAdapterHelper.getPackedPositionChild(expandablePosition);
if (childPosition == RecyclerView.NO_POSITION) {
return adapter.onSwipeGroupItem(holder, groupPosition, result);
} else {
return adapter.onSwipeChildItem(holder, groupPosition, childPosition, result);
}
}
示例10: onSetSwipeBackground
import com.h6ah4i.android.widget.advrecyclerview.swipeable.RecyclerViewSwipeManager; //导入依赖的package包/类
@Override
public void onSetSwipeBackground(TaskViewHolder holder, int position, int type) {
int bgRes = 0;
switch (type) {
case RecyclerViewSwipeManager.DRAWABLE_SWIPE_NEUTRAL_BACKGROUND:
bgRes = R.drawable.bg_swipe_item_neutral;
break;
case RecyclerViewSwipeManager.DRAWABLE_SWIPE_LEFT_BACKGROUND:
bgRes = R.drawable.bg_swipe_item_left; //左边滑动出现的布局,应该算是一个drawable
break;
case RecyclerViewSwipeManager.DRAWABLE_SWIPE_RIGHT_BACKGROUND:
bgRes = R.drawable.bg_swipe_item_right; //右边滑动出现的布局
break;
}
holder.itemView.setBackgroundResource(bgRes);
}
示例11: onSwipeItem
import com.h6ah4i.android.widget.advrecyclerview.swipeable.RecyclerViewSwipeManager; //导入依赖的package包/类
@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;
}
}
示例12: onPerformAfterSwipeReaction
import com.h6ah4i.android.widget.advrecyclerview.swipeable.RecyclerViewSwipeManager; //导入依赖的package包/类
@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);
}
}
示例13: onSwipeItem
import com.h6ah4i.android.widget.advrecyclerview.swipeable.RecyclerViewSwipeManager; //导入依赖的package包/类
@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;
}
}
示例14: onPerformAfterSwipeReaction
import com.h6ah4i.android.widget.advrecyclerview.swipeable.RecyclerViewSwipeManager; //导入依赖的package包/类
@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);
}
}
示例15: onSwipeItem
import com.h6ah4i.android.widget.advrecyclerview.swipeable.RecyclerViewSwipeManager; //导入依赖的package包/类
@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,代码行数:24,代码来源:MyDraggableSwipeableItemAdapter.java