Java Code Examples for android.support.v7.widget.helper.ItemTouchHelper#END
The following examples show how to use
android.support.v7.widget.helper.ItemTouchHelper#END .
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: ItemActivity.java From Fairy with Apache License 2.0 | 6 votes |
private void initView() { RecyclerView recycleView = findViewById(R.id.recycle_main); adapter = new MyAdapter(this); itemTouchCallback = new MyItemTouchCallback(this, adapter, ItemTouchHelper.UP | ItemTouchHelper.DOWN, ItemTouchHelper.LEFT | ItemTouchHelper.END); ItemTouchHelper itemTouchHelper = new ItemTouchHelper(itemTouchCallback); recycleView.setLayoutManager(new LinearLayoutManager(this)); recycleView.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL)); recycleView.setAdapter(adapter); adapter.addAll(new ArrayList<>()); itemTouchHelper.attachToRecyclerView(recycleView); adapter.setOnClickListener(position -> { viewModel.setTempPosition(position); Intent intent = new Intent(ItemActivity.this, LogcatActivity.class); LogcatItem item = adapter.get(position); intent.putExtra(LogcatActivity.LOGCAT_ITEM, item); startActivityForResult(intent, ITEM_REQUEST_CODE); }); }
Example 2
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 3
Source File: TodayAdapter.java From OmniList with GNU Affero General Public License v3.0 | 5 votes |
@Override public void onItemRemoved(int position, int direction) { Assignment mJustDeletedToDoItem = getData().remove(position).assignment; notifyItemRemoved(position); if (onItemRemovedListener != null) { if (direction == ItemTouchHelper.END) { onItemRemovedListener.onItemRemovedRight(mJustDeletedToDoItem, position); } else if (direction == ItemTouchHelper.START) { onItemRemovedListener.onItemRemovedLeft(mJustDeletedToDoItem, position); } } }
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: CustomItemTouchHelper.java From OmniList with GNU Affero General Public License v3.0 | 5 votes |
@Override public int getMovementFlags(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) { if (viewHolder.getItemViewType() == IItemTouchHelperAdapter.ViewType.HEADER.id || viewHolder.getItemViewType() == IItemTouchHelperAdapter.ViewType.FOOTER.id){ return makeMovementFlags(0,0); } int upFlags = ItemTouchHelper.UP | ItemTouchHelper.DOWN; int swipeFlags = ItemTouchHelper.START | ItemTouchHelper.END; return makeMovementFlags(upFlags, 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 LazyRecyclerAdapter with MIT License | 5 votes |
@Override public int getMovementFlags(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) { // Enable drag and swipe in both directions final int dragFlags = ItemTouchHelper.UP | ItemTouchHelper.DOWN; final int swipeFlags = ItemTouchHelper.START | ItemTouchHelper.END; return makeMovementFlags(dragFlags, swipeFlags); }
Example 8
Source File: ListDragMenuActivity.java From LRecyclerView with Apache License 2.0 | 5 votes |
@Override public int getMovementFlags(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) { int dragFlags = 0, swipeFlags = 0; if (recyclerView.getLayoutManager() instanceof StaggeredGridLayoutManager) { dragFlags = ItemTouchHelper.UP | ItemTouchHelper.DOWN | ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT; } else if (recyclerView.getLayoutManager() instanceof LinearLayoutManager) { dragFlags = ItemTouchHelper.UP | ItemTouchHelper.DOWN; //设置侧滑方向为从左到右和从右到左都可以 swipeFlags = ItemTouchHelper.START | ItemTouchHelper.END; } return makeMovementFlags(dragFlags, swipeFlags); }
Example 9
Source File: UpdatesItemTouchCallback.java From fdroidclient with GNU General Public License v3.0 | 5 votes |
@Override public int getMovementFlags(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) { int swipeFlags = 0; if (viewHolder instanceof AppListItemController) { AppListItemController controller = (AppListItemController) viewHolder; if (controller.canDismiss()) { swipeFlags = ItemTouchHelper.START | ItemTouchHelper.END; } } return makeMovementFlags(0, swipeFlags); }
Example 10
Source File: ItemDragHelperCallback.java From NetEasyNews with GNU General Public License v3.0 | 5 votes |
@Override public int getMovementFlags(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) { int dragFlags; RecyclerView.LayoutManager layoutManager = recyclerView.getLayoutManager(); if (layoutManager instanceof GridLayoutManager || layoutManager instanceof StaggeredGridLayoutManager) { dragFlags = ItemTouchHelper.UP | ItemTouchHelper.DOWN | ItemTouchHelper.START | ItemTouchHelper.END; } else { dragFlags = ItemTouchHelper.UP | ItemTouchHelper.DOWN; } int swipeFlags = 0; return makeMovementFlags(dragFlags, swipeFlags); }
Example 11
Source File: ItemTouchHelperCallback.java From voice-pitch-analyzer with GNU Affero General Public License v3.0 | 5 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 12
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 13
Source File: ItemTouchHelperCallback.java From vk_music_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: SimpleItemTouchHelperCallback.java From Stock-Hawk with Apache License 2.0 | 4 votes |
@Override public int getMovementFlags(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) { final int dragFlags = 0; final int swipeFlags = ItemTouchHelper.START | ItemTouchHelper.END; return makeMovementFlags(dragFlags, swipeFlags); }
Example 15
Source File: TabListTouchHelperCallback.java From photosearcher 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 16
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 17
Source File: HandleAdapterActivity.java From FancyAdapters with MIT License | 4 votes |
public CustomAdapter(List<String> items, RecyclerView recyclerView) { super(items, recyclerView, ItemTouchHelper.UP | ItemTouchHelper.DOWN, ItemTouchHelper.START | ItemTouchHelper.END); }
Example 18
Source File: SimpleItemTouchHelperCallback.java From ankihelper with GNU General Public License v3.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: RecyclerViewTouchHelperBase.java From Ouroboros 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 20
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); }