Java Code Examples for android.support.v7.widget.helper.ItemTouchHelper#UP
The following examples show how to use
android.support.v7.widget.helper.ItemTouchHelper#UP .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ItemDragHelperCallback.java From Toutiao with Apache License 2.0 | 5 votes |
@Override public int getMovementFlags(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) { int dragFlags; RecyclerView.LayoutManager manager = recyclerView.getLayoutManager(); if (manager instanceof GridLayoutManager || manager instanceof StaggeredGridLayoutManager) { dragFlags = ItemTouchHelper.UP | ItemTouchHelper.DOWN | ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT; } else { dragFlags = ItemTouchHelper.UP | ItemTouchHelper.DOWN; } // 如果想支持滑动(删除)操作, swipeFlags = ItemTouchHelper.START | ItemTouchHelper.END int swipeFlags = 0; return makeMovementFlags(dragFlags, swipeFlags); }
Example 2
Source File: ItemDragHelperCallback.java From MicroReader with MIT License | 5 votes |
@Override public int getMovementFlags(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) { int dragFlags; RecyclerView.LayoutManager manager = recyclerView.getLayoutManager(); if (manager instanceof GridLayoutManager || manager instanceof StaggeredGridLayoutManager) { dragFlags = ItemTouchHelper.UP | ItemTouchHelper.DOWN | ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT; } else { dragFlags = ItemTouchHelper.UP | ItemTouchHelper.DOWN; } // 如果想支持滑动(删除)操作, swipeFlags = ItemTouchHelper.START | ItemTouchHelper.END int swipeFlags = 0; return makeMovementFlags(dragFlags, swipeFlags); }
Example 3
Source File: CustomNewsActivity.java From NewsMe with Apache License 2.0 | 5 votes |
private SimpleItemTouchHelperCallback simpleItemTouch(ItemTouchHelperAdapter adapter) { return new SimpleItemTouchHelperCallback(adapter) { @Override public int getMovementFlags(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) { final int dragFlags = ItemTouchHelper.UP | ItemTouchHelper.DOWN; final int swipeFlags = 0; return makeMovementFlags(dragFlags, swipeFlags); } }; }
Example 4
Source File: SimpleItemTouchHelperCallback.java From RecyclerViewUndoSwipe with Apache License 2.0 | 5 votes |
@Override public int getMovementFlags(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) { // Enable drag up and down and right swipe in right direction final int dragFlags = ItemTouchHelper.UP | ItemTouchHelper.DOWN; final int swipeFlags = ItemTouchHelper.END; // final int swipeFlags = ItemTouchHelper.END | ItemTouchHelper.START; Enable swipe in both direction return makeMovementFlags(dragFlags, swipeFlags); }
Example 5
Source File: SimpleItemTouchHelperCallback.java From privacy-friendly-weather with GNU General Public License v3.0 | 5 votes |
/** * @see android.support.v7.widget.helper.ItemTouchHelper.Callback#getMovementFlags(RecyclerView, RecyclerView.ViewHolder) * Sets the swipe flags for start and end. */ @Override public int getMovementFlags(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) { int dragFlags = ItemTouchHelper.UP | ItemTouchHelper.DOWN; int swipeFlags = ItemTouchHelper.START | ItemTouchHelper.END; return makeMovementFlags(dragFlags, swipeFlags); }
Example 6
Source File: SwipeToDismissItemCallback.java From SimpleRecyclerView with Apache License 2.0 | 5 votes |
@Override public int getMovementFlags(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) { if (simpleRecyclerView == null) { simpleRecyclerView = (SimpleRecyclerView) recyclerView; } // obtain current item swipeItemPosition = viewHolder.getAdapterPosition(); if (swipeItemPosition != NO_POSITION) { swipeItem = simpleRecyclerView.getCell(swipeItemPosition).getItem(); } // reset isItemSettled = false; isItemSwiped = false; int swipeFlags = 0; if (options.canSwipeLeft()) { swipeFlags = swipeFlags | ItemTouchHelper.START; } if (options.canSwipeRight()) { swipeFlags = swipeFlags | ItemTouchHelper.END; } if (options.canSwipeUp()) { swipeFlags = swipeFlags | ItemTouchHelper.UP; } if (options.canSwipeDown()) { swipeFlags = swipeFlags | ItemTouchHelper.DOWN; } return makeMovementFlags(0, swipeFlags); }
Example 7
Source File: SimpleItemTouchHelperCallback.java From PracticalRecyclerView with Apache License 2.0 | 5 votes |
@Override public int getMovementFlags(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) { if (!(recyclerView.getAdapter() instanceof AbstractAdapter)) { return 0; } mAdapter = (AbstractAdapter) recyclerView.getAdapter(); int currentPosition = viewHolder.getAdapterPosition(); if (!mAdapter.canDrag(currentPosition)) { return 0; } int dragFlags; int swipeFlags; RecyclerView.LayoutManager layoutManager = recyclerView.getLayoutManager(); if (layoutManager instanceof GridLayoutManager) { dragFlags = ItemTouchHelper.UP | ItemTouchHelper.DOWN | ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT; swipeFlags = 0; } else if (layoutManager instanceof LinearLayoutManager) { dragFlags = ItemTouchHelper.UP | ItemTouchHelper.DOWN; swipeFlags = ItemTouchHelper.START | ItemTouchHelper.END; } else { dragFlags = 0; swipeFlags = 0; } return makeMovementFlags(dragFlags, swipeFlags); }
Example 8
Source File: SelectRecycleAdapter.java From PowerRecyclerView with Apache License 2.0 | 5 votes |
@NonNull @Override public int[] getMovementFlags(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) { if (viewHolder.getAdapterPosition() % 2 == 0) { return new int[] { ItemTouchHelper.UP | ItemTouchHelper.DOWN | ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT, ItemTouchHelper.ACTION_STATE_IDLE }; } return super.getMovementFlags(recyclerView, viewHolder); }
Example 9
Source File: ItemDragCallback.java From ChannelManageDemo_Java with MIT License | 5 votes |
@Override public int getMovementFlags(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) { //固定位置及tab下面的channel不能拖动 if (viewHolder.getLayoutPosition() < mAdapter.getFixSize() + 1 || viewHolder.getLayoutPosition() > mAdapter.getSelectedSize()) { return 0; } int dragFlags = ItemTouchHelper.UP | ItemTouchHelper.DOWN | ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT; int swipeFlags = 0; return makeMovementFlags(dragFlags, swipeFlags); }
Example 10
Source File: SimpleItemTouchHelperCallback.java From Focus with GNU General Public License v3.0 | 5 votes |
@Override public int getMovementFlags(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) { // Enable drag up and down and right swipe in right direction final int dragFlags = ItemTouchHelper.UP | ItemTouchHelper.DOWN; final int swipeFlags = ItemTouchHelper.END; // final int swipeFlags = ItemTouchHelper.END | ItemTouchHelper.START; Enable swipe in both direction return makeMovementFlags(dragFlags, swipeFlags); }
Example 11
Source File: BindDragCallBack.java From LazyRecyclerAdapter with MIT License | 5 votes |
@Override public int getMovementFlags(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) { final int dragFlags; final int swipeFlags; if (recyclerView.getLayoutManager() instanceof GridLayoutManager || recyclerView.getLayoutManager() instanceof StaggeredGridLayoutManager) { dragFlags = ItemTouchHelper.UP | ItemTouchHelper.DOWN | ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT; swipeFlags = 0; } else { dragFlags = ItemTouchHelper.UP | ItemTouchHelper.DOWN; swipeFlags = mSwipeFlags; } return makeMovementFlags(dragFlags, swipeFlags); }
Example 12
Source File: SimpleItemTouchHelperCallback.java From PowerfulRecyclerView with Apache License 2.0 | 4 votes |
@Override public int getMovementFlags(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) { int dragFlags = ItemTouchHelper.UP | ItemTouchHelper.DOWN; int swipeFlags = ItemTouchHelper.START | ItemTouchHelper.END; return makeMovementFlags(dragFlags, swipeFlags); }
Example 13
Source File: SimpleItemTouchHelperCallback.java From PowerSwitch_Android with GNU General Public License v3.0 | 4 votes |
@Override public int getMovementFlags(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) { int dragFlags = ItemTouchHelper.UP | ItemTouchHelper.DOWN; int swipeFlags = ItemTouchHelper.START | ItemTouchHelper.END; return makeMovementFlags(dragFlags, swipeFlags); }
Example 14
Source File: MyItemTouchHelperCallback.java From FaceT with Mozilla Public License 2.0 | 4 votes |
@Override public int getMovementFlags(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) { int dragFlags = ItemTouchHelper.UP | ItemTouchHelper.DOWN; // movements drag return makeFlag( ItemTouchHelper.ACTION_STATE_DRAG , dragFlags); // as parameter, action drag and flags drag }
Example 15
Source File: MyItemTouchCallback.java From TimePicker with Apache License 2.0 | 4 votes |
@Override public int getMovementFlags(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) { int dragFlags = ItemTouchHelper.UP | ItemTouchHelper.DOWN; int swipeFlags = ItemTouchHelper.START | ItemTouchHelper.END; return makeMovementFlags(dragFlags, swipeFlags); }
Example 16
Source File: SimpleItemTouchHelperCallBack.java From Android-nRF-BLE-Joiner with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public int getMovementFlags(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) { int dragFlags = ItemTouchHelper.UP | ItemTouchHelper.DOWN; int swipeFlags = ItemTouchHelper.END; return makeMovementFlags(dragFlags, swipeFlags); }
Example 17
Source File: ChecklistDragCallback.java From Travel-Mate with MIT License | 4 votes |
@Override public int getMovementFlags(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) { int dragFlags = ItemTouchHelper.UP | ItemTouchHelper.DOWN; // swipeFlags 0 should disable swiping for all directions return makeMovementFlags(dragFlags, 0); }
Example 18
Source File: ItemTouchHelperCallback.java From SimpleNews with Apache License 2.0 | 4 votes |
@Override public int getMovementFlags(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) { final int dragFlags = ItemTouchHelper.UP | ItemTouchHelper.DOWN; final int swipeFlags = ItemTouchHelper.START | ItemTouchHelper.END; return makeMovementFlags(dragFlags, swipeFlags); }
Example 19
Source File: DownloadFileItemHelperCallback.java From Popeens-DSub with GNU General Public License v3.0 | 4 votes |
public DownloadFileItemHelperCallback(SubsonicFragment fragment, boolean mainList) { super(ItemTouchHelper.UP | ItemTouchHelper.DOWN, ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT); this.fragment = fragment; this.mainList = mainList; }
Example 20
Source File: NormalAdapter.java From PowerRecyclerView with Apache License 2.0 | 4 votes |
@NonNull @Override public int[] getMovementFlags(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) { return new int[]{ItemTouchHelper.UP | ItemTouchHelper.DOWN | ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT, ItemTouchHelper.ACTION_STATE_IDLE}; }