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

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


package cn.ninegame.b.h;

import android.annotation.TargetApi;
import android.content.Context;
import android.graphics.Bitmap;
import android.net.Uri;
import android.net.http.SslError;
import android.os.Build;
import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
import android.os.Message;
import android.text.TextUtils;
import android.util.Log;
import android.view.InputEvent;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.InputMethodManager;
import android.webkit.ConsoleMessage;
import android.webkit.ValueCallback;
import cn.ninegame.b.a;
import cn.ninegame.b.a.a;
import cn.ninegame.library.c.a.c;
import cn.ninegame.library.network.net.model.Body;
import cn.ninegame.library.util.ae;
import cn.ninegame.library.util.bv;
import cn.ninegame.library.util.bz;
import cn.uc.downloadlib.logic.DownloadCfgFile;
import com.UCMobile.Apollo.Global;
import com.ta.utdid2.android.utils.NetworkUtils;
import com.uc.webview.export.GeolocationPermissions;
import com.uc.webview.export.HttpAuthHandler;
import com.uc.webview.export.JsPromptResult;
import com.uc.webview.export.JsResult;
import com.uc.webview.export.SslErrorHandler;
import com.uc.webview.export.WebChromeClient;
import com.uc.webview.export.WebResourceRequest;
import com.uc.webview.export.WebResourceResponse;
import com.uc.webview.export.WebSettings;
import com.uc.webview.export.WebView;
import com.uc.webview.export.WebViewClient;
import com.uc.webview.export.extension.UCClient;
import com.uc.webview.export.extension.UCExtension;
import com.uc.webview.export.extension.UCSettings;
import java.lang.ref.WeakReference;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import org.json.JSONObject;
public class a extends WebView {
    private WeakReference<View> A;
    private WebViewClient B;
    private WebChromeClient C;
    private boolean D;
    private int F;
    private String f346a;
    private String b;
    public boolean c;
    public boolean d;
    public HashMap<String, Object> e;
    public String f;
    public boolean g;
    public int h;
    public String i;
    public cn.ninegame.b.b.c j;
    protected boolean k;
    protected float l;
    public boolean m;
    private Handler n;
    private boolean o;
    private int p;
    private m q;
    private d r;
    private int s;
    private cn.ninegame.b.a.f t;
    private volatile int u;
    private StringBuffer v;
    private boolean w;
    private cn.ninegame.b.b.e y;
    private String z;
    private static long x = 0;
    private static boolean E = false;

    public interface InterfaceC0022a {
        void a();
    }

    public interface b {
        boolean a();
    }

    static boolean B(a aVar) {
        aVar.o = true;
        return true;
    }

    static int a(a aVar) {
        int i = aVar.u + 1;
        aVar.u = i;
        return i;
    }

    static int c(a aVar) {
        int i = aVar.u - 1;
        aVar.u = i;
        return i;
    }

    public static Handler e(a aVar) {
        aVar.n = null;
        return null;
    }

    public static int f(a aVar) {
        aVar.s = 0;
        return 0;
    }

    public static int g(a aVar) {
        int i = aVar.s;
        aVar.s = i + 1;
        return i;
    }

    static boolean m(a aVar) {
        aVar.w = true;
        return true;
    }

    public static boolean t(a aVar) {
        aVar.D = false;
        return false;
    }

    public a(Context context) {
        super(context);
        this.c = false;
        this.e = new HashMap<>();
        this.f346a = "javascript:if(window.JSBridge && JSBridge.onEvent) JSBridge.onEvent('";
        this.s = 0;
        this.u = 0;
        this.v = new StringBuffer();
        this.w = false;
        this.g = false;
        this.F = 300;
        this.m = false;
        this.y = cn.ninegame.b.b.e.q();
        this.t = new cn.ninegame.b.a.f(this.y.k());
        setId(getContext().getResources().getIdentifier("special_container", "id", getContext().getPackageName()));
        setBackgroundColor(getContext().getResources().getColor(a.C0020a.browser_bg));
        setHorizontalScrollBarEnabled(false);
        setVerticalScrollBarEnabled(false);
        setVerticalScrollbarOverlay(true);
        setScrollbarFadingEnabled(true);
        setScrollBarStyle(33554432);
        setSoundEffectsEnabled(false);
        setLongClickable(false);
        if (Build.VERSION.SDK_INT >= 11 && !a()) {
            try {
                setLayerType(1, null);
            } catch (Throwable th) {
            }
        }
        WebSettings settings = getSettings();
        settings.setUserAgentString(this.y.e());
        settings.setLoadWithOverviewMode(true);
        settings.setUseWideViewPort(false);
        settings.setBuiltInZoomControls(false);
        settings.setSupportZoom(false);
        settings.setRenderPriority(WebSettings.RenderPriority.HIGH);
        settings.setAppCachePath(getContext().getFilesDir() + "/webcache");
        settings.setAppCacheEnabled(true);
        settings.setLoadsImagesAutomatically(true);
        settings.setLightTouchEnabled(false);
        settings.setDomStorageEnabled(true);
        settings.setDatabaseEnabled(true);
        settings.setDatabasePath(getContext().getFilesDir() + "/localstorage");
        if (Build.VERSION.SDK_INT >= 16) {
            settings.setAllowUniversalAccessFromFileURLs(true);
        }
        settings.setSavePassword(false);
        UCExtension uCExtension = getUCExtension();
        if (uCExtension != null) {
            uCExtension.setClient(new e());
            boolean d2 = this.y.d();
            UCSettings.setEnableAdblock(d2);
            UCSettings.setGlobalEnableUCProxy(d2);
            UCSettings.setEnableDispatcher(d2);
            this.m = d2;
            uCExtension.getUCSettings().setEnableFastScroller(false);
        }
        WebSettings settings2 = getSettings();
        if (a()) {
            addJavascriptInterface(new c(), "JSBridge");
        }
        if (Build.VERSION.SDK_INT >= 11) {
            removeJavascriptInterface("searchBoxJavaBridge_");
            removeJavascriptInterface("accessibility");
            removeJavascriptInterface("accessibilityTraversal");
        }
        if (!settings2.getJavaScriptEnabled()) {
            try {
                settings2.setJavaScriptEnabled(true);
            } catch (Exception e2) {
            }
        }
        this.r = new d();
        d dVar = this.r;
        if (dVar.b != null) {
            c.HandlerC0055c.c(dVar.b);
        }
        d dVar2 = this.r;
        String str = ae.k;
        ae.b();
        if (dVar2.b != null) {
            dVar2.b.f1856a = false;
        }
        super.setWebViewClient(new g());
        super.setWebChromeClient(new f());
        getSettings().setMediaPlaybackRequiresUserGesture(false);
    }

    class c {
        c() {
        }
    }

    @Override
    public void setWebChromeClient(WebChromeClient webChromeClient) {
        this.C = webChromeClient;
    }

    @Override
    public void setWebViewClient(WebViewClient webViewClient) {
        this.B = webViewClient;
    }

    @Override
    public synchronized void coreDestroy() {
        if (!this.c) {
            String str = ae.w;
            ae.b();
            if (cn.ninegame.b.c.a.a()) {
                cn.ninegame.b.c.a.a("cycle", h() + " 真正Core Destroy");
            }
            this.r.a();
            ViewGroup viewGroup = (ViewGroup) getParent();
            if (viewGroup != null) {
                viewGroup.removeView(this);
            }
            this.C = null;
            this.B = null;
            this.j = null;
            try {
                try {
                    removeJavascriptInterface("JSBridge");
                } catch (Exception e2) {
                }
            } catch (AbstractMethodError e3) {
            }
            destroyDrawingCache();
            super.coreDestroy();
            String str2 = ae.k;
            ae.b();
            this.c = true;
        }
    }

    private static boolean a() {
        try {
            cn.ninegame.b.f.j.e();
            switch (cn.ninegame.b.f.i.c()) {
                case 1:
                    return true;
                case 2:
                default:
                    return false;
                case 3:
                    return true;
            }
        } catch (Throwable th) {
            return false;
        }
    }

    @Override
    public void loadUrl(String str) {
        loadUrl(str, null);
    }

    @Override
    public void loadUrl(String str, Map<String, String> map) {
        a("get", str, map);
    }

    @Override
    public void postUrl(String str, byte[] bArr) {
        a("post", str, bArr);
    }

    private void a(String str, String str2, Object obj) {
        if (!this.c && str2 != null) {
            boolean startsWith = str2.startsWith("file");
            if (startsWith && !a.C0021a.a().f308a) {
                if (cn.ninegame.b.c.a.a()) {
                    cn.ninegame.b.c.a.a("action", "等待解压html包");
                }
                cn.ninegame.b.h.b bVar = new cn.ninegame.b.h.b(this);
                cn.ninegame.b.h.c cVar = new cn.ninegame.b.h.c(this, str, startsWith, str2, obj);
                if (this.n == null) {
                    this.n = new cn.ninegame.b.h.d(this, Looper.getMainLooper(), bVar, cVar);
                }
                this.n.sendEmptyMessageDelayed(1, 1000L);
            } else {
                a(str, startsWith, str2, obj);
            }
            a(12, (Object) null);
        }
    }

