Giter VIP home page Giter VIP logo

android-rv-swipe-delete's Introduction

Android Slide Action

Android Slide Action Recycler View

Release

This library provides a simple way to add a draggable sliding up panel (popularized by Google Music and Google Maps) to your Android application.

Based On https://github.com/kitek/android-rv-swipe-delete

Lots of work has been put in making it seem smooth and close to iOS in feel.

Notes

  • Supports custom background color & icon
  • Supports swipe to delete & click to delete
  • Only 1 row active at a time
  • It is written using canvas, no extra views drawn. Uses pure Java code

Using in your project

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

  1. Add dependency to project
    dependencies {
	    compile 'com.github.softwarejoint:/android-rv-swipe-delete:1.1.1'
	}

  1. Bind to RecyclerView
        Drawable deleteIcon = ContextCompat.getDrawable(this, R.drawable.ic_delete_white_24);
        SwipeTouchHelper swipeTouchHelper = new SwipeTouchHelper(recyclerView, deleteIcon, this);
  1. Add CallBackListener
    @Override
    public void onSwipeActionClicked(final RecyclerView.ViewHolder viewHolder) {
        Log.d(TAG, "onSwipeActionClicked: " + viewHolder.getItemId());
        
        final int position = viewHolder.getAdapterPosition();
        final long itemId = viewHolder.getItemId();

        //Network Op...
        if (doNetworkOp()) {
            //actionCompleted
            adapter.removeAt(position);
            swipeTouchHelper.markActionComplete(itemId);
        } else {
            //actionCancelled
            swipeTouchHelper.undoAction(viewHolder)
        }
    }
    
  1. Set Custom Color
    swipeTouchHelper.setSwipeBackGroundColor(@ColorInt int resourceId) 
  1. Undo Action
    swipeTouchHelper.undoAction(viewHolder);

android-rv-swipe-delete's People

Contributors

dsp90 avatar kitek avatar pankajsoni19 avatar

Watchers

 avatar  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.