<commit_before>package com.stuonline;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.Toast;

import com.alibaba.fastjson.TypeReference;
import com.lidroid.xutils.ViewUtils;
import com.lidroid.xutils.http.RequestParams;
import com.lidroid.xutils.http.ResponseInfo;
import com.lidroid.xutils.view.annotation.ViewInject;
import com.lidroid.xutils.view.annotation.event.OnClick;
import com.stuonline.entity.Muser;
import com.stuonline.entity.Result;
import com.stuonline.https.MyCallBack;
import com.stuonline.https.XUtils;
import com.stuonline.utils.DialogUtil;
import com.stuonline.utils.JsonUtil;
import com.stuonline.views.CustomerEditText;
import com.stuonline.views.TitleView;

/**
 * 孙卫星：注册Activity
 * Created by Administrator on 2015/9/15.
 */
public class RegisterActivity extends BaseActivity {
    @ViewInject(R.id.register_title)
    private TitleView mTitle;
    @ViewInject(R.id.register_email)
    private CustomerEditText mEmail;
    @ViewInject(R.id.register_pwd)
    private CustomerEditText mPassword;
    @ViewInject(R.id.register_repeatepwd)
    private CustomerEditText mRepeatPassword;
    private String account;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_register);
        ViewUtils.inject(this);
    }
    @OnClick({R.id.title_left,R.id.title_right})
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.title_left:
                //返回上一个页面
                finish();
                break;
            case R.id.title_right:
                //注册
                getRegisterEditText();
                break;
        }


    }

    /**
     * 获取注册页面的内容
     */
    public void getRegisterEditText(){
        String email=mEmail.getText();
        String password=mPassword.getText();
        String repeatPassword=mRepeatPassword.getText();
        account=getIntent().getStringExtra("account");
        if ( TextUtils.isEmpty(email)&&TextUtils.isEmpty(password)&& TextUtils.isEmpty(repeatPassword)){
            if (TextUtils.isEmpty(email))
                XUtils.showToast("邮箱不能为空!");
            if (TextUtils.isEmpty(password))
                XUtils.showToast("密码不能为空!");
            if (TextUtils.isEmpty(repeatPassword))
                XUtils.showToast("重复密码不能为空!");
        }else {
            if(!email.matches("^[a-z0-9]+([._\\\\-]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$")){
                XUtils.showToast("邮箱不正确！");
            }else {
                if (!password.equals(repeatPassword)){
                    XUtils.showToast("密码不一致！");
                }else {
                    RequestParams params = new RequestParams();
                    params.addBodyParameter("u.account", account);
                    params.addBodyParameter("u.pwd", password);
                    params.addBodyParameter("u.email",email);
                    DialogUtil.showWaitting(this);
                    XUtils.send(XUtils.REG, params, new MyCallBack<String>() {
                        @Override
                        public void onSuccess(ResponseInfo<String> responseInfo) {
                            DialogUtil.hiddenWaitting();
                            if (responseInfo != null) {
                                JsonUtil<Result<Boolean>> jsonUtil = new JsonUtil<Result<Boolean>>(new TypeReference<Result<Boolean>>() {
                                });
                                Log.i("aaa","======="+responseInfo.result);
                                Result<Boolean> result = jsonUtil.parse(responseInfo.result);
                                Log.i("aaa","======="+result);
                                XUtils.showToast(result.desc);

                            }
                        }
                    });
                }
            }

        }

    }

}<commit_msg>孙卫星：注册Activity<commit_after>package com.stuonline;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.Toast;

import com.alibaba.fastjson.TypeReference;
import com.lidroid.xutils.ViewUtils;
import com.lidroid.xutils.http.RequestParams;
import com.lidroid.xutils.http.ResponseInfo;
import com.lidroid.xutils.view.annotation.ViewInject;
import com.lidroid.xutils.view.annotation.event.OnClick;
import com.stuonline.entity.Muser;
import com.stuonline.entity.Result;
import com.stuonline.https.MyCallBack;
import com.stuonline.https.XUtils;
import com.stuonline.utils.DialogUtil;
import com.stuonline.utils.JsonUtil;
import com.stuonline.views.CustomerEditText;
import com.stuonline.views.TitleView;

/**
 * 孙卫星：注册Activity
 * Created by Administrator on 2015/9/15.
 */
public class RegisterActivity extends BaseActivity {
    @ViewInject(R.id.register_title)
    private TitleView mTitle;
    @ViewInject(R.id.register_email)
    private CustomerEditText mEmail;
    @ViewInject(R.id.register_pwd)
    private CustomerEditText mPassword;
    @ViewInject(R.id.register_repeatepwd)
    private CustomerEditText mRepeatPassword;
    private String account;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_register);
        ViewUtils.inject(this);
    }
    @OnClick({R.id.title_left,R.id.title_right})
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.title_left:
                //返回上一个页面
                finish();
                break;
            case R.id.title_right:
                //注册
                getRegisterEditText();
                break;
        }


    }

    /**
     * 获取注册页面的内容
     */
    public void getRegisterEditText(){
        String email=mEmail.getText();
        String password=mPassword.getText();
        String repeatPassword=mRepeatPassword.getText();
        account=getIntent().getStringExtra("account");
        if ( TextUtils.isEmpty(email)&&TextUtils.isEmpty(password)&& TextUtils.isEmpty(repeatPassword)){
            if (TextUtils.isEmpty(email))
                XUtils.showToast("邮箱不能为空!");
            if (TextUtils.isEmpty(password))
                XUtils.showToast("密码不能为空!");
            if (TextUtils.isEmpty(repeatPassword))
                XUtils.showToast("重复密码不能为空!");
        }else {
            if(!email.matches("^[a-z0-9]+([._\\\\-]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$")){
                XUtils.showToast("邮箱不正确！");
            }else {
                if (!password.equals(repeatPassword)){
                    XUtils.showToast("密码不一致！");
                }else {
                    RequestParams params = new RequestParams();
                    params.addBodyParameter("u.account", account);
                    params.addBodyParameter("u.pwd", password);
                    params.addBodyParameter("u.email",email);
                    DialogUtil.showWaitting(this);
                    XUtils.send(XUtils.REG, params, new MyCallBack<String>() {
                        @Override
                        public void onSuccess(ResponseInfo<String> responseInfo) {
                            DialogUtil.hiddenWaitting();
                            if (responseInfo != null) {
                                JsonUtil<Result<Boolean>> jsonUtil = new JsonUtil<Result<Boolean>>(new TypeReference<Result<Boolean>>() {
                                });
                                Log.i("aaa","======="+responseInfo.result);
                                Result<Boolean> result = jsonUtil.parse(responseInfo.result);
                                Log.i("aaa","======="+result);
                                XUtils.showToast(result.desc);
                                    finish();

                            }
                        }
                    });
                }
            }

        }

    }

}
{'fraction_non_alphanumeric': 0.12104809939721983, 'fraction_numerical': 0.005412719891745603, 'mean_word_length': 1.9693206720233747, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1079524', 'n_tokens_mistral': 2389, 'n_tokens_neox': 2338, 'n_words': 329}