// Path: app/src/main/java/com/socks/jiandan/callback/OnHttpResponseCallBackImpl.java
// public abstract class OnHttpResponseCallBackImpl<T> implements OnHttpResponseCallBack<T> {
// 
// 
//     @Override
//     public void onSuccess(int statusCode,T t) {
// 
//     }
// 
//     @Override
//     public void onStart() {
// 
//     }
// 
//     @Override
//     public void onFinish() {
// 
//     }
// 
//     @Override
//     public void onFailure(int statusCode, Throwable throwable) {
// 
//     }
// 
//     @Override
//     public void onCancel() {
// 
//     }
// }
// 
// Path: app/src/main/java/com/socks/jiandan/utils/JSONParser.java
// public class JSONParser {
// 
//     private static Gson gson = new Gson();
// 
//     public static String toString(Object obj) {
//         return gson.toJson(obj);
//     }
// 
//     /**
//      * @param type 类型反射(Class<?>)或反射令牌(TypeToken)
//      * @return Object
//      * @throws
//      * @Description: 将标准JSON字符串反序列化为对象
//      */
//     public static Object toObject(String jsonString, Object type) {
//         jsonString = jsonString.replace("&nbsp", "");
//         jsonString = jsonString.replace("﹠nbsp", "");
//         jsonString = jsonString.replace("nbsp", "");
//         jsonString = jsonString.replace("&amp;", "");
//         jsonString = jsonString.replace("&amp", "");
//         jsonString = jsonString.replace("amp", "");
//         if (type instanceof Type) {
//             try {
//                 return gson.fromJson(jsonString, (Type) type);
//             } catch (JsonSyntaxException e) {
//                 e.printStackTrace();
//                 return null;
//             }
//         } else if (type instanceof Class<?>) {
//             try {
//                 return gson.fromJson(jsonString, (Class<?>) type);
//             } catch (JsonSyntaxException e) {
//                 e.printStackTrace();
//                 return null;
//             }
//         } else {
//             throw new RuntimeException("只能是Class<?>或者通过TypeToken获取的Type类型");
//         }
//     }
// }


import android.support.annotation.NonNull;
import com.google.gson.reflect.TypeToken;
import com.socks.jiandan.callback.OnHttpResponseCallBackImpl;
import com.socks.jiandan.model.Picture;
import com.socks.jiandan.utils.JSONParser;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
package com.socks.jiandan.async;





/**
 * Created by zhaokaiqiang on 15/11/10.
 */
public class Handler4Picture extends BaseJsonResponseHandler {

    public Handler4Picture(@NonNull OnHttpResponseCallBackImpl<ArrayList<Picture>> onHttpResponseCallBack) {
        super(onHttpResponseCallBack);
    }

    @Override
    protected void onSuccess(int statusCode, String rawJsonResponse) {

        try {
            String jsonStr = new JSONObject(rawJsonResponse).getJSONArray("comments").toString();

            ArrayList<Picture> pictures = (ArrayList<Picture>) JSONParser.toObject(jsonStr,
// Path: app/src/main/java/com/socks/jiandan/callback/OnHttpResponseCallBackImpl.java
// public abstract class OnHttpResponseCallBackImpl<T> implements OnHttpResponseCallBack<T> {
// 
// 
//     @Override
//     public void onSuccess(int statusCode,T t) {
// 
//     }
// 
//     @Override
//     public void onStart() {
// 
//     }
// 
//     @Override
//     public void onFinish() {
// 
//     }
// 
//     @Override
//     public void onFailure(int statusCode, Throwable throwable) {
// 
//     }
// 
//     @Override
//     public void onCancel() {
// 
//     }
// }
// 
// Path: app/src/main/java/com/socks/jiandan/utils/JSONParser.java
// public class JSONParser {
// 
//     private static Gson gson = new Gson();
// 
//     public static String toString(Object obj) {
//         return gson.toJson(obj);
//     }
// 
//     /**
//      * @param type 类型反射(Class<?>)或反射令牌(TypeToken)
//      * @return Object
//      * @throws
//      * @Description: 将标准JSON字符串反序列化为对象
//      */
//     public static Object toObject(String jsonString, Object type) {
//         jsonString = jsonString.replace("&nbsp", "");
//         jsonString = jsonString.replace("﹠nbsp", "");
//         jsonString = jsonString.replace("nbsp", "");
//         jsonString = jsonString.replace("&amp;", "");
//         jsonString = jsonString.replace("&amp", "");
//         jsonString = jsonString.replace("amp", "");
//         if (type instanceof Type) {
//             try {
//                 return gson.fromJson(jsonString, (Type) type);
//             } catch (JsonSyntaxException e) {
//                 e.printStackTrace();
//                 return null;
//             }
//         } else if (type instanceof Class<?>) {
//             try {
//                 return gson.fromJson(jsonString, (Class<?>) type);
//             } catch (JsonSyntaxException e) {
//                 e.printStackTrace();
//                 return null;
//             }
//         } else {
//             throw new RuntimeException("只能是Class<?>或者通过TypeToken获取的Type类型");
//         }
//     }
// }


// Path: app/src/main/java/com/socks/jiandan/async/Handler4Picture.java
import android.support.annotation.NonNull;
import com.google.gson.reflect.TypeToken;
import com.socks.jiandan.callback.OnHttpResponseCallBackImpl;
import com.socks.jiandan.model.Picture;
import com.socks.jiandan.utils.JSONParser;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;

package com.socks.jiandan.async;





/**
 * Created by zhaokaiqiang on 15/11/10.
 */
public class Handler4Picture extends BaseJsonResponseHandler {

    public Handler4Picture(@NonNull OnHttpResponseCallBackImpl<ArrayList<Picture>> onHttpResponseCallBack) {
        super(onHttpResponseCallBack);
    }

    @Override
    protected void onSuccess(int statusCode, String rawJsonResponse) {

        try {
            String jsonStr = new JSONObject(rawJsonResponse).getJSONArray("comments").toString();

            ArrayList<Picture> pictures = (ArrayList<Picture>) JSONParser.toObject(jsonStr,
                    new TypeToken<ArrayList<Picture>>() {