导航菜单

页面标题

页面副标题

Fancy Optimizer v4.6.3 - InneractiveInternalBrowserActivity.java 源代码

正在查看: Fancy Optimizer v4.6.3 应用的 InneractiveInternalBrowserActivity.java JAVA 源代码文件

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


package com.fyber.inneractive.sdk.activities;

import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import com.fyber.inneractive.sdk.R;
import com.fyber.inneractive.sdk.external.InneractiveAdSpot;
import com.fyber.inneractive.sdk.external.InneractiveAdSpotManager;
import com.fyber.inneractive.sdk.flow.k;
import com.fyber.inneractive.sdk.util.IAlog;
import com.fyber.inneractive.sdk.util.e0;
import com.fyber.inneractive.sdk.util.n;
import java.net.URLDecoder;

public class InneractiveInternalBrowserActivity extends Activity {
    public static final String EXTRA_KEY_SPOT_ID = "spotId";
    public static final String URL_EXTRA = "extra_url";
    public static String i;
    public static InternalBrowserListener j;
    public k a;
    public String b;
    public LinearLayout c;
    public WebView d;
    public ImageButton e;
    public ImageButton f;
    public ImageButton g;
    public ImageButton h;

    public interface InternalBrowserListener {
        void onApplicationInBackground();

        void onInternalBrowserDismissed();
    }

    public static void disableWebviewZoomControls(WebView webView) {
        webView.getSettings().setSupportZoom(true);
        webView.getSettings().setBuiltInZoomControls(true);
        webView.getSettings().setDisplayZoomControls(false);
    }

    public static void setHtmlExtra(String str) {
        i = str;
    }

    public static void setInternalBrowserListener(InternalBrowserListener internalBrowserListener) {
        j = internalBrowserListener;
    }

    public final View a() {
        this.c = new LinearLayout(this);
        this.c.setLayoutParams(new LinearLayout.LayoutParams(-1, -1));
        this.c.setOrientation(1);
        this.c.setContentDescription("IAInternalBrowserView");
        RelativeLayout relativeLayout = new RelativeLayout(this);
        relativeLayout.setLayoutParams(new LinearLayout.LayoutParams(-1, -2));
        this.c.addView(relativeLayout);
        LinearLayout linearLayout = new LinearLayout(this);
        linearLayout.setId(1);
        RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(-1, n.b(getResources().getInteger(R.integer.ia_ib_toolbar_height_dp)));
        layoutParams.addRule(12);
        linearLayout.setLayoutParams(layoutParams);
        linearLayout.setBackground(n.d(R.drawable.ia_ib_background));
        relativeLayout.addView(linearLayout);
        this.e = a(n.d(R.drawable.ia_ib_left_arrow));
        this.f = a(n.d(R.drawable.ia_ib_right_arrow));
        this.g = a(n.d(R.drawable.ia_ib_refresh));
        this.h = a(n.d(R.drawable.ia_ib_close));
        linearLayout.addView(this.e);
        linearLayout.addView(this.f);
        linearLayout.addView(this.g);
        linearLayout.addView(this.h);
        WebView webView = new WebView(this);
        this.d = webView;
        webView.setId(R.id.inneractive_webview_internal_browser);
        RelativeLayout.LayoutParams layoutParams2 = new RelativeLayout.LayoutParams(-1, -1);
        layoutParams2.addRule(2, 1);
        this.d.setLayoutParams(layoutParams2);
        relativeLayout.addView(this.d);
        return this.c;
    }

    @Override
    public void finish() {
        InternalBrowserListener internalBrowserListener = j;
        super.finish();
        if (internalBrowserListener != null) {
            internalBrowserListener.onInternalBrowserDismissed();
        }
    }

    @Override
    public void onBackPressed() {
        finish();
    }

