/**
  * 获取所有关注好友列表
  *
  * @param uid 指定用户UID
  * @param handler
  */
 public static void getAllFriendsList(int uid, int relation, AsyncHttpResponseHandler handler) {
   RequestParams params = new RequestParams();
   params.put("uid", uid);
   params.put("relation", relation);
   params.put("all", 1);
   ApiHttpClient.get("action/api/friends_list", params, handler);
 }
  @Override
  public void onClick(View v) {

    switch (v.getId()) {
      case R.id.female_btn:
        sex = "female";
        break;

      case R.id.male_btn:
        sex = "male";
        break;

      case R.id.next_btn:
        if (nextCheck == true) {

          name = nameEt.getText().toString();
          birth = birthEt.getText().toString();

          RequestParams params = new RequestParams();

          params.put("email", email);
          params.put("phone", phone);
          params.put("password", password);
          params.put("name", name);
          params.put("birth", birth);
          params.put("sex", sex);

          registMember(params);
        }

        break;
    }
  }
  private void removeMyCoach(int position) {
    RequestParams params = new RequestParams();
    params.put("user_id", userId);
    params.put("video_id", list1.get(position).coach_id);
    HttpUtils.post(
        Constants.VIDEO_PRAISE,
        params,
        new TextHttpResponseHandler() {

          @Override
          public void onSuccess(int arg0, Header[] arg1, String arg2) {
            Gson gson = new Gson();
            InfoBean fromJson = gson.fromJson(arg2, InfoBean.class);
            if ("0".equals(fromJson.code)) {
              Utils.showToast(getActivity(), "移除成功");
            } else {
              Utils.showToast(getActivity(), "移除失败");
            }
          }

          @Override
          public void onFailure(int arg0, Header[] arg1, String arg2, Throwable arg3) {
            Utils.showToast(getActivity(), "网络连接失败");
          }
        });
  }
  public void startArmCallback(final String number) {
    Bundle extras = new Bundle();
    extras.putString(WebSendParam.phoneNumber.name(), number);
    //        SmartPagerApplication.getInstance().startWebAction(WebAction.armCallback, extras);
    ((BaseActivity) getActivity()).showProgressDialog(getString(R.string.sending_request));

    RequestParams params = new RequestParams();
    params.put("smartPagerID", SmartPagerApplication.getInstance().getPreferences().getUserID());
    params.put("uberPassword", SmartPagerApplication.getInstance().getPreferences().getPassword());
    params.put("phoneNumber", number);

    httpClient.post(
        getActivity().getApplicationContext(),
        Constants.BASE_REST_URL + "/armCallback",
        params,
        new JsonHttpResponseHandler() {

          @Override
          public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
            System.out.println("successful response: " + response);
            ((BaseActivity) getActivity()).hideProgressDialog();
            makeArmCallBack(number);
          }

          @Override
          public void onFailure(
              int statusCode, Header[] headers, String responseBody, Throwable error) {
            System.out.println("failure response: " + responseBody);
            ((BaseActivity) getActivity()).hideProgressDialog();
          }
        });
  }
Beispiel #5
0
 // Fetch MentionsFragment
 public void getMentions(int page, AsyncHttpResponseHandler handler) {
   String apiUrl = getApiUrl("statuses/mentions_timeline.json");
   RequestParams params = new RequestParams();
   params.put("count", 5);
   params.put("page", String.valueOf(page));
   client.get(apiUrl, params, handler);
 }
  @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;
    }
  }
