开发专用 v00.00.26版本的 MD5 值为:27d23588b440d1fe24ff30607dd0eda9

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


package com.uzmap.pkg.openapi;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.text.TextUtils;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.ValueCallback;
import android.webkit.WebBackForwardList;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.widget.FrameLayout;
import com.deepe.b.d;
import com.deepe.c.b.c;
import com.deepe.c.i.k;
import com.deepe.c.i.r;
import com.deepe.d.a;
import com.deepe.sdk.WebShare;
import com.uzmap.pkg.uzcore.b.d;
import com.uzmap.pkg.uzcore.e;
import com.uzmap.pkg.uzcore.e.b;
import com.uzmap.pkg.uzcore.f;
import com.uzmap.pkg.uzcore.h;
import com.uzmap.pkg.uzcore.h.w;
import com.uzmap.pkg.uzcore.q;
import com.uzmap.pkg.uzcore.x;
import java.util.HashMap;
import org.json.JSONObject;

public final class SuperWebview extends FrameLayout {
    private static boolean m = false;
    private h a;
    private f b;
    private final ViewClient c;
    private Object d;
    private boolean e;
    private boolean f;
    private boolean g;
    private boolean h;
    private w i;
    private String j;
    private String k;
    private Boolean l;

    public SuperWebview(Context context, Object obj) {
        super(context);
        this.e = true;
        this.g = false;
        this.l = null;
        this.c = new ViewClient(this);
        this.b = f.b(context);
        if (tryToTablayoutInfo(obj)) {
            return;
        }
        this.d = obj;
        this.b.c(obj != null ? obj.toString() : null);
    }

    private void changeEngineModeIfNeeded(d dVar) {
        if (this.g) {
            return;
        }
        if (dVar.o() || dVar.p()) {
            if (dVar.p()) {
                dVar.n = true;
            }
            createSuperView(dVar);
            this.g = true;
            if (a.a) {
                a.f("SuperWebview@" + hashCode() + " changeEngineMode " + dVar.q());
            }
        }
    }

    private void checkWithNullUrlInitialized() {
        if (isInitialized()) {
            return;
        }
        initialize(d.c(getDefaultStartUrl(), null));
    }

    private void createSuperView(d dVar) {
        h hVar = this.a;
        if (hVar != null) {
            removeView(hVar);
            this.a.t();
        }
        w wVar = this.i;
        if (wVar != null) {
            dVar.a(wVar);
        }
        b.a(dVar);
        this.b.a((f.a) this.c);
        h hVar2 = new h(getContext(), dVar);
        this.a = hVar2;
        hVar2.a((f.a) this.c);
        this.a.a();
        this.a.setLayoutParams(c.b());
        this.a.a(true);
        this.a.b(1);
        addView(this.a);
    }

    private boolean doSpecialScheme(String str) {
        if (!"http://ops.fun.mipm/sync".equals(str)) {
            return false;
        }
        this.b.a("data_sync", true);
        return true;
    }

    private com.uzmap.pkg.uzcore.a getCurAPIView() {
        com.uzmap.pkg.uzcore.d.a curFrame = getCurFrame();
        if (curFrame != null) {
            return curFrame.d();
        }
        return null;
    }

    private final com.uzmap.pkg.uzcore.d.a getCurFrame() {
        com.uzmap.pkg.uzcore.d.c curWindow = getCurWindow();
        if (curWindow != null) {
            return curWindow.E();
        }
        return null;
    }

    private WebView getCurWebView() {
        Object curAPIView = getCurAPIView();
        if (curAPIView instanceof WebView) {
            return (WebView) curAPIView;
        }
        return null;
    }

    private com.uzmap.pkg.uzcore.d.c getCurWindow() {
        h hVar = this.a;
        if (hVar != null) {
            return hVar.p();
        }
        return null;
    }

    private String ifNeededTransUrl(String str) {
        d j;
        int indexOf;
        if (str == null || FileSystem.isLocked() || (j = e.a().j()) == null || !j.k || (indexOf = str.indexOf("widget/")) <= 0) {
            return str;
        }
        String substring = str.substring(indexOf);
        String b = j.b();
        int indexOf2 = b.indexOf("widget/");
        if (indexOf2 <= 0) {
            return str;
        }
        return String.valueOf(b.substring(0, indexOf2)) + substring;
    }

    private void initialize(d dVar) {
        if (this.f) {
            changeEngineModeIfNeeded(dVar);
            this.a.a(dVar);
        } else {
            createSuperView(dVar);
            this.f = true;
            this.b.j();
        }
    }

    private String makeRealUrlAndSuperViewIfNeeded(String str) {
        if (com.deepe.c.i.d.a((CharSequence) str)) {
            return str;
        }
        if (k.d(str)) {
            d j = d.j(r.y(str));
            if (j.o()) {
                changeEngineModeIfNeeded(j);
                start();
                return null;
            }
            String n = j != null ? j.n() : null;
            if (n != null) {
                changeEngineModeIfNeeded(j);
                return String.valueOf(n) + x.e(str);
            }
        } else if (k.b(str)) {
            changeEngineModeIfNeeded(d.c(str, null));
            start(str);
            return null;
        }
        return str;
    }

    private void realStart() {
        this.a.d();
        if (this.e) {
            startupProcess();
        }
    }

    private boolean shouldOverrideKeyPress(q.a aVar) {
        h hVar = this.a;
        return hVar != null && hVar.a(aVar);
    }

    private final void startupProcess() {
        if (m) {
            return;
        }
        m = true;
        e.a().a((com.deepe.b.d.d) new com.deepe.b.d(new d.a() {
            @Override
            public Activity getActivity() {
                return com.deepe.c.a.a.a(SuperWebview.this.getContext());
            }

            @Override
            public boolean isFromNativeSDK() {
                return true;
            }

            @Override
            public void onSmartUpdateFinish(boolean z, com.deepe.b.b.c cVar) {
                if (SuperWebview.this.a != null) {
                    SuperWebview.this.a.a(z, cVar);
                }
            }

            @Override
            public boolean requestFinishApp(boolean z) {
                return false;
            }

            @Override
            public boolean requestRebootApp() {
                return false;
            }
        }));
        e.a().d();
    }

    private boolean tryToTablayoutInfo(Object obj) {
        if (obj == null) {
            return false;
        }
        if (obj instanceof w) {
            this.i = (w) obj;
            return true;
        }
        w wVar = new w(obj.toString(), null);
        this.i = wVar;
        if (!wVar.ac || this.i.ab) {
            this.i = null;
            return false;
        }
        checkWithNullUrlInitialized();
        return true;
    }

    public final void addHtml5EventListener(Html5EventListener html5EventListener) {
        APIEventCenter.get().addHtml5EventListener(getContext(), html5EventListener);
    }

    public final void addJavascriptInterface(Object obj, String str) {
        checkWithNullUrlInitialized();
        if (getCurWebView() != null) {
            getCurWebView().addJavascriptInterface(obj, str);
        } else {
            a.h("SuperWebview addJavascriptInterface method in, but WebView is null.");
        }
    }

    public final void appendUserAgent(String str) {
        checkWithNullUrlInitialized();
        com.deepe.c.k.k.a(getCurWebView(), str);
    }

    public final boolean canGoBack() {
        if (getCurWebView() != null) {
            return getCurWebView().canGoBack();
        }
        a.h("SuperWebview canGoBack method in, but WebView is null.");
        return false;
    }

    public final boolean canGoBackOrForward(int i) {
        if (getCurWebView() != null) {
            return getCurWebView().canGoBackOrForward(i);
        }
        a.h("SuperWebview canGoBackOrForward method in, but WebView is null.");
        return false;
    }

    public final boolean canGoForward() {
        if (getCurWebView() != null) {
            return getCurWebView().canGoForward();
        }
        a.h("SuperWebview canGoForward method in, but WebView is null.");
        return false;
    }

    public final void clearCache(boolean z) {
        checkWithNullUrlInitialized();
        if (getCurWebView() != null) {
            getCurWebView().clearCache(z);
        } else {
            a.h("SuperWebview clearCache method in, but WebView is null.");
        }
    }

