Java 类com.loopj.android.http.AsyncHttpResponseHandler 实例源码

项目:OSchina_resources_android    文件:OSChinaTeamApi.java   
/***
 * 改变一个任务的状态
 *
 * @param teamId
 * @param issue
 * @param target  修改的属性("state" : 状态, "assignee" 指派人, "deadline" : 截止日期)
 * @param handler
 * @return void
 * @author 火蚁 2015-3-6 上午11:44:01
 */
public static void changeIssueState(int teamId, TeamIssue issue,
                                    String target, AsyncHttpResponseHandler handler, Context context) {
    if (issue == null)
        return;
    RequestParams params = new RequestParams();
    params.put("uid", AccountHelper.getUserId());
    params.put("teamid", teamId);
    params.put("target", target);
    params.put("issueid", issue.getId());
    if (target.equals("state")) {
        params.put("state", issue.getState());
    } else if (target.equals("assignee")) {
        params.put("assignee", issue.getToUser().getId());
    } else if (target.equals("deadline")) {
        params.put("deadline", issue.getDeadlineTime());
    }
    ApiHttpClient.post("action/api/team_issue_update", params, handler);
}
项目:OSchina_resources_android    文件:OSChinaTeamApi.java   
/***
 * 发表一个新的团队动态
 *
 * @param teamId
 * @param content
 * @param img
 * @param handler
 * @return void
 * @author 火蚁 2015-3-9 下午2:46:13
 */
public static void pubTeamNewActive(int teamId, String content, File img,
                                    AsyncHttpResponseHandler handler, Context context) {
    RequestParams params = new RequestParams();
    params.put("teamid", teamId);
    params.put("uid", AccountHelper.getUserId());
    params.put("msg", content);
    params.put("appid", 3);
    if (img != null) {

        try {
            params.put("img", img);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
    }
    ApiHttpClient.post("action/api/team_tweet_pub", params, handler);
}
项目:OSchina_resources_android    文件:OSChinaTeamApi.java   
/***
 * 更新子任务属性
 *
 * @param teamId
 * @param target
 * @param childIssue
 * @param handler
 * @return void
 * @author 火蚁 2015-3-10 下午4:53:49
 */
public static void updateChildIssue(int teamId, String target,
                                    TeamIssue childIssue, AsyncHttpResponseHandler handler, Context context) {
    RequestParams params = new RequestParams();
    params.put("uid", AccountHelper.getUserId());
    params.put("teamid", teamId);
    params.put("childissueid", childIssue.getId());
    params.put("target", target);
    if (target.equals("state")) {
        params.put("state", childIssue.getState());
    } else {
        params.put("title", childIssue.getTitle());
    }
    ApiHttpClient.post("action/api/team_issue_update_child_issue", params,
            handler);
}
项目:OSchina_resources_android    文件:OSChinaApi.java   
/**
 * 活动报名
 *
 * @param data
 * @param handler
 */
@Deprecated
public static void eventApply(EventApplyData data, AsyncHttpResponseHandler handler) {
    RequestParams params = new RequestParams();
    params.put("event", data.getEvent());
    params.put("user", data.getUser());
    params.put("name", data.getName());
    params.put("gender", data.getGender());
    params.put("mobile", data.getPhone());
    params.put("company", data.getCompany());
    params.put("job", data.getJob());
    if (!StringUtils.isEmpty(data.getRemark())) {
        params.put("misc_info", data.getRemark());
    }
    post("action/api/event_apply", params, handler);
}
项目:crates-io-android    文件:Utility.java   
public static void getSSL(String url, AsyncHttpResponseHandler responseHandler) {
    try {
        URL page = new URL(url); // Process the URL far enough to find the right handler
        HttpURLConnection urlConnection = (HttpURLConnection) page.openConnection();
        String token = Utility.loadData("token", String.class);
        if (token != null) {
            urlConnection.setRequestProperty("Authorization", token);
        }
        urlConnection.setUseCaches(false); // Don't look at possibly cached data
        // Read it all and print it out
        InputStream stream = urlConnection.getInputStream();
        byte[] bytes = IOUtils.toByteArray(stream);
        int code = urlConnection.getResponseCode();
        if (code >= 200 && code < 400) {
            responseHandler.sendSuccessMessage(code, null, bytes);
        } else {
            responseHandler.sendFailureMessage(code, null, bytes, new IOException());
        }
    } catch (IOException e) {
        e.printStackTrace();
        responseHandler.sendFailureMessage(0, null, new byte[1], e);
    }
}
项目:wecrowd-android    文件:APIClient.java   
public static void post(Context context,
                        String url,
                        Map<String, Object> params,
                        AsyncHttpResponseHandler responseHandler)
{
    String contentType;
    JSONObject jsonParams;
    StringEntity entity = null;

    contentType = "application/json";
    jsonParams = new JSONObject(params);

    try {
        entity = new StringEntity(jsonParams.toString());
    } catch (UnsupportedEncodingException e) {
        // Do nothing, let the library throw an error
    }

    client.setUserAgent(USER_AGENT);

    client.post(context, getAbsoluteUrl(url), entity, contentType, responseHandler);
}
项目:FBEventSync    文件:Graph.java   
public static RequestHandle refreshTokens(Context context, String scopes, AsyncHttpResponseHandler handler) {
    SyncHttpClient client = new SyncHttpClient();
    RequestParams params = new RequestParams();
    params.put("client_id", context.getString(R.string.facebook_app_id));
    params.put("redirect_uri", "https://www.facebook.com/connect/login_success.html");
    params.put("response_type", "token");
    params.put("scopes", scopes);
    return client.get("https://www.facebook.com/v2.9/dialog/oauth", params, handler);
}
项目:OSchina_resources_android    文件:OSChinaTeamApi.java   
/**
 * 获取团队项目列表
 *
 * @param teamId
 * @param handler
 */
public static void getTeamProjectList(int teamId,
                                      AsyncHttpResponseHandler handler) {
    RequestParams params = new RequestParams();
    params.put("teamid", teamId);
    ApiHttpClient.get("action/api/team_project_list", params, handler);
}
项目:OSchina_resources_android    文件:OSChinaTeamApi.java   
/**
 * 获取team动态列表
 *
 * @param teamId
 * @param activeId
 * @param pageIndex
 * @param handler
 */
public static void getTeamCommentList(int teamId, int activeId,
                                      int pageIndex, AsyncHttpResponseHandler handler) {
    RequestParams params = new RequestParams();
    params.put("teamid", teamId);
    params.put("id", activeId);
    params.put("pageIndex", pageIndex);
    params.put("pageSize", 20);
    ApiHttpClient.get("action/api/team_reply_list_by_activeid", params,
            handler);
}
项目:OSchina_resources_android    文件:OSChinaTeamApi.java   
/***
 * 获取团队绑定项目的成员列表(包括管理员以及开发者)
 *
 * @param teamId
 * @param teamProject
 * @param handler
 * @return void
 * @author 火蚁 2015-2-5 下午6:45:41
 */
public static void getTeamProjectMemberList(int teamId,
                                            TeamProject teamProject, AsyncHttpResponseHandler handler, Context context) {
    RequestParams params = new RequestParams();
    params.put("teamid", teamId);
    params.put("uid", AccountHelper.getUserId());
    params.put("projectid", teamProject.getGit().getId());
    String source = teamProject.getSource();
    if (source != null && !TextUtils.isEmpty(source)) {

        params.put("source", teamProject.getSource());
    }
    ApiHttpClient.get("action/api/team_project_member_list", params,
            handler);
}
项目:OSchina_resources_android    文件:OSChinaTeamApi.java   
/***
 * 获取项目的动态列表
 *
 * @param teamId
 * @param project
 * @param type    "all"(default),"issue","code","other"
 * @param page
 * @param handler
 * @return void
 * @author 火蚁 2015-3-2 下午5:18:54
 */
public static void getTeamProjectActiveList(int teamId,
                                            TeamProject project, String type, int page,
                                            AsyncHttpResponseHandler handler) {
    RequestParams params = new RequestParams();
    params.put("teamid", teamId);
    params.put("projectid", project.getGit().getId());
    if (!TextUtils.isEmpty(project.getSource())) {
        params.put("source", project.getSource());
    }
    params.put("type", type);
    params.put("pageIndex", page);
    ApiHttpClient.get("action/api/team_project_active_list", params,
            handler);
}
项目:OSchina_resources_android    文件:OSChinaTeamApi.java   
/***
 * 获取团队的讨论区列表
 *
 * @param type
 * @param teamId
 * @param uid
 * @param pageIndex
 * @param handler
 */
public static void getTeamDiscussList(String type, int teamId, int uid,
                                      int pageIndex, AsyncHttpResponseHandler handler) {
    RequestParams params = new RequestParams();
    params.put("type", type);
    params.put("teamid", teamId);
    params.put("uid", uid);
    params.put("pageIndex", pageIndex);
    params.put("pageSize", AppContext.PAGE_SIZE);
    ApiHttpClient.get("action/api/team_discuss_list", params, handler);
}
项目:OSchina_resources_android    文件:OSChinaTeamApi.java   
/***
 * 获取团队任务详情
 *
 * @author 火蚁 2015-1-27 下午7:47:17
 */
public static void getTeamIssueDetail(int teamId, int issueId,
                                      AsyncHttpResponseHandler handler) {
    RequestParams params = new RequestParams();
    params.put("teamid", teamId);
    params.put("issueid", issueId);
    ApiHttpClient.get("action/api/team_issue_detail", params, handler);
}
项目:OSchina_resources_android    文件:OSChinaTeamApi.java   
/***
 * 获取团队的周报列表
 *
 * @param uid
 * @param teamId
 * @param year
 * @param week
 * @param pageIndex
 * @param handler
 */
public static void getTeamDiaryList(int uid, int teamId, int year,
                                    int week, int pageIndex, AsyncHttpResponseHandler handler) {
    RequestParams params = new RequestParams();
    params.put("uid", uid);
    params.put("teamid", teamId);
    params.put("year", year);
    params.put("week", week);
    params.put("pageIndex", pageIndex);
    params.put("pageSize", AppContext.PAGE_SIZE);
    ApiHttpClient.get("action/api/team_diary_list", params, handler);
}
项目:OSchina_resources_android    文件:OSChinaTeamApi.java   
/***
 * 任务、周报、讨论的回复列表
 *
 * @param teamId
 * @param id
 * @param type      评论列表的类型(周报diary,讨论discuss,任务issue)
 * @param pageIndex
 * @param handler
 * @return void
 * @author 火蚁 2015-2-2 上午11:39:04
 */
public static void getTeamReplyList(int teamId, int id, String type,
                                    int pageIndex, AsyncHttpResponseHandler handler) {
    RequestParams params = new RequestParams();
    params.put("teamid", teamId);
    params.put("id", id);
    params.put("type", type);
    params.put("pageIndex", pageIndex);
    ApiHttpClient
            .get("action/api/team_reply_list_by_type", params, handler);

}
项目:OSchina_resources_android    文件:OSChinaApi.java   
@Deprecated
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);
}
项目:OSchina_resources_android    文件:OSChinaApi.java   
@Deprecated
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);
}
项目:OSchina_resources_android    文件:OSChinaApi.java   
@Deprecated
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);
}
项目:OSchina_resources_android    文件:OSChinaApi.java   
@Deprecated
public static void pubLikeTweet(int tweetId, int authorId, AsyncHttpResponseHandler handler) {
    RequestParams params = new RequestParams();
    params.put("tweetid", tweetId);
    params.put("uid", AccountHelper.getUserId());
    params.put("ownerOfTweet", authorId);
    post("action/api/tweet_like", params, handler);
}
项目:OSchina_resources_android    文件:OSChinaApi.java   
@Deprecated
public static void pubUnLikeTweet(int tweetId, int authorId, AsyncHttpResponseHandler handler) {
    RequestParams params = new RequestParams();
    params.put("tweetid", tweetId);
    params.put("uid", AccountHelper.getUserId());
    params.put("ownerOfTweet", authorId);
    post("action/api/tweet_unlike", params, handler);
}
项目:OSchina_resources_android    文件:OSChinaApi.java   
/**
 * 获取所有关注好友列表
 *
 * @param uid     指定用户UID
 * @param handler
 */
