reformat code & optimize import & reorder entries
This commit is contained in:
@ -1,17 +1,11 @@
|
||||
package com.gh.common.util;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.gh.gamecenter.entity.CommentEntity;
|
||||
import com.gh.gamecenter.retrofit.JSONObjectResponse;
|
||||
import com.gh.gamecenter.retrofit.*;
|
||||
import com.gh.gamecenter.retrofit.Response;
|
||||
import com.gh.gamecenter.retrofit.RetrofitManager;
|
||||
|
||||
import okhttp3.*;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import okhttp3.MediaType;
|
||||
import okhttp3.RequestBody;
|
||||
import okhttp3.ResponseBody;
|
||||
import retrofit2.adapter.rxjava.HttpException;
|
||||
import rx.Observable;
|
||||
import rx.android.schedulers.AndroidSchedulers;
|
||||
@ -20,7 +14,6 @@ import rx.schedulers.Schedulers;
|
||||
|
||||
/**
|
||||
* Created by khy on 2016/11/9.
|
||||
*
|
||||
*/
|
||||
public class PostCommentUtils {
|
||||
|
||||
@ -46,7 +39,7 @@ public class PostCommentUtils {
|
||||
@Override
|
||||
public void onResponse(JSONObject response) {
|
||||
if (response.length() != 0) {
|
||||
if (listener != null){
|
||||
if (listener != null) {
|
||||
listener.postSuccess(response);
|
||||
}
|
||||
} else {
|
||||
@ -66,7 +59,7 @@ public class PostCommentUtils {
|
||||
addCommentData(context, newsId, content, false, commentEntity, listener);
|
||||
return;
|
||||
}
|
||||
if (listener != null){
|
||||
if (listener != null) {
|
||||
listener.postFailed(e);
|
||||
}
|
||||
}
|
||||
@ -106,7 +99,7 @@ public class PostCommentUtils {
|
||||
}
|
||||
|
||||
public static void addReportData(final Context context, final String reportData, boolean isCheck,
|
||||
final PostCommentListener listener) {
|
||||
final PostCommentListener listener) {
|
||||
TokenUtils.getToken(context, isCheck)
|
||||
.flatMap(new Func1<String, Observable<ResponseBody>>() {
|
||||
@Override
|
||||
@ -136,6 +129,7 @@ public class PostCommentUtils {
|
||||
|
||||
public interface PostCommentListener {
|
||||
void postSuccess(JSONObject response);
|
||||
|
||||
void postFailed(Throwable error);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user