Home

Awesome

Android Arsenal BSD Jitpack Build Status

RecyclerViewSwipeDismiss

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

Preview

preview

How to use

repositories {
	maven {
	    url "https://jitpack.io"
	}
}

dependencies {
	 compile 'com.github.CodeFalling:RecyclerViewSwipeDismiss:v1.1.3'
}

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

Sample

You can see sample code in sample/MainActivity.java