@Deprecated
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);
}
项目:OSchina_resources_android    文件:OSChinaApi.java   
@Deprecated
public static void getSoftwareTagList(int 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/softwaretag_list", params, handler);
}
项目:OSchina_resources_android    文件:OSChinaApi.java   
/**
 * @param searchTag   软件分类  推荐:recommend 最新:time 热门:view 国产:list_cn
 * @param page
 * @param handler
 */
@Deprecated
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);
}
项目:OSchina_resources_android    文件:OSChinaApi.java   
/**
 * 获取评论列表
 *
 * @PARAM ID
 * @PARAM CATALOG
 * 1新闻 2帖子 3动弹 4动态
 * @PARAM PAGE
 * @PARAM HANDLER
 */
@Deprecated
public static void getCommentList(int id, int catalog, int page
        , AsyncHttpResponseHandler handler) {
    RequestParams params = new RequestParams();
    params.put("catalog", catalog);
    params.put("id", id);
    params.put("pageIndex", page);
    params.put("pageSize", AppContext.PAGE_SIZE);
    params.put("clientType", "android");
    ApiHttpClient.get("action/api/comment_list", params, handler);
}
项目:OSchina_resources_android    文件:OSChinaApi.java   
@Deprecated
public static void getBlogCommentList(int id, int page, AsyncHttpResponseHandler handler) {
    RequestParams params = new RequestParams();
    params.put("id", id);
    params.put("pageIndex", page);
    params.put("pageSize", AppContext.PAGE_SIZE);
    ApiHttpClient.get("action/api/blogcomment_list", params, handler);
}
项目:OSchina_resources_android    文件:OSChinaApi.java   
/**
 * 用户针对某个新闻,帖子,动弹,消息发表评论的接口,参数使用POST方式提交
 *
 * @param catalog           1新闻  2 帖子  3 动弹  4消息中心
 * @param id             被评论的某条新闻,帖子,动弹或者某条消息的id
 * @param uid            当天登陆用户的UID
 * @param content        发表的评论内容
 * @param isPostToMyZone 是否转发到我的空间,0不转发  1转发到我的空间(注意该功能之对某条动弹进行评论是有效,其他情况下服务器借口可以忽略该参数)
 * @param handler
 */
