曹妃甸核酸检测平台.apk(点击下载) / j.java


package com.alipay.sdk.widget;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.net.http.SslError;
import android.text.TextUtils;
import android.view.MotionEvent;
import android.view.animation.Animation;
import android.view.animation.TranslateAnimation;
import android.webkit.JsPromptResult;
import android.webkit.SslErrorHandler;
import android.webkit.WebView;
import android.widget.ImageView;
import asmack.org.jivesoftware.smackx.Form;
import com.alipay.sdk.util.o;
import com.alipay.sdk.widget.WebViewWindow;
import com.baidu.ocr.sdk.model.IDCardParams;
import com.igexin.download.Downloads;
import cz.msebera.android.httpclient.HttpHost;
import java.util.Map;
import org.json.JSONObject;

public class j extends g implements WebViewWindow.a, WebViewWindow.b, WebViewWindow.c {

    /* renamed from: b  reason: collision with root package name */
    private boolean f1077b = true;

    /* renamed from: c  reason: collision with root package name */
    private String f1078c = "GET";

    /* renamed from: d  reason: collision with root package name */
    private boolean f1079d = false;

    /* renamed from: e  reason: collision with root package name */
    private boolean f1080e;

    /* renamed from: f  reason: collision with root package name */
    private WebViewWindow f1081f = null;

    /* renamed from: g  reason: collision with root package name */
    private u f1082g = new u();

    /* access modifiers changed from: private */
    public abstract class a implements Animation.AnimationListener {
        private a() {
        }

        /* synthetic */ a(j jVar, k kVar) {
            this();
        }

        public void onAnimationRepeat(Animation animation) {
        }

        public void onAnimationStart(Animation animation) {
        }
    }

    public j(Activity activity) {
        super(activity);
        c();
    }

    /* JADX WARNING: Code restructure failed: missing block: B:17:0x0075, code lost:
        if (r8 != false) goto L_0x0079;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:23:0x008f, code lost:
        if (r8 != false) goto L_0x0079;
     */
    private void a(String str, String str2, String str3) {
        ImageView refreshButton;
        JSONObject d2 = o.d(str3);
        if (Downloads.COLUMN_TITLE.equals(str) && d2.has(Downloads.COLUMN_TITLE)) {
            this.f1081f.getTitle().setText(d2.optString(Downloads.COLUMN_TITLE, ""));
        } else if ("refresh".equals(str)) {
            this.f1081f.getWebView().reload();
        } else if (IDCardParams.ID_CARD_SIDE_BACK.equals(str)) {
            e();
        } else {
            int i = 0;
            if ("exit".equals(str)) {
                com.alipay.sdk.app.j.a(d2.optString(Form.TYPE_RESULT, null));
                a(d2.optBoolean("success", false));
                return;
            }
            if ("backButton".equals(str)) {
                boolean optBoolean = d2.optBoolean("show", true);
                refreshButton = this.f1081f.getBackButton();
            } else if ("refreshButton".equals(str)) {
                boolean optBoolean2 = d2.optBoolean("show", true);
                refreshButton = this.f1081f.getRefreshButton();
            } else if ("pushWindow".equals(str) && d2.optString("url", null) != null) {
                b(d2.optString("url"), d2.optString(Downloads.COLUMN_TITLE, ""));
                return;
            } else {
                return;
            }
            i = 4;
            refreshButton.setVisibility(i);
        }
    }

    private void a(boolean z) {
        com.alipay.sdk.app.j.a(z);
        this.f1073a.finish();
    }

