igo/app/src/main/java/com/igo/ucpr/igo/Activities/RegisterActivity.java
/**
     * Attempts to sign in or register the account specified by the login form.
     * If there are form errors (invalid email, missing fields, etc.), the
     * errors are presented and no actual login attempt is made.
     */
Attempts to sign in or register the account specified by the login form.
If there are form errors (invalid email, missing fields, etc.), the
errors are presented and no actual login attempt is made.
Attempts to sign in or register the account specified by the login form . If there are form errors ( invalid email missing fields etc . ) the errors are presented and no actual login attempt is made .
private void attemptRegister() {
        mEmailView.setError(null);
        mPasswordView.setError(null);
        mUserNameView.setError(null);
        String email = mEmailView.getText().toString();
        String password = mPasswordView.getText().toString();
        String username = mUserNameView.getText().toString();
        Log.e("Register",""+username);
        boolean cancel = false;
        View focusView = null;
        if (!TextUtils.isEmpty(password) && !isPasswordValid(password)) {
            mPasswordView.setError(getString(R.string.error_invalid_password));
            focusView = mPasswordView;
            cancel = true;
        }
        if (username.isEmpty()) {
            mUserNameView.setError(getString(R.string.error_invalid_username));
            focusView = mUserNameView;
            cancel = true;
        }
        if (TextUtils.isEmpty(email)) {
            mEmailView.setError(getString(R.string.error_field_required));
            focusView = mEmailView;
            cancel = true;
        } else if (!isEmailValid(email)) {
            mEmailView.setError(getString(R.string.error_invalid_email));
            focusView = mEmailView;
            cancel = true;
        }
        if (cancel) {
            focusView.requestFocus();
        } else {
            pDialog = new SweetAlertDialog(RegisterActivity.this, SweetAlertDialog.PROGRESS_TYPE);
            pDialog.getProgressHelper().setBarColor(Color.parseColor("#A5DC86"));
            pDialog.setTitleText("Loading");
            pDialog.setCancelable(false);
            pDialog.show();
            register(username, email, password);
        }
    }
private void attemptRegister ( ) { mEmailView . setError ( null ) ; mPasswordView . setError ( null ) ; mUserNameView . setError ( null ) ; String email = mEmailView . getText ( ) . toString ( ) ; String password = mPasswordView . getText ( ) . toString ( ) ; String username = mUserNameView . getText ( ) . toString ( ) ; Log . e ( "Register" , "" + username ) ; boolean cancel = false ; View focusView = null ; if ( ! TextUtils . isEmpty ( password ) && ! isPasswordValid ( password ) ) { mPasswordView . setError ( getString ( R . string . error_invalid_password ) ) ; focusView = mPasswordView ; cancel = true ; } if ( username . isEmpty ( ) ) { mUserNameView . setError ( getString ( R . string . error_invalid_username ) ) ; focusView = mUserNameView ; cancel = true ; } if ( TextUtils . isEmpty ( email ) ) { mEmailView . setError ( getString ( R . string . error_field_required ) ) ; focusView = mEmailView ; cancel = true ; } else if ( ! isEmailValid ( email ) ) { mEmailView . setError ( getString ( R . string . error_invalid_email ) ) ; focusView = mEmailView ; cancel = true ; } if ( cancel ) { focusView . requestFocus ( ) ; } else { pDialog = new SweetAlertDialog ( RegisterActivity . this , SweetAlertDialog . PROGRESS_TYPE ) ; pDialog . getProgressHelper ( ) . setBarColor ( Color . parseColor ( "#A5DC86" ) ) ; pDialog . setTitleText ( "Loading" ) ; pDialog . setCancelable ( false ) ; pDialog . show ( ) ; register ( username , email , password ) ; } }
Attempts to sign in or register the account specified by the login form.
Attempts to sign in or register the account specified by the login form .
// Reset errors. // Store values at the time of the login attempt. // Check for a valid password, if the user entered one. // Check for a valid email address. // There was an error; don't attempt login and focus the first // form field with an error. // Show a progress spinner, and kick off a background task to // perform the user login attempt. // showProgress(true);