本文整理汇总了Java中com.f2prateek.rx.preferences.RxSharedPreferences.getInteger方法的典型用法代码示例。如果您正苦于以下问题:Java RxSharedPreferences.getInteger方法的具体用法?Java RxSharedPreferences.getInteger怎么用?Java RxSharedPreferences.getInteger使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.f2prateek.rx.preferences.RxSharedPreferences
的用法示例。
在下文中一共展示了RxSharedPreferences.getInteger方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: provideNetworkFailurePercent
import com.f2prateek.rx.preferences.RxSharedPreferences; //导入方法依赖的package包/类
@Provides @Singleton @NetworkFailurePercent
Preference<Integer> provideNetworkFailurePercent(RxSharedPreferences preferences) {
return preferences.getInteger("debug_network_failure_percent", 3);
}
示例2: provideNetworkVariancePercent
import com.f2prateek.rx.preferences.RxSharedPreferences; //导入方法依赖的package包/类
@Provides @Singleton @NetworkVariancePercent
Preference<Integer> provideNetworkVariancePercent(RxSharedPreferences preferences) {
return preferences.getInteger("debug_network_variance_percent", 40);
}
示例3: provideAnimationSpeed
import com.f2prateek.rx.preferences.RxSharedPreferences; //导入方法依赖的package包/类
@Provides @Singleton @AnimationSpeed
Preference<Integer> provideAnimationSpeed(RxSharedPreferences preferences) {
return preferences.getInteger("debug_animation_speed", DEFAULT_ANIMATION_SPEED);
}
示例4: parseMethodAnnotations
import com.f2prateek.rx.preferences.RxSharedPreferences; //导入方法依赖的package包/类
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());
}
}
}
示例5: provideRxItemId
import com.f2prateek.rx.preferences.RxSharedPreferences; //导入方法依赖的package包/类
@Provides @PerApp Preference<Integer> provideRxItemId(RxSharedPreferences preferences) {
return preferences.getInteger(PreferenceHelper.ITEM_ID, -1);
}
示例6: provideNetworkFailurePercent
import com.f2prateek.rx.preferences.RxSharedPreferences; //导入方法依赖的package包/类
@Provides
@ApplicationScope
@NetworkFailurePercent
Preference<Integer> provideNetworkFailurePercent(RxSharedPreferences prefs) {
return prefs.getInteger("debug_network_failure_percent", 3);
}
示例7: provideNetworkVariancePercent
import com.f2prateek.rx.preferences.RxSharedPreferences; //导入方法依赖的package包/类
@Provides
@ApplicationScope
@NetworkVariancePercent
Preference<Integer> provideNetworkVariancePercent(RxSharedPreferences prefs) {
return prefs.getInteger("debug_network_variance_percent", 40);
}
示例8: provideAnimationSpeed
import com.f2prateek.rx.preferences.RxSharedPreferences; //导入方法依赖的package包/类
@Provides
@ApplicationScope
@AnimationSpeed
Preference<Integer> provideAnimationSpeed(RxSharedPreferences prefs) {
return prefs.getInteger("debug_animation_speed", DEFAULT_ANIMATION_SPEED);
}
示例9: provideNetworkErrorPercent
import com.f2prateek.rx.preferences.RxSharedPreferences; //导入方法依赖的package包/类
@Provides @Singleton @NetworkErrorPercent
Preference<Integer> provideNetworkErrorPercent(RxSharedPreferences preferences) {
return preferences.getInteger("debug_network_error_percent", 0);
}