导航菜单

页面标题

页面副标题

bbinstant v6.24.0 - BannerClickWebView.java 源代码

正在查看: bbinstant v6.24.0 应用的 BannerClickWebView.java JAVA 源代码文件

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


package com.bigbasket.bbinstant.ui.invoice;

import android.app.AlertDialog;
import android.content.DialogInterface;
import android.net.http.SslError;
import android.os.Bundle;
import android.view.View;
import android.webkit.SslErrorHandler;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import com.amazon.identity.auth.device.authorization.AuthorizationResponseParser;
import com.amazonaws.services.s3.internal.Constants;
import com.bigbasket.bbinstant.ui.BaseActivity;
import com.bigbasket.bbinstant.ui.invoice.BannerClickWebView;
import kotlin.jvm.internal.v;

public final class BannerClickWebView extends BaseActivity {

    public static final class a extends WebViewClient {
        a() {
        }

        public static final void onReceivedSslError$lambda$0(SslErrorHandler sslErrorHandler, DialogInterface dialogInterface, int i) {
            v.checkNotNullParameter(sslErrorHandler, "$handler");
            sslErrorHandler.proceed();
        }

        public static final void onReceivedSslError$lambda$1(SslErrorHandler sslErrorHandler, DialogInterface dialogInterface, int i) {
            v.checkNotNullParameter(sslErrorHandler, "$handler");
            sslErrorHandler.cancel();
        }

        @Override
        public void onReceivedError(WebView webView, int i, String str, String str2) {
            v.checkNotNullParameter(webView, "view");
            v.checkNotNullParameter(str, "description");
            v.checkNotNullParameter(str2, "failingUrl");
        }

        @Override
        public void onReceivedSslError(WebView webView, final SslErrorHandler sslErrorHandler, SslError sslError) {
            v.checkNotNullParameter(sslErrorHandler, "handler");
            v.checkNotNullParameter(sslError, AuthorizationResponseParser.ERROR);
            StringBuilder sb = new StringBuilder();
            sb.append(sslErrorHandler.toString());
            sb.append("error:");
            sb.append(sslError);
            AlertDialog.Builder builder = new AlertDialog.Builder(BannerClickWebView.this);
            builder.setMessage("Something went wrong");
            builder.setPositiveButton("Continue", new DialogInterface.OnClickListener() {
                @Override
                public final void onClick(DialogInterface dialogInterface, int i) {
                    BannerClickWebView.a.onReceivedSslError$lambda$0(sslErrorHandler, dialogInterface, i);
                }
            });
            builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
                @Override
                public final void onClick(DialogInterface dialogInterface, int i) {
                    BannerClickWebView.a.onReceivedSslError$lambda$1(sslErrorHandler, dialogInterface, i);
                }
            });
            AlertDialog create = builder.create();
            v.checkNotNullExpressionValue(create, "builder.create()");
            create.show();
        }

        @Override
        public boolean shouldOverrideUrlLoading(WebView webView, String str) {
            v.checkNotNullParameter(webView, "view");
            v.checkNotNullParameter(str, Constants.URL_ENCODING);
            webView.loadUrl(str);
            return true;
        }
    }

    @Override
    protected void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        setContentView(2131558474);
        String stringExtra = getIntent().getStringExtra(Constants.URL_ENCODING);
        View findViewById = findViewById(2131362818);
        v.checkNotNull(findViewById, "null cannot be cast to non-null type android.webkit.WebView");
        WebView webView = (WebView) findViewById;
        webView.setWebViewClient(new a());
        webView.getSettings().setJavaScriptEnabled(true);
        webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
        webView.getSettings().setUseWideViewPort(true);
        webView.getSettings().setDomStorageEnabled(true);
        webView.getSettings().setLoadWithOverviewMode(true);
        if (stringExtra != null) {
            webView.loadUrl(stringExtra);
        }
    }
}