Home   →   Blog   →   Free Library for Deleting Items

    Free Library for Deleting Items

    We continue to develop useful plugins, libraries, and templates. This time, we are pleased to introduce you our new and free SwipeToDelete library. We hope you'll find a way to use it during your development process.

    What is SwipeToDelete?

    SwipeToDelete is an easy-to-use library that will help a user to delete any item by swiping it. The deleting function is quite popular, so we offer a simple and beautiful solution. Instead of the traditional "delete" button, you can provide users with a much more expressive way to accomplish this task.

    How to use?

    Our library can be used almost anywhere. For example, if a user wants to swipe an item off the screen. On the other hand, SwipeToDelete will come in handy for implementing all sorts of to-do lists: a user gets a possibility to swipe (that is, delete!) already completed tasks. Easy, remarkable, and illustrative!

    Thus, feel free to take full advantage of SwipeToDelete to implement any deletion function.


    We offer three options for SwipeToDelete customization:

    • the bottom container. A user can accept or abandon the bottom container with the warning information about the fact of deleting the certain item;
    • the "undo" function which allows canceling the deleting action being done;
    • delay. The process of deleting an item can be performed with a specified time delay.


    • Implement ISwipeToDeleteAdapter in your own adapter or another class.
    • Make example of SwipeToDeleteDelegate in your own adapter
    SwipeToDeleteDelegate(context = context, items = mutableList, swipeToDeleteDelegate = this)
    Call corresponding methods in your overridden methods
    override fun onBindViewHolder(holder: Holder, position: Int) {
           swipeToDeleteDelegate.onBindViewHolder(holder, mutableList[position].name, position)
    override fun removeItem(key: String) {
    • Implement ISwipeToDeleteHolder in your holder. You should have a container with your regular item layout and if needed with a bottom container too.
    • In your holder, you need to have var pendingDelete as false by default and you need to override val topContainer
    override val topContainer: View
               get() =
               if (pendingDelete) undoContainer
               else itemContainer
    override var pendingDelete: Boolean = false
    • Also, you need to make default key in holder by yourself
    override var key: Int = -1
    • If you need bottom container appearance while waiting, simply override onBindPendingItem(holder: Holder, key: Int, item: User) method:
    override fun onBindPendingItem(holder: Holder, key: Int, item: User) {
    • You can also implement IAnimationUpdateListener and IAnimatorListener to override methods for achieving the animation along the axis x with duration which is equal to deleting duration
    UserAdapter(...) : ... , IAnimationUpdateListener {
     fun onAnimationUpdated(animation: android.animation.ValueAnimator?, options: ModelOptions<*>) {}
     fun onAnimationEnd(animation: Animator?, options: ModelOptions<*>) {}
     fun onAnimationCancel(animation: Animator?, options: ModelOptions<*>) {}
     fun onAnimationStart(animation: Animator?, options: ModelOptions<*>) {}
     fun onAnimationRepeat(animation: Animator, options: ModelOptions<*>) {}

    If you want to know more about SwipeToDelete Library, visit this page!

    Next Posts
    Rails Application Template for Creating...
    Rails Application Template. A basic template for creating...
    jQuery GTM In-Viewport Manager Plugin
    We’d like to share with you our new jQuery GTM...
    Timetracker Plugin. Keep Track of Time!
    ​The time counter can be a very helpful feature when...