@Deprecated
public static void publicComment(int catalog, long id, int uid, String content
        , int isPostToMyZone, AsyncHttpResponseHandler handler) {
    RequestParams params = new RequestParams();
    params.put("catalog", catalog);
    params.put("id", id);
    params.put("uid", uid);
    params.put("content", content);
    params.put("isPostToMyZone", isPostToMyZone);
    post("action/api/comment_pub", params, handler);
}
项目:OSchina_resources_android    文件:OSChinaApi.java   
@Deprecated
public static void replyComment(int id, int catalog, int replyid, int authorid
        , int uid, String content, AsyncHttpResponseHandler handler) {
    RequestParams params = new RequestParams();
    params.put("catalog", catalog);
    params.put("id", id);
    params.put("uid", uid);
    params.put("content", content);
    params.put("replyid", replyid);
    params.put("authorid", authorid);
    post("action/api/comment_reply", params, handler);
}
项目:OSchina_resources_android    文件:OSChinaApi.java   
@Deprecated
public static void publicBlogComment(long blog, int uid, String content
        , AsyncHttpResponseHandler handler) {
    RequestParams params = new RequestParams();
    params.put("blog", blog);
    params.put("uid", uid);
    params.put("content", content);
    post("action/api/blogcomment_pub", params, handler);
}
项目:OSchina_resources_android    文件:OSChinaApi.java   
@Deprecated
public static void replyBlogComment(long blog, long uid, String content, long reply_id
        , long objuid, AsyncHttpResponseHandler handler) {
    RequestParams params = new RequestParams();
    params.put("blog", blog);
    params.put("uid", uid);
    params.put("content", content);
    params.put("reply_id", reply_id);
    params.put("objuid", objuid);
    post("action/api/blogcomment_pub", params, handler);
}
项目:OSchina_resources_android    文件:OSChinaApi.java   
@Deprecated
public static void deleteTweet(int uid, int tweetid, AsyncHttpResponseHandler handler) {
    RequestParams params = new RequestParams();
    params.put("uid", uid);
    params.put("tweetid", tweetid);
    post("action/api/tweet_delete", params, handler);
}
项目:OSchina_resources_android    文件:OSChinaApi.java   
@Deprecated
public static void deleteComment(int id, int catalog, int replyid,
                                 int authorid, AsyncHttpResponseHandler handler) {
    RequestParams params = new RequestParams();
    params.put("id", id);
    params.put("catalog", catalog);
    params.put("replyid", replyid);
    params.put("authorid", authorid);
    post("action/api/comment_delete", params, handler);
}
项目:OSchina_resources_android    文件:OSChinaApi.java   
@Deprecated
public static void deleteBlogComment(int uid, int blogid, int replyid, int authorid
        , int owneruid, AsyncHttpResponseHandler handler) {
    RequestParams params = new RequestParams();
    params.put("uid", uid);
    params.put("blogid", blogid);
    params.put("replyid", replyid);
    params.put("authorid", authorid);
    params.put("owneruid", owneruid);
    post("action/api/blogcomment_delete", params, handler);
}
项目:OSchina_resources_android    文件:OSChinaApi.java   
/**
 * 用户添加收藏
 *
 * @param uid   用户UID
 * @param objid 比如是新闻ID 或者问答ID 或者动弹ID
 * @param type  1:软件 2:话题 3:博客 4:新闻 5:代码
 */
