Spice
This is an Android library that allows a similar experience to the iOS NSFetchedResultsController. It leverages Volley and GSON for REST requests and subsequent JSON parsing. It then integrates with a slightly modified version of Sugar ORM for data (cache) persistence and retrieval. This is ideal for any application looking to do server calls and have a local database for offline viewing of the app.
Features
- Automatic RESTful JSON parsing and integration
- Custom JSON parsing strategies
- Automatic JSON Response Caching (configurable)
- Easy integration with Sugar Orm
Future features
- Secure Logout support
- Offline Post, Put, Delete (execute requests when internet becomes available)
Let me know what features are important or bugs you encounter and I will do my best to fix them. I use this in many of my own projects and have found great success.
For those of you looking to use this DB for offline data storage (caching), Check out Sugar Orm
Example
- For an example, check out the app directory
- To view the library source, look at the spice directory
Usage Instructions:
- copy spice-{version}.jar and sugar-{version}.jar from the ./spice/libs folder into your libs folder
- add the following dependencies to your build.gradle:
compile 'com.mcxiaoke.volley:library:1.0.+@aar'
compile 'com.google.code.gson:gson:2.3'
compile 'com.google.guava:guava:18.0'
compile 'org.apache.httpcomponents:httpclient-android:4.3.5.1'
compile('org.apache.httpcomponents:httpmime:4.3') {
exclude module: "httpclient"
}
Support or Contact
Having trouble with Sugar? Contact me and I’ll help you sort it out.