    public final void clearFormData() {
        checkWithNullUrlInitialized();
        if (getCurWebView() != null) {
            getCurWebView().clearFormData();
        } else {
            a.h("SuperWebview clearFormData method in, but WebView is null.");
        }
    }

    public final void clearHistory() {
        checkWithNullUrlInitialized();
        if (getCurWebView() != null) {
            getCurWebView().clearHistory();
        } else {
            a.h("SuperWebview clearHistory method in, but WebView is null.");
        }
    }

    public final WebBackForwardList copyBackForwardList() {
        checkWithNullUrlInitialized();
        if (getCurWebView() != null) {
            return getCurWebView().copyBackForwardList();
        }
        a.h("SuperWebview copyBackForwardList method in, but WebView is null.");
        return null;
    }

    public final void destroy() {
        h hVar = this.a;
        if (hVar != null) {
            removeView(hVar);
            this.a.t();
            this.a = null;
            com.uzmap.pkg.a.b.a();
        }
        ViewClient viewClient = this.c;
        if (viewClient != null) {
            viewClient.destroy();
        }
    }

    public final void evaluateJavascript(String str) {
        evaluateJavascript((String) null, str);
    }

    public final void evaluateJavascript(String str, ValueCallback valueCallback) {
        evaluateJavascript(null, null, str, valueCallback);
    }

    public final void evaluateJavascript(String str, String str2) {
        evaluateJavascript(str, null, str2);
    }

    public final void evaluateJavascript(String str, String str2, String str3) {
        evaluateJavascript(str, str2, str3, null);
    }

    public final void evaluateJavascript(String str, String str2, String str3, ValueCallback valueCallback) {
        if (this.a != null) {
            com.uzmap.pkg.uzcore.uzmodule.b.q qVar = new com.uzmap.pkg.uzcore.uzmodule.b.q();
            qVar.a = str;
            qVar.b = str2;
            qVar.c = str3;
            qVar.d = valueCallback;
            this.a.b(qVar);
        }
    }

    public final View getBrowserView() {
        return getCurWebView();
    }

    public String getDefaultStartUrl() {
        com.uzmap.pkg.uzcore.b.d j = e.a().j();
        return j != null ? j.b() : "file:///android_asset/widget/index.html";
    }

    public final String getFrameName() {
        return getCurFrame() != null ? getCurFrame().a() : "";
    }

    public final HashMap<Integer, String> getHitTestResult() {
        checkWithNullUrlInitialized();
        if (getCurWebView() == null) {
            a.h("SuperWebview getHitTestResult method in, but WebView is null.");
            return null;
        }
        WebView.HitTestResult hitTestResult = getCurWebView().getHitTestResult();
        if (hitTestResult == null) {
            return null;
        }
        Integer valueOf = Integer.valueOf(hitTestResult.getType());
        String extra = hitTestResult.getExtra();
        HashMap<Integer, String> hashMap = new HashMap<>();
        hashMap.put(valueOf, extra);
        return hashMap;
    }

    public final String getOriginalUrl() {
        checkWithNullUrlInitialized();
        if (getCurWebView() != null) {
            return getCurWebView().getOriginalUrl();
        }
        a.h("SuperWebview getOriginalUrl method in, but WebView is null.");
        return null;
    }

    public final WebSettings getSettings() {
        checkWithNullUrlInitialized();
        if (getCurWebView() != null) {
            return getCurWebView().getSettings();
        }
        a.h("SuperWebview getSettings method in, but WebView is null.");
        return null;
    }

    public final String getUrl() {
        checkWithNullUrlInitialized();
        if (getCurAPIView() != null) {
            return getCurAPIView().getUrl();
        }
        if (this.k != null) {
            a.h("SuperWebview getUrl method in, but WebView is null. return mStartUrl. ");
            return this.k;
        }
        a.h("SuperWebview getUrl method in, but WebView is null.");
        return null;
    }

    public final String getUserAgent() {
        checkWithNullUrlInitialized();
        return com.deepe.c.k.k.b(getCurWebView());
    }

