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
Android Library to provide swipe, click and other functionality to RecyclerView

RecyclerViewEnhanced Android Library to provide swipe, click and other functionality to RecyclerView Usage Add this to your build.gradle file dependen

Nikhil Panju 1k Dec 29, 2022
Android Library to provide swipe, click and other functionality to RecyclerView

RecyclerViewEnhanced Android Library to provide swipe, click and other functionality to RecyclerView Usage Add this to your build.gradle file dependen

Nikhil Panju 1k Dec 29, 2022
Pagination-RecyclerView - Simple and easy way to Paginating a RecyclerView

Pagination-RecyclerView Simple and easy way to Paginating a RecyclerView Android

Rakshit Nawani 0 Jan 3, 2022
A RecyclerView that implements pullrefresh and loadingmore featrues.you can use it like a standard RecyclerView

XRecyclerView a RecyclerView that implements pullrefresh , loadingmore and header featrues.you can use it like a standard RecyclerView. you don't need

XRecyclerView 5.3k Dec 26, 2022
A RecyclerView that implements pullrefresh and loadingmore featrues.you can use it like a standard RecyclerView

XRecyclerView a RecyclerView that implements pullrefresh , loadingmore and header featrues.you can use it like a standard RecyclerView. you don't need

XRecyclerView 5.3k Dec 26, 2022
Just another one easy-to-use adapter for RecyclerView :rocket:

Elementary RecyclerView Adapter Another one easy-to-use adapter for RecyclerView ?? Features: DSL-like methods for building adapters similar to Jetpac

Roman Andrushchenko 29 Jan 6, 2023
TikTok-RecyclerView - This is a demo app built using 'Koin' a new dependency injection framework for Android along with RecyclerView and ExoPlayer2.

TikTok-RecyclerView Demo About This is a demo app built using 'Koin' a new dependency injection framework for Android along with RecyclerView and ExoP

Baljeet Singh 19 Dec 28, 2022
ANDROID. ChipsLayoutManager (SpanLayoutManager, FlowLayoutManager). A custom layout manager for RecyclerView which mimicric TextView span behaviour, flow layouts behaviour with support of amazing recyclerView features

ChipsLayoutManager This is ChipsLayoutManager - custom Recycler View's LayoutManager which moves item to the next line when no space left on the curre

Oleg Beloy 3.2k Dec 25, 2022
Carousel Recyclerview let's you create carousel layout with the power of recyclerview by creating custom layout manager.

Carousel Recyclerview let's you create carousel layout with the power of recyclerview by creating custom layout manager.

Jack and phantom 504 Dec 25, 2022
RecyclerView : SleepQualityTracker with RecyclerView app

RecyclerView - SleepQualityTracker with RecyclerView app SleepQualityTracker with RecyclerView This app builds on the SleepQualityTracker developed pr

Kevin 2 May 14, 2022
[] Super fast and easy way to create header for Android RecyclerView

DEPRECATED I created this library back in the day when I thought RecyclerView was all new and difficult. Writing an adapter that could inflate multipl

Bartek Lipinski 1.3k Dec 28, 2022
Easy RecyclerView Adapter

GenericAdapter Easy RecyclerView Adapter Getting started build.gradle allprojects { repositories { // ... maven { url 'https://jit

JaredDoge 4 Dec 3, 2021
Elegant design and convenient to use RecyclerView adapter library based on Kotlin DSL.

xAdapter: Kotlin DSL 风格的 Adapter 封装 1、简介 该项目是 KotlinDSL 风格的 Adapter 框架封装,用来简化 Adapter 调用,思想是采用工厂和构建者方式获取 Adapter 避免代码中定义大量的 Adapter 类。该项目在 BRVAH 的 Ada

ShouHeng 17 Oct 9, 2022
Add RecyclerView, use Adapter class and ViewHolder to display data.

فكرة المشروع في هذا المشروع سنقوم بعرض قائمة من البيانات للطلاب على واجهة تطبيق Android بإستخدام: مفهوم RecyclerView مفهوم Adapter مفهوم ViewModel محت

Shaima Alghamdi 3 Nov 18, 2021
A customizable and easy-to-use Timeline View library for Android

TimelineView A customizable and easy-to-use Timeline View library for Android Can be used as a standalone view or as a RecyclerView decorator Setup 1.

Riccardo Lattarulo 189 Dec 10, 2022
A RecyclerView(advanced and flexible version of ListView in Android) with refreshing,loading more,animation and many other features.

UltimateRecyclerView Master branch: Dev branch: Project website:https://github.com/cymcsg/UltimateRecyclerView Description UltimateRecyclerView is a R

MarshalChen 7.2k Jan 2, 2023
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
A Common RecyclerView.Adapter implementation which supports all kind of items and has useful data operating APIs such as remove,add,etc.

##PowerfulRecyclerViewAdapter A Common RecyclerView.Adapter implementation which supports any kind of items and has useful data operating APIs such as

null 313 Nov 12, 2022