    public void a(String str, boolean z, String str2, Object obj) {
        if (z) {
            this.g = cn.ninegame.b.g.c.a(str2);
            String a2 = cn.ninegame.b.a.g.a().a(str2);
            if (cn.ninegame.b.c.a.a() && !a2.equals(str2)) {
                cn.ninegame.b.c.a.a("action", str2 + " --> " + a2);
            }
            str2 = a2;
        }
        if (str2.indexOf("://") < 0) {
            str2 = "http://" + str2;
        }
        this.f = str2;
        if (!this.g) {
            this.g = cn.ninegame.b.g.c.a(str2);
        }
        com.wa.base.wa.c.a("ctu3", "u3_t1_l");
        boolean z2 = this.mWebView.getUCExtension() != null;
        if (z2) {
            String str3 = ae.k;
            ae.b();
        }
        boolean z3 = this.g;
        int i = z2 ? 1 : 2;
        try {
            cn.ninegame.library.stat.e.j a3 = cn.ninegame.library.stat.e.j.a("op_u3wv");
            a3.a("ng_lr", z3 ? "1" : "0");
            a3.a("core_type", String.valueOf(i));
            cn.ninegame.library.stat.e.h.a("ctu3", a3);
        } catch (Exception e2) {
        }
        cn.ninegame.b.e.a a4 = cn.ninegame.b.e.a.a();
        Log.i("H5TimeInfo", String.format("traceOnLoadUrl: %s:::%s", str2, a4.p));
        if (a4.p != null) {
            a4.b = false;
            a4.f323a = false;
        }
        a4.p = str2;
        a4.e = System.currentTimeMillis();
        a4.q = true;
        cn.ninegame.b.e.a.a().o = this.m;
        try {
            if (cn.ninegame.b.c.a.a()) {
                cn.ninegame.b.c.a.a("action", h() + " " + (System.currentTimeMillis() - x) + "加载url " + str2 + ",使用method = " + str);
            }
            if (Build.VERSION.SDK_INT <= 10 && str2 != null) {
                String a5 = cn.ninegame.b.g.b.a(str2);
                String f2 = this.y.f();
                if (TextUtils.isEmpty(f2)) {
                    cn.ninegame.b.g.a.a(a5, "sdksid", "0");
                } else {
                    cn.ninegame.b.g.a.a(a5, "sdksid", f2);
                }
                cn.ninegame.b.g.a.a(a5, "sidType", Global.APOLLO_SERIES);
                String g2 = this.y.g();
                if (TextUtils.isEmpty(g2)) {
                    cn.ninegame.b.g.a.a(a5, "serviceTicket", "0");
                } else {
                    cn.ninegame.b.g.a.a(a5, "serviceTicket", g2);
                }
                cn.ninegame.b.g.a.a(a5, "ucid", String.valueOf(this.y.i()));
                cn.ninegame.b.g.a.a(a5, Body.CONST_CLIENT_UUID, bz.a());
                String h = this.y.h();
                if (TextUtils.isEmpty(h)) {
                    h = "0";
                }
                cn.ninegame.b.g.a.a(a5, "ast", h);
            }
            if ("post".equals(str)) {
                if (obj instanceof byte[]) {
                    super.postUrl(str2, (byte[]) obj);
                }
            } else if ("get".equals(str) && a(str2)) {
                if (obj == null) {
                    super.loadUrl(str2);
                } else if (obj instanceof HashMap) {
                    HashMap hashMap = new HashMap();
                    hashMap.putAll((HashMap) obj);
                    super.loadUrl(str2, hashMap);
                }
            }
        } catch (Throwable th) {
        }
    }

    public final void b(String str) {
        HashMap hashMap = new HashMap();
        hashMap.put("Referer", this.f);
        loadUrl(str, hashMap);
    }

    @Override
    public void coreOnScrollChanged(int i, int i2, int i3, int i4) {
        try {
            super.coreOnScrollChanged(i, i2, i3, i4);
            float contentHeight = getContentHeight() * getScale();
            if (this.l != contentHeight && contentHeight <= getCoreView().getScrollY() + getHeight() + this.F) {
                if (this.k) {
                    this.k = false;
                } else {
                    cn.ninegame.b.a.f.a(this, "page_scroll_bottom", null);
                    this.l = contentHeight;
                }
            }
            if (this.j != null) {
                this.j.a(i2, i4);
            }
        } catch (Exception e2) {
        }
    }

    @Override
    public void reload() {
        if (cn.ninegame.b.c.a.a()) {
            cn.ninegame.b.c.a.a("action", h() + " reload:" + getUrl());
        }
        if (!this.r.b()) {
            a(12, (Object) null);
            super.reload();
        }
    }

    public final void a(int i) {
        this.l = 0.0f;
        if (i <= 0) {
            i = 300;
        }
        this.F = i;
    }

    public final Object c(String str) {
        if (this.e.containsKey(str)) {
            return this.e.get(str);
        }
        return null;
    }

    public final String u_() {
        return this.b;
    }

    public class d extends cn.ninegame.library.c.a.c {
        cn.ninegame.library.c.a.b d;
        cn.ninegame.library.c.a.b e;
        cn.ninegame.library.c.a.b f;
        cn.ninegame.library.c.a.b g;
        cn.ninegame.library.c.a.b h;

        class C0023a extends cn.ninegame.library.c.a.b {
            public C0023a() {
            }

            @Override
            public void a() {
                if (cn.ninegame.b.c.a.a()) {
                    cn.ninegame.b.c.a.a("cycle", a.this.h() + " 进入" + b());
                }
                a.i(a.this);
                if (a.this.j != null) {
                    a.this.j.c(a.this.getUrl());
                }
                long unused = a.x = System.currentTimeMillis();
                d.this.a();
                d dVar = d.this;
                if (dVar.b != null) {
                    dVar.b.sendMessageDelayed(dVar.b == null ? null : Message.obtain(dVar.b, 20), 30000L);
                }
                a.this.postDelayed(new l(this), 6000L);
            }

            @Override
            public final boolean a(Message message) {
                boolean z = false;
                switch (message.what) {
                    case 13:
                    case 15:
                    case 24:
                        a.m(a.this);
                        if (!a.this.g) {
                            z = true;
                            break;
                        }
                        break;
                    case 14:
                    case 17:
                    case 21:
                    case 22:
                    case 23:
                    default:
                        return false;
                    case 16:
                    case 18:
                        z = true;
                        break;
                    case 19:
                    case 20:
                        if (message.what == 20) {
                            cn.ninegame.b.e.c.a(new cn.ninegame.b.d.a("1", a.this.c(), a.this.f, a.this.g, NetworkUtils.isConnectInternet(a.this.getContext())));
                        } else {
                            Object obj = message.obj;
                            bv.c();
                            cn.ninegame.b.e.c.a((cn.ninegame.b.d.a) message.obj);
                        }
                        d.this.a();
                        d.this.a((cn.ninegame.library.c.a.a) d.this.h);
                        break;
                }
                if (z) {
                    d.this.a();
                    d.this.a((cn.ninegame.library.c.a.a) d.this.g);
                }
                return true;
            }
        }

        protected d() {
            super("web_view_ex_load_machine", Looper.getMainLooper());
            this.d = new cn.ninegame.b.h.g(this);
            this.e = new h(this);
            this.f = new i(this);
            this.g = new j(this);
            this.h = new k(this);
            a(this.d);
            a(this.e);
            a(this.f);
            a(this.g);
            a(this.h);
            c.HandlerC0055c.b(this.b, this.d);
        }

        protected final boolean b() {
            cn.ninegame.library.c.a.a aVar;
            cn.ninegame.library.c.a.a aVar2;
            aVar = r0.f[this.b.g].f1859a;
            if (aVar != this.f) {
                aVar2 = r0.f[this.b.g].f1859a;
                if (aVar2 != this.e) {
                    return false;
                }
            }
            return true;
        }

        public final boolean c() {
            cn.ninegame.library.c.a.a aVar;
            aVar = r0.f[this.b.g].f1859a;
            return aVar == this.g;
        }
    }

    public final boolean b() {
        return this.r.b();
    }

    public final boolean g() {
        return this.r.c();
    }

    @Deprecated
    public final void a(int i, Object obj) {
        d dVar = this.r;
        if (dVar.b == null) {
            return;
        }
        dVar.b.sendMessage(dVar.b == null ? null : Message.obtain(dVar.b, i, obj));
    }

    @Override
    public void onDetachedFromWindow() {
        if (cn.ninegame.b.c.a.a()) {
            cn.ninegame.b.c.a.b("cycle", h() + " onDetachedFromWindow");
        }
        super.onDetachedFromWindow();
        if (this.r.b() && System.currentTimeMillis() - x > 6000) {
            cn.ninegame.b.e.c.a(new cn.ninegame.b.d.a("3", ((System.currentTimeMillis() - x) / 1000) + ":" + c(), this.f, this.g, NetworkUtils.isConnectInternet(getContext())));
        }
    }

    @Override
    public void onAttachedToWindow() {
        super.onAttachedToWindow();
        if (cn.ninegame.b.c.a.a()) {
            cn.ninegame.b.c.a.b("cycle", h() + " onAttachWindow");
        }
    }

    @Override
    public void coreOnVisibilityChanged(View view, int i) {
        super.coreOnVisibilityChanged(view, i);
    }

    @Override
    public void onSizeChanged(int i, int i2, int i3, int i4) {
        super.onSizeChanged(i, i2, i3, i4);
    }

    class g extends WebViewClient {
        g() {
        }

        @Override
        public final void onReceivedSslError(WebView webView, SslErrorHandler sslErrorHandler, SslError sslError) {
            cn.ninegame.library.stat.e.i a2 = cn.ninegame.library.stat.e.i.a("act_u3_ssl_report");
            a2.a(cn.ninegame.share.core.g.ERROR, sslError.toString());
            cn.ninegame.library.stat.e.h.a("ctu3", a2);
            super.onReceivedSslError(webView, sslErrorHandler, sslError);
            if (a.this.B != null) {
                a.this.B.onReceivedSslError(webView, sslErrorHandler, sslError);
            }
        }

        @Override
        public final void onPageStarted(WebView webView, String str, Bitmap bitmap) {
            super.onPageStarted(webView, str, bitmap);
            a.this.a(22, (Object) null);
            if (a.this.B != null) {
                a.this.B.onPageStarted(webView, str, bitmap);
            }
            if (cn.ninegame.b.c.a.a()) {
                cn.ninegame.b.c.a.a("action", a.this.h() + " onPageStarted");
            }
            a.b(a.this, "pst");
        }

        @Override
        public final void onPageFinished(WebView webView, String str) {
            super.onPageFinished(webView, str);
            if (a.this.B != null) {
                a.this.B.onPageFinished(webView, str);
            }
            cn.ninegame.b.e.a.a().l = System.currentTimeMillis();
            if (cn.ninegame.b.c.a.a()) {
                cn.ninegame.b.c.a.a("action", a.this.h() + " onPageFinished");
            }
            a.b(a.this, "pf");
            a.this.a(13, (Object) null);
        }

        @Override
        public final boolean shouldOverrideUrlLoading(WebView webView, String str) {
            if (cn.ninegame.b.c.a.a()) {
                cn.ninegame.b.c.a.a("action", a.this.h() + " shouldOverrideUrlLoading:" + str);
            }
            a.b(a.this, "oul");
            if ((a.this.B == null || !a.this.B.shouldOverrideUrlLoading(webView, str)) && !a.this.y.a(str, new String[]{"ref", a.this.getUrl()})) {
                WebView.HitTestResult hitTestResult = webView.getHitTestResult();
                if (hitTestResult == null || hitTestResult.getType() != 7) {
                    return super.shouldOverrideUrlLoading(webView, str);
                }
                a.this.b(str);
                return true;
            }
            return true;
        }

