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

Issue AGILE#155: Changed mask string to constant

Signed-off-by: Lucas Braz Cunha's avatarLucas B. Cunha <lbc16@inf.ufpr.br>
parent 24d4d5a1
......@@ -183,20 +183,20 @@ public class AccountActivity extends AppCompatActivity implements AccountView {
userImgHelper = new UserImgHelper(getBaseContext());
et_cep.addTextChangedListener(Mask.insert("#####-###", et_cep));
et_cep.setFilters(new InputFilter[]{new InputFilter.LengthFilter("#####-###".length())});
et_cep.addTextChangedListener(Mask.insert(Utils.CEP_MASK, et_cep));
et_cep.setFilters(new InputFilter[]{new InputFilter.LengthFilter(Utils.CEP_MASK.length())});
et_phone.addTextChangedListener(Mask.insert("(##)#####-####", et_phone));
et_phone.setFilters(new InputFilter[]{new InputFilter.LengthFilter("(##)#####-####".length())});
et_phone.addTextChangedListener(Mask.insert(Utils.PHONE_MASK, et_phone));
et_phone.setFilters(new InputFilter[]{new InputFilter.LengthFilter(Utils.PHONE_MASK.length())});
et_phone2.addTextChangedListener(Mask.insert("(##)#####-####", et_phone2));
et_phone2.setFilters(new InputFilter[]{new InputFilter.LengthFilter("(##)#####-####".length())});
et_phone2.addTextChangedListener(Mask.insert(Utils.PHONE_MASK, et_phone2));
et_phone2.setFilters(new InputFilter[]{new InputFilter.LengthFilter(Utils.PHONE_MASK.length())});
et_cpf.addTextChangedListener(Mask.insert("###.###.###-##", et_cpf));
et_cpf.setFilters(new InputFilter[]{new InputFilter.LengthFilter("###.###.###-##".length())});
et_cpf.addTextChangedListener(Mask.insert(Utils.CPF_MASK, et_cpf));
et_cpf.setFilters(new InputFilter[]{new InputFilter.LengthFilter(Utils.CPF_MASK.length())});
et_birthdate.addTextChangedListener(Mask.insert("##/##/####", et_birthdate));
et_birthdate.setFilters(new InputFilter[]{new InputFilter.LengthFilter("##/##/####".length())});
et_birthdate.addTextChangedListener(Mask.insert(Utils.BIRTH_DAY_MASK, et_birthdate));
et_birthdate.setFilters(new InputFilter[]{new InputFilter.LengthFilter(Utils.BIRTH_DAY_MASK.length())});
loadData();
......@@ -869,7 +869,7 @@ public class AccountActivity extends AppCompatActivity implements AccountView {
values.put(Utils.NAME, et_name.getText().toString());
values.put(Utils.RG, et_rg.getText().toString());
values.put(Utils.BIRTH_DATE, DateValidator.stringToDate(et_birthdate.getText().toString(), false));
values.put(Utils.BIRTH_DAY, DateValidator.stringToDate(et_birthdate.getText().toString(), false));
if (rb_no.isChecked()) {
values.put(Utils.PCD, null);
......
......@@ -13,6 +13,7 @@ import android.widget.TextView;
import br.ufpr.c3sl.agendador.agendador.helpers.Mask;
import br.ufpr.c3sl.agendador.agendador.helpers.ConnectionErrorDialog;
import br.ufpr.c3sl.agendador.agendador.helpers.Utils;
import br.ufpr.c3sl.agendador.agendador.presenters.CepPresenter;
import br.ufpr.c3sl.agendador.agendador.presenters.PresenterManager;
import br.ufpr.c3sl.agendador.agendador.views.CepView;
......@@ -47,8 +48,8 @@ public class CepActivity extends AppCompatActivity implements CepView {
pb_waiting = (ProgressBar) findViewById(R.id.pb_cepact);
et_cep = (EditText) findViewById(R.id.et_cepact_cep);
et_cep.addTextChangedListener(Mask.insert("#####-###", et_cep));
et_cep.setFilters(new InputFilter[]{new InputFilter.LengthFilter("#####-###".length())});
et_cep.addTextChangedListener(Mask.insert(Utils.CEP_MASK, et_cep));
et_cep.setFilters(new InputFilter[]{new InputFilter.LengthFilter(Utils.CPF_MASK.length())});
et_cep.addTextChangedListener(new CepChangeListener());
......
......@@ -22,7 +22,6 @@ import android.support.v7.widget.Toolbar;
import android.text.Editable;
import android.text.InputFilter;
import android.text.TextWatcher;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
......@@ -158,21 +157,20 @@ public class DependentUpdateActivity extends AppCompatActivity implements Depend
userImgHelper = new UserImgHelper(getBaseContext());
et_disability.setEnabled(false);
et_cep.addTextChangedListener(Mask.insert("#####-###", et_cep));
et_cep.setFilters(new InputFilter[]{new InputFilter.LengthFilter("#####-###".length())});
et_cep.addTextChangedListener(Mask.insert(Utils.CEP_MASK, et_cep));
et_cep.setFilters(new InputFilter[]{new InputFilter.LengthFilter(Utils.CEP_MASK.length())});
et_phone.addTextChangedListener(Mask.insert("(##)#####-####", et_phone));
et_phone.setFilters(new InputFilter[]{new InputFilter.LengthFilter("(##)#####-####".length())});
et_phone.addTextChangedListener(Mask.insert(Utils.PHONE_MASK, et_phone));
et_phone.setFilters(new InputFilter[]{new InputFilter.LengthFilter(Utils.PHONE_MASK.length())});
et_phone2.addTextChangedListener(Mask.insert("(##)#####-####", et_phone2));
et_phone2.setFilters(new InputFilter[]{new InputFilter.LengthFilter("(##)#####-####".length())});
et_phone2.addTextChangedListener(Mask.insert(Utils.PHONE_MASK, et_phone2));
et_phone2.setFilters(new InputFilter[]{new InputFilter.LengthFilter(Utils.PHONE_MASK.length())});
et_cpf.addTextChangedListener(Mask.insert("###.###.###-##", et_cpf));
et_cpf.setFilters(new InputFilter[]{new InputFilter.LengthFilter("###.###.###-##".length())});
et_cpf.addTextChangedListener(Mask.insert(Utils.CPF_MASK, et_cpf));
et_cpf.setFilters(new InputFilter[]{new InputFilter.LengthFilter(Utils.CPF_MASK.length())});
et_birthdate.addTextChangedListener(Mask.insert("##/##/####", et_birthdate));
et_birthdate.setFilters(new InputFilter[]{new InputFilter.LengthFilter("##/##/####".length())});
et_birthdate.addTextChangedListener(Mask.insert(Utils.BIRTH_DAY_MASK, et_birthdate));
et_birthdate.setFilters(new InputFilter[]{new InputFilter.LengthFilter(Utils.BIRTH_DAY_MASK.length())});
try{
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
......@@ -544,7 +542,7 @@ public class DependentUpdateActivity extends AppCompatActivity implements Depend
values.put(Utils.RG, et_rg.getText().toString().trim());
values.put(Utils.BIRTH_DATE, DateValidator.stringToDate(et_birthdate.getText().toString(), false));
values.put(Utils.BIRTH_DAY, DateValidator.stringToDate(et_birthdate.getText().toString(), false));
values.put(Utils.CEP, Mask.unmask(et_cep.getText().toString()));
......
......@@ -67,8 +67,8 @@ public class LoginActivity extends AppCompatActivity implements LoginView {
et_cpf = (EditText) findViewById(R.id.et_loginact_cpf);
et_cpf.addTextChangedListener(Mask.insert("###.###.###-##", et_cpf));
et_cpf.setFilters(new InputFilter[]{new InputFilter.LengthFilter("###.###.###-##".length())});
et_cpf.addTextChangedListener(Mask.insert(Utils.CPF_MASK, et_cpf));
et_cpf.setFilters(new InputFilter[]{new InputFilter.LengthFilter(Utils.CPF_MASK.length())});
et_cpf.addTextChangedListener(new LoginChangeListener());
......
......@@ -23,7 +23,6 @@ import android.support.v7.widget.Toolbar;
import android.text.Editable;
import android.text.InputFilter;
import android.text.TextWatcher;
import android.util.Log;
import android.view.MenuItem;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
......@@ -49,7 +48,6 @@ import br.ufpr.c3sl.agendador.agendador.helpers.UserImgHelper;
import br.ufpr.c3sl.agendador.agendador.helpers.Utils;
import br.ufpr.c3sl.agendador.agendador.helpers.adapters.PhotoSelectionAdapter;
import br.ufpr.c3sl.agendador.agendador.models.FullDependent;
import br.ufpr.c3sl.agendador.agendador.models.UserOutput;
import br.ufpr.c3sl.agendador.agendador.presenters.NewDependentPresenter;
import br.ufpr.c3sl.agendador.agendador.presenters.PresenterManager;
import br.ufpr.c3sl.agendador.agendador.views.NewDependentsView;
......@@ -148,22 +146,21 @@ public class NewDependentActivity extends AppCompatActivity implements NewDepen
userImgHelper = new UserImgHelper(getBaseContext());
et_disability.setEnabled(false);
et_cep.addTextChangedListener(Mask.insert("#####-###", et_cep));
et_cep.setFilters(new InputFilter[]{new InputFilter.LengthFilter("#####-###".length())});
et_phone.addTextChangedListener(Mask.insert("(##)#####-####", et_phone));
et_phone.setFilters(new InputFilter[]{new InputFilter.LengthFilter("(##)#####-####".length())});
et_cep.addTextChangedListener(Mask.insert(Utils.CEP_MASK, et_cep));
et_cep.setFilters(new InputFilter[]{new InputFilter.LengthFilter(Utils.CEP_MASK.length())});
et_phone2.addTextChangedListener(Mask.insert("(##)#####-####", et_phone2));
et_phone2.setFilters(new InputFilter[]{new InputFilter.LengthFilter("(##)#####-####".length())});
et_phone.addTextChangedListener(Mask.insert(Utils.PHONE_MASK, et_phone));
et_phone.setFilters(new InputFilter[]{new InputFilter.LengthFilter(Utils.PHONE_MASK.length())});
et_phone2.addTextChangedListener(Mask.insert(Utils.PHONE_MASK, et_phone2));
et_phone2.setFilters(new InputFilter[]{new InputFilter.LengthFilter(Utils.PHONE_MASK.length())});
et_cpf.addTextChangedListener(Mask.insert("###.###.###-##", et_cpf));
et_cpf.setFilters(new InputFilter[]{new InputFilter.LengthFilter("###.###.###-##".length())});
et_cpf.addTextChangedListener(Mask.insert(Utils.CPF_MASK, et_cpf));
et_cpf.setFilters(new InputFilter[]{new InputFilter.LengthFilter(Utils.CPF_MASK.length())});
et_birthdate.addTextChangedListener(Mask.insert("##/##/####", et_birthdate));
et_birthdate.setFilters(new InputFilter[]{new InputFilter.LengthFilter("##/##/####".length())});
et_birthdate.addTextChangedListener(Mask.insert(Utils.BIRTH_DAY_MASK, et_birthdate));
et_birthdate.setFilters(new InputFilter[]{new InputFilter.LengthFilter(Utils.BIRTH_DAY_MASK.length())});
try{
getSupportActionBar().setDisplayShowTitleEnabled(false);
......@@ -457,7 +454,7 @@ public class NewDependentActivity extends AppCompatActivity implements NewDepen
if(!et_rg.getText().toString().isEmpty())
values.put(Utils.RG, et_rg.getText().toString().trim());
values.put(Utils.BIRTH_DATE, DateValidator.stringToDate(et_birthdate.getText().toString(), false));
values.put(Utils.BIRTH_DAY, DateValidator.stringToDate(et_birthdate.getText().toString(), false));
if (rb_no.isChecked()) {
values.put(Utils.PCD, null);
......
......@@ -12,6 +12,7 @@ import android.widget.ProgressBar;
import android.widget.TextView;
import br.ufpr.c3sl.agendador.agendador.helpers.Mask;
import br.ufpr.c3sl.agendador.agendador.helpers.Utils;
import br.ufpr.c3sl.agendador.agendador.presenters.ForgotPasswordPresenter;
import br.ufpr.c3sl.agendador.agendador.presenters.PresenterManager;
import br.ufpr.c3sl.agendador.agendador.views.ForgotPasswordView;
......@@ -48,8 +49,8 @@ public class PasswordRetrievalActivity extends AppCompatActivity implements Forg
et_cpf = (EditText) findViewById(R.id.et_passwd_retriev_cpf);
et_cpf.addTextChangedListener(Mask.insert("###.###.###-##", et_cpf));
et_cpf.setFilters(new InputFilter[]{new InputFilter.LengthFilter("###.###.###-##".length())});
et_cpf.addTextChangedListener(Mask.insert(Utils.CPF_MASK, et_cpf));
et_cpf.setFilters(new InputFilter[]{new InputFilter.LengthFilter(Utils.CPF_MASK.length())});
pb_waiting = (ProgressBar) findViewById(R.id.pb_passwd_retriev_act);
......
......@@ -85,20 +85,20 @@ public class SignUpActivity extends AppCompatActivity implements SignupView {
btn_back = (Button) findViewById(R.id.btn_signup_back);
btn_signup = (Button) findViewById(R.id.btn_signup_signup);
et_cep.addTextChangedListener(Mask.insert("#####-###", et_cep));
et_cep.setFilters(new InputFilter[]{new InputFilter.LengthFilter("#####-###".length())});
et_cep.addTextChangedListener(Mask.insert(Utils.CEP_MASK, et_cep));
et_cep.setFilters(new InputFilter[]{new InputFilter.LengthFilter(Utils.CEP_MASK.length())});
loadCepData();
et_phone.addTextChangedListener(Mask.insert("(##)#####-####", et_phone));
et_phone.setFilters(new InputFilter[]{new InputFilter.LengthFilter("(##)#####-####".length())});
et_phone.addTextChangedListener(Mask.insert(Utils.PHONE_MASK, et_phone));
et_phone.setFilters(new InputFilter[]{new InputFilter.LengthFilter(Utils.PHONE_MASK.length())});
et_cpf.addTextChangedListener(Mask.insert("###.###.###-##", et_cpf));
et_cpf.setFilters(new InputFilter[]{new InputFilter.LengthFilter("###.###.###-##".length())});
et_cpf.addTextChangedListener(Mask.insert(Utils.CPF_MASK, et_cpf));
et_cpf.setFilters(new InputFilter[]{new InputFilter.LengthFilter(Utils.CPF_MASK.length())});
et_birthday.addTextChangedListener(Mask.insert("##/##/####", et_birthday));
et_birthday.setFilters(new InputFilter[]{new InputFilter.LengthFilter("##/##/####".length())});
et_birthday.addTextChangedListener(Mask.insert(Utils.BIRTH_DAY_MASK, et_birthday));
et_birthday.setFilters(new InputFilter[]{new InputFilter.LengthFilter(Utils.BIRTH_DAY_MASK.length())});
btn_back.setOnClickListener(new View.OnClickListener() {
......@@ -308,7 +308,7 @@ public class SignUpActivity extends AppCompatActivity implements SignupView {
HashMap<String,String> values = new HashMap<String,String>();
values.put(Utils.CPF,Mask.unmask(et_cpf.getText().toString()));
values.put(Utils.BIRTH_DATE, DateValidator.stringToDate(et_birthday.getText().toString(),false));
values.put(Utils.BIRTH_DAY, DateValidator.stringToDate(et_birthday.getText().toString(),false));
values.put(Utils.NAME,et_name.getText().toString());
values.put(Utils.CEP,Mask.unmask(et_cep.getText().toString()));
values.put(Utils.PASSWORD_CONFIRMATION,et_password_confirm.getText().toString());
......
......@@ -74,7 +74,7 @@ public class Utils {
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 BIRTH_DAY = "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";
......@@ -91,6 +91,10 @@ public class Utils {
public static final String PASSWORD_CONFIRMATION = "password_confirmation";
public static final String CURRENT_PASSWORD = "current_password";
public static final int NO_ID = 0;
public static final String CEP_MASK = "#####-###";
public static final String PHONE_MASK = "(##)#####-####";
public static final String CPF_MASK = "###.###.###-##";
public static final String BIRTH_DAY_MASK = "##/##/####";
public static int getPixelValue(int dp, Context context) {
Resources resources = context.getResources();
......
......@@ -77,7 +77,7 @@ public class DependentCreation {
this.phone1 = values.get(Utils.PHONE_1);
this.phone2 = values.get(Utils.PHONE_2);
this.name = values.get(Utils.NAME);
this.birthDate = values.get(Utils.BIRTH_DATE);
this.birthDate = values.get(Utils.BIRTH_DAY);
this.cep = values.get(Utils.CEP);
this.addressComplement = values.get(Utils.ADDRESS_COMPLEMENT);
this.active = values.get(Utils.ACTIVE).equals("true");
......
......@@ -56,7 +56,7 @@ public class UserData {
this.mPhone1 = values.get(Utils.PHONE_1);
this.mPhone2 = values.get(Utils.PHONE_2);
this.mName = values.get(Utils.NAME);
this.mBirth_Date = values.get(Utils.BIRTH_DATE);
this.mBirth_Date = values.get(Utils.BIRTH_DAY);
this.mCep = values.get(Utils.CEP);
this.mAddressComplement = values.get(Utils.ADDRESS_COMPLEMENT);
......
......@@ -100,7 +100,7 @@ public class UserOutput implements Parcelable {
this.mPhone1 = values.get(Utils.PHONE_1);
this.mPhone2 = values.get(Utils.PHONE_2);
this.mName = values.get(Utils.NAME);
this.mBirth_Date = values.get(Utils.BIRTH_DATE);
this.mBirth_Date = values.get(Utils.BIRTH_DAY);
this.mCep = values.get(Utils.CEP);
this.mAddressComplement = values.get(Utils.ADDRESS_COMPLEMENT);
......@@ -204,7 +204,7 @@ public class UserOutput implements Parcelable {
osb.edit().putString(Utils.ADDRESS_COMPLEMENT, this.mAddress.getComplement()).apply();
osb.edit().putString(Utils.CREATED_AT, this.mCreated_At).apply();
osb.edit().putString(Utils.CPF, this.mCpf).apply();
osb.edit().putString(Utils.BIRTH_DATE, this.mBirth_Date).apply();
osb.edit().putString(Utils.BIRTH_DAY, this.mBirth_Date).apply();
osb.edit().putString(Utils.CITY_NAME, this.mCity.mName).apply();
osb.edit().putString(Utils.STATE_NAME, this.mState.mName).apply();
osb.edit().putString(Utils.STATE_ABBREVIATION, this.mState.mAbbreviation).apply();
......
......@@ -49,7 +49,7 @@ public class SignUpPresenter extends BasePresenter<SignupView> {
ApiEndpoints service = ApiUtils.request(header);
Map<String, String> body;
body = signUpPresenter.view().getValues();
User user = new User(body.get(Utils.CPF), body.get(Utils.BIRTH_DATE), body.get(Utils.PASSWORD),
User user = new User(body.get(Utils.CPF), body.get(Utils.BIRTH_DAY), body.get(Utils.PASSWORD),
body.get(Utils.PASSWORD_CONFIRMATION), body.get(Utils.NAME), body.get(Utils.PHONE_1), body.get(Utils.RG), body.get(Utils.CEP),body.get(Utils.EMAIL));
Call<AccountOutput> listCall = service.signUp(user);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment