Exemplo n.º 1
0
  @Override
  public Void doInBackground(Void... params) {

    // 返回
    if (isRunning) return null;

    User user = BookApp.getUser();

    EditText input = (EditText) caller.findViewById(R.id.consume_zfb_input);

    double money = 0;
    if (StringUtils.isNotBlank(input.getText().toString()) && user != null) {
      money = Double.parseDouble(input.getText().toString());
      if (money < Constants.CONSUME_PAY_MIN) {
        return null;
      }

      AliPayBean aliPayBean = HttpImpl.alipayApp(user.getUid(), money);

      final String orderInfo = URLDecoder.decode(aliPayBean.getContent());
      final String encodeStrSign = aliPayBean.getSign();
      final String signType = aliPayBean.getSign_type();

      aliPayBean = new AliPayBean();

      HANDLER.post(
          new Runnable() {

            @Override
            public void run() {
              // 执行支付
              alipay.pay(orderInfo, encodeStrSign, signType);
            }
          });
    } else {
      HANDLER.post(
          new Runnable() {
            @Override
            public void run() {
              //						Toast.makeText(caller, "最低充值限额" + Constants.CONSUME_PAY_MIN + "元",
              // Toast.LENGTH_LONG).show();
              ViewUtils.showDialog(caller, "请输入20以上的整数", R.drawable.infoicon, null);
            }
          });
    }

    return null;
  }
Exemplo n.º 2
0
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.updateinfo);
    CloseActivity.add(this);

    setTopBar();

    email = (EditText) findViewById(R.id.updateInfo_email);

    update = (Button) findViewById(R.id.updateInfo_over);
    update.setOnClickListener(this);

    user = BookApp.getUser();
    uid = user.getUid();
    token = user.getToken();

    if (user == null) {
      Toast.makeText(UpdateInfo.this, "您尚未登录,请先登录!", Toast.LENGTH_LONG).show();
      Intent intent = new Intent(UpdateInfo.this, LoginActivity.class);
      startActivity(intent);
      finish();
      return;
    }

    new Thread() {
      public void run() {
        JSONObject json = HttpImpl.syncUserInfo(uid, token);
        if (json == null) {
          handler.sendEmptyMessage(123);
          return;
        }
        user2 = JsonToBean.JsonToUser(json);
        if (user2 != null) {
          handler.sendEmptyMessage(124);
        }
      };
    }.start();

    right1.setOnClickListener(this);
  }