Пример #1
0
 public void setUserId(String value) {
   application
       .getSharedPreferences(USER_STORAGE, Context.MODE_PRIVATE)
       .edit()
       .putString(ID_USER_PREFERENCE_KEY, value)
       .apply();
 }
Пример #2
0
 public void setConnected(boolean value) {
   application
       .getSharedPreferences(USER_STORAGE, Context.MODE_PRIVATE)
       .edit()
       .putBoolean(IS_CONNECT_PREFERENCE_KEY, value)
       .apply();
 }
 private void createTestUsers() {
   Application application = getActivity().getApplication();
   SharedPreferences.Editor editor =
       application
           .getSharedPreferences(PreferenceAdapter.PREFERENCES_FILE_COMMON, MODE_PRIVATE)
           .edit();
   Set<String> profiles = new LinkedHashSet<String>();
   profiles.add("Default User");
   profiles.add("John Doe");
   profiles.add("Jayne Doe");
   editor.putStringSet(getString(R.string.profile_entries), profiles);
   editor.commit();
 }
Пример #4
0
 public void onCreate(Application application) {
   SharedPreferences settings = application.getSharedPreferences(SettingsActivity.PREFS_NAME, 0);
   String serverIP = settings.getString(Constants.PROPERTY_NAME_SERVER_IP, Constants.DEFAULT_IP);
   String serverPort =
       settings.getString(Constants.PROPERTY_NAME_SERVER_PORT, Constants.DEFAULT_PORT);
   String serverPassword =
       settings.getString(Constants.PROPERTY_NAME_SERVER_PASSWORD, Constants.DEFAULT_PASSWORD);
   this.controller =
       new OpenWebNetControllerService(
           serverIP, Integer.parseInt(serverPort), Integer.parseInt(serverPassword));
   this.persist = new PersistenceServiceImpl(controller);
   this.application = application;
 }
Пример #5
0
  public AppStaticValue() {
    application = App.getApplication();
    preferences =
        application.getSharedPreferences(StaticField.Preferences.TOKENFILE, App.MODE_PRIVATE);
    UserID = preferences.getString(StaticField.Preferences.USERID, "");
    UserToken = preferences.getString(StaticField.Preferences.USERTOKEN, "");
    UserPhone = preferences.getString(StaticField.Preferences.USERPHONE, "");

    notifiPreferences = PreferenceManager.getDefaultSharedPreferences(application);

    if (UserID.compareTo("") != 0) {
      setDataBaseHelper(UserID);
    }
  }
 @Provides
 @AppScope
 SharedPreferences provideSharedPreferences(Application app) {
   return app.getSharedPreferences("kotlin", Context.MODE_PRIVATE);
 }
Пример #7
0
 public String getUsername() {
   return application
       .getSharedPreferences(USER_STORAGE, Context.MODE_PRIVATE)
       .getString(USERNAME_PREFERENCE_KEY, null);
 }
Пример #8
0
 @Provides
 @Singleton
 SharedPreferences provideSharedPreference(Application app) {
   return app.getSharedPreferences("Latte", Context.MODE_PRIVATE);
 }