导航菜单

页面标题

页面副标题

FileWipe Pro v3.0.0 - InneractiveInternalBrowserActivity.java 源代码

正在查看: FileWipe Pro v3.0.0 应用的 InneractiveInternalBrowserActivity.java JAVA 源代码文件

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


package com.fyber.inneractive.sdk.activities;

import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Bundle;
import android.text.TextUtils;
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.config.IAConfigManager;
import com.fyber.inneractive.sdk.config.global.r;
import com.fyber.inneractive.sdk.external.InneractiveAdRequest;
import com.fyber.inneractive.sdk.external.InneractiveAdSpot;
import com.fyber.inneractive.sdk.external.InneractiveAdSpotManager;
import com.fyber.inneractive.sdk.flow.x;
import com.fyber.inneractive.sdk.network.u;
import com.fyber.inneractive.sdk.network.w;
import com.fyber.inneractive.sdk.util.IAlog;
import com.fyber.inneractive.sdk.util.f0;
import com.fyber.inneractive.sdk.util.m0;
import com.fyber.inneractive.sdk.util.t;
import com.mbridge.msdk.playercommon.exoplayer2.C;
import java.net.URLDecoder;
import java.util.Iterator;
import org.json.JSONArray;
import org.json.JSONObject;

public class InneractiveInternalBrowserActivity extends InneractiveBaseActivity {
    public static final String EXTRA_KEY_SPOT_ID = "spotId";
    public static final String URL_EXTRA = "extra_url";

    public static String f5165j;

    public static InternalBrowserListener f5166k;

    public x f5167b;

    public String f5168c;

    public LinearLayout f5169d;

    public WebView f5170e;

    public ImageButton f5171f;

    public ImageButton f5172g;

    public ImageButton f5173h;

    public ImageButton f5174i;

    public interface InternalBrowserListener {
        void onApplicationInBackground();

        void onInternalBrowserDismissed();
    }

    public static void a(InneractiveInternalBrowserActivity inneractiveInternalBrowserActivity, com.fyber.inneractive.sdk.click.b bVar) {
        r rVar;
        x xVar = inneractiveInternalBrowserActivity.f5167b;
        InneractiveAdRequest inneractiveAdRequest = xVar != null ? xVar.f5954a : null;
        com.fyber.inneractive.sdk.response.e c4 = xVar != null ? xVar.c() : null;
        x xVar2 = inneractiveInternalBrowserActivity.f5167b;
        JSONArray b10 = (xVar2 == null || (rVar = xVar2.f5956c) == null) ? null : rVar.b();
        u uVar = u.FYBER_SUCCESS_CLICK;
        w wVar = new w(c4);
        wVar.f6304c = uVar;
        wVar.f6302a = inneractiveAdRequest;
        wVar.f6305d = b10;
        JSONObject jSONObject = new JSONObject();
        long j5 = bVar.f5289e;
        if (j5 != 0) {
            Object valueOf = Long.valueOf(j5);
            try {
                jSONObject.put("time_passed", valueOf);
            } catch (Exception unused) {
                IAlog.f("Got exception adding param to json object: %s, %s", "time_passed", valueOf);
            }
        }
        JSONArray jSONArray = new JSONArray();
        Iterator it = bVar.f5290f.iterator();
        while (it.hasNext()) {
            com.fyber.inneractive.sdk.click.j jVar = (com.fyber.inneractive.sdk.click.j) it.next();
            JSONObject jSONObject2 = new JSONObject();
            try {
                jSONObject2.put("url", jVar.f5307a);
                jSONObject2.put("success", jVar.f5308b);
                jSONObject2.put("opened_by", jVar.f5309c);
                jSONObject2.put("reason", jVar.f5310d);
            } catch (Exception unused2) {
            }
            jSONArray.put(jSONObject2);
        }
        try {
            jSONObject.put("urls", jSONArray);
        } catch (Exception unused3) {
            IAlog.f("Got exception adding param to json object: %s, %s", "urls", jSONArray);
        }
        Object obj = com.fyber.inneractive.sdk.util.g.VIDEO_CTA;
        try {
            jSONObject.put("origin", obj);
        } catch (Exception unused4) {
            IAlog.f("Got exception adding param to json object: %s, %s", "origin", obj);
        }
        wVar.f6307f.put(jSONObject);
        wVar.a((String) null);
    }

    public static void disableWebviewZoomControls(WebView webView) {
        webView.getSettings().setSupportZoom(true);
        webView.getSettings().setBuiltInZoomControls(true);
        new m0(webView).run();
    }

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

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

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

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

