Git Product home page Git Product logo

dynamicrecyclerview's Introduction

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

dynamicrecyclerview's People

Contributors

ismoli avatar tbarthel-fr avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.