private void sendUserService(DatosUsuario datosUsuario) { boolean isEnabled = gameUtils.internetAvailable(getApplication()); if (isEnabled) { } else { Toast.makeText(getApplication(), "Debes estar conectado a intenet", Toast.LENGTH_LONG).show(); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // FacebookSdk.sdkInitialize(getApplicationContext()); setContentView(getLayout()); ButterKnife.bind(this); gameUtils = GameUtils.getInstance(this); init(); edt_borndate.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { DialogFragment dialogFragment = new DatePickerFragment(); dialogFragment.show(getFragmentManager(), "Date"); } }); btn_continue.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { /* Intent navIntent = new Intent(RegisterActivity.this, MainActivity.class); navIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(navIntent);*/ validateData(); } }); btn_cancel.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { // onBackPressed(); Aviso aviso = new Aviso(getApplicationContext()); aviso.show(); } }); }
@Override public void setFontInViews() { txt_title.setTypeface(gameUtils.getTypefaceGame(getApplication(), Constants.FONT_BOLD)); txt_borndate.setTypeface(gameUtils.getTypefaceGame(getApplication(), Constants.FONT_REGULAR)); edt_name.setTypeface(gameUtils.getTypefaceGame(getApplication(), Constants.FONT_REGULAR)); edt_last_name_p.setTypeface( gameUtils.getTypefaceGame(getApplication(), Constants.FONT_REGULAR)); edt_last_name_m.setTypeface( gameUtils.getTypefaceGame(getApplication(), Constants.FONT_REGULAR)); edt_email.setTypeface(gameUtils.getTypefaceGame(getApplication(), Constants.FONT_REGULAR)); edt_password.setTypeface(gameUtils.getTypefaceGame(getApplication(), Constants.FONT_REGULAR)); edt_repeat_password.setTypeface( gameUtils.getTypefaceGame(getApplication(), Constants.FONT_REGULAR)); edt_tutor_name.setTypeface(gameUtils.getTypefaceGame(getApplication(), Constants.FONT_REGULAR)); edt_tutor_last_name.setTypeface( gameUtils.getTypefaceGame(getApplication(), Constants.FONT_REGULAR)); btn_continue.setTypeface(gameUtils.getTypefaceGame(getApplication(), Constants.FONT_BOLD)); // btn_cancel.setTypeface(gameUtils.getTypefaceGame(getApplication(), Constants.FONT_BOLD)); }
void validateData() { boolean cancel = false; View focusView = null; String name_user = edt_name.getText().toString(); String ln_p = edt_last_name_p.getText().toString(); String ln_m = edt_last_name_m.getText().toString(); String email = edt_email.getText().toString(); String password = edt_password.getText().toString(); String password_repeat = edt_repeat_password.getText().toString(); String fecha_nacimiento = edt_borndate.getText().toString(); String tutor = edt_tutor_name.getText().toString(); String tutor_last_name = edt_tutor_last_name.getText().toString(); boolean acept = cb_aviso.isChecked(); if (TextUtils.isEmpty(name_user)) { edt_name.setError(getString(R.string.error_fiel_requiered)); focusView = edt_name; cancel = true; } if (TextUtils.isEmpty(ln_p)) { edt_last_name_p.setError(getString(R.string.error_fiel_requiered)); focusView = edt_last_name_p; cancel = true; } if (TextUtils.isEmpty(ln_m)) { edt_last_name_m.setError(getString(R.string.error_fiel_requiered)); focusView = edt_last_name_m; cancel = true; } if (TextUtils.isEmpty(email)) { edt_email.setError(getString(R.string.error_fiel_requiered)); focusView = edt_email; cancel = true; } else if (!isEmailValid(email)) { edt_email.setError(getString(R.string.error_fiel_email)); focusView = edt_email; cancel = true; } if (TextUtils.isEmpty(password)) { edt_password.setError(getString(R.string.error_fiel_requiered)); focusView = edt_password; cancel = true; } if (TextUtils.isEmpty(password_repeat)) { edt_repeat_password.setError(getString(R.string.error_fiel_requiered)); focusView = edt_repeat_password; cancel = true; } if (!TextUtils.isEmpty(password) && !TextUtils.isEmpty(password_repeat)) { if (!password.equals(password_repeat)) { Toast.makeText(this, "El password no es el mismo, verificalo!", Toast.LENGTH_LONG).show(); } } if (TextUtils.isEmpty(fecha_nacimiento)) { edt_borndate.setError(getString(R.string.error_fiel_requiered)); focusView = edt_borndate; cancel = true; } if (TextUtils.isEmpty(tutor)) { edt_tutor_name.setError(getString(R.string.error_fiel_requiered)); focusView = edt_tutor_name; cancel = true; } if (TextUtils.isEmpty(tutor_last_name)) { edt_tutor_last_name.setError(getString(R.string.error_fiel_requiered)); focusView = edt_tutor_last_name; cancel = true; } if (!acept) { Toast.makeText(this, "Debes aceptar el aviso de privacidad", Toast.LENGTH_LONG).show(); cancel = true; } if (cancel) { focusView.requestFocus(); Toast.makeText(this, "Debes ingresar la informaciĆ³n requerida", Toast.LENGTH_LONG).show(); } else { // TODO CALL SERVICE // (String nombre, int id_asentamiento_municipio, String fecha_nacimiento, String // apellido_paterno, String apellido_materno, String nombre_tutor, String // apellido_paterno_tutor, String apellido_materno_tutor, int aviso, String tipo_telefono, // String lada, String telefono, String fecha_creacion) datosUsuario = new DatosUsuario( name_user, 128, fecha_nacimiento, ln_p, ln_m, tutor, tutor_last_name, "empty", 1, "0", "01", null, gameUtils.getdayDate()); sendUserService(datosUsuario); } }