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!

comments powered by Disqus
Cf68cdaaf75f9cd1417267c6b1cafb3813c488a1 Virtual Reality Applications
Augmented reality apps are widely used – from geolocalization to using it in gaming industry. Augmented reality app is a new way to access data determined by environment conditions.
754d17aa02f8c56a0e0b671d45bf2455f6177062 Agile Methodology (Scrum)
Scrum is the very popular agile methodology for managing product development and project delivery. Scrum is the framework that could be applied for the development of product use cases, different projects or entire products.
1a1b621bfd24aba09a56bb25cf18719ad46ef190 News App Development
Smartphones are regularly used everywhere & anytime: in cars, on the way to the office, during the rest on holidays or weekends. That’s very convenient way for users to access important or just fun information with the help of news mobile app.
D63ac21dfd17c4acc93d52d9bdc72fea10e84edd Geolocation Services in Mobile Tracking Software
Geolocation services are used by many mobile apps, websites, mobile operators etc.