修改点赞逻辑,评论数据同步

This commit is contained in:
khy
2016-12-01 14:45:55 +08:00
parent e82f202a17
commit 24c41107d2
11 changed files with 184 additions and 50 deletions

View File

@ -55,22 +55,30 @@ public class PostCommentUtils {
}).start();
}
public static void addCommentVoto(final Context context, final String newsId) {
addCommentVoto(context, newsId, true);
public static void addCommentVoto(final Context context, final String newsId, final PostCommentListener listener) {
addCommentVoto(context, newsId, true, listener);
}
public static void addCommentVoto(final Context context, final String newsId, final boolean isCheck) {
public static void addCommentVoto(final Context context, final String newsId, final boolean isCheck
, final PostCommentListener listener) {
new Thread(new Runnable() {
@Override
public void run() {
StringExtendedRequest request = new StringExtendedRequest(
Request.Method.POST, Config.COMMENT_HOST + "comment/" + newsId + "/vote" ,
null,
Request.Method.POST, Config.COMMENT_HOST + "comment/" + newsId + "/vote",
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
listener.postSucced(null);
}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
if (error.networkResponse != null && error.networkResponse.statusCode == 401) {
addCommentVoto(context, newsId, false);
addCommentVoto(context, newsId, false,listener);
} else {
listener.postFailed(error);
}
}
});