UniversalPreferences


Source link: https://github.com/Zookey/UniversalPreferences

UniversalPreferences

UniversalPreferences is simple Android library that allows you to use Shared Preferences in an easy way.

This library allows you to easily to store and retrive values from SharedPreferences without creating lots of boilerplate.

Usage

Add to your module's build.gradle:

allprojects {

  repositories {

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

  
}
 
}
 

and to your app build.gradle:

dependencies {

  compile 'com.github.zookey:universalpreferences:0.0.4' 
}
 

First you do need to initalize this libarary inside onCreate of the Application class of your project.

public class UniversalPreferencesApplication extends Application {

@Override
  public void onCreate() {

super.onCreate();

UniversalPreferences.initialize(this);

  
}
 
}

Now you can use UniversalPreferences library in any class of your project.

UniversalPreferences library is "universal" at accepting object types, so there is only one method to store and only one method to retrive values.

Store and retrieve String
UniversalPreferences.getInstance().put("string", "some value");
 String stringValue = UniversalPreference.getInstance().get("string", "");
Store and retrieve Integer
UniversalPreferences.getInstance().put("int", 30);
 int integerValue = UniversalPreference.getInstance().get("int", 0);
Store and retrieve Float
UniversalPreferences.getInstance().put("float", 3.0f);
 float valueFloat = UniversalPreference.getInstance().get("float", 0.0f);
Store and retrieve Boolean
UniversalPreferences.getInstance().put("bool", true);
 boolean bool = UniversalPreference.getInstance().get("bool", false);
Store and retrieve Set
Set<String> set = new HashSet<String>();
 set.add("test 1");
 set.add("test 2");
 UniversalPreferences.getInstance().put("set", set);
 Set<String> savedSet = UniversalPreference.getInstance().get("set", new HashSet<String>);

Resources

Android Promise wrappers for Apache Http client.

A simple custom view based on EditText that lets you validate credit card numbers.

Simple full screen image viewer for Fresco library that includes "pinch to zoom" and "swipe to dismiss" gestures.

This library add something for swipe item settling, recover base on the Itemtouchhelper.

Chaining multiple sources with RxJava.

Deal with Android M permissions in runtime in a simple way with reactive programming. This library was developed in Kotlin but can interoperate with Java.

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