    public final ViewGroup getViewGroup() {
        return this;
    }

    public final String getWindowName() {
        return getCurWindow() != null ? getCurWindow().v() : "";
    }

    public final void goBack() {
        if (getCurWebView() != null) {
            getCurWebView().goBack();
        } else {
            a.h("SuperWebview goBack method in, but WebView is null.");
        }
    }

    public final void goBackOrForward(int i) {
        if (getCurWebView() != null) {
            getCurWebView().goBackOrForward(i);
        } else {
            a.h("SuperWebview goBackOrForward method in, but WebView is null.");
        }
    }

    public final void goForward() {
        if (getCurWebView() != null) {
            getCurWebView().goForward();
        } else {
            a.h("SuperWebview goForward method in, but WebView is null.");
        }
    }

    public final boolean isInitialized() {
        return this.f;
    }

    public final boolean isWebClientNull() {
        return getCurWebView() == null;
    }

    public final boolean isWebviewNull() {
        return getCurAPIView() == null;
    }

    public final void loadDataWithBaseURL(String str, String str2, String str3, String str4, String str5) {
        checkWithNullUrlInitialized();
        if (getCurWebView() == null) {
            a.h("SuperWebview loadDataWithBaseURL method in, but WebView is null.");
            return;
        }
        getCurWebView().loadDataWithBaseURL(str, str2, str3, str4, str5);
        if (a.a) {
            a.f("SuperWebview@" + hashCode() + " loadDataWithBaseURL: " + str2);
        }
    }

    public final void loadUrl(String str) {
        if (doSpecialScheme(str)) {
            return;
        }
        if (!this.h) {
            this.j = str;
            return;
        }
        if (a.a) {
            Activity a = com.deepe.c.a.a.a(getContext());
            StringBuilder sb = new StringBuilder("SuperWebview@");
            sb.append(hashCode());
            sb.append("|");
            sb.append(a != null ? Integer.valueOf(a.hashCode()) : "null");
            sb.append(" loadUrl: ");
            sb.append(str);
            a.f(sb.toString());
        }
        this.k = str;
        if (this.i != null) {
            if (a.a) {
                a.f("SuperWebview@" + hashCode() + " loadUrl mTablayoutInfo is not null.");
            }
            realStart();
            return;
        }
        checkWithNullUrlInitialized();
        if (getCurAPIView() == null) {
            a.h("SuperWebview loadUrl method in, but WebView is null.");
            return;
        }
        String makeRealUrlAndSuperViewIfNeeded = makeRealUrlAndSuperViewIfNeeded(str);
        if (makeRealUrlAndSuperViewIfNeeded != null) {
            getCurAPIView().a(makeRealUrlAndSuperViewIfNeeded, (com.uzmap.pkg.b.f.c) null);
        }
    }

    public final boolean onActivityResult(int i, int i2, Intent intent) {
        if (a.a) {
            a.f("SuperWebview@" + hashCode() + " onActivityResult: " + i + ", " + i2 + ", " + com.uzmap.pkg.b.f.a.a(intent));
        }
        return this.b.a(i, i2, intent);
    }

    @Override
    protected void onAttachedToWindow() {
        this.h = true;
        super.onAttachedToWindow();
        if (a.a) {
            a.f("SuperWebview@" + hashCode() + " onAttachedToWindow... " + this.j);
        }
        if (this.j != null) {
            post(new Runnable() {
                @Override
                public void run() {
                    SuperWebview superWebview = SuperWebview.this;
                    superWebview.loadUrl(superWebview.j);
                    SuperWebview.this.j = null;
                }
            });
        }
    }

    public final void onNetworkChanged(boolean z, String str) {
        this.a.a(z, str);
    }

    public final void onPause() {
        h hVar = this.a;
        if (hVar != null) {
            hVar.k();
        }
    }

    public final boolean onRequestPermissionsResult(int i, String[] strArr, int[] iArr) {
        if (a.a) {
            a.f("SuperWebview@" + hashCode() + " onRequestPermissionsResult: " + i + ", " + strArr + ", " + iArr);
        }
        return this.b.a(i, strArr, iArr, new Object[0]);
    }

    public final void onResume() {
        h hVar = this.a;
        if (hVar != null) {
            hVar.l();
        }
    }

    @Override
    protected void onWindowVisibilityChanged(int i) {
        super.onWindowVisibilityChanged(i);
        h hVar = this.a;
        if (hVar == null) {
            return;
        }
        if (8 == i) {
            hVar.g();
        } else if (i == 0) {
            hVar.f();
        }
    }

    public final void postUrl(String str, byte[] bArr) {
        checkWithNullUrlInitialized();
        if (getCurWebView() != null) {
            getCurWebView().postUrl(str, bArr);
        } else {
            a.h("SuperWebview postUrl method in, but WebView is null.");
        }
    }

    public final void reload() {
        checkWithNullUrlInitialized();
        if (getCurWebView() != null) {
            getCurWebView().reload();
        } else {
            a.h("SuperWebview reload method in, but WebView is null.");
        }
    }

    public final void removeAllHtml5EventListener() {
        APIEventCenter.get().removeAllHtml5EventListener(getContext());
    }

    public final void removeHtml5EventListener(Html5EventListener html5EventListener) {
        if (html5EventListener == null) {
            return;
        }
        APIEventCenter.get().removeHtml5EventListener(getContext(), html5EventListener);
    }

    public final void sendEvent(EventEntity eventEntity) {
        if (this.a != null) {
            com.uzmap.pkg.uzcore.uzmodule.b.e eVar = new com.uzmap.pkg.uzcore.uzmodule.b.e(null, null);
            eVar.c = eventEntity.name;
            eVar.b = eventEntity.extra;
            this.a.a(eVar);
        }
    }

    public final void sendEventToHtml5(String str, JSONObject jSONObject) {
        sendEvent(new EventEntity(str, jSONObject));
    }

    public final void setAcceptClient(boolean z) {
        this.e = z;
    }

    public final void setApiListener(APIListener aPIListener) {
        this.c.setApiClient(aPIListener);
    }

    public final void setChromeListener(ChromeListener chromeListener) {
        this.c.setChromeListener(chromeListener);
    }

    @Override
    public final void setForceDarkAllowed(boolean z) {
        if (Build.VERSION.SDK_INT >= 29) {
            this.l = Boolean.valueOf(z);
            checkWithNullUrlInitialized();
            if (getCurWebView() != null) {
                getCurWebView().setForceDarkAllowed(this.l.booleanValue());
            }
        }
    }

    public final void setImmerseState(boolean z) {
        this.c.setImmerseState(Boolean.valueOf(z));
    }

    public final void setInnerMode(boolean z) {
        this.c.setInnerMode(z);
        if (a.a) {
            a.f("SuperWebview@" + hashCode() + " setInnerMode: " + z);
        }
    }

    public final void setOpenInfo(Object obj) {
        tryToTablayoutInfo(obj);
    }

    public final void setPullRefreshListener(PullRefreshListener pullRefreshListener) {
        checkWithNullUrlInitialized();
        if (getCurFrame() != null) {
            getCurFrame().a(pullRefreshListener);
        }
    }

    public final void setRefreshFooterEnable(boolean z) {
        checkWithNullUrlInitialized();
        if (getCurFrame() != null) {
            getCurFrame().d(z);
        } else {
            a.h("SuperWebview setRefreshFooterEnable method in, but WebView is null.");
        }
    }

    public final void setRefreshHeaderEnable(boolean z) {
        checkWithNullUrlInitialized();
        if (getCurFrame() != null) {
            getCurFrame().c(z);
        } else {
            a.h("SuperWebview setRefreshHeaderEnable method in, but WebView is null.");
        }
    }

    public final void setSupportZoom(boolean z) {
        checkWithNullUrlInitialized();
        if (getCurAPIView() != null) {
            getCurAPIView().a(z);
        } else {
            a.h("SuperWebview setSupportZoom method in, but WebView is null.");
        }
    }

