private void setupUserIfExists() {
    if (user != null) {
      userType = user.getType();

      setEditTextValue(username, user.getUsername());
      setEditTextValue(email, user.getEmail());
      setEditTextDate(birthday, user.getBirthday());
      setUserGenderValue();
    }
  }
Ejemplo n.º 2
0
  @Override
  protected Boolean doInBackground(User... users) {
    if (users.length == 0) return false;

    User user = users[0];
    Long id = user.save();

    SystemPreferences systemPreferences = new SystemPreferences(context);
    systemPreferences.setUserLoggedId(id);

    return true;
  }
  private void setUserGenderValue() {
    UserGender userGender = new UserGender(getActivity(), user.getGender());
    ArrayAdapter<UserGender> adapter = ((ArrayAdapter<UserGender>) gender.getAdapter());
    int position = adapter.getPosition(userGender);

    gender.setSelection(position);
  }
  @NonNull
  private User createUser() {
    User user = new User();
    user.setType(userType);
    user.setUsername(username.getText().toString());
    user.setEmail(email.getText().toString());
    user.setPassword(password.getText().toString());
    user.setBirthday(getBirthdayDate());

    UserLocale userLocale =
        (UserLocale) country.getAdapter().getItem(country.getSelectedItemPosition());
    String displayCountry = userLocale.getLocale().getDisplayCountry();
    user.setCountry(displayCountry);

    UserGender userGender =
        (UserGender) gender.getAdapter().getItem(gender.getSelectedItemPosition());
    user.setGender(userGender.getGender());
    return user;
  }
Ejemplo n.º 5
0
 @Override
 public void onLoginWithSocialNetwork(final User user) {
   UserServices userServices = new UserServices();
   userServices.getUser(
       user.getKey(),
       new ValueEventListenerAdapter() {
         @Override
         public void onDataChange(DataSnapshot dataSnapshot) {
           if (dataSnapshot.exists()) {
             User user = dataSnapshot.getValue(User.class);
             user.setKey(dataSnapshot.getKey());
             onUserReady(user, false);
           } else {
             addSignUpFragment(user);
           }
         }
       });
 }
 private void bindView(User user) {
   check.setChecked(selectedCoauthors != null && selectedCoauthors.contains(user));
   name.setText(user.getUsername());
 }