@Provides @Singleton @ScalpelWireframeEnabled Preference<Boolean> provideScalpelWireframeEnabled(RxSharedPreferences preferences) { return preferences.getBoolean( "debug_scalpel_wireframe_drawer", DEFAULT_SCALPEL_WIREFRAME_ENABLED); }
@Provides @Singleton @AccessToken Preference<String> provideAccessToken( RxSharedPreferences prefs, @ApiEndpoint Preference<String> endpoint) { // Return an endpoint-specific preference. return prefs.getString("access-token-" + endpoint.get()); }
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; } } }); }
@Provides @Singleton @NetworkFailurePercent Preference<Integer> provideNetworkFailurePercent(RxSharedPreferences preferences) { return preferences.getInteger("debug_network_failure_percent", 3); }
@Provides @Singleton @NetworkDelay Preference<Long> provideNetworkDelay(RxSharedPreferences preferences) { return preferences.getLong("debug_network_delay", 2000l); }
@Provides @Singleton @ApiEndpoint Preference<String> provideEndpointPreference(RxSharedPreferences preferences) { return preferences.getString("debug_endpoint", ApiEndpoints.MOCK_MODE.url); }
@Provides @Singleton RxSharedPreferences provideRxSharedPreferences(SharedPreferences prefs) { return RxSharedPreferences.create(prefs); }
@Provides @Singleton @SeenDebugDrawer Preference<Boolean> provideSeenDebugDrawer(RxSharedPreferences preferences) { return preferences.getBoolean("debug_seen_debug_drawer", DEFAULT_SEEN_DEBUG_DRAWER); }
@Provides @Singleton @ScalpelEnabled Preference<Boolean> provideScalpelEnabled(RxSharedPreferences preferences) { return preferences.getBoolean("debug_scalpel_enabled", DEFAULT_SCALPEL_ENABLED); }
@Provides @Singleton @PixelGridEnabled Preference<Boolean> providePixelGridEnabled(RxSharedPreferences preferences) { return preferences.getBoolean("debug_pixel_grid_enabled", DEFAULT_PIXEL_GRID_ENABLED); }
@Provides @Singleton @PixelRatioEnabled Preference<Boolean> providePixelRatioEnabled(RxSharedPreferences preferences) { return preferences.getBoolean("debug_pixel_ratio_enabled", DEFAULT_PIXEL_RATIO_ENABLED); }
@Provides @Singleton @PicassoDebugging Preference<Boolean> providePicassoDebugging(RxSharedPreferences preferences) { return preferences.getBoolean("debug_picasso_debugging", DEFAULT_PICASSO_DEBUGGING); }
@Provides @Singleton @AnimationSpeed Preference<Integer> provideAnimationSpeed(RxSharedPreferences preferences) { return preferences.getInteger("debug_animation_speed", DEFAULT_ANIMATION_SPEED); }
@Provides @Singleton @CaptureIntents Preference<Boolean> provideCaptureIntentsPreference(RxSharedPreferences preferences) { return preferences.getBoolean("debug_capture_intents", DEFAULT_CAPTURE_INTENTS); }
@Provides @Singleton Preference<InetSocketAddress> provideNetworkProxyAddress(RxSharedPreferences preferences) { return preferences.getObject( "debug_network_proxy", InetSocketAddressPreferenceAdapter.INSTANCE); }
@Provides @Singleton @NetworkVariancePercent Preference<Integer> provideNetworkVariancePercent(RxSharedPreferences preferences) { return preferences.getInteger("debug_network_variance_percent", 40); }