realm-recyclerview


Source link: https://github.com/thorbenprimke/realm-recyclerview

A RecyclerView that is powered by Realm

Latest 0.9.25 is built with Realm 2.2.1.

A powerful Recyclerview wrapper for working with Realm as your datastore. It supports the following features out of the box:

  • Custom adapter that automatically refreshes the list when the realm changes and animates the new items in.
  • Empty state
  • Pull-to-refresh (backed by SwipeRefreshLayout)
  • Infinite scrolling (callback for more data fetching)
  • Section headers (backed by SuperSLiM)

##How To Include It:


 allprojects {

repositories {

 // ...

 maven {
 url "https://jitpack.io" 
}

}

  
}
 
 dependencies {

 compile 'com.github.thorbenprimke:realm-recyclerview:0.9.25'  
}
 

##Demo

How To Get Started:

The RealmRecyclerView has a few attributes that can be set in XML in order to customize it's look and feel and most importanlty which layoutType is used. In addition, it relies on an extended RecyclerView.Adapter called RealmBasedRecyclerViewAdapter to provide support for animation and headers.

##RealmRecyclerView

The snippet below shows how to include the RealmRecyclerView in your layout file.


 <co.moonmonkeylabs.realmrecyclerview.RealmRecyclerView

android:id="@+id/realm_recycler_view"

android:layout_width="match_parent"

android:layout_height="match_parent"

app:rrvIsRefreshable="true"

app:rrvEmptyLayoutId="@layout/empty_view"

app:rrvLayoutType="LinearLayout"

/> 

Important to note here is that the app:rrvLayoutType attribute has to be set. It determines which LayoutManager will be used. The options are:

  • LinearLayout
  • Grid
  • LinearLayoutWithHeaders

All these will yield vertical linear or grid layouts.

###Other Attributes:

rrvIsRefreshable: Adds the pull-to-refresh feature to the recyclerView. In order to receive the refresh events, a listner has to be set via setOnRefreshListener and setRefreshing is used to control either turn the refersh animation on/off.

rrvEmptyLayoutId: A custom empty state view can be provided via this attribute. Whenever the list has no item, the empty state is shown.

rrvGridLayoutSpanCount: This attribute has to be set with an integer greater than zero when the rrvLayoutType is set to Grid unless rrvGridLayoutItemWidth is set.

rrvGridLayoutItemWidth: This attribute has to be set with a size value that represents the width of a grid column when the rrvLayoutType is set to Grid unless rrvGridLayoutSpanCount is set.

rrvSwipeToDelete: This attribute is only supported with rrvLayoutType of LinearLayout. If set to true, swiping a row to delete is enabled. The row is deleted from the Realm directly.

##RealmBasedRecyclerViewAdapter:

The heart of the RealmRecyclerView's functionality comes from this custom RecyclerView.Adapter. It includes support for insertion/deletion animation whenever the Realm changes. It also inculde the logic to generate the headers for the list's contents if it's of type LinearLayoutWithHeaders.

  • automaticUpdate: If automaticUpdate is set, the RealmResults are automatially updated and the list is refershed with new results.

  • animateResults: If animateResults is set together with automaticUpdate, the automatic updates are animated. This is limited to a single deletion or insertion. If it's more than one item, it will simply refresh the list. The animation leverages the resuls primary key column in order as a unique identifier for each row. Therefore your Realm's schema needs to include a primary key column of type Integer or String.

  • addSectionHeaders: When the rrvLayoutType is LinearLayoutWithHeaders, addSectionHeaders needs be set in order for the adapter to generate the headers. The headerColumnName needs to be set as well in order to look up the header column programmatically your Realm's schema. Note: There is currently no support for customizing the header and it is always inline|sticky.

##Feedback/More Features: I would love to hear your feedback. Do you find the RealmRecyclerView useful? What functionality are you missing? Open a Github issue and let me know. Thanks!

License

Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License. You may obtain a copy of the License at
  http://www.apache.org/licenses/LICENSE-2.0  Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.  Included dependencies are: Realm (https://github.com/realm/realm-java) SuperSLiM/Tonic Artos (https://github.com/TonicArtos/SuperSLiM) 

Resources

ChipView helps you in creating attractive [Chips] for your application. ChipView provides you a flexible way of creating and organizing your chip by following ways:

  • Adding a background or text color to your chip
  • Creating custom layout for your chip
  • Can even create multi color chips

Simple View Behavior for Android CoordinatorLayout.

Simple library for fast right-left list item swiping.

A simple way to convert any model to multipart.

Get a birthday calendar for all your social networks right inside Google Calendar. Supports Facebook, LinkedIn, Xing, Skype, DavDroid and all other apps which sync contacts with your Android device. Enable reminder alarms and decide which contacts you want to see. You'll get notifications for all of them.

This is an implementation of web feedback animation UI.

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