use of org.flyve.mdm.agent.core.user.UserSchema in project android-mdm-agent by flyve-mdm.
the class EditUserActivity method save.
/**
* Storage information
*/
private void save() {
UserSchema userSchema = new UserSchema();
// -------------
// Emails
// -------------
ArrayList<UserData.EmailsData> arrEmails = new ArrayList<>();
List<EditText> emailEdit = editEmail.getEditList();
List<Spinner> emailTypeEdit = editEmail.getSpinnList();
if (!emailEdit.isEmpty()) {
for (int i = 0; i < emailEdit.size(); i++) {
UserData.EmailsData emails = new UserData(EditUserActivity.this).new EmailsData();
EditText editText = emailEdit.get(i);
Spinner spinner = emailTypeEdit.get(i);
if (!editText.getText().toString().equals("")) {
emails.setEmail(editText.getText().toString());
emails.setType(spinner.getSelectedItem().toString());
arrEmails.add(emails);
}
}
}
if (!arrEmails.isEmpty()) {
userSchema.setEmails(arrEmails);
}
userSchema.setFirstName(editName.getText().toString());
userSchema.setLastName(editLastName.getText().toString());
userSchema.setPicture(strPicture);
userSchema.setLanguage(spinnerLanguage.getSelectedItem().toString());
userSchema.setAdministrativeNumber(editAdministrative.getText().toString());
// Mobile Phone
if (!editPhone.getEditList().isEmpty()) {
String mobilePhone = editPhone.getEditList().get(0).getText().toString();
if (!mobilePhone.equals("")) {
userSchema.setMobilePhone(mobilePhone);
}
}
// Phone
if (editPhone.getEditList().size() > 1) {
String phone = editPhone.getEditList().get(1).getText().toString();
if (!phone.equals("")) {
userSchema.setPhone(phone);
}
}
// Phone 2
if (editPhone.getEditList().size() > 2) {
String phone2 = editPhone.getEditList().get(2).getText().toString();
if (!phone2.equals("")) {
userSchema.setPhone2(phone2);
}
}
presenter.save(EditUserActivity.this, userSchema);
}
Aggregations