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

项目:OSchina_resources_android    文件:OSChinaApi.java   
/**
 * 发布评论
 */
public static void pubComment(long sourceId, int type, String content, long referId, long replyId,
                              long reAuthorId,
                              TextHttpResponseHandler handler) {
    RequestParams params = new RequestParams();
    params.put("sourceId", sourceId);
    params.put("type", type);
    params.put("content", content);
    if (referId > 0)
        params.put("referId", referId);
    if (replyId > 0)
        params.put("replyId", replyId);
    if (reAuthorId > 0)
        params.put("reAuthorId", reAuthorId);
    post("action/apiv2/comment_push", params, handler);
}
项目:OSchina_resources_android    文件:API.java   
/**
 * 获取项目评论
 *
 * @param id      项目id
 * @param handler 回调
 */
public static void getProjectComments(long id, String token, TextHttpResponseHandler handler) {
    RequestParams params = new RequestParams();
    params.put("projectId", id);
    params.put("pageToken", token);
    ApiHttpClient.get("action/apiv2/git_comments_list", params, handler);
}
项目:OSchina_resources_android    文件:API.java   
/**
 * 添加git项目评论
 *
 * @param project 项目
 * @param comment 内容
 * @param handler 回调
 */
public static void addProjectComment(Project project, String comment, TextHttpResponseHandler handler) {
    RequestParams params = new RequestParams();
    params.put("projectId", project.getId());
    params.put("name", project.getName());
    params.put("pathWithNamespace", project.getPathWithNamespace());
    params.put("content", comment);
    ApiHttpClient.post("action/apiv2/pub_git_comment", params, handler);
}
项目:OSchina_resources_android    文件:API.java   
/**
 * 获取代码片段
 *
 * @param language language
 * @param type     type
 * @param page     page
 * @param handler  handler
 */
public static void getGists(String language, String type, int page, TextHttpResponseHandler handler) {
    RequestParams params = new RequestParams();
    if (!TextUtils.isEmpty(language))
        params.put("language", language);
    if (!TextUtils.isEmpty(type))
        params.put("type", type);
    params.put("page", page);
    mClient.get("https://gitee.com/api/v3/gists/public", params, handler);
}
项目:OSchina_resources_android    文件:API.java   
/**
 * 发表代码片段评论
 *
 * @param id      id
 * @param name    name
 * @param content content
 * @param handler 回调
 */
public static void pubGistComment(String id, String name, String url, String content, TextHttpResponseHandler handler) {
    RequestParams params = new RequestParams();
    params.put("gistId", id);
    params.put("name", name);
    params.put("url", url);
    params.put("content", content);
    ApiHttpClient.post("action/apiv2/pub_gist_comment", params, handler);
}
项目:OSchina_resources_android    文件:API.java   
/**
 * 代码片段评论列表
 *
 * @param id      id
 * @param token   token
 * @param handler handler
 */
public static void getGistComments(String id, String token, TextHttpResponseHandler handler) {
    RequestParams params = new RequestParams();
    params.put("gistId", id);
    if (!TextUtils.isEmpty(token))
        params.put("pageToken", token);
    ApiHttpClient.get("action/apiv2/gist_comments_list", params, handler);
}
项目:OSchina_resources_android    文件:OSChinaApi.java   
/**
 * get software tweet list
 *
 * @param tag     software tag
 * @param handler handler
 */
public static void getSoftwareTweetList(String tag, String pageToken, TextHttpResponseHandler handler) {
    if (TextUtils.isEmpty(tag)) return;
    RequestParams params = new RequestParams();
    params.put("tag", tag);
    params.put("pageToken", pageToken);
    ApiHttpClient.get("action/apiv2/tweets", params, handler);
}
项目:OSchina_resources_android    文件:OSChinaApi.java   
/**
 * pub tweet like status
 *
 * @param sourceId source id
 * @param handler  handler
 */
public static void pubSoftwareLike(long sourceId, TextHttpResponseHandler handler) {
    if (sourceId <= 0) return;
    RequestParams params = new RequestParams();
    params.put("sourceId", sourceId);
    post("action/apiv2/tweet_like_reverse", params, handler);
}
项目:OSchina_resources_android    文件:OSChinaApi.java   
/**
 * 请求评论详情
 *
 * @param id      评论Id
 * @param handler AsyncHttpResponseHandler
 */
public static void getCommentDetail(long id, long aid, int type, TextHttpResponseHandler handler) {
    if (id <= 0) return;
    RequestParams params = new RequestParams();
    params.put("id", id);
    params.put("authorId", aid);
    params.put("type", type);
    ApiHttpClient.get("action/apiv2/comment_detail", params, handler);
}
项目:OSchina_resources_android    文件:OSChinaApi.java   
/**
 * 发表评论
 *
 * @param sourceId   文章id
 * @param referId    引用的评论的id,问答评论详情
 * @param replyId    回复的评论的id
 * @param reAuthorId 引用、回复的发布者id
 * @param type       文章类型 1:软件推荐, 2:问答帖子, 3:博客, 4:翻译文章, 5:活动, 6:资讯
 * @param content    内容
 * @param handler    你懂得
 */
public static void publishComment(long sourceId, long referId, long replyId, long reAuthorId,
                                  int type, String content, TextHttpResponseHandler handler) {
    RequestParams params = new RequestParams();
    params.put("sourceId", sourceId);
    params.put("type", type);
    params.put("content", content);
    if (referId > 0)
        params.put("referId", referId);
    if (replyId > 0)
        params.put("replyId", replyId);
    if (reAuthorId > 0)
        params.put("reAuthorId", reAuthorId);
    post("action/apiv2/comment_push", params, handler);
}
项目:OSchina_resources_android    文件:OSChinaApi.java   
/**
 * 发表资讯评论
 *
 * @see {{@link #publicComment(int, long, int, String, int, AsyncHttpResponseHandler)}}
 */
public static void pubNewsComment(long sid, long commentId, long commentAuthorId
        , String comment, TextHttpResponseHandler handler) {
    if (commentId == 0 || commentId == sid) {
        commentId = 0;
        commentAuthorId = 0;
    }
    publishComment(sid, 0, commentId, commentAuthorId, 6, comment, handler);
}
项目:OSchina_resources_android    文件:OSChinaApi.java   
/**
 * 发表问答评论
 *
 * @see {{@link #publicComment(int, long, int, String, int, AsyncHttpResponseHandler)}}
 */
public static void pubQuestionComment(long sid, long commentId, long commentAuthorId
        , String comment, TextHttpResponseHandler handler) {
    if (commentId == 0 || commentId == sid) {
        commentId = 0;
        commentAuthorId = 0;
    }
    publishComment(sid, 0, commentId, commentAuthorId, 2, comment, handler);
}
项目:OSchina_resources_android    文件:OSChinaApi.java   
/**
 * 发表翻译评论
 *
 * @see {{@link #publicComment(int, long, int, String, int, AsyncHttpResponseHandler)}}
 */
public static void pubTranslateComment(long sid, long commentId, long commentAuthorId
        , String comment, TextHttpResponseHandler handler) {
    if (commentId == 0 || commentId == sid) {
        commentId = 0;
        commentAuthorId = 0;
    }
    publishComment(sid, 0, commentId, commentAuthorId, 4, comment, handler);
}
项目:OSchina_resources_android    文件:OSChinaApi.java   
/**
 * 发布博客评论
 *
 * @see {{@link #publicComment(int, long, int, String, int, AsyncHttpResponseHandler)}}
 */
public static void pubBlogComment(long sid, long commentId, long commentAuthorId
        , String comment, TextHttpResponseHandler handler) {
    if (commentId == 0 || commentId == sid) {
        commentId = 0;
        commentAuthorId = 0;
    }
    publishComment(sid, 0, commentId, commentAuthorId, 3, comment, handler);
}
项目:OSchina_resources_android    文件:OSChinaApi.java   
/**
 * 对资讯,博客,翻译详情下的评论列表进行顶操作(ps:默认现在只能顶,不能取消)
 *
 * @param sourceType      sourceType
 * @param commentId       commentId
 * @param commentAuthorId commentAuthorId
 * @param voteOpt         voteOpt
 * @param handler         handler
 */
public static void voteComment(int sourceType, long commentId, long commentAuthorId
        , int voteOpt, TextHttpResponseHandler handler) {
    if (commentId <= 0) return;
    RequestParams params = new RequestParams();
    params.put("sourceType", sourceType);
    params.put("commentId", commentId);
    params.put("commentAuthorId", commentAuthorId);
    params.put("voteOpt", voteOpt);
    post("action/apiv2/comment_vote_reverse", params, handler);

}
项目:OSchina_resources_android    文件:OSChinaApi.java   
/**
 * 请求动弹评论列表
 *
 * @param sourceId 动弹id
 * @param handler  回调
 */
