导航菜单

页面标题

页面副标题

Rilo v2.0.21 - GameWebViewActivity.java 源代码

正在查看: Rilo v2.0.21 应用的 GameWebViewActivity.java JAVA 源代码文件

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


package app.callpe.ui.user.games.common;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.webkit.JavascriptInterface;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ProgressBar;
import androidx.appcompat.app.AppCompatActivity;
import app.callpe.common.utils.custom.EnhancedWebView;
import app.callpe.databinding.ActivityGameWebViewBinding;
import app.callpe.ui.payment.WalletActivity;
import com.facebook.internal.NativeProtocol;
import kotlin.Metadata;
import kotlin.jvm.internal.Intrinsics;
import org.json.JSONObject;
import timber.log.Timber;

@Metadata(d1 = {"\u0000\"\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0004\u0018\u00002\u00020\u0001:\u0001\fB\u0005¢\u0006\u0002\u0010\u0002J\b\u0010\u0005\u001a\u00020\u0006H\u0003J\u0012\u0010\u0007\u001a\u00020\u00062\b\u0010\b\u001a\u0004\u0018\u00010\tH\u0014J\b\u0010\n\u001a\u00020\u0006H\u0014J\b\u0010\u000b\u001a\u00020\u0006H\u0002R\u000e\u0010\u0003\u001a\u00020\u0004X\u0082.¢\u0006\u0002\n\u0000¨\u0006\r"}, d2 = {"Lapp/callpe/ui/user/games/common/GameWebViewActivity;", "Landroidx/appcompat/app/AppCompatActivity;", "()V", "binding", "Lapp/callpe/databinding/ActivityGameWebViewBinding;", "initViews", "", "onCreate", "savedInstanceState", "Landroid/os/Bundle;", "onResume", "setupDefaultSettings", "WebAppInterface", "app_riloRelease"}, k = 1, mv = {1, 8, 0}, xi = 48)
public final class GameWebViewActivity extends AppCompatActivity {
    private ActivityGameWebViewBinding binding;

    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        ActivityGameWebViewBinding inflate = ActivityGameWebViewBinding.inflate(getLayoutInflater());
        Intrinsics.checkNotNullExpressionValue(inflate, "inflate(layoutInflater)");
        this.binding = inflate;
        if (inflate == null) {
            Intrinsics.throwUninitializedPropertyAccessException("binding");
            inflate = null;
        }
        setContentView((View) inflate.getRoot());
    }

    private final void initViews() {
        String str;
        Intent intent = getIntent();
        if (intent == null || (str = intent.getStringExtra("url")) == null) {
            str = "";
        }
        Timber.i("url " + str, new Object[0]);
        ActivityGameWebViewBinding activityGameWebViewBinding = this.binding;
        if (activityGameWebViewBinding == null) {
            Intrinsics.throwUninitializedPropertyAccessException("binding");
            activityGameWebViewBinding = null;
        }
        EnhancedWebView enhancedWebView = activityGameWebViewBinding.webView;
        enhancedWebView.getSettings().setJavaScriptEnabled(true);
        setupDefaultSettings();
        enhancedWebView.addJavascriptInterface(new WebAppInterface(), "AppInterface");
        enhancedWebView.setWebViewClient(new WebViewClient() {
            @Override
            public void onPageFinished(WebView view, String url) {
                ActivityGameWebViewBinding activityGameWebViewBinding2;
                super.onPageFinished(view, url);
                activityGameWebViewBinding2 = GameWebViewActivity.this.binding;
                if (activityGameWebViewBinding2 == null) {
                    Intrinsics.throwUninitializedPropertyAccessException("binding");
                    activityGameWebViewBinding2 = null;
                }
                ProgressBar progressBar = activityGameWebViewBinding2.progress;
                Intrinsics.checkNotNullExpressionValue(progressBar, "binding.progress");
                progressBar.setVisibility(8);
            }
        });
        enhancedWebView.injectTokenAndLoadUrl(str);
    }

    private final void setupDefaultSettings() {
        ActivityGameWebViewBinding activityGameWebViewBinding = this.binding;
        if (activityGameWebViewBinding == null) {
            Intrinsics.throwUninitializedPropertyAccessException("binding");
            activityGameWebViewBinding = null;
        }
        EnhancedWebView enhancedWebView = activityGameWebViewBinding.webView;
        enhancedWebView.getSettings().setLoadWithOverviewMode(true);
        enhancedWebView.getSettings().setUseWideViewPort(true);
        enhancedWebView.getSettings().setSupportZoom(true);
        enhancedWebView.getSettings().setBuiltInZoomControls(true);
        enhancedWebView.getSettings().setDisplayZoomControls(false);
        enhancedWebView.getSettings().setDomStorageEnabled(true);
        enhancedWebView.getSettings().setAllowFileAccess(true);
    }

    @Metadata(d1 = {"\u0000\u001a\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0000\b\u0086\u0004\u0018\u00002\u00020\u0001B\u0005¢\u0006\u0002\u0010\u0002J\b\u0010\u0003\u001a\u00020\u0004H\u0007J\u0012\u0010\u0005\u001a\u00020\u00042\b\u0010\u0006\u001a\u0004\u0018\u00010\u0007H\u0007¨\u0006\b"}, d2 = {"Lapp/callpe/ui/user/games/common/GameWebViewActivity$WebAppInterface;", "", "(Lapp/callpe/ui/user/games/common/GameWebViewActivity;)V", "handleWALLET_UPDATE", "", "onButtonClick", NativeProtocol.WEB_DIALOG_PARAMS, "", "app_riloRelease"}, k = 1, mv = {1, 8, 0}, xi = 48)
    public final class WebAppInterface {
        public WebAppInterface() {
        }

        @JavascriptInterface
        public final void onButtonClick(String params) {
            String str = params;
            if (str == null || str.length() == 0) {
                return;
            }
            JSONObject jSONObject = new JSONObject(params);
            Timber.e("param " + params, new Object[0]);
            String string = jSONObject.getString("onClick");
            jSONObject.getString("data");
            if (Intrinsics.areEqual(string, "BACK_BUTTON")) {
                GameWebViewActivity.this.finish();
            } else if (Intrinsics.areEqual(string, "TOPUP_CLICK")) {
                GameWebViewActivity.this.startActivity(new Intent((Context) GameWebViewActivity.this, (Class<?>) WalletActivity.class));
            }
        }

        @JavascriptInterface
        public final void handleWALLET_UPDATE() {
            Timber.d("Processing Handle Wallet Update", new Object[0]);
        }
    }

    protected void onResume() {
        super.onResume();
        initViews();
    }
}