Ejemplo n.º 1
0
  @Override
  public void onClick(View v) {
    switch (v.getId()) {
      case R.id.rl_youyaoqing: // 有邀请ID
        rl_youyaoqing.setVisibility(View.GONE);
        ll_yaoqingid.setVisibility(View.VISIBLE);
        break;
      case R.id.rl_wuyaoqing: // 无邀请ID、
        rl_youyaoqing.setVisibility(View.GONE);
        ll_yaoqingid.setVisibility(View.GONE);
        rl_wuyaoqing.setVisibility(View.GONE);
        ll_text_t.setVisibility(View.VISIBLE);
        ll_text_s.setVisibility(View.VISIBLE);
        params = new RequestParams();
        params.put("deviceId", BaseApp.getModel().getDeviceId()); // deviceId没有获得,
        HttpUtils.getPointsFromInvite(
            new HttpErrorHandler() {

              @Override
              public void onRecevieSuccess(JSONObject json) {
                Tools.toast(FirstLoginActivity.this, "无邀请ID获得20积分");
              }
            },
            params);
        /** 提交数据 */
        break;
      case R.id.rl_yaoqingyes: // 有邀请ID,并输入ID后的确定
        shifuID = et_inputid.getText().toString().trim();
        if (StringUtil.isEmpty(shifuID)) {
          Tools.toast(FirstLoginActivity.this, "邀请ID不能为空,如没有请选择无邀请!");
          return;
        }
        rl_youyaoqing.setVisibility(View.GONE);
        rl_wuyaoqing.setVisibility(View.GONE);
        ll_yaoqingid.setVisibility(View.GONE);
        ll_text_t.setVisibility(View.VISIBLE);
        ll_text_s.setVisibility(View.VISIBLE);
        params = new RequestParams();
        params.put("deviceId", BaseApp.getModel().getDeviceId()); // deviceId没有获得,
        params.put("parentid", shifuID);
        HttpUtils.getPointsFromInvite(
            new HttpErrorHandler() {

              @Override
              public void onRecevieSuccess(JSONObject json) {
                Tools.toast(FirstLoginActivity.this, "有邀请ID获得30积分");
              }
            },
            params);
        /** 提交数据 */
        break;
      case R.id.rl_huodeyes:
        startActivity(new Intent(FirstLoginActivity.this, MainActivity.class));

        finish();
        break;
      default:
        break;
    }
  }
Ejemplo n.º 2
0
  public void getNew() {
    /** 个人资料 */
    params = new RequestParams();
    params.put("deviceId", BaseApp.getModel().getDeviceId()); // 设备ID
    params.put("part", "1"); // 1或者2(1是新手教程,2是个人资料得分)
    HttpUtils.postNewAndPersonal(
        new AbstractHttpHandler() {

          @Override
          public void onJsonSuccess(JSONObject json) {
            if (json.getString("code").equals("200")) { // 个人资料已完成
              SharedPreferenceUtils.init(NewActivity.this).setIsOver("true");
              SharedPreferenceUtils.init(NewActivity.this).setIsNew("false");
            }
          }

          @Override
          public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {}
        },
        params);
  }