    @Override
    public void onCreate(Bundle bundle) {
        InneractiveAdSpot spot;
        getWindow().requestFeature(2);
        getWindow().setFeatureInt(2, -1);
        getWindow().addFlags(1024);
        super.onCreate(bundle);
        if (getActionBar() != null) {
            getActionBar().hide();
        }
        try {
            setContentView(a());
            String stringExtra = getIntent().getStringExtra("spotId");
            this.f5168c = stringExtra;
            if (!TextUtils.isEmpty(stringExtra) && (spot = InneractiveAdSpotManager.get().getSpot(this.f5168c)) != null) {
                this.f5167b = spot.getAdContent();
            }
            Intent intent = getIntent();
            WebSettings settings = this.f5170e.getSettings();
            settings.setJavaScriptEnabled(true);
            settings.setDomStorageEnabled(true);
            settings.setSupportZoom(true);
            settings.setBuiltInZoomControls(true);
            settings.setUseWideViewPort(true);
            settings.setLoadWithOverviewMode(true);
            disableWebviewZoomControls(this.f5170e);
            this.f5170e.setWebChromeClient(new e(this));
            String stringExtra2 = intent.getStringExtra(URL_EXTRA);
            if (!TextUtils.isEmpty(f5165j)) {
                String r6 = s1.a.r(new StringBuilder(), f5165j, "<title>DigitalTurbine Internal Browser</title>");
                f5165j = r6;
                this.f5170e.loadDataWithBaseURL(stringExtra2, r6, "text/html", C.UTF8_NAME, null);
            } else if (TextUtils.isEmpty(stringExtra2)) {
                IAlog.f("Empty url", new Object[0]);
                finish();
            } else if (!f0.d(stringExtra2)) {
                this.f5170e.loadUrl(stringExtra2);
            } else if (f0.c(stringExtra2)) {
                try {
                    stringExtra2 = URLDecoder.decode(stringExtra2, "utf-8");
                    this.f5170e.loadUrl(stringExtra2);
                } catch (Exception unused) {
                    IAlog.f("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);
                    InternalBrowserListener internalBrowserListener = f5166k;
                    if (internalBrowserListener != null) {
                        internalBrowserListener.onApplicationInBackground();
                    }
                } catch (ActivityNotFoundException unused2) {
                    IAlog.f("Failed to start activity for %s. Please ensure that your phone can handle this intent.", stringExtra2);
                }
                finish();
            }
            this.f5171f.setBackgroundColor(0);
            this.f5171f.setOnClickListener(new i(this));
            this.f5171f.setContentDescription("IABackButton");
            this.f5172g.setBackgroundColor(0);
            this.f5172g.setOnClickListener(new j(this));
            this.f5172g.setContentDescription("IAForwardButton");
            this.f5173h.setBackgroundColor(0);
            this.f5173h.setOnClickListener(new k(this));
            this.f5173h.setContentDescription("IARefreshButton");
            this.f5174i.setBackgroundColor(0);
            this.f5174i.setOnClickListener(new l(this));
            this.f5174i.setContentDescription("IACloseButton");
            com.fyber.inneractive.sdk.util.o.a();
            com.fyber.inneractive.sdk.util.o.f();
        } catch (Exception unused3) {
            finish();
        }
    }

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

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

    @Override
    public void onPause() {
        super.onPause();
        com.fyber.inneractive.sdk.util.o.g();
    }

    @Override
    public void onResume() {
        super.onResume();
        com.fyber.inneractive.sdk.util.o.f();
    }

    public final LinearLayout a() {
        this.f5169d = new LinearLayout(this);
        this.f5169d.setLayoutParams(new LinearLayout.LayoutParams(-1, -1));
        this.f5169d.setOrientation(1);
        this.f5169d.setContentDescription("IAInternalBrowserView");
        RelativeLayout relativeLayout = new RelativeLayout(this);
        relativeLayout.setLayoutParams(new LinearLayout.LayoutParams(-1, -2));
        this.f5169d.addView(relativeLayout);
        LinearLayout linearLayout = new LinearLayout(this);
        linearLayout.setId(1);
        RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(-1, com.fyber.inneractive.sdk.util.o.b(getResources().getInteger(R.integer.ia_ib_toolbar_height_dp)));
        layoutParams.addRule(12);
        linearLayout.setLayoutParams(layoutParams);
        com.fyber.inneractive.sdk.util.o.a(linearLayout, com.fyber.inneractive.sdk.util.o.d(R.drawable.ia_ib_background));
        relativeLayout.addView(linearLayout);
        this.f5171f = a(com.fyber.inneractive.sdk.util.o.d(R.drawable.ia_ib_left_arrow));
        this.f5172g = a(com.fyber.inneractive.sdk.util.o.d(R.drawable.ia_ib_right_arrow));
        this.f5173h = a(com.fyber.inneractive.sdk.util.o.d(R.drawable.ia_ib_refresh));
        this.f5174i = a(com.fyber.inneractive.sdk.util.o.d(R.drawable.ia_ib_close));
        linearLayout.addView(this.f5171f);
        linearLayout.addView(this.f5172g);
        linearLayout.addView(this.f5173h);
        linearLayout.addView(this.f5174i);
        WebView webView = new WebView(IAConfigManager.O.f5348v.a());
        this.f5170e = webView;
        webView.setWebViewClient(new f(this));
        this.f5170e.setId(R.id.ia_inneractive_webview_internal_browser);
        RelativeLayout.LayoutParams layoutParams2 = new RelativeLayout.LayoutParams(-1, -1);
        layoutParams2.addRule(2, 1);
        this.f5170e.setLayoutParams(layoutParams2);
        relativeLayout.addView(this.f5170e);
        return this.f5169d;
    }

    public final ImageButton a(Drawable drawable) {
        ImageButton imageButton = new ImageButton(this);
        LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(com.fyber.inneractive.sdk.util.o.b(getResources().getInteger(R.integer.ia_ib_button_size_dp)), com.fyber.inneractive.sdk.util.o.b(getResources().getInteger(R.integer.ia_ib_button_size_dp)), 1.0f);
        layoutParams.gravity = 16;
        imageButton.setLayoutParams(layoutParams);
        imageButton.setScaleType(ImageView.ScaleType.FIT_CENTER);
        imageButton.setImageDrawable(drawable);
        return imageButton;
    }
}