    private void b(String str) {
        Map<String, String> c2 = o.c(str);
        if (str.startsWith("callNativeFunc")) {
            a(c2.get("func"), c2.get("cbId"), c2.get("data"));
        } else if (str.startsWith("onBack")) {
            e();
        } else if (str.startsWith("setTitle") && c2.containsKey(Downloads.COLUMN_TITLE)) {
            this.f1081f.getTitle().setText(c2.get(Downloads.COLUMN_TITLE));
        } else if (str.startsWith("onRefresh")) {
            this.f1081f.getWebView().reload();
        } else if (str.startsWith("showBackButton") && c2.containsKey("bshow")) {
            this.f1081f.getBackButton().setVisibility(TextUtils.equals("true", c2.get("bshow")) ? 0 : 4);
        } else if (str.startsWith("onExit")) {
            com.alipay.sdk.app.j.a(c2.get(Form.TYPE_RESULT));
            a(TextUtils.equals("true", c2.get("bsucc")));
        } else if (str.startsWith("onLoadJs")) {
            this.f1081f.a("javascript:(function() {\n    if (window.AlipayJSBridge) {\n        return\n    }\n\n    function alipayjsbridgeFunc(url) {\n        var iframe = document.createElement(\"iframe\");\n        iframe.style.width = \"1px\";\n        iframe.style.height = \"1px\";\n        iframe.style.display = \"none\";\n        iframe.src = url;\n        document.body.appendChild(iframe);\n        setTimeout(function() {\n            document.body.removeChild(iframe)\n        }, 100)\n    }\n    window.alipayjsbridgeSetTitle = function(title) {\n        document.title = title;\n        alipayjsbridgeFunc(\"alipayjsbridge://setTitle?title=\" + encodeURIComponent(title))\n    };\n    window.alipayjsbridgeRefresh = function() {\n        alipayjsbridgeFunc(\"alipayjsbridge://onRefresh?\")\n    };\n    window.alipayjsbridgeBack = function() {\n        alipayjsbridgeFunc(\"alipayjsbridge://onBack?\")\n    };\n    window.alipayjsbridgeExit = function(bsucc) {\n        alipayjsbridgeFunc(\"alipayjsbridge://onExit?bsucc=\" + bsucc)\n    };\n    window.alipayjsbridgeShowBackButton = function(bshow) {\n        alipayjsbridgeFunc(\"alipayjsbridge://showBackButton?bshow=\" + bshow)\n    };\n    window.AlipayJSBridge = {\n        version: \"2.0\",\n        addListener: addListener,\n        hasListener: hasListener,\n        callListener: callListener,\n        callNativeFunc: callNativeFunc,\n        callBackFromNativeFunc: callBackFromNativeFunc\n    };\n    var uniqueId = 1;\n    var h5JsCallbackMap = {};\n\n    function iframeCall(paramStr) {\n        setTimeout(function() {\n        \tvar iframe = document.createElement(\"iframe\");\n        \tiframe.style.width = \"1px\";\n        \tiframe.style.height = \"1px\";\n        \tiframe.style.display = \"none\";\n        \tiframe.src = \"alipayjsbridge://callNativeFunc?\" + paramStr;\n        \tvar parent = document.body || document.documentElement;\n        \tparent.appendChild(iframe);\n        \tsetTimeout(function() {\n            \tparent.removeChild(iframe)\n        \t}, 0)\n        }, 0)\n    }\n\n    function callNativeFunc(nativeFuncName, data, h5JsCallback) {\n        var h5JsCallbackId = \"\";\n        if (h5JsCallback) {\n            h5JsCallbackId = \"cb_\" + (uniqueId++) + \"_\" + new Date().getTime();\n            h5JsCallbackMap[h5JsCallbackId] = h5JsCallback\n        }\n        var dataStr = \"\";\n        if (data) {\n            dataStr = encodeURIComponent(JSON.stringify(data))\n        }\n        var paramStr = \"func=\" + nativeFuncName + \"&cbId=\" + h5JsCallbackId + \"&data=\" + dataStr;\n        iframeCall(paramStr)\n    }\n\n    function callBackFromNativeFunc(h5JsCallbackId, data) {\n        var h5JsCallback = h5JsCallbackMap[h5JsCallbackId];\n        if (h5JsCallback) {\n            h5JsCallback(data);\n            delete h5JsCallbackMap[h5JsCallbackId]\n        }\n    }\n    var h5ListenerMap = {};\n\n    function addListener(jsFuncName, jsFunc) {\n        h5ListenerMap[jsFuncName] = jsFunc\n    }\n\n    function hasListener(jsFuncName) {\n        var jsFunc = h5ListenerMap[jsFuncName];\n        if (!jsFunc) {\n            return false\n        }\n        return true\n    }\n\n    function callListener(h5JsFuncName, data, nativeCallbackId) {\n        var responseCallback;\n        if (nativeCallbackId) {\n            responseCallback = function(responseData) {\n                var dataStr = \"\";\n                if (responseData) {\n                    dataStr = encodeURIComponent(JSON.stringify(responseData))\n                }\n                var paramStr = \"func=h5JsFuncCallback\" + \"&cbId=\" + nativeCallbackId + \"&data=\" + dataStr;\n                iframeCall(paramStr)\n            }\n        }\n        var h5JsFunc = h5ListenerMap[h5JsFuncName];\n        if (h5JsFunc) {\n            h5JsFunc(data, responseCallback)\n        } else if (h5JsFuncName == \"h5BackAction\") {\n            if (!window.alipayjsbridgeH5BackAction || !alipayjsbridgeH5BackAction()) {\n                var paramStr = \"func=back\";\n                iframeCall(paramStr)\n            }\n        } else {\n            console.log(\"AlipayJSBridge: no h5JsFunc \" + h5JsFuncName + data)\n        }\n    }\n    var event;\n    if (window.CustomEvent) {\n        event = new CustomEvent(\"alipayjsbridgeready\")\n    } else {\n        event = document.createEvent(\"Event\");\n        event.initEvent(\"alipayjsbridgeready\", true, true)\n    }\n    document.dispatchEvent(event);\n    setTimeout(excuteH5InitFuncs, 0);\n\n    function excuteH5InitFuncs() {\n        if (window.AlipayJSBridgeInitArray) {\n            var h5InitFuncs = window.AlipayJSBridgeInitArray;\n            delete window.AlipayJSBridgeInitArray;\n            for (var i = 0; i < h5InitFuncs.length; i++) {\n                try {\n                    h5InitFuncs[i](AlipayJSBridge)\n                } catch (e) {\n                    setTimeout(function() {\n                        throw e\n                    })\n                }\n            }\n        }\n    }\n})();\n");
        }
    }

    private boolean b(String str, String str2) {
        WebViewWindow webViewWindow = this.f1081f;
        try {
            this.f1081f = new WebViewWindow(this.f1073a);
            this.f1081f.setChromeProxy(this);
            this.f1081f.setWebClientProxy(this);
            this.f1081f.setWebEventProxy(this);
            if (!TextUtils.isEmpty(str2)) {
                this.f1081f.getTitle().setText(str2);
            }
            this.f1079d = true;
            this.f1082g.a(webViewWindow);
            TranslateAnimation translateAnimation = new TranslateAnimation(1, 1.0f, 1, 0.0f, 1, 0.0f, 1, 0.0f);
            translateAnimation.setDuration(400);
            translateAnimation.setFillAfter(false);
            translateAnimation.setAnimationListener(new m(this, webViewWindow, str));
            this.f1081f.setAnimation(translateAnimation);
            addView(this.f1081f);
            return true;
        } catch (Throwable unused) {
            return false;
        }
    }

    private boolean c() {
        try {
            this.f1081f = new WebViewWindow(this.f1073a);
            this.f1081f.setChromeProxy(this);
            this.f1081f.setWebClientProxy(this);
            this.f1081f.setWebEventProxy(this);
            addView(this.f1081f);
            return true;
        } catch (Exception unused) {
            return false;
        }
    }

    private void d() {
        if (this.f1077b) {
            this.f1073a.finish();
        } else {
            this.f1081f.a("javascript:window.AlipayJSBridge.callListener('h5BackAction');");
        }
    }

    private void e() {
        WebView webView = this.f1081f.getWebView();
        if (webView.canGoBack()) {
            webView.goBack();
            return;
        }
        u uVar = this.f1082g;
        if (uVar == null || uVar.b()) {
            a(false);
        } else {
            f();
        }
    }

    private boolean f() {
        if (this.f1082g.b()) {
            this.f1073a.finish();
        } else {
            this.f1079d = true;
            WebViewWindow webViewWindow = this.f1081f;
            this.f1081f = this.f1082g.a();
            TranslateAnimation translateAnimation = new TranslateAnimation(1, 0.0f, 1, 1.0f, 1, 0.0f, 1, 0.0f);
            translateAnimation.setDuration(400);
            translateAnimation.setFillAfter(false);
            translateAnimation.setAnimationListener(new l(this, webViewWindow));
            webViewWindow.setAnimation(translateAnimation);
            removeView(webViewWindow);
            addView(this.f1081f);
        }
        return true;
    }

    @Override // com.alipay.sdk.widget.g
    public void a() {
        this.f1081f.a();
        this.f1082g.c();
    }

    @Override // com.alipay.sdk.widget.WebViewWindow.c
    public void a(WebViewWindow webViewWindow) {
        webViewWindow.getWebView().reload();
        webViewWindow.getRefreshButton().setVisibility(4);
    }

    @Override // com.alipay.sdk.widget.g
    public void a(String str) {
        if ("POST".equals(this.f1078c)) {
            this.f1081f.a(str, (byte[]) null);
        } else {
            this.f1081f.a(str);
        }
    }

    public void a(String str, String str2, boolean z) {
        this.f1078c = str2;
        this.f1081f.getTitle().setText(str);
        this.f1077b = z;
    }

    @Override // com.alipay.sdk.widget.WebViewWindow.b
    public boolean a(WebViewWindow webViewWindow, int i, String str, String str2) {
        com.alipay.sdk.app.a.a.a("net", "SSLError", "onReceivedError:" + str2);
        webViewWindow.getRefreshButton().setVisibility(0);
        return false;
    }

    @Override // com.alipay.sdk.widget.WebViewWindow.b
    public boolean a(WebViewWindow webViewWindow, SslErrorHandler sslErrorHandler, SslError sslError) {
        com.alipay.sdk.app.a.a.a("net", "SSLError", "2-" + sslError);
        if (this.f1080e) {
            sslErrorHandler.proceed();
            this.f1080e = false;
            return true;
        }
        this.f1073a.runOnUiThread(new n(this, sslErrorHandler));
        return true;
    }

    @Override // com.alipay.sdk.widget.WebViewWindow.b
    public boolean a(WebViewWindow webViewWindow, String str) {
        if (TextUtils.isEmpty(str)) {
            return false;
        }
        if (str.startsWith("alipayjsbridge://")) {
            b(str.substring(17));
            return true;
        } else if (TextUtils.equals(str, "sdklite://h5quit")) {
            a(false);
            return true;
        } else if (str.startsWith("http://") || str.startsWith("https://")) {
            this.f1081f.a(str);
            return true;
        } else {
            try {
                Intent intent = new Intent();
                intent.setAction("android.intent.action.VIEW");
                intent.setData(Uri.parse(str));
                this.f1073a.startActivity(intent);
                return true;
            } catch (Throwable th) {
                com.alipay.sdk.app.a.a.a("biz", th);
                return true;
            }
        }
    }

    @Override // com.alipay.sdk.widget.WebViewWindow.a
    public boolean a(WebViewWindow webViewWindow, String str, String str2, String str3, JsPromptResult jsPromptResult) {
        if (str2.startsWith("<head>") && str2.contains("sdk_result_code:")) {
            this.f1073a.runOnUiThread(new k(this));
        }
        jsPromptResult.cancel();
        return true;
    }

    @Override // com.alipay.sdk.widget.WebViewWindow.c
    public void b(WebViewWindow webViewWindow) {
        d();
    }

    @Override // com.alipay.sdk.widget.WebViewWindow.a
    public void b(WebViewWindow webViewWindow, String str) {
        if (!str.startsWith(HttpHost.DEFAULT_SCHEME_NAME) && !webViewWindow.getUrl().endsWith(str)) {
            this.f1081f.getTitle().setText(str);
        }
    }

    @Override // com.alipay.sdk.widget.g
    public boolean b() {
        if (this.f1079d) {
            return true;
        }
        d();
        return true;
    }

    @Override // com.alipay.sdk.widget.WebViewWindow.b
    public boolean c(WebViewWindow webViewWindow, String str) {
        webViewWindow.a("javascript:window.prompt('<head>'+document.getElementsByTagName('html')[0].innerHTML+'</head>');(function() {\n    if (window.AlipayJSBridge) {\n        return\n    }\n\n    function alipayjsbridgeFunc(url) {\n        var iframe = document.createElement(\"iframe\");\n        iframe.style.width = \"1px\";\n        iframe.style.height = \"1px\";\n        iframe.style.display = \"none\";\n        iframe.src = url;\n        document.body.appendChild(iframe);\n        setTimeout(function() {\n            document.body.removeChild(iframe)\n        }, 100)\n    }\n    window.alipayjsbridgeSetTitle = function(title) {\n        document.title = title;\n        alipayjsbridgeFunc(\"alipayjsbridge://setTitle?title=\" + encodeURIComponent(title))\n    };\n    window.alipayjsbridgeRefresh = function() {\n        alipayjsbridgeFunc(\"alipayjsbridge://onRefresh?\")\n    };\n    window.alipayjsbridgeBack = function() {\n        alipayjsbridgeFunc(\"alipayjsbridge://onBack?\")\n    };\n    window.alipayjsbridgeExit = function(bsucc) {\n        alipayjsbridgeFunc(\"alipayjsbridge://onExit?bsucc=\" + bsucc)\n    };\n    window.alipayjsbridgeShowBackButton = function(bshow) {\n        alipayjsbridgeFunc(\"alipayjsbridge://showBackButton?bshow=\" + bshow)\n    };\n    window.AlipayJSBridge = {\n        version: \"2.0\",\n        addListener: addListener,\n        hasListener: hasListener,\n        callListener: callListener,\n        callNativeFunc: callNativeFunc,\n        callBackFromNativeFunc: callBackFromNativeFunc\n    };\n    var uniqueId = 1;\n    var h5JsCallbackMap = {};\n\n    function iframeCall(paramStr) {\n        setTimeout(function() {\n        \tvar iframe = document.createElement(\"iframe\");\n        \tiframe.style.width = \"1px\";\n        \tiframe.style.height = \"1px\";\n        \tiframe.style.display = \"none\";\n        \tiframe.src = \"alipayjsbridge://callNativeFunc?\" + paramStr;\n        \tvar parent = document.body || document.documentElement;\n        \tparent.appendChild(iframe);\n        \tsetTimeout(function() {\n            \tparent.removeChild(iframe)\n        \t}, 0)\n        }, 0)\n    }\n\n    function callNativeFunc(nativeFuncName, data, h5JsCallback) {\n        var h5JsCallbackId = \"\";\n        if (h5JsCallback) {\n            h5JsCallbackId = \"cb_\" + (uniqueId++) + \"_\" + new Date().getTime();\n            h5JsCallbackMap[h5JsCallbackId] = h5JsCallback\n        }\n        var dataStr = \"\";\n        if (data) {\n            dataStr = encodeURIComponent(JSON.stringify(data))\n        }\n        var paramStr = \"func=\" + nativeFuncName + \"&cbId=\" + h5JsCallbackId + \"&data=\" + dataStr;\n        iframeCall(paramStr)\n    }\n\n    function callBackFromNativeFunc(h5JsCallbackId, data) {\n        var h5JsCallback = h5JsCallbackMap[h5JsCallbackId];\n        if (h5JsCallback) {\n            h5JsCallback(data);\n            delete h5JsCallbackMap[h5JsCallbackId]\n        }\n    }\n    var h5ListenerMap = {};\n\n    function addListener(jsFuncName, jsFunc) {\n        h5ListenerMap[jsFuncName] = jsFunc\n    }\n\n    function hasListener(jsFuncName) {\n        var jsFunc = h5ListenerMap[jsFuncName];\n        if (!jsFunc) {\n            return false\n        }\n        return true\n    }\n\n    function callListener(h5JsFuncName, data, nativeCallbackId) {\n        var responseCallback;\n        if (nativeCallbackId) {\n            responseCallback = function(responseData) {\n                var dataStr = \"\";\n                if (responseData) {\n                    dataStr = encodeURIComponent(JSON.stringify(responseData))\n                }\n                var paramStr = \"func=h5JsFuncCallback\" + \"&cbId=\" + nativeCallbackId + \"&data=\" + dataStr;\n                iframeCall(paramStr)\n            }\n        }\n        var h5JsFunc = h5ListenerMap[h5JsFuncName];\n        if (h5JsFunc) {\n            h5JsFunc(data, responseCallback)\n        } else if (h5JsFuncName == \"h5BackAction\") {\n            if (!window.alipayjsbridgeH5BackAction || !alipayjsbridgeH5BackAction()) {\n                var paramStr = \"func=back\";\n                iframeCall(paramStr)\n            }\n        } else {\n            console.log(\"AlipayJSBridge: no h5JsFunc \" + h5JsFuncName + data)\n        }\n    }\n    var event;\n    if (window.CustomEvent) {\n        event = new CustomEvent(\"alipayjsbridgeready\")\n    } else {\n        event = document.createEvent(\"Event\");\n        event.initEvent(\"alipayjsbridgeready\", true, true)\n    }\n    document.dispatchEvent(event);\n    setTimeout(excuteH5InitFuncs, 0);\n\n    function excuteH5InitFuncs() {\n        if (window.AlipayJSBridgeInitArray) {\n            var h5InitFuncs = window.AlipayJSBridgeInitArray;\n            delete window.AlipayJSBridgeInitArray;\n            for (var i = 0; i < h5InitFuncs.length; i++) {\n                try {\n                    h5InitFuncs[i](AlipayJSBridge)\n                } catch (e) {\n                    setTimeout(function() {\n                        throw e\n                    })\n                }\n            }\n        }\n    }\n})();\n;window.AlipayJSBridge.callListener('h5PageFinished');");
        webViewWindow.getRefreshButton().setVisibility(0);
        return true;
    }

    public boolean onInterceptTouchEvent(MotionEvent motionEvent) {
        if (this.f1079d) {
            return true;
        }
        return super.onInterceptTouchEvent(motionEvent);
    }
}