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

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


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

import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.net.wifi.WifiManager;
import android.os.Bundle;
import android.support.annotation.Keep;
import android.support.v4.app.NotificationCompat;
import android.support.v4.content.ContextCompat;
import android.support.v7.view.menu.MenuBuilder;
import android.support.v7.widget.Toolbar;
import android.text.SpannableString;
import android.text.TextUtils;
import android.text.format.Formatter;
import android.text.style.ForegroundColorSpan;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.dialog.DialogResult;
import com.dialog.c;
import com.dialog.theme.DialogTwoButtonTheme;
import com.efs.sdk.base.core.util.NetworkUtil;
import com.framework.config.Config;
import com.framework.helpers.IntentHelper;
import com.framework.manager.network.NetworkStatusManager;
import com.framework.net.ILoadPageEventListener;
import com.framework.rxbus.RxBus;
import com.framework.rxbus.annotation.Subscribe;
import com.framework.rxbus.annotation.Tag;
import com.framework.utils.ActivityStateUtils;
import com.framework.utils.BundleUtils;
import com.framework.utils.DeviceUtils;
import com.framework.utils.UMengEventUtils;
import com.huawei.hms.framework.common.ContainerUtils;
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.config.GameCenterConfigKey;
import com.m4399.gamecenter.plugin.main.controllers.gamehub.GameHubPostJsInterface;
import com.m4399.gamecenter.plugin.main.controllers.video.ZoneVideoPlayActivity;
import com.m4399.gamecenter.plugin.main.controllers.web.BaseWebViewActivity;
import com.m4399.gamecenter.plugin.main.controllers.youngmodel.YoungModelManagerProxy;
import com.m4399.gamecenter.plugin.main.helpers.GameHubActionHelper;
import com.m4399.gamecenter.plugin.main.helpers.bq;
import com.m4399.gamecenter.plugin.main.helpers.event.EventHelper;
import com.m4399.gamecenter.plugin.main.manager.favorites.PostFavoriteCheckListener;
import com.m4399.gamecenter.plugin.main.manager.router.GameCenterRouterManager;
import com.m4399.gamecenter.plugin.main.manager.stat.StatManager;
import com.m4399.gamecenter.plugin.main.manager.task.TaskManager;
import com.m4399.gamecenter.plugin.main.manager.user.UserCenterManager;
import com.m4399.gamecenter.plugin.main.manager.user.UserGradeManager;
import com.m4399.gamecenter.plugin.main.models.gamehub.GameHubPostModifyModel;
import com.m4399.gamecenter.plugin.main.models.gamehub.ModeratorActionModel;
import com.m4399.gamecenter.plugin.main.models.task.TaskActions;
import com.m4399.gamecenter.plugin.main.models.user.UserHomePageTabType;
import com.m4399.gamecenter.plugin.main.providers.gamehub.GameHubActionCheckDataProvider;
import com.m4399.gamecenter.plugin.main.providers.gamehub.GameHubPostModifyDp;
import com.m4399.gamecenter.plugin.main.utils.ImageProvide;
import com.m4399.gamecenter.plugin.main.utils.PostTrackHelper;
import com.m4399.gamecenter.plugin.main.utils.bc;
import com.m4399.gamecenter.plugin.main.views.GameIconCardView;
import com.m4399.gamecenter.plugin.main.views.gamehub.ModeratorActionDialog;
import com.m4399.gamecenter.plugin.main.widget.web.BaseWebViewLayout;
import com.m4399.gamecenter.plugin.main.widget.web.RecycleWebView;
import com.m4399.gamecenter.plugin.main.widget.web.ScrollWebView;
import com.m4399.gamecenter.plugin.main.widget.web.WebViewLayout;
import com.m4399.support.controllers.OnDoubleClickListener;
import com.m4399.support.quick.RecyclerQuickAdapter;
import com.m4399.support.utils.HttpResultTipUtils;
import com.m4399.support.utils.StatusBarHelper;
import com.m4399.support.utils.ToastUtils;
import com.m4399.support.widget.dialog.CommonLoadingDialog;
import com.tencent.bugly.Bugly;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import kotlin.Unit;
import kotlin.jvm.functions.Function0;
import org.json.JSONObject;
import rx.Observable;
import rx.Subscription;
import rx.android.schedulers.AndroidSchedulers;
import rx.functions.Action1;
import timber.log.Timber;

public class GameHubPostActivity extends BaseWebViewActivity implements Toolbar.OnMenuItemClickListener, com.m4399.gamecenter.plugin.main.widget.web.g {
    public static final String FRAGMENTS_TAG = "android:support:fragments";
    private static String aMt = "b.key.content";
    private int aJP;
    private boolean aLY;
    private Runnable aLZ;
    private int aMB;
    private View aMb;
    private GameIconCardView aMc;
    private TextView aMd;
    private int aMg;
    private MenuItem aMh;
    private MenuItem aMi;
    private boolean aMj;
    private boolean aMk;
    private String aMl;
    private CommonLoadingDialog aMm;
    private MenuItem aMn;
    private Subscription aMo;
    private boolean aMp;
    private GameHubPostJsInterface aMq;
    private GameHubForumPostFragment aMr;
    private a aMs;
    private String aMv;
    private MenuItem aMw;
    private boolean aMz;
    private int mForumsId;
    private String mFrom;
    private String mFromPage;
    private int mGameHubId;
    private boolean mIsFavorite;
    private String mPassthrough;
    private int mPostId;
    private String mPostTitle;
    protected com.m4399.gamecenter.plugin.main.providers.gamehub.m mVideoPlayCountProvider;
    private long mViewStart;
    private boolean aMa = false;
    private boolean aMe = false;
    private int aMf = 0;
    boolean aCb = false;
    private String aMu = "";
    private boolean aMx = false;
    private boolean aMy = true;
    private boolean aMA = false;
    private ArrayList<Object> EU = new ArrayList<>();

    public interface a {
        void postAddEssence(int i);

        void postOperate(String str, int i);

        void switchOrder(int i, String str);
    }

    @Override
    protected String getUmengPageEvent() {
        return "ad_circle_post_detail_time";
    }

    @Override
    public String getUmengPageTitle() {
        return "贴子详情";
    }

    @Override
    protected String getWebViewUrl() {
        return null;
    }

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

    public void setForumsId(int i) {
        this.mForumsId = i;
    }

    public int getPostId() {
        return this.mPostId;
    }

    public GameHubForumPostFragment getPostFragment() {
        return this.aMr;
    }

    public void setOnPostDetailMoreActionListener(a aVar) {
        this.aMs = aVar;
    }

    public GameHubPostJsInterface getPostJSInterface() {
        return this.aMq;
    }

