示例#1
0
        @Override
        public void OnGetStWithPasswd(
            String userAccount,
            long dwSrcAppid,
            int dwMainSigMap,
            long dwSubDstAppid,
            String userPasswd,
            WUserSigInfo userSigInfo,
            int ret,
            ErrMsg errMsg) {
          switch (ret) {
            case util.S_GET_IMAGE:
              {
              }
              break;

            case util.S_GET_SMS:
              {
              }
              break;

            case util.S_SUCCESS:
              {
                loginSuccess(userAccount);
              }
              break;

            case util.S_BABYLH_EXPIRED:
            case util.S_LH_EXPIRED:
              {
              }
              break;

            default:
              WtloginUtil.setUin(null);
              // 取消菊花
              dismissProDialog();
              ToastUtil.ShowLongToast(
                  GTOctopusActivity.this, errMsg.getTitle() + "," + errMsg.getMessage());
              finish();
          }
        }
示例#2
0
  /* 进行验证码验证,或者进行快速登录的回调,这两个是进行快速登录可能遇到的情况 */
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    String userAccount = "";
    ErrMsg errMsg = null;
    WUserSigInfo userSigInfo = null;
    switch (requestCode) {
      case WtloginUtil.REQ_VCODE:
        {
          if (data == null) break;
          Bundle bundle = data.getExtras();
          if (bundle == null) break;
          userAccount = bundle.getString("ACCOUNT");
          errMsg = (ErrMsg) bundle.getParcelable("ERRMSG");
          userSigInfo = (WUserSigInfo) bundle.getParcelable("USERSIG");

          if (resultCode == util.S_SUCCESS) {
            // 转菊花,等待产品列表获取结果
            showProDialog(
                getString(R.string.pi_octopus_pull_products),
                getString(R.string.pi_octopus_pull_products_content));
            loginSuccess(userAccount);
          } else if (resultCode == util.S_LH_EXPIRED || resultCode == util.S_BABYLH_EXPIRED) {
            Ticket ticket = WtloginHelper.GetUserSigInfoTicket(userSigInfo, SigType.WLOGIN_LHSIG);
            finish();
            ToastUtil.ShowLongToast(
                GTApp.getContext(),
                "lhsig=" + util.buf_to_string(ticket._sig) + " errMsg=" + errMsg);
          } else {
            finish();
            ToastUtil.ShowLongToast(GTApp.getContext(), "errMsg=" + errMsg);
          }
        }
        break;
      case WtloginUtil.REQ_QLOGIN: // 快速登录返回
        try {
          if (data == null) { // 这种情况下用户多半是直接按了返回按钮,没有进行快速登录;快速登录失败可提醒用户输入密码登录
            break;
          }

          WUserSigInfo sigInfo = WtloginUtil.getSigInfo(data);
          if (sigInfo == null) {
            ToastUtil.ShowLongToast(GTApp.getContext(), R.string.pi_octopus_login_user_quickerror);
            break;
          }

          WtloginUtil.setUin(sigInfo.uin);

          // 转菊花,等待产品列表获取结果
          showProDialog(
              getString(R.string.pi_octopus_pull_products),
              getString(R.string.pi_octopus_pull_products_content));

          // 快速登录只是从手Q换取了A1票据,A1则相当于用户密码,在此仍需要再发起一次A1换票的流程,才能拿到目标票据
          WtloginUtil.getStWithPasswd(sigInfo);
          // 换票据成功后会触发wtloginListener的监听
        } catch (Exception e) {
          util.printException(e);
        }
        break;
      default:
        break;
    }
  }
示例#3
0
 @Override
 public void onClick(View v) {
   switch (v.getId()) {
     case R.id.upload_btn:
       if ((null != WtloginUtil.getUin()) && (isNewProj == false)) {
         String sk = WtloginUtil.getSKey(WtloginUtil.getUin());
         String psk = WtloginUtil.getPsKey(WtloginUtil.getUin());
         String lsk = WtloginUtil.getLsKey(WtloginUtil.getUin());
         dataPersisted();
         showUploadDialog(sk, psk, lsk);
       } else if (isNewProj == true) {
         String sk = WtloginUtil.getSKey(WtloginUtil.getUin());
         String psk = WtloginUtil.getPsKey(WtloginUtil.getUin());
         String lsk = WtloginUtil.getLsKey(WtloginUtil.getUin());
         File file = new File(strNewProjName);
         comfirmUpdateSize(file, sk, psk, lsk);
       } else {
         ToastUtil.ShowLongToast(GTApp.getContext(), R.string.qq_need_login);
       }
       break;
     case R.id.back_gt:
       finish();
       break;
   }
 }
示例#4
0
 @Override
 protected void onDestroy() {
   super.onDestroy();
   GTOctopusEngine.getInstance().removeListener(this);
   WtloginUtil.getHelper().SetListener(null);
 }
示例#5
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Intent newProjIntent = this.getIntent();

    if (newProjIntent != null && newProjIntent.getAction() == "New_Proj") {
      isNewProj = true;
      newProjBundle = newProjIntent.getExtras();
      strNewProjName = newProjBundle.getString("name");
      strIntent = newProjBundle.getString("intent");
    }
    // 屏蔽进入界面默认唤出键盘在第一个EditText上
    getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
    setContentView(R.layout.pi_octopus);

    WtloginUtil.getHelper().SetListener(wtloginListener);

    TextView back = (TextView) findViewById(R.id.back_gt);
    back.setOnClickListener(this);
    Button uploadBtn = (Button) findViewById(R.id.upload_btn);
    uploadBtn.setOnClickListener(this);

    spProductName = (Spinner) findViewById(R.id.sp_product_name);

    if (productPairs != null) {
      productPairs.clear();
    }
    productAdapter =
        new ArrayAdapter<Pair<String, String>>(
            this, android.R.layout.simple_spinner_item, productPairs);
    productAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    spProductName.setAdapter(productAdapter);

    GTOctopusEngine.getInstance().addListener(this);

    /*
     * @important! 快速登录入口
     * 完成wtlogin的接入之后,请到qqlogin.oa.com 申请快速登录权限
     * TODO 判断是否登录过,如未登录过,则进入快速登录;如登录过,则进入上传页
     */
    String lsk = WtloginUtil.getLsKey(WtloginUtil.getUin());
    if (lsk == null || lsk.isEmpty()) {
      Intent intent = WtloginUtil.getIntent();

      boolean canQlogin = (intent != null);
      if (!canQlogin) {
        ToastUtil.ShowLongToast(this, R.string.qq_need_install);
        finish();
        return;
      }

      try {
        GTOctopusActivity.this.startActivityForResult(intent, WtloginUtil.REQ_QLOGIN);
      } catch (Exception e) {
        ToastUtil.ShowLongToast(this, R.string.qq_quicklogin_error);
      }
      return;
    }

    // 转菊花,等待产品列表获取结果
    showProDialog(
        getString(R.string.qq_quicklogin_trying), getString(R.string.qq_quicklogin_trying_content));
    loginSuccess(WtloginUtil.getUin());
  }