导航菜单

页面标题

页面副标题

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

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

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


package com.fyber.inneractive.sdk.activities;

import android.R;
import android.app.Activity;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.os.Build;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import com.fyber.inneractive.sdk.config.a0;
import com.fyber.inneractive.sdk.config.c0;
import com.fyber.inneractive.sdk.config.enums.Orientation;
import com.fyber.inneractive.sdk.external.InneractiveAdSpot;
import com.fyber.inneractive.sdk.external.InneractiveAdSpotManager;
import com.fyber.inneractive.sdk.external.InneractiveUnitController;
import com.fyber.inneractive.sdk.flow.l;
import com.fyber.inneractive.sdk.flow.t;
import com.fyber.inneractive.sdk.interfaces.c;
import com.fyber.inneractive.sdk.network.r;
import com.fyber.inneractive.sdk.renderers.k;
import com.fyber.inneractive.sdk.ui.CloseButtonFlowManager;
import com.fyber.inneractive.sdk.util.IAlog;
import com.fyber.inneractive.sdk.util.n;
import com.fyber.inneractive.sdk.util.o;

public class InneractiveFullscreenAdActivity extends Activity implements c.a {
    public static final String EXTRA_KEY_SPOT_ID = "spotId";
    public ViewGroup a;
    public InneractiveAdSpot b;
    public com.fyber.inneractive.sdk.interfaces.c c;
    public int d = 0;
    public int e = 0;
    public int f = 0;
    public boolean g = false;
    public CloseButtonFlowManager h;

    public interface FullScreenRendererProvider {
        com.fyber.inneractive.sdk.interfaces.c getFullscreenRenderer();
    }

    public interface OnInneractiveFullscreenAdDestroyListener {
        void onActivityDestroyed(InneractiveFullscreenAdActivity inneractiveFullscreenAdActivity);
    }

    public class a implements View.OnSystemUiVisibilityChangeListener {

        public class RunnableC0082a implements Runnable {
            public RunnableC0082a() {
            }

            @Override
            public void run() {
                if (InneractiveFullscreenAdActivity.this.isFinishing()) {
                    return;
                }
                InneractiveFullscreenAdActivity inneractiveFullscreenAdActivity = InneractiveFullscreenAdActivity.this;
                String str = InneractiveFullscreenAdActivity.EXTRA_KEY_SPOT_ID;
                inneractiveFullscreenAdActivity.a();
            }
        }

        public a() {
        }

        @Override
        public void onSystemUiVisibilityChange(int i) {
            if ((i & 2) == 0) {
                o.b.postDelayed(new RunnableC0082a(), 3000L);
            }
        }
    }

    public final void a() {
        View decorView = getWindow().getDecorView();
        if ((decorView.getSystemUiVisibility() & 2) == 0) {
            decorView.setSystemUiVisibility(2818);
        }
        decorView.setOnSystemUiVisibilityChangeListener(new a());
    }

    @Override
    public void destroy() {
        if (isFinishing() || this.a == null) {
            return;
        }
        finish();
    }

    @Override
    public void disableCloseButton() {
        CloseButtonFlowManager closeButtonFlowManager = this.h;
        closeButtonFlowManager.c.setVisibility(8);
        closeButtonFlowManager.a.setVisibility(8);
    }

    @Override
    public void dismissAd(boolean z10) {
        this.g = z10;
        com.fyber.inneractive.sdk.interfaces.c cVar = this.c;
        if (cVar != null) {
            cVar.c(z10);
        }
        finish();
    }

    @Override
    public View getCloseButton() {
        return this.h.e;
    }

    @Override
    public ViewGroup getLayout() {
        return this.a;
    }

    public void initWindowFeatures(com.fyber.inneractive.sdk.interfaces.c cVar) {
        requestWindowFeature(1);
        getWindow().addFlags(1024);
        getWindow().addFlags(128);
        if (Build.VERSION.SDK_INT >= 28) {
            getWindow().addFlags(2);
        }
        if (cVar != 0 && (((l) cVar) instanceof k)) {
            setTheme(R.style.Theme.NoTitleBar.Fullscreen);
            requestWindowFeature(67108864);
            requestWindowFeature(134217728);
            requestWindowFeature(Integer.MIN_VALUE);
        }
        a();
        c0 c0Var = ((a0) this.b.getAdContent().d).f;
        if (c0Var != null) {
            Orientation orientation = c0Var.e;
            setActivityOrientation(orientation.allowOrientationChange, orientation);
        }
    }

    @Override
    public boolean isCloseButtonDisplay() {
        return this.h.d.getVisibility() == 0;
    }

    @Override
    public void onBackPressed() {
        com.fyber.inneractive.sdk.interfaces.c cVar = this.c;
        if (cVar == null || !cVar.v()) {
            super.onBackPressed();
        }
    }