public static void getTweetCommentList(long sourceId, String pageToken, TextHttpResponseHandler handler) {
    RequestParams params = new RequestParams();
    params.put("sourceId", sourceId);
    params.put("pageToken", pageToken);
    ApiHttpClient.get("action/apiv2/tweet_comments", params, handler);
}
项目:OSchina_resources_android    文件:OSChinaApi.java   
/**
 * 请求动弹点赞列表
 *
 * @param sourceId 动弹id
 * @param handler  回调
 */
public static void getTweetLikeList(long sourceId, String pageToken, TextHttpResponseHandler handler) {
    RequestParams params = new RequestParams();
    params.put("sourceId", sourceId);
    params.put("pageToken", pageToken);
    ApiHttpClient.get("action/apiv2/tweet_likes", params, handler);
}
项目:OSchina_resources_android    文件:OSChinaApi.java   
public static void pubMessage(long authorId, File content, TextHttpResponseHandler handler) {
    RequestParams params = new RequestParams();
    params.put("authorId", authorId);
    try {
        params.put("file", content);
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    }
    post("action/apiv2/messages_pub", params, handler);
}
项目:OSchina_resources_android    文件:OSChinaApi.java   
/**
 * 添加反馈,私信接口
 *
 * @param authorId
 * @param content
 * @param file
 * @param handler
 */
