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;
               }
             }
           });
 }
Exemple #2
0
 @Provides
 @Singleton
 @AnimationSpeed
 Preference<Integer> provideAnimationSpeed(RxSharedPreferences preferences) {
   return preferences.getInteger("debug_animation_speed", DEFAULT_ANIMATION_SPEED);
 }
Exemple #3
0
 @Provides
 @Singleton
 @NetworkFailurePercent
 Preference<Integer> provideNetworkFailurePercent(RxSharedPreferences preferences) {
   return preferences.getInteger("debug_network_failure_percent", 3);
 }
Exemple #4
0
 @Provides
 @Singleton
 @NetworkVariancePercent
 Preference<Integer> provideNetworkVariancePercent(RxSharedPreferences preferences) {
   return preferences.getInteger("debug_network_variance_percent", 40);
 }