Skip to content

Commit

Permalink
Merge pull request JakeWharton#199 from steffandroid/sd/rx-preferences
Browse files Browse the repository at this point in the history
Replace internal RxSharedPreferences with library
  • Loading branch information
JakeWharton committed Sep 4, 2015
2 parents 52e8f8c + a7181bf commit b67f417
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 116 deletions.
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ dependencies {

internalCompile 'com.mattprecious.telescope:telescope:1.4.0@aar'

internalDebugCompile 'com.f2prateek.rx.preferences:rx-preferences:1.0.0'

androidTestCompile 'junit:junit:4.12'
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2'
// TODO https://code.google.com/p/android-test-kit/issues/detail?id=157
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
import android.app.Application;
import android.content.SharedPreferences;
import android.net.Uri;
import com.f2prateek.rx.preferences.RxSharedPreferences;
import com.jakewharton.u2020.IsInstrumentationTest;
import com.jakewharton.u2020.data.api.DebugApiModule;
import com.jakewharton.u2020.data.api.oauth.AccessToken;
import com.jakewharton.u2020.data.prefs.BooleanPreference;
import com.jakewharton.u2020.data.prefs.IntPreference;
import com.jakewharton.u2020.data.prefs.LongPreference;
import com.jakewharton.u2020.data.prefs.NetworkProxyPreference;
import com.jakewharton.u2020.data.prefs.RxSharedPreferences;
import com.jakewharton.u2020.data.prefs.StringPreference;
import com.squareup.okhttp.OkHttpClient;
import com.squareup.picasso.OkHttpDownloader;
Expand Down Expand Up @@ -121,7 +121,8 @@ BooleanPreference providePixelGridEnabled(SharedPreferences preferences) {

@Provides @Singleton @PixelGridEnabled
Observable<Boolean> provideObservablePixelGridEnabled(RxSharedPreferences preferences) {
return preferences.getBoolean("debug_pixel_grid_enabled", DEFAULT_PIXEL_GRID_ENABLED);
return preferences.getBoolean("debug_pixel_grid_enabled", DEFAULT_PIXEL_GRID_ENABLED)
.asObservable();
}

@Provides @Singleton @PixelRatioEnabled
Expand All @@ -132,7 +133,8 @@ BooleanPreference providePixelRatioEnabled(SharedPreferences preferences) {

@Provides @Singleton @PixelRatioEnabled
Observable<Boolean> provideObservablePixelRatioEnabled(RxSharedPreferences preferences) {
return preferences.getBoolean("debug_pixel_ratio_enabled", DEFAULT_PIXEL_RATIO_ENABLED);
return preferences.getBoolean("debug_pixel_ratio_enabled", DEFAULT_PIXEL_RATIO_ENABLED)
.asObservable();
}

@Provides @Singleton @SeenDebugDrawer
Expand All @@ -147,7 +149,7 @@ BooleanPreference provideScalpelEnabled(SharedPreferences preferences) {

@Provides @Singleton @ScalpelEnabled
Observable<Boolean> provideObservableScalpelEnabled(RxSharedPreferences preferences) {
return preferences.getBoolean("debug_scalpel_enabled", DEFAULT_SCALPEL_ENABLED);
return preferences.getBoolean("debug_scalpel_enabled", DEFAULT_SCALPEL_ENABLED).asObservable();
}

@Provides @Singleton @ScalpelWireframeEnabled
Expand All @@ -159,7 +161,7 @@ BooleanPreference provideScalpelWireframeEnabled(SharedPreferences preferences)
@Provides @Singleton @ScalpelWireframeEnabled
Observable<Boolean> provideObservableScalpelWireframeEnabled(RxSharedPreferences preferences) {
return preferences.getBoolean("debug_scalpel_wireframe_drawer",
DEFAULT_SCALPEL_WIREFRAME_ENABLED);
DEFAULT_SCALPEL_WIREFRAME_ENABLED).asObservable();
}

@Provides @Singleton Picasso providePicasso(OkHttpClient client, NetworkBehavior behavior,
Expand Down

This file was deleted.

0 comments on commit b67f417

Please sign in to comment.