当前位置: 首页>>代码示例>>Java>>正文


Java RxSharedPreferences类代码示例

本文整理汇总了Java中com.f2prateek.rx.preferences.RxSharedPreferences的典型用法代码示例。如果您正苦于以下问题:Java RxSharedPreferences类的具体用法?Java RxSharedPreferences怎么用?Java RxSharedPreferences使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


RxSharedPreferences类属于com.f2prateek.rx.preferences包,在下文中一共展示了RxSharedPreferences类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: init

import com.f2prateek.rx.preferences.RxSharedPreferences; //导入依赖的package包/类
@Override
protected void init() {
    super.init();
    btn_submit.setText("查看变量");
    editText=new EditText(getActivity());
    checkBox=new CheckBox(getActivity());
    checkBox.setText("是否为男性");
    container.addView(checkBox);
    container.addView(editText);
    //创建实例
    SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(getActivity());
    RxSharedPreferences rxPreferences = RxSharedPreferences.create(preferences);

    //创建个人
    pre_username = rxPreferences.getString("username");
    pre_sex= rxPreferences.getBoolean("sex", true);

    //绑定
    RxCompoundButton.checkedChanges(checkBox)
            .subscribe(pre_sex.asAction());

    RxTextView.textChanges(editText)
            .flatMap(new Func1<CharSequence, Observable<String>>() {
                @Override
                public Observable<String> call(final CharSequence charSequence) {
                    return Observable.create(new Observable.OnSubscribe<String>() {
                        @Override
                        public void call(Subscriber<? super String> subscriber) {
                            subscriber.onNext(charSequence.toString());
                            subscriber.onCompleted();
                        }
                    });
                }
            })
        .subscribe(pre_username.asAction());
}
 
开发者ID:Aiushtha,项目名称:Go-RxJava,代码行数:37,代码来源:RxPreferences_Demo.java

示例2: check_update1

import com.f2prateek.rx.preferences.RxSharedPreferences; //导入依赖的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());
}
 
开发者ID:cowthan,项目名称:AyoSunny,代码行数:14,代码来源:CheckBoxUpdateFragment.java

示例3: WindFishState

import com.f2prateek.rx.preferences.RxSharedPreferences; //导入依赖的package包/类
WindFishState(Application context, RxPowerStatus powerStatus) {
  this.powerStatus = powerStatus;

  SharedPreferences sharedPreferences =
      context.getSharedPreferences("windfish_state.prefs", Context.MODE_PRIVATE);
  RxSharedPreferences rxPrefs = RxSharedPreferences.create(sharedPreferences);
  mode = rxPrefs.getString(KEY_MODE, Mode.ALWAYS_OFF.name());
}
 
开发者ID:hannesstruss,项目名称:WindFish,代码行数:9,代码来源:WindFishState.java

示例4: InitialStartupInteractor

import com.f2prateek.rx.preferences.RxSharedPreferences; //导入依赖的package包/类
public InitialStartupInteractor(Context context, DatabaseReference firebaseClient, IUserInteractor userInteractor) {
    mContext = context;
    mFirebaseClient = firebaseClient;
    mUserInteractor = userInteractor;
    mPrefs = context.getSharedPreferences(SP_NAME, Context.MODE_PRIVATE);
    mRxPrefs = RxSharedPreferences.create(mPrefs);
}
 
开发者ID:coderswithoutborders,项目名称:deglancer,代码行数:8,代码来源:InitialStartupInteractor.java

示例5: NetworkSettingsRepository

import com.f2prateek.rx.preferences.RxSharedPreferences; //导入依赖的package包/类
@Inject
NetworkSettingsRepository(@NetworkPreferences final SharedPreferences sharedPreferences) {
    this.sharedPreferences = sharedPreferences;
    this.rxSharedPreferences = RxSharedPreferences.create(sharedPreferences);
}
 
开发者ID:dmitrikudrenko,项目名称:MDRXL,代码行数:6,代码来源:NetworkSettingsRepository.java

示例6: provideRxSharedPreferences

import com.f2prateek.rx.preferences.RxSharedPreferences; //导入依赖的package包/类
@Provides @Singleton
public RxSharedPreferences provideRxSharedPreferences(SharedPreferences sharedPreferences) {
  return RxSharedPreferences.create(sharedPreferences);
}
 
开发者ID:philipphager,项目名称:disclosure-android-app,代码行数:5,代码来源:PreferenceModule.java