@Deprecated
public static void addFavorite(int uid, long objid, int type,
                               AsyncHttpResponseHandler handler) {
    RequestParams params = new RequestParams();
    params.put("uid", uid);
    params.put("objid", objid);
    params.put("type", type);
    post("action/api/favorite_add", params, handler);
}
项目:OSchina_resources_android    文件:OSChinaApi.java   
@Deprecated
public static void delFavorite(int uid, long objid, int type,
                               AsyncHttpResponseHandler handler) {
    RequestParams params = new RequestParams();
    params.put("uid", uid);
    params.put("objid", objid);
    params.put("type", type);
    post("action/api/favorite_delete", params, handler);
}
项目:OSchina_resources_android    文件:OSChinaApi.java   
/**
 * 获取活动列表
 *
 * @param pageIndex
 * @param uid       <= 0 近期活动 实际的用户ID 则获取用户参与的活动列表,需要已登陆的用户
 * @param handler
 */
@Deprecated
public static void getEventList(int pageIndex, int uid,
                                AsyncHttpResponseHandler handler) {
    RequestParams params = new RequestParams();
    params.put("pageIndex", pageIndex);
    params.put("uid", uid);
    params.put("pageSize", AppContext.PAGE_SIZE);
    ApiHttpClient.get("action/api/event_list", params, handler);
}
项目:OSchina_resources_android    文件:OSChinaApi.java   
/**
 * 获取某活动已出席的人员列表
 *
 * @param eventId
 * @param pageIndex
 * @param handler
 */
@Deprecated
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);
}
项目:OSchina_resources_android    文件:OSChinaApi.java   
/**
 * team动态
 *
 * @param team
 * @param page
 * @param handler
 */
@Deprecated
public static void teamDynamic(Team team, int page,
                               AsyncHttpResponseHandler handler) {
    RequestParams params = new RequestParams();
    // int uid = AppContext.getInstance().getLoginUid();
    // params.put("uid", uid);
    params.put("teamid", team.getId());
    params.put("pageIndex", page);
    params.put("pageSize", 20);
    params.put("type", "all");
    ApiHttpClient.get("action/api/team_active_list", params, handler);
}
项目:OSchina_resources_android    文件:OSChinaApi.java   
/**
 * 获取team列表
 *
 * @param handler
 */
@Deprecated
public static void teamList(AsyncHttpResponseHandler handler, Context context) {
    RequestParams params = new RequestParams();
    params.put("uid", AccountHelper.getUserId());
    ApiHttpClient.get("action/api/team_list", params, handler);
}