Commit c7e669c2 authored by Lucas Braz Cunha's avatar Lucas Braz Cunha

Issue AGILE#199: [WP] Done New Dependent, Update Dependent needs check(back-end issue)

Signed-off-by: Lucas Braz Cunha's avatarLucas B. Cunha <lbc16@inf.ufpr.br>
parent 2c3810a7
...@@ -62,6 +62,7 @@ import br.ufpr.c3sl.agendador.agendador.views.AccountView; ...@@ -62,6 +62,7 @@ import br.ufpr.c3sl.agendador.agendador.views.AccountView;
public class AccountActivity extends AppCompatActivity implements AccountView { public class AccountActivity extends AppCompatActivity implements AccountView {
private EditText et_name, et_cpf, et_rg, et_birthdate, private EditText et_name, et_cpf, et_rg, et_birthdate,
et_disability, et_cep, et_address, et_number, et_neighborhood, et_disability, et_cep, et_address, et_number, et_neighborhood,
et_city, et_state, et_complement, et_phone, et_phone2, et_city, et_state, et_complement, et_phone, et_phone2,
...@@ -317,9 +318,9 @@ public class AccountActivity extends AppCompatActivity implements AccountView { ...@@ -317,9 +318,9 @@ public class AccountActivity extends AppCompatActivity implements AccountView {
android.support.v7.app.AlertDialog.Builder builderSingle = new android.support.v7.app.AlertDialog.Builder(AccountActivity.this); android.support.v7.app.AlertDialog.Builder builderSingle = new android.support.v7.app.AlertDialog.Builder(AccountActivity.this);
//builderSingle.setIcon(R.drawable.ic_action_search); //builderSingle.setIcon(R.drawable.ic_action_search);
//TODO: this message is too long for the dialog. //TODO: this message is too long for the dialog.
builderSingle.setTitle(getString(R.string.prof_pic_dialog)); builderSingle.setTitle(getString(R.string.picture_dialog));
final String[] opts = {getString(R.string.prof_pic_update), getString(R.string.prof_pic_remove)}; final String[] opts = {getString(R.string.picture_update), getString(R.string.picture_remove)};
int[] drawableIds = {android.R.drawable.ic_menu_camera, android.R.drawable.ic_menu_close_clear_cancel}; int[] drawableIds = {android.R.drawable.ic_menu_camera, android.R.drawable.ic_menu_close_clear_cancel};
final PhotoSelectionAdapter arrayAdapter = new PhotoSelectionAdapter(getBaseContext(), opts, drawableIds); final PhotoSelectionAdapter arrayAdapter = new PhotoSelectionAdapter(getBaseContext(), opts, drawableIds);
...@@ -846,45 +847,45 @@ public class AccountActivity extends AppCompatActivity implements AccountView { ...@@ -846,45 +847,45 @@ public class AccountActivity extends AppCompatActivity implements AccountView {
public HashMap<String, String> getValues() { public HashMap<String, String> getValues() {
HashMap<String, String> values = new HashMap<>(); HashMap<String, String> values = new HashMap<>();
values.put("name", et_name.getText().toString()); values.put(Utils.NAME, et_name.getText().toString());
values.put("rg", et_rg.getText().toString()); values.put(Utils.RG, et_rg.getText().toString());
values.put("birth_date", DateValidator.stringToDate(et_birthdate.getText().toString(), false)); values.put(Utils.BIRTH_DATE, DateValidator.stringToDate(et_birthdate.getText().toString(), false));
if (rb_no.isChecked()) { if (rb_no.isChecked()) {
values.put("pcd", null); values.put(Utils.PCD, null);
} else { } else {
if (et_disability.getText().toString().isEmpty()) { if (et_disability.getText().toString().isEmpty()) {
values.put("pcd", null); values.put(Utils.PCD, null);
} else { } else {
values.put("pcd", et_disability.getText().toString()); values.put(Utils.PCD, et_disability.getText().toString());
} }
} }
values.put("cep", Mask.unmask(et_cep.getText().toString())); values.put(Utils.CEP, Mask.unmask(et_cep.getText().toString()));
values.put("address_number", et_number.getText().toString()); values.put(Utils.ADDRESS_NUMBER, et_number.getText().toString());
values.put("address_complement", et_complement.getText().toString()); values.put(Utils.ADDRESS_COMPLEMENT, et_complement.getText().toString());
values.put("phone1", Mask.unmask(et_phone.getText().toString())); values.put(Utils.PHONE_1, Mask.unmask(et_phone.getText().toString()));
values.put("phone2", Mask.unmask(et_phone2.getText().toString())); values.put(Utils.PHONE_2, Mask.unmask(et_phone2.getText().toString()));
values.put("email", et_email.getText().toString()); values.put(Utils.EMAIL, et_email.getText().toString());
if (et_new_password.getText().toString().isEmpty() && et_new_password.getText().toString().isEmpty()) { if (et_new_password.getText().toString().isEmpty() && et_new_password.getText().toString().isEmpty()) {
values.put("password", null); values.put(Utils.PASSWORD, null);
values.put("password_confirmation", null); values.put(Utils.PASSWORD_CONFIRMATION, null);
} else { } else {
values.put("current_password", this.current_password); values.put(Utils.CURRENT_PASSWORD, this.current_password);
values.put("password", et_new_password.getText().toString()); values.put(Utils.PASSWORD, et_new_password.getText().toString());
values.put("password_confirmation", et_password_confirmation.getText().toString()); values.put(Utils.PASSWORD_CONFIRMATION, et_password_confirmation.getText().toString());
} }
if(isChangingPhoto) { if(isChangingPhoto) {
if(isPhotoDelete) { if(isPhotoDelete) {
values.put("photo_type", "delete"); values.put(Utils.PHOTO_TYPE, "delete");
}else { }else {
values.put("photo_content", Utils.getBase64FromFile(userImgHelper.getTempFilePath(Utils.USR_PICT_FILE_NAME, id))); values.put(Utils.PHOTO_CONTENT, Utils.getBase64FromFile(userImgHelper.getTempFilePath(Utils.USR_PICT_FILE_NAME, id)));
values.put("photo_type", "image/png"); values.put(Utils.PHOTO_TYPE, "image/png");
// TODO: 03/05/17 Change here to work with multi photo types // TODO: 03/05/17 Change here to work with multi photo types
values.put("photo_name", id + ".png"); values.put(Utils.PHOTO_NAME, id + ".png");
} }
} }
...@@ -978,7 +979,7 @@ public class AccountActivity extends AppCompatActivity implements AccountView { ...@@ -978,7 +979,7 @@ public class AccountActivity extends AppCompatActivity implements AccountView {
// Filesystem. // Filesystem.
final Intent galleryIntent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI); final Intent galleryIntent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
galleryIntent.setType("image/*"); galleryIntent.setType("image/*");
chooserIntent = Intent.createChooser(galleryIntent, getString(R.string.prof_pic_chooser)); chooserIntent = Intent.createChooser(galleryIntent, getString(R.string.picture_chooser));
} }
if(hasCameraPermission) { if(hasCameraPermission) {
...@@ -999,7 +1000,7 @@ public class AccountActivity extends AppCompatActivity implements AccountView { ...@@ -999,7 +1000,7 @@ public class AccountActivity extends AppCompatActivity implements AccountView {
} }
if(!hasReadPermission) { if(!hasReadPermission) {
chooserIntent = Intent.createChooser(cameraIntents.get(cameraIntents.size() - 1), getString(R.string.prof_pic_chooser)); chooserIntent = Intent.createChooser(cameraIntents.get(cameraIntents.size() - 1), getString(R.string.picture_chooser));
cameraIntents.remove(cameraIntents.get(cameraIntents.size() - 1)); cameraIntents.remove(cameraIntents.get(cameraIntents.size() - 1));
chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, cameraIntents.toArray(new Parcelable[cameraIntents.size()])); chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, cameraIntents.toArray(new Parcelable[cameraIntents.size()]));
} }
......
...@@ -12,6 +12,7 @@ import android.support.design.widget.FloatingActionButton; ...@@ -12,6 +12,7 @@ import android.support.design.widget.FloatingActionButton;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.View; import android.view.View;
import android.widget.Button; import android.widget.Button;
import android.widget.ProgressBar; import android.widget.ProgressBar;
...@@ -47,6 +48,12 @@ public class DependentsListActivity extends AppCompatActivity implements Depende ...@@ -47,6 +48,12 @@ public class DependentsListActivity extends AppCompatActivity implements Depende
private List<Dependent> dependents; private List<Dependent> dependents;
private boolean updateList;
private static final int DEPENDENT_UPDATE_CODE = 1;
private static final int NEW_DEPENDENT_CODE = 2;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
...@@ -61,7 +68,7 @@ public class DependentsListActivity extends AppCompatActivity implements Depende ...@@ -61,7 +68,7 @@ public class DependentsListActivity extends AppCompatActivity implements Depende
setContentView(R.layout.activity_dependents_list); setContentView(R.layout.activity_dependents_list);
FloatingActionButton fab_new_dependent = (FloatingActionButton) findViewById(R.id.fab_new_dependent); FloatingActionButton fabNewDependent = (FloatingActionButton) findViewById(R.id.fab_new_dependent);
pb_dependents = (ProgressBar) findViewById(R.id.pb_dependentact); pb_dependents = (ProgressBar) findViewById(R.id.pb_dependentact);
...@@ -87,17 +94,18 @@ public class DependentsListActivity extends AppCompatActivity implements Depende ...@@ -87,17 +94,18 @@ public class DependentsListActivity extends AppCompatActivity implements Depende
} }
})); }));
fab_new_dependent.setOnClickListener(new View.OnClickListener() { fabNewDependent.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
Intent intent = new Intent(DependentsListActivity.this, NewDependentActivity.class); Intent intent = new Intent(DependentsListActivity.this, NewDependentActivity.class);
startActivity(intent); startActivityForResult(intent, NEW_DEPENDENT_CODE);
} }
}); });
} }
public void successfulDependents(List<Dependent> dependents) { public void successfulDependents(List<Dependent> dependents) {
this.dependents = dependents; this.dependents = dependents;
updateList = false;
showLayout(true); showLayout(true);
} }
...@@ -108,8 +116,7 @@ public class DependentsListActivity extends AppCompatActivity implements Depende ...@@ -108,8 +116,7 @@ public class DependentsListActivity extends AppCompatActivity implements Depende
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();
bundle.putParcelable(Utils.CITIZEN, dependent); bundle.putParcelable(Utils.CITIZEN, dependent);
intent.putExtra(Utils.CITIZEN_BUNDLE, bundle); intent.putExtra(Utils.CITIZEN_BUNDLE, bundle);
startActivity(intent); startActivityForResult(intent, DEPENDENT_UPDATE_CODE);
finish();
} }
...@@ -136,8 +143,29 @@ public class DependentsListActivity extends AppCompatActivity implements Depende ...@@ -136,8 +143,29 @@ public class DependentsListActivity extends AppCompatActivity implements Depende
} }
} }
public void afterPictureFailed(){ public void afterPictureFailed(){
Toast.makeText(this, "Ocorreu um problema ao carregar sua foto de perfil", Toast.LENGTH_SHORT).show(); Toast.makeText(this, "Ocorreu um problema ao carregar a foto", Toast.LENGTH_SHORT).show();
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
switch (requestCode){
case DEPENDENT_UPDATE_CODE:
break;
case NEW_DEPENDENT_CODE:
if(resultCode == Activity.RESULT_OK){
updateList = true;
}
/* do nothing
if (resultCode == Activity.RESULT_CANCELED) {
//Write your code if there's no result
}*/
break;
default:
break;
}
} }
...@@ -150,7 +178,7 @@ public class DependentsListActivity extends AppCompatActivity implements Depende ...@@ -150,7 +178,7 @@ public class DependentsListActivity extends AppCompatActivity implements Depende
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
presenter.bindView(this); presenter.bindView(this);
if(dependents == null) if(dependents == null || updateList)
presenter.requestDependents(); presenter.requestDependents();
} }
...@@ -180,6 +208,7 @@ public class DependentsListActivity extends AppCompatActivity implements Depende ...@@ -180,6 +208,7 @@ public class DependentsListActivity extends AppCompatActivity implements Depende
rv_dependents.setVisibility(View.INVISIBLE); rv_dependents.setVisibility(View.INVISIBLE);
} else { } else {
pb_dependents.setVisibility(View.INVISIBLE); pb_dependents.setVisibility(View.INVISIBLE);
rv_dependents.setVisibility(View.VISIBLE);
} }
} }
......
...@@ -20,6 +20,7 @@ import br.ufpr.c3sl.agendador.agendador.helpers.ConnectionChecker; ...@@ -20,6 +20,7 @@ import br.ufpr.c3sl.agendador.agendador.helpers.ConnectionChecker;
import br.ufpr.c3sl.agendador.agendador.helpers.ConnectionErrorDialog; import br.ufpr.c3sl.agendador.agendador.helpers.ConnectionErrorDialog;
import br.ufpr.c3sl.agendador.agendador.helpers.DateValidator; import br.ufpr.c3sl.agendador.agendador.helpers.DateValidator;
import br.ufpr.c3sl.agendador.agendador.helpers.Mask; import br.ufpr.c3sl.agendador.agendador.helpers.Mask;
import br.ufpr.c3sl.agendador.agendador.helpers.Utils;
import br.ufpr.c3sl.agendador.agendador.presenters.PresenterManager; import br.ufpr.c3sl.agendador.agendador.presenters.PresenterManager;
import br.ufpr.c3sl.agendador.agendador.presenters.SignUpPresenter; import br.ufpr.c3sl.agendador.agendador.presenters.SignUpPresenter;
import br.ufpr.c3sl.agendador.agendador.views.SignupView; import br.ufpr.c3sl.agendador.agendador.views.SignupView;
...@@ -297,15 +298,15 @@ public class SignUpActivity extends AppCompatActivity implements SignupView { ...@@ -297,15 +298,15 @@ public class SignUpActivity extends AppCompatActivity implements SignupView {
public HashMap<String,String> getValues(){ public HashMap<String,String> getValues(){
HashMap<String,String> values = new HashMap<String,String>(); HashMap<String,String> values = new HashMap<String,String>();
values.put("cpf",Mask.unmask(et_cpf.getText().toString())); values.put(Utils.CPF,Mask.unmask(et_cpf.getText().toString()));
values.put("birth_date", DateValidator.stringToDate(et_birthday.getText().toString(),false)); values.put(Utils.BIRTH_DATE, DateValidator.stringToDate(et_birthday.getText().toString(),false));
values.put("name",et_name.getText().toString()); values.put(Utils.NAME,et_name.getText().toString());
values.put("cep",Mask.unmask(et_cep.getText().toString())); values.put(Utils.CEP,Mask.unmask(et_cep.getText().toString()));
values.put("password_confirmation",et_password_confirm.getText().toString()); values.put(Utils.PASSWORD_CONFIRMATION,et_password_confirm.getText().toString());
values.put("password",et_password.getText().toString()); values.put(Utils.PASSWORD,et_password.getText().toString());
values.put("email",et_email.getText().toString()); values.put(Utils.EMAIL,et_email.getText().toString());
values.put("phone1",Mask.unmask(et_phone.getText().toString())); values.put(Utils.PHONE_1,Mask.unmask(et_phone.getText().toString()));
values.put("rg",et_rg.getText().toString()); values.put(Utils.RG,et_rg.getText().toString());
return values; return values;
} }
......
...@@ -4,6 +4,8 @@ import android.content.Context; ...@@ -4,6 +4,8 @@ import android.content.Context;
import android.content.res.Resources; import android.content.res.Resources;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.BitmapFactory; import android.graphics.BitmapFactory;
import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.util.Base64; import android.util.Base64;
...@@ -21,6 +23,8 @@ import java.io.IOException; ...@@ -21,6 +23,8 @@ import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.Calendar; import java.util.Calendar;
import br.ufpr.c3sl.agendador.agendador.models.UserOutput;
/** /**
* Created by Lucas B. Cunha on 31/03/17. * Created by Lucas B. Cunha on 31/03/17.
*/ */
...@@ -48,7 +52,44 @@ public class Utils { ...@@ -48,7 +52,44 @@ public class Utils {
public static final String CITIZEN_BUNDLE = "br.ufpr.c3sl.agendador.agendador.citizen_bundle"; public static final String CITIZEN_BUNDLE = "br.ufpr.c3sl.agendador.agendador.citizen_bundle";
public static final String JOB_FILE_NAME = "fileName_tag"; public static final String JOB_FILE_NAME = "fileName_tag";
public static final String ADDRESS_NEIGHBORHOOD = "address.neighborhood";
public static final String ADDRESS_NUMBER = "address_number";
public static final String UPDATED_AT = "updated_at";
public static final String ADDRESS_ADDRESS = "address.address";
public static final String AVATAR_UPDATED_AT = "avatar_updated_at";
public static final String ID = "id";
public static final String PHOTO_CONTENT_TYPE = "photo_content_type";
public static final String PHOTO_FILE_NAME = "photo_file_name";
public static final String PHOTO_FILE_SIZE = "photo_file_size";
public static final String NOTE = "note";
public static final String RG = "rg";
public static final String EMAIL = "email";
public static final String PCD = "pcd";
public static final String ACCOUNT_ID = "account_id";
public static final String PHONE_2 = "phone2";
public static final String PHONE_1 = "phone1";
public static final String RESPONSIBLE_ID = "responsible_id";
public static final String ADDRESS_ZIPCODE = "address.zipcode";
public static final String NAME = "name";
public static final String ADDRESS_COMPLEMENT = "address.complement";
public static final String CREATED_AT = "created_at";
public static final String CPF = "cpf";
public static final String BIRTH_DATE = "birth_date";
public static final String CITY_NAME = "city.name";
public static final String STATE_NAME = "state.name";
public static final String STATE_ABBREVIATION = "state.abbreviation";
public static final String CEP = "cep";
public static final String UID = "uid";
public static final String ACCESS_TOKEN = "access-token";
public static final String CLIENT = "client";
public static final String EXPIRY = "expiry";
public static final String PHOTO_CONTENT = "photo_content";
public static final String PHOTO_TYPE = "photo_type";
public static final String PHOTO_NAME = "photo_name";
public static final String ACTIVE = "active";
public static final String PASSWORD = "password";
public static final String PASSWORD_CONFIRMATION = "password_confirmation";
public static final String CURRENT_PASSWORD = "current_password";
public static int getPixelValue(int dp, Context context) { public static int getPixelValue(int dp, Context context) {
Resources resources = context.getResources(); Resources resources = context.getResources();
......
...@@ -4,6 +4,8 @@ import com.google.gson.annotations.SerializedName; ...@@ -4,6 +4,8 @@ import com.google.gson.annotations.SerializedName;
import java.util.Map; import java.util.Map;
import br.ufpr.c3sl.agendador.agendador.helpers.Utils;
/** /**
* Created by lbc16 on 30/08/17. * Created by lbc16 on 30/08/17.
*/ */
...@@ -68,18 +70,18 @@ public class DependentCreation { ...@@ -68,18 +70,18 @@ public class DependentCreation {
private Image image; private Image image;
DependentData(Map<String, String> values) { DependentData(Map<String, String> values) {
this.addressNumber = values.get("address_number"); this.addressNumber = values.get(Utils.ADDRESS_NUMBER);
this.rg = values.get("rg"); this.rg = values.get(Utils.RG);
this.email = values.get("email"); this.email = values.get(Utils.EMAIL);
this.pcd = values.get("pcd"); this.pcd = values.get(Utils.PCD);
this.phone2 = values.get("phone2"); this.phone1 = values.get(Utils.PHONE_1);
this.phone1 = values.get("phone1"); this.phone2 = values.get(Utils.PHONE_2);
this.name = values.get("name"); this.name = values.get(Utils.NAME);
this.birthDate = values.get("birth_date"); this.birthDate = values.get(Utils.BIRTH_DATE);
this.cep = values.get("cep"); this.cep = values.get(Utils.CEP);
this.addressComplement = values.get("address_complement"); this.addressComplement = values.get(Utils.ADDRESS_COMPLEMENT);
this.active = values.get("active").equals("true"); this.active = values.get(Utils.ACTIVE).equals("true");
this.cpf = values.get("cpf"); this.cpf = values.get(Utils.CPF);
} }
......
...@@ -57,13 +57,17 @@ public class FullDependent implements Parcelable{ ...@@ -57,13 +57,17 @@ public class FullDependent implements Parcelable{
dest.writeParcelable(info, flags); dest.writeParcelable(info, flags);
} }
@Override @Override
public int describeContents() { public int describeContents() {
return 0; return 0;
} }
public UserOutput getInfo() { public UserOutput getInfo() {
return info; return info;
} }
public long getId() {
return id;
}
} }
...@@ -4,6 +4,8 @@ import com.google.gson.annotations.SerializedName; ...@@ -4,6 +4,8 @@ import com.google.gson.annotations.SerializedName;
import java.util.Map; import java.util.Map;
import br.ufpr.c3sl.agendador.agendador.helpers.Utils;
/** /**
* Created by Bruno Freitas Tissei on 2/3/17. * Created by Bruno Freitas Tissei on 2/3/17.
*/ */
...@@ -47,16 +49,16 @@ public class UserData { ...@@ -47,16 +49,16 @@ public class UserData {
private Image mImage; private Image mImage;
public UserData(Map<String, String> values) { public UserData(Map<String, String> values) {
this.mAddress_Number = values.get("address_number"); this.mAddress_Number = values.get(Utils.ADDRESS_NUMBER);
this.mRg = values.get("rg"); this.mRg = values.get(Utils.RG);
this.mEmail = values.get("email"); this.mEmail = values.get(Utils.EMAIL);
this.mPcd = values.get("pcd"); this.mPcd = values.get(Utils.PCD);
this.mPhone2 = values.get("phone2"); this.mPhone1 = values.get(Utils.PHONE_1);
this.mPhone1 = values.get("phone1"); this.mPhone2 = values.get(Utils.PHONE_2);
this.mName = values.get("name"); this.mName = values.get(Utils.NAME);
this.mBirth_Date = values.get("birth_date"); this.mBirth_Date = values.get(Utils.BIRTH_DATE);
this.mCep = values.get("cep"); this.mCep = values.get(Utils.CEP);
this.mAddressComplement = values.get("address_complement"); this.mAddressComplement = values.get(Utils.ADDRESS_COMPLEMENT);
} }
......
...@@ -9,6 +9,7 @@ import com.google.gson.annotations.SerializedName; ...@@ -9,6 +9,7 @@ import com.google.gson.annotations.SerializedName;
import java.util.Map; import java.util.Map;
import br.ufpr.c3sl.agendador.agendador.helpers.ObscuredSharedPreferences; import br.ufpr.c3sl.agendador.agendador.helpers.ObscuredSharedPreferences;
import br.ufpr.c3sl.agendador.agendador.helpers.Utils;
/** /**
* Created by Bruno Freitas Tissei on 2/3/17. * Created by Bruno Freitas Tissei on 2/3/17.
...@@ -92,16 +93,16 @@ public class UserOutput implements Parcelable { ...@@ -92,16 +93,16 @@ public class UserOutput implements Parcelable {
private String mAddressComplement; private String mAddressComplement;
public UserOutput(Map<String,String> values){ public UserOutput(Map<String,String> values){
this.mAddressNumber = values.get("address_number"); this.mAddressNumber = values.get(Utils.ADDRESS_NUMBER);
this.mRg = values.get("rg"); this.mRg = values.get(Utils.RG);
this.mEmail = values.get("email"); this.mEmail = values.get(Utils.EMAIL);
this.mPcd = values.get("pcd"); this.mPcd = values.get(Utils.PCD);
this.mPhone2 = values.get("phone2"); this.mPhone1 = values.get(Utils.PHONE_1);
this.mPhone1 = values.get("phone1"); this.mPhone2 = values.get(Utils.PHONE_2);
this.mName = values.get("name"); this.mName = values.get(Utils.NAME);
this.mBirth_Date = values.get("birth_date"); this.mBirth_Date = values.get(Utils.BIRTH_DATE);
this.mCep = values.get("cep"); this.mCep = values.get(Utils.CEP);
this.mAddressComplement = values.get("address_complement"); this.mAddressComplement = values.get(Utils.ADDRESS_COMPLEMENT);
} }
...@@ -176,40 +177,40 @@ public class UserOutput implements Parcelable { ...@@ -176,40 +177,40 @@ public class UserOutput implements Parcelable {
mAddressComplement = pc.readString(); mAddressComplement = pc.readString();
} }
public void save(Context context) { public void save(Context context) {
ObscuredSharedPreferences osb = ObscuredSharedPreferences.getPrefs(context, "Agendador", ObscuredSharedPreferences osb = ObscuredSharedPreferences.getPrefs(context, "Agendador",
Context.MODE_PRIVATE); Context.MODE_PRIVATE);
osb.edit().putString("address.neighborhood", this.mAddress.getNeighborhood()).apply(); osb.edit().putString(Utils.ADDRESS_NEIGHBORHOOD, this.mAddress.getNeighborhood()).apply();
osb.edit().putString("address_number", this.mAddressNumber).apply(); osb.edit().putString(Utils.ADDRESS_NUMBER, this.mAddressNumber).apply();
osb.edit().putString("updated_at", this.mUpdated_At).apply(); osb.edit().putString(Utils.UPDATED_AT, this.mUpdated_At).apply();
osb.edit().putString("address.address", this.mAddress.getAddress()).apply(); osb.edit().putString(Utils.ADDRESS_ADDRESS, this.mAddress.getAddress()).apply();
osb.edit().putString("avatar_updated_at", this.mPhoto_Update_At).apply(); osb.edit().putString(Utils.AVATAR_UPDATED_AT, this.mPhoto_Update_At).apply();
osb.edit().putLong("id", this.mId).apply(); osb.edit().putLong(Utils.ID, this.mId).apply();
osb.edit().putString("photo_content_type", this.mPhoto_Content_Type).apply(); osb.edit().putString(Utils.PHOTO_CONTENT_TYPE, this.mPhoto_Content_Type).apply();
osb.edit().putString("photo_file_name", this.mPhoto_File_Name).apply(); osb.edit().putString(Utils.PHOTO_FILE_NAME, this.mPhoto_File_Name).apply();
osb.edit().putString("photo_file_size", this.mPhoto_File_Size).apply(); osb.edit().putString(Utils.PHOTO_FILE_SIZE, this.mPhoto_File_Size).apply();
osb.edit().putString("note", this.mNote).apply(); osb.edit().putString(Utils.NOTE, this.mNote).apply();
osb.edit().putString("rg", this.mRg).apply(); osb.edit().putString(Utils.RG, this.mRg).apply();
osb.edit().putString("email", this.mEmail).apply(); osb.edit().putString(Utils.EMAIL, this.mEmail).apply();
osb.edit().putString("pcd", this.mPcd).apply(); osb.edit().putString(Utils.PCD, this.mPcd).apply();
osb.edit().putInt("account_id", this.mAccount_Id).apply(); osb.edit().putInt(Utils.ACCOUNT_ID, this.mAccount_Id).apply();
osb.edit().putString("phone2", this.mPhone2).apply(); osb.edit().putString(Utils.PHONE_2, this.mPhone2).apply();
osb.edit().putString("phone1", this.mPhone1).apply(); osb.edit().putString(Utils.PHONE_1, this.mPhone1).apply();
osb.edit().putInt("responsible_id", this.mResponsible_Id).apply(); osb.edit().putInt(Utils.RESPONSIBLE_ID, this.mResponsible_Id).apply();
osb.edit().putString("address.zipcode", this.mAddress.getZipcode()).apply(); osb.edit().putString(Utils.ADDRESS_ZIPCODE, this.mAddress.getZipcode()).apply();
osb.edit().putBoolean("active", this.mActive).apply(); osb.edit().putBoolean(Utils.ACTIVE, this.mActive).apply();
osb.edit().putString("name", this.mName).apply(); osb.edit().putString(Utils.NAME, this.mName).apply();
osb.edit().putString("address.complement", this.mAddress.getComplement()).apply(); osb.edit().putString(Utils.ADDRESS_COMPLEMENT, this.mAddress.getComplement()).apply();
osb.edit().putString("created_at", this.mCreated_At).apply(); osb.edit().putString(Utils.CREATED_AT, this.mCreated_At).apply();
osb.edit().putString("cpf", this.mCpf).apply(); osb.edit().putString(Utils.CPF, this.mCpf).apply();
osb.edit().putString("birth_date", this.mBirth_Date).apply(); osb.edit().putString(Utils.BIRTH_DATE, this.mBirth_Date).apply();
osb.edit().putString("city.name", this.mCity.mName).apply(); osb.edit().putString(Utils.CITY_NAME, this.mCity.mName).apply();
osb.edit().putString("state.name", this.mState.mName).apply(); osb.edit().putString(Utils.STATE_NAME