RvTools


Source link: https://github.com/olmur/rvtools

RvTools

Add lib to your project

compile ('com.olmur.rvtools:rvtools:0.0.5') {

exclude group: 'com.android.support' 
}

Extend RvtRecyclerAdapter class

public class MyAdapter extends RvtListAdapter<MyEntity, MyViewHolder> {

... 
}

Create ViewHolder that extends RvtViewHolder

public class MyViewHolder extends RvtRecyclerAdapter.RvtViewHolder<MyEntity> {

 private TextView titleTv;

 ViewHolder(@NonNull View view) {

 super(view);

 titleTv = (TextView) view.findViewById(R.id.title_tv);

}

 @Override

public void bindViewHolder(MyEntity element) {

 titleTv.setText(element.getTitle());

}
 
}

Create Gestures Listeners

public class MainActivity extends AppCompatActivity implements OnSwipeLeftAction, OnSwipeRightAction, OnOrderChangedListener {

@Override
  public void onSwipeLeftAction(int position) {

adapter.deletItem(position);

  
}

 @Override
  public void onSwipeRightAction(int position) {

adapter.changeItem(position);

  
}

 @Override
  public void onOrderChanged() {

Snackbar.make(root, "Order has been changed", Snackbar.LENGTH_SHORT).show();

  
}
 
}

Create Swipe Context Menu Drawer:

You can use RvtSwipeContextMenu

RvtSwipeContextMenu rvtSwipeContextMenu = new RvtSwipeContextMenu.Builder(context)

 .withIconsRes(R.drawable.ic_edit, R.drawable.ic_delete)

 .withIconsSizeDp(32)

 .withIconsMarginFromListEdgesDp(16)

 .withIconsColorInt(Color.WHITE)

 .withBackgroundsColorsInt(Color.MAGENTA, Color.RED)

 .build();

Or create your own swipe context menu by implementing SwipeContextMenuDrawer interface

To add different behaviour on item select/release override these methods in your ViewHolder

 public class MyViewHolder extends RvtViewHolder<MyEntity> {

 ...

 @Override

public void onSelected() {

 super.onSelected();

 itemView.setBackgroundColor(Color.GRAY);

 titleTv.setTextColor(Color.WHITE);

}

 @Override

public void onReleased() {

 super.onReleased();

 itemView.setBackgroundColor(Color.WHITE);

 titleTv.setTextColor(Color.GRAY);

}

// Provide selected vh height for elevation increase/decrease when vh is being selected/released.

// Works only API 21 and above only.

@Override

public int selectedVhHeightDp() {

 return RvtUtils.Resources.dpToPixels(itemView.getContext(), 8);

}
  
}

Create RvtRecyclerView and provide it with empty view

RvtRecyclerView recyclerView = (RvtRecyclerView) findViewById(R.id.rvt_recycler_view);
 recyclerView.setEmptyView(emptyView);

Create RvTools for your RecyclerView

  RvTools rvtools = new RvTools

  .Builder(recyclerView)

  .withSwipeRightAction(this)

  .withSwipeLeftAction(this)

  .withMoveAction(this, RvTools.DOWN, RvTools.UP)

  .withSwipeContextMenuDrawer(rvtSwipeContextMenu)

  .build();

Than you can bind and unbind rvtools from your recycler view

rvtools.bind(recyclerView);

  rvtools.unbind();

Check out for more examples in sample app.

Resources

An open source project to provide push notification support for Android - a XMPP based notification server and a client tool kit.

android-checkout is a library for Android In-App Billing (v3). The main goal is to reduce work which should be done by developers who want to integrate in-app purchases in their products. The project is inspired by Volley library and is designed to be easy to use, fast and flexible.

Mobile App testing on 300+ real devices!

  • Save in App Development Costs
  • Reduce Risks with Proactive, Agile Testing
  • Speed Up Time to Market
  • Reduce Operational & Unpredictable Costs
  • Improve App Ratings & Brand Reputation

AndroidAsync is a low level network protocol library.

Features:

  • Based on NIO. One thread, driven by callbacks. Highly efficient.
  • All operations return a Future that can be cancelled
  • Socket client + socket server
  • HTTP client + server
  • WebSocket client + server
  • Socket.IO client

This library is an Android networking abstraction library consisting of a combination of Volley, OkHttp, and Jackson, with a little glue to stick it all together. It's a great place to start if you need to execute requests, especially thos which return JSON.

RoboCoP is a Java library that can generate a fully-functional ContentProvider from a simple JSON schema file.

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