    @Override
    protected WebViewLayout onCreateWebViewLayout(Context context) {
        return new WebViewLayout(context) {
            @Override
            protected boolean enableProgressBar() {
                return false;
            }

            @Override
            public ScrollWebView onCreateWebView(Context context2) {
                ScrollWebView webView = com.m4399.gamecenter.plugin.main.manager.ae.b.getInstance().getWebView(context2, 1);
                if (webView == null) {
                    ScrollWebView onCreateWebView = super.onCreateWebView(context2);
                    PostTrackHelper.INSTANCE.setGetWebView(System.currentTimeMillis());
                    return onCreateWebView;
                }
                if (!(webView instanceof RecycleWebView)) {
                    return webView;
                }
                if (((RecycleWebView) webView).isUsing()) {
                    PostTrackHelper.INSTANCE.setGetWebViewReuse(System.currentTimeMillis());
                    return webView;
                }
                PostTrackHelper.INSTANCE.setGetWebView(System.currentTimeMillis());
                return webView;
            }
        };
    }

    @Override
    public void onCreate(Bundle bundle) {
        this.aMA = bundle == null;
        Timber.d("onCreate", new Object[0]);
        PostTrackHelper.INSTANCE.setOnCreate(System.currentTimeMillis());
        RxBus.register(this);
        registerSubscriber(UserCenterManager.getInstance().asLoginStatusObservable().observeOn(AndroidSchedulers.mainThread()).subscribe(new Action1<Boolean>() {
            @Override
            public void call(Boolean bool) {
                GameHubPostActivity.this.aMr.onUserStatusChanged(bool.booleanValue());
                if (bool.booleanValue() && GameHubPostActivity.this.mWebView != null) {
                    String url = GameHubPostActivity.this.mWebView.getUrl();
                    if (!TextUtils.isEmpty(url) && url.contains("my.4399.com")) {
                        GameHubPostActivity.this.mWebView.loadUrl(GameHubPostActivity.this.cl(url));
                    }
                }
                GameHubPostActivity.this.sV();
            }
        }));
        if (bundle != null) {
            bundle.remove("android:support:fragments");
        }
        super.onCreate(bundle);
        this.mVideoPlayCountProvider = new com.m4399.gamecenter.plugin.main.providers.gamehub.m();
        UserGradeManager.getInstance().doExpTask(33);
        UMengEventUtils.onEvent("ad_circle_post_into", getPageTracer().getFullTrace());
        com.m4399.gamecenter.plugin.main.manager.post.a.deleteOldOrderCache();
    }

    public void sR() {
        if (ActivityStateUtils.isDestroy((Activity) this) || getToolBar() == null) {
            return;
        }
        View view = this.aMb;
        if (view != null) {
            view.setVisibility(8);
        }
        getToolBar().getMenu().clear();
    }

    @Override
    protected int getTopDivisionStyle() {
        if (this.aJP != 0) {
            return -1;
        }
        return super.getTopDivisionStyle();
    }

    @Override
    protected void initView(Bundle bundle) {
        super.initView(bundle);
        qo();
        this.mWebView.getLayoutParams().width = DeviceUtils.getDeviceWidthPixels(this);
        this.aMr = new GameHubForumPostFragment();
        getWindow().setSoftInputMode(16);
        String str = this.mFromPage;
        if (str != null && str.equals(ZoneVideoPlayActivity.class.getSimpleName())) {
            com.m4399.gamecenter.plugin.main.utils.b.assistActivity(this);
        }
        super.startFragment(this.aMr, (Bundle) null);
        Timber.d("startFragment mGameHubForumPostFragment", new Object[0]);
        this.aMr.initWebView(this.mWebView);
        this.mWebView.setOnWebViewClientListener(this);
        this.mWebView.setAcceptThirdPartyCookies();
        if (com.m4399.gamecenter.plugin.main.base.utils.a.c.isTraceContainWith(this, String.format("%s-%s", getResources().getString(R.string.home_tab_title_community), getResources().getString(R.string.gamehub_tag_recommend_title)))) {
            TaskManager.getInstance().checkTaskViewThreadFormRecommend(TaskActions.VIEW_THREAD_NEW, String.valueOf(this.mPostId));
        }
        if (!this.aLY) {
            TaskManager.getInstance().checkTask(TaskActions.VIEW_THREAD);
        }
        sS();
    }

    private void sS() {
        getWindow().getDecorView().addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
            @Override
            @SuppressLint({"ResourceType"})
            public void onLayoutChange(View view, int i, int i2, int i3, int i4, int i5, int i6, int i7, int i8) {
                View findViewById = GameHubPostActivity.this.findViewById(35);
                if (findViewById != null) {
                    findViewById.setVisibility(4);
                }
            }
        });
    }

    @Override
    public void initData(Intent intent) {
        this.mFrom = intent.getStringExtra("intent.extra.from.key");
        this.aLY = intent.getBooleanExtra("intent.extra.gamehub.post.is.from.info.list", false);
        this.mGameHubId = intent.getIntExtra("intent.extra.gamehub.id", 0);
        this.mPostId = intent.getIntExtra("intent.extra.gamehub.post.id", 0);
        this.mForumsId = intent.getIntExtra("intent.extra.gamehub.forums.id", 0);
        this.aJP = intent.getIntExtra("intent.extra.gamehub.post.reply.id", 0);
        this.mFromPage = intent.getStringExtra("intent.extra.from.page.name");
        this.mPassthrough = intent.getStringExtra("intent.extra.passthrough");
        if (IntentHelper.isStartByWeb(intent)) {
            Map<String, String> uriParams = IntentHelper.getUriParams(intent);
            this.mGameHubId = bc.toInt(uriParams.get("gameHubId"));
            this.mPostId = bc.toInt(uriParams.get("topicId"));
            this.mForumsId = bc.toInt(uriParams.get("forumsId"));
        }
        this.aMa = intent.getBooleanExtra("intent.extra.from.message", false);
        this.aMz = intent.getBooleanExtra("intent.extra.favorite.show.guiding.bar", false);
        sV();
        StatManager.getInstance().onUserActionTraceEvent("goto_post_detail", StatManager.filterTrace(getPageTracer().getFullTrace()));
        getPageTracer().setTraceTitle("帖子详情[id=" + this.mPostId + "]");
    }

    public void commitStat() {
        if (this.aMA) {
            this.aMA = false;
            int i = BundleUtils.getInt(getIntent(), "intent.extra.list.position", -1);
            int i2 = BundleUtils.getInt(getIntent(), "intent.extra.gamehub.post.root.tyoe", -1);
            Map<String, Object> buildMap = com.m4399.gamecenter.plugin.main.utils.ay.buildMap("passthrough", BundleUtils.getString(getIntent(), "intent.extra.passthrough"));
            GameHubForumPostFragment gameHubForumPostFragment = this.aMr;
            if (gameHubForumPostFragment != null) {
                buildMap.put("is_ask", Boolean.valueOf(gameHubForumPostFragment.isIsQa()));
                buildMap.put("is_video", Boolean.valueOf(this.aMr.isVideo()));
            }
            com.m4399.gamecenter.plugin.main.manager.stat.e.openPostDetail(this, i2, this.mPostId, this.mGameHubId, this.mForumsId, i, buildMap);
        }
    }

    public void setPostType(int i) {
        GameHubPostJsInterface gameHubPostJsInterface = this.aMq;
        if (gameHubPostJsInterface != null) {
            gameHubPostJsInterface.setPostType(i);
        }
        if (this.mShareJSInterface != null) {
            this.mShareJSInterface.setPostType(i);
        }
        boolean z = false;
        boolean z2 = i == 2 || i == 3;
        if (this.aMr.getUserPtuid().equals(UserCenterManager.getPtUid()) && z2) {
            z = true;
        }
        this.aMx = z;
    }

    public void setForumsName(String str) {
        GameHubPostJsInterface gameHubPostJsInterface = this.aMq;
        if (gameHubPostJsInterface != null) {
            gameHubPostJsInterface.setForumName(str);
        }
    }

    @Override
    protected void initJavascriptInterface(WebViewLayout webViewLayout) {
        super.initJavascriptInterface(webViewLayout);
        this.aMq = (GameHubPostJsInterface) getRecycleJsInterface(GameHubPostJsInterface.class, webViewLayout);
        if (this.aMq == null) {
            this.aMq = new GameHubPostJsInterface(webViewLayout, this);
        }
        this.aMq.setForumsId(this.mForumsId);
        this.aMq.setGameHubId(this.mGameHubId);
        this.aMq.setPostId(this.mPostId);
        this.aMq.setPassthrough(this.mPassthrough);
        this.aMq.setGamehubActionListener(new GameHubPostJsInterface.b() {
            @Override
            public void doPlayVideo(String str) {
                GameHubPostActivity.this.cm(str);
            }

            @Override
            public void applyDialogClickListener(String str, String str2, String str3) {
                GameHubPostActivity.this.aMr.applyDialogCallBack(str, str2, str3);
            }

            @Override
            public boolean isQaStateTrue() {
                return GameHubPostActivity.this.aMr.getIsQAAnswer() == 1;
            }
        });
        webViewLayout.addJavascriptInterface(this.aMq, "android");
        this.mShareJSInterface.setFeature(UserHomePageTabType.TAB_POST);
        this.mShareJSInterface.setUmengKey("ad_topic_share_click");
        this.mShareJSInterface.setUmengValue("游戏圈帖子");
        this.mShareJSInterface.setFeatureId(this.mPostId);
        this.mShareJSInterface.setForumsId(this.mForumsId);
        this.mShareJSInterface.setGameHubId(this.mGameHubId);
        this.mLoginJsInterface.bindEvent("login", "");
    }

    @Override
    protected void onDestroy() {
        RxBus.unregister(this);
        super.onDestroy();
        GameHubPostJsInterface gameHubPostJsInterface = this.aMq;
        if (gameHubPostJsInterface != null) {
            gameHubPostJsInterface.onDestroy();
            this.aMq = null;
        }
        this.aMs = null;
        this.aMr = null;
        com.m4399.gamecenter.plugin.main.viewholder.favorite.g.getInstance().hideTip();
        com.m4399.gamecenter.plugin.main.utils.aw.dumpLogFile("threadDetail.txt");
        this.aLZ = null;
        CommonLoadingDialog commonLoadingDialog = this.aMm;
        if (commonLoadingDialog != null) {
            commonLoadingDialog.dismiss();
        }
    }

    @Override
    public void setContentView(int i) {
        com.m4399.gamecenter.plugin.main.utils.aw.logTraceFunc();
        getDelegate().setContentView(i);
        com.m4399.gamecenter.plugin.main.utils.aw.logTraceFunc("setContentView");
        initToolBar();
        com.m4399.gamecenter.plugin.main.utils.aw.logTraceFunc("initToolBar");
    }

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

    @Override
    protected void onResume() {
        super.onResume();
        GameHubPostJsInterface gameHubPostJsInterface = this.aMq;
        if (gameHubPostJsInterface != null) {
            gameHubPostJsInterface.onResume();
        }
        this.mViewStart = System.currentTimeMillis();
    }

    @Override
    protected void onPause() {
        GameHubPostJsInterface gameHubPostJsInterface = this.aMq;
        if (gameHubPostJsInterface != null) {
            gameHubPostJsInterface.onPause();
        }
        super.onPause();
        this.aLZ = null;
    }

    @Override
    public void onWebViewPageStart(BaseWebViewLayout baseWebViewLayout, String str, Bitmap bitmap) {
        super.onWebViewPageStart(baseWebViewLayout, str, bitmap);
        GameHubForumPostFragment gameHubForumPostFragment = this.aMr;
        if (gameHubForumPostFragment != null) {
            gameHubForumPostFragment.onWebViewPageStart(baseWebViewLayout, str, bitmap);
        }
    }

    @Override
    public void onWebViewPageFinished(BaseWebViewLayout baseWebViewLayout, String str) {
        if (this.mWebView == null) {
            return;
        }
        if (!this.isReceivedError) {
            String title = this.mWebView.getTitle();
            if (!TextUtils.isEmpty(this.mWebView.getTitle()) && title.contains("data:text/html")) {
                setTitle("网络异常");
            }
        }
        GameHubForumPostFragment gameHubForumPostFragment = this.aMr;
        if (gameHubForumPostFragment != null) {
            gameHubForumPostFragment.onWebViewPageFinished(baseWebViewLayout, str);
        }
        super.onWebViewPageFinished(baseWebViewLayout, str);
        if (this.aLY) {
            this.aLZ = new Runnable() {
                @Override
                public void run() {
                    TaskManager.getInstance().checkViewNewsV2Task(TaskActions.VIEW_NEWS_V2, com.m4399.gamecenter.plugin.main.manager.task.c.createViewNewsParams(GameHubPostActivity.this.mFrom), UserHomePageTabType.TAB_POST + GameHubPostActivity.this.mPostId);
                }
            };
            com.m4399.gamecenter.plugin.main.utils.e.postDelayed(this, this.aLZ, 3000L);
        }
    }

    private void qo() {
        Toolbar toolBar = getToolBar();
        setSupportActionBar(getToolBar());
        if (this.aJP != 0) {
            findViewById(R.id.v_toolbar_bottom_line).setVisibility(0);
        }
        toolBar.addView(sU());
        toolBar.setOnClickListener(new OnDoubleClickListener() {
            @Override
            protected void onDoubleClick(View view) {
                if (GameHubPostActivity.this.mWebView != null && GameHubPostActivity.this.mWebView.getWebView() != null) {
                    GameHubPostActivity.this.mWebView.getWebView().scrollTo(0, 0);
                }
                UMengEventUtils.onEvent("returnto_top_toolbar_click", "帖子详情页");
            }
        });
        toolBar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (GameHubPostActivity.this.aMr != null) {
                    GameHubPostActivity.this.aMr.clearWebViewHistory();
                }
                GameHubPostActivity.this.finish();
            }
        });
        toolBar.setOverflowIcon(getResources().getDrawable(R.drawable.m4399_xml_selector_toolbar_item_more_black));
    }

    public void showToolbarMenu() {
        getToolBar().getMenu().clear();
        kw();
        b(getToolBar());
    }

    private void b(Toolbar toolbar) {
        Menu menu = toolbar.getMenu();
        this.aMi = menu.findItem(R.id.m4399_menu_post_modify);
        this.aMn = menu.findItem(R.id.m4399_menu_post_share);
        this.aMw = menu.findItem(R.id.m4399_menu_report);
        this.aMh = menu.findItem(R.id.m4399_menu_action);
        MenuItem menuItem = this.aMn;
        if (menuItem != null) {
            menuItem.setTitle(getString(R.string.menu_share));
        }
        toolbar.setPopupTheme(R.style.MyDarkToolbarStyle);
        bq.trySetShowMenuIcon(toolbar.getMenu());
    }

    @Override
    public int getMenuID() {
        try {
            new MenuBuilder(this);
        } catch (Error e) {
            e.printStackTrace();
            this.aCb = true;
        }
        if (this.aCb) {
        }
        return -1;
    }

    @Override
    public boolean onCreatePanelMenu(int i, Menu menu) {
        return super.onCreatePanelMenu(i, menu);
    }

    private void kw() {
        Toolbar toolBar = getToolBar();
        toolBar.inflateMenu(R.menu.m4399_menu_post_detail);
        toolBar.setOnMenuItemClickListener(this);
        bq.trySetShowMenuIcon(toolBar.getMenu());
    }

    public void bindMenuItemPostModify(final String str, final boolean z, final boolean z2, final String str2, final int i) {
        com.m4399.gamecenter.plugin.main.utils.e.postDelayed(new Runnable() {
            @Override
            public void run() {
                if (GameHubPostActivity.this.aMi == null) {
                    return;
                }
                GameHubPostActivity.this.aMj = z;
                GameHubPostActivity.this.aMk = z2;
                GameHubPostActivity.this.aMl = str2;
                if (UserCenterManager.isLogin().booleanValue() && UserCenterManager.getPtUid().equals(str) && i == 1) {
                    GameHubPostActivity.this.aMi.setVisible(true);
                    SpannableString spannableString = new SpannableString(GameHubPostActivity.this.aMi.getTitle());
                    spannableString.setSpan(new ForegroundColorSpan(ContextCompat.getColor(GameHubPostActivity.this, z ? R.color.hei_de000000 : R.color.hui_42000000)), 0, spannableString.length(), 0);
                    GameHubPostActivity.this.aMi.setTitle(spannableString);
                    GameHubPostActivity.this.aMi.setIcon(z ? R.mipmap.m4399_png_toolbar_more_item_edit_post : R.mipmap.m4399_png_toolbar_more_item_edit_post_disable);
                    return;
                }
                GameHubPostActivity.this.aMi.setVisible(false);
            }
        }, 500L);
    }

    @Override
    public boolean onMenuItemClick(MenuItem menuItem) {
        if (!this.aMe) {
            ToastUtils.showToast(this, getString(R.string.post_is_being_audited));
            return true;
        }
        int itemId = menuItem.getItemId();
        if (itemId == R.id.m4399_menu_post_modify) {
            if (!NetworkStatusManager.checkIsAvalible()) {
                ToastUtils.showToast(PluginApplication.getApplication(), R.string.str_check_your_network);
                return true;
            }
            sW();
        } else if (itemId == R.id.m4399_menu_post_share) {
            if (this.aMB >= 5) {
                ToastUtils.showToast(this, R.string.poster_not_support_share);
                return true;
            }
            this.mShareJSInterface.openShare();
            HashMap hashMap = new HashMap();
            hashMap.put("name", "分享(顶部)");
            hashMap.put(com.m4399.gamecenter.plugin.main.database.tables.m.COLUMN_MSG_QUAN_ID, String.valueOf(this.mGameHubId));
            UMengEventUtils.onEvent("ad_circle_topic_more_click", hashMap);
        } else if (itemId == R.id.m4399_menu_favorite) {
            GameHubForumPostFragment gameHubForumPostFragment = this.aMr;
            if (gameHubForumPostFragment != null) {
                gameHubForumPostFragment.doCollection();
            }
            UMengEventUtils.onEvent("ad_circle_topic_more_click", "name", "收藏(顶部)", com.m4399.gamecenter.plugin.main.database.tables.m.COLUMN_MSG_QUAN_ID, String.valueOf(this.mGameHubId));
        } else if (itemId == R.id.m4399_menu_report) {
            if (this.aMv != null && this.mPostTitle != null && this.aMr != null) {
                HashMap hashMap2 = new HashMap();
                hashMap2.put("name", "举报");
                hashMap2.put(com.m4399.gamecenter.plugin.main.database.tables.m.COLUMN_MSG_QUAN_ID, String.valueOf(this.mGameHubId));
                UMengEventUtils.onEvent("ad_circle_topic_more_click", hashMap2);
                Bundle bundle = new Bundle();
                bundle.putString("intent.extra.report.id", Integer.toString(this.mPostId));
                bundle.putInt("intent.extra.report.content.type", 6);
                bundle.putString("intent.extra.report.nick", this.aMv);
                bundle.putSerializable("intent.extra.report.extra", this.mPostTitle);
                bundle.putInt("intent.extra.report.extra.forums.id", this.mForumsId);
                bundle.putInt("post.root.type", this.aMr.getPostRootType());
                GameCenterRouterManager.getInstance().openReport(this, bundle);
            }
        } else if (itemId == R.id.m4399_menu_action) {
            if (!NetworkStatusManager.checkIsAvalible()) {
                ToastUtils.showToast(PluginApplication.getApplication(), R.string.str_check_your_network);
                return true;
            }
            sT();
        }
        return true;
    }

    private void sT() {
        dT();
    }

    private void dT() {
        final GameHubActionCheckDataProvider gameHubActionCheckDataProvider = new GameHubActionCheckDataProvider();
        gameHubActionCheckDataProvider.setQuanId(this.mGameHubId);
        gameHubActionCheckDataProvider.setForumsId(this.mForumsId);
        gameHubActionCheckDataProvider.setThreadId(this.mPostId);
        gameHubActionCheckDataProvider.setBanId(this.aMu);
        gameHubActionCheckDataProvider.setPermissionType(1);
        gameHubActionCheckDataProvider.loadData(new ILoadPageEventListener() {
            @Override
            public void onBefore() {
            }

            @Override
            public void onSuccess() {
                GameHubPostActivity.this.n(gameHubActionCheckDataProvider.getActions());
            }

            @Override
            public void onFailure(Throwable th, int i, String str, int i2, JSONObject jSONObject) {
                GameHubPostActivity gameHubPostActivity = GameHubPostActivity.this;
                ToastUtils.showToast(gameHubPostActivity, HttpResultTipUtils.getFailureTip(gameHubPostActivity, th, i, str));
            }
        });
    }

    public void n(ArrayList<Object> arrayList) {
        ModeratorActionDialog moderatorActionDialog = new ModeratorActionDialog(this);
        moderatorActionDialog.setOnItemClickListener(new RecyclerQuickAdapter.OnItemClickListener<Object>() {
            @Override
            public void onItemClick(View view, Object obj, int i) {
                if (obj instanceof ModeratorActionModel) {
                    if (!NetworkStatusManager.checkIsAvalible()) {
                        ToastUtils.showToast(GameHubPostActivity.this, R.string.network_error);
                        return;
                    }
                    ModeratorActionModel moderatorActionModel = (ModeratorActionModel) obj;
                    switch (moderatorActionModel.getType()) {
                        case 0:
                            GameHubPostActivity.this.a(moderatorActionModel);
                            break;
                        case 1:
                            GameHubPostActivity.this.b(moderatorActionModel);
                            break;
                        case 2:
                            GameHubPostActivity.this.c(moderatorActionModel);
                            break;
                        case 3:
                            GameHubPostActivity.this.d(moderatorActionModel);
                            break;
                        case 4:
                            GameHubPostActivity.this.e(moderatorActionModel);
                            break;
                        case 5:
                            GameHubPostActivity.this.f(moderatorActionModel);
                            break;
                        case 6:
                            GameHubPostActivity.this.g(moderatorActionModel);
                            break;
                    }
                    HashMap<String, Object> postMobileVerifyMap = com.m4399.gamecenter.plugin.main.manager.stat.e.getPostMobileVerifyMap();
                    postMobileVerifyMap.put("click_position", moderatorActionModel.getTitle());
                    EventHelper.INSTANCE.onEventMap("post_restricted_operation_click", postMobileVerifyMap);
                }
            }
        });
        moderatorActionDialog.bind(arrayList);
        moderatorActionDialog.show();
    }

    public void a(ModeratorActionModel moderatorActionModel) {
        GameHubActionHelper.INSTANCE.reason(moderatorActionModel, this.mPostId, this.mForumsId, this.mGameHubId, this.aMu, this.aMv, this.mPostTitle, 1);
    }

    public void b(final ModeratorActionModel moderatorActionModel) {
        GameHubActionHelper.INSTANCE.action(moderatorActionModel, this.mPostId, this.mForumsId, this.mGameHubId, new Function0<Unit>() {
            @Override
            public Unit invoke() {
                GameHubPostActivity gameHubPostActivity;
                int i;
                boolean isExecuted = moderatorActionModel.getIsExecuted();
                int i2 = !isExecuted ? 1 : 0;
                GameHubPostActivity.this.aMr.lockEditorJs(i2);
                moderatorActionModel.setExecuted(!isExecuted);
                if (GameHubPostActivity.this.aMs != null) {
                    GameHubPostActivity.this.aMs.postOperate("post_lock", i2);
                }
                if (isExecuted) {
                    gameHubPostActivity = GameHubPostActivity.this;
                    i = R.string.cancel_lock;
                } else {
                    gameHubPostActivity = GameHubPostActivity.this;
                    i = R.string.locked;
                }
                String string = gameHubPostActivity.getString(i);
                com.m4399.gamecenter.plugin.main.manager.stat.e.postOperationSuccessEvent(true, string);
                ToastUtils.showToast(GameHubPostActivity.this, string);
                return null;
            }
        });
    }

    public void c(final ModeratorActionModel moderatorActionModel) {
        GameHubActionHelper.INSTANCE.action(moderatorActionModel, this.mPostId, this.mForumsId, this.mGameHubId, new Function0<Unit>() {
            @Override
            public Unit invoke() {
                GameHubPostActivity gameHubPostActivity;
                int i;
                boolean isExecuted = moderatorActionModel.getIsExecuted();
                moderatorActionModel.setExecuted(!isExecuted);
                if (GameHubPostActivity.this.aMs != null) {
                    GameHubPostActivity.this.aMs.postOperate("post_down", !isExecuted ? 1 : 0);
                }
                if (isExecuted) {
                    gameHubPostActivity = GameHubPostActivity.this;
                    i = R.string.cancel_download_post;
                } else {
                    gameHubPostActivity = GameHubPostActivity.this;
                    i = R.string.download_post;
                }
                String string = gameHubPostActivity.getString(i);
                com.m4399.gamecenter.plugin.main.manager.stat.e.postOperationSuccessEvent(true, string);
                ToastUtils.showToast(GameHubPostActivity.this, string);
                return null;
            }
        });
    }

    public void d(final ModeratorActionModel moderatorActionModel) {
        GameHubActionHelper.INSTANCE.top(moderatorActionModel, this.mPostId, this.mForumsId, this.mGameHubId, new Function0<Unit>() {
            @Override
            public Unit invoke() {
                GameHubPostActivity gameHubPostActivity;
                int i;
                boolean isExecuted = moderatorActionModel.getIsExecuted();
                if (GameHubPostActivity.this.aMs != null) {
                    GameHubPostActivity.this.aMs.postOperate("post_top", !isExecuted ? 1 : 0);
                }
                if (isExecuted) {
                    gameHubPostActivity = GameHubPostActivity.this;
                    i = R.string.post_top_cancel;
                } else {
                    gameHubPostActivity = GameHubPostActivity.this;
                    i = R.string.post_top;
                }
                com.m4399.gamecenter.plugin.main.manager.stat.e.postOperationSuccessEvent(true, gameHubPostActivity.getString(i));
                return null;
            }
        });
    }

    public void e(ModeratorActionModel moderatorActionModel) {
        final boolean isExecuted = moderatorActionModel.getIsExecuted();
        a aVar = this.aMs;
        if (aVar != null) {
            aVar.postOperate("post_fine", !isExecuted ? 1 : 0);
        }
        GameHubActionHelper.INSTANCE.action(moderatorActionModel, this.mPostId, this.mForumsId, this.mGameHubId, new Function0<Unit>() {
            @Override
            public Unit invoke() {
                GameHubPostActivity gameHubPostActivity;
                int i;
                if (isExecuted) {
                    gameHubPostActivity = GameHubPostActivity.this;
                    i = R.string.cancel_fine_post;
                } else {
                    gameHubPostActivity = GameHubPostActivity.this;
                    i = R.string.fine_post;
                }
                String string = gameHubPostActivity.getString(i);
                ToastUtils.showToast(GameHubPostActivity.this, string);
                com.m4399.gamecenter.plugin.main.manager.stat.e.postOperationSuccessEvent(true, string);
                return null;
            }
        });
    }

    public void f(ModeratorActionModel moderatorActionModel) {
        GameHubActionHelper.INSTANCE.moveKind(moderatorActionModel, this.mPostId, this.mForumsId, this.mGameHubId);
    }

    public void g(ModeratorActionModel moderatorActionModel) {
        GameHubActionHelper.INSTANCE.mute(moderatorActionModel, this.mPostId, this.mForumsId, this.mGameHubId, this.aMu, this.aMv, this.aMr.getmQuanName(), 1);
    }

    public void setWebViewHeightWrapContent(boolean z) {
        if (this.mWebView == null || this.mWebView.getWebView() == null) {
            return;
        }
        try {
            int measuredHeight = this.mWebView.getWebView().getMeasuredHeight();
            ViewGroup.LayoutParams layoutParams = this.mWebView.getWebView().getLayoutParams();
            if (z) {
                measuredHeight = -2;
            }
            layoutParams.height = measuredHeight;
        } catch (Throwable th) {
            th.printStackTrace();
        }
    }

    public void clearToolbarMenuAndView() {
        Toolbar toolBar = getToolBar();
        if (toolBar == null) {
            return;
        }
        View view = this.aMb;
        if (view != null) {
            toolBar.removeView(view);
        }
        Menu menu = toolBar.getMenu();
        if (menu != null) {
            menu.clear();
        }
    }

    public void setToolBarStyle(boolean z) {
        Resources resources;
        int i;
        View view = this.aMb;
        if (view != null) {
            view.setVisibility(z ? 8 : 0);
        }
        findViewById(R.id.v_toolbar_bottom_line).setVisibility(z ? 8 : 0);
        Toolbar toolBar = getToolBar();
        if (z) {
            resources = getResources();
            i = R.color.transparent;
        } else {
            resources = getResources();
            i = R.color.bai_ffffffff;
        }
        toolBar.setBackgroundColor(resources.getColor(i));
        StatusBarHelper.setStatusBarDarkStyle(this, false);
        getToolBar().setNavigationIcon(R.drawable.m4399_xml_selector_toolbar_item_back_white);
        getToolBar().setOverflowIcon(getResources().getDrawable(R.drawable.m4399_xml_selector_toolbar_item_more_white));
    }

    private View sU() {
        this.aMb = getLayoutInflater().inflate(R.layout.m4399_view_gamehub_post_detail_header, (ViewGroup) getToolBar(), false);
        this.aMb.setVisibility(8);
        this.aMc = (GameIconCardView) this.aMb.findViewById(R.id.game_icon);
        this.aMd = (TextView) this.aMb.findViewById(R.id.tv_game_name);
        return this.aMb;
    }

    public void sV() {
        com.m4399.gamecenter.plugin.main.manager.favorites.c.getInstance().checkIsFavorites(3, this.mPostId, null, new PostFavoriteCheckListener() {
            @Override
            public void onChecked(boolean z, Integer num) {
                GameHubPostActivity.this.a(z, num.intValue(), "pageload");
            }
        });
    }

    public void setMenuItemAdmin(boolean z) {
        this.aMh.setVisible(z);
    }

    public void setPostYears(int i) {
        this.aMB = i;
    }

    @Override
    public boolean onKeyDown(int i, KeyEvent keyEvent) {
        GameHubForumPostFragment gameHubForumPostFragment;
        if (i == 4 && (gameHubForumPostFragment = this.aMr) != null) {
            if (gameHubForumPostFragment.getBottomBar() != null && this.aMr.getBottomBar().isAuthorReplyViewShown()) {
                this.aMr.getBottomBar().showDefaultView();
                return false;
            }
            this.aMr.hideKeyboard();
            this.aMr.clearWebViewHistory();
        }
        return super.onKeyDown(i, keyEvent);
    }

    public void a(boolean z, int i, String str) {
        if (this.mWebView == null) {
            return;
        }
        this.mWebView.loadUrl("javascript:window.TopicApp.collectCallback(" + z + ",'" + str + "'," + i + ")");
        this.mIsFavorite = z;
        this.aMg = i;
    }

    public boolean getFavoriteState() {
        return this.mIsFavorite;
    }

    public int getFavoriteNum() {
        return this.aMg;
    }

    public boolean isShowFavoriteBar() {
        return this.aMz;
    }

    public void setOnlyLandlordEnable(boolean z) {
        this.aMe = z;
    }

    public void bindToolBarChildView(String str, String str2, final int i, final int i2, boolean z) {
        View view;
        if (!z) {
            this.aMb.setVisibility(8);
            return;
        }
        if (ActivityStateUtils.isDestroy((Activity) this) || getToolBar() == null || (view = this.aMb) == null || this.aMc == null || this.aMd == null) {
            return;
        }
        view.setVisibility(0);
        ImageProvide.with((Context) this).wifiLoad(true).load(str).asBitmap().into(this.aMc.getImageView());
        this.aMd.setText(str2);
        this.aMb.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view2) {
                GameHubPostActivity.this.getPageTracer().setTraceTitle("顶部论坛入口");
                Bundle bundle = new Bundle();
                bundle.putInt("intent.extra.gamehub.id", i);
                bundle.putInt("intent.extra.gamehub.forums.id", i2);
                bundle.putInt("intent.extra.game.hub.tab.id", 2);
                GameCenterRouterManager.getInstance().openGameHubDetail(GameHubPostActivity.this, bundle, false, new int[0]);
                UMengEventUtils.onEvent("ad_circle_details_header_click");
                UMengEventUtils.onEvent("ad_circle_post_details_source_click", "from", "顶部圈子入口");
            }
        });
    }

    private void sW() {
        if (this.aMr == null) {
            return;
        }
        if (!this.aMj) {
            ToastUtils.showToast(this, this.aMl);
            return;
        }
        if (this.aMk) {
            final com.dialog.c cVar = new com.dialog.c(this) {
                @Override
                protected boolean getEKy() {
                    return false;
                }
            };
            cVar.setDialogTwoButtomTheme(DialogTwoButtonTheme.Horizontal_Default);
            cVar.setOnDialogTwoHorizontalBtnsClickListener(new c.b() {
                @Override
                public DialogResult onRightBtnClick() {
                    GameHubPostActivity.this.a(cVar);
                    return DialogResult.OK;
                }

                @Override
                public DialogResult onLeftBtnClick() {
                    return DialogResult.Cancel;
                }
            });
            cVar.show(getString(R.string.post_post_modify_confirm_dialog_title), getString(R.string.post_post_modify_confirm_dialog_content), getString(R.string.cancel), getString(R.string.post_post_modify_confirm_dialog_right_btn));
            return;
        }
        a((com.dialog.c) null);
        UMengEventUtils.onEvent("ad_circle_topic_more_click", "name", "修改帖子", com.m4399.gamecenter.plugin.main.database.tables.m.COLUMN_MSG_QUAN_ID, String.valueOf(this.mGameHubId));
    }

    public void a(final com.dialog.c cVar) {
        if (this.aMr == null) {
            return;
        }
        final GameHubPostModifyDp gameHubPostModifyDp = new GameHubPostModifyDp();
        gameHubPostModifyDp.setForumsId(this.aMr.getmForumsId());
        gameHubPostModifyDp.setThreadId(bc.toInt(this.aMr.getTid()));
        gameHubPostModifyDp.setQuanId(this.aMr.getmQuanId());
        gameHubPostModifyDp.loadData(new ILoadPageEventListener() {
            @Override
            public void onBefore() {
                com.dialog.c cVar2 = cVar;
                if (cVar2 == null) {
                    if (GameHubPostActivity.this.aMm == null) {
                        GameHubPostActivity gameHubPostActivity = GameHubPostActivity.this;
                        gameHubPostActivity.aMm = new CommonLoadingDialog(gameHubPostActivity);
                    }
                    GameHubPostActivity.this.aMm.show(GameHubPostActivity.this.getString(R.string.game_hub_post_modify_loading));
                    return;
                }
                cVar2.startRightBtnLoading();
            }

            @Override
            public void onSuccess() {
                if (ActivityStateUtils.isDestroy((Activity) GameHubPostActivity.this)) {
                    return;
                }
                com.dialog.c cVar2 = cVar;
                if (cVar2 == null) {
                    if (GameHubPostActivity.this.aMm != null) {
                        GameHubPostActivity.this.aMm.dismiss();
                    }
                } else {
                    cVar2.stopRightBtnLoading();
                    cVar.dismiss();
                }
                GameHubPostActivity.this.a(gameHubPostModifyDp.getAQb());
            }

            @Override
            public void onFailure(Throwable th, int i, String str, int i2, JSONObject jSONObject) {
                if (ActivityStateUtils.isDestroy((Activity) GameHubPostActivity.this)) {
                    return;
                }
                com.dialog.c cVar2 = cVar;
                if (cVar2 == null) {
                    if (GameHubPostActivity.this.aMm != null) {
                        GameHubPostActivity.this.aMm.dismiss();
                    }
                } else {
                    cVar2.stopRightBtnLoading();
                }
                ToastUtils.showToast(GameHubPostActivity.this, HttpResultTipUtils.getFailureTip(GameHubPostActivity.this, th, i, str));
            }
        });
    }

    public void a(GameHubPostModifyModel gameHubPostModifyModel) {
        if (gameHubPostModifyModel == null || gameHubPostModifyModel.isEmpty() || this.aMr == null) {
            return;
        }
        Bundle bundle = new Bundle();
        bundle.putInt("intent.extra.gamehub.post.id", bc.toInt(this.aMr.getTid()));
        bundle.putInt("intent.extra.gamehub.id", this.aMr.getmQuanId());
        bundle.putInt("intent.extra.game.forums.id", this.aMr.getmForumsId());
        bundle.putString("intent.extra.gamehub.kind.id", String.valueOf(this.aMr.getmKindId()));
        bundle.putBoolean("intent.extra.post.publish.is.join.contribute", gameHubPostModifyModel.getContributeState() != 0);
        bundle.putString(GameHubDetailForumStyleActivity.INTENT_EXTRA_GAMEHUB_NAME, this.aMr.getmQuanName());
        bundle.putBoolean("intent.extra.is.selected.qa", this.aMr.isIsQa());
        bundle.putSerializable("intent.extra.post.modify.model", gameHubPostModifyModel);
        GameCenterRouterManager.getInstance().openGameHubPostPublish(this, bundle);
    }

    public void gameHubForumPostCollect(boolean z) {
        com.m4399.gamecenter.plugin.main.manager.favorites.c.getInstance().setFavorite(this, 3, z, this.mPostId, false, false, Integer.valueOf(this.mForumsId), Integer.valueOf(this.mGameHubId));
        HashMap hashMap = new HashMap();
        hashMap.put("name", "收藏(主楼底部)");
        hashMap.put(com.m4399.gamecenter.plugin.main.database.tables.m.COLUMN_MSG_QUAN_ID, String.valueOf(this.mGameHubId));
        UMengEventUtils.onEvent("ad_circle_topic_more_click", hashMap);
    }

    @Subscribe(tags = {@Tag("tag.Favorite.completed")})
    public void onFavoriteCompleted(Bundle bundle) {
        int i = bundle.getInt("intent.action.share.success");
        int i2 = bundle.getInt("intent.extra.favorite.id");
        if (i == 3 && this.mPostId == i2) {
            boolean z = bundle.getBoolean("intent.extra.is.favorite");
            if (z) {
                this.aMg++;
            } else {
                int i3 = this.aMg;
                if (i3 > 0) {
                    this.aMg = i3 - 1;
                }
            }
            a(z, this.aMg, "toolbar");
            GameHubForumPostFragment gameHubForumPostFragment = this.aMr;
            if (gameHubForumPostFragment != null) {
                gameHubForumPostFragment.bindFavoriteView(z);
            }
        }
    }

    @Keep
    @Subscribe(tags = {@Tag("tag.sync.post.video.status")})
    public void onSyncPostVideoProgress(Bundle bundle) {
        int i = bundle.getInt("intent.extra.current.state");
        int i2 = bundle.getInt("intent.extra.current.progress");
        int i3 = 2;
        if (i != 2) {
            if (i != 10 && i != 5 && i != 9) {
                if (i == 6) {
                    i3 = 3;
                } else if (i == 0) {
                    i3 = 0;
                }
            }
            JSONObject jSONObject = new JSONObject();
            jSONObject.put(NotificationCompat.CATEGORY_PROGRESS, i2);
            jSONObject.put("status", i3);
            this.mWebView.loadUrl("javascript:window.TopicApp.fullScreenBack(" + jSONObject.toString() + ")");
            this.aMo = Observable.timer(4000L, TimeUnit.MILLISECONDS, AndroidSchedulers.mainThread()).subscribe(new Action1<Long>() {
                @Override
                public void call(Long l) {
                    GameHubPostActivity.this.setWebViewHeightWrapContent(true);
                }
            });
        }
        i3 = 1;
        JSONObject jSONObject2 = new JSONObject();
        jSONObject2.put(NotificationCompat.CATEGORY_PROGRESS, i2);
        jSONObject2.put("status", i3);
        this.mWebView.loadUrl("javascript:window.TopicApp.fullScreenBack(" + jSONObject2.toString() + ")");
        this.aMo = Observable.timer(4000L, TimeUnit.MILLISECONDS, AndroidSchedulers.mainThread()).subscribe(new Action1<Long>() {
            @Override
            public void call(Long l) {
                GameHubPostActivity.this.setWebViewHeightWrapContent(true);
            }
        });
    }

    public void CancelTimer() {
        Subscription subscription = this.aMo;
        if (subscription != null) {
            subscription.unsubscribe();
        }
    }

    @Override
    public void onSaveInstanceState(Bundle bundle) {
        if (bundle != null) {
            bundle.putString(aMt, this.aMr.getUserWriteContent());
        }
        super.onSaveInstanceState(bundle);
    }

    @Override
    public void onRestoreInstanceState(Bundle bundle) {
        if (bundle != null) {
            this.aMr.getUserWriteEditText().setText(bundle.getString(aMt));
        }
        super.onRestoreInstanceState(bundle);
    }

    @Override
    public boolean shouldOverrideUrlLoading(BaseWebViewLayout baseWebViewLayout, String str) {
        if (str != null && str.contains("my.4399.com") && !this.aMp) {
            str = cl(str);
            try {
                baseWebViewLayout.loadUrl(str);
                this.aMp = true;
            } catch (Exception e) {
                e.printStackTrace();
                return false;
            }
        }
        if (str != null && str.contains("://ptlogin.4399.com/ptlogin/logout.do")) {
            this.aMp = false;
        }
        return false;
    }

    public String cl(String str) {
        String substring = (str == null || !str.contains("forums")) ? "" : str.substring(str.lastIndexOf("forums"));
        if (str != null && str.contains("mobile")) {
            substring = str.substring(str.lastIndexOf("mobile"));
        }
        if (UserCenterManager.isLogin().booleanValue()) {
            return b(bc.toLong(UserCenterManager.getPtUid()), UserCenterManager.getToken(), substring);
        }
        return b(0L, "", substring);
    }

    private String b(long j, String str, String str2) {
        StringBuilder sb = new StringBuilder();
        String str3 = (String) Config.getValue(GameCenterConfigKey.MY_GAME_GROUP_AUTO_LOGIN_URL);
        String str4 = (String) Config.getValue(GameCenterConfigKey.AUTH_CLIENT_ID);
        sb.append(str3);
        sb.append("?");
        sb.append("access_token=");
        sb.append(str);
        sb.append(ContainerUtils.FIELD_DELIMITER);
        sb.append("client_id=");
        sb.append(str4);
        sb.append(ContainerUtils.FIELD_DELIMITER);
        sb.append("uid=");
        sb.append(j);
        sb.append(ContainerUtils.FIELD_DELIMITER);
        sb.append("method=exchange_cookie");
        sb.append(ContainerUtils.FIELD_DELIMITER);
        sb.append("client_ip=");
        sb.append(Formatter.formatIpAddress(((WifiManager) BaseApplication.getApplication().getApplicationContext().getSystemService(NetworkUtil.NETWORK_TYPE_WIFI)).getConnectionInfo().getIpAddress()));
        sb.append(ContainerUtils.FIELD_DELIMITER);
        sb.append("url=");
        String stringExtra = getIntent().getStringExtra("intent.extra.webview.url.dir");
        if (!TextUtils.isEmpty(stringExtra)) {
            sb.append(stringExtra);
        } else {
            sb.append("/");
            sb.append(str2);
        }
        return sb.toString();
    }

    @Keep
    @Subscribe(tags = {@Tag("tag.game.hub.subscribe.result")})
    public void onSubscribeResult(Bundle bundle) {
        boolean z = bundle.getBoolean("intent.extra.gamehub.subscribe");
        boolean z2 = bundle.getBoolean("intent.extra.gamehub.subscribe.success");
        String str = z ? "subscribe" : "unsubscribe";
        String str2 = z2 ? "success" : Bugly.SDK_IS_DEV;
        this.aMq.invoke(str + "_" + str2);
    }

    private void sX() {
        if (this.aMw != null) {
            this.aMw.setVisible(!(!TextUtils.isEmpty(this.aMu) && this.aMu.equals(UserCenterManager.getPtUid())));
        }
    }

    public void onJsFinished() {
        this.mWebView.loadUrl(getString(R.string.js_prefix, new Object[]{"reportBtnClick()"}));
    }

    public void reportPostInfo(String str, String str2, String str3, String str4, String str5) {
        this.aMu = str2;
        this.aMv = str3;
        this.mPostTitle = str4;
        sX();
    }

    public void switchOrder(String str) {
        if (!NetworkStatusManager.checkIsAvalible()) {
            ToastUtils.showToast(PluginApplication.getApplication(), R.string.str_check_your_network);
            return;
        }
        a aVar = this.aMs;
        if (aVar != null) {
            aVar.switchOrder(this.mPostId, str);
        }
        HashMap hashMap = new HashMap();
        if (YoungModelManagerProxy.KEY_DESC.equalsIgnoreCase(str)) {
            hashMap.put("name", "倒序查看");
        } else if ("asc".equalsIgnoreCase(str)) {
            hashMap.put("name", "正序查看");
        } else if (com.m4399.gamecenter.plugin.main.providers.ac.b.SORT_BY_HOT.equalsIgnoreCase(str)) {
            hashMap.put("name", "热门查看");
        }
        hashMap.put(com.m4399.gamecenter.plugin.main.database.tables.m.COLUMN_MSG_QUAN_ID, String.valueOf(this.mGameHubId));
        UMengEventUtils.onEvent("ad_circle_topic_more_click", hashMap);
        UMengEventUtils.onEvent("ad_circle_topic_details_inverted_order");
    }

    public void cm(String str) {
        com.m4399.gamecenter.plugin.main.providers.gamehub.m mVar = this.mVideoPlayCountProvider;
        if (mVar != null) {
            mVar.setVideoUrl(str);
            this.mVideoPlayCountProvider.setThreadId(this.mPostId);
            this.mVideoPlayCountProvider.setForumsId(this.mForumsId);
            this.mVideoPlayCountProvider.setIsAddBrowse(false);
            this.mVideoPlayCountProvider.loadData(new ILoadPageEventListener() {
                @Override
                public void onBefore() {
                }

                @Override
                public void onFailure(Throwable th, int i, String str2, int i2, JSONObject jSONObject) {
                }

                @Override
                public void onSuccess() {
                }
            });
        }
    }

    public void doPraise() {
        this.mWebView.loadUrl("javascript:window.TopicApp.praise()");
    }

    @Override
    public void finish() {
        GameHubPostJsInterface gameHubPostJsInterface = this.aMq;
        if (gameHubPostJsInterface != null) {
            gameHubPostJsInterface.onActivityFinish();
        }
        GameHubForumPostFragment gameHubForumPostFragment = this.aMr;
        if (gameHubForumPostFragment != null) {
            gameHubForumPostFragment.saveCommentToCache();
            if (this.aMr.getWebViewLayout() != null) {
                this.aMr.getWebViewLayout().onDestroy();
            }
        }
        super.finish();
        PostTrackHelper.INSTANCE.clear();
    }

    @Override
    protected void onActivityResult(int i, int i2, Intent intent) {
        super.onActivityResult(i, i2, intent);
        if (i2 == -1 && i == 89) {
            if (intent == null) {
                finish();
            } else {
                invoke(intent.getStringExtra("callback"), "");
            }
        }
    }

    private void invoke(String str, Object obj) {
        if (TextUtils.isEmpty(str) || this.mWebView == null) {
            return;
        }
        this.mWebView.loadUrl(BaseWebViewLayout.JAVASCRIPT_PREFIX + str + "(" + obj + ")");
    }
}