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

Overview

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

  • 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

Comments
  • Gradle not working

    Gradle not working

    opened by SyedWasiHaider 2
  • add item background press change effect, just like RecyclerView

    add item background press change effect, just like RecyclerView

    Hi, I'm coming again, thanks for your prework in this library firstly, it help me a lot in my project, after finish my work, I found I have extended a item background press change feature, I think it can make the RecyclerView which use your library act more native.

    opened by RickAi 1
  • add item click callback

    add item click callback

    The origin project only allow developer set onTouch callback which is not suitable for my requirement, therefore I add a onClick callback which give more choices for developers to use.

    opened by RickAi 1
  • Add Travis CI support

    Add Travis CI support

    * What went wrong:
    A problem occurred configuring project ':app'.
    > A problem occurred configuring project ':library'.
       > Could not resolve all dependencies for configuration ':library:_debugCompile'.
          > Could not find com.android.support:appcompat-v7:22.1.1.
            Searched in the following locations:
                https://jcenter.bintray.com/com/android/support/appcompat-v7/22.1.1/appcompat-v7-22.1.1.pom
                https://jcenter.bintray.com/com/android/support/appcompat-v7/22.1.1/appcompat-v7-22.1.1.jar
                file:/usr/local/android-sdk/extras/android/m2repository/com/android/support/appcompat-v7/22.1.1/appcompat-v7-22.1.1.pom
                file:/usr/local/android-sdk/extras/android/m2repository/com/android/support/appcompat-v7/22.1.1/appcompat-v7-22.1.1.jar
                file:/usr/local/android-sdk/extras/google/m2repository/com/android/support/appcompat-v7/22.1.1/appcompat-v7-22.1.1.pom
                file:/usr/local/android-sdk/extras/google/m2repository/com/android/support/appcompat-v7/22.1.1/appcompat-v7-22.1.1.jar
            Required by:
                RecyclerViewSwipeDismiss:library:unspecified
    
    help wanted 
    opened by xcodebuild 1
  • OnTouchListener and OnClickListener crash

    OnTouchListener and OnClickListener crash

    Hello, OnTouchListener and OnClickListener will cause crash, because SwipeDismissRecyclerViewTouchListener forgot to check If user not use OnTouchListener and OnClickListener.

    opened by a1573595 0
  • Problem with Child View inconsistency

    Problem with Child View inconsistency

    Problem with Child View inconsistency, Im actually using concurrent hashmap and copyonwrite arraylist for my recyclerview adapter.

    When I remove fast, Some changes are inconsistent some child views remain, but isnt touchable.

    opened by DavidMont 0
Releases(v1.1.3)
Owner
xcodebuild
[object Object]
xcodebuild
Kotlin way of building RecyclerView Adapter 🧩. You do not have to write RecyclerView Adapters again and again and suffer from handling of different view types. Kiel will help you.

Kiel Kiel is a RecyclerView.Adapter with a minimalistic and convenient Kotlin DSL which provides utility on top of Android's normal RecyclerView.Adapt

ibrahim yilmaz 370 Jan 2, 2023
[] A swipe menu for ListView.

SwipeMenuListView A swipe menu for ListView. Demo Usage Add dependency dependencies { compile 'com.baoyz.swipemenulistview:library:1.3.0' } Step 1

ζ˜ŸδΈ€ 3.5k Dec 16, 2022
RecyclerView extension library which provides advanced features. (ex. Google's Inbox app like swiping, Play Music app like drag and drop sorting)

Advanced RecyclerView This RecyclerView extension library provides Google's Inbox app like swiping, Play Music app like drag-and-drop sorting and expa

Haruki Hasegawa 5.2k Dec 23, 2022
Pumped up RecyclerView

##Description This is an attempt to make RecyclerView easier to use. Features built in: ProgressBar while adapter hasn't been set EmptyView if adapter

Anton Malinskiy 2.6k Jan 5, 2023
. Android library that integrate sticky section headers in your RecyclerView

recyclerview-stickyheaders Recyclerview-stickyheaders is an Android library that makes it easy to integrate section headers in your RecyclerView. Thes

null 968 Nov 10, 2022
An adapter which could be used to achieve a parallax effect on RecyclerView.

android-parallax-recycleview Integration Step 1. Add the JitPack repository to your build file repositories { maven { url "https://jitpack

Pedro Oliveira 1.6k Nov 17, 2022
An Android Animation library which easily add itemanimator to RecyclerView items.

RecyclerView Animators RecyclerView Animators is an Android library that allows developers to easily create RecyclerView with animations. Please feel

Daichi Furiya 11.2k Jan 5, 2023
Android library providing simple way to control divider items (ItemDecoration) of RecyclerView

RecyclerView-FlexibleDivider Android library providing simple way to control divider items of RecyclerView Release Note [Release Note] (https://github

Yoshihito Ikeda 2.4k Dec 18, 2022
A Fast Scroller for the RecyclerView world!

RecyclerViewFastScroller The RecyclerViewFastScroller is a widget that can be added to a layout and connected to a RecyclerView for fast scrolling. Th

Daniel Smith 1.1k Dec 19, 2022
Android library defining adapter classes of RecyclerView to manage multiple view types

RecyclerView-MultipleViewTypeAdapter RecyclerView adapter classes for managing multiple view types Release Note [Release Note] (https://github.com/yqr

Yoshihito Ikeda 414 Nov 21, 2022
ItemDecoration for RecyclerView using LinearLayoutManager for Android

RecyclerItemDecoration RecyclerItemDecoration allows you to draw divider between items in recyclerview with multiple ViewType without considering item

magiepooh 328 Dec 27, 2022
[UNMAINTAINED] Sticky Headers decorator for Android's RecyclerView

This project is no longer being maintained sticky-headers-recyclerview This decorator allows you to easily create section headers for RecyclerViews us

timehop 3.7k Dec 31, 2022
πŸ‘‡ Easy Google Photos style multi-selection for RecyclerViews, powered by Kotlin and AndroidX.

Drag Select Recycler View This library allows you to implement Google Photos style multi-selection in your apps! You start by long pressing an item in

Aidan Follestad 1.9k Dec 7, 2022
Android library to achieve in an easy way, the behaviour of the home page in the Expedia app, with a pair of auto-scroll circular parallax ListViews.

ListBuddies This library is not maintained anymore and there will be no further releases Android library of a pair of auto-scroll circular parallax Li

JPARDOGO 970 Dec 29, 2022
Dividers is a simple Android library to create easy separators for your RecyclerViews

Dividers Dividers is an Android library to easily create separators for your RecyclerViews. It supports a wide range of dividers from simple ones, tha

Karumi 490 Dec 28, 2022
A modified version of Android's experimental StaggeredGridView. Includes own OnItemClickListener and OnItemLongClickListener, selector, and fixed position restore.

StaggeredGridView Introduction This is a modified version of Android's experimental StaggeredGridView. The StaggeredGridView allows the user to create

Maurycy Wojtowicz 1.7k Nov 28, 2022
Android library to display a ListView whose cells are not rigid but flabby and react to ListView scroll.

FlabbyListView This library is not maintained anymore and there will be no further releases Android library to display a ListView which cells are not

JPARDOGO 762 Nov 23, 2022
An Android custom ListView and ScrollView with pull to zoom-in.

PullZoomView An Android custom ListView and ScrollView with pull to zoom-in. Features Set ZoomView enable Add HeaderView Custom ZoomView Parallax or N

Frank-Zhu 2.3k Dec 26, 2022
Android ListView that mimics a GridView with asymmetric items. Supports items with row span and column span

AsymmetricGridView An Android custom ListView that implements multiple columns and variable sized elements. Please note that this is currently in a pr

Felipe Lima 1.8k Jan 7, 2023