        @Override
        public final void onReceivedError(WebView webView, int i, String str, String str2) {
            if (a.this.B != null) {
                a.this.B.onReceivedError(webView, i, str, str2);
            }
            a.this.a(new cn.ninegame.b.d.a(Global.APOLLO_SERIES, i + ":" + str, str2, a.this.g, NetworkUtils.isConnectInternet(a.this.getContext())));
        }

        @Override
        public final void onUnhandledKeyEvent(WebView webView, KeyEvent keyEvent) {
            if ((webView instanceof a) && keyEvent.getKeyCode() == 66) {
                cn.ninegame.b.a.f.a((a) webView, "keyboard_enter", null);
                Context context = webView.getContext();
                IBinder windowToken = webView.getWindowToken();
                InputMethodManager inputMethodManager = (InputMethodManager) context.getSystemService("input_method");
                if (inputMethodManager.isActive()) {
                    inputMethodManager.hideSoftInputFromWindow(windowToken, 0);
                }
            }
            if (a.this.B != null && Build.VERSION.SDK_INT >= 9) {
                a.this.B.onUnhandledInputEvent(webView, keyEvent);
            }
            super.onUnhandledKeyEvent(webView, keyEvent);
            if (a.this.B != null) {
                a.this.B.onUnhandledKeyEvent(webView, keyEvent);
            }
        }

        @Override
        @TargetApi(11)
        public final WebResourceResponse shouldInterceptRequest(WebView webView, String str) {
            String str2;
            String str3;
            WebResourceResponse shouldInterceptRequest = a.this.B != null ? a.this.B.shouldInterceptRequest(webView, str) : null;
            if (shouldInterceptRequest != null) {
                return shouldInterceptRequest;
            }
            ae.a();
            if (a.this.y.a(str)) {
                Uri parse = Uri.parse(str);
                String str4 = parse.getHost() + parse.getPath();
                if (TextUtils.isEmpty(str4) || !str4.contains("9game.cn/api/")) {
                    return null;
                }
                String path = parse.getPath();
                String[] split = path.substring(path.indexOf("/api/", 0) + 5).split("/");
                JSONObject a2 = cn.ninegame.b.g.b.a(str, true);
                if (split.length == 2) {
                    str3 = split[0];
                    str2 = split[1];
                } else {
                    str2 = null;
                    str3 = null;
                }
                if ("webresp".equals(str3)) {
                    if ("fromUri".equals(str2)) {
                        return cn.ninegame.b.a.h.a(a2.optString(DownloadCfgFile.COLUMN_URI));
                    }
                    "fromText".equals(str2);
                    return null;
                }
                return null;
            }
            return null;
        }

        @Override
        public final void onLoadResource(WebView webView, String str) {
            super.onLoadResource(webView, str);
            if (cn.ninegame.b.c.a.a()) {
                cn.ninegame.b.c.a.b("action", a.this.h() + " onLoadResource:" + str);
            }
            if (a.this.B != null) {
                a.this.B.onLoadResource(webView, str);
            }
        }

        @Override
        public final void onRestoreSnapshotFileCompleted() {
            super.onRestoreSnapshotFileCompleted();
            if (a.this.B != null) {
                a.this.B.onRestoreSnapshotFileCompleted();
            }
        }

        @Override
        public final WebResourceResponse shouldInterceptRequest(WebView webView, WebResourceRequest webResourceRequest) {
            return a.this.B != null ? a.this.B.shouldInterceptRequest(webView, webResourceRequest) : super.shouldInterceptRequest(webView, webResourceRequest);
        }

        @Override
        public final void doUpdateVisitedHistory(WebView webView, String str, boolean z) {
            super.doUpdateVisitedHistory(webView, str, z);
            if (a.this.B != null) {
                a.this.B.doUpdateVisitedHistory(webView, str, z);
            }
        }

        @Override
        public final void onReceivedHttpAuthRequest(WebView webView, HttpAuthHandler httpAuthHandler, String str, String str2) {
            super.onReceivedHttpAuthRequest(webView, httpAuthHandler, str, str2);
            if (a.this.B != null) {
                a.this.B.onReceivedHttpAuthRequest(webView, httpAuthHandler, str, str2);
            }
        }

        @Override
        public final void onUnhandledInputEvent(WebView webView, InputEvent inputEvent) {
            super.onUnhandledInputEvent(webView, inputEvent);
            if (a.this.B != null) {
                a.this.B.onUnhandledInputEvent(webView, inputEvent);
            }
        }

        @Override
        public final boolean shouldOverrideKeyEvent(WebView webView, KeyEvent keyEvent) {
            return a.this.B != null ? a.this.B.shouldOverrideKeyEvent(webView, keyEvent) : super.shouldOverrideKeyEvent(webView, keyEvent);
        }

        @Override
        public final void onScaleChanged(WebView webView, float f, float f2) {
            super.onScaleChanged(webView, f, f2);
            if (a.this.B != null) {
                a.this.B.onScaleChanged(webView, f, f2);
            }
        }
    }

    class f extends WebChromeClient {
        f() {
        }

        @Override
        public final boolean onConsoleMessage(ConsoleMessage consoleMessage) {
            if (consoleMessage.messageLevel() == ConsoleMessage.MessageLevel.ERROR && cn.ninegame.b.c.a.a()) {
                cn.ninegame.b.c.a.a("action", "js console:" + consoleMessage.sourceId() + ":" + consoleMessage.lineNumber() + ":" + consoleMessage.message());
            }
            if (a.this.C != null) {
                return a.this.C.onConsoleMessage(consoleMessage);
            }
            return true;
        }

        @Override
        public final boolean onJsPrompt(WebView webView, String str, String str2, String str3, JsPromptResult jsPromptResult) {
            a.a(a.this);
            cn.ninegame.b.a.f fVar = a.this.t;
            a aVar = a.this;
            if (fVar.f314a != null) {
                jsPromptResult.confirm(fVar.f314a.a(aVar, str2));
            }
            a.c(a.this);
            return true;
        }

        @Override
        public final boolean onJsAlert(WebView webView, String str, String str2, JsResult jsResult) {
            a.this.y.a(ae.k, str2);
            jsResult.confirm();
            return true;
        }

        @Override
        public final boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> valueCallback, WebChromeClient.FileChooserParams fileChooserParams) {
            if (cn.ninegame.b.c.a.a()) {
                cn.ninegame.b.c.a.b("action", a.this.h() + " onShowFileChooser");
            }
            if (a.this.C == null || !a.this.C.onShowFileChooser(webView, valueCallback, fileChooserParams)) {
                a.this.y.a(valueCallback);
            }
            return true;
        }

        @Override
        public final void onReceivedTitle(WebView webView, String str) {
            super.onReceivedTitle(webView, str);
            if (cn.ninegame.b.c.a.a()) {
                cn.ninegame.b.c.a.a("action", a.this.h() + " onTitleUpdate:" + str);
            }
            a.b(a.this, "rt");
            a.this.z = str;
            if (a.this.C != null) {
                a.this.C.onReceivedTitle(webView, str);
            }
        }

        @Override
        public final void onProgressChanged(WebView webView, int i) {
            super.onProgressChanged(webView, i);
            if (i != a.this.p) {
                a.this.p = i;
                if (i == 0) {
                    if (cn.ninegame.b.c.a.a()) {
                        cn.ninegame.b.c.a.a("action", a.this.h() + " onProgressChanged:" + i);
                    }
                    a.b(a.this, "pc " + i);
                    a.this.a(23, (Object) null);
                } else if (i == 100) {
                    String str = ae.r;
                    ae.b();
                    a.b(a.this, "pc " + i);
                    if (cn.ninegame.b.c.a.a()) {
                        cn.ninegame.b.c.a.a("action", a.this.h() + " onProgressChanged:" + i);
                    }
                    a.this.a(24, (Object) null);
                    if (a.this.q != null) {
                        a.this.q.a(3);
                    }
                }
                if (a.this.C != null) {
                    a.this.C.onProgressChanged(webView, i);
                }
            }
        }

        @Override
        public final void onReceivedIcon(WebView webView, Bitmap bitmap) {
            super.onReceivedIcon(webView, bitmap);
            if (a.this.C != null) {
                a.this.C.onReceivedIcon(webView, bitmap);
            }
        }

        @Override
        public final void onReceivedTouchIconUrl(WebView webView, String str, boolean z) {
            super.onReceivedTouchIconUrl(webView, str, z);
            if (a.this.C != null) {
                a.this.C.onReceivedTouchIconUrl(webView, str, z);
            }
        }

        @Override
        public final void onShowCustomView(View view, WebChromeClient.CustomViewCallback customViewCallback) {
            super.onShowCustomView(view, customViewCallback);
            if (a.this.C != null) {
                a.this.C.onShowCustomView(view, customViewCallback);
            }
        }

        @Override
        public final void onHideCustomView() {
            super.onHideCustomView();
            if (a.this.C != null) {
                a.this.C.onHideCustomView();
            }
        }

        @Override
        public final boolean onCreateWindow(WebView webView, boolean z, boolean z2, Message message) {
            return a.this.C != null ? a.this.C.onCreateWindow(webView, z, z2, message) : super.onCreateWindow(webView, z, z2, message);
        }

        @Override
        public final void onRequestFocus(WebView webView) {
            super.onRequestFocus(webView);
            if (a.this.C != null) {
                a.this.C.onRequestFocus(webView);
            }
        }

        @Override
        public final void onCloseWindow(WebView webView) {
            super.onCloseWindow(webView);
            if (a.this.C != null) {
                a.this.C.onCloseWindow(webView);
            }
        }

        @Override
        public final boolean onJsConfirm(WebView webView, String str, String str2, JsResult jsResult) {
            return a.this.C != null ? a.this.C.onJsConfirm(webView, str, str2, jsResult) : super.onJsConfirm(webView, str, str2, jsResult);
        }

        @Override
        public final boolean onJsBeforeUnload(WebView webView, String str, String str2, JsResult jsResult) {
            return a.this.C != null ? a.this.C.onJsBeforeUnload(webView, str, str2, jsResult) : super.onJsBeforeUnload(webView, str, str2, jsResult);
        }

        @Override
        public final void onGeolocationPermissionsShowPrompt(String str, GeolocationPermissions.Callback callback) {
            super.onGeolocationPermissionsShowPrompt(str, callback);
            if (a.this.C != null) {
                a.this.C.onGeolocationPermissionsShowPrompt(str, callback);
            }
        }

