导航菜单

页面标题

页面副标题

小柿子 v1.3.8 - b.java 源代码

正在查看: 小柿子 v1.3.8 应用的 b.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package q3;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.ComponentName;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.ResolveInfo;
import android.graphics.Bitmap;
import android.net.Uri;
import android.net.http.SslError;
import android.os.Build;
import android.webkit.DownloadListener;
import android.webkit.SslErrorHandler;
import android.webkit.ValueCallback;
import android.webkit.WebChromeClient;
import android.webkit.WebResourceError;
import android.webkit.WebResourceRequest;
import android.webkit.WebResourceResponse;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import com.ss.android.download.api.constant.BaseConstants;
import java.util.Iterator;

public class b {
    public Activity a;
    public WebView b;
    public ValueCallback<Uri> d;
    public ValueCallback<Uri[]> e;
    public WebViewClient c = new a();
    public WebChromeClient f = new C0231b();

    public class C0231b extends WebChromeClient {
        public C0231b() {
        }

        @Override
        public void onProgressChanged(WebView webView, int i) {
            super.onProgressChanged(webView, i);
            b.this.a.isFinishing();
        }

        @Override
        public void onReceivedTitle(WebView webView, String str) {
            if (str == null || str.equals("")) {
                return;
            }
            b.this.a.setTitle(str);
        }

        @Override
        public boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> valueCallback, WebChromeClient.FileChooserParams fileChooserParams) {
            b bVar = b.this;
            bVar.e = valueCallback;
            bVar.a();
            return true;
        }
    }

    public class c implements DownloadListener {
        public c() {
        }

        @Override
        public void onDownloadStart(String str, String str2, String str3, String str4, long j) {
            StringBuilder sb = new StringBuilder();
            sb.append("onReceivedError.onDownloadStart=");
            sb.append(str);
            Intent intent = new Intent();
            intent.setAction("android.intent.action.VIEW");
            intent.addCategory("android.intent.category.BROWSABLE");
            intent.setData(Uri.parse(str));
            b bVar = b.this;
            if (bVar.d(bVar.a, intent)) {
                intent.setComponent(new ComponentName(BaseConstants.KLLK_PROMOTION_NORMAL_PKG_INFO, "com.android.browser.BrowserActivity"));
            }
            b.this.a.startActivity(intent);
        }
    }

    public final void a() {
        Intent intent = new Intent("android.intent.action.GET_CONTENT");
        intent.addCategory("android.intent.category.OPENABLE");
        intent.setType("image/*");
        this.a.startActivityForResult(Intent.createChooser(intent, "Image Chooser"), 12);
    }

    public void b(Activity activity, WebView webView) {
        this.a = activity;
        this.b = webView;
        WebSettings settings = webView.getSettings();
        settings.setJavaScriptEnabled(true);
        settings.setDomStorageEnabled(true);
        settings.setAppCacheMaxSize(8388608L);
        settings.setAllowFileAccess(true);
        settings.setAppCacheEnabled(true);
        settings.setAppCachePath(activity.getApplication().getCacheDir().getAbsolutePath());
        settings.setDatabaseEnabled(true);
        settings.setUseWideViewPort(true);
        settings.setLoadWithOverviewMode(true);
        settings.setSupportZoom(true);
        settings.setBuiltInZoomControls(true);
        settings.setDisplayZoomControls(false);
        settings.setTextZoom(100);
        settings.setCacheMode(2);
        settings.setAllowFileAccess(true);
        settings.setJavaScriptCanOpenWindowsAutomatically(true);
        settings.setLoadsImagesAutomatically(true);
        settings.setDefaultTextEncodingName("utf-8");
        settings.setBlockNetworkImage(false);
        settings.setUseWideViewPort(true);
        if (Build.VERSION.SDK_INT >= 21) {
            settings.setMixedContentMode(0);
        }
        webView.setWebChromeClient(this.f);
        webView.setWebViewClient(this.c);
        webView.setDownloadListener(new c());
    }

    public final boolean d(Context context, Intent intent) {
        Iterator<ResolveInfo> it = context.getPackageManager().queryIntentActivities(intent, 65536).iterator();
        while (it.hasNext()) {
            if (it.next().activityInfo.packageName.contains(BaseConstants.KLLK_PROMOTION_NORMAL_PKG_INFO)) {
                return true;
            }
        }
        return false;
    }

    public class a extends WebViewClient {

        public class DialogInterfaceOnClickListenerC0230a implements DialogInterface.OnClickListener {
            public final Activity a;

            public DialogInterfaceOnClickListenerC0230a(Activity activity) {
                this.a = activity;
            }

            @Override
            public void onClick(DialogInterface dialogInterface, int i) {
                this.a.startActivity(new Intent("android.intent.action.VIEW", Uri.parse("https://d.alipay.com")));
            }
        }

        public a() {
        }

        @Override
        public void onPageFinished(WebView webView, String str) {
            super.onPageFinished(webView, str);
            b.this.a.isFinishing();
        }

        @Override
        public void onPageStarted(WebView webView, String str, Bitmap bitmap) {
            super.onPageStarted(webView, str, bitmap);
        }

        @Override
        public void onReceivedError(WebView webView, WebResourceRequest webResourceRequest, WebResourceError webResourceError) {
            int errorCode = webResourceError.getErrorCode();
            StringBuilder sb = new StringBuilder();
            sb.append("onReceivedError.errCode=");
            sb.append(errorCode);
            if (errorCode != 400) {
                return;
            }
            webView.loadUrl("file:///android_assets/error_handle.html");
        }

        @Override
        public void onReceivedHttpError(WebView webView, WebResourceRequest webResourceRequest, WebResourceResponse webResourceResponse) {
        }

        @Override
        public void onReceivedSslError(WebView webView, SslErrorHandler sslErrorHandler, SslError sslError) {
            sslErrorHandler.proceed();
        }

        @Override
        public boolean shouldOverrideUrlLoading(WebView webView, String str) {
            StringBuilder sb = new StringBuilder();
            sb.append("onReceivedError.shouldOverrideUrlLoading=");
            sb.append(str);
            if (b.this.a.isFinishing()) {
                return true;
            }
            Activity activity = b.this.a;
            if (str.startsWith("alipays:") || str.startsWith("alipay")) {
                try {
                    activity.startActivity(new Intent("android.intent.action.VIEW", Uri.parse(str)));
                } catch (Exception unused) {
                    new AlertDialog.Builder(activity).setMessage("未检测到支付宝客户端,请安装后重试。").setPositiveButton("立即安装", new DialogInterfaceOnClickListenerC0230a(activity)).setNegativeButton("取消", (DialogInterface.OnClickListener) null).show();
                }
                return true;
            }
            if (str.startsWith("weixin:")) {
                Intent intent = new Intent();
                intent.setAction("android.intent.action.VIEW");
                intent.setData(Uri.parse(str));
                activity.startActivity(intent);
                return true;
            }
            if (str.startsWith("http") || str.startsWith(BaseConstants.SCHEME_HTTPS)) {
                return false;
            }
            try {
                Intent parseUri = Intent.parseUri(str, 1);
                parseUri.setFlags(805306368);
                parseUri.addCategory("android.intent.category.BROWSABLE");
                parseUri.setComponent(null);
                activity.startActivity(parseUri);
                return true;
            } catch (Exception e) {
                e.printStackTrace();
                return true;
            }
        }

        @Override
        public boolean shouldOverrideUrlLoading(WebView webView, WebResourceRequest webResourceRequest) {
            return super.shouldOverrideUrlLoading(webView, webResourceRequest);
        }
    }
}