/RxTray

rx wapper for tray

Primary LanguageJava

RxService

License Jcenter

A rxjava wapper for tary library

Installation

Using JCenter:

repositories {
    jcenter()
}

dependencies {
    compile 'com.jiechic.android.library:rxtray:1.0.0'
}

Usage

Simple tutorial how to use Tray in your project instead of the SharedPreferences

the some as tray then replace AppPreferences with RxAppPreferences and replace TrayPreferences with RxTrayPreferences

for example:

// create a preference accessor. This is for global app preferences.
final RxAppPreferences appPreferences = new RxAppPreferences(getContext()); // this Preference comes for free from the library
// save a key value pair
appPreferences.put("key", "lorem ipsum");
// create a preference accessor for a module
public class MyModulePreference extends RxTrayPreferences {

    public static String KEY_IS_FIRST_LAUNCH = "first_launch";

    public MyModulePreference(final Context context) {
        super(context, "myModule", 1);
    }
}

now you can subscription your key of value

   appPreferences.getXXXObservable(key).subscribe()

Save and read preferences

Just enable RxTray as soon as possible. In Android, for example: