Popularity
5.0
Growing
Activity
0.0
Stable
431
13
91

Code Quality Rank: L4
Programming language: Java
License: BSD 2-clause "Simplified" License
Latest version: v1.1.3

RecyclerViewSwipeDismiss alternatives and similar packages

Based on the "Recyclerview Widget" category.
Alternatively, view RecyclerViewSwipeDismiss alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of RecyclerViewSwipeDismiss or a related project?

Add another 'Recyclerview Widget' Package

README

Android Arsenal BSD Jitpack Build Status

RecyclerViewSwipeDismiss

A very easy-to-use and non-intrusive implement of Swipe to dismiss for RecyclerView.

Preview

[preview](RecyclerViewSwipeDismiss.gif)

How to use

  • Add these lines to your build.gradle
repositories {
    maven {
        url "https://jitpack.io"
    }
}

dependencies {
     compile 'com.github.CodeFalling:RecyclerViewSwipeDismiss:v1.1.3'
}
  • Build onTouchListener and bind it to your RecyclerView

SwipeDismissRecyclerViewTouchListener listener = new SwipeDismissRecyclerViewTouchListener.Builder(
        recyclerView,
        new SwipeDismissRecyclerViewTouchListener.DismissCallbacks() {
            @Override
            public boolean canDismiss(int position) {
                return true;
            }

            @Override
            public void onDismiss(View view) {
                // Do what you want when dismiss

            }
        })
        .setIsVertical(false)
        .setItemTouchCallback(
                new SwipeDismissRecyclerViewTouchListener.OnItemTouchCallBack() {
                    @Override
                    public void onTouch(int index) {
                        // Do what you want when item be touched
                    }
                })
        .setItemClickCallback(new SwipeDismissRecyclerViewTouchListener.OnItemClickCallBack() {
                    @Override
                    public void onClick(int position) {
                        // Do what you want when item be clicked                    }
                })
        .setBackgroundId(R.drawable.bg_item_normal, R.drawable.bg_item_selected)
        .create();
recyclerView.setOnTouchListener(listener);

More

  • setIsVertical(false) means allow swipe in horizontal direction

  • listener.setEnabled(false) can disable swipe to dismiss

  • onTouch will be called when MOUSE_UP on item without swipe

  • onClick will be called when ACTION_UP on item within 1 second and move no more than a fixed distance

  • By use setBackgroundId, you can set background id for item's normal and pressed state, just like the normal effect in RecyclerView

Sample

You can see sample code in sample/MainActivity.java


*Note that all licence references and agreements mentioned in the RecyclerViewSwipeDismiss README section above are relevant to that project's source code only.