Ejemplo n.º 1
0
  @Override
  public void getFollowing(String token, String username, final int loadType, Page page) {
    mUi.showLoading(loadType);
    String url = API.API_HOST + "/users/" + username + "/following";
    Map<String, String> head = new HashMap<>();
    API.configAuthorizationHead(head, token);

    Map<String, String> params = new HashMap<>();
    params.put(API.PAGE, String.valueOf(page.getPageIndex()));
    params.put(API.PER_PAGE, String.valueOf(page.getPageDataCount()));

    GsonRequest<List<User>> request =
        new GsonRequest<List<User>>(
            Request.Method.GET,
            url,
            params,
            head,
            new TypeToken<List<User>>() {}.getType(),
            new Response.Listener<List<User>>() {
              @Override
              public void onResponse(List<User> response) {
                handlerResponse(loadType, response);
              }
            },
            new Response.ErrorListener() {
              @Override
              public void onErrorResponse(VolleyError error) {
                handlerError(loadType, error);
              }
            });
    VolleyUtil.addRequest(request, this);
  }
Ejemplo n.º 2
0
 @Override
 public void detachUi(UserListUi ui) {
   VolleyUtil.cancelRequestByTag(this);
 }