Set of plugable extenstions for Android RecyclerView

Overview

DynamicRecyclerView

Set of light and non-invasive extensions for Android RecyclerView widget. Does not use custom RecyclerView or LayoutManager. With this extensions you can create RecyclerView with following features:

Drag and drop reordering.

  • Implemented using RecyclerView.OnItemTouchListener
  • Support for custom "Drag frame" drawable
  • ~350 LOC
Usage:
    dragDropTouchListener = new DragDropTouchListener(recyclerView, this) {
        @Override
        protected void onItemSwitch(RecyclerView recyclerView, int from, int to) {
            adapter.swapPositions(from, to);
            adapter.notifyItemChanged(to);
            adapter.notifyItemChanged(from);
 
         @Override
         protected void onItemDrop(RecyclerView recyclerView, int position) {
        }
   };
   }
   
    recyclerView.addOnItemTouchListener(dragDropTouchListener);

Swipe to dismiss items

This is port of Roman Nurik's SwipeToDismiss for ListView

  • Implemented using RecyclerView.OnItemTouchListener
  • Configurable swipe directions: only left, only right, both, none
  • ~320 LOC
Usage:
 swipeToDismissTouchListener = new SwipeToDismissTouchListener(recyclerView, new SwipeToDismissTouchListener.DismissCallbacks() {
            @Override
           public SwipeToDismissTouchListener.SwipeDirection canDismiss(int position) {
               return SwipeToDismissTouchListener.SwipeDirection.RIGHT;
           }
            @Override
           public void onDismiss(RecyclerView view, List<SwipeToDismissTouchListener.PendingDismissData> dismissData) {
              for (SwipeToDismissTouchListener.PendingDismissData data : dismissData) {
                  adapter.removeItem(data.position);
                  adapter.notifyItemRemoved(data.position);
              }
           }
   });
  recyclerView.addOnItemTouchListener(swipeToDismissTouchListener);

Select/activate items

  • Small RecyclerViewAdapter extension that can keep a state of selected/activated items
Usage

Use as normal RecyclerView.Adapter

ItemTouchListenerAdapter

As RecyclerView does not have standard way to add click listeners to the items, this RecyclerView.OnItemTouchListener intercepts touch events and translates them to simple onItemClick() and onItemLongClick() callbacks.

Usage
    recyclerView.addOnItemTouchListener(new ItemTouchListenerAdapter(recyclerView, this));

Sample

Sample app code is included, please see DemoActivity.

For full featured demo of real app see /du:/ tasks app on Google Play Store

Comments
  • Drag & Drop in a GridLayoutManager

    Drag & Drop in a GridLayoutManager

    Thanks for the fantastic library.

    I'm trying to implement drag-and-drop with a GridLayoutManager.

    In my Activity.onCreate I have declared the grid:

    recyclerView.setLayoutManager(new GridLayoutManager(this, 2));
    

    And I do get a grid of 2 columns. However, when I go into drag-and-drop mode I can only move within the column, I cannot move left or right.

    I'm pretty sure I need to muck around in DragDropTouchListener.switchViewsIfNeeded but I'm not sure.

    Any suggestions on how to tackle this? Thanks!

    opened by ruckus 4
  • Horizontal LinearManager support

    Horizontal LinearManager support

    Hello and thanks for the great lib!

    I wanted to add a horizontal linear manager support, can you please help me by pointing out places in code where I can play and add horizontal support?

    Cheers!

    opened by meoyawn 2
  • How to add this library to my project?

    How to add this library to my project?

    I saw this project on github and it seems great for the types of functionalities I would like to get out of my RecyclerViews. I'm just starting out with github, so I do not know how to apply some of the features of this project to my application. I would be very appreciate if you could tell me the the way to apply it to my application!

    opened by danksky 1
  • Problem when adapter has 2 or more ViewType

    Problem when adapter has 2 or more ViewType

    Hi,

    nice library :-) but I tried to use it in a recycler view with two types of view (so 2 viewHolders) and when you swap two items which are not of the same type, the items swapped are becoming invisible until you make a new long press on them... I have quickly read your code, but I don't know yet from where the problem is coming.

    opened by euitam 1
  • Fix broken headings in Markdown files

    Fix broken headings in Markdown files

    GitHub changed the way Markdown headings are parsed, so this change fixes it.

    See bryant1410/readmesfix for more information.

    Tackles bryant1410/readmesfix#1

    opened by bryant1410 0
  • Implementing your API

    Implementing your API

    Hello, I'm very rookie when it comes to pulling off other projects' APIs and implementing some of their code into my own. I want to include features for my RecyclerView like bringing up a contextual action bar with ease upon long clicking a card, or swiping cards to archive them. I don't understand how I can implement your code to my own so that I can design a new function for, say, swiping, so that the swiped card does what { I } desire to do, but with the ease that your sample code shows. Please help or set me in the right direction?

    opened by danksky 0
Owner
Ilja S.
Ilja S.
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
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
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
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
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
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 8, 2023
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
[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 Jan 8, 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
[] 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
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 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
Android library for RecyclerView to manage order of items and multiple view types.

recyclerview-binder Android Library for RecyclerView to manage order of items and multiple view types. Features Insert any items to wherever you want

Satoru Fujiwara 185 Nov 15, 2022
A pull to zoom-in RecyclerView for android

PullZoomRecyclerView Using RecyclerView requires three steps: Step one: use the PullZoomRecyclerView in XML Step two: call the function setAdapter and

dinus_developer 433 Nov 10, 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
Epoxy is an Android library for building complex screens in a RecyclerView

Epoxy Epoxy is an Android library for building complex screens in a RecyclerView. Models are automatically generated from custom views or databinding

Airbnb 8.1k Dec 29, 2022