示例7: provideHasSeenSystemSettingsTutorial

import com.f2prateek.rx.preferences.RxSharedPreferences; //导入依赖的package包/类
@Provides @Singleton @HasSeenEditPermissionsTutorial
public Preference<Boolean> provideHasSeenSystemSettingsTutorial(
    RxSharedPreferences rxPreferences) {
  return rxPreferences.getBoolean("provideHasSeenSystemSettingsTutorial", false);
}
 
开发者ID:philipphager,项目名称:disclosure-android-app,代码行数:6,代码来源:PreferenceModule.java

示例8: provideDisplayAllPermissions

import com.f2prateek.rx.preferences.RxSharedPreferences; //导入依赖的package包/类
@Provides @Singleton @DisplayAllPermissions
public Preference<Boolean> provideDisplayAllPermissions(RxSharedPreferences rxPreferences) {
  return rxPreferences.getBoolean("displayAllPermissions", false);
}
 
开发者ID:philipphager,项目名称:disclosure-android-app,代码行数:5,代码来源:PreferenceModule.java

示例9: provideAppListSortBy

import com.f2prateek.rx.preferences.RxSharedPreferences; //导入依赖的package包/类
@Provides @Singleton @AppListSortBy
public Preference<SortBy> provideAppListSortBy(RxSharedPreferences rxPreferences) {
  return rxPreferences.getEnum("appListSortBy", SortBy.LIBRARY_COUNT, SortBy.class);
}
 
开发者ID:philipphager,项目名称:disclosure-android-app,代码行数:5,代码来源:PreferenceModule.java

示例10: provideOnlyShowUsedLibraries

import com.f2prateek.rx.preferences.RxSharedPreferences; //导入依赖的package包/类
@Provides @Singleton @OnlyShowUsedLibraries
public Preference<Boolean> provideOnlyShowUsedLibraries(RxSharedPreferences rxPreferences) {
  return rxPreferences.getBoolean("onlyShowUsedLibraries", true);
}
 
开发者ID:philipphager,项目名称:disclosure-android-app,代码行数:5,代码来源:PreferenceModule.java

示例11: provideRxSharedPreferences

import com.f2prateek.rx.preferences.RxSharedPreferences; //导入依赖的package包/类
@Provides @Singleton RxSharedPreferences provideRxSharedPreferences(SharedPreferences prefs) {
  return RxSharedPreferences.create(prefs);
}
 
开发者ID:rogues-dev,项目名称:superglue,代码行数:4,代码来源:DataModule.java

示例12: provideEndpointPreference

import com.f2prateek.rx.preferences.RxSharedPreferences; //导入依赖的package包/类
@Provides @Singleton @ApiEndpoint
Preference<String> provideEndpointPreference(RxSharedPreferences preferences) {
  return preferences.getString("debug_endpoint", ApiEndpoints.PRODUCTION.url);
}
 
开发者ID:rogues-dev,项目名称:superglue,代码行数:5,代码来源:DebugDataModule.java

示例13: provideNetworkDelay

import com.f2prateek.rx.preferences.RxSharedPreferences; //导入依赖的package包/类
@Provides @Singleton @NetworkDelay
Preference<Long> provideNetworkDelay(RxSharedPreferences preferences) {
  return preferences.getLong("debug_network_delay", 2000L);
}
 
开发者ID:rogues-dev,项目名称:superglue,代码行数:5,代码来源:DebugDataModule.java

示例14: provideNetworkFailurePercent

import com.f2prateek.rx.preferences.RxSharedPreferences; //导入依赖的package包/类
@Provides @Singleton @NetworkFailurePercent
Preference<Integer> provideNetworkFailurePercent(RxSharedPreferences preferences) {
  return preferences.getInteger("debug_network_failure_percent", 3);
}
 
开发者ID:rogues-dev,项目名称:superglue,代码行数:5,代码来源:DebugDataModule.java

示例15: provideNetworkVariancePercent

import com.f2prateek.rx.preferences.RxSharedPreferences; //导入依赖的package包/类
@Provides @Singleton @NetworkVariancePercent
Preference<Integer> provideNetworkVariancePercent(RxSharedPreferences preferences) {
  return preferences.getInteger("debug_network_variance_percent", 40);
}
 
开发者ID:rogues-dev,项目名称:superglue,代码行数:5,代码来源:DebugDataModule.java


注:本文中的com.f2prateek.rx.preferences.RxSharedPreferences类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。