导航菜单

页面标题

页面副标题

pg 娱乐 v1.0.7.202506242308 - WebViewActivity.java 源代码

正在查看: pg 娱乐 v1.0.7.202506242308 应用的 WebViewActivity.java JAVA 源代码文件

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


package com.yueyi.container.ui.web;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.DownloadListener;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.widget.ImageView;
import androidx.appcompat.app.AppCompatActivity;
import com.blankj.utilcode.util.ScreenUtils;
import com.lzf.easyfloat.EasyFloat;
import com.lzf.easyfloat.interfaces.OnInvokeView;
import com.yueyi.container.R;
import io.ktor.http.LinkHeader;
import kotlin.Metadata;
import kotlin.jvm.internal.Intrinsics;

@Metadata(d1 = {"\u00008\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\u000b\n\u0000\n\u0002\u0010\u000e\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\u0018\u00002\u00020\u0001B\u0005¢\u0006\u0002\u0010\u0002J\b\u0010\u0010\u001a\u00020\u0011H\u0002J\b\u0010\u0012\u001a\u00020\u0011H\u0016J\u0012\u0010\u0013\u001a\u00020\u00112\b\u0010\u0014\u001a\u0004\u0018\u00010\u0015H\u0014J\b\u0010\u0016\u001a\u00020\u0011H\u0014J\b\u0010\u0017\u001a\u00020\u0011H\u0014R\u001a\u0010\u0003\u001a\u00020\u0004X\u0086.¢\u0006\u000e\n\u0000\u001a\u0004\b\u0005\u0010\u0006\"\u0004\b\u0007\u0010\bR\u000e\u0010\t\u001a\u00020\nX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u000b\u001a\u00020\fX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\r\u001a\u00020\fX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u000e\u001a\u00020\u000fX\u0082.¢\u0006\u0002\n\u0000¨\u0006\u0018"}, d2 = {"Lcom/yueyi/container/ui/web/WebViewActivity;", "Landroidx/appcompat/app/AppCompatActivity;", "()V", "floatButton", "Landroid/view/View;", "getFloatButton", "()Landroid/view/View;", "setFloatButton", "(Landroid/view/View;)V", "isLandscape", "", "mTitle", "", "mUrl", "webView", "Landroid/webkit/WebView;", "initData", "", "onBackPressed", "onCreate", "savedInstanceState", "Landroid/os/Bundle;", "onPause", "onResume", "app_kaiyuanRelease"}, k = 1, mv = {1, 8, 0}, xi = 48)
public final class WebViewActivity extends AppCompatActivity {
    public View floatButton;
    private boolean isLandscape;
    private WebView webView;
    private String mUrl = "";
    private String mTitle = "";

    public final View getFloatButton() {
        View view = this.floatButton;
        if (view != null) {
            return view;
        }
        Intrinsics.throwUninitializedPropertyAccessException("floatButton");
        return null;
    }

    public final void setFloatButton(View view) {
        Intrinsics.checkNotNullParameter(view, "<set-?>");
        this.floatButton = view;
    }

    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        ScreenUtils.toggleFullScreen((Activity) this);
        setContentView(R.layout.activity_container);
        View inflate = LayoutInflater.from((Context) this).inflate(R.layout.item_back, (ViewGroup) null, false);
        Intrinsics.checkNotNullExpressionValue(inflate, "from(this).inflate(R.lay…t.item_back, null, false)");
        setFloatButton(inflate);
        getFloatButton().setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                WebViewActivity.onCreate$lambda$0(WebViewActivity.this, view);
            }
        });
        ((ImageView) findViewById(R.id.splash)).setVisibility(8);
        initData();
    }

    public static final void onCreate$lambda$0(WebViewActivity this$0, View view) {
        Intrinsics.checkNotNullParameter(this$0, "this$0");
        this$0.onBackPressed();
    }

    private final void initData() {
        String stringExtra = getIntent().getStringExtra("url");
        if (stringExtra == null) {
            stringExtra = "";
        }
        this.mUrl = stringExtra;
        String stringExtra2 = getIntent().getStringExtra(LinkHeader.Parameters.Title);
        this.mTitle = stringExtra2 != null ? stringExtra2 : "";
        boolean booleanExtra = getIntent().getBooleanExtra("isLandscape", false);
        this.isLandscape = booleanExtra;
        if (booleanExtra) {
            ScreenUtils.setLandscape((Activity) this);
        }
        View findViewById = findViewById(R.id.web_view);
        Intrinsics.checkNotNullExpressionValue(findViewById, "findViewById(R.id.web_view)");
        WebView webView = (WebView) findViewById;
        this.webView = webView;
        WebViewActivity webViewActivity = this;
        if (webView == null) {
            Intrinsics.throwUninitializedPropertyAccessException("webView");
            webView = null;
        }
        WebView initWebView = CommonJavaScriptInterfaceKt.initWebView(webViewActivity, webView);
        initWebView.setWebChromeClient(new WebChromeClient() {
            @Override
            public void onReceivedTitle(WebView webView2, String title) {
                String str;
                super.onReceivedTitle(webView2, title);
                str = WebViewActivity.this.mTitle;
                str.length();
            }
        });
        initWebView.loadUrl(this.mUrl);
        initWebView.setDownloadListener(new DownloadListener() {
            @Override
            public final void onDownloadStart(String str, String str2, String str3, String str4, long j) {
                WebViewActivity.initData$lambda$2$lambda$1(WebViewActivity.this, str, str2, str3, str4, j);
            }
        });
    }

    public static final void initData$lambda$2$lambda$1(WebViewActivity this$0, String str, String str2, String str3, String str4, long j) {
        Intrinsics.checkNotNullParameter(this$0, "this$0");
        Intent intent = new Intent("android.intent.action.VIEW");
        intent.setData(Uri.parse(str));
        this$0.startActivity(intent);
    }

    protected void onResume() {
        super.onResume();
        WebView webView = this.webView;
        if (webView == null) {
            Intrinsics.throwUninitializedPropertyAccessException("webView");
            webView = null;
        }
        webView.onResume();
        EasyFloat.Builder.setLayout$default(EasyFloat.INSTANCE.with((Context) this), getFloatButton(), (OnInvokeView) null, 2, (Object) null).setDragEnable(true).show();
    }

    protected void onPause() {
        super.onPause();
        WebView webView = this.webView;
        if (webView == null) {
            Intrinsics.throwUninitializedPropertyAccessException("webView");
            webView = null;
        }
        webView.onPause();
    }

    public void onBackPressed() {
        WebView webView = this.webView;
        WebView webView2 = null;
        if (webView == null) {
            Intrinsics.throwUninitializedPropertyAccessException("webView");
            webView = null;
        }
        if (webView.canGoBack()) {
            WebView webView3 = this.webView;
            if (webView3 == null) {
                Intrinsics.throwUninitializedPropertyAccessException("webView");
            } else {
                webView2 = webView3;
            }
            webView2.goBack();
            return;
        }
        finish();
    }
}