本文整理汇总了Java中com.f2prateek.rx.preferences.Preference类的典型用法代码示例。如果您正苦于以下问题:Java Preference类的具体用法?Java Preference怎么用?Java Preference使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Preference类属于com.f2prateek.rx.preferences包,在下文中一共展示了Preference类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: AppDetailPresenter
import com.f2prateek.rx.preferences.Preference; //导入依赖的package包/类
@Inject public AppDetailPresenter(AppService appService,
IntentFactory intentFactory,
@HasSeenEditPermissionsTutorial Preference<Boolean> hasSeenEditPermissionsTutorial,
@DisplayAllPermissions Preference<Boolean> displayAllPermissions,
AnalyseUsedPermissions analyseUsedPermissions,
FetchLibrariesForAppWithPermissions fetchLibrariesForAppWithPermissions,
AppAnalyticsService appAnalyticsService,
DeviceFeatures deviceFeatures) {
this.appService = appService;
this.intentFactory = intentFactory;
this.hasSeenEditPermissionsTutorial = hasSeenEditPermissionsTutorial;
this.displayAllPermissions = displayAllPermissions;
this.analyseUsedPermissions = analyseUsedPermissions;
this.fetchLibrariesForAppWithPermissions = fetchLibrariesForAppWithPermissions;
this.appAnalyticsService = appAnalyticsService;
this.deviceFeatures = deviceFeatures;
}
示例2: testRxSharePreference
import com.f2prateek.rx.preferences.Preference; //导入依赖的package包/类
public void testRxSharePreference() {
Preference<String> name = profile.name();
assertNotNull(name);
assertEquals("No Name", name.get());
Preference<Boolean> gender = profile.gender();
remove("gender");
assertNotNull(gender);
gender.set(true);
sleep(2000);
assertTrue(gender.get());
assertTrue(sp().getBoolean("gender", false));
gender.delete();
sleep(2000);
assertNull(gender.get());
}
示例3: changeSyncId
import com.f2prateek.rx.preferences.Preference; //导入依赖的package包/类
private void changeSyncId(Preference<String> syncIdPreference,
Preference<Boolean> isGroupSchedulePreference) {
Boolean b = isGroupSchedulePreference.get();
if (b != null && b) {
List<StudentGroup> groups = mStorIOSQLite.get()
.listOfObjects(StudentGroup.class)
.withQuery(Query.builder()
.table(StudentGroupEntry.TABLE_NAME)
.where(StudentGroupEntry.COL_NAME + " = ?")
.whereArgs(syncIdPreference.get())
.build())
.prepare()
.executeAsBlocking();
if (groups.size() == 1) {
syncIdPreference.set(String.valueOf(groups.get(0).id));
}
}
}
示例4: AppManagerPresenter
import com.f2prateek.rx.preferences.Preference; //导入依赖的package包/类
@Inject public AppManagerPresenter(AppService appService,
@AppListSortBy Preference<SortBy> sortBy,
AppAnalyticsService appAnalyticsService,
StringProvider stringProvider) {
this.appService = appService;
this.sortBy = sortBy;
this.appAnalyticsService = appAnalyticsService;
this.stringProvider = stringProvider;
}
示例5: LibraryCategoryPresenter
import com.f2prateek.rx.preferences.Preference; //导入依赖的package包/类
@Inject
public LibraryCategoryPresenter(@OnlyShowUsedLibraries Preference<Boolean> onlyShowUsedLibraries,
ApiSyncer apiSyncer,
AppService appService,
AnalyseUsedLibraries analyseUsedLibraries) {
this.onlyShowUsedLibraries = onlyShowUsedLibraries;
this.apiSyncer = apiSyncer;
this.appService = appService;
this.analyseUsedLibraries = analyseUsedLibraries;
}
示例6: provideBehavior
import com.f2prateek.rx.preferences.Preference; //导入依赖的package包/类
@Provides @Singleton NetworkBehavior provideBehavior(@NetworkDelay Preference<Long> networkDelay,
@NetworkFailurePercent Preference<Integer> networkFailurePercent,
@NetworkVariancePercent Preference<Integer> networkVariancePercent) {
NetworkBehavior behavior = NetworkBehavior.create();
behavior.setDelay(networkDelay.get(), MILLISECONDS);
behavior.setFailurePercent(networkFailurePercent.get());
behavior.setVariancePercent(networkVariancePercent.get());
return behavior;
}
示例7: provideOkHttpClient
import com.f2prateek.rx.preferences.Preference; //导入依赖的package包/类
@Provides @Singleton OkHttpClient provideOkHttpClient(Application app,
Preference<InetSocketAddress> networkProxyAddress) {
return DataModule.createOkHttpClient(app)
.sslSocketFactory(createBadSslSocketFactory())
.proxy(InetSocketAddressPreferenceAdapter.createProxy(networkProxyAddress.get()))
.build();
}
示例8: ProxyAdapter
import com.f2prateek.rx.preferences.Preference; //导入依赖的package包/类
ProxyAdapter(Context context, Preference<InetSocketAddress> proxyAddress) {
super(context);
if (proxyAddress == null) {
throw new IllegalStateException("proxy == null");
}
this.proxyAddress = proxyAddress;
}
示例9: DebugViewContainer
import com.f2prateek.rx.preferences.Preference; //导入依赖的package包/类
@Inject public DebugViewContainer(LumberYard lumberYard,
IntentManager intentManager,
@SeenDebugDrawer Preference<Boolean> seenDebugDrawer,
@PixelGridEnabled Preference<Boolean> pixelGridEnabled,
@PixelRatioEnabled Preference<Boolean> pixelRatioEnabled,
@ScalpelEnabled Preference<Boolean> scalpelEnabled,
@ScalpelWireframeEnabled Preference<Boolean> scalpelWireframeEnabled) {
this.lumberYard = lumberYard;
this.intentManager = intentManager;
this.seenDebugDrawer = seenDebugDrawer;
this.pixelGridEnabled = pixelGridEnabled;
this.pixelRatioEnabled = pixelRatioEnabled;
this.scalpelEnabled = scalpelEnabled;
this.scalpelWireframeEnabled = scalpelWireframeEnabled;
}
示例10: LoginPresenter
import com.f2prateek.rx.preferences.Preference; //导入依赖的package包/类
@Inject public LoginPresenter(LoginContract.View loginView,
ZoomEyeApiService api,
ErrorBodyHandler errorHandler,
@AccessToken Preference<String> tokenPreference) {
this.loginView = loginView;
this.api = api;
this.errorHandler = errorHandler;
this.tokenPreference = tokenPreference;
}
示例11: OauthManager
import com.f2prateek.rx.preferences.Preference; //导入依赖的package包/类
@Inject public OauthManager(IntentFactory intentFactory, OkHttpClient client, Gson gson,
@AccessToken Preference<String> accessToken) {
this.intentFactory = intentFactory;
this.client = client;
this.gson = gson;
this.accessToken = accessToken;
}
示例12: check_update1
import com.f2prateek.rx.preferences.Preference; //导入依赖的package包/类
/**
* 同步SharedPreferences
*/
private void check_update1() {
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(getActivity());
RxSharedPreferences rxPreferences = RxSharedPreferences.create(preferences);
Preference<Boolean> xxFunction = rxPreferences.getBoolean("xxFunction", false);
checkBox1.setChecked(xxFunction.get());
RxCompoundButton.checkedChanges(checkBox1)
.subscribe(xxFunction.asAction());
}
示例13: parseResponseType
import com.f2prateek.rx.preferences.Preference; //导入依赖的package包/类
private ResponseType parseResponseType() {
Type returnType = method.getGenericReturnType();
Type[] parameterTypes = method.getGenericParameterTypes();
if (parameterTypes.length > 1) {
throw methodError("%s method has more than one parameter", method.getName());
}
Type typeToCheck = null;
if (parameterTypes.length > 0) {
typeToCheck = parameterTypes[0];
}
boolean hasReturnType = returnType != void.class;
if (typeToCheck != null && hasReturnType) {
Log.w(TAG, String.format("Setter method %s should not have return value", method.getName()));
hasReturnType = false;
returnType = void.class;
}
if (hasReturnType) {
Class rawReturnType = Types.getRawType(returnType);
// if (parameterTypes.length > 0) {
// throw methodError("getter method %s should not have parameter", method.getName());
// }
if (HAS_RX_JAVA) {
if (rawReturnType == Preference.class) {
returnType = Types.getSupertype(returnType, rawReturnType, Preference.class);
responseObjectType = getParameterUpperBound((ParameterizedType) returnType);
return ResponseType.OBSERVABLE;
}
}
responseObjectType = returnType;
}
FavorType = (hasReturnType ? returnType : typeToCheck);
return hasReturnType ? ResponseType.OBJECT : ResponseType.VOID;
}
示例14: getRemoteViews
import com.f2prateek.rx.preferences.Preference; //导入依赖的package包/类
/**
* Gets remote views.
*
* @param context the context
* @param id the id
* @return the remote views
*/
@Nullable public static RemoteViews getRemoteViews(Context context, int id,
Preference.Adapter<SyncIdItem> adapter) {
SyncIdItem item = PreferenceHelper.getSyncIdItemPreference(context, id, adapter);
if (item == null) {
return null;
}
boolean isNightModeEnabled = PreferenceHelper.isNightModeEnabled(context, id);
boolean isToday = PreferenceHelper.getIsTodayPreference(context, id);
boolean isCollapsed = PreferenceHelper.getIsWidgetCollapsedPreference(context, id);
SubgroupFilter subgroupFilter = PreferenceHelper.getSubgroupFilterPreference(context, id);
RemoteViews remoteViews =
new RemoteViews(context.getPackageName(), R.layout.appwidget_schedule);
remoteViews.setInt(R.id.icon, "setVisibility", isCollapsed ? View.GONE : View.VISIBLE);
setupRemoteViews(context, id, isToday, isNightModeEnabled, remoteViews);
setupSubtitle(item, subgroupFilter, remoteViews);
setupOpenApp(context, remoteViews, isCollapsed ? R.id.title_subtitle : R.id.icon);
setupItemPendingIntentTemplate(context, id, remoteViews);
setupArrow(context, id, isToday, remoteViews);
return remoteViews;
}
示例15: AppWidgetScheduleFactory
import com.f2prateek.rx.preferences.Preference; //导入依赖的package包/类
public AppWidgetScheduleFactory(Context context, Intent intent, StorIOSQLite storIOSQLite,
Preference.Adapter<SyncIdItem> adapter) {
mAppWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID,
AppWidgetManager.INVALID_APPWIDGET_ID);
mContext = context;
mIsToday = intent.getBooleanExtra(AppWidgetScheduleProvider.EXTRA_IS_TODAY, true);
mStorIOSQLite = storIOSQLite;
mSyncIdItem = PreferenceHelper.getSyncIdItemPreference(context, mAppWidgetId, adapter);
mAreCirclesColored = PreferenceHelper.getAreCirclesColoredPreference(context, mAppWidgetId);
mIsDarkTheme = PreferenceHelper.isNightModeEnabled(context, mAppWidgetId);
mSubgroupFilter = PreferenceHelper.getSubgroupFilterPreference(context, mAppWidgetId);
mIsCollapsed = PreferenceHelper.getIsWidgetCollapsedPreference(mContext, mAppWidgetId);
}