OurPlay v5.5.9版本的 MD5 值为:d4e139798f4c2243a1145c8af5e21046

以下内容为反编译后的 b.java 源代码,内容仅作参考


package com.excelliance.kxqp.gs.discover.comment;

import android.content.Context;
import android.content.Intent;
import android.graphics.BitmapFactory;
import android.graphics.drawable.Drawable;
import android.text.SpannableStringBuilder;
import android.text.style.ClickableSpan;
import android.util.Log;
import android.view.View;
import com.bumptech.glide.d.d.a.e;
import com.bumptech.glide.i;
import com.excelliance.kxqp.gs.discover.common.ImagePreviewActivity;
import com.excelliance.kxqp.gs.discover.common.f;
import com.excelliance.kxqp.gs.discover.common.h;
import com.excelliance.kxqp.gs.discover.model.CDNData;
import com.excelliance.kxqp.gs.discover.model.CommentItem;
import com.excelliance.kxqp.gs.discover.model.ResponseData;
import com.excelliance.kxqp.gs.discover.model.SubCommentItem;
import com.excelliance.kxqp.gs.discover.model.request.CommentOperationRequestData;
import com.excelliance.kxqp.gs.discover.model.request.DeleteCommentRequestData;
import com.excelliance.kxqp.gs.discover.model.request.ModifyCommentRequestData;
import com.excelliance.kxqp.gs.discover.model.request.SendCommentRequestData;
import com.excelliance.kxqp.gs.discover.model.request.SendSubCommentRequestData;
import com.excelliance.kxqp.gs.discover.model.request.SubCommentHeadRequestData;
import com.excelliance.kxqp.gs.discover.model.request.SubCommentListRequestData;
import com.excelliance.kxqp.gs.util.as;
import com.excelliance.kxqp.gs.util.bd;
import com.excelliance.kxqp.gs.util.be;
import com.excelliance.kxqp.gs.util.bp;
import com.excelliance.kxqp.gs.util.bx;
import com.excelliance.kxqp.gs.util.cn;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.HashMap;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.http.HttpHost;

public class b {

    private static b f5355a;

    private Context f5356b;
    private Gson c = new Gson();
    private String d;

    public static synchronized b a(Context context) {
        b bVar;
        synchronized (b.class) {
            if (f5355a == null) {
                f5355a = new b(context.getApplicationContext());
            }
            bVar = f5355a;
        }
        return bVar;
    }

    private b(Context context) {
        this.f5356b = context;
        this.d = com.excelliance.kxqp.swipe.a.a.getString(this.f5356b, "server_wrong");
    }

    public ResponseData a(String str, String str2) {
        SendCommentRequestData sendCommentRequestData;
        String str3;
        String a2;
        ResponseData responseData;
        String a3 = a();
        try {
            sendCommentRequestData = (SendCommentRequestData) this.c.a(cn.i(this.f5356b).toString(), new TypeToken<SendCommentRequestData>() {
            }.getType());
        } catch (Exception e) {
            e.printStackTrace();
            Log.e("CommentRepository", e.toString());
            sendCommentRequestData = null;
        }
        if (sendCommentRequestData == null) {
            sendCommentRequestData = new SendCommentRequestData(str, a3, str2);
        } else {
            sendCommentRequestData.setData(str, a3, str2);
        }
        String a4 = this.c.a(sendCommentRequestData);
        ResponseData responseData2 = new ResponseData();
        responseData2.code = 1;
        responseData2.msg = this.d;
        be d = bd.d("http://api.ourplay.com.cn/comment/addnews", a4);
        if (d != null) {
            str3 = d.c;
            responseData2.msg = as.a(this.f5356b, d);
        } else {
            str3 = null;
        }
        if (str3 != null && (a2 = bp.a(str3, "fuck_snsslmm_bslznw", "utf-8")) != null) {
            try {
                responseData = (ResponseData) this.c.a(a2, new TypeToken<ResponseData>() {
                }.getType());
            } catch (Exception e2) {
                e2.printStackTrace();
                Log.e("CommentRepository", e2.toString());
                responseData = null;
            }
            if (responseData != null) {
                return responseData;
            }
        }
        return responseData2;
    }

    private String a() {
        return bx.a().a(this.f5356b);
    }

    public ResponseData a(String str, String str2, String str3, String str4) {
        SendSubCommentRequestData sendSubCommentRequestData;
        String str5;
        String a2;
        ResponseData responseData;
        String a3 = a();
        try {
            sendSubCommentRequestData = (SendSubCommentRequestData) this.c.a(cn.i(this.f5356b).toString(), new TypeToken<SendSubCommentRequestData>() {
            }.getType());
        } catch (Exception e) {
            e.printStackTrace();
            Log.e("CommentRepository", e.toString());
            sendSubCommentRequestData = null;
        }
        if (sendSubCommentRequestData == null) {
            sendSubCommentRequestData = new SendSubCommentRequestData(str, a3, str4, str3, str2);
        } else {
            sendSubCommentRequestData.setData(str, a3, str4, str3, str2);
        }
        String a4 = this.c.a(sendSubCommentRequestData);
        ResponseData responseData2 = new ResponseData();
        responseData2.code = 1;
        responseData2.msg = this.d;
        be d = bd.d("http://api.ourplay.com.cn/comment/addchildnews", a4);
        if (d != null) {
            str5 = d.c;
            responseData2.msg = as.a(this.f5356b, d);
        } else {
            str5 = null;
        }
        if (str5 != null && (a2 = bp.a(str5, "fuck_snsslmm_bslznw", "utf-8")) != null) {
            try {
                responseData = (ResponseData) this.c.a(a2, new TypeToken<ResponseData>() {
                }.getType());
            } catch (Exception e2) {
                e2.printStackTrace();
                Log.e("CommentRepository", e2.toString());
                responseData = null;
            }
            if (responseData != null) {
                return responseData;
            }
        }
        return responseData2;
    }

    public ResponseData<CommentItem> a(String str) {
        SubCommentHeadRequestData subCommentHeadRequestData;
        String str2;
        String a2;
        ResponseData<CommentItem> responseData;
        String a3 = a();
        try {
            subCommentHeadRequestData = (SubCommentHeadRequestData) this.c.a(cn.i(this.f5356b).toString(), new TypeToken<SubCommentHeadRequestData>() {
            }.getType());
        } catch (Exception e) {
            e.printStackTrace();
            Log.e("CommentRepository", e.toString());
            subCommentHeadRequestData = null;
        }
        if (subCommentHeadRequestData == null) {
            subCommentHeadRequestData = new SubCommentHeadRequestData(a3, str);
        } else {
            subCommentHeadRequestData.setData(a3, str);
        }
        String a4 = this.c.a(subCommentHeadRequestData);
        ResponseData<CommentItem> responseData2 = new ResponseData<>();
        responseData2.code = 1;
        responseData2.msg = this.d;
        be d = bd.d("http://api.ourplay.com.cn/comment/newscontent", a4);
        if (d != null) {
            str2 = d.c;
            responseData2.msg = as.a(this.f5356b, d);
        } else {
            str2 = null;
        }
        if (str2 != null && (a2 = bp.a(str2, "fuck_snsslmm_bslznw", "utf-8")) != null) {
            try {
                responseData = (ResponseData) this.c.a(a2, new TypeToken<ResponseData<CommentItem>>() {
                }.getType());
            } catch (Exception e2) {
                e2.printStackTrace();
                Log.e("CommentRepository", e2.toString());
                responseData = null;
            }
            if (responseData != null) {
                return responseData;
            }
        }
        return responseData2;
    }

    public ResponseData<List<SubCommentItem>> a(String str, int i, int i2) {
        SubCommentListRequestData subCommentListRequestData;
        String str2;
        String a2;
        ResponseData<List<SubCommentItem>> responseData;
        String a3 = a();
        try {
            subCommentListRequestData = (SubCommentListRequestData) this.c.a(cn.i(this.f5356b).toString(), new TypeToken<SubCommentListRequestData>() {
            }.getType());
        } catch (Exception e) {
            e.printStackTrace();
            Log.e("CommentRepository", e.toString());
            subCommentListRequestData = null;
        }
        if (subCommentListRequestData == null) {
            subCommentListRequestData = new SubCommentListRequestData(a3, str, i, i2);
        } else {
            subCommentListRequestData.setData(a3, str, i, i2);
        }
        String a4 = this.c.a(subCommentListRequestData);
        ResponseData<List<SubCommentItem>> responseData2 = new ResponseData<>();
        responseData2.code = 1;
        responseData2.msg = this.d;
        be d = bd.d("http://api.ourplay.com.cn/comment/newschildlist", a4);
        if (d != null) {
            str2 = d.c;
            responseData2.msg = as.a(this.f5356b, d);
        } else {
            str2 = null;
        }
        if (str2 != null && (a2 = bp.a(str2, "fuck_snsslmm_bslznw", "utf-8")) != null) {
            try {
                responseData = (ResponseData) this.c.a(a2, new TypeToken<ResponseData<List<SubCommentItem>>>() {
                }.getType());
            } catch (Exception e2) {
                e2.printStackTrace();
                Log.e("CommentRepository", e2.toString());
                responseData = null;
            }
            if (responseData != null) {
                return responseData;
            }
        }
        return responseData2;
    }

    public ResponseData b(String str, int i, int i2) {
        CommentOperationRequestData commentOperationRequestData;
        String str2;
        String a2;
        ResponseData responseData;
        String a3 = a();
        try {
            commentOperationRequestData = (CommentOperationRequestData) this.c.a(cn.i(this.f5356b).toString(), new TypeToken<CommentOperationRequestData>() {
            }.getType());
        } catch (Exception e) {
            e.printStackTrace();
            Log.e("CommentRepository", e.toString());
            commentOperationRequestData = null;
        }
        if (commentOperationRequestData == null) {
            commentOperationRequestData = new CommentOperationRequestData(str, a3, i, i2);
        } else {
            commentOperationRequestData.setData(str, a3, i, i2);
        }
        String a4 = this.c.a(commentOperationRequestData);
        ResponseData responseData2 = new ResponseData();
        responseData2.code = 1;
        responseData2.msg = this.d;
        be d = bd.d("http://api.ourplay.com.cn/comment/setlike", a4);
        if (d != null) {
            str2 = d.c;
            responseData2.msg = as.a(this.f5356b, d);
        } else {
            str2 = null;
        }
        if (str2 != null && (a2 = bp.a(str2, "fuck_snsslmm_bslznw", "utf-8")) != null) {
            try {
                responseData = (ResponseData) this.c.a(a2, new TypeToken<ResponseData>() {
                }.getType());
            } catch (Exception e2) {
                e2.printStackTrace();
                Log.e("CommentRepository", e2.toString());
                responseData = null;
            }
            if (responseData != null) {
                return responseData;
            }
        }
        return responseData2;
    }

    public ResponseData a(String str, String str2, int i) {
        DeleteCommentRequestData deleteCommentRequestData;
        String str3;
        String a2;
        ResponseData responseData;
        try {
            deleteCommentRequestData = (DeleteCommentRequestData) this.c.a(cn.i(this.f5356b).toString(), new TypeToken<DeleteCommentRequestData>() {
            }.getType());
        } catch (Exception e) {
            e.printStackTrace();
            Log.e("CommentRepository", e.toString());
            deleteCommentRequestData = null;
        }
        if (deleteCommentRequestData == null) {
            deleteCommentRequestData = new DeleteCommentRequestData(str2, str, i);
        } else {
            deleteCommentRequestData.setData(str2, str, i);
        }
        String a3 = this.c.a(deleteCommentRequestData);
        ResponseData responseData2 = new ResponseData();
        responseData2.code = 1;
        responseData2.msg = this.d;
        be d = bd.d("http://api.ourplay.com.cn/comment/delete", a3);
        if (d != null) {
            str3 = d.c;
            responseData2.msg = as.a(this.f5356b, d);
        } else {
            str3 = null;
        }
        if (str3 != null && (a2 = bp.a(str3, "fuck_snsslmm_bslznw", "utf-8")) != null) {
            try {
                responseData = (ResponseData) this.c.a(a2, new TypeToken<ResponseData>() {
                }.getType());
            } catch (Exception e2) {
                e2.printStackTrace();
                Log.e("CommentRepository", e2.toString());
                responseData = null;
            }
            if (responseData != null) {
                return responseData;
            }
        }
        return responseData2;
    }

    public ResponseData a(String str, String str2, String str3, int i) {
        ModifyCommentRequestData modifyCommentRequestData;
        String str4;
        String a2;
        ResponseData responseData;
        String a3 = a();
        try {
            modifyCommentRequestData = (ModifyCommentRequestData) this.c.a(cn.i(this.f5356b).toString(), new TypeToken<ModifyCommentRequestData>() {
            }.getType());
        } catch (Exception e) {
            e.printStackTrace();
            Log.e("CommentRepository", e.toString());
            modifyCommentRequestData = null;
        }
        if (modifyCommentRequestData == null) {
            modifyCommentRequestData = new ModifyCommentRequestData(str, str3, a3, i, str2);
        } else {
            modifyCommentRequestData.setData(str, str3, a3, i, str2);
        }
        String a4 = this.c.a(modifyCommentRequestData);
        ResponseData responseData2 = new ResponseData();
        responseData2.code = 1;
        responseData2.msg = this.d;
        be d = bd.d("http://api.ourplay.com.cn/comment/update ", a4);
        if (d != null) {
            str4 = d.c;
            responseData2.msg = as.a(this.f5356b, d);
        } else {
            str4 = null;
        }
        if (str4 != null && (a2 = bp.a(str4, "fuck_snsslmm_bslznw", "utf-8")) != null) {
            try {
                responseData = (ResponseData) this.c.a(a2, new TypeToken<ResponseData>() {
                }.getType());
            } catch (Exception e2) {
                e2.printStackTrace();
                Log.e("CommentRepository", e2.toString());
                responseData = null;
            }
            if (responseData != null) {
                return responseData;
            }
        }
        return responseData2;
    }

