4399游戏盒 v7.2.1.31版本的 MD5 值为:951717f45e3fda95c8a358caf4ca93e1

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


package com.m4399.gamecenter.plugin.main.helpers;

import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.os.Bundle;
import android.text.SpannableString;
import android.text.TextPaint;
import android.text.TextUtils;
import android.text.style.ReplacementSpan;
import com.framework.config.Config;
import com.framework.config.SysConfigKey;
import com.framework.utils.JSONUtils;
import com.huawei.hms.push.constant.RemoteMessageConst;
import com.m4399.gamecenter.plugin.main.manager.user.UserCenterManager;
import com.m4399.gamecenter.plugin.main.models.gamedetail.GamePlayerVideoModel;
import com.m4399.gamecenter.plugin.main.widget.web.BaseWebViewLayout;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.json.JSONObject;

public class k {
    public static final String JS_ADD_COMMENT = "javascript:m_comment.newComment";
    public static final String JS_ADD_COMMENT_JSON = "javascript:m_comment.newCommentJSON";
    public static final String JS_ADD_DRAFT_COMMENT = "javascript:m_comment.newDrafts";
    public static final String JS_ADD_RATE_COMMENT = "javascript:m_comment.newRatesJSON";
    public static final String JS_ADD_VIDEO_CMT = "javascript:m_videoComment.newComment";
    public static final String JS_ADD_WEEKLY_REPORT_CMT = "javascript:m_weekly.newComment";
    public static final String JS_COMMON_ADD_COMMENT = "javascript:m_common.newComment";
    public static final String JS_COMMON_REPLY_COMMENT = "javascript:m_common.newReply";
    public static final String JS_DEL_COMMON_CMT = "javascript:m_common.deleteSuccess";
    public static final String JS_PRAISE_COMMON_CMT = "javascript:m_common.praiseSuccess";
    public static final String JS_REPLY_COMMENT = "javascript:m_comment.newReply";
    public static final String JS_REPLY_COMMON_CMT_SUCCESS = "javascript:m_common.newReplySuccess";
    public static final String JS_REPLY_VIDEO_CMT = "javascript:m_videoComment.newReply";
    public static final String JS_REPLY_WEEKLY_REPORT_CMT = "javascript:m_weekly.newReply";

    public interface b {
        void onMatch(String str);
    }

    public static String buildWeeklyReportParamsJsonStr(Bundle bundle) {
        JSONObject jSONObject = new JSONObject();
        if (bundle == null) {
            return jSONObject.toString();
        }
        int i = bundle.getInt("intent.extra.added.comment.id");
        String string = bundle.getString("extra.comment.uid");
        String string2 = bundle.getString("intent.extra.user.nick");
        String string3 = bundle.getString("intent.extra.comment.share.user.icon");
        String string4 = bundle.getString("intent.extra.comment.content");
        int i2 = bundle.getInt("intent.extra.comment.reply.num");
        int i3 = bundle.getInt("intent.extra.comment.like.num");
        String string5 = bundle.getString("extra.comment.model");
        int i4 = bundle.getInt("intent.extra.comment.state");
        int i5 = bundle.getInt("intent.extra.target.comment.id");
        long j = bundle.getLong("intent.extra.comment.action.time");
        JSONUtils.putObject("id", Integer.valueOf(i), jSONObject);
        JSONUtils.putObject("uid", string, jSONObject);
        JSONUtils.putObject(com.m4399.gamecenter.plugin.main.database.tables.u.COLUMN_NICK, string2, jSONObject);
        JSONUtils.putObject("sface", string3, jSONObject);
        JSONUtils.putObject("content", string4, jSONObject);
        JSONUtils.putObject("reply_num", Integer.valueOf(i2), jSONObject);
        JSONUtils.putObject(GamePlayerVideoModel.LIKE_NUM, Integer.valueOf(i3), jSONObject);
        JSONUtils.putObject("model", string5, jSONObject);
        JSONUtils.putObject("audit", Integer.valueOf(i4), jSONObject);
        JSONUtils.putObject("dateline", Long.valueOf(j), jSONObject);
        if (i5 != 0) {
            JSONUtils.putObject("comment_id", Integer.valueOf(i5), jSONObject);
        }
        return jSONObject.toString();
    }

    private static String a(int i, String str, String str2, String str3) {
        return "javascript:m_comment.newComment('" + com.m4399.gamecenter.plugin.main.utils.bo.escapeQuoteJava(str) + "', " + i + ", '" + str2 + "', '" + str3 + "', 2, '" + Config.getValue(SysConfigKey.DEVICE_NAME) + "')";
    }

    private static String b(String str, int i, String str2, String str3) {
        return "javascript:m_comment.newReply(" + i + ", '" + com.m4399.gamecenter.plugin.main.utils.bo.escapeQuoteJava(str) + "', '" + str2 + "', '" + str3 + "', 2, '" + Config.getValue(SysConfigKey.DEVICE_NAME) + "')";
    }

    public static void executeJs(BaseWebViewLayout baseWebViewLayout, String str) {
        if (baseWebViewLayout == null || TextUtils.isEmpty(str)) {
            return;
        }
        baseWebViewLayout.loadJs(str);
    }

    public static void executeAddCommentJs(BaseWebViewLayout baseWebViewLayout, int i, String str) {
        executeJs(baseWebViewLayout, a(i, str, UserCenterManager.getNick(), UserCenterManager.getUserIcon()));
    }

    public static void executeReplyCommentJs(BaseWebViewLayout baseWebViewLayout, String str, int i) {
        executeJs(baseWebViewLayout, b(str, i, UserCenterManager.getNick(), UserCenterManager.getUserIcon()));
    }

    public static String createAddCommentJs(int i, String str, String str2) {
        return "javascript:m_comment.newComment('" + com.m4399.gamecenter.plugin.main.utils.bo.escapeQuoteJava(str) + "', " + i + ", '" + UserCenterManager.getNick() + "', '" + UserCenterManager.getUserIcon() + "', 2, '" + Config.getValue(SysConfigKey.DEVICE_NAME) + "', '" + str2 + "')";
    }

    public static String createAddCommentJs(int i, String str, String str2, int i2, String str3, int i3, int i4) {
        return "javascript:m_comment.newComment('" + com.m4399.gamecenter.plugin.main.utils.bo.escapeQuoteJava(str) + "', " + i + ", '" + UserCenterManager.getNick() + "', '" + UserCenterManager.getUserIcon() + "', 2, '" + Config.getValue(SysConfigKey.DEVICE_NAME) + "', '" + str2 + "', '" + i2 + "', '" + str3 + "', '" + i3 + "', '" + i4 + "')";
    }

    public static String createAddCommentJsonJs(String str, int i, int i2, int i3) {
        JSONObject parseJSONObjectFromString = JSONUtils.parseJSONObjectFromString(str);
        JSONUtils.putObject("star", Integer.valueOf(i), parseJSONObjectFromString);
        JSONUtils.putObject("avatar", UserCenterManager.getUserIcon(), parseJSONObjectFromString);
        JSONUtils.putObject(com.m4399.gamecenter.plugin.main.database.tables.u.COLUMN_NICK, UserCenterManager.getNick(), parseJSONObjectFromString);
        JSONUtils.putObject("is_game_comment", Integer.valueOf(i2), parseJSONObjectFromString);
        JSONUtils.putObject("contribute", Integer.valueOf(i3), parseJSONObjectFromString);
        return "javascript:m_comment.newCommentJSON('" + parseJSONObjectFromString + "')";
    }

    public static String createAddCommentJsonJs(String str, int i, int i2) {
        return createAddCommentJsonJs(str, i, i2, 0);
    }

    public static String createVideoAddCommentJsonJs(String str) {
        return "javascript:m_videoComment.newComment('" + JSONUtils.parseJSONObjectFromString(str) + "')";
    }

    public static String createDraftCommentJs(int i, String str) {
        return "javascript:m_comment.newDrafts('" + com.m4399.gamecenter.plugin.main.utils.bo.escapeQuoteJava(str) + "', " + i + ", '" + UserCenterManager.getNick() + "', '" + UserCenterManager.getUserIcon() + "')";
    }

    public static String createRateCommentJs(String str) {
        JSONObject parseJSONObjectFromString = JSONUtils.parseJSONObjectFromString(str);
        JSONUtils.putObject("avatar", UserCenterManager.getUserIcon(), parseJSONObjectFromString);
        JSONUtils.putObject(com.m4399.gamecenter.plugin.main.database.tables.u.COLUMN_NICK, UserCenterManager.getNick(), parseJSONObjectFromString);
        return "javascript:m_comment.newRatesJSON('" + parseJSONObjectFromString + "')";
    }

    public static void regrexCommentTagStyle(SpannableString spannableString) {
        regrexCommentTagStyle(spannableString, null);
    }

    public static void regrexCommentTagStyle(SpannableString spannableString, b bVar) {
        if (TextUtils.isEmpty(spannableString)) {
            return;
        }
        Matcher matcher = Pattern.compile("^\\[.*?]|\n\\[.*?]").matcher(spannableString);
        while (matcher.find()) {
            int start = matcher.start();
            if (spannableString.charAt(start) == '\n') {
                start++;
            }
            String charSequence = spannableString.subSequence(start, matcher.end()).toString();
            spannableString.setSpan(new a(charSequence), start, matcher.end(), 33);
            if (bVar != null) {
                bVar.onMatch(charSequence);
            }
        }
    }

    public static class a extends ReplacementSpan {
        private String cGg;
        private TextPaint cGh;
        private String mTag;

        public String getTag() {
            return this.mTag;
        }

        public a(String str) {
            this.mTag = str;
            if (str.startsWith("[") && str.endsWith("]")) {
                this.cGg = str.substring(1, str.length() - 1) + ":";
            }
            this.cGh = new TextPaint();
            this.cGh.setColor(Color.parseColor("#66000000"));
            this.cGh.setAntiAlias(true);
        }

        @Override
        public int getSize(Paint paint, CharSequence charSequence, int i, int i2, Paint.FontMetricsInt fontMetricsInt) {
            if (this.cGg == null) {
                return 0;
            }
            this.cGh.setTextSize(paint.getTextSize());
            TextPaint textPaint = this.cGh;
            String str = this.cGg;
            return (int) textPaint.measureText(str, 0, str.length());
        }

        @Override
        public void draw(Canvas canvas, CharSequence charSequence, int i, int i2, float f, int i3, int i4, int i5, Paint paint) {
            if (this.cGg == null) {
                return;
            }
            canvas.save();
            String str = this.cGg;
            canvas.drawText(str, 0, str.length(), f, i4, (Paint) this.cGh);
            canvas.restore();
        }
    }

    public static String replyParams(String str, String str2) {
        if (TextUtils.isEmpty(str2)) {
            str2 = "";
        }
        JSONObject jSONObject = new JSONObject();
        JSONUtils.putObject("message", str, jSONObject);
        JSONUtils.putObject(RemoteMessageConst.DATA, str2, jSONObject);
        return jSONObject.toString();
    }
}