Swiperoo


Source link: https://github.com/BelkaLab/Swiperoo

Swiperoo Adapter

An extandable adapter which provides swipe to delete on your row item.

Live demo

Inspired by: https://github.com/nemanja-kovacevic/recycler-view-swipe-to-delete

Installation

Gradle

Add Gradle dependency:

dependencies {

  compile 'us.belka:swiperoo-library:1.0.0' 
}

Maven

<dependency>
<groupId>us.belka</groupId>
<artifactId>swiperoo-library</artifactId>
<version>1.0.0</version>
<type>pom</type> </dependency>

Usage

In the app folder you will find a working example of the library

You need to do 3 things to make the library works:

1. Create your ViewHolder

 public class MyViewHolder extends SwiperooViewHolder<String> {

 static class Factory implements SwiperooViewHolder.Factory {

  @Override

 public SwiperooViewHolder createViewHolder(Context context, ViewGroup parent, int viewType) {

  return new MyViewHolder(from(context).inflate(YOUR_ITEM_LAYOUT, parent, false), context);

 
}

}

 public MyViewHolder(View itemView, Context context) {

 super(itemView, context);

}

 @Override

public void bindViewHolder(String data) {

 
}

  
}

Pay attention to the Factory class, you need to return an instance of your ViewHolder (Factory pattern)

2. Create your Adapter

 public class MyAdapter extends SwiperooAdapter<String> {

 public MyAdapter(Context context, List<String> items, Listener listener, SwiperooViewHolder.Factory factory) {

 super(context, items, listener, factory);

}

  
}

3. Put it all togheter

 mSwiperooRecyclerView.setLayoutManager(new LinearLayoutManager(this));

  MyAdapter adapter = new MyAdapter(this, items, this, new MyViewHolder.Factory());

mSwiperooRecyclerView.setAdapter(adapter);

adapter.addSupportToSwipeToDelete(this, mSwiperooRecyclerView);

You can use "this" as third parameter in the Adapter or you can directly pass in an implementation of the Listener, both ways you will implement the interface to handle item delete

Listeners

@Override
  public void onItemDeleted(String item) {

  ///Do your stuff with the deleted item
  
}

Pay attention

Your item layout container must be a Relative Layout, otherwise the Holder will throw you a NotSupportedException

License

Swiperoo is Copyright (c) 2017 Belka, srl. It is free software, and may be redistributed under the terms specified in the LICENSE file.

About Belka

Belka is a Digital Agency specialized in design, mobile applications development and custom solutions. We love open source software! You can see our projects or look at our case studies.

Interested? Hire us to help build your next amazing project.

www.belka.us

Resources

Quick and convenient way to shorten urls using goo.gl service with Rx and Kotlin.

A cool ViewPager.

A swipe layout similar to iOS Mail app.

This library allows you to send simple data from WebView to Java. Sends the data via url.

Arc Layout is a view group with which you can add a arc-shaped container in your layout. Two main variables are the direction and the curvature of the arc.

Custom implementation of NavigationView for using custom layout for navigation items and header.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes