九游游戏中心HD v4.6.8.1版本的 MD5 值为:78c397802cc5ffdcc7f5502ede90502e

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


package cn.ninegame.library.uilib.adapter.webFragment;

import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CompoundButton;
import android.widget.RelativeLayout;
import cn.ninegame.b.a.a;
import cn.ninegame.gamemanagerhd.R;
import cn.ninegame.genericframework.basic.IResultListener;
import cn.ninegame.hybird.BaseTabFragment;
import cn.ninegame.library.dynamicconfig.DynamicConfig;
import cn.ninegame.library.stat.StatInfo;
import cn.ninegame.library.uilib.adapter.title.a.w;
import cn.ninegame.library.uilib.adapter.toolbar.SubToolBar;
import cn.ninegame.library.util.bp;
import cn.ninegame.library.util.cc;
import cn.ninegame.share.core.ShareParameter;
import com.UCMobile.Apollo.MediaPlayer;
import com.uc.webview.export.DownloadListener;
import com.xiaomi.mipush.sdk.MiPushClient;
import java.util.HashMap;
import org.json.JSONException;
import org.json.JSONObject;
public class ForumWebPageFragment extends SingleWebPageFragment implements View.OnClickListener, CompoundButton.OnCheckedChangeListener, cn.ninegame.library.uilib.adapter.title.a.m, cn.ninegame.library.uilib.adapter.title.a.p, cn.ninegame.library.uilib.adapter.title.a.r {
    private cn.ninegame.gamemanager.game.a.d f2531a;
    private int b = 0;
    private boolean c = false;
    private boolean d = false;

    public static boolean f(ForumWebPageFragment forumWebPageFragment) {
        forumWebPageFragment.d = true;
        return true;
    }

    @Override
    public final void l_() {
        super.l_();
        a("base_biz_toggle_setting_webview_no_image_mode", this);
    }

    @Override
    public final void i() {
        super.i();
        b("base_biz_toggle_setting_webview_no_image_mode", this);
    }

    @Override
    public void onNotify(cn.ninegame.genericframework.basic.r rVar) {
        super.onNotify(rVar);
        if ("base_biz_toggle_setting_webview_no_image_mode".equals(rVar.f1701a) && rVar.b != null) {
            this.G.getSettings().setLoadsImagesAutomatically(!rVar.b.getBoolean("no_image_mode"));
        }
    }

    @Override
    public void onDestroy() {
        try {
            if (this.G != null) {
                this.G.clearCache(true);
                this.G.destroy();
            }
            cn.ninegame.framework.router.d.a().b();
        } catch (Exception e) {
            cn.ninegame.library.stat.b.b.a(e);
        }
        super.onDestroy();
    }

    @Override
    public final boolean e_() {
        boolean e_ = super.e_();
        if (e_) {
            this.g.b();
        }
        if (!e_) {
            cn.ninegame.library.stat.a.j.b().a("btn_quit`llq``");
        } else {
            cn.ninegame.library.stat.a.j.b().a("btn_backward", "llq", null, null);
        }
        return e_;
    }

    @Override
    public void onCheckedChanged(CompoundButton compoundButton, boolean z) {
        cn.ninegame.library.stat.b.b.a("H5Page#ForumPage " + compoundButton.isEnabled() + MiPushClient.ACCEPT_TIME_SEPARATOR + compoundButton.isPressed(), new Object[0]);
        if (compoundButton.isEnabled() && compoundButton.isPressed() && this.G != null) {
            if (z) {
                String str = this.G.b;
                String title = this.G.getTitle() != null ? this.G.getTitle() : str;
                cn.ninegame.library.stat.b.b.a("H5Page#ForumPage " + str + MiPushClient.ACCEPT_TIME_SEPARATOR + title, new Object[0]);
                if (str != null && title != null) {
                    int a2 = this.f2531a.a(title, str);
                    cn.ninegame.library.stat.b.b.a("H5Page#ForumPage onCheckedChanged isChecked bookmarkId: " + a2, new Object[0]);
                    if (a2 > 0) {
                        cc.i("收藏成功!");
                    }
                }
            } else {
                String str2 = this.G.b;
                if (str2 != null) {
                    Integer valueOf = Integer.valueOf(this.f2531a.a(str2));
                    cn.ninegame.library.stat.b.b.a("H5Page#ForumPage onCheckedChanged is not Checked bookmarkId: " + valueOf, new Object[0]);
                    if (valueOf.intValue() > 0) {
                        cc.i("取消成功!");
                    }
                }
            }
            cn.ninegame.library.stat.a.j.b().a("btn_collet`lt``");
        }
    }

    @Override
    public void onResume() {
        super.onResume();
        if (this.d) {
            w();
        }
    }

    class a implements DownloadListener {
        a() {
        }

        @Override
        public final void onDownloadStart(String str, String str2, String str3, String str4, long j) {
            if (ForumWebPageFragment.this.isAdded()) {
                Intent intent = new Intent("android.intent.action.VIEW", Uri.parse(str));
                intent.addFlags(MediaPlayer.MEDIA_ERROR_UNKNOWN);
                try {
                    ForumWebPageFragment.this.o.startActivity(intent);
                } catch (ActivityNotFoundException e) {
                    cc.i("无下载器可下载文件");
                }
            }
        }
    }

    @Override
    public final void a(cn.ninegame.library.uilib.adapter.title.d dVar) {
        this.G.reload();
    }

    @Override
    public final void f_() {
        if (isAdded()) {
            ShareParameter shareParameter = this.q;
            if (shareParameter == null) {
                String valueOf = String.valueOf(this.g.b.getText());
                if (!TextUtils.isEmpty(valueOf)) {
                    shareParameter = new ShareParameter();
                    shareParameter.put("title", valueOf);
                    shareParameter.put("content", getString(R.string.see_details));
                    shareParameter.put(cn.ninegame.share.core.g.SHARE_INFO_SHARE_URL, this.G.getUrl());
                    StatInfo statInfo = new StatInfo();
                    statInfo.action = "btn_share";
                    statInfo.a1 = "llqms_all";
                    shareParameter.setStatInfo(statInfo);
                } else {
                    return;
                }
            }
            shareParameter.setStatAction(cn.ninegame.share.core.g.SHARE_STAT_IM, "btn_myfrishare`tzxq_fxtc``");
            cn.ninegame.share.core.o.a(getActivity(), shareParameter);
            cn.ninegame.library.stat.n.b(shareParameter.getStatInfo());
        }
    }

    @Override
    public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
        String str;
        cn.ninegame.b.a.a unused;
        if (this.k == null) {
            this.k = layoutInflater.inflate(R.layout.main_forum_page, (ViewGroup) null);
            this.f2531a = (cn.ninegame.gamemanager.game.a.d) cn.ninegame.library.storage.db.e.a(cn.ninegame.gamemanager.game.a.d.class);
            this.c = c_().getBoolean("bool", false);
            this.G = new cn.ninegame.library.b.a(getActivity());
            a(this.G);
            this.G.requestFocusFromTouch();
            this.G.j = new BaseTabFragment.a();
            this.G.setWebViewClient(new f(this));
            this.G.setDownloadListener(new a());
            Bundle c_ = c_();
            if (c_.containsKey("header_action")) {
                this.b = c_.getInt("header_action");
            }
            this.l = new w();
            StatInfo statInfo = new StatInfo();
            statInfo.a1 = "llqms_all";
            this.l.t = statInfo;
            this.l.g = this;
            this.l.f = this;
            this.g = (SubToolBar) d(R.id.header_bar);
            this.g.c = new e(this);
            switch (this.b) {
                case 1:
                    this.g.d(true);
                    this.g.a(this.o.getString(R.string.im_create_group));
                    this.g.g(false);
                    break;
                default:
                    this.g.c(true);
                    break;
            }
            RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(-1, -1);
            layoutParams.addRule(3, R.id.llTopNav);
            ((ViewGroup) this.k).addView(this.G, layoutParams);
            String string = c_().getString("url");
            if (string != null) {
                JSONObject jSONObject = new JSONObject();
                try {
                    jSONObject.put("messageCount", cn.ninegame.share.core.o.f());
                } catch (JSONException e) {
                    cn.ninegame.library.stat.b.b.a(e);
                }
                String a2 = cn.ninegame.library.util.l.a(jSONObject, string, true, false);
                JSONObject a3 = cn.ninegame.library.util.l.a(a2, true);
                JSONObject e2 = cc.e(a3, "shareInfo");
                if (e2 != null && !TextUtils.isEmpty(e2.toString())) {
                    JSONObject e3 = cc.e(a3, "statInfo");
                    String b = cc.b(e2, "title");
                    String b2 = cc.b(e2, "content");
                    String b3 = cc.b(e2, cn.ninegame.share.core.g.SHARE_INFO_SHARE_URL);
                    String b4 = cc.b(e2, cn.ninegame.share.core.g.SHARE_INFO_IMG_URL);
                    String b5 = cc.b(e2, "iconUrl");
                    String b6 = cc.b(e2, cn.ninegame.share.core.g.SHARE_INFO_AD_WORD);
                    String b7 = cc.b(e2, cn.ninegame.share.core.g.SHARE_INFO_AD_URL);
                    String b8 = cc.b(e2, cn.ninegame.share.core.g.SHARE_INFO_PLATFORM);
                    String b9 = cc.b(e2, "from");
                    if (b != null) {
                        str = b;
                    } else if (this.G.getTitle() == null) {
                        str = "九游试玩中心,免下载安装,直接体验游戏大作,和好友比技能秀节操,不服来战!";
                    } else {
                        str = this.G.getTitle();
                    }
                    String str2 = b6 == null ? "手机游戏,尽在九游" : b6;
                    String str3 = b7 == null ? "http://app.9game.cn?ch=KD_3" : b7;
                    if (b8 == null) {
                        b8 = "";
                    }
                    this.q = new ShareParameter();
                    this.q.put("title", str);
                    this.q.put("content", b2);
                    this.q.put(cn.ninegame.share.core.g.SHARE_INFO_SHARE_URL, b3);
                    String url = this.G.getUrl();
                    if (TextUtils.isEmpty(url)) {
                        cn.ninegame.library.stat.b.b.c("Argument 'url' is null or empty", new Object[0]);
                        url = "";
                    } else if (TextUtils.isEmpty(cn.ninegame.framework.a.b.KEY_PAGE_TYPE)) {
                        cn.ninegame.library.stat.b.b.c("Argument 'key' is null or empty", new Object[0]);
                        url = "";
                    } else if (TextUtils.isEmpty(cn.ninegame.framework.a.b.PAGE_TYPE_BROWSER)) {
                        cn.ninegame.library.stat.b.b.c("Argument 'value' is null or empty", new Object[0]);
                        url = "";
                    } else {
                        Uri parse = Uri.parse(url);
                        if (parse == null) {
                            cn.ninegame.library.stat.b.b.c("Invalid url format: %s", url);
                            url = "";
                        } else if (parse.getQueryParameter(cn.ninegame.framework.a.b.KEY_PAGE_TYPE) == null) {
                            url = parse.buildUpon().appendQueryParameter(cn.ninegame.framework.a.b.KEY_PAGE_TYPE, cn.ninegame.framework.a.b.PAGE_TYPE_BROWSER).build().toString();
                        }
                    }
                    unused = a.C0021a.f309a;
                    cn.ninegame.library.util.l.b(url, cn.ninegame.b.a.a.a());
                    this.q.put(cn.ninegame.share.core.g.SHARE_INFO_INNER_URL, b3);
                    this.q.put(cn.ninegame.share.core.g.SHARE_INFO_IMG_URL, b4);
                    this.q.put("iconUrl", b5);
                    this.q.put(cn.ninegame.share.core.g.SHARE_INFO_AD_WORD, str2);
                    this.q.put(cn.ninegame.share.core.g.SHARE_INFO_AD_URL, str3);
                    this.q.put(cn.ninegame.share.core.g.SHARE_INFO_PLATFORM, b8);
                    this.q.put("from", b9);
                    if (e3 != null) {
                        StatInfo statInfo2 = new StatInfo();
                        statInfo2.action = e3.optString("action");
                        statInfo2.a1 = e3.optString("a1");
                        statInfo2.a2 = e3.optString("a2");
                        statInfo2.a3 = e3.optString("a3");
                        if (statInfo2.action == null) {
                            statInfo2.action = "";
                        }
                        if (statInfo2.a1 == null) {
                            statInfo2.a1 = "";
                        }
                        if (statInfo2.a2 == null) {
                            statInfo2.a2 = "";
                        }
                        if (statInfo2.a3 == null) {
                            statInfo2.a3 = "";
                        }
                        this.q.setStatInfo(statInfo2);
                    }
                }
                if ("pagetype_not_found".equals(c_().getString("url_jump_state"))) {
                    String str4 = new String(a2);
                    cn.ninegame.framework.router.d a4 = cn.ninegame.framework.router.d.a();
                    a4.c = new g(this, str4);
                    if (a4.f444a != null) {
                        a4.f444a.postDelayed(new cn.ninegame.framework.router.e(a4), DynamicConfig.DELAY_TIME);
                    }
                } else {
                    j(a2);
                }
            }
            cn.ninegame.library.stat.a.j.b().a(cn.ninegame.framework.a.b.PAGE_TYPE_BROWSER, null, null, null);
        }
        return super.onCreateView(layoutInflater, viewGroup, bundle);
    }

    public final void j(String str) {
        String str2;
        boolean z;
        JSONObject jSONObject;
        if (this.G == null) {
            str2 = "";
        } else {
            str2 = this.G.b;
        }
        if (TextUtils.isEmpty(str2)) {
            String string = c_().getString("bundle_web_header");
            try {
                jSONObject = TextUtils.isEmpty(string) ? null : new JSONObject(string);
            } catch (JSONException e) {
                jSONObject = null;
            }
            str2 = jSONObject != null ? jSONObject.optString("Referer") : "";
        }
        if (!TextUtils.isEmpty(str2)) {
            if (str.startsWith(cn.ninegame.hybird.link.a.e.HTTP.n)) {
                z = false;
            } else {
                z = !str.startsWith(cn.ninegame.hybird.link.a.e.HTTPS.n);
            }
            if (!z) {
                HashMap hashMap = new HashMap();
                hashMap.put("Referer", str2);
                this.G.loadUrl(str, hashMap);
                return;
            }
        }
        this.G.loadUrl(str);
    }

    @Override
    public final void C_() {
        cn.ninegame.library.util.l.e(this.G.getUrl());
        cn.ninegame.library.stat.a.j.b().a("btn_browser", "llq", null, null);
    }

    public static void c(ForumWebPageFragment forumWebPageFragment) {
        switch (forumWebPageFragment.b) {
            case 1:
                final Uri parse = Uri.parse(forumWebPageFragment.c_().getString("url"));
                cn.ninegame.genericframework.basic.g.a().b().a("im_invoke_on_login", Bundle.EMPTY, new IResultListener() {
                    @Override
                    public void onResult(Bundle bundle) {
                        if (bundle.getBoolean("result", false)) {
                            int d = bp.d(parse.getQueryParameter("gameId"));
                            String queryParameter = parse.getQueryParameter("gameName");
                            Bundle bundle2 = new Bundle();
                            bundle2.putBoolean("is_pull_up", false);
                            if (d > 0) {
                                bundle2.putInt("game_id", d);
                            }
                            if (queryParameter != null) {
                                bundle2.putString("game_name", queryParameter);
                            }
                            cn.ninegame.genericframework.basic.g.a().b().a("im_chat_enter_create_group", bundle2);
                        }
                    }
                });
                return;
            default:
                return;
        }
    }
}