public static void pubMessage(long authorId, String content, File file, TextHttpResponseHandler handler) {
    RequestParams params = new RequestParams();
    params.put("authorId", authorId);
    params.put("content", content);
    if (file != null && file.exists()) {
        try {
            params.put("file", file);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    post("action/apiv2/messages_pub", params, handler);
}
项目:OSchina_resources_android    文件:OSChinaApi.java   
/**
 * 获取某用户的信息
 *
 * @param uid  user id
 * @param nick unique personal suffix
 */
public static void getUserInfo(long uid, String nick, String suffix, TextHttpResponseHandler handler) {
    RequestParams params = new RequestParams();
    if (uid > 0) params.put("id", uid);
    params.put("nickname", nick);
    params.put("suffix", suffix);
    ApiHttpClient.get("action/apiv2/user_info", params, handler);
}
项目:OSchina_resources_android    文件:OSChinaApi.java   
/**
 * 获取个人信息
 */
public static void getUserInfo(TextHttpResponseHandler handler) {
    // RequestParams params = new RequestParams();
    // params.put("id", uid);
    ApiHttpClient.get("action/apiv2/user_info", handler);

}
项目:OSchina_resources_android    文件:OSChinaApi.java   
/**
 * update the user icon
 *
 * @param file    file
 * @param handler handler
 */
public static void updateUserIcon(File file, TextHttpResponseHandler handler) {
    if (file == null) return;
    RequestParams params = new RequestParams();
    try {
        params.put("portrait", file);
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    }
    post("action/apiv2/user_edit_portrait", params, handler);

}
项目:OSchina_resources_android    文件:OSChinaApi.java   
/**
 * @param type      {@link #TYPE_USER_FLOWS ,#TYPE_USER_FANS}
 * @param userId    userId
 * @param pageToken pageToken
 * @param handler   handler
 */
public static void getUserFansOrFlows(int type, long userId, String pageToken, TextHttpResponseHandler handler) {
    if (userId <= 0) return;
    RequestParams params = new RequestParams();
    params.put("id", userId);
    params.put("pageToken", pageToken);

    String uri = "user_follows";
    if (type == TYPE_USER_FANS) {
        uri = "user_fans";
    }
    ApiHttpClient.get("action/apiv2/" + uri, params, handler);
}
项目:OSchina_resources_android    文件:OSChinaApi.java   
public static void checkUpdate(TextHttpResponseHandler handler) {
    RequestParams params = new RequestParams();
    params.put("appId", 1);
    params.put("catalog", 1);
    params.put("all", false);
    ApiHttpClient.get("action/apiv2/product_version", params, handler);
}
项目:OSchina_resources_android    文件:OSChinaApi.java   
/**
 * @param catalog  open catalog
 * @param openInfo openInfo
 * @param handler  handler
 */
public static void openLogin(String catalog, String openInfo, TextHttpResponseHandler handler) {
    if (TextUtils.isEmpty(openInfo)) return;
    RequestParams params = new RequestParams();
    params.put("catalog", catalog);
    params.put("info", openInfo);

    post("action/apiv2/account_open_login", params, handler);
}
项目:OSchina_resources_android    文件:OSChinaApi.java   
/**
 * register user info
 *
 * @param username   username
 * @param password   pwd
 * @param gender     gender
 * @param phoneToken token
 * @param handler    handler
 */
public static void register(String username, String password, int gender
        , String phoneToken, TextHttpResponseHandler handler) {
    RequestParams params = new RequestParams();
    params.put("username", username);
    params.put("password", password);
    params.put("gender", gender);
    params.put("phoneToken", phoneToken);

    post("action/apiv2/account_register", params, handler);
}
项目:OSchina_resources_android    文件:OSChinaApi.java   
/**
 * reset pwd
 *
 * @param password   password
 * @param phoneToken token
 * @param handler    handler
 */
public static void resetPwd(String password, String phoneToken
        , TextHttpResponseHandler handler) {
    RequestParams params = new RequestParams();
    params.put("password", password);
    params.put("phoneToken", phoneToken);

    post("action/apiv2/account_password_forgot", params, handler);
}
项目:OSchina_resources_android    文件:OSChinaApi.java   
/**
 * 动弹列表
 *
 * @param aid     author id, 请求某人的动弹
 * @param tag     相关话题
 * @param type    1: 广场(所有动弹), 2:朋友圈(好友动弹)
 * @param order   1: 最新, 2:最热
 * @param handler handler
 */
public static void getTweetList(Long aid, String tag, Integer type, Integer order
        , String pageToken, TextHttpResponseHandler handler) {
    RequestParams params = new RequestParams();
    if (aid != null) {
        params.put("authorId", aid);
    } else if (!TextUtils.isEmpty(tag)) {
        params.put("tag", tag);
    } else {
        params.put("type", type);
    }
    params.put("order", order);
    params.put("pageToken", pageToken);
    ApiHttpClient.get("action/apiv2/tweet_list", params, handler);
}
项目:OSchina_resources_android    文件:OSChinaApi.java   
/**
 * 新版获得各种类型详情统一接口和Model
 */
public static void getDetail(int type, String ident, long id, TextHttpResponseHandler handler) {
    RequestParams params = new RequestParams();
    params.put("type", type);
    params.put("id", id);
    if (!TextUtils.isEmpty(ident))
        params.put("ident", ident);
    ApiHttpClient.get("action/apiv2/detail", params, handler);
}
项目:OSchina_resources_android    文件:OSChinaApi.java   
/**
 * event signin
 *
 * @param sourceId sourceId
 * @param phone    phone
 * @param handler  handler
 */
public static void eventSignin(long sourceId, String phone, TextHttpResponseHandler handler) {
    if (sourceId <= 0) return;
    RequestParams params = new RequestParams();
    params.put("sourceId", sourceId);
    if (!TextUtils.isEmpty(phone))
        params.put("phone", phone);
    ApiHttpClient.post("action/apiv2/event_signin", params, handler);
}
项目:OSchina_resources_android    文件:OSChinaApi.java   
/**
 * 新版活动报名,动态参数
 */
public static void signUpEvent(long sourceId, List<SignUpEventOptions> options, TextHttpResponseHandler handler) {
    StringParams params = new StringParams();
    params.putForm("sourceId", String.valueOf(sourceId));
    for (SignUpEventOptions option : options) {
        params.putForm(option.getKey(), option.getValue());
    }
    ApiHttpClient.post("action/apiv2/event_apply", params, handler);
}
项目:OSchina_resources_android    文件:OSChinaApi.java   
/**
 * 获取用户自己的活动
 *
 * @param authorId   authorId
 * @param authorName authorName
 * @param pageToken  pageToken
 * @param handler    handler
 */
public static void getUserEvent(long authorId, String authorName, String pageToken, TextHttpResponseHandler handler) {
    if (authorId <= 0) return;
    RequestParams params = new RequestParams();
    params.put("authorId", authorId);
    params.put("authorName", authorName);
    params.put("pageToken", pageToken);
    ApiHttpClient.get("action/apiv2/event_list", params, handler);

}
项目:OSchina_resources_android    文件:OSChinaApi.java   
/**
 * 举报
 *
 * @param sourceId 举报的内容数据Id
 * @param type     举报资源的类型
 * @param href     举报的文章地址
 * @param reason   举报原因:
 * @param memo     其他原因的描述字段
 * @param handler
 */
public static void report(long sourceId, int type, String href, int reason, String memo,
                          TextHttpResponseHandler handler) {
    RequestParams params = new RequestParams();
    params.put("sourceId", sourceId);
    params.put("type", type);
    params.put("href", href);
    params.put("reason", reason);
    params.put("memo", memo);
    ApiHttpClient.post("action/apiv2/report", params, handler);
}
项目:OSchina_resources_android    文件:OSChinaApi.java   
/**
 * 获取活动出席列表
 */
public static void getApplyUsers(long sourceId, String pageToken, String filter, TextHttpResponseHandler handler) {
    RequestParams params = new RequestParams();
    params.put("sourceId", sourceId);
    if (!TextUtils.isEmpty(pageToken))
        params.put("pageToken", pageToken);
    if (!TextUtils.isEmpty("filter")) {
        params.put("filter", filter);
    }
    ApiHttpClient.post("action/apiv2/event_attendee_list", params, handler);
}
项目:OSchina_resources_android    文件:OSChinaApi.java   
/**
 * 拉取用户好友(联系人)
 *
 * @param userId       userId
 * @param pageToken    pageToken
 * @param requestCount requestCount
 * @param handler      handler
 */
public static void getUserFriends(long userId, String pageToken, int requestCount, TextHttpResponseHandler handler) {

    if (userId <= 0) return;
    RequestParams params = new RequestParams();
    params.put("id", userId);
    params.put("pageToken", pageToken);
    params.put("count", requestCount);
    ApiHttpClient.get("action/apiv2/user_follows", params, handler);

}
项目:OSchina_resources_android    文件:OSChinaApi.java   
/**
 * 支付打赏接口信息拉取
 *
 * @param authorId 被打赏作者
 * @param objId    文章id
 * @param money    价格,支付宝单位元、微信单位分
 * @param payType  支付类型 1 支付宝  2、微信支付  返回结果不一样
 * @param handler  handler
 */
public static void getPayDonate(long authorId, long objId, float money, int payType, TextHttpResponseHandler handler) {
    RequestParams params = new RequestParams();
    params.put("authorId", authorId);
    params.put("objId", objId);
    params.put("money", Float.valueOf(money).intValue());
    params.put("payType", payType);
    Log.e("getPayDonate", "  --  " + authorId + "  --  " + objId + " --  " + money + "  -- " + payType);
    ApiHttpClient.get("action/apiv2/blog_donate_prepare", params, handler);
}
项目:OSchina_resources_android    文件:OSChinaApi.java   
/**
 * 获取用户活动列表
 */
public static void getUserEvents(long authorId, String authorName, String pageToken, TextHttpResponseHandler handler) {
    RequestParams params = new RequestParams();
    if (authorId > 0)
        params.put("authorId", authorId);
    if (!TextUtils.isEmpty(authorName))
        params.put("authorName", authorName);
    if (!TextUtils.isEmpty(pageToken))
        params.put("pageToken", pageToken);
    ApiHttpClient.get("action/apiv2/event_list", params, handler);
}
项目:OSchina_resources_android    文件:OSChinaApi.java   
/**
 * 修改用户资料
 * 忽略则不修改
 *
 * @param handler 回调
 */
public static void updateUserInfo(String userName,
                                  String signature,
                                  String skill,
                                  String field,
                                  String province,
                                  String city,
                                  TextHttpResponseHandler handler) {
    RequestParams params = new RequestParams();
    if (!TextUtils.isEmpty(userName)) {
        params.put("nickname", userName);
    }
    if (!TextUtils.isEmpty(signature)) {
        params.put("signature", signature);
    }
    if (!TextUtils.isEmpty(skill)) {
        params.put("skill", skill);
    }
    if (!TextUtils.isEmpty(field)) {
        params.put("field", field);
    }
    if (!TextUtils.isEmpty(province)) {
        params.put("province", province);
    }
    if (!TextUtils.isEmpty(city)) {
        params.put("city", city);
    }
    ApiHttpClient.get("action/apiv2/user_edit_infos", params, handler);
}
项目:OSchina_resources_android    文件:OSChinaApi.java   
/**
 * 发布博客
 *
 * @param Blog    博客
 * @param handler 回调
 */
public static void pubBlog(Blog blog, TextHttpResponseHandler handler) {
    RequestParams params = new RequestParams();
    params.put("title", blog.getTitle());
    params.put("abstract", blog.getSummary());
    params.put("system", blog.getSystem());
    params.put("catalog", blog.getCatalog());
    params.put("canVisible", blog.getCanVisible());
    params.put("canComment", blog.getCanComment());
    params.put("isStick", blog.getIsStick());
    params.put("type", blog.getType());
    params.put("content", blog.getContent());
    ApiHttpClient.post("action/apiv2/pub_blog", params, handler);
}
项目:JSSample    文件:HttpUtils.java   
public static void get(Context context, String urlString, TextHttpResponseHandler res)   //不带参数,获取json对象或者数组
{
    if (isNetworkConnected(context)) {
        client.cancelRequests(context, true);
        client.get(urlString, res);
    } else {
        makeText(context);
    }

}