    @Override
    public void onCreate(Bundle bundle) {
        InternalBrowserListener internalBrowserListener;
        InneractiveAdSpot spot;
        getWindow().requestFeature(2);
        getWindow().setFeatureInt(2, -1);
        super.onCreate(bundle);
        try {
            setContentView(a());
            String stringExtra = getIntent().getStringExtra("spotId");
            this.b = stringExtra;
            if (!TextUtils.isEmpty(stringExtra) && (spot = InneractiveAdSpotManager.get().getSpot(this.b)) != null) {
                this.a = spot.getAdContent();
            }
            Intent intent = getIntent();
            WebSettings settings = this.d.getSettings();
            boolean z10 = true;
            settings.setJavaScriptEnabled(true);
            settings.setSupportZoom(true);
            settings.setBuiltInZoomControls(true);
            settings.setUseWideViewPort(true);
            settings.setLoadWithOverviewMode(true);
            disableWebviewZoomControls(this.d);
            this.d.setWebViewClient(new a(this));
            this.d.setWebChromeClient(new b(this));
            String stringExtra2 = intent.getStringExtra(URL_EXTRA);
            if (!TextUtils.isEmpty(i)) {
                this.d.loadDataWithBaseURL(stringExtra2, i, "text/html", "UTF-8", null);
            } else if (!e0.e(stringExtra2)) {
                this.d.loadUrl(stringExtra2);
            } else if (e0.d(stringExtra2)) {
                try {
                    stringExtra2 = URLDecoder.decode(stringExtra2, "utf-8");
                    this.d.loadUrl(stringExtra2);
                } catch (Exception unused) {
                    IAlog.e("Failed to open Url: %s", stringExtra2);
                    finish();
                }
            } else {
                Intent intent2 = new Intent("android.intent.action.VIEW", Uri.parse(stringExtra2));
                intent2.addFlags(268435456);
                try {
                    startActivity(intent2);
                } catch (ActivityNotFoundException unused2) {
                    IAlog.e("Failed to start activity for %s. Please ensure that your phone can handle this intent.", stringExtra2);
                    z10 = false;
                }
                if (z10 && (internalBrowserListener = j) != null) {
                    internalBrowserListener.onApplicationInBackground();
                }
                finish();
            }
            this.e.setBackgroundColor(0);
            this.e.setOnClickListener(new c(this));
            this.e.setContentDescription("IABackButton");
            this.f.setBackgroundColor(0);
            this.f.setOnClickListener(new d(this));
            this.f.setContentDescription("IAForwardButton");
            this.g.setBackgroundColor(0);
            this.g.setOnClickListener(new e(this));
            this.g.setContentDescription("IARefreshButton");
            this.h.setBackgroundColor(0);
            this.h.setOnClickListener(new f(this));
            this.h.setContentDescription("IACloseButton");
        } catch (Exception unused3) {
            finish();
        }
    }

    @Override
    public void onDestroy() {
        LinearLayout linearLayout = this.c;
        if (linearLayout != null) {
            linearLayout.removeAllViews();
        }
        WebView webView = this.d;
        if (webView != null) {
            webView.destroy();
            this.d = null;
        }
        super.onDestroy();
        setHtmlExtra(null);
    }

    @Override
    public void onDetachedFromWindow() {
        super.onDetachedFromWindow();
        setVisible(false);
    }

    @Override
    public void onPause() {
        super.onPause();
    }

    @Override
    public void onResume() {
        super.onResume();
    }

    public final ImageButton a(Drawable drawable) {
        ImageButton imageButton = new ImageButton(this);
        Resources resources = getResources();
        int i10 = R.integer.ia_ib_button_size_dp;
        LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(n.b(resources.getInteger(i10)), n.b(getResources().getInteger(i10)), 1.0f);
        layoutParams.gravity = 16;
        imageButton.setLayoutParams(layoutParams);
        imageButton.setScaleType(ImageView.ScaleType.FIT_CENTER);
        imageButton.setImageDrawable(drawable);
        return imageButton;
    }
}