    public ResponseData<CDNData> a(String str, String str2, String str3) {
        T t;
        ResponseData<CDNData> responseData = new ResponseData<>();
        responseData.code = 1;
        responseData.msg = this.d;
        File file = new File(str3);
        if (!file.exists()) {
            responseData.code = 1;
            responseData.msg = com.excelliance.kxqp.swipe.a.a.getString(this.f5356b, "local_wrong");
            return responseData;
        }
        String name = file.getName();
        HashMap hashMap = new HashMap();
        hashMap.put("key", "xspace/commentimage/" + name);
        hashMap.put("token", str);
        HashMap hashMap2 = new HashMap();
        hashMap2.put(file.getName(), file);
        String a2 = com.excelliance.kxqp.gs.discover.a.a(str2, hashMap, hashMap2);
        if (a2 != null) {
            try {
                t = (CDNData) this.c.a(a2, new TypeToken<CDNData>() {
                }.getType());
            } catch (Exception e) {
                e.printStackTrace();
                t = 0;
            }
            if (t != 0) {
                responseData.code = 0;
                responseData.data = t;
            }
        }
        return responseData;
    }

    public CharSequence b(String str) {
        final String substring;
        Drawable c;
        if ("".equals(str)) {
            return null;
        }
        SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder();
        spannableStringBuilder.append((CharSequence) str);
        Matcher matcher = Pattern.compile("<img[^>]*\\/>").matcher(str);
        while (matcher.find()) {
            String substring2 = str.substring(matcher.start(), matcher.end());
            int indexOf = substring2.indexOf(HttpHost.DEFAULT_SCHEME_NAME);
            if (indexOf != -1 && (c = c((substring = substring2.substring(indexOf, substring2.indexOf("jpg") + 3)))) != null) {
                c.setBounds(0, 0, c.getIntrinsicWidth(), c.getIntrinsicHeight());
                Log.d("CommentRepository", "CommentRepository/getSpanComment:drawable w:" + c.getIntrinsicWidth());
                spannableStringBuilder.setSpan(new h(c, 1), matcher.start(), matcher.end(), 33);
                spannableStringBuilder.setSpan(new ClickableSpan() {
                    @Override
                    public void onClick(View view) {
                        Intent intent = new Intent(b.this.f5356b, (Class<?>) ImagePreviewActivity.class);
                        intent.putExtra("image", substring);
                        intent.setFlags(268435456);
                        b.this.f5356b.startActivity(intent);
                    }
                }, matcher.start(), matcher.end(), 33);
            }
        }
        return spannableStringBuilder;
    }

    public Drawable c(String str) {
        File file;
        try {
            file = i.b(this.f5356b).a(str).c(0, 0).get(10L, TimeUnit.SECONDS);
        } catch (Exception e) {
            e.printStackTrace();
            Log.e("CommentRepository", "CommentRepository/getSpanComment:" + e.toString());
            file = null;
        }
        if (file == null) {
            return null;
        }
        BitmapFactory.Options options = new BitmapFactory.Options();
        options.inJustDecodeBounds = true;
        try {
            BitmapFactory.decodeStream(new FileInputStream(file), null, options);
            options.inSampleSize = a(options, com.excelliance.kxqp.gs.discover.a.c(this.f5356b));
            try {
                return i.b(this.f5356b).a(file).a(new e(this.f5356b), new f(this.f5356b, 20)).d(options.outWidth / options.inSampleSize, options.outHeight / options.inSampleSize).get(10L, TimeUnit.SECONDS);
            } catch (Exception e2) {
                e2.printStackTrace();
                Log.e("CommentRepository", "CommentRepository/getSpanComment:" + e2.toString());
                return null;
            }
        } catch (FileNotFoundException e3) {
            e3.printStackTrace();
            Log.e("CommentRepository", "CommentRepository/getSpanComment:" + e3.toString());
            return null;
        }
    }

    public static int a(BitmapFactory.Options options, int i) {
        int i2 = options.outWidth;
        int i3 = 1;
        if (i2 > i) {
            while ((i2 / 2) / i3 >= i) {
                i3 *= 2;
            }
        }
        return i3;
    }

    public String d(String str) {
        if ("".equals(str)) {
            return null;
        }
        Matcher matcher = Pattern.compile("<img[^>]*\\/>").matcher(str);
        StringBuilder sb = new StringBuilder();
        int i = 0;
        int i2 = 0;
        int i3 = 0;
        while (matcher.find()) {
            i++;
            sb.append(str.substring(i2, matcher.start()));
            sb.append(com.excelliance.kxqp.swipe.a.a.getString(this.f5356b, "readable_image_tag"));
            i2 = matcher.end();
            i3 = matcher.end();
        }
        if (i == 0) {
            return str;
        }
        sb.append(str.substring(i3, str.length()));
        return sb.toString();
    }
}