    public final void setTNSRes(String str) {
        setWebShare("yonyou_tns", str);
    }

    public final void setUserAgent(String str) {
        checkWithNullUrlInitialized();
        com.deepe.c.k.k.b(getCurWebView(), str);
    }

    public final void setWebShare(String str, Object obj) {
        WebShare.setGlobalData(str, obj);
    }

    public final void setWebviewBackgroundColor(int i) {
        checkWithNullUrlInitialized();
        if (getCurWebView() != null) {
            getCurWebView().setBackgroundColor(i);
        } else {
            a.h("SuperWebview setBackgroundColor method in, but WebView is null.");
        }
    }

    public final void setWebviewHorizontalScrollBarEnabled(boolean z) {
        checkWithNullUrlInitialized();
        if (getCurWebView() != null) {
            getCurWebView().setHorizontalScrollBarEnabled(z);
        } else {
            a.h("SuperWebview setHorizontalScrollBarEnabled method in, but WebView is null.");
        }
    }

    public final void setWebviewOnLongClickListener(View.OnLongClickListener onLongClickListener) {
        checkWithNullUrlInitialized();
        if (getCurWebView() != null) {
            getCurWebView().setOnLongClickListener(onLongClickListener);
        } else {
            a.h("SuperWebview setOnLongClickListener method in, but WebView is null.");
        }
    }

    public final void setWebviewOverScrollMode(int i) {
        checkWithNullUrlInitialized();
        if (getCurWebView() != null) {
            getCurWebView().setOverScrollMode(i);
        } else {
            a.h("SuperWebview setOverScrollMode method in, but WebView is null.");
        }
    }

    public final void setWebviewVerticalScrollBarEnabled(boolean z) {
        checkWithNullUrlInitialized();
        if (getCurWebView() != null) {
            getCurWebView().setVerticalScrollBarEnabled(z);
        } else {
            a.h("SuperWebview setVerticalScrollBarEnabled method in, but WebView is null.");
        }
    }

    public void start() {
        start(null);
    }

    public void start(String str) {
        com.uzmap.pkg.uzcore.b.d dVar;
        com.uzmap.pkg.uzcore.b.d dVar2;
        if (a.a) {
            a.f("SuperWebview@" + hashCode() + " start: " + str);
        }
        if (doSpecialScheme(str)) {
            return;
        }
        String defaultStartUrl = getDefaultStartUrl();
        if (TextUtils.isEmpty(str)) {
            dVar2 = com.uzmap.pkg.uzcore.b.d.c(defaultStartUrl, null);
        } else {
            com.uzmap.pkg.uzcore.uzmodule.f a = com.uzmap.pkg.uzcore.uzmodule.f.a(str);
            String d = x.d(str);
            if (k.d(d)) {
                dVar = com.uzmap.pkg.uzcore.b.d.j(d);
                if (dVar != null && a != null && dVar.A == null) {
                    dVar.A = a;
                }
            } else {
                dVar = null;
            }
            this.k = str;
            defaultStartUrl = str;
            dVar2 = dVar;
        }
        if (dVar2 == null) {
            dVar2 = com.uzmap.pkg.uzcore.b.d.c(ifNeededTransUrl(defaultStartUrl), null);
        }
        initialize(dVar2);
        realStart();
        if (a.a) {
            a.f("SuperWebview@" + hashCode() + " final start: " + dVar2.b());
        }
    }

    public final void stopLoading() {
        checkWithNullUrlInitialized();
        if (getCurWebView() != null) {
            getCurWebView().stopLoading();
        } else {
            a.h("SuperWebview stopLoading method in, but WebView is null.");
        }
    }

    public boolean windowBack() {
        if (this.a == null) {
            return false;
        }
        if (!shouldOverrideKeyPress(q.a.BACK)) {
            return this.a.h();
        }
        this.a.a(q.a.BACK, false);
        return true;
    }

    public boolean windowCanBack() {
        if (this.a == null) {
            return false;
        }
        if (shouldOverrideKeyPress(q.a.BACK)) {
            return true;
        }
        return this.a.j();
    }
}