    @Override
    public void onConfigurationChanged(Configuration configuration) {
        super.onConfigurationChanged(configuration);
        com.fyber.inneractive.sdk.interfaces.c cVar = this.c;
        if (cVar != null) {
            int i = configuration.orientation;
            if (i != this.d) {
                this.d = i;
                cVar.b();
                return;
            }
            int i10 = this.e;
            int i11 = configuration.screenHeightDp;
            if (i10 == i11 && this.f == configuration.screenWidthDp) {
                return;
            }
            this.e = i11;
            this.f = configuration.screenWidthDp;
            cVar.b();
        }
    }

    @Override
    public void onCreate(Bundle bundle) {
        String stringExtra = getIntent().getStringExtra("spotId");
        InneractiveAdSpot inneractiveAdSpot = null;
        if (TextUtils.isEmpty(stringExtra)) {
            IAlog.e("%sSpot id must be provided as an extra before calling createActivity with InneractiveInterstitialAdActivty", IAlog.a(this));
        } else {
            InneractiveAdSpot spot = InneractiveAdSpotManager.get().getSpot(stringExtra);
            if (spot == null) {
                IAlog.b("%sSpot id %s cannot be found in spot manager!", IAlog.a(this), stringExtra);
            }
            if (spot != null && spot.getAdContent() == null) {
                IAlog.a("%sSpot does not have a content. Cannot start activity", IAlog.a(this));
            }
            if (spot != null && spot.getAdContent() != null) {
                inneractiveAdSpot = spot;
            }
        }
        this.b = inneractiveAdSpot;
        if (inneractiveAdSpot == null || inneractiveAdSpot.getAdContent() == null || this.b.getAdContent().d == null) {
            super.onCreate(bundle);
            finish();
            return;
        }
        InneractiveUnitController selectedUnitController = this.b.getSelectedUnitController();
        if (selectedUnitController == null || !(selectedUnitController instanceof FullScreenRendererProvider)) {
            IAlog.e("%sno appropriate unit controller found for full screen ad. Aborting", IAlog.a(this));
            super.onCreate(bundle);
            finish();
            return;
        }
        com.fyber.inneractive.sdk.interfaces.c fullscreenRenderer = ((FullScreenRendererProvider) selectedUnitController).getFullscreenRenderer();
        this.c = fullscreenRenderer;
        initWindowFeatures(fullscreenRenderer);
        super.onCreate(bundle);
        IAlog.a("%sInterstitial for spot id %s created", IAlog.a(this), this.b.getLocalUniqueId());
        this.d = getResources().getConfiguration().orientation;
        this.e = getResources().getConfiguration().screenHeightDp;
        this.f = getResources().getConfiguration().screenWidthDp;
        if (this.c == null) {
            IAlog.e("Interstitial Activity: Could not find an appropriate full screen ad renderer for content!", new Object[0]);
            finish();
            return;
        }
        try {
            setContentView(com.fyber.inneractive.sdk.R.layout.ia_fullscreen_activity);
            this.a = (ViewGroup) findViewById(com.fyber.inneractive.sdk.R.id.ia_ad_content);
            this.h = new CloseButtonFlowManager(this);
            com.fyber.inneractive.sdk.interfaces.c cVar = this.c;
            InneractiveAdSpot inneractiveAdSpot2 = this.b;
            t tVar = (t) cVar;
            tVar.a = inneractiveAdSpot2;
            tVar.b = inneractiveAdSpot2.getAdContent();
            tVar.c = inneractiveAdSpot2.getSelectedUnitController().getEventsListener();
            tVar.v.a = inneractiveAdSpot2;
            try {
                this.c.a(this, this);
                this.b.getAdContent().e = true;
            } catch (Resources.NotFoundException e) {
                IAlog.e("Interstitial Activity: %s", e.getMessage());
                finish();
            } catch (InneractiveUnitController.AdDisplayError e10) {
                IAlog.e("Interstitial Activity: %s", e10.getMessage());
                finish();
            }
        } catch (Throwable th) {
            r.a(th, this.b.getAdContent().a, this.b.getAdContent().d());
            finish();
        }
    }

    @Override
    public void onDestroy() {
        ViewGroup viewGroup = this.a;
        if (viewGroup != null) {
            viewGroup.removeAllViews();
            this.a = null;
        }
        InneractiveAdSpot inneractiveAdSpot = this.b;
        InneractiveUnitController selectedUnitController = inneractiveAdSpot == null ? null : inneractiveAdSpot.getSelectedUnitController();
        if (selectedUnitController != null && (selectedUnitController instanceof OnInneractiveFullscreenAdDestroyListener)) {
            ((OnInneractiveFullscreenAdDestroyListener) selectedUnitController).onActivityDestroyed(this);
        }
        com.fyber.inneractive.sdk.interfaces.c cVar = this.c;
        if (cVar != null) {
            cVar.m();
            this.c.destroy();
            this.c = null;
        }
        super.onDestroy();
    }

    @Override
    public void onPause() {
        super.onPause();
        if (!isFinishing()) {
            com.fyber.inneractive.sdk.interfaces.c cVar = this.c;
            if (cVar != null) {
                cVar.t();
                return;
            }
            return;
        }
        com.fyber.inneractive.sdk.interfaces.c cVar2 = this.c;
        if (cVar2 != null) {
            cVar2.m();
            this.c.destroy();
            this.c = null;
        }
    }

    @Override
    public void onResume() {
        super.onResume();
        com.fyber.inneractive.sdk.interfaces.c cVar = this.c;
        if (cVar != null) {
            cVar.o();
        }
    }

    @Override
    public void onWindowFocusChanged(boolean z10) {
        super.onWindowFocusChanged(z10);
        if (z10) {
            a();
        }
    }

    @Override
    public void setActivityOrientation(boolean z10, Orientation orientation) {
        if (z10 && orientation.equals(Orientation.USER)) {
            setRequestedOrientation(13);
            return;
        }
        if (z10 && orientation.equals(Orientation.NONE)) {
            setRequestedOrientation(getRequestedOrientation());
            return;
        }
        if (orientation.equals(Orientation.LANDSCAPE)) {
            setRequestedOrientation(6);
            return;
        }
        if (orientation.equals(Orientation.PORTRAIT)) {
            setRequestedOrientation(7);
            return;
        }
        int i = getResources().getConfiguration().orientation;
        if (i == 1) {
            setRequestedOrientation(7);
        } else if (i == 2) {
            setRequestedOrientation(6);
        }
    }

    @Override
    public void showCloseButton(boolean z10, int i, int i10) {
        int i11;
        int i12;
        CloseButtonFlowManager closeButtonFlowManager = this.h;
        if (z10) {
            closeButtonFlowManager.a.setAlpha(0.0f);
            closeButtonFlowManager.d.setAlpha(0.0f);
        }
        closeButtonFlowManager.b.setText("");
        closeButtonFlowManager.b.setVisibility(8);
        if (i >= 5) {
            int a10 = n.a(i);
            closeButtonFlowManager.d.getLayoutParams().width = a10;
            closeButtonFlowManager.d.getLayoutParams().height = a10;
        }
        if (i10 >= 5) {
            FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) closeButtonFlowManager.d.getLayoutParams();
            FrameLayout.LayoutParams layoutParams2 = (FrameLayout.LayoutParams) closeButtonFlowManager.a.getLayoutParams();
            FrameLayout.LayoutParams layoutParams3 = (FrameLayout.LayoutParams) closeButtonFlowManager.c.getLayoutParams();
            int a11 = n.a(i10);
            int i13 = layoutParams.width;
            int i14 = a11 - i13;
            if (a11 <= i13 || i14 <= (i12 = layoutParams2.rightMargin)) {
                layoutParams3.width = a11;
                layoutParams3.height = a11;
                i11 = layoutParams2.rightMargin;
                if (i14 < i11) {
                    i11 -= i14 / 2;
                }
            } else {
                int i15 = (i13 / 2) + (a11 / 2) + i12;
                layoutParams3.width = i15;
                layoutParams3.height = i15;
                layoutParams2.gravity = 53;
                i11 = 0;
            }
            layoutParams3.setMargins(i11, i11, i11, i11);
            layoutParams3.gravity = 17;
        }
        closeButtonFlowManager.a.setVisibility(0);
        closeButtonFlowManager.d.setVisibility(0);
        closeButtonFlowManager.c.setVisibility(0);
    }

    @Override
    public void showCloseCountdown() {
        CloseButtonFlowManager closeButtonFlowManager = this.h;
        closeButtonFlowManager.b.setBackgroundResource(com.fyber.inneractive.sdk.R.drawable.ia_round_overlay_bg);
        closeButtonFlowManager.a.setVisibility(0);
        closeButtonFlowManager.b.setVisibility(0);
        closeButtonFlowManager.d.setVisibility(8);
        closeButtonFlowManager.c.setVisibility(8);
    }

    @Override
    public void updateCloseCountdown(int i) {
        CloseButtonFlowManager closeButtonFlowManager = this.h;
        closeButtonFlowManager.getClass();
        if (i > 0) {
            closeButtonFlowManager.b.setText(Integer.toString(i));
        }
    }

    @Override
    public boolean wasDismissedByUser() {
        return this.g;
    }
}