A rxjava wapper for tary library
Using JCenter:
repositories {
jcenter()
}
dependencies {
compile 'com.jiechic.android.library:rxtray:1.0.0'
}
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()
Just enable RxTray as soon as possible. In Android, for example: