Java Code Examples for com.f2prateek.rx.preferences.RxSharedPreferences#getBoolean()

The following examples show how to use com.f2prateek.rx.preferences.RxSharedPreferences#getBoolean() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ApplicationModule.java    From ViewInspector with Apache License 2.0 4 votes vote down vote up
@Provides @Singleton @ScalpelShowId Preference<Boolean> provideScalpelIdFlag(
    RxSharedPreferences prefs) {
  return prefs.getBoolean("scalpelId", false);
}
 
Example 2
Source File: DebugDataModule.java    From u2020-mvp with Apache License 2.0 4 votes vote down vote up
@Provides
@ApplicationScope
@ScalpelEnabled
Preference<Boolean> provideScalpelEnabled(RxSharedPreferences prefs) {
    return prefs.getBoolean("debug_scalpel_enabled", DEFAULT_SCALPEL_ENABLED);
}
 
Example 3
Source File: DebugDataModule.java    From u2020 with Apache License 2.0 4 votes vote down vote up
@Provides @Singleton @PixelGridEnabled
Preference<Boolean> providePixelGridEnabled(RxSharedPreferences preferences) {
  return preferences.getBoolean("debug_pixel_grid_enabled", DEFAULT_PIXEL_GRID_ENABLED);
}
 
Example 4
Source File: TelescopeViewContainer.java    From u2020-mvp with Apache License 2.0 4 votes vote down vote up
@Inject public TelescopeViewContainer(LumberYard lumberYard, RxSharedPreferences preferences) {
    this.lumberYard = lumberYard;
    this.seenTelescopeDialog = preferences.getBoolean("internal-seen-telescope-dialog", false);
}
 
Example 5
Source File: DebugDataModule.java    From u2020-mvp with Apache License 2.0 4 votes vote down vote up
@Provides
@ApplicationScope
@PixelGridEnabled
Preference<Boolean> providePixelGridEnabled(RxSharedPreferences prefs) {
    return prefs.getBoolean("debug_pixel_grid_enabled", DEFAULT_PIXEL_GRID_ENABLED);
}
 
Example 6
Source File: DebugDataModule.java    From u2020-mvp with Apache License 2.0 4 votes vote down vote up
@Provides
@ApplicationScope
@PicassoDebugging
Preference<Boolean> providePicassoDebugging(RxSharedPreferences prefs) {
    return prefs.getBoolean("debug_picasso_debugging", DEFAULT_PICASSO_DEBUGGING);
}
 
Example 7
Source File: DebugDataModule.java    From u2020 with Apache License 2.0 4 votes vote down vote up
@Provides @Singleton @PixelRatioEnabled
Preference<Boolean> providePixelRatioEnabled(RxSharedPreferences preferences) {
  return preferences.getBoolean("debug_pixel_ratio_enabled", DEFAULT_PIXEL_RATIO_ENABLED);
}
 
Example 8
Source File: ApplicationModule.java    From DataInspector with Apache License 2.0 4 votes vote down vote up
@Provides @Singleton @LogStorageEvents Preference<Boolean> provideLogStorageEventsFlag(
    RxSharedPreferences prefs) {
  return prefs.getBoolean("logStorageEvents", false);
}
 
Example 9
Source File: ApplicationModule.java    From DataInspector with Apache License 2.0 4 votes vote down vote up
@Provides @Singleton @LogPreferenceEvents Preference<Boolean> provideLogPreferenceEventsFlag(
    RxSharedPreferences prefs) {
  return prefs.getBoolean("logPreferenceEvents", false);
}
 
Example 10
Source File: TelescopeViewContainer.java    From u2020 with Apache License 2.0 4 votes vote down vote up
@Inject public TelescopeViewContainer(LumberYard lumberYard, RxSharedPreferences preferences) {
  this.lumberYard = lumberYard;
  this.seenTelescopeDialog = preferences.getBoolean("internal-seen-telescope-dialog", false);
}
 
Example 11
Source File: MethodInfo.java    From Favor with Apache License 2.0 4 votes vote down vote up
private void parseMethodAnnotations() {
        for (Annotation methodAnnotation : method.getAnnotations()) {
            Class<? extends Annotation> annotationType = methodAnnotation.annotationType();

            if (annotationType == Favor.class) {
                key = ((Favor) methodAnnotation).value();
                if (key.trim().length() == 0) {
                    key = getKeyFromMethod(method);
                }
                if (!TextUtils.isEmpty(prefix)) {
                    key = prefix + key;
                }
            } else if (annotationType == Default.class) {
                defaultValues = ((Default) methodAnnotation).value();
            } else if (annotationType == Commit.class) {
                commit = true;
            }
        }

        if (allFavor && key == null) {
            key = getKeyFromMethod(method);
            if (!TextUtils.isEmpty(prefix)) {
                key = prefix + key;
            }
        }

        if (responseType == ResponseType.OBSERVABLE) {
            checkDefaultValueType(responseObjectType, defaultValues);
            if (commit) {
                Log.w(TAG, "@Commit will be ignored for RxReference");
            }
            RxSharedPreferences rx = RxSharedPreferences.create(sp);
            if (responseObjectType == String.class) {
                rxPref = rx.getString(key, defaultValues[0]);
            } else if (responseObjectType == Integer.class) {
                rxPref = rx.getInteger(key, defaultValues[0] == null ? null : Integer.valueOf(defaultValues[0]));
            } else if (responseObjectType == Float.class) {
                rxPref = rx.getFloat(key, defaultValues[0] == null ? null : Float.valueOf(defaultValues[0]));
            } else if (responseObjectType == Long.class) {
                rxPref = rx.getLong(key, defaultValues[0] == null ? null : Long.valueOf(defaultValues[0]));
            } else if (responseObjectType == Boolean.class) {
                rxPref = rx.getBoolean(key, defaultValues[0] == null ? null : Boolean.valueOf(defaultValues[0]));
            } else if (Serializable.class.isAssignableFrom(Types.getRawType(responseObjectType))) {
                rxPref = rx.getObject(key, new SerializableAdapter<>());
            } else {
//                        Class returnTypeClass = Types.getRawType(returnType);
//                        if (returnTypeClass == Set.class) {
//                            rxPref = rx.getStringSet(key,new HashSet<String>(defaultValues))
//                        }
            }
        } else {
            if (FavorType == String.class) {
                taste = new Taste.StringTaste(sp, key, defaultValues);
            } else if (FavorType == boolean.class) {
                taste = new Taste.BoolTaste(sp, key, defaultValues);
            } else if (FavorType == int.class) {
                taste = new Taste.IntTaste(sp, key, defaultValues);
            } else if (FavorType == float.class) {
                taste = new Taste.FloatTaste(sp, key, defaultValues);
            } else if (FavorType == long.class) {
                taste = new Taste.LongTaste(sp, key, defaultValues);
            } else if (Types.getRawType(FavorType) == Set.class) {
                taste = new Taste.StringSetTaste(sp, key, defaultValues);
            } else if (Serializable.class.isAssignableFrom(Types.getRawType(FavorType))) {
                taste = new Taste.SerializableTaste(sp, key, defaultValues);
            } else {
                taste = new Taste.EmptyTaste(sp, key, defaultValues);
                throw methodError("Unsupported type " + FavorType.toString());
            }
        }
    }
 
Example 12
Source File: ApplicationModule.java    From ViewInspector with Apache License 2.0 4 votes vote down vote up
@Provides @Singleton @ScalpelWireframe Preference<Boolean> provideScalpelWireframeFlag(
    RxSharedPreferences prefs) {
  return prefs.getBoolean("scalpelWireframe", false);
}
 
Example 13
Source File: ApplicationModule.java    From ViewInspector with Apache License 2.0 4 votes vote down vote up
@Provides @Singleton @Scalpel3D Preference<Boolean> provideScalpel3dFlag(
    RxSharedPreferences prefs) {
  return prefs.getBoolean("scalpel3d", false);
}
 
Example 14
Source File: ApplicationModule.java    From ViewInspector with Apache License 2.0 4 votes vote down vote up
@Provides @Singleton @LogViewEvents Preference<Boolean> provideLogViewEventsFlag(
    RxSharedPreferences prefs) {
  return prefs.getBoolean("logViewEvents", false);
}
 
Example 15
Source File: ApplicationModule.java    From ViewInspector with Apache License 2.0 4 votes vote down vote up
@Provides @Singleton @Profiling Preference<Boolean> provideProfilingFlag(
    RxSharedPreferences prefs) {
  return prefs.getBoolean("profiling", false);
}
 
Example 16
Source File: ApplicationModule.java    From ViewInspector with Apache License 2.0 4 votes vote down vote up
@Provides @Singleton @ProbeMeasures Preference<Boolean> provideProbeMeasuresFlag(
    RxSharedPreferences prefs) {
  return prefs.getBoolean("probeMeasures", false);
}
 
Example 17
Source File: ApplicationModule.java    From ViewInspector with Apache License 2.0 4 votes vote down vote up
@Provides @Singleton @BypassInterceptor Preference<Boolean> provideBypassInterceptorFlag(
    RxSharedPreferences prefs) {
  return prefs.getBoolean("bypassInterceptor", false);
}
 
Example 18
Source File: DebugDataModule.java    From u2020 with Apache License 2.0 4 votes vote down vote up
@Provides @Singleton @ScalpelWireframeEnabled
Preference<Boolean> provideScalpelWireframeEnabled(RxSharedPreferences preferences) {
  return preferences.getBoolean("debug_scalpel_wireframe_drawer",
      DEFAULT_SCALPEL_WIREFRAME_ENABLED);
}
 
Example 19
Source File: ApplicationModule.java    From ViewInspector with Apache License 2.0 4 votes vote down vote up
@Provides @Singleton @ShowMargin Preference<Boolean> provideShowMarginFlag(
    RxSharedPreferences prefs) {
  return prefs.getBoolean("showMargin", false);
}
 
Example 20
Source File: ApplicationModule.java    From ViewInspector with Apache License 2.0 4 votes vote down vote up
@Provides @Singleton @ShowOutline Preference<Boolean> provideShowOutlineFlag(
    RxSharedPreferences prefs) {
  return prefs.getBoolean("showOutline", false);
}