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


Java RxSharedPreferences.getString方法代码示例

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


在下文中一共展示了RxSharedPreferences.getString方法的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: 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

示例3: 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

示例4: provideAccessToken

import com.f2prateek.rx.preferences.RxSharedPreferences; //导入方法依赖的package包/类
@Provides @Singleton @AccessToken Preference<String> provideAccessToken(RxSharedPreferences prefs) {
  return prefs.getString("access-token");
}
 
开发者ID:donglua,项目名称:ZoomEyeAndroid,代码行数:4,代码来源:DataModule.java

示例5: provideAccessToken

import com.f2prateek.rx.preferences.RxSharedPreferences; //导入方法依赖的package包/类
@Provides @ApplicationScope @AccessToken Preference<String> provideAccessToken(RxSharedPreferences prefs) {
  return prefs.getString("access-token");
}
 
开发者ID:donglua,项目名称:GitHubClient,代码行数:4,代码来源:DataModule.java

示例6: 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());
            }
        }
    }
 
开发者ID:soarcn,项目名称:Favor,代码行数:72,代码来源:MethodInfo.java

示例7: provideRxSyncId

import com.f2prateek.rx.preferences.RxSharedPreferences; //导入方法依赖的package包/类
@Provides @PerApp @Named(PreferenceHelper.SYNC_ID) Preference<String> provideRxSyncId(
    RxSharedPreferences preferences) {
  return preferences.getString(PreferenceHelper.SYNC_ID, null);
}
 
开发者ID:drymarev,项目名称:rxbsuir,代码行数:5,代码来源:PreferencesModule.java

示例8: provideRxTitle

import com.f2prateek.rx.preferences.RxSharedPreferences; //导入方法依赖的package包/类
@Provides @PerApp @Named(PreferenceHelper.TITLE) Preference<String> provideRxTitle(
    RxSharedPreferences preferences, Application application) {
  return preferences.getString(PreferenceHelper.TITLE, application.getString(R.string.app_name));
}
 
开发者ID:drymarev,项目名称:rxbsuir,代码行数:5,代码来源:PreferencesModule.java

示例9: provideRxFavoriteSyncId

import com.f2prateek.rx.preferences.RxSharedPreferences; //导入方法依赖的package包/类
@Provides @PerApp @Named(PreferenceHelper.FAVORITE_SYNC_ID)
Preference<String> provideRxFavoriteSyncId(RxSharedPreferences preferences) {
  return preferences.getString(PreferenceHelper.FAVORITE_SYNC_ID, null);
}
 
开发者ID:drymarev,项目名称:rxbsuir,代码行数:5,代码来源:PreferencesModule.java

示例10: provideRxFavoriteTitle

import com.f2prateek.rx.preferences.RxSharedPreferences; //导入方法依赖的package包/类
@Provides @PerApp @Named(PreferenceHelper.FAVORITE_TITLE)
Preference<String> provideRxFavoriteTitle(RxSharedPreferences preferences) {
  return preferences.getString(PreferenceHelper.FAVORITE_TITLE, null);
}
 
开发者ID:drymarev,项目名称:rxbsuir,代码行数:5,代码来源:PreferencesModule.java

示例11: provide

import com.f2prateek.rx.preferences.RxSharedPreferences; //导入方法依赖的package包/类
@Provides @PerApp @Named(PreferenceHelper.NIGHT_MODE) Preference<String> provide(
    RxSharedPreferences prefs) {
  return prefs.getString(PreferenceHelper.NIGHT_MODE,
      String.valueOf(AppCompatDelegate.MODE_NIGHT_NO));
}
 
开发者ID:drymarev,项目名称:rxbsuir,代码行数:6,代码来源:NightModePreferenceModule.java

示例12: provideEndpointPreference

import com.f2prateek.rx.preferences.RxSharedPreferences; //导入方法依赖的package包/类
@Provides
@ApplicationScope
@ApiEndpoint
Preference<String> provideEndpointPreference(RxSharedPreferences prefs) {
    return prefs.getString("debug_endpoint", ApiEndpoints.MOCK_MODE.url);
}
 
开发者ID:LiveTyping,项目名称:u2020-mvp,代码行数:7,代码来源:DebugDataModule.java

示例13: provideAccessToken

import com.f2prateek.rx.preferences.RxSharedPreferences; //导入方法依赖的package包/类
@Provides @Singleton @AccessToken
Preference<String> provideAccessToken(RxSharedPreferences prefs) {
  return prefs.getString("access-token");
}
 
开发者ID:JakeWharton,项目名称:u2020,代码行数:5,代码来源:DataModule.java

示例14: provideAccessToken

import com.f2prateek.rx.preferences.RxSharedPreferences; //导入方法依赖的package包/类
@Provides @Singleton @AccessToken Preference<String> provideAccessToken(RxSharedPreferences prefs,
    @ApiEndpoint Preference<String> endpoint) {
  // Return an endpoint-specific preference.
  return prefs.getString("access-token-" + endpoint.get());
}
 
开发者ID:JakeWharton,项目名称:u2020,代码行数:6,代码来源:DebugDataModule.java

示例15: provideEndpointPreference

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


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