Android Sectioned Adapter


Source link: https://github.com/CardinalNow/android-sectioned-adapter

Android Sectioned Adapter

Android Section Adapter allows you to easily create a RecyclerView.Adapter which will automatically sort your data into sections and add a header above each section.

You can use it with the provided header view:

Or you can use it with a custom header view that you specify:

Usage

Get it with Gradle

Add the dependency to your build.gradle file.

compile 'com.cardinalsolutions:android-sectioned-adapter:1.0.0' 

Implement Categorizable

Your data object needs to implement Categorizable.getCategory() to return the name of its category. For each category name that appears in the data, SectionedAdapter will automatically create and insert a header view for that category and place all the item views beneath it. For example, the Dog class will be sectioned according to the breed of the dog.

class Dog implements Categorizable {

  String name;
  String breed;

public String getCategory()
  {

return breed;
  
}
 
}
 

The Person example is sectioned according to the first letter of his/her last name.

class Person implements Categorizable {

  String firstName;
  String lastName;

public String getCategory()
  {

return lastName.substring(0, 1);

  
}
 
}
 

Subclass SectionedAdapter

Sectioned Adapter takes care of generating and inserting the header views, so all your subclass needs to do is implement onCreateItemViewHolder() to create a ViewHolder for your items and onBindItemViewHolder() to bind the data, exactly like you would do when creating a normal RecyclerView.Adapter. SectionedAdapter takes type parameter, the type of your model object you want to adapt. Finally, you must call setListItems() with your list of Categorizable data in order to generate the headers and show your data.

Use a Custom Header View

Sectioned Adapter will automatically generate a header view for your data using a built-in layout as seen in the Yankees example above. You can also specify an XML layout that you want to inflate for each header. The view must contain a Text View with the ID @android:id/title.

Resources

Heimdall is an OAuth 2.0 client specifically designed for easy usage and high flexibility. It supports all grants as described in Section 4 as well as refreshing an access token as described in Section 6 of the The OAuth 2.0 Authorization Framework specification.

AEB - Android Easy Binding. Android View properties binding to the Business Objects (known as POJO).

Vitamin Saber provides resource injection for Android (@InjectResource(resId)). It is annotation processor based and will provide all the speed you need on Android by avoiding reflection.

A library to pick multiple images.

A library to easily show open source (Github) project contributors.

A library to create StepsView for Android.

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