예제 #1
0
 private void subscribeToChanges() {
   RxSharedPreferences prefs =
       RxSharedPreferences.create(PreferenceManager.getDefaultSharedPreferences(mAppContext));
   Preference<Integer> lastPage = prefs.getInteger(Constants.PREF_LAST_PAGE);
   Observable.merge(
           mBookmarkModel.tagsObservable(),
           mBookmarkModel.bookmarksObservable(),
           lastPage.asObservable())
       .observeOn(AndroidSchedulers.mainThread())
       .subscribe(
           new Action1<Object>() {
             @Override
             public void call(Object o) {
               if (mFragment != null) {
                 requestData(false);
               } else {
                 mCachedData = null;
               }
             }
           });
 }
예제 #2
0
 @Provides
 @Singleton
 RxSharedPreferences provideRxSharedPreferences(SharedPreferences prefs) {
   return RxSharedPreferences.create(prefs);
 }