public void getLikeShotListMore(int id) {

    String url = ApiInterface.PLAYERS;
    int page = shotList.size() / PER_PAGE + 1;
    int per_page = PER_PAGE;

    BeeCallback<JSONObject> cb =
        new BeeCallback<JSONObject>() {

          @Override
          public void callback(String url, JSONObject jo, AjaxStatus status) {
            LikeShotModel.this.callback(url, jo, status);

            if (null != jo) {
              try {
                JSONArray shotArray = jo.optJSONArray("shots");
                for (int i = 0; i < shotArray.length(); i++) {
                  JSONObject jsonItem = shotArray.getJSONObject(i);
                  SHOT shotItem = new SHOT();
                  shotItem.fromJson(jsonItem);
                  shotList.add(shotItem);
                }
                LikeShotModel.this.OnMessageResponse(url, jo, status);
              } catch (JSONException e) {
                e.printStackTrace();
              }
            }
          }
        };

    url += id;
    url += "/shots/likes?" + "page=" + page + "&per_page=" + per_page;
    cb.url(url).type(JSONObject.class).method(Constants.METHOD_GET);
    aq.ajax(cb);
  }
  public void getShotDetail(int id) {
    String url = ApiInterface.SHOT_LIST;
    BeeCallback<JSONObject> cb =
        new BeeCallback<JSONObject>() {

          @Override
          public void callback(String url, JSONObject jo, AjaxStatus status) {

            ShotDetailModel.this.callback(url, jo, status);
            try {
              if (jo != null) {
                shot = new SHOT();
                shot.fromJson(jo);
                ShotDetailModel.this.OnMessageResponse(url, jo, status);
              }
            } catch (JSONException e) {
              e
                  .printStackTrace(); // To change body of catch statement use File | Settings |
                                      // File Templates.
            }
          }
        };

    url += "/" + id;
    cb.url(url).type(JSONObject.class).method(Constants.METHOD_GET);
    aq.ajax(cb);
  }
Beispiel #3
0
  public void getShotListPre(String filter) {
    if (null == filter) {
      filter = "popular";
    }

    String url = ApiInterface.SHOT_LIST;
    int page = 1;
    int per_page = PER_PAGE;

    BeeCallback<JSONObject> cb =
        new BeeCallback<JSONObject>() {

          @Override
          public void callback(String url, JSONObject jo, AjaxStatus status) {
            ShotModel.this.callback(url, jo, status);

            if (null != jo) {
              dataList.clear();
              try {
                JSONArray shotArray = jo.optJSONArray("shots");
                for (int i = 0; i < shotArray.length(); i++) {
                  JSONObject jsonItem = shotArray.getJSONObject(i);
                  SHOT shotItem = new SHOT();
                  shotItem.fromJson(jsonItem);
                  dataList.add(shotItem);
                }

                ShotModel.this.total = jo.optInt("total");
                ShotModel.this.OnMessageResponse(url, jo, status);
              } catch (JSONException e) {
                e.printStackTrace();
              }
            }
          }
        };

    url += "/" + filter;
    url += "?" + "page=" + page + "&per_page=" + per_page;

    cb.url(url).type(JSONObject.class).method(Constants.METHOD_GET);
    MyProgressDialog mPro = new MyProgressDialog(mContext, "请稍后...");

    aq.progress(mPro.mDialog).ajax(cb);
  }