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

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


package com.m4399.gamecenter.plugin.main.controllers.comment;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Keep;
import android.support.v4.util.ArrayMap;
import android.support.v7.widget.Toolbar;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.GestureDetector;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import com.dialog.DialogResult;
import com.dialog.c;
import com.dialog.theme.DialogTwoButtonTheme;
import com.framework.EnvironmentMode;
import com.framework.config.Config;
import com.framework.config.SysConfigKey;
import com.framework.database.tables.CachesTable;
import com.framework.manager.udid.UdidManager;
import com.framework.net.HttpHeaderKey;
import com.framework.providers.NetworkDataProvider;
import com.framework.rxbus.RxBus;
import com.framework.rxbus.annotation.Subscribe;
import com.framework.rxbus.annotation.Tag;
import com.framework.rxbus.thread.EventThread;
import com.framework.utils.JSONUtils;
import com.framework.utils.KeyboardUtils;
import com.framework.utils.UMengEventUtils;
import com.huawei.hms.framework.common.hianalytics.CrashHianalyticsData;
import com.huawei.hms.push.constant.RemoteMessageConst;
import com.m4399.framework.BaseApplication;
import com.m4399.gamecenter.plugin.main.PluginApplication;
import com.m4399.gamecenter.plugin.main.R;
import com.m4399.gamecenter.plugin.main.controllers.playerrec.PlayerRecommendListFragment;
import com.m4399.gamecenter.plugin.main.controllers.user.u;
import com.m4399.gamecenter.plugin.main.controllers.web.BaseWebViewActivity;
import com.m4399.gamecenter.plugin.main.controllers.web.CommentJsInterface;
import com.m4399.gamecenter.plugin.main.controllers.web.GameCommentJsInterface;
import com.m4399.gamecenter.plugin.main.controllers.web.g;
import com.m4399.gamecenter.plugin.main.fastplay.helper.FastPlayAuthHelper;
import com.m4399.gamecenter.plugin.main.helpers.k;
import com.m4399.gamecenter.plugin.main.helpers.l;
import com.m4399.gamecenter.plugin.main.helpers.t;
import com.m4399.gamecenter.plugin.main.listeners.f;
import com.m4399.gamecenter.plugin.main.manager.authentication.ContentPublishAuthManagerProxy;
import com.m4399.gamecenter.plugin.main.manager.user.UserCenterManager;
import com.m4399.gamecenter.plugin.main.manager.user.UserGradeManager;
import com.m4399.gamecenter.plugin.main.manager.v;
import com.m4399.gamecenter.plugin.main.models.gamedetail.GamePlayerVideoModel;
import com.m4399.gamecenter.plugin.main.models.user.UserHomePageTabType;
import com.m4399.gamecenter.plugin.main.models.user.UserModel;
import com.m4399.gamecenter.plugin.main.utils.ap;
import com.m4399.gamecenter.plugin.main.utils.at;
import com.m4399.gamecenter.plugin.main.utils.bc;
import com.m4399.gamecenter.plugin.main.utils.cd;
import com.m4399.gamecenter.plugin.main.utils.e;
import com.m4399.gamecenter.plugin.main.widget.web.BaseWebViewLayout;
import com.m4399.gamecenter.plugin.main.widget.web.WebViewLayout;
import com.m4399.stat.StatisticsAgent;
import com.m4399.support.utils.ToastUtils;
import com.umeng.analytics.AnalyticsConfig;
import java.io.File;
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import org.json.JSONObject;
import rx.Observable;
import rx.android.schedulers.AndroidSchedulers;
import rx.functions.Action1;

public class CommentDetailActivity extends BaseWebViewActivity implements Toolbar.OnMenuItemClickListener, TextWatcher, GestureDetector.OnGestureListener, View.OnClickListener, View.OnTouchListener {
    public static final String MODULE_GAME = "comment_detail";
    public static final int TYPE_GAME_COMMENT = 0;
    public static final int TYPE_NEWS = 3;
    public static final int TYPE_SPECIAL = 2;
    public static final int TYPE_VIDEO_INFO = 4;
    public static final int TYPE_WEEKLY_REPORT = 1;
    private int aoH;
    private int aoI;
    private String aoJ;
    private String aoK;
    private String aoL;
    private String aoM;
    private boolean aoN;
    private String aoO;
    private String aoP;
    private boolean aoQ;
    private String aoR;
    private String aoT;
    private Button aoU;
    private LinearLayout aoV;
    private String aoW;
    private String aoX;
    private int aoY;
    private int aoZ;
    private GameCommentJsInterface apa;
    private int apb;
    private int apc;
    private MenuItem apd;
    private EditText mEditText;
    private String mGameID;
    private String mGameIconUrl;
    private String mGameName;
    private String mGamePackage;
    private String mIcon;
    private g mLoginJsInterface;
    private int mNewsId;
    private String mUid;
    private boolean aoS = false;
    GestureDetector ape = new GestureDetector(this);

    @Override
    public void afterTextChanged(Editable editable) {
    }

    @Override
    public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
    }

    @Override
    protected String getWebUrl() {
        return "";
    }

    @Override
    protected boolean isRefreshTitleWithWeb() {
        return false;
    }

    @Override
    public boolean onDown(MotionEvent motionEvent) {
        return false;
    }

    @Override
    public void onLongPress(MotionEvent motionEvent) {
    }

    @Override
    public void onShowPress(MotionEvent motionEvent) {
    }

    @Override
    public boolean onSingleTapUp(MotionEvent motionEvent) {
        return false;
    }

    @Override
    protected int getLayoutID() {
        return R.layout.m4399_activity_comment_detail;
    }

    @Override
    public void initToolBar() {
        super.initToolBar();
        setTitle("评论详情");
        if (this.aoH == 0) {
            getToolBar().setOnMenuItemClickListener(this);
            getToolBar().setOverflowIcon(getResources().getDrawable(R.drawable.m4399_xml_selector_toolbar_item_more_black));
            this.apd = getToolBar().getMenu().findItem(R.id.m4399_menu_report);
            mz();
        }
    }

    public void receiveGameCommentData(String str) {
        JSONObject parseJSONObjectFromString = JSONUtils.parseJSONObjectFromString(str);
        String string = JSONUtils.getString("uid", parseJSONObjectFromString);
        int i = JSONUtils.getInt("entity_id", parseJSONObjectFromString);
        String string2 = JSONUtils.getString("id", parseJSONObjectFromString);
        if (this.aoH == 0) {
            c(i, string2, string);
        }
    }

    @Override
    public int getMenuID() {
        if (this.aoH == 0) {
            return R.menu.m4399_menu_comment_detail;
        }
        return super.getMenuID();
    }

    public void mz() {
        if (this.aoH != 0 || this.apd == null) {
            return;
        }
        if (UserCenterManager.isLogin().booleanValue()) {
            if (TextUtils.isEmpty(this.mUid)) {
                this.apd.setVisible(false);
                return;
            } else if (UserCenterManager.getPtUid().equals(this.mUid)) {
                this.apd.setVisible(false);
                return;
            } else {
                this.apd.setVisible(true);
                return;
            }
        }
        this.apd.setVisible(true);
    }

    @Override
    public void onCreate(Bundle bundle) {
        getWindow().setSoftInputMode(16);
        super.onCreate(bundle);
        RxBus.register(this);
        mA();
        UserGradeManager.getInstance().doExpTask(31);
    }

    private void c(int i, String str, String str2) {
        if (i < 0 || TextUtils.isEmpty(str) || TextUtils.isEmpty(str2)) {
            return;
        }
        HashMap hashMap = new HashMap();
        hashMap.put("uid", UserCenterManager.getPtUid());
        hashMap.put(FastPlayAuthHelper.KEY_UDID, UdidManager.getInstance().getUdid());
        hashMap.put(CrashHianalyticsData.TIME, Long.valueOf(System.currentTimeMillis() / 1000));
        hashMap.put("channel", UserHomePageTabType.TAB_GAME_COMMENT);
        hashMap.put("action", "view");
        hashMap.put("position", MODULE_GAME);
        hashMap.put("comment_id", str);
        hashMap.put("entity_id", Integer.valueOf(i));
        hashMap.put("comment_uid", str2);
        StatisticsAgent.onEvent((Context) BaseApplication.getApplication(), "yxh_comment_action", (Map<String, Object>) hashMap, true);
    }

    private void mA() {
        int i = this.aoH;
        if (i == 0) {
            v.getInstance().loadGameCommentTemplate(this.mWebView, new v.c() {
                @Override
                public void handle(File file) {
                    CommentDetailActivity.this.mWebView.loadUrl("file:///" + file.getAbsolutePath());
                    if (CommentDetailActivity.this.apa != null) {
                        CommentDetailActivity.this.apa.setIsLoadTemplate(true);
                    }
                }
            });
        } else if (i == 2 || i == 3 || i == 4) {
            mB();
        } else {
            mB();
        }
    }

    private void mB() {
        v.getInstance().loadTemplate(3, this.mWebView, null, new v.b(this, this.mWebView, 3));
    }

    @Override
    public void initData(Intent intent) {
        super.initData(intent);
        this.aoH = intent.getIntExtra("extra.comment.type", 0);
        this.aoI = intent.getIntExtra("intent.extra.weekly.report.id", 0);
        this.apb = intent.getIntExtra("intent.extra.special.id", 0);
        this.mNewsId = intent.getIntExtra("intent.extra.information.news.id", 0);
        this.apc = intent.getIntExtra("intent.extra.video.info.id", 0);
        this.mGameID = intent.getStringExtra("intent.extra.game.id");
        this.aoK = intent.getStringExtra("intent.extra.comment.detail.relate.id");
        this.aoM = intent.getStringExtra("intent.extra.comment.detail.title");
        intent.getStringExtra("intent.extra.comment.detail.reply.id");
        String stringExtra = intent.getStringExtra("intent.extra.comment.detail.from");
        boolean z = true;
        boolean z2 = TextUtils.equals(stringExtra, "notice") || TextUtils.equals(stringExtra, PlayerRecommendListFragment.MODULE_UNIQUE_IDENTIFICATION) || TextUtils.equals(stringExtra, u.MODULE_UNIQUE_IDENTIFICATION);
        this.aoN = intent.getBooleanExtra("is_show_game", false);
        if (!this.aoN && !z2) {
            z = false;
        }
        this.aoN = z;
        this.mIcon = intent.getStringExtra("intent.extra.comment.detail.icoN");
        this.aoO = intent.getStringExtra("intent.extra.comment.reply.hint");
        this.aoP = intent.getStringExtra("intent.extra.comment.ext");
        this.aoJ = intent.getStringExtra("intent.extra.comment.reply.json");
        this.aoQ = intent.getBooleanExtra("intent.extra.comment.like.state", false);
        this.aoR = intent.getStringExtra("intent.extra.comment.like.num");
        this.aoW = intent.getStringExtra("intent.extra.comment.reply.num");
        this.aoX = intent.getStringExtra("intent.extra.comment.share.game.img");
        this.mGameIconUrl = intent.getStringExtra("intent.extra.comment.share.game.icon");
        this.mGameName = intent.getStringExtra("intent.extra.comment.share.game.name");
        this.aoL = intent.getStringExtra("intent.extra.comment.detail.tag.id");
        this.mGamePackage = intent.getStringExtra("intent.extra.game.package.name");
        this.aoY = intent.getIntExtra("intent.extra.game.version.code", 0);
    }

    @Override
    protected void addWebViewToParent(ViewGroup viewGroup, WebViewLayout webViewLayout) {
        if (viewGroup != null) {
            viewGroup.addView(webViewLayout, 0);
        }
    }

    @Override
    public void initView(Bundle bundle) {
        super.initView(bundle);
        this.mEditText = (EditText) findViewById(R.id.comment_detail_edit);
        EditText editText = this.mEditText;
        if (editText != null) {
            editText.addTextChangedListener(this);
            this.mEditText.setOnClickListener(this);
        }
        this.aoU = (Button) findViewById(R.id.comment_detail_confirm_btn);
        this.aoV = (LinearLayout) findViewById(R.id.comment_detail_edit_layout);
        LinearLayout linearLayout = this.aoV;
        if (linearLayout != null) {
            linearLayout.setVisibility(8);
        }
        this.mWebView.setFocusable(false);
        this.mWebView.setFocusableInTouchMode(false);
        if (this.mWebView.getWebView() != null) {
            this.mWebView.getWebView().setFocusableInTouchMode(false);
        }
        if (this.mWebView.getWebView() != null) {
            this.mWebView.getWebView().setOnTouchListener(this);
        }
        at atVar = new at();
        atVar.registerActivity(this);
        atVar.setVisibilityListener(new at.a() {
            @Override
            public void onVisibilityChanged(boolean z) {
                if (!z) {
                    CommentDetailActivity.this.hideKeyboard();
                } else {
                    if (CommentDetailActivity.this.aoU == null || CommentDetailActivity.this.aoU.getVisibility() != 8) {
                        return;
                    }
                    CommentDetailActivity.this.aoU.setVisibility(0);
                }
            }
        });
    }

    @Override
    public void initJavascriptInterface(WebViewLayout webViewLayout) {
        super.initJavascriptInterface(webViewLayout);
        int i = this.aoH;
        if (i == 0) {
            mH();
            mF();
        } else if (i == 2) {
            mE();
        } else if (i == 3) {
            mD();
        } else if (i == 4) {
            mC();
        } else {
            mG();
        }
        this.apa.setEditorInterface(new CommentJsInterface.a() {
            @Override
            public void enableEditor(boolean z, String str) {
                CommentDetailActivity.this.enableEditor(z, str);
            }
        });
        a(webViewLayout);
    }

    public void enableEditor(boolean z, final String str) {
        EditText editText = this.mEditText;
        if (editText == null) {
            return;
        }
        if (z) {
            editText.setFocusable(true);
            this.mEditText.setFocusableInTouchMode(true);
            this.mEditText.setOnClickListener(this);
            this.mEditText.setHint(R.string.comment_replay_comment);
            return;
        }
        editText.setFocusable(false);
        this.mEditText.setFocusableInTouchMode(false);
        this.mEditText.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                UMengEventUtils.onEvent("ad_close_toast_appear", CommentDetailActivity.this.aoH == 0 ? "游戏评论回复" : "通用评论回复");
                ToastUtils.showToast(PluginApplication.getContext(), str);
            }
        });
        if (TextUtils.isEmpty(str)) {
            return;
        }
        this.mEditText.setHint(str);
    }

    private void mC() {
        this.apa = new GameCommentJsInterface(this.mWebView, this);
        this.apa.setFrom("video_info_comment_detail");
        this.apa.addWebRequestParam("positionPage", 15);
        this.apa.addWebRequestParam(CachesTable.COLUMN_KEY, Integer.valueOf(this.apc));
        this.apa.addWebRequestParam("commentId", this.aoK);
        this.apa.addWebRequestParam(RemoteMessageConst.DATA, this.aoJ);
        this.mWebView.addJavascriptInterface(this.apa, "android");
    }

    private void mD() {
        this.apa = new GameCommentJsInterface(this.mWebView, this);
        this.apa.setFrom("news_comment_detail");
        this.apa.addWebRequestParam("positionPage", 12);
        this.apa.addWebRequestParam(CachesTable.COLUMN_KEY, Integer.valueOf(this.mNewsId));
        this.apa.addWebRequestParam("commentId", this.aoK);
        this.apa.addWebRequestParam(RemoteMessageConst.DATA, this.aoJ);
        this.mWebView.addJavascriptInterface(this.apa, "android");
    }

    private void mE() {
        this.apa = new GameCommentJsInterface(this.mWebView, this);
        this.apa.setFrom("special_comment_detail");
        this.apa.addWebRequestParam("positionPage", 8);
        this.apa.addWebRequestParam(CachesTable.COLUMN_KEY, Integer.valueOf(this.apb));
        this.apa.addWebRequestParam("commentId", this.aoK);
        this.apa.addWebRequestParam(RemoteMessageConst.DATA, this.aoJ);
        this.mWebView.addJavascriptInterface(this.apa, "android");
    }

    private void a(WebViewLayout webViewLayout) {
        this.mLoginJsInterface = new g(webViewLayout, this);
        webViewLayout.addJavascriptInterface(this.mLoginJsInterface, "login");
    }

    private void mF() {
        ArrayMap<String, Object> arrayMap = new ArrayMap<>();
        arrayMap.put("game_id", this.mGameID);
        arrayMap.put("comment_id", this.aoK);
        arrayMap.put(EnvironmentMode.ONLINE, "1");
        arrayMap.put("show_game", this.aoN ? "1" : "0");
        String str = this.aoP;
        if (str == null) {
            str = "";
        }
        arrayMap.put("ext", str);
        arrayMap.put(HttpHeaderKey.PAUTH, URLEncoder.encode((String) Config.getValue(SysConfigKey.AUTH_PAUTH)));
        arrayMap.put("like", this.aoQ ? "1" : "0");
        arrayMap.put(GamePlayerVideoModel.LIKE_NUM, TextUtils.isEmpty(this.aoR) ? "" : this.aoR);
        arrayMap.put(RemoteMessageConst.DATA, this.aoJ);
        arrayMap.put("tagId", this.aoL);
        this.apa.setParamsArrayMap(arrayMap);
    }

    private void mG() {
        this.apa = new GameCommentJsInterface(this.mWebView, this);
        this.apa.setFrom("weekly_comment_detail");
        this.apa.setWeeklyReportId(this.aoI);
        this.apa.addWebRequestParam("positionPage", 3);
        this.apa.addWebRequestParam(CachesTable.COLUMN_KEY, Integer.valueOf(this.aoI));
        this.apa.addWebRequestParam("commentId", this.aoK);
        this.apa.addWebRequestParam(RemoteMessageConst.DATA, this.aoJ);
        this.mWebView.addJavascriptInterface(this.apa, "android");
    }

    private void mH() {
        this.apa = new GameCommentJsInterface(this.mWebView, this);
        this.apa.setFrom(MODULE_GAME);
        this.apa.setGamePackage(this.mGamePackage);
        this.apa.setLatestVersionCode(this.aoY);
        this.apa.setGameID(bc.toInt(this.mGameID));
        this.apa.setCommentID(this.aoK);
        this.apa.setGameIconUrl(this.mGameIconUrl);
        this.apa.setGameImgUrl(this.aoX);
        this.apa.setGameName(this.mGameName);
        this.mWebView.addJavascriptInterface(this.apa, "android");
    }

    @Override
    public void onClick(View view) {
        int id = view.getId();
        if (id == R.id.comment_detail_confirm_btn) {
            if (cd.isFastClick()) {
                return;
            }
            int i = this.aoH;
            if (i == 1) {
                mI();
                HashMap hashMap = new HashMap();
                hashMap.put("from", "一周加游站");
                hashMap.put("type", "点击底部回复入口");
                UMengEventUtils.onEvent("ad_common_comment_detail_item", hashMap);
                return;
            }
            if (i == 2) {
                mI();
                HashMap hashMap2 = new HashMap();
                hashMap2.put("from", "专辑");
                hashMap2.put("type", "点击底部回复入口");
                UMengEventUtils.onEvent("ad_common_comment_detail_item", hashMap2);
                return;
            }
            if (i == 3) {
                mI();
                HashMap hashMap3 = new HashMap();
                hashMap3.put("from", "文章资讯");
                hashMap3.put("type", "点击底部回复入口");
                UMengEventUtils.onEvent("ad_common_comment_detail_item", hashMap3);
                return;
            }
            if (i == 4) {
                mI();
                HashMap hashMap4 = new HashMap();
                hashMap4.put("from", "视频资讯");
                hashMap4.put("type", "点击底部回复入口");
                UMengEventUtils.onEvent("ad_common_comment_detail_item", hashMap4);
                return;
            }
            mK();
            return;
        }
        if (id == R.id.comment_detail_edit) {
            this.aoU.setVisibility(0);
        }
    }

    private void mI() {
        ContentPublishAuthManagerProxy.INSTANCE.getInstance().check(this, "common_comment_reply", new f<Integer>() {
            @Override
            public void onChecking() {
            }

            @Override
            public void onCheckFinish(Integer num, Object... objArr) {
                CommentDetailActivity.this.mJ();
            }
        });
    }

    public void mJ() {
        k.executeJs(this.mWebView, "javascript:m_weekly.newReply(" + k.replyParams(this.mEditText.getText().toString().replace("\n", "<br>"), this.aoJ) + ")");
    }

    @Override
    public void onWebViewPageFinished(BaseWebViewLayout baseWebViewLayout, String str) {
        super.onWebViewPageFinished(baseWebViewLayout, str);
        if (TextUtils.isEmpty(this.aoO)) {
            return;
        }
        Observable.timer(300L, TimeUnit.MILLISECONDS).observeOn(AndroidSchedulers.mainThread()).subscribe(new Action1<Long>() {
            @Override
            public void call(Long l) {
                if (CommentDetailActivity.this.isFinishing() || CommentDetailActivity.this.aoZ != 0) {
                    return;
                }
                if (bc.toInt(CommentDetailActivity.this.aoW) == 0) {
                    KeyboardUtils.showKeyboard(CommentDetailActivity.this.mEditText, CommentDetailActivity.this);
                }
                CommentDetailActivity.this.aoV.setVisibility(0);
                CommentDetailActivity.this.mEditText.requestFocus();
                CommentDetailActivity.this.mEditText.setHint(CommentDetailActivity.this.aoO);
                CommentDetailActivity.this.aoU.setVisibility(0);
            }
        });
    }

    @Override
    public boolean onTouch(View view, MotionEvent motionEvent) {
        return this.ape.onTouchEvent(motionEvent);
    }

    private void bw(final String str) {
        Observable.timer(150L, TimeUnit.MILLISECONDS).observeOn(AndroidSchedulers.mainThread()).subscribe(new Action1<Long>() {
            @Override
            public void call(Long l) {
                if (CommentDetailActivity.this.isFinishing() || CommentDetailActivity.this.aoZ != 0) {
                    return;
                }
                CommentDetailActivity.this.enableEditor(true, "");
                KeyboardUtils.showKeyboard(CommentDetailActivity.this.mEditText, CommentDetailActivity.this);
                if (CommentDetailActivity.this.aoV.getVisibility() == 8) {
                    CommentDetailActivity.this.aoV.setVisibility(0);
                }
                CommentDetailActivity.this.aoU.setVisibility(0);
                CommentDetailActivity.this.mEditText.requestFocus();
                CommentDetailActivity.this.mEditText.setHint(str);
            }
        });
    }

    public void hideKeyboardOnly() {
        e.runOnUiThread(new Runnable() {
            @Override
            public void run() {
                CommentDetailActivity commentDetailActivity = CommentDetailActivity.this;
                KeyboardUtils.hideKeyboard(commentDetailActivity, commentDetailActivity.mEditText);
            }
        });
    }

    public void hideKeyboard() {
        if (KeyboardUtils.isOpenInput(this, this.mEditText)) {
            KeyboardUtils.hideKeyboard(this, this.mEditText);
            Observable.timer(150L, TimeUnit.MILLISECONDS).observeOn(AndroidSchedulers.mainThread()).subscribe(new Action1<Long>() {
                @Override
                public void call(Long l) {
                    if (CommentDetailActivity.this.mEditText != null) {
                        if (TextUtils.isEmpty(CommentDetailActivity.this.mEditText.getText().toString())) {
                            CommentDetailActivity.this.mEditText.setHint(CommentDetailActivity.this.getString(R.string.comment_replay_comment));
                            if (CommentDetailActivity.this.aoU != null) {
                                CommentDetailActivity.this.aoU.setVisibility(8);
                            }
                            CommentDetailActivity.this.aoJ = null;
                            return;
                        }
                        if (CommentDetailActivity.this.aoU != null) {
                            CommentDetailActivity.this.aoU.setVisibility(0);
                        }
                    }
                }
            });
        }
    }

    private void mK() {
        UserCenterManager.checkIsLogin(PluginApplication.getContext(), new f<Boolean>() {
            @Override
            public void onChecking() {
            }

            @Override
            public void onCheckFinish(Boolean bool, Object... objArr) {
                if (bool.booleanValue()) {
                    if (CommentDetailActivity.this.aoH != 0) {
                        CommentDetailActivity.this.mL();
                    } else {
                        ContentPublishAuthManagerProxy.INSTANCE.getInstance().check(CommentDetailActivity.this, "game_comment_reply", new f<Integer>() {
                            @Override
                            public void onChecking() {
                            }

                            @Override
                            public void onCheckFinish(Integer num, Object... objArr2) {
                                CommentDetailActivity.this.mL();
                            }
                        });
                    }
                }
            }
        });
    }

    public void mL() {
        String replyParams = k.replyParams(this.mEditText.getText().toString().replaceAll("\n", "<br>"), this.aoJ);
        this.mWebView.loadJs(getString(R.string.js_prefix, new Object[]{"loadList.newReply(" + replyParams + ")"}));
        UserModel user = UserCenterManager.getInstance().getUser();
        UMengEventUtils.onEvent("ad_game_details_reply_comment_send", (user == null || user.getRank() != 2) ? "普通用户" : "开发者");
    }

    @Override
    public void onDestroy() {
        GameCommentJsInterface gameCommentJsInterface = this.apa;
        if (gameCommentJsInterface != null) {
            HashMap<String, String> statParamsOnDestoryMap = gameCommentJsInterface.getStatParamsOnDestoryMap();
            if (statParamsOnDestoryMap.containsKey(AnalyticsConfig.RTD_START_TIME) && !TextUtils.isEmpty(statParamsOnDestoryMap.get(AnalyticsConfig.RTD_START_TIME))) {
                statParamsOnDestoryMap.put("duration", String.valueOf(NetworkDataProvider.getNetworkDateline() - Long.parseLong(statParamsOnDestoryMap.get(AnalyticsConfig.RTD_START_TIME))));
            }
            t.onEvent("browse_game_comment", statParamsOnDestoryMap);
            this.apa.onDestroy();
        }
        g gVar = this.mLoginJsInterface;
        if (gVar != null) {
            gVar.onDestroy();
        }
        super.onDestroy();
        RxBus.unregister(this);
        this.aoO = null;
        this.aoT = null;
    }

    private void resetInputEditText() {
        this.aoJ = null;
        e.runOnUiThread(new Runnable() {
            @Override
            public void run() {
                if (CommentDetailActivity.this.mEditText != null) {
                    CommentDetailActivity.this.mEditText.setText("");
                    CommentDetailActivity.this.mEditText.clearFocus();
                    CommentDetailActivity.this.mEditText.setHint(CommentDetailActivity.this.getString(R.string.comment_replay_comment));
                }
            }
        });
    }

    @Keep
    @Subscribe(tags = {@Tag("tag.common.comment.praise")}, thread = EventThread.MAIN_THREAD)
    public void praiseCommonComment(Bundle bundle) {
        if (TextUtils.isEmpty(bundle.getString("from")) || k(bundle)) {
            return;
        }
        int i = bundle.getInt("intent.extra.comment.id");
        k.executeJs(this.mWebView, "javascript:m_common.praiseSuccess(" + i + ")");
    }

    @Keep
    @Subscribe(tags = {@Tag("tag.comment.reply")})
    public void setReplay(Bundle bundle) {
        String string = bundle.getString("intent.extra.comment.reply.hint");
        if (TextUtils.isEmpty(string)) {
            string = getString(R.string.comment_replay_comment);
        }
        this.aoJ = bundle.getString("intent.extra.comment.reply.json");
        this.mEditText.setText("");
        bw(string);
    }

    @Keep
    @Subscribe(tags = {@Tag("tag.comment.reply.request"), @Tag("tag.weekly.comment,reply.request")})
    public void onNetworkRequestLifecycle(Bundle bundle) {
        if (k(bundle)) {
            KeyboardUtils.hideKeyboard(this, this.mEditText);
            if (l.ACTION_STATE_FAILURE.equals(bundle.getString("state"))) {
                this.aoO = null;
            } else if (l.ACTION_STATE_SUCCESS.equals(bundle.getString("state"))) {
                resetInputEditText();
            }
        }
    }

    private boolean k(Bundle bundle) {
        if (bundle == null) {
            return false;
        }
        String string = bundle.getString("from");
        if (TextUtils.isEmpty(string)) {
            return false;
        }
        int i = this.aoH;
        if (i == 0) {
            return MODULE_GAME.equals(string);
        }
        if (i == 1) {
            return "weekly_comment_detail".equals(string);
        }
        if (i == 2) {
            return "special_comment_detail".equals(string);
        }
        if (i == 3) {
            return "news_comment_detail".equals(string);
        }
        if (i == 4) {
            return "video_info_comment_detail".equals(string);
        }
        return false;
    }

    @Keep
    @Subscribe(tags = {@Tag("tag.comment.page.load.success")})
    public void loadSuccess(Boolean bool) {
        LinearLayout linearLayout = this.aoV;
        if (linearLayout != null && this.aoZ == 0) {
            linearLayout.setVisibility(bool.booleanValue() ? 0 : 8);
            if (!bool.booleanValue()) {
                KeyboardUtils.hideKeyboard(this, this.mEditText);
            }
        }
        if (this.aoS) {
            return;
        }
        if (!TextUtils.isEmpty(this.aoT) && this.mWebView != null) {
            this.mWebView.loadJs(this.aoT);
            this.aoT = null;
        }
        this.aoS = true;
    }

    @Keep
    @Subscribe(tags = {@Tag("tag.comment.delete.action")})
    public void deleteComment(String str) {
        this.mWebView.loadJs(str);
    }

    @Keep
    @Subscribe(tags = {@Tag("tag.comment.page.load.error")})
    public void loadError(Integer num) {
        this.aoZ = num.intValue();
        hideKeyboard();
    }

    @Keep
    @Subscribe(tags = {@Tag("tag.comment.detail.dialog")})
    public void dialog(String str) {
        JSONObject parseJSONObjectFromString = JSONUtils.parseJSONObjectFromString(str);
        String string = JSONUtils.getString("msg", parseJSONObjectFromString);
        final String string2 = JSONUtils.getString("cancel", parseJSONObjectFromString);
        final String string3 = JSONUtils.getString("confirm", parseJSONObjectFromString);
        com.dialog.c cVar = new com.dialog.c(this);
        cVar.setDialogTwoButtomTheme(DialogTwoButtonTheme.Horizontal_Red);
        cVar.setOnDialogTwoHorizontalBtnsClickListener(new c.b() {
            @Override
            public DialogResult onLeftBtnClick() {
                CommentDetailActivity.this.mWebView.loadJs(CommentDetailActivity.this.getString(R.string.js_prefix, new Object[]{string3 + "()"}));
                return null;
            }

            @Override
            public DialogResult onRightBtnClick() {
                CommentDetailActivity.this.mWebView.loadJs(CommentDetailActivity.this.getString(R.string.js_prefix, new Object[]{string2 + "()"}));
                return null;
            }
        });
        cVar.showDialog(string, "", getString(R.string.delete), getString(R.string.cancel));
    }

    @Keep
    @Subscribe(tags = {@Tag("tag.game.detail.comment.success")})
    public void onModifyCommentSuccess(Bundle bundle) {
        if (bundle.getInt("intent.extra.game.id") == Integer.valueOf(this.mGameID).intValue() && !TextUtils.isEmpty(this.aoK)) {
            if (this.aoK.equals(String.valueOf(bundle.getInt("extra.comment.tid", 0)))) {
                k.executeJs(this.mWebView, k.createAddCommentJsonJs(bundle.getString("intent.extra.comment.action.json"), bundle.getInt("intent.extra.comment.rating", 3), bundle.getInt("intent.extra.comment.is.game.comment"), bundle.getInt("comment_contribute")));
            }
        }
    }

    @Keep
    @Subscribe(tags = {@Tag("tag.comment.action")})
    public void onCommentActionResult(Bundle bundle) {
        String string;
        if (this.mWebView == null) {
            return;
        }
        String string2 = bundle.getString("intent.extra.comment.action.state");
        String string3 = bundle.getString("intent.extra.comment.action.from");
        String string4 = bundle.getString("intent.extra.comment.action");
        if (l.ACTION_STATE_SUCCESS.equals(string2)) {
            if (l.ACTION_GET_COMMENT_DETAIL.equals(string4) && this.aoH == 0 && UserCenterManager.isLogin().booleanValue()) {
                this.mUid = JSONUtils.getString("uid", JSONUtils.getJSONObject("userInfo", JSONUtils.getJSONObject(RemoteMessageConst.DATA, JSONUtils.getJSONObject(RemoteMessageConst.DATA, JSONUtils.getJSONObject("response", ap.parseJSONObjectFromString(bundle.getString("intent.extra.comment.action.info")))))));
                e.runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        CommentDetailActivity.this.mz();
                    }
                });
            }
        } else if (l.ACTION_STATE_FAILURE.equals(string2) && "like".equals(string4) && !MODULE_GAME.equals(string3)) {
            int i = bundle.getInt("intent.extra.comment.action.failure.code");
            string = getString(R.string.js_prefix, new Object[]{"supportErrorCallback(" + i + ")"});
            if (!this.aoS) {
                if (TextUtils.isEmpty(string)) {
                    return;
                }
                this.mWebView.loadJs(string);
                return;
            }
            this.aoT = string;
            return;
        }
        string = "";
        if (!this.aoS) {
        }
    }

    @Override
    public void onResume() {
        super.onResume();
    }

    @Override
    public void onPause() {
        super.onPause();
        KeyboardUtils.hideKeyboard(this, this.mEditText);
    }

    @Override
    public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
        if (charSequence.toString().trim().length() > 0) {
            this.aoU.setTextColor(-1);
            this.aoU.setEnabled(true);
            this.aoU.setBackgroundResource(R.drawable.m4399_xml_selector_green_btn_round_corner_background);
            this.aoU.setOnClickListener(this);
            return;
        }
        this.aoU.setTextColor(getResources().getColor(R.color.bai_66ffffff));
        this.aoU.setBackgroundResource(R.drawable.m4399_shape_bg_lv_54ba3d_3dp);
        this.aoU.setEnabled(false);
        this.aoU.setOnClickListener(null);
    }

    @Override
    public boolean onScroll(MotionEvent motionEvent, MotionEvent motionEvent2, float f, float f2) {
        if (Math.abs(motionEvent.getY() - motionEvent2.getY()) <= 20.0f) {
            return false;
        }
        hideKeyboard();
        return false;
    }

    @Override
    public boolean onFling(MotionEvent motionEvent, MotionEvent motionEvent2, float f, float f2) {
        if (Math.abs(motionEvent.getY() - motionEvent2.getY()) <= 20.0f) {
            return false;
        }
        hideKeyboard();
        return false;
    }

    @Override
    public boolean onMenuItemClick(MenuItem menuItem) {
        if (menuItem.getItemId() == R.id.m4399_menu_report) {
            this.mWebView.loadJs(getString(R.string.js_prefix, new Object[]{"window.m_commentDetail.report()"}));
        }
        return false;
    }
}