RecyclerViewElementary


Source link: https://github.com/Android-s14/RecyclerViewElementary

RecyclerViewElementary

The idea of the project is to make construction of simple RecyclerViews as easy as writing one line of code and supplying a data structure. Why spend time implementing multiple classes if you only need a simple RecyclerView? Currently RecyclerViews containing TextViews and ImageViews are supported with default or custom row layouts.

You are very welcome to offer improvements and feature requests.

How to use

  1. Add the library to your project dependencies.

    dependencies {
    
      compile fileTree(dir: 'libs', include: ['*.jar'])
      compile 'com.github.android-s14:rve:1.1.4' 
    }
     
  2. Implement DataModel interface to describe your data structure.

  3. Build your RecyclerView:

    List<DataModel> data = getData();
     //your data RecyclerView view = new RecyclerViewBuilder(this).setData(data).build();
    
  4. Add RecyclerView to your layout.

You can find an example of usage in the sample module.

Supported customizations

  • setLayoutManager(LayoutManager) - provide your layout manager, LinearLayoutManager with vertical orientation is used by default
  • setRowLayout(@LayoutRes int) - provide your custom row layout, default behaviour is stacking all your Drawable and String fields from the data structure in a horizontal linear view inside a card view
  • setListener(View.OnClickListener) - provide your onClickListener for RecyclerView members
  • setCardMargins(int, int, int, int) - set margins for both default and custom row layouts (default = 5dp)
  • setCardPadding(int, int, int, int) - set padding for the default row layout only (for custom set up in XML) (default = 10dp)
  • setCardCornerRadii(float) - set corner radii for the default row layout (for custom CardViews set up in XML) (default = 10dp)
  • setItemAnimator(RecyclerView.ItemAnimator) - add custom animation for the list items

Supplying your RecyclerView

Now you can also provide your own RecyclerView: either made programmatically or defined in XML:

RecyclerView recyclerView = (RecyclerView) layout.findViewById(R.id.recycler_view);
 new RecyclerViewBuilder(this).using(recyclerView).setData(imageData).build();
View layout = getLayoutInflater().inflate(R.layout.activity_main_recycler, null);
 new RecyclerViewBuilder(this).using(R.id.recycler_view, layout).setData(imageData).build();

You are not required to catch the returned RecyclerView - it is the same instance as supplied.

Coming soon

  • basic construction of purely textual RecyclerViews
  • setting a custom LayoutManager
  • setting an onClickListener
  • setting a custom layout from layout resources (implemented for textual RecyclerViews)
  • support for images in data structures
  • other customizations (some are already implemented: margins, padding, corner radii, etc.)
  • your requested features

Screenshots

This is what you get just by providing a simple data structure class containing two text fields and one drawable field and using the most basic construction process new RecyclerViewBuilder(this).setData(imageData).build.

<img src="/screenshots/image_recycler.png" width="250")/>

This is a simplistic textual RecyclerView constructed with mere new RecyclerViewBuilder(this).setData(data).setLayoutManager(new GridLayoutManager(this,2)).setRowLayout(R.layout.text_row_layout.build().

<img src="/screenshots/text_recycler.png" width="250")/>

Resources

Make your native android toast look beautiful.

ViewFrom is an android library that allows you to easily find and animate child views from one or multiple ViewGroups using their tag, type, visibility and much more.

Simple dateHelper, that can help you to make your life easy. Just give date to dateHelper and get in different format

DrawingView is a simple view that lets you draw on screen using your fingers and lets you save the drawings as images.

Expressive conditions in Java.

A photopicker to select and click photos and document picker to select different types of documents.

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