Beispiel #7
0
  public void setProfileInfo(User user) {
    params = new RequestParams();
    username = user.getScreenName();
    name = user.getName();
    params.put("uid", user.getUserId());
    params.put("username", username);
    params.put("name", name);
    savePreferences("username", username);
    handler =
        new AsyncHttpResponseHandler() {
          @Override
          public void onSuccess(String response) {
            try {
              JSONObject object = new JSONObject(response);
              status = (String) object.get("auth");
            } catch (JSONException e) {
              e.printStackTrace();
            }
            next_step(status);
          }

          @Override
          public void onFailure(Throwable arg0, String arg1) {
            super.onFailure(arg0, arg1);
          }
        };
  }
 public static void updatePortrait(int uid, File portrait, AsyncHttpResponseHandler handler)
     throws FileNotFoundException {
   RequestParams params = new RequestParams();
   params.put("uid", uid);
   params.put("portrait", portrait);
   ApiHttpClient.post("action/api/portrait_update", params, handler);
 }
 /**
  * 获取某活动已出席的人员列表
  *
  * @param eventId
  * @param pageIndex
  * @param handler
  */
 public static void getEventApplies(int eventId, int pageIndex, AsyncHttpResponseHandler handler) {
   RequestParams params = new RequestParams();
   params.put("pageIndex", pageIndex);
   params.put("event_id", eventId);
   params.put("pageSize", AppContext.PAGE_SIZE);
   ApiHttpClient.get("action/api/event_attend_user", params, handler);
 }
 public static void deleteBlog(int uid, int authoruid, int id, AsyncHttpResponseHandler handler) {
   RequestParams params = new RequestParams();
   params.put("uid", uid);
   params.put("authoruid", authoruid);
   params.put("id", id);
   ApiHttpClient.post("action/api/userblog_delete", params, handler);
 }
 public static void delFavorite(int uid, int objid, int type, AsyncHttpResponseHandler handler) {
   RequestParams params = new RequestParams();
   params.put("uid", uid);
   params.put("objid", objid);
   params.put("type", type);
   ApiHttpClient.post("action/api/favorite_delete", params, handler);
 }
 public static void pubSoftWareTweet(Tweet tweet, int softid, AsyncHttpResponseHandler handler) {
   RequestParams params = new RequestParams();
   params.put("uid", tweet.getAuthorid());
   params.put("msg", tweet.getBody());
   params.put("project", softid);
   ApiHttpClient.post("action/api/software_tweet_pub", params, handler);
 }
 public static void getChatMessageList(int friendId, int page, AsyncHttpResponseHandler handler) {
   RequestParams params = new RequestParams();
   params.put("id", friendId);
   params.put("pageIndex", page);
   params.put("pageSize", AppContext.PAGE_SIZE);
   ApiHttpClient.get("action/api/message_detail", params, handler);
 }
 /**
  * @param searchTag   软件分类  推荐:recommend 最新:time 热门:view 国产:list_cn
  * @param page
  * @param handler
  */
 public static void getSoftwareList(String searchTag, int page, AsyncHttpResponseHandler handler) {
   RequestParams params = new RequestParams();
   params.put("searchTag", searchTag);
   params.put("pageIndex", page);
   params.put("pageSize", AppContext.PAGE_SIZE);
   ApiHttpClient.get("action/api/software_list", params, handler);
 }
Beispiel #15
0
  public void getPerfPpofDayData(final Integer page) {
    RequestParams params1 = new RequestParams();
    params1.put("cycle", "4");
    params1.put("ppid", ppid);
    params1.put("date", dayStr.toString());
    params1.put("begin", page.toString());
    params1.put("count", 20 + "");

    final MzbProgressDialog pd = new MzbProgressDialog(getActivity(), "请稍后....");
    pd.show();

    RequestUtils.ClientTokenPost(
        getActivity(),
        MzbUrlFactory.BASE_URL + MzbUrlFactory.BRAND_PERFPP,
        params1,
        new NetCallBack() {

          @TargetApi(Build.VERSION_CODES.KITKAT)
          @Override
          public void onMzbSuccess(String result) {

            try {
              JSONObject obj = new JSONObject(result);
              Gson gson = new Gson();
              if (obj.getInt("code") == 0) {
                if (page == 0) {
                  data.clear();
                }

                jsonArray = new JSONArray(obj.getString("data"));
                for (int i = 0; i < jsonArray.length(); i++) {
                  JSONObject object = jsonArray.getJSONObject(i);
                  PerfPpData perfPpData = gson.fromJson(object.toString(), PerfPpData.class);
                  data.add(perfPpData);
                }
                curPage = data.size();
                view =
                    Utility.getInstance()
                        .getDataLayout(
                            getActivity(), curPage != 0, ground, "暂无数据", R.mipmap.nodata_err, view);
                add2removeFooterView();

                listView.onRefreshComplete();

                pd.dismiss();
              } else {
                listView.onRefreshComplete();
                pd.dismiss();
              }
            } catch (JSONException e) {
              e.printStackTrace();
            }
          }

          @Override
          public void onMzbFailues(Throwable arg0) {
            pd.dismiss();
          }
        });
  }
 public static void getBlogList(String type, int pageIndex, AsyncHttpResponseHandler handler) {
   RequestParams params = new RequestParams();
   params.put("type", type);
   params.put("pageIndex", pageIndex);
   params.put("pageSize", AppContext.PAGE_SIZE);
   ApiHttpClient.get("action/api/blog_list", params, handler);
 }
Beispiel #17
0
  // 获取企业的类型
  public void companytypelist(final OnAsynGetListListener listener) {
    RequestParams params = new RequestParams();
    params.put("pageSize", 10000);
    params.put("thisPage", 1);
    if (NetUtil.isNetworkAvailable()) {
      HttpUtil.post(
          "api/system/companytypelist",
          true,
          params,
          new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
              if (arg0 != 200) {
                listener.OnAsynRequestFail(
                    "-1", GezitechApplication.getContext().getString(R.string.data_error));
              }
              try {
                Response response = new Response(new String(arg2));
                JSONObject root = response.asJSONObject();

                if (root.getInt("state") != 1) { // 0
                  if (listener != null) listener.OnAsynRequestFail("-1", root.getString("msg"));
                  return;
                }
                JSONObject data = root.getJSONObject("data");
                JSONArray ja = data.getJSONArray("datas");
                PageList pl = new PageList();
                Companytype ct = null;
                for (int i = 0; i < ja.length(); i++) {
                  JSONObject jo = ja.getJSONObject(i);
                  ct = new Companytype(jo);
                  ct.childtype = jo.has("childtype") ? jo.getJSONArray("childtype") : null;
                  pl.add(ct);
                }

                listener.OnGetListDone(pl);

              } catch (Exception ex) {
                listener.OnAsynRequestFail(
                    "-1", GezitechApplication.getContext().getString(R.string.data_error));
              }
            }

            @Override
            public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {
              listener.OnAsynRequestFail(
                  "-1", GezitechApplication.getContext().getString(R.string.data_error));
            }

            @Override
            public void onFinish() { // 完成后调用,失败,成功,都要掉
            }
          });
    } else {
      if (listener != null) {
        listener.OnAsynRequestFail(
            "-1", GezitechApplication.getContext().getString(R.string.network_error));
      }
    }
  }
 private static void uploadLog(String data, String report, AsyncHttpResponseHandler handler) {
   RequestParams params = new RequestParams();
   params.put("app", "1");
   params.put("report", report);
   params.put("msg", data);
   ApiHttpClient.post("action/api/user_report_to_admin", params, handler);
 }
  public void clickGetAcc() {

    RequestParams params = new RequestParams();

    params.put("j_username", firstparameter.trim());
    params.put("j_password", secondparameter.trim());

    System.out.println(params.toString());

    httpClient.post(
        METRO_STEP2,
        params,
        new AsyncHttpResponseHandler() {
          @Override
          public void onSuccess(String response) {

            System.out.println("metrobank5 response " + response);
            // myProgressDialog.dismiss();
            clickJavier();
          }

          public void onFailure(Throwable error, String content) {
            System.out.println("metrobank2 e1rror  " + content);
            myProgressDialog.dismiss();
          }
        });
  }
 public static void getPostListByTag(String tag, int page, AsyncHttpResponseHandler handler) {
   RequestParams params = new RequestParams();
   params.put("tag", tag);
   params.put("pageIndex", page);
   params.put("pageSize", AppContext.PAGE_SIZE);
   ApiHttpClient.get("action/api/post_list", params, handler);
 }
  public void makeVoipCall(final String number) {
    AudioManagerUtils.setLoudSpeaker(false);
    ((BaseActivity) getActivity()).showProgressDialog("Connecting VOIP Call");
    RequestParams params = new RequestParams();
    params.put("smartPagerID", SmartPagerApplication.getInstance().getPreferences().getUserID());
    params.put("uberPassword", SmartPagerApplication.getInstance().getPreferences().getPassword());

    AsyncHttpClient httpClient = new AsyncHttpClient();
    httpClient.post(
        getActivity().getApplicationContext(),
        Constants.BASE_REST_URL + "/getTwilioClientToken",
        params,
        new JsonHttpResponseHandler() {

          @Override
          public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
            System.out.println("successful response: " + response);
            ((BaseActivity) getActivity()).hideProgressDialog();

            VoipPhone voipPhone =
                new VoipPhone(
                    ((BaseActivity) getActivity()).getApplicationContext(),
                    response.optString("token"));
            voipPhone.connect(number);
          }

          @Override
          public void onFailure(
              int statusCode, Header[] headers, String responseBody, Throwable error) {
            System.out.println("failure response: " + responseBody);
            ((BaseActivity) getActivity()).hideProgressDialog();
          }
        });
  }
 public static void getTweetList(int uid, int page, AsyncHttpResponseHandler handler) {
   RequestParams params = new RequestParams();
   params.put("uid", uid);
   params.put("pageIndex", page);
   params.put("pageSize", AppContext.PAGE_SIZE);
   ApiHttpClient.get("action/api/tweet_list", params, handler);
 }
 /** 请求服务器数据---首页 */
 private void requestData() {
   // 获取轮播图
   HttpUtils.getSpecialList(
       new EntityHandler<Gift>(Gift.class) {
         @Override
         public void onReadSuccess(List<Gift> list) {
           specialList = list;
           for (int i = 0; i < list.size(); i++) {
             imageList.add(list.get(i).getGoods_image());
           }
           // 设置轮播
           viewPager.setAdapter(adapter);
           // 设置选中的标识
           LinearLayout pointLinear = (LinearLayout) findViewById(R.id.gallery_point_linear);
           for (int i = 0; i < imageList.size(); i++) {
             ImageView pointView = new ImageView(IndexActivity.this);
             if (i == 0) {
               pointView.setBackgroundResource(R.drawable.feature_point_cur);
             } else {
               pointView.setBackgroundResource(R.drawable.feature_point);
             }
             pointLinear.addView(pointView);
           }
         }
       });
   // 获取首页新闻资讯列表
   RequestParams params = new RequestParams();
   params.put("page", page); // 当前第几页
   params.put("per_page", NUM); // 每页条数
   HttpUtils.getnewslist(rel_getnewslist, params);
 }
 public static void getTweetTopicList(int page, String topic, AsyncHttpResponseHandler handler) {
   RequestParams params = new RequestParams();
   params.put("pageIndex", page);
   params.put("title", topic);
   params.put("pageSize", AppContext.PAGE_SIZE);
   ApiHttpClient.get("action/api/tweet_topic_list", params, handler);
 }