        @Override
        public final void onGeolocationPermissionsHidePrompt() {
            super.onGeolocationPermissionsHidePrompt();
            if (a.this.C != null) {
                a.this.C.onGeolocationPermissionsHidePrompt();
            }
        }

        @Override
        public final Bitmap getDefaultVideoPoster() {
            return a.this.C != null ? a.this.C.getDefaultVideoPoster() : super.getDefaultVideoPoster();
        }

        @Override
        public final View getVideoLoadingProgressView() {
            return a.this.C != null ? a.this.C.getVideoLoadingProgressView() : super.getVideoLoadingProgressView();
        }

        @Override
        public final void getVisitedHistory(ValueCallback<String[]> valueCallback) {
            super.getVisitedHistory(valueCallback);
            if (a.this.C != null) {
                a.this.C.getVisitedHistory(valueCallback);
            }
        }

        @Override
        public final void openFileChooser(ValueCallback<Uri> valueCallback) {
            super.openFileChooser(valueCallback);
            if (a.this.C != null) {
                a.this.C.openFileChooser(valueCallback);
            }
        }
    }

    class e extends UCClient {
        e() {
        }

        @Override
        public final void onWebViewEvent(WebView webView, int i, Object obj) {
            int intValue;
            super.onWebViewEvent(webView, i, obj);
            a.b(a.this, "event " + i);
            long currentTimeMillis = System.currentTimeMillis() - a.x;
            String h = a.this.h();
            switch (i) {
                case 4:
                    a.this.a(14, (Object) null);
                    if (cn.ninegame.b.c.a.a()) {
                        cn.ninegame.b.c.a.a("cycle", currentTimeMillis + "u3开始 " + h);
                    }
                    cn.ninegame.b.e.a a2 = cn.ninegame.b.e.a.a();
                    String str = a.this.f;
                    a2.f = System.currentTimeMillis();
                    if (!a2.p.equals(str) || !a2.q) {
                        a2.b();
                    }
                    a2.q = false;
                    return;
                case 5:
                    if (cn.ninegame.b.c.a.a()) {
                        cn.ninegame.b.c.a.a("cycle", currentTimeMillis + " t0 " + h);
                    }
                    cn.ninegame.b.e.a.a().g = System.currentTimeMillis();
                    if (a.this.q != null) {
                        a.this.q.a(0);
                        return;
                    }
                    return;
                case 6:
                    a.this.a(15, (Object) null);
                    if (cn.ninegame.b.c.a.a()) {
                        cn.ninegame.b.c.a.a("cycle", currentTimeMillis + " t1 " + h);
                    }
                    if (currentTimeMillis < 30000) {
                        cn.ninegame.library.stat.e.i a3 = cn.ninegame.library.stat.e.i.a("u3_t1");
                        a3.a("dur", String.valueOf(currentTimeMillis));
                        cn.ninegame.b.e.c.a(a3, new String[0]);
                        String str2 = ae.u;
                        ae.b();
                    }
                    if (a.this.q != null) {
                        a.this.q.a(1);
                    }
                    cn.ninegame.b.e.a.a().h = System.currentTimeMillis();
                    return;
                case 7:
                    a.this.a(16, (Object) null);
                    if (cn.ninegame.b.c.a.a()) {
                        cn.ninegame.b.c.a.a("cycle", currentTimeMillis + " t2 " + h);
                    }
                    cn.ninegame.b.e.a.a().j = System.currentTimeMillis();
                    cn.ninegame.library.stat.e.i a4 = cn.ninegame.library.stat.e.i.a("u3_t2");
                    a4.a("dur", String.valueOf(currentTimeMillis));
                    cn.ninegame.b.e.c.a(a4, new String[0]);
                    if (a.this.q != null) {
                        a.this.q.a(3);
                        return;
                    }
                    return;
                case 8:
                    a.this.a(17, (Object) null);
                    if (cn.ninegame.b.c.a.a()) {
                        cn.ninegame.b.c.a.a("cycle", currentTimeMillis + " t3 " + h);
                    }
                    cn.ninegame.library.stat.e.i a5 = cn.ninegame.library.stat.e.i.a("u3_t3");
                    a5.a("dur", String.valueOf(currentTimeMillis));
                    cn.ninegame.b.e.c.a(a5, new String[0]);
                    if (a.this.q != null) {
                        a.this.q.a(2);
                        return;
                    }
                    return;
                case 9:
                    if (!(obj instanceof Integer)) {
                        intValue = -1;
                    } else {
                        intValue = ((Integer) obj).intValue();
                    }
                    if (intValue == 6) {
                        a.B(a.this);
                        cn.ninegame.b.e.c.a(new cn.ninegame.b.d.a("4", a.this.c(), a.this.f, a.this.g, NetworkUtils.isWifi(a.this.getContext())));
                        a.this.y.a(9, a.this.f);
                        if (cn.ninegame.b.c.a.a()) {
                            cn.ninegame.b.c.a.a("cycle", currentTimeMillis + "load fail in 6s " + h);
                            return;
                        }
                        return;
                    }
                    return;
                default:
                    return;
            }
        }

        @Override
        public final void onFirstLayoutFinished(boolean z, String str) {
            super.onFirstLayoutFinished(z, str);
            if (cn.ninegame.b.c.a.a()) {
                cn.ninegame.b.c.a.b("cycle", a.this.h() + " onFirstLayoutFinished:" + z + ":" + str);
            }
        }

        @Override
        public final void onFirstVisuallyNonEmptyDraw() {
            super.onFirstVisuallyNonEmptyDraw();
            if (cn.ninegame.b.c.a.a()) {
                cn.ninegame.b.c.a.b("cycle", a.this.h() + " onFirstVisuallyNonEmptyDraw");
            }
        }

        @Override
        public final void onResourceDidFinishLoading(String str, long j) {
            super.onResourceDidFinishLoading(str, j);
            if (cn.ninegame.b.c.a.a()) {
                cn.ninegame.b.c.a.b("cycle", a.this.h() + " 资源加载完成 " + str);
            }
        }

        @Override
        public final WebResourceRequest onWillSendRequest(WebResourceRequest webResourceRequest) {
            if (cn.ninegame.b.c.a.a()) {
                cn.ninegame.b.c.a.b("cycle", a.this.h() + "发起请求 " + webResourceRequest.getUrl());
            }
            return super.onWillSendRequest(webResourceRequest);
        }

        @Override
        public final boolean onWillInterceptResponse(HashMap<String, String> hashMap) {
            if (cn.ninegame.b.c.a.a()) {
                cn.ninegame.b.c.a.b("cycle", a.this.h() + "收到响应 " + hashMap.toString());
            }
            return super.onWillInterceptResponse(hashMap);
        }
    }

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

    public void callJS(String str) {
        if (cn.ninegame.b.c.a.a()) {
            cn.ninegame.b.c.a.b("js_bright", "call JS:" + str);
        }
        if (Looper.myLooper() == Looper.getMainLooper()) {
            e(str);
        } else {
            post(new cn.ninegame.b.h.e(this, str));
        }
    }

    @Override
    public void scrollTo(int i, int i2) {
        getCoreView().scrollTo(i, i2);
    }

    public final void d(String str) {
        if (this.j != null) {
            this.j.a(str);
        }
    }

    public final void a(cn.ninegame.b.d.a aVar) {
        if (cn.ninegame.b.c.a.a()) {
            cn.ninegame.b.c.a.a("cycle", "on receive error:" + aVar.f322a + ":" + aVar.b);
        }
        if (this.B != null) {
            this.B.onReceivedError(this, -1, aVar.f322a, aVar.b);
        }
        a(19, aVar);
    }

    public final String h() {
        return a.class.getSimpleName() + hashCode();
    }

    public String c() {
        StringBuilder sb = new StringBuilder();
        cn.ninegame.b.f.j.e();
        return sb.append(cn.ninegame.b.f.i.c()).append("|").append(this.u).append("|").append(this.v.toString()).toString();
    }

    private void a(View view) {
        View view2;
        if (view != null) {
            if (this.A != null && (view2 = this.A.get()) != null) {
                removeView(view2);
            }
            this.A = new WeakReference<>(view);
            addView(view, -1, -1);
            view.setVisibility(0);
            view.bringToFront();
        }
    }

    @Override
    public void goBack() {
        super.goBack();
        this.D = true;
    }

    private boolean a(String str) {
        boolean z;
        boolean z2 = false;
        if (!TextUtils.isEmpty(str) && str.startsWith(this.f346a)) {
            Iterator<String> it = this.e.keySet().iterator();
            while (true) {
                if (!it.hasNext()) {
                    z = false;
                    break;
                } else if (str.contains(it.next())) {
                    z = true;
                    break;
                }
            }
            return z;
        }
        if (!TextUtils.isEmpty(str) && str.startsWith("javascript:")) {
            z2 = true;
        }
        if (z2) {
            return true;
        }
        this.e.clear();
        return true;
    }

    public void e(String str) {
        if (!this.c) {
            try {
                if (Build.VERSION.SDK_INT < 19) {
                    if (!str.startsWith("javascript:")) {
                        str = "javascript:" + str;
                    }
                    synchronized (this) {
                        if (!this.c && str != null) {
                            try {
                                if (a(str)) {
                                    super.loadUrl(str);
                                }
                            } catch (Throwable th) {
                            }
                        }
                    }
                    return;
                }
                String replace = str.replace("javascript:", "");
                synchronized (this) {
                    evaluateJavascript(replace, null);
                }
            } catch (Exception e2) {
            }
        }
    }

    static void i(a aVar) {
        aVar.v.delete(0, aVar.v.length());
        if (aVar.q != null) {
            aVar.q.setVisibility(8);
        }
        aVar.l = 0.0f;
        aVar.k = true;
        aVar.o = false;
        aVar.p = 0;
        x = 0L;
        aVar.w = false;
        aVar.i = null;
    }

    public static void q(a aVar) {
        View view = null;
        switch (aVar.h) {
            case 0:
                view = aVar.y.m();
                break;
        }
        aVar.a(view);
    }

    public static void s(a aVar) {
        View view;
        if (aVar.A == null || (view = aVar.A.get()) == null) {
            return;
        }
        aVar.removeView(view);
    }

    public static void x(a aVar) {
        View n = aVar.y.n();
        n.setOnClickListener(new cn.ninegame.b.h.f(aVar));
        aVar.a(n);
    }

    static void b(a aVar, String str) {
        aVar.v.append(str).append("|");
    }
}