导航菜单

页面标题

页面副标题

Cantique de Louanges v12 - AppLovinWebViewActivity.java 源代码

正在查看: Cantique de Louanges v12 应用的 AppLovinWebViewActivity.java JAVA 源代码文件

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


package com.applovin.sdk;

import android.app.Activity;
import android.net.Uri;
import android.os.Bundle;
import android.text.TextUtils;
import android.webkit.RenderProcessGoneDetail;
import android.webkit.WebSettings;
import android.webkit.WebView;
import com.applovin.impl.sdk.ab;
import com.applovin.impl.sdk.c.b;
import com.applovin.impl.sdk.n;
import com.applovin.impl.sdk.utils.StringUtils;
import com.applovin.impl.sdk.utils.u;
import com.applovin.impl.sdk.x;
import com.applovin.mediation.MaxReward;
import com.applovin.sdk.AppLovinWebViewActivity;
import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;

public class AppLovinWebViewActivity extends Activity {
    public static final String EVENT_DISMISSED_VIA_BACK_BUTTON = "dismissed_via_back_button";
    public static final String INTENT_EXTRA_KEY_IMMERSIVE_MODE_ON = "immersive_mode_on";
    public static final String INTENT_EXTRA_KEY_LOAD_URL = "load_url";
    public static final String INTENT_EXTRA_KEY_SDK_KEY = "sdk_key";
    public static final String URI_PATH_WEBVIEW_EVENT = "webview_event";
    private final AtomicBoolean aZB = new AtomicBoolean();
    private String aZC;
    private EventListener aZD;
    private WebView webView;

    class AnonymousClass1 extends ab {
        final n atm;

        AnonymousClass1(n nVar) {
            this.atm = nVar;
        }

        public void T(n nVar) {
            if (!((Boolean) nVar.a(b.aQq)).booleanValue() || !AppLovinWebViewActivity.this.aZB.compareAndSet(false, true)) {
                AppLovinWebViewActivity.this.finish();
                return;
            }
            AppLovinWebViewActivity.this.S(nVar);
            if (StringUtils.isValidString(AppLovinWebViewActivity.this.aZC)) {
                AppLovinWebViewActivity.this.webView.loadUrl(AppLovinWebViewActivity.this.aZC);
            }
        }

        @Override
        public boolean onRenderProcessGone(WebView webView, RenderProcessGoneDetail renderProcessGoneDetail) {
            if (AppLovinWebViewActivity.this.webView == webView) {
                AppLovinWebViewActivity.this.webView.destroy();
                AppLovinWebViewActivity.this.webView = null;
                AppLovinWebViewActivity appLovinWebViewActivity = AppLovinWebViewActivity.this;
                final n nVar = this.atm;
                appLovinWebViewActivity.runOnUiThread(new Runnable() {
                    @Override
                    public final void run() {
                        AppLovinWebViewActivity.AnonymousClass1.this.T(nVar);
                    }
                });
            }
            return super.onRenderProcessGone(webView, renderProcessGoneDetail);
        }

        @Override
        public boolean shouldOverrideUrlLoading(WebView webView, String str) {
            Uri parse = Uri.parse(str);
            String scheme = parse.getScheme();
            String host = parse.getHost();
            String path = parse.getPath();
            this.atm.BN();
            if (x.Fn()) {
                this.atm.BN().f("AppLovinWebViewActivity", "Handling url load: " + str);
            }
            if (!"applovin".equalsIgnoreCase(scheme) || !"com.applovin.sdk".equalsIgnoreCase(host) || AppLovinWebViewActivity.this.aZD == null) {
                return super.shouldOverrideUrlLoading(webView, str);
            }
            if (!path.endsWith(AppLovinWebViewActivity.URI_PATH_WEBVIEW_EVENT)) {
                return true;
            }
            Set<String> queryParameterNames = parse.getQueryParameterNames();
            String str2 = queryParameterNames.isEmpty() ? MaxReward.DEFAULT_LABEL : (String) queryParameterNames.toArray()[0];
            if (!StringUtils.isValidString(str2)) {
                this.atm.BN();
                if (!x.Fn()) {
                    return true;
                }
                this.atm.BN().i("AppLovinWebViewActivity", "Failed to parse WebView event parameter");
                return true;
            }
            String queryParameter = parse.getQueryParameter(str2);
            this.atm.BN();
            if (x.Fn()) {
                this.atm.BN().f("AppLovinWebViewActivity", "Parsed WebView event parameter name: " + str2 + " and value: " + queryParameter);
            }
            AppLovinWebViewActivity.this.aZD.onReceivedEvent(queryParameter);
            return true;
        }
    }

    public interface EventListener {
        void onReceivedEvent(String str);
    }

    public void S(n nVar) {
        WebView b5 = u.b(this, "WebView Activity");
        this.webView = b5;
        if (b5 == null) {
            finish();
            return;
        }
        setContentView(b5);
        WebSettings settings = this.webView.getSettings();
        settings.setSupportMultipleWindows(false);
        settings.setJavaScriptEnabled(true);
        this.webView.setVerticalScrollBarEnabled(true);
        this.webView.setHorizontalScrollBarEnabled(true);
        this.webView.setScrollBarStyle(33554432);
        this.webView.setWebViewClient(new AnonymousClass1(nVar));
    }

    public void loadUrl(String str, EventListener eventListener) {
        this.aZD = eventListener;
        this.aZC = str;
        this.aZB.set(false);
        WebView webView = this.webView;
        if (webView != null) {
            webView.loadUrl(str);
        }
    }

    @Override
    public void onBackPressed() {
        EventListener eventListener = this.aZD;
        if (eventListener != null) {
            eventListener.onReceivedEvent(EVENT_DISMISSED_VIA_BACK_BUTTON);
        }
        super.onBackPressed();
    }

    @Override
    protected void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        String stringExtra = getIntent().getStringExtra(INTENT_EXTRA_KEY_SDK_KEY);
        if (TextUtils.isEmpty(stringExtra)) {
            x.H("AppLovinWebViewActivity", "No SDK key specified");
            finish();
            return;
        }
        S(AppLovinSdk.getInstance(stringExtra, new AppLovinSdkSettings(getApplicationContext()), getApplicationContext()).a());
        if (getIntent().getBooleanExtra(INTENT_EXTRA_KEY_IMMERSIVE_MODE_ON, false)) {
            getWindow().getDecorView().setSystemUiVisibility(5894);
        }
        String stringExtra2 = getIntent().getStringExtra(INTENT_EXTRA_KEY_LOAD_URL);
        this.aZC = stringExtra2;
        if (StringUtils.isValidString(stringExtra2)) {
            this.webView.loadUrl(this.aZC);
        }
    }
}