/** 初始化 */
  public void init() {
    baseGestureLockView = (BaseGestureLockView) findViewById(R.id.gestureLockView);
    gesture_set_textview = (TextView) findViewById(R.id.gesture_set_textview);
    animation = new TranslateAnimation(-20, 20, 0, 0);
    animation.setDuration(50);
    animation.setRepeatCount(2);
    animation.setRepeatMode(Animation.REVERSE);
    TextView login_by_text = (TextView) findViewById(R.id.login_by_text);
    login_by_text.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            // TODO 自动生成的方法存根
            Intent intent2 = new Intent();
            intent2.setClass(mContext, BaseLoginActivity.class);
            startActivity(intent2);
            finish();
          }
        });

    //
    final String handPassword = SharePreferenceUtil.getString(mContext, "handpassword", "");
    final String loginName = SharePreferenceUtil.getString(mContext, "loginName", "");
    final String password = SharePreferenceUtil.getString(mContext, "password", "");

    // 设置密码
    baseGestureLockView.setKey(handPassword);
    // 手势完成后回调
    baseGestureLockView.setOnGestureFinishListener(
        new OnGestureFinishListener() {
          @Override
          public void OnGestureFinish(boolean success, String key) {
            baseGestureLockView.clearPassWord();
            if (success) {

              mdialog = UtilsTool.initProgressDialog(mContext, "请稍等.....");
              mdialog.show();
              UserLoginResult userloginresult = new UserLoginResult();
              userloginresult.execute(mdialog, loginName, password);

            } else {
              gesture_set_textview.setTextColor(Color.parseColor("#FF2525"));
              gesture_set_textview.setVisibility(View.VISIBLE);
              gesture_set_textview.setText("密码错误!");
              gesture_set_textview.startAnimation(animation);
            }
          }
        });
  }
    @Override
    protected void onPostExecute(String result) {
      //                  MyToast.show(context, "连接服务器成功,result:::::::::"+result, 1);
      if (dialog != null) dialog.dismiss();
      if (result == null) {
        MyToast.show(mContext, "连接服务器异常,无法提交申请", 1);
        return;
      } else if (result.equals("fail")) {
        MyToast.show(mContext, "连接服务器异常", Toast.LENGTH_LONG);
      } else {
        try {
          JSONObject obj = new JSONObject(result);
          //	                    int tempresult =Integer.parseInt(obj.optString("result"));
          int tempresult = -1;
          if (!TextUtils.isEmpty(obj.optString("result"))) {
            tempresult = Integer.parseInt(obj.optString("result"));
          }
          // 返回:0用户不存在;1用户已禁用;2密码错误;3登陆成功;4设备不匹配 // 登陆成功后,在后台启动服务定期检测设备可用性

          switch (tempresult) {
            case 0:
              MyToast.show(mContext, "该设备正在审核中,请稍后。。。", 1);
              //	                        imap_login_userlogin.setOnClickListener(null);
              break;
            case 1:

              //	                        if(obj.optBoolean("state")){//说明用户成功登陆
              //	                            DistApp.username =obj.optString("userName");
              //	                            DistApp.userid = obj.optString("userId");;//表示设备的用户id
              //                        2跳转到主页面
              Intent intent1 = new Intent();
              intent1.setClass(mContext, BaseMainActivity.class);
              startActivity(intent1);
              finish();
              //	                        }else{
              //	                            MyToast.show(mContext, "登录名或密码错误,请重新登陆", 1);
              //	                        }

              break;
            case 2: // 说明该设备已经挂失,需要删除用户的所有信息
              MyToast.show(mContext, "该设备已挂失,稍后清除所有信息", 1);

              SharePreferenceUtil.clear(mContext);

              break;
            case 3:
              MyToast.show(mContext, "该设备已被禁用,请联系管理员", 1);
              break;
            default:
              MyToast.show(mContext, "服务器返回值异常,无法成功登陆", 1);
              break;
          }
        } catch (JSONException e) {
          // TODO 自动生成的 catch 块
          e.printStackTrace();
        }
      }
    }