Beispiel #25
0
 // Fetch Home Timeline
 public void getUserTimeLine(String screen_name, AsyncHttpResponseHandler handler) {
   String apiUrl = getApiUrl("statuses/user_timeline.json");
   RequestParams params = new RequestParams();
   params.put("count", 50);
   params.put("screen_name", String.valueOf(screen_name));
   client.get(apiUrl, params, handler);
 }
 /**
  * * 使用第三方账号注册
  *
  * @param catalog 类别(qq、wechat)
  * @param openIdInfo 第三方info
  * @param handler handler
  */
 public static void openid_reg(
     String catalog, String openIdInfo, AsyncHttpResponseHandler handler) {
   RequestParams params = new RequestParams();
   params.put("catalog", catalog);
   params.put("openid_info", openIdInfo);
   ApiHttpClient.post("action/api/openid_reg", params, handler);
 }
 public void getUserTimeline(String screenName, AsyncHttpResponseHandler handler) {
   String apiUrl = getApiUrl("statuses/user_timeline.json");
   RequestParams params = new RequestParams();
   params.put("count", 25);
   params.put("screen_name", screenName);
   getClient().get(apiUrl, params, handler);
 }
Beispiel #28
0
 public void getUserCredentials(AsyncHttpResponseHandler handler) {
   String apiUrl = getApiUrl("account/verify_credentials.json");
   RequestParams params = new RequestParams();
   params.put("skip_status", 1);
   params.put("include_entities", "false");
   getClient().get(apiUrl, params, handler);
 }
  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    System.out.println(resultCode);
    System.out.println(BraintreePaymentActivity.RESULT_OK);
    if (resultCode == BraintreePaymentActivity.BRAINTREE_RESULT_DEVELOPER_ERROR) {
      System.out.println("test");

    } else if (resultCode == BraintreePaymentActivity.BRAINTREE_RESULT_SERVER_ERROR) {
      System.out.println("test2");
    }

    if (resultCode == BraintreePaymentActivity.RESULT_OK) {
      System.out.println("hello");
      String paymentMethodNonce =
          data.getStringExtra(BraintreePaymentActivity.EXTRA_PAYMENT_METHOD_NONCE);

      RequestParams requestParams = new RequestParams();
      requestParams.put("payment_method_nonce", paymentMethodNonce);
      requestParams.put("amount", "10.00");

      client.post(
          "https://pacific-tor-4300.herokuapp.com" + "/payment_methods",
          requestParams,
          new TextHttpResponseHandler() {
            @Override
            public void onSuccess(String content) {
              System.out.print("olala");
              Toast.makeText(SearchActivity.this, "You've just bought a credit!", Toast.LENGTH_LONG)
                  .show();
            }
          });
    }
  }
 public static void pubUnLikeTweet(int tweetId, int authorId, AsyncHttpResponseHandler handler) {
   RequestParams params = new RequestParams();
   params.put("tweetid", tweetId);
   params.put("uid", AppContext.getInstance().getLoginUid());
   params.put("ownerOfTweet", authorId);
   ApiHttpClient.post("action/api/tweet_unlike", params, handler);
 }