大漢易經書院.apk(点击下载) / LTTabView.java


package com.lt.app.views;

import android.content.Context;
import android.os.Build;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.webkit.URLUtil;
import android.webkit.WebResourceRequest;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import com.lt.app.d;

public class LTTabView extends WebView {

    /* renamed from: ʻ  reason: contains not printable characters */
    private a f6314 = null;

    /* renamed from: ʼ  reason: contains not printable characters */
    private long f6315 = 0;

    public interface a {
        void onTabItemTapped(String str);
    }

    public LTTabView(Context context) {
        super(context);
        m8597();
    }

    public LTTabView(Context context, AttributeSet attributeSet) {
        super(context, attributeSet);
        m8597();
    }

    public LTTabView(Context context, AttributeSet attributeSet, int i) {
        super(context, attributeSet, i);
        m8597();
    }

    /* renamed from: ʻ  reason: contains not printable characters */
    public void m8600(String str) {
        if (!TextUtils.isEmpty(str)) {
            if (!URLUtil.isJavaScriptUrl(str)) {
                str = "javascript:" + str;
            }
            this.f6315 = System.currentTimeMillis();
            if (Build.VERSION.SDK_INT >= 19) {
                evaluateJavascript(str, null);
            } else {
                loadUrl(str);
            }
        }
    }

    /* renamed from: ʻ  reason: contains not printable characters */
    private void m8597() {
        removeJavascriptInterface("searchBoxJavaBridge_");
        removeJavascriptInterface("accessibility");
        removeJavascriptInterface("accessibilityTraversal");
        WebSettings settings = getSettings();
        settings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NARROW_COLUMNS);
        settings.setUseWideViewPort(true);
        settings.setLoadWithOverviewMode(true);
        settings.setJavaScriptEnabled(true);
        settings.setJavaScriptCanOpenWindowsAutomatically(true);
        settings.setSupportMultipleWindows(true);
        settings.setSupportZoom(false);
        settings.setBuiltInZoomControls(false);
        settings.setDefaultTextEncodingName("UTF-8");
        settings.setAppCacheEnabled(true);
        settings.setAllowFileAccess(false);
        settings.setDomStorageEnabled(true);
        settings.setSavePassword(false);
        setWebViewClient(new WebViewClient() {
            /* class com.lt.app.views.LTTabView.AnonymousClass1 */

            @Override // android.webkit.WebViewClient
            public boolean shouldOverrideUrlLoading(WebView webView, WebResourceRequest webResourceRequest) {
                if (System.currentTimeMillis() - LTTabView.this.f6315 < 250) {
                    return false;
                }
                if (Build.VERSION.SDK_INT < 21) {
                    return true;
                }
                LTTabView.this.m8599(webResourceRequest.getUrl().toString());
                return true;
            }

            @Override // android.webkit.WebViewClient
            public boolean shouldOverrideUrlLoading(WebView webView, String str) {
                if (System.currentTimeMillis() - LTTabView.this.f6315 < 250) {
                    return false;
                }
                LTTabView.this.m8599(str);
                return true;
            }
        });
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    /* renamed from: ʼ  reason: contains not printable characters */
    private void m8599(String str) {
        if (!TextUtils.isEmpty(str)) {
            if (str.startsWith("js:")) {
                str = "javascript:" + str.substring(3);
            }
            if (URLUtil.isHttpUrl(str) || URLUtil.isHttpsUrl(str) || URLUtil.isJavaScriptUrl(str) || str.startsWith("fs:")) {
                a aVar = this.f6314;
                if (aVar != null) {
                    aVar.onTabItemTapped(str);
                    return;
                }
                return;
            }
            d.m8547(getContext(), str, true);
        }
    }

    public void setLTTabViewListener(a aVar) {
        this.f6314 = aVar;
    }

    public void setContent(String str) {
        if (!TextUtils.isEmpty(str)) {
            if (URLUtil.isHttpUrl(str) || URLUtil.isHttpsUrl(str)) {
                loadUrl(str);
            } else {
                loadDataWithBaseURL(null, str, "text/html", "UTF-8", null);
            }
        }
    }
}