导航菜单

页面标题

页面副标题

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

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

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


package com.mbridge.msdk.nativex.view;

import android.R;
import android.content.Context;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.graphics.Rect;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.Base64;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowInsets;
import android.webkit.URLUtil;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.iab.omid.library.mmadbridge.adsession.AdEvents;
import com.iab.omid.library.mmadbridge.adsession.AdSession;
import com.iab.omid.library.mmadbridge.adsession.media.InteractionType;
import com.iab.omid.library.mmadbridge.adsession.media.MediaEvents;
import com.iab.omid.library.mmadbridge.adsession.media.PlayerState;
import com.iab.omid.library.mmadbridge.adsession.media.Position;
import com.iab.omid.library.mmadbridge.adsession.media.VastProperties;
import com.mbridge.msdk.foundation.entity.CampaignEx;
import com.mbridge.msdk.foundation.entity.m;
import com.mbridge.msdk.foundation.tools.aa;
import com.mbridge.msdk.foundation.tools.ae;
import com.mbridge.msdk.foundation.tools.h;
import com.mbridge.msdk.foundation.tools.p;
import com.mbridge.msdk.foundation.tools.r;
import com.mbridge.msdk.foundation.tools.v;
import com.mbridge.msdk.foundation.tools.z;
import com.mbridge.msdk.foundation.webview.BrowserView;
import com.mbridge.msdk.mbnative.controller.NativeController;
import com.mbridge.msdk.mbsignalcommon.windvane.WindVaneWebView;
import com.mbridge.msdk.nativex.view.MediaViewPlayerView;
import com.mbridge.msdk.nativex.view.mbfullview.BaseView;
import com.mbridge.msdk.nativex.view.mbfullview.MBridgeFullView;
import com.mbridge.msdk.nativex.view.mbfullview.MBridgeTopFullView;
import com.mbridge.msdk.out.Campaign;
import com.mbridge.msdk.out.NativeListener;
import com.mbridge.msdk.out.OnMBMediaViewListener;
import com.mbridge.msdk.out.OnMBMediaViewListenerPlus;
import com.mbridge.msdk.playercommon.VideoPlayerStatusListener;
import com.mbridge.msdk.playercommon.exoplayer2.text.ttml.TtmlNode;
import com.mbridge.msdk.playercommon.exoplayer2.upstream.DataSchemeDataSource;
import com.mbridge.msdk.video.signal.communication.IRewardCommunication;
import com.mbridge.msdk.videocommon.download.k;
import com.mbridge.msdk.videocommon.view.MyImageView;
import java.io.File;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

public class MBMediaView extends LinearLayout implements VideoPlayerStatusListener, IRewardCommunication {
    public static final int OPEN_FULLSCREEN_ON_VIDEO_TYPE_1_LANDING_PAGE = 1;
    public static final int OPEN_FULLSCREEN_ON_VIDEO_TYPE_2_NORMAL_FULLSCREEN = 2;
    public static final int OPEN_FULLSCREEN_ON_VIDEO_TYPE_3_NORMAL_FULLSCREEN_ENDCARD = 3;
    public static final int OPEN_FULLSCREEN_ON_VIDEO_TYPE_4_NORMAL_FULLSCREEN_LP = 4;
    public static final int OPEN_FULLSCREEN_ON_VIDEO_TYPE_6_SMALLVIDEO = 6;
    public static final String TAG = "MBMediaView";
    public static final int WHAT_VIEW_FULL_SCREEN = 2;
    public static final int WHAT_VIEW_SMALL_SCREEN = 1;
    private static int o = 2;
    private static int p = 1;
    private WindVaneWebViewForNV A;
    private WindVaneWebViewForNV B;
    private MyImageView C;
    private ProgressBar D;
    private View E;
    private BaseView F;
    private RelativeLayout G;
    private RelativeLayout H;
    private TextView I;
    private ProgressBar J;
    private RelativeLayout K;
    private int L;
    private Handler M;
    private CampaignEx N;
    private int O;
    private int P;
    private double Q;
    private double R;
    private int S;
    private int T;
    private e U;
    private SensorManager V;
    private Sensor W;
    private boolean a;

    private com.mbridge.msdk.videocommon.download.a f435aa;

    private a f436ab;

    private OnMBMediaViewListener f437ac;

    private OnMBMediaViewListenerPlus f438ad;

    private int f439ae;
    private boolean af;
    private boolean ag;
    private RelativeLayout ah;
    private ImageView ai;
    private int aj;
    private boolean ak;
    private Context al;
    private boolean am;
    private Runnable an;
    private boolean b;
    private boolean c;
    private boolean d;
    private boolean e;
    private boolean f;
    private boolean g;
    private boolean h;
    private volatile boolean i;
    private volatile boolean j;
    private boolean k;
    private boolean l;
    private ArrayList<String> m;
    private ArrayList<String> n;
    private boolean q;
    private boolean r;
    private AdSession s;
    private AdEvents t;
    private MediaEvents u;
    private int v;
    private MediaViewPlayerView w;

    private RelativeLayout f440x;

    private RelativeLayout f441y;

    private RelativeLayout f442z;

    public static class AnonymousClass10 {
        static final int[] a;

        static {
            int[] iArr = new int[BaseView.a.values().length];
            a = iArr;
            try {
                iArr[BaseView.a.FULL_MIDDLE_VIEW.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
            try {
                a[BaseView.a.FULL_TOP_VIEW.ordinal()] = 2;
            } catch (NoSuchFieldError unused2) {
            }
        }
    }

    public enum a {
        BIG_IMAGE,
        VIDEO,
        GIF
    }

    public static final class b implements Runnable {
        WeakReference<MBMediaView> a;

        public b(MBMediaView mBMediaView) {
            this.a = new WeakReference<>(mBMediaView);
        }

        @Override
        public final void run() {
            MBMediaView mBMediaView = this.a.get();
            if (mBMediaView != null) {
                try {
                    if (mBMediaView.f436ab == null || mBMediaView.f436ab != a.BIG_IMAGE) {
                        return;
                    }
                    mBMediaView.e();
                    mBMediaView.f436ab = a.VIDEO;
                    mBMediaView.changeNoticeURL();
                } catch (Throwable th) {
                    v.a(MBMediaView.TAG, th.getMessage(), th);
                }
            }
        }
    }

    public static final class d implements com.mbridge.msdk.mbsignalcommon.base.a {
        private d() {
        }

        @Override
        public final boolean a(String str) {
            try {
                if (!TextUtils.isEmpty(str)) {
                    if (z.a.a(str)) {
                        z.a(com.mbridge.msdk.foundation.controller.a.d().f(), str, null);
                        return true;
                    }
                    if (URLUtil.isNetworkUrl(str)) {
                        return false;
                    }
                    z.b(com.mbridge.msdk.foundation.controller.a.d().f(), str, null);
                    return true;
                }
            } catch (Exception e) {
                v.d(MBMediaView.TAG, e.getMessage());
            }
            return false;
        }
    }

    public static final class f implements com.mbridge.msdk.videocommon.listener.a {
        WeakReference<MBMediaView> a;

        public f(MBMediaView mBMediaView) {
            this.a = new WeakReference<>(mBMediaView);
        }

        public final void a(String str, String str2) {
        }

        public final void a(String str) {
            MBMediaView mBMediaView = this.a.get();
            if (mBMediaView != null) {
                mBMediaView.M.post(new b(mBMediaView));
            }
        }
    }

    public static final class g extends WebViewClient {
        WeakReference<MBMediaView> a;

        public g(MBMediaView mBMediaView) {
            this.a = new WeakReference<>(mBMediaView);
        }

        @Override
        public final void onPageFinished(WebView webView, String str) {
            super.onPageFinished(webView, str);
            try {
                MBMediaView mBMediaView = this.a.get();
                if (mBMediaView == null || mBMediaView.f436ab == null || mBMediaView.f436ab != a.BIG_IMAGE) {
                    return;
                }
                mBMediaView.l();
                mBMediaView.f436ab = a.GIF;
                mBMediaView.changeNoticeURL();
            } catch (Exception e) {
                v.d(MBMediaView.TAG, e.getMessage());
            }
        }
    }

    public MBMediaView(Context context) {
        super(context);
        this.a = true;
        this.b = true;
        this.c = true;
        this.d = true;
        this.e = true;
        this.f = false;
        this.g = true;
        this.h = false;
        this.i = false;
        this.j = false;
        this.k = true;
        this.l = true;
        this.m = new ArrayList<>();
        this.n = new ArrayList<>();
        this.q = false;
        this.r = false;
        this.s = null;
        this.t = null;
        this.u = null;
        this.v = 0;
        this.f435aa = null;
        this.f436ab = null;
        this.af = false;
        this.ag = false;
        this.ak = false;
        this.am = false;
        this.an = new Runnable() {
            @Override
            public final void run() {
                try {
                    if (!MBMediaView.this.h) {
                        MBMediaView mBMediaView = MBMediaView.this;
                        if (mBMediaView.a((View) mBMediaView)) {
                            MBMediaView.T(MBMediaView.this);
                        } else {
                            MBMediaView.S(MBMediaView.this);
                        }
                    }
                    MBMediaView.this.M.postDelayed(this, 300L);
                } catch (Exception e10) {
                    v.d(MBMediaView.TAG, e10.getMessage());
                }
            }
        };
        a(context);
    }

    public static void N(MBMediaView mBMediaView) {
        CampaignEx.b mediaViewHolder;
        CampaignEx campaignEx = mBMediaView.N;
        if (campaignEx == null || (mediaViewHolder = campaignEx.getMediaViewHolder()) == null || mediaViewHolder.b || mBMediaView.N.getNativeVideoTracking() == null || mBMediaView.N.getNativeVideoTracking().c() == null) {
            return;
        }
        mediaViewHolder.b = true;
        Context context = mBMediaView.getContext();
        CampaignEx campaignEx2 = mBMediaView.N;
        com.mbridge.msdk.click.a.a(context, campaignEx2, campaignEx2.getCampaignUnitId(), mBMediaView.N.getNativeVideoTracking().c(), false, false);
    }

    public static void O(MBMediaView mBMediaView) {
        CampaignEx.b mediaViewHolder;
        CampaignEx campaignEx = mBMediaView.N;
        if (campaignEx == null || (mediaViewHolder = campaignEx.getMediaViewHolder()) == null || mediaViewHolder.c || mBMediaView.N.getNativeVideoTracking() == null || mBMediaView.N.getNativeVideoTracking().d() == null) {
            return;
        }
        mediaViewHolder.c = true;
        Context context = mBMediaView.getContext();
        CampaignEx campaignEx2 = mBMediaView.N;
        com.mbridge.msdk.click.a.a(context, campaignEx2, campaignEx2.getCampaignUnitId(), mBMediaView.N.getNativeVideoTracking().d(), false, false);
    }

    public static void P(MBMediaView mBMediaView) {
        CampaignEx.b mediaViewHolder;
        CampaignEx campaignEx = mBMediaView.N;
        if (campaignEx == null || (mediaViewHolder = campaignEx.getMediaViewHolder()) == null || mediaViewHolder.e || mBMediaView.N.getNativeVideoTracking() == null || mBMediaView.N.getNativeVideoTracking().f() == null) {
            return;
        }
        mediaViewHolder.e = true;
        Context context = mBMediaView.getContext();
        CampaignEx campaignEx2 = mBMediaView.N;
        com.mbridge.msdk.click.a.a(context, campaignEx2, campaignEx2.getCampaignUnitId(), mBMediaView.N.getNativeVideoTracking().f(), false, false);
    }

    public static void Q(MBMediaView mBMediaView) {
        CampaignEx.b mediaViewHolder;
        CampaignEx campaignEx = mBMediaView.N;
        if (campaignEx == null || (mediaViewHolder = campaignEx.getMediaViewHolder()) == null || mediaViewHolder.f || mBMediaView.N.getNativeVideoTracking() == null || mBMediaView.N.getNativeVideoTracking().g() == null) {
            return;
        }
        mediaViewHolder.f = true;
        Context context = mBMediaView.getContext();
        CampaignEx campaignEx2 = mBMediaView.N;
        com.mbridge.msdk.click.a.a(context, campaignEx2, campaignEx2.getCampaignUnitId(), mBMediaView.N.getNativeVideoTracking().g(), false, false);
    }

    public static void S(MBMediaView mBMediaView) {
        try {
            MediaViewPlayerView mediaViewPlayerView = mBMediaView.w;
            if (mediaViewPlayerView != null && mediaViewPlayerView.hasPrepare() && mBMediaView.w.isPlaying()) {
                try {
                    MediaViewPlayerView mediaViewPlayerView2 = mBMediaView.w;
                    if (mediaViewPlayerView2 != null) {
                        mediaViewPlayerView2.pause();
                    }
                } catch (Throwable th) {
                    v.d(TAG, th.getMessage());
                }
            }
        } catch (Throwable th2) {
            v.d(TAG, th2.getMessage());
        }
    }

    public static void T(MBMediaView mBMediaView) {
        try {
            MediaViewPlayerView mediaViewPlayerView = mBMediaView.w;
            if (mediaViewPlayerView == null || !mediaViewPlayerView.hasPrepare() || mBMediaView.w.isPlaying() || mBMediaView.w.isComplete() || !mBMediaView.w.hasPrepare()) {
                return;
            }
            mBMediaView.w.startOrPlayVideo();
        } catch (Throwable th) {
            v.d(TAG, th.getMessage());
        }
    }

    public void h() {
        try {
            if (this.f436ab != a.VIDEO || this.f440x == null) {
                return;
            }
            int A = (int) A();
            int j = aa.j(getContext());
            if (this.h) {
                RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) this.G.getLayoutParams();
                layoutParams.width = A;
                layoutParams.height = j;
                layoutParams.addRule(13);
                this.G.setLayoutParams(layoutParams);
            } else {
                RelativeLayout.LayoutParams layoutParams2 = (RelativeLayout.LayoutParams) this.f440x.getLayoutParams();
                layoutParams2.width = this.P;
                layoutParams2.height = this.O;
                layoutParams2.addRule(13);
                this.f440x.setLayoutParams(layoutParams2);
            }
            q();
            if (this.h) {
                a(this.w, A, j);
            } else {
                a(this.w, this.P, this.O);
            }
        } catch (Exception e10) {
            v.d(TAG, e10.getMessage());
        }
    }

    private void i() {
        try {
            this.w.showSoundIndicator(this.l);
            this.w.showProgressView(this.k);
            OnMBMediaViewListener onMBMediaViewListener = this.f437ac;
            if (onMBMediaViewListener != null) {
                onMBMediaViewListener.onExitFullscreen();
            }
            OnMBMediaViewListenerPlus onMBMediaViewListenerPlus = this.f438ad;
            if (onMBMediaViewListenerPlus != null) {
                onMBMediaViewListenerPlus.onExitFullscreen();
            }
            MediaEvents mediaEvents = this.u;
            if (mediaEvents != null) {
                mediaEvents.playerStateChange(PlayerState.NORMAL);
            }
        } catch (Exception e10) {
            v.d(TAG, e10.getMessage());
        }
    }

    private void n() {
        try {
            CampaignEx campaignEx = this.N;
            if (campaignEx == null) {
                return;
            }
            String gifUrl = campaignEx.getGifUrl();
            if (ae.a(gifUrl) || getContext() == null) {
                return;
            }
            this.A.loadDataWithBaseURL(null, "<!DOCTYPE html><html lang=\"en\"><head>  <meta charset=\"UTF-8\">  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"><meta http-equiv=\"X-UA-Compatible\" content=\"ie=edge\">  <title>Document</title>  <style>  *{    margin: 0;    padding: 0;  }  html, body{    width: 100%;    height: 100%;  }  body{    background-image: url('gifUrl');    background-position: center;    background-size: contain;    background-repeat: no-repeat;  }  </style></head><body></body></html>".replace("gifUrl", gifUrl), "text/html", "utf-8", null);
            this.A.setInterceptTouch(true);
            this.f442z.setOnClickListener(new com.mbridge.msdk.widget.a() {
                public final void a(View view) {
                    if (MBMediaView.this.al != null) {
                        MBMediaView mBMediaView = MBMediaView.this;
                        mBMediaView.b(mBMediaView.al);
                    } else {
                        MBMediaView.this.b(view.getContext());
                    }
                    v.b(MBMediaView.TAG, "CLICK WEBVIEW LAYOUT ");
                }
            });
        } catch (Throwable th) {
            v.d(TAG, th.getMessage());
        }
    }

    public String o() {
        try {
            CampaignEx campaignEx = this.N;
            if (campaignEx == null || !ae.b(campaignEx.getCampaignUnitId())) {
                return null;
            }
            return this.N.getCampaignUnitId();
        } catch (Exception e10) {
            v.d(TAG, e10.getMessage());
            return null;
        }
    }

    private void p() {
        try {
            if (this.N == null) {
                v.b(TAG, "campaign is null addPlayerView return");
            }
            MediaViewPlayerView mediaViewPlayerView = this.w;
            if (mediaViewPlayerView != null && mediaViewPlayerView.getParent() != null) {
                ((ViewGroup) this.w.getParent()).removeView(this.w);
            }
            k();
            MediaViewPlayerView mediaViewPlayerView2 = new MediaViewPlayerView(getContext());
            this.w = mediaViewPlayerView2;
            mediaViewPlayerView2.showProgressView(this.k);
            this.w.showSoundIndicator(this.l);
            if (this.f) {
                this.w.openSound();
            } else {
                this.w.closeSound();
            }
            this.w.setAllowLoopPlay(this.b);
            this.w.initPlayerViewData(r(), this.N, u(), this, this.f435aa, o());
            this.w.setOnMediaViewPlayerViewListener(new c(this));
            this.f440x.addView(this.w, -1, -1);
            try {
                MediaViewPlayerView mediaViewPlayerView3 = this.w;
                if (mediaViewPlayerView3 != null) {
                    mediaViewPlayerView3.setOnClickListener(new com.mbridge.msdk.widget.a() {
                        public final void a(View view) {
                            try {
                                if (!MBMediaView.this.h) {
                                    MBMediaView.d(MBMediaView.this);
                                }
                                MBMediaView.this.w.showSoundIndicator(true);
                                MBMediaView.this.w.showProgressView(true);
                                if (MBMediaView.this.d && !MBMediaView.this.h && (MBMediaView.this.E == null || MBMediaView.this.E.getParent() == null)) {
                                    if (!MBMediaView.this.w.halfLoadingViewisVisible() && MBMediaView.this.w.isPlaying()) {
                                        MBMediaView.h(MBMediaView.this);
                                        return;
                                    }
                                    v.b(MBMediaView.TAG, "is loading or no playing return;");
                                    return;
                                }
                                if (MBMediaView.this.h) {
                                    v.b(MBMediaView.TAG, "fullScreenShowUI");
                                    MBMediaView.i(MBMediaView.this);
                                    return;
                                }
                                if (MBMediaView.this.al != null) {
                                    MBMediaView mBMediaView = MBMediaView.this;
                                    mBMediaView.b(mBMediaView.al);
                                } else {
                                    MBMediaView.this.b(view.getContext());
                                }
                                if (MBMediaView.this.u != null) {
                                    MBMediaView.this.u.adUserInteraction(InteractionType.CLICK);
                                }
                            } catch (Throwable th) {
                                v.a(MBMediaView.TAG, th.getMessage(), th);
                            }
                        }
                    });
                }
            } catch (Throwable th) {
                v.d(TAG, th.getMessage());
            }
            AdSession adSession = this.s;
            if (adSession != null) {
                MediaViewPlayerView mediaViewPlayerView4 = this.w;
                if (mediaViewPlayerView4 != null) {
                    mediaViewPlayerView4.registerView(adSession);
                }
                this.t = AdEvents.createAdEvents(this.s);
                this.u = MediaEvents.createMediaEvents(this.s);
                this.s.start();
                this.t.loaded(VastProperties.createVastPropertiesForNonSkippableMedia(true, Position.STANDALONE));
                this.w.setVideoEvents(this.u);
                try {
                    AdEvents adEvents = this.t;
                    if (adEvents != null) {
                        adEvents.impressionOccurred();
                    }
                } catch (Exception e10) {
                    v.a("omsdk", e10.getMessage());
                }
            }
        } catch (Throwable th2) {
            v.d(TAG, th2.getMessage());
        }
    }

    public void q() {
        try {
            if (getVisibility() != 0) {
                return;
            }
            if (a((View) this)) {
                com.mbridge.msdk.c.d t = t();
                int d10 = t != null ? t.d() : 0;
                Message obtainMessage = this.M.obtainMessage();
                obtainMessage.what = 3;
                obtainMessage.obj = this;
                this.M.sendMessageDelayed(obtainMessage, (d10 * 1000) + 300);
            }
            if (this.f436ab == a.VIDEO) {
                MediaViewPlayerView mediaViewPlayerView = this.w;
                if (mediaViewPlayerView == null) {
                    p();
                    return;
                }
                if (this.N != mediaViewPlayerView.getCampaign()) {
                    this.w.release();
                    p();
                    if (getParent() != null) {
                        ((View) getParent()).invalidate();
                    }
                    requestLayout();
                }
            }
        } catch (Throwable th) {
            v.d(TAG, th.getMessage());
        }
    }

    private String r() {
        try {
        } catch (Exception e10) {
            v.d(TAG, e10.getMessage());
        }
        if (this.N == null) {
            return null;
        }
        com.mbridge.msdk.videocommon.download.a aVar = this.f435aa;
        if (aVar != null && aVar.f() == 5) {
            String d10 = this.f435aa.d();
            if (new File(d10).exists() && this.f435aa.e() == aa.a(new File(d10))) {
                return d10;
            }
        }
        String videoUrlEncode = this.N.getVideoUrlEncode();
        if (ae.b(videoUrlEncode)) {
            return videoUrlEncode;
        }
        return null;
    }

    public void cai(Object obj, String str) {
        v.a(TAG, "cai:" + str);
        if (TextUtils.isEmpty(str)) {
            com.mbridge.msdk.mbsignalcommon.communication.b.a(obj, "params is null");
            return;
        }
        if (TextUtils.isEmpty(str)) {
            return;
        }
        try {
            try {
                String optString = new JSONObject(str).optString("packageName");
                if (TextUtils.isEmpty(optString)) {
                    com.mbridge.msdk.mbsignalcommon.communication.b.a(obj, "packageName is empty");
                }
                int i = aa.c(com.mbridge.msdk.foundation.controller.a.d().f(), optString) ? 1 : 2;
                try {
                    JSONObject jSONObject = new JSONObject();
                    jSONObject.put("code", com.mbridge.msdk.mbsignalcommon.communication.b.b);
                    JSONObject jSONObject2 = new JSONObject();
                    jSONObject2.put("result", i);
                    jSONObject.put(DataSchemeDataSource.SCHEME_DATA, jSONObject2);
                    com.mbridge.msdk.mbsignalcommon.windvane.g.a().a(obj, Base64.encodeToString(jSONObject.toString().getBytes(), 2));
                } catch (Exception e10) {
                    com.mbridge.msdk.mbsignalcommon.communication.b.a(obj, e10.getMessage());
                    v.a(TAG, e10.getMessage());
                }
            } catch (Throwable th) {
                com.mbridge.msdk.mbsignalcommon.communication.b.a(obj, "exception: " + th.getLocalizedMessage());
                v.a(TAG, "cai", th);
            }
        } catch (JSONException e11) {
            com.mbridge.msdk.mbsignalcommon.communication.b.a(obj, "exception: " + e11.getLocalizedMessage());
            v.a(TAG, "cai", e11);
        }
    }

    public boolean canShowVideo() {
        return a(false) == a.VIDEO;
    }

    public void changeNoticeURL() {
        CampaignEx campaignEx = this.N;
        if (campaignEx != null) {
            String noticeUrl = campaignEx.getNoticeUrl();
            if (TextUtils.isEmpty(noticeUrl)) {
                return;
            }
            if (noticeUrl.contains("is_video")) {
                a aVar = this.f436ab;
                if (aVar == a.VIDEO) {
                    if (noticeUrl.contains("is_video=2")) {
                        noticeUrl = noticeUrl.replace("is_video=2", "is_video=1");
                    }
                } else if (aVar == a.BIG_IMAGE && noticeUrl.contains("is_video=1")) {
                    noticeUrl = noticeUrl.replace("is_video=1", "is_video=2");
                }
            } else {
                a aVar2 = this.f436ab;
                String str = aVar2 == a.VIDEO ? "1" : aVar2 == a.BIG_IMAGE ? "2" : "";
                StringBuilder sb2 = new StringBuilder(noticeUrl);
                if (noticeUrl.contains("?")) {
                    sb2.append("&is_video=");
                    sb2.append(str);
                } else {
                    sb2.append("?is_video=");
                    sb2.append(str);
                }
                noticeUrl = sb2.toString();
            }
            this.N.setNoticeUrl(noticeUrl);
        }
    }

    public void destory() {
        try {
            MediaViewPlayerView mediaViewPlayerView = this.w;
            if (mediaViewPlayerView != null) {
                mediaViewPlayerView.release();
            }
            a();
        } catch (Throwable th) {
            v.d(TAG, th.getMessage());
        }
    }

    public void exitFullScreen() {
        try {
            w();
            if (this.b) {
                this.w.onClickPlayButton();
            }
        } catch (Exception e10) {
            v.d(TAG, e10.getMessage());
        }
    }

    public String getAddNVT2ToNoticeURL() {
        CampaignEx campaignEx = this.N;
        if (campaignEx == null) {
            return null;
        }
        String noticeUrl = campaignEx.getNoticeUrl();
        if (TextUtils.isEmpty(noticeUrl) || noticeUrl.contains(CampaignEx.JSON_KEY_NV_T2)) {
            return noticeUrl;
        }
        return noticeUrl + "&nv_t2=" + this.N.getNvT2();
    }

    public void getEndScreenInfo(Object obj, String str) {
        try {
            ArrayList arrayList = new ArrayList();
            arrayList.add(this.N);
            String a10 = a(arrayList, o(), "MAL_16.2.51,3.0.1");
            String encodeToString = !TextUtils.isEmpty(a10) ? Base64.encodeToString(a10.getBytes(), 2) : "";
            v.d(TAG, "getEndScreenInfo-mCampaign.name:" + this.N.getAppName());
            com.mbridge.msdk.mbsignalcommon.windvane.g.a().a(obj, encodeToString);
        } catch (Throwable th) {
            v.d(TAG, th.getMessage());
        }
    }

    public BaseView getFullScreenViewByStyle(Context context, BaseView.a aVar) {
        BaseView mBridgeFullView;
        BaseView baseView;
        int i = AnonymousClass10.a[aVar.ordinal()];
        if (i == 1) {
            mBridgeFullView = new MBridgeFullView(context);
        } else {
            if (i != 2) {
                baseView = null;
                baseView.setStytle(aVar);
                return baseView;
            }
            mBridgeFullView = new MBridgeTopFullView(context);
        }
        baseView = mBridgeFullView;
        baseView.setStytle(aVar);
        return baseView;
    }

    public BaseView.a handleViewStyleResult(Context context) {
        int nvT2 = this.N.getNvT2();
        if (nvT2 == 1) {
            b(context);
        } else {
            if (nvT2 == 2 || nvT2 == 3 || nvT2 == 4) {
                return BaseView.a.FULL_MIDDLE_VIEW;
            }
            if (nvT2 == 6) {
                return BaseView.a.FULL_TOP_VIEW;
            }
        }
        return null;
    }

    public void hideEndCardWebViewCloseBtn() {
        ImageView imageView = this.ai;
        if (imageView == null || imageView.getVisibility() != 0) {
            return;
        }
        this.ai.setVisibility(8);
    }

    public void install(Object obj, String str) {
        WindVaneWebView windVaneWebView;
        try {
            Context context = this.al;
            if (context != null) {
                b(context);
            } else {
                if (!(obj instanceof com.mbridge.msdk.mbsignalcommon.windvane.a) || (windVaneWebView = ((com.mbridge.msdk.mbsignalcommon.windvane.a) obj).a) == null) {
                    return;
                }
                b(windVaneWebView.getContext());
            }
        } catch (Exception e10) {
            v.d(TAG, e10.getMessage());
        }
    }

    public boolean ismCurIsFullScreen() {
        return this.h;
    }

    @Override
    public void onAttachedToWindow() {
        super.onAttachedToWindow();
        try {
            if (this.c) {
                try {
                    SensorManager sensorManager = (SensorManager) getContext().getSystemService("sensor");
                    this.V = sensorManager;
                    this.W = sensorManager.getDefaultSensor(1);
                    e eVar = new e();
                    this.U = eVar;
                    this.V.registerListener(eVar, this.W, 2);
                } catch (Throwable th) {
                    v.d(TAG, th.getMessage());
                }
            }
            this.g = isHardwareAccelerated();
            this.aj = getOrientation();
            d();
            this.M.postDelayed(this.an, 300L);
        } catch (Throwable th2) {
            v.d(TAG, th2.getMessage());
        }
    }

    @Override
    public void onBufferingEnd() {
        v.b("bufferend", "bufferend");
        MediaEvents mediaEvents = this.u;
        if (mediaEvents != null) {
            mediaEvents.bufferFinish();
        }
    }

    @Override
    public void onBufferingStart(String str) {
        v.b("bufferMsg", str);
        MediaEvents mediaEvents = this.u;
        if (mediaEvents != null) {
            mediaEvents.bufferStart();
        }
    }

    @Override
    public void onConfigurationChanged(Configuration configuration) {
        super.onConfigurationChanged(configuration);
        if (this.ak) {
            int i = this.aj;
            int i10 = configuration.orientation;
            if (i == i10) {
                return;
            }
            this.aj = i10;
            this.i = i10 == 0;
            this.j = this.aj == 0;
            this.M.postDelayed(new Runnable() {
                @Override
                public final void run() {
                    try {
                        com.mbridge.msdk.nativex.view.mbfullview.a.a(MBMediaView.this.getContext()).a(MBMediaView.this.F, MBMediaView.this.i);
                        if (MBMediaView.this.aj == 0) {
                            MBMediaView.this.D();
                        } else {
                            MBMediaView.this.C();
                        }
                        MBMediaView.this.h();
                        MBMediaView.this.f();
                        MBMediaView.this.g();
                        if (MBMediaView.this.B != null) {
                            MBMediaView.this.B.orientation(MBMediaView.this.i);
                        }
                    } catch (Exception e10) {
                        v.d(MBMediaView.TAG, e10.getMessage());
                    }
                }
            }, 200L);
        }
    }

    @Override
    public void onDetachedFromWindow() {
        e eVar;
        super.onDetachedFromWindow();
        try {
            if (this.s != null) {
                MediaViewPlayerView mediaViewPlayerView = this.w;
                if (mediaViewPlayerView != null) {
                    mediaViewPlayerView.unregisterView();
                }
                this.s.finish();
                this.s = null;
            }
            if (this.u != null) {
                this.u = null;
            }
            if (this.t != null) {
                this.t = null;
            }
            this.M.removeCallbacks(this.an);
            Handler handler = this.M;
            if (handler != null) {
                handler.removeCallbacksAndMessages(null);
            }
            try {
                SensorManager sensorManager = this.V;
                if (sensorManager != null && (eVar = this.U) != null) {
                    sensorManager.unregisterListener(eVar);
                }
            } catch (Throwable th) {
                v.d(TAG, th.getMessage());
            }
            a();
        } catch (Throwable th2) {
            v.d(TAG, th2.getMessage());
        }
    }

    @Override
    public void onMeasure(int i, int i10) {
        super.onMeasure(i, i10);
        try {
            this.O = getHeight();
            int width = getWidth();
            this.P = width;
            if (width == 0) {
                this.P = getMeasuredWidth();
            }
            if (this.O == 0) {
                this.O = getMeasuredHeight();
            }
            if (this.P == 0 && this.O == 0) {
                this.P = (int) A();
            }
            a aVar = this.f436ab;
            if (aVar != a.VIDEO || this.h) {
                if (aVar == a.BIG_IMAGE && !this.h) {
                    f();
                    return;
                } else {
                    if (aVar != a.GIF || this.h) {
                        return;
                    }
                    g();
                    return;
                }
            }
            ViewGroup.LayoutParams layoutParams = getLayoutParams();
            if (this.O == 0 || ((layoutParams != null && layoutParams.height == -2) || (layoutParams != null && layoutParams.height == -1))) {
                this.O = (int) ((this.P * this.R) / this.Q);
            }
            h();
        } catch (Throwable th) {
            v.d(TAG, th.getMessage());
        }
    }

    @Override
    public void onPlayCompleted() {
        MediaEvents mediaEvents = this.u;
        if (mediaEvents != null) {
            mediaEvents.complete();
        }
    }

    @Override
    public void onPlayError(final String str) {
        try {
            v.b(CampaignEx.JSON_NATIVE_VIDEO_ERROR, str);
            Runnable runnable = new Runnable() {
                @Override
                public final void run() {
                    MBMediaView.r(MBMediaView.this);
                    MBMediaView.a(MBMediaView.this, str);
                    NativeController.insertExcludeId(MBMediaView.this.N.getCampaignUnitId(), MBMediaView.this.N);
                }
            };
            if (com.mbridge.msdk.foundation.controller.b.a().d()) {
                com.mbridge.msdk.foundation.same.f.b.a().execute(runnable);
            } else {
                runnable.run();
            }
        } catch (Throwable th) {
            v.d(TAG, th.getMessage());
        }
    }

    @Override
    public void onPlayProgress(int i, int i10) {
        int i11;
        String str;
        CampaignEx.b mediaViewHolder;
        CampaignEx.b mediaViewHolder2;
        Map<Integer, String> map;
        try {
            CampaignEx campaignEx = this.N;
            if (campaignEx != null && (mediaViewHolder2 = campaignEx.getMediaViewHolder()) != null && !mediaViewHolder2.h && (map = mediaViewHolder2.l) != null && map.size() > 0) {
                Map<Integer, String> map2 = mediaViewHolder2.l;
                Iterator<Map.Entry<Integer, String>> it = map2.entrySet().iterator();
                while (it.hasNext()) {
                    Map.Entry<Integer, String> next = it.next();
                    Integer key = next.getKey();
                    String value = next.getValue();
                    if (i >= key.intValue() && !TextUtils.isEmpty(value)) {
                        Context context = getContext();
                        CampaignEx campaignEx2 = this.N;
                        com.mbridge.msdk.click.a.a(context, campaignEx2, campaignEx2.getCampaignUnitId(), value, false, false);
                        it.remove();
                    }
                }
                if (map2.size() <= 0) {
                    mediaViewHolder2.h = true;
                }
            }
        } catch (Exception e10) {
            v.d(TAG, e10.getMessage());
        }
        try {
            CampaignEx campaignEx3 = this.N;
            if (campaignEx3 != null && (mediaViewHolder = campaignEx3.getMediaViewHolder()) != null && !mediaViewHolder.i && i10 != 0) {
                List<Map<Integer, String>> b10 = this.N.getNativeVideoTracking().b();
                int i12 = ((i + 1) * 100) / i10;
                if (b10 != null) {
                    int i13 = 0;
                    while (i13 < b10.size()) {
                        Map<Integer, String> map3 = b10.get(i13);
                        if (map3 != null && map3.size() > 0) {
                            Iterator<Map.Entry<Integer, String>> it2 = map3.entrySet().iterator();
                            while (it2.hasNext()) {
                                Map.Entry<Integer, String> next2 = it2.next();
                                int intValue = next2.getKey().intValue();
                                String value2 = next2.getValue();
                                if (intValue <= i12 && !TextUtils.isEmpty(value2)) {
                                    Context context2 = getContext();
                                    CampaignEx campaignEx4 = this.N;
                                    com.mbridge.msdk.click.a.a(context2, campaignEx4, campaignEx4.getCampaignUnitId(), new String[]{value2}, false, true);
                                    it2.remove();
                                    b10.remove(i13);
                                    i13--;
                                }
                            }
                        }
                        i13++;
                    }
                    if (b10.size() <= 0) {
                        mediaViewHolder.i = true;
                    }
                }
            }
        } catch (Throwable unused) {
            v.d(TAG, "reportPlayPercentageData error");
        }
        MediaEvents mediaEvents = this.u;
        if (mediaEvents != null) {
            int i14 = (i * 100) / i10;
            int i15 = ((i + 1) * 100) / i10;
            if (i14 <= 25 && 25 < i15) {
                mediaEvents.firstQuartile();
            } else if (i14 <= 50 && 50 < i15) {
                mediaEvents.midpoint();
            } else if (i14 <= 75 && 75 < i15) {
                mediaEvents.thirdQuartile();
            }
        }
        if (s() == 100 || this.am) {
            return;
        }
        int f10 = t() != null ? t().f() : 0;
        int s = s();
        if (s == 0) {
            return;
        }
        if (f10 > s) {
            f10 = s / 2;
        }
        if (f10 < 0 || i < (i11 = (f10 * i10) / 100)) {
            return;
        }
        if (this.N.getAdType() == 94 || this.N.getAdType() == 287) {
            str = this.N.getRequestId() + this.N.getId() + this.N.getVideoUrlEncode();
        } else {
            str = this.N.getId() + this.N.getVideoUrlEncode() + this.N.getBidToken();
        }
        com.mbridge.msdk.videocommon.download.a a10 = com.mbridge.msdk.videocommon.download.c.getInstance().a(o(), str);
        if (a10 != null) {
            a10.j();
            this.am = true;
            v.d(TAG, "CDRate is : " + i11 + " and start download !");
        }
    }

    @Override
    public void onPlaySetDataSourceError(String str) {
        v.b("errorstr", str);
    }

    @Override
    public void onPlayStarted(int i) {
        MediaEvents mediaEvents = this.u;
        if (mediaEvents != null) {
            try {
                mediaEvents.start(i, this.f ? 1.0f : 0.0f);
            } catch (IllegalArgumentException e10) {
                v.a("omsdk", e10.getMessage());
            }
        }
    }

    @Override
    public void onWindowFocusChanged(boolean z10) {
        MediaViewPlayerView mediaViewPlayerView;
        super.onWindowFocusChanged(z10);
        try {
            this.e = z10;
            if (this.f436ab == a.VIDEO && (mediaViewPlayerView = this.w) != null) {
                mediaViewPlayerView.setIsFrontDesk(z10);
            }
            try {
                if (this.h) {
                    MediaViewPlayerView mediaViewPlayerView2 = this.w;
                    if (mediaViewPlayerView2 == null) {
                        v.d(TAG, "fullscreen playerview is null return");
                    } else if (!this.e) {
                        mediaViewPlayerView2.pause();
                    } else if (mediaViewPlayerView2.isPlaying()) {
                        v.b(TAG, "fullscreen windowfocuse true isPlaying do nothing return");
                    } else {
                        MediaViewPlayerView mediaViewPlayerView3 = this.w;
                        if (mediaViewPlayerView3 != null && !mediaViewPlayerView3.isComplete() && !this.w.getIsActiviePause()) {
                            this.w.onClickPlayButton();
                        }
                    }
                }
            } catch (Throwable th) {
                v.d(TAG, th.getMessage());
            }
            requestLayout();
        } catch (Throwable th2) {
            v.d(TAG, th2.getMessage());
        }
    }

    public void openURL(Object obj, String str) {
        WindVaneWebView windVaneWebView;
        v.d(TAG, "openURL:" + str);
        if (TextUtils.isEmpty(str)) {
            com.mbridge.msdk.mbsignalcommon.communication.b.a(obj, "params is null");
            return;
        }
        Context f10 = com.mbridge.msdk.foundation.controller.a.d().f();
        if (TextUtils.isEmpty(str)) {
            return;
        }
        if (f10 == null) {
            try {
                if ((obj instanceof com.mbridge.msdk.mbsignalcommon.windvane.a) && (windVaneWebView = ((com.mbridge.msdk.mbsignalcommon.windvane.a) obj).a) != null) {
                    f10 = windVaneWebView.getContext();
                }
            } catch (Exception e10) {
                v.d(TAG, e10.getMessage());
            }
        }
        if (f10 == null) {
            return;
        }
        try {
            JSONObject jSONObject = new JSONObject(str);
            String optString = jSONObject.optString("url");
            int optInt = jSONObject.optInt("type");
            if (optInt == 1) {
                com.mbridge.msdk.click.b.a(f10, optString);
            } else if (optInt == 2) {
                com.mbridge.msdk.click.b.b(f10, optString);
            }
        } catch (JSONException e11) {
            v.d(TAG, e11.getMessage());
        } catch (Throwable th) {
            v.d(TAG, th.getMessage());
        }
    }

    public void setAllowLoopPlay(boolean z10) {
        this.b = z10;
    }

    public void setAllowScreenChange(boolean z10) {
        this.c = z10;
    }

    public void setAllowVideoRefresh(boolean z10) {
        this.a = z10;
    }

    public void setFollowActivityOrientation(boolean z10) {
        this.ak = z10;
    }

    public void setFullScreenViewBackgroundColor(int i) {
        this.v = i;
    }

    public void setIsAllowFullScreen(boolean z10) {
        this.d = z10;
    }

    public void setNativeAd(com.mbridge.msdk.out.Campaign r9) {
        throw new UnsupportedOperationException("Method not decompiled: com.mbridge.msdk.nativex.view.MBMediaView.setNativeAd(com.mbridge.msdk.out.Campaign):void");
    }

    public void setOnMediaViewListener(OnMBMediaViewListener onMBMediaViewListener) {
        this.f437ac = onMBMediaViewListener;
    }

    public void setProgressVisibility(boolean z10) {
        this.k = z10;
        MediaViewPlayerView mediaViewPlayerView = this.w;
        if (mediaViewPlayerView != null) {
            mediaViewPlayerView.showProgressView(z10);
        }
    }

    public void setSoundIndicatorVisibility(boolean z10) {
        this.l = z10;
        MediaViewPlayerView mediaViewPlayerView = this.w;
        if (mediaViewPlayerView != null) {
            mediaViewPlayerView.showSoundIndicator(z10);
        }
    }

    public void setVideoSoundOnOff(boolean z10) {
        this.f = z10;
        MediaViewPlayerView mediaViewPlayerView = this.w;
        if (mediaViewPlayerView != null) {
            if (z10) {
                mediaViewPlayerView.openSound();
            } else {
                mediaViewPlayerView.closeSound();
            }
        }
    }

    public void showEndCardWebViewCloseBtn() {
        ImageView imageView = this.ai;
        if (imageView == null || imageView.getVisibility() == 0) {
            return;
        }
        this.ai.setVisibility(0);
    }

    public void toggleCloseBtn(Object obj, String str) {
        try {
            if (!TextUtils.isEmpty(str)) {
                try {
                    new JSONObject(str).optInt("state", 1);
                } catch (Exception e10) {
                    v.d(TAG, e10.getMessage());
                }
            }
            v.d(TAG, "SHOW CLOSE BTN ");
            showEndCardWebViewCloseBtn();
            com.mbridge.msdk.mbsignalcommon.windvane.g.a().a(obj, a(0));
        } catch (Exception e11) {
            v.d(TAG, e11.getMessage());
            com.mbridge.msdk.mbsignalcommon.windvane.g.a().b(obj, a(1));
        }
    }

    public void triggerCloseBtn(Object obj, String str) {
        try {
            exitFullScreen();
            com.mbridge.msdk.mbsignalcommon.windvane.g.a().a(obj, a(0));
        } catch (Exception e10) {
            v.d(TAG, e10.getMessage());
            com.mbridge.msdk.mbsignalcommon.windvane.g.a().b(obj, a(1));
        }
    }

    public void updateViewManger(boolean z10) {
        com.mbridge.msdk.nativex.view.mbfullview.a a10 = com.mbridge.msdk.nativex.view.mbfullview.a.a(getContext());
        boolean z11 = true;
        int i = 0;
        if (a10 != null) {
            try {
                this.F.getmAnimationPlayer().clearAnimation();
                a10.a(z10, !this.w.isComplete(), this.F);
                a10.a(z10, this.F, this.f439ae);
            } catch (NullPointerException e10) {
                e10.printStackTrace();
                return;
            }
        }
        BaseView baseView = this.F;
        if (!(baseView instanceof MBridgeTopFullView) || a10 == null) {
            return;
        }
        if (z10) {
            z11 = false;
        }
        if (baseView instanceof MBridgeTopFullView) {
            MBridgeTopFullView mBridgeTopFullView = (MBridgeTopFullView) baseView;
            if (!z11) {
                i = 8;
            }
            mBridgeTopFullView.getMBridgeFullViewDisplayIcon().setVisibility(i);
            mBridgeTopFullView.getMBridgeFullViewDisplayTitle().setVisibility(i);
            mBridgeTopFullView.getMBridgeFullViewDisplayDscription().setVisibility(i);
            mBridgeTopFullView.getStarLevelLayoutView().setVisibility(i);
        }
    }

    public static final class c implements com.mbridge.msdk.nativex.listener.a {
        WeakReference<MBMediaView> a;

        public c(MBMediaView mBMediaView) {
            this.a = new WeakReference<>(mBMediaView);
        }

        @Override
        public final void a() {
            MBMediaView mBMediaView = this.a.get();
            if (mBMediaView != null) {
                MBMediaView.N(mBMediaView);
            }
        }

        @Override
        public final void b() {
            MBMediaView mBMediaView = this.a.get();
            if (mBMediaView != null) {
                MBMediaView.O(mBMediaView);
            }
        }

        @Override
        public final void c() {
            MBMediaView mBMediaView = this.a.get();
            if (mBMediaView != null) {
                MBMediaView.P(mBMediaView);
            }
        }

        @Override
        public final void d() {
            MBMediaView mBMediaView = this.a.get();
            if (mBMediaView != null) {
                MBMediaView.Q(mBMediaView);
            }
        }

        @Override
        public final void a(String str) {
            MBMediaView mBMediaView = this.a.get();
            if (mBMediaView != null) {
                mBMediaView.a(str);
            }
        }

        @Override
        public final void b(String str) {
            MBMediaView mBMediaView = this.a.get();
            if (mBMediaView != null) {
                mBMediaView.b(str);
            }
        }
    }

    public float A() {
        try {
            float i = aa.i(getContext());
            return this.i ? i + aa.k(getContext()) : i;
        } catch (Throwable th) {
            v.d(TAG, th.getMessage());
            return 0.0f;
        }
    }

    private float B() {
        try {
            float j = aa.j(getContext());
            return !this.i ? j + aa.k(getContext()) : j;
        } catch (Throwable th) {
            v.d(TAG, th.getMessage());
            return 0.0f;
        }
    }

    public void C() {
        try {
            if (this.H == null && this.ai == null) {
                return;
            }
            RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(aa.b(getContext(), 30.0f), aa.b(getContext(), 30.0f));
            layoutParams.addRule(11);
            layoutParams.addRule(10);
            layoutParams.topMargin = aa.b(getContext(), 8.0f);
            layoutParams.rightMargin = aa.b(getContext(), 8.0f);
            RelativeLayout relativeLayout = this.H;
            if (relativeLayout != null) {
                relativeLayout.setLayoutParams(layoutParams);
            }
            ImageView imageView = this.ai;
            if (imageView != null) {
                imageView.setLayoutParams(layoutParams);
            }
            updateViewManger(false);
        } catch (Throwable th) {
            v.d(TAG, th.getMessage());
        }
    }

    public void D() {
        try {
            if (this.H == null && this.ai == null) {
                return;
            }
            RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(aa.b(getContext(), 30.0f), aa.b(getContext(), 30.0f));
            layoutParams.addRule(11);
            layoutParams.addRule(10);
            if (this.f439ae == 0 && h.a(getContext())) {
                layoutParams.rightMargin = aa.k(getContext()) + aa.b(getContext(), 8.0f);
            } else {
                layoutParams.rightMargin = aa.b(getContext(), 8.0f);
            }
            layoutParams.topMargin = aa.b(getContext(), 8.0f);
            RelativeLayout relativeLayout = this.H;
            if (relativeLayout != null) {
                relativeLayout.setLayoutParams(layoutParams);
            }
            ImageView imageView = this.ai;
            if (imageView != null) {
                imageView.setLayoutParams(layoutParams);
            }
            updateViewManger(true);
        } catch (Throwable th) {
            v.d(TAG, th.getMessage());
        }
    }

    private void E() {
        try {
            CampaignEx campaignEx = this.N;
            if (campaignEx == null || campaignEx.getNativeVideoTracking() == null) {
                return;
            }
            String[] a10 = this.N.getNativeVideoTracking().a();
            int i = this.i ? o : p;
            for (String str : a10) {
                if (!TextUtils.isEmpty(str)) {
                    Context context = getContext();
                    CampaignEx campaignEx2 = this.N;
                    com.mbridge.msdk.click.a.a(context, campaignEx2, campaignEx2.getCampaignUnitId(), str + "&orienation=" + i, false, false);
                }
            }
        } catch (Exception e10) {
            v.d(TAG, e10.getMessage());
        }
    }

    public WindVaneWebViewForNV F() {
        try {
            WindVaneWebViewForNV windVaneWebViewForNV = this.B;
            if (windVaneWebViewForNV != null && this.ag) {
                return windVaneWebViewForNV;
            }
            if (this.ag) {
                return null;
            }
            b(true);
            return null;
        } catch (Exception e10) {
            v.d(TAG, e10.getMessage());
            return null;
        }
    }

    private void d() {
        AdSession adSession;
        try {
            this.f436ab = a(true);
            changeNoticeURL();
            a aVar = this.f436ab;
            if (aVar == a.BIG_IMAGE) {
                CampaignEx campaignEx = this.N;
                if (campaignEx != null && TextUtils.isEmpty(campaignEx.getVideoUrlEncode()) && (adSession = this.s) != null) {
                    try {
                        adSession.registerAdView(this.C);
                        this.t = AdEvents.createAdEvents(this.s);
                        this.s.start();
                        AdEvents adEvents = this.t;
                        if (adEvents != null) {
                            adEvents.impressionOccurred();
                        }
                    } catch (Exception e10) {
                        v.a("omsdk", e10.getMessage());
                    }
                }
                j();
                m();
            } else if (aVar == a.VIDEO) {
                e();
            } else if (aVar == a.GIF) {
                n();
                l();
            }
            this.q = true;
        } catch (Throwable th) {
            v.a(TAG, th.getMessage(), th);
        }
    }

    public void e() {
        z();
        k();
    }

    public void f() {
        int i;
        int i10;
        int i11;
        try {
            if (this.f436ab != a.BIG_IMAGE || (i = this.P) == 0 || (i10 = this.T) == 0 || (i11 = this.S) == 0) {
                return;
            }
            int i12 = (i * i10) / i11;
            MyImageView myImageView = this.C;
            if (myImageView == null || i12 == 0) {
                return;
            }
            RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) myImageView.getLayoutParams();
            layoutParams.width = this.P;
            layoutParams.height = i12;
            this.C.setLayoutParams(layoutParams);
        } catch (Throwable th) {
            v.d(TAG, th.getMessage());
        }
    }

    public void g() {
        RelativeLayout relativeLayout;
        int i;
        int i10;
        try {
            if (this.f436ab == a.GIF) {
                int i11 = this.P;
                if (i11 != 0 && (i = this.T) != 0 && (i10 = this.S) != 0) {
                    int i12 = (i11 * i) / i10;
                    RelativeLayout relativeLayout2 = this.f442z;
                    if (relativeLayout2 != null && i12 != 0) {
                        RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) relativeLayout2.getLayoutParams();
                        layoutParams.width = this.P;
                        layoutParams.height = i12;
                        layoutParams.addRule(13);
                        this.f442z.setLayoutParams(layoutParams);
                    }
                } else if (i11 != 0 && (relativeLayout = this.f442z) != null) {
                    RelativeLayout.LayoutParams layoutParams2 = (RelativeLayout.LayoutParams) relativeLayout.getLayoutParams();
                    int i13 = this.P;
                    layoutParams2.width = i13;
                    layoutParams2.height = (i13 * 627) / 1200;
                    layoutParams2.addRule(13);
                    this.f442z.setLayoutParams(layoutParams2);
                }
            }
        } catch (Throwable th) {
            v.d(TAG, th.getMessage());
        }
    }

    private void j() {
        try {
            aa.a((ImageView) this.C);
            this.C.setVisibility(0);
            this.f440x.setVisibility(8);
            this.f442z.setVisibility(8);
        } catch (Throwable th) {
            v.d(TAG, th.getMessage());
        }
    }

    private void k() {
        try {
            this.f440x.setVisibility(0);
            this.C.setVisibility(8);
            this.f442z.setVisibility(8);
        } catch (Throwable th) {
            v.d(TAG, th.getMessage());
        }
    }

    public void l() {
        try {
            this.f440x.setVisibility(8);
            this.C.setVisibility(8);
            this.f442z.setVisibility(0);
            this.A.setVisibility(0);
        } catch (Throwable th) {
            v.d(TAG, th.getMessage());
        }
    }

    private void m() {
        try {
            CampaignEx campaignEx = this.N;
            if (campaignEx == null) {
                return;
            }
            String imageUrl = campaignEx.getImageUrl();
            if (ae.a(imageUrl) || getContext() == null) {
                return;
            }
            com.mbridge.msdk.foundation.same.c.b.a(com.mbridge.msdk.foundation.controller.a.d().f()).a(imageUrl, new com.mbridge.msdk.foundation.same.c.c() {
                @Override
                public final void onSuccessLoad(Bitmap bitmap, String str) {
                    if (MBMediaView.this.C == null || MBMediaView.this.f436ab != a.BIG_IMAGE) {
                        return;
                    }
                    if (bitmap != null) {
                        MBMediaView.this.S = bitmap.getWidth();
                        MBMediaView.this.T = bitmap.getHeight();
                        MBMediaView.this.C.setImageUrl(str);
                        MBMediaView.this.C.setImageBitmap(bitmap);
                    }
                    MBMediaView.this.C.setOnClickListener(new com.mbridge.msdk.widget.a() {
                        public final void a(View view) {
                            if (MBMediaView.this.al == null) {
                                MBMediaView.this.b(view.getContext());
                            } else {
                                MBMediaView mBMediaView = MBMediaView.this;
                                mBMediaView.b(mBMediaView.al);
                            }
                        }
                    });
                }

                @Override
                public final void onFailedLoad(String str, String str2) {
                }
            });
        } catch (Throwable th) {
            v.d(TAG, th.getMessage());
        }
    }

    private int s() {
        if (t() != null) {
            return t().e();
        }
        return 100;
    }

    private com.mbridge.msdk.c.d t() {
        try {
            CampaignEx campaignEx = this.N;
            if (campaignEx != null && !ae.a(campaignEx.getCampaignUnitId())) {
                String campaignUnitId = this.N.getCampaignUnitId();
                String g6 = com.mbridge.msdk.foundation.controller.a.d().g();
                if (!ae.a(campaignUnitId) && !ae.a(g6)) {
                    com.mbridge.msdk.c.d e10 = com.mbridge.msdk.c.b.a().e(g6, campaignUnitId);
                    return e10 != null ? e10 : com.mbridge.msdk.c.d.d(campaignUnitId);
                }
                return com.mbridge.msdk.c.d.d(campaignUnitId);
            }
            return null;
        } catch (Exception e11) {
            v.d(TAG, e11.getMessage());
            return null;
        }
    }

    private boolean u() {
        com.mbridge.msdk.c.d t;
        try {
            t = t();
        } catch (Throwable th) {
            v.d(TAG, th.getMessage());
        }
        if (t == null) {
            return false;
        }
        int i = t.i();
        if (i == 1) {
            return aa.b(getContext());
        }
        if (i == 2) {
            return false;
        }
        return i == 3 ? aa.c(getContext()) : aa.b(getContext());
    }

    public View v() {
        try {
            this.ah = new RelativeLayout(getContext());
            this.ah.setLayoutParams(new RelativeLayout.LayoutParams(-1, -1));
            ImageView imageView = new ImageView(getContext());
            this.ai = imageView;
            imageView.setScaleType(ImageView.ScaleType.FIT_XY);
            RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(aa.b(getContext(), 30.0f), aa.b(getContext(), 30.0f));
            layoutParams.addRule(11);
            layoutParams.addRule(10);
            layoutParams.topMargin = aa.b(getContext(), 8.0f);
            layoutParams.rightMargin = aa.b(getContext(), 8.0f);
            this.ai.setLayoutParams(layoutParams);
            this.ai.setBackgroundResource(p.a(getContext(), "mbridge_nativex_close", "drawable"));
            this.ai.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    MBMediaView.this.exitFullScreen();
                }
            });
            this.B.setLayoutParams(new RelativeLayout.LayoutParams(-1, -1));
            this.ah.addView(this.B);
            this.ah.addView(this.ai);
            return this.ah;
        } catch (Exception e10) {
            v.d(TAG, e10.getMessage());
            return null;
        }
    }

    public void w() {
        try {
            FrameLayout frameLayout = (FrameLayout) getRootView().findViewById(R.id.content);
            FrameLayout frameLayout2 = (FrameLayout) getRootView().findViewById(100);
            RelativeLayout relativeLayout = (RelativeLayout) getRootView().findViewById(101);
            RelativeLayout relativeLayout2 = (RelativeLayout) getRootView().findViewById(103);
            if (relativeLayout2 == null && relativeLayout != null) {
                relativeLayout2 = (RelativeLayout) relativeLayout.findViewById(103);
            }
            RelativeLayout relativeLayout3 = (RelativeLayout) getRootView().findViewById(p.a(getContext(), "mbridge_full_rl_playcontainer", "id"));
            if (relativeLayout3 == null && relativeLayout2 != null) {
                relativeLayout3 = (RelativeLayout) relativeLayout2.findViewById(p.a(getContext(), "mbridge_full_rl_playcontainer", "id"));
            }
            RelativeLayout relativeLayout4 = (RelativeLayout) getRootView().findViewById(p.a(getContext(), "mbridge_full_player_parent", "id"));
            if (relativeLayout4 == null && relativeLayout3 != null) {
                relativeLayout4 = (RelativeLayout) relativeLayout3.findViewById(p.a(getContext(), "mbridge_full_player_parent", "id"));
            }
            ProgressBar progressBar = (ProgressBar) getRootView().findViewById(p.a(getContext(), "mbridge_full_pb_loading", "id"));
            RelativeLayout relativeLayout5 = (RelativeLayout) getRootView().findViewById(p.a(getContext(), "mbridge_full_rl_install", "id"));
            LinearLayout linearLayout = (LinearLayout) getRootView().findViewById(p.a(getContext(), "mbridge_full_ll_pro_dur", "id"));
            ViewGroup viewGroup = frameLayout2 != null ? (ViewGroup) frameLayout2.getParent() : null;
            if (relativeLayout2 != null) {
                relativeLayout2.removeView(linearLayout);
            } else if (linearLayout != null && linearLayout.getParent() != null) {
                ((ViewGroup) linearLayout.getParent()).removeView(linearLayout);
            }
            RelativeLayout relativeLayout6 = this.ah;
            if (relativeLayout6 != null) {
                if (relativeLayout2 != null) {
                    relativeLayout2.removeView(relativeLayout6);
                } else if (relativeLayout6.getParent() != null) {
                    ((ViewGroup) this.ah.getParent()).removeView(this.ah);
                }
                this.B.setBackListener(null);
                this.B.setObject(null);
                this.B = null;
                this.ah = null;
            }
            if (relativeLayout2 != null) {
                relativeLayout2.removeView(relativeLayout5);
            } else if (relativeLayout5 != null && relativeLayout5.getParent() != null) {
                ((ViewGroup) relativeLayout5.getParent()).removeView(relativeLayout5);
            }
            if (relativeLayout2 != null) {
                relativeLayout2.removeView(progressBar);
            } else if (progressBar != null && progressBar.getParent() != null) {
                ((ViewGroup) progressBar.getParent()).removeView(progressBar);
            }
            if (relativeLayout4 != null) {
                relativeLayout4.removeView(this.w);
            }
            if (relativeLayout3 != null) {
                relativeLayout3.removeView(relativeLayout4);
            } else if (relativeLayout4 != null && relativeLayout4.getParent() != null) {
                ((ViewGroup) relativeLayout4.getParent()).removeView(relativeLayout4);
            }
            if (relativeLayout2 != null) {
                relativeLayout2.removeView(relativeLayout3);
            } else if (relativeLayout3 == null || relativeLayout3.getParent() == null) {
                BaseView baseView = this.F;
                if (baseView != null) {
                    baseView.removeView(this.G);
                }
            } else {
                ((ViewGroup) relativeLayout3.getParent()).removeView(relativeLayout3);
            }
            if (relativeLayout != null) {
                relativeLayout.removeView(relativeLayout2);
            } else if (relativeLayout2 == null || relativeLayout2.getParent() == null) {
                View view = this.E;
                if (view != null) {
                    ((ViewGroup) view).removeView(this.F);
                    ((ViewGroup) this.E.getParent()).removeView(this.E);
                }
            } else {
                ((ViewGroup) relativeLayout2.getParent()).removeView(relativeLayout2);
            }
            if (frameLayout != null) {
                if (relativeLayout != null) {
                    frameLayout.removeView(relativeLayout);
                } else {
                    frameLayout.removeView(this.E);
                    if (this.E.getParent() != null) {
                        ((ViewGroup) this.E.getParent()).removeView(this.E);
                        this.E.setVisibility(8);
                    }
                }
            }
            setVisibility(0);
            requestLayout();
            if (viewGroup != null) {
                if (this.w.getParent() != null && this.w.getParent() != viewGroup) {
                    ((ViewGroup) this.w.getParent()).removeView(this.w);
                }
                viewGroup.addView(this.w, this.L);
                viewGroup.removeView(frameLayout2);
                viewGroup.invalidate();
            }
            i();
            this.h = false;
            MediaViewPlayerView mediaViewPlayerView = this.w;
            if (mediaViewPlayerView != null) {
                mediaViewPlayerView.setExitFullScreen();
                if (this.f) {
                    this.w.openSound();
                } else {
                    this.w.closeSound();
                }
                this.w.gonePauseView();
            }
        } catch (Exception e10) {
            v.d(TAG, e10.getMessage());
        }
    }

    private boolean x() {
        try {
            this.G = this.F.getMBridgeFullPlayContainer();
            this.K = this.F.getMBridgeFullPlayerParent();
            this.H = this.F.getMBridgeFullClose();
            this.I = this.F.getMBridgeFullTvInstall();
            this.J = this.F.getMBridgeFullPb();
            return true;
        } catch (Throwable th) {
            v.d(TAG, th.getMessage());
            return false;
        }
    }

    private void y() {
        try {
            this.i = aa.i(getContext()) >= aa.j(getContext());
            this.j = this.i;
        } catch (Throwable th) {
            v.d(TAG, th.getMessage());
        }
    }

    private void z() {
        String[] split;
        try {
            CampaignEx campaignEx = this.N;
            if (campaignEx == null || ae.a(campaignEx.getVideoResolution()) || (split = this.N.getVideoResolution().split("x")) == null || split.length != 2) {
                return;
            }
            String str = split[0];
            String str2 = split[1];
            double b10 = aa.b(str);
            double b11 = aa.b(str2);
            if (b10 <= 0.0d || b11 <= 0.0d) {
                return;
            }
            this.Q = b10;
            this.R = b11;
        } catch (Throwable th) {
            v.d(TAG, th.getMessage());
        }
    }

    public void setOnMediaViewListener(OnMBMediaViewListenerPlus onMBMediaViewListenerPlus) {
        this.f438ad = onMBMediaViewListenerPlus;
    }

    private void b() {
        int a10 = p.a(getContext(), "mbridge_nativex_mbmediaview", TtmlNode.TAG_LAYOUT);
        if (a10 == -1) {
            v.d(TAG, "can not find mediaview resource");
            return;
        }
        View inflate = LayoutInflater.from(getContext()).inflate(a10, (ViewGroup) null);
        this.f441y = (RelativeLayout) inflate.findViewById(p.a(getContext(), "mbridge_rl_mediaview_root", "id"));
        this.f440x = (RelativeLayout) inflate.findViewById(p.a(getContext(), "mbridge_ll_playerview_container", "id"));
        this.C = inflate.findViewById(p.a(getContext(), "mbridge_my_big_img", "id"));
        this.D = (ProgressBar) inflate.findViewById(p.a(getContext(), "mbridge_native_pb", "id"));
        this.f442z = (RelativeLayout) inflate.findViewById(p.a(getContext(), "mbridge_nativex_webview_layout", "id"));
        this.A = (WindVaneWebViewForNV) inflate.findViewById(p.a(getContext(), "mbridge_nativex_webview_layout_webview", "id"));
        this.f441y.setClickable(true);
        addView(inflate, -1, -1);
    }

    private void c() {
        this.M = new Handler() {
            @Override
            public final void handleMessage(Message message) {
                Object obj;
                if (message != null) {
                    try {
                        int i = message.what;
                        if (i == 1) {
                            MBMediaView.this.q();
                        } else if (i == 3 && (obj = message.obj) != null && (obj instanceof View)) {
                            if (MBMediaView.this.a((View) obj)) {
                                MBMediaView.b(MBMediaView.this);
                            }
                        }
                    } catch (Exception e10) {
                        v.d(MBMediaView.TAG, e10.getMessage());
                    }
                }
            }
        };
    }

    private boolean c(Context context) {
        return (context.getResources().getConfiguration().screenLayout & 15) >= 3;
    }

    public static void o(MBMediaView mBMediaView) {
        try {
            ProgressBar progressBar = mBMediaView.J;
            if (progressBar != null) {
                progressBar.setVisibility(0);
            }
        } catch (Exception e10) {
            v.d(TAG, e10.getMessage());
        }
    }

    public static void c(MBMediaView mBMediaView, Campaign campaign, String str) {
        try {
            OnMBMediaViewListener onMBMediaViewListener = mBMediaView.f437ac;
            if (onMBMediaViewListener != null) {
                onMBMediaViewListener.onFinishRedirection(campaign, str);
            }
            OnMBMediaViewListenerPlus onMBMediaViewListenerPlus = mBMediaView.f438ad;
            if (onMBMediaViewListenerPlus != null) {
                onMBMediaViewListenerPlus.onFinishRedirection(campaign, str);
            }
        } catch (Exception e10) {
            v.d(TAG, e10.getMessage());
        }
    }

    private void a(Context context) {
        try {
            c();
            b();
            this.al = context;
        } catch (Throwable th) {
            v.d(TAG, th.getMessage());
        }
    }

    public static void r(MBMediaView mBMediaView) {
        CampaignEx campaignEx = mBMediaView.N;
        if (campaignEx == null || campaignEx.getMediaViewHolder() == null || mBMediaView.N.getMediaViewHolder().d || TextUtils.isEmpty(mBMediaView.N.getCampaignUnitId()) || mBMediaView.N.getNativeVideoTracking() == null || mBMediaView.N.getNativeVideoTracking().h() == null) {
            return;
        }
        mBMediaView.N.getMediaViewHolder().d = true;
        Context context = mBMediaView.getContext();
        CampaignEx campaignEx2 = mBMediaView.N;
        com.mbridge.msdk.click.a.a(context, campaignEx2, campaignEx2.getCampaignUnitId(), mBMediaView.N.getNativeVideoTracking().h(), false, false);
    }

    public static void i(MBMediaView mBMediaView) {
        try {
            MediaViewPlayerView mediaViewPlayerView = mBMediaView.w;
            if (mediaViewPlayerView == null) {
                return;
            }
            mediaViewPlayerView.onClickPlayerView();
        } catch (Throwable th) {
            v.d(TAG, th.getMessage());
        }
    }

    public static void n(MBMediaView mBMediaView) {
        try {
            ProgressBar progressBar = mBMediaView.D;
            if (progressBar != null) {
                progressBar.setVisibility(0);
            }
        } catch (Exception e10) {
            v.d(TAG, e10.getMessage());
        }
    }

    private void a() {
        com.mbridge.msdk.videocommon.download.a aVar = this.f435aa;
        if (aVar != null) {
            aVar.b((com.mbridge.msdk.videocommon.listener.a) null);
        }
    }

    public final void a(String str) {
        try {
            if (TextUtils.isEmpty(str) || this.m.contains(str)) {
                return;
            }
            this.m.add(str);
            OnMBMediaViewListener onMBMediaViewListener = this.f437ac;
            if (onMBMediaViewListener != null) {
                onMBMediaViewListener.onVideoStart();
            }
            OnMBMediaViewListenerPlus onMBMediaViewListenerPlus = this.f438ad;
            if (onMBMediaViewListenerPlus != null) {
                onMBMediaViewListenerPlus.onVideoStart();
            }
        } catch (Exception e10) {
            v.d(TAG, e10.getMessage());
        }
    }

    public final void b(String str) {
        try {
            if (TextUtils.isEmpty(str) || this.n.contains(str)) {
                return;
            }
            this.n.add(str);
            OnMBMediaViewListenerPlus onMBMediaViewListenerPlus = this.f438ad;
            if (onMBMediaViewListenerPlus != null) {
                onMBMediaViewListenerPlus.onVideoComplete();
            }
        } catch (Exception e10) {
            v.d(TAG, e10.getMessage());
        }
    }

    private void b(View view) {
        if (view == null) {
            return;
        }
        try {
            RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) view.getLayoutParams();
            layoutParams.width = -1;
            if (this.i) {
                layoutParams.height = -1;
            } else {
                layoutParams.height = (((int) A()) * 9) / 16;
                layoutParams.addRule(13);
            }
            view.setLayoutParams(layoutParams);
        } catch (Exception e10) {
            v.d(TAG, e10.getMessage());
        }
    }

    public static void q(MBMediaView mBMediaView) {
        try {
            ProgressBar progressBar = mBMediaView.J;
            if (progressBar != null) {
                progressBar.setVisibility(8);
            }
        } catch (Exception e10) {
            v.d(TAG, e10.getMessage());
        }
    }

    private a a(boolean z10) {
        try {
            CampaignEx campaignEx = this.N;
            if (campaignEx == null) {
                return null;
            }
            if (ae.a(campaignEx.getVideoUrlEncode())) {
                a aVar = ae.b(this.N.getImageUrl()) ? a.BIG_IMAGE : null;
                if (!ae.b(this.N.getGifUrl())) {
                    return aVar;
                }
                if (ae.a(this.N.getImageUrl())) {
                    aVar = a.GIF;
                }
                this.A.setWebViewClient(new g(this));
                n();
                return aVar;
            }
            if (this.g && this.f435aa != null) {
                if (ae.b(this.N.getVideoUrlEncode()) && ae.a(this.N.getImageUrl())) {
                    return a.VIDEO;
                }
                if (!ae.b(this.N.getVideoUrlEncode()) || !ae.b(this.N.getImageUrl())) {
                    return null;
                }
                if (k.a(this.f435aa, s())) {
                    return a.VIDEO;
                }
                a aVar2 = a.BIG_IMAGE;
                if (z10 && this.a) {
                    this.f435aa.b(new f(this));
                }
                return aVar2;
            }
            return a.BIG_IMAGE;
        } catch (Throwable th) {
            v.d(TAG, th.getMessage());
            return a.BIG_IMAGE;
        }
    }

    public static void h(MBMediaView mBMediaView) {
        WindowInsets rootWindowInsets;
        try {
            if (mBMediaView.getRootView() != null && (mBMediaView.getRootView() instanceof ViewGroup)) {
                BaseView.a handleViewStyleResult = mBMediaView.handleViewStyleResult(mBMediaView.getContext());
                if (handleViewStyleResult == null) {
                    return;
                }
                BaseView fullScreenViewByStyle = mBMediaView.getFullScreenViewByStyle(mBMediaView.getContext(), handleViewStyleResult);
                mBMediaView.F = fullScreenViewByStyle;
                if (fullScreenViewByStyle != null && mBMediaView.x()) {
                    com.mbridge.msdk.nativex.view.mbfullview.a a10 = com.mbridge.msdk.nativex.view.mbfullview.a.a(mBMediaView.getContext());
                    BaseView baseView = mBMediaView.F;
                    a10.a(baseView.style, mBMediaView.N, baseView);
                    mBMediaView.h = true;
                    mBMediaView.r = false;
                    MediaViewPlayerView mediaViewPlayerView = mBMediaView.w;
                    if (mediaViewPlayerView != null) {
                        mediaViewPlayerView.setEnterFullScreen();
                        mBMediaView.w.setIsActivePause(false);
                    }
                    try {
                        OnMBMediaViewListener onMBMediaViewListener = mBMediaView.f437ac;
                        if (onMBMediaViewListener != null) {
                            onMBMediaViewListener.onEnterFullscreen();
                        }
                        OnMBMediaViewListenerPlus onMBMediaViewListenerPlus = mBMediaView.f438ad;
                        if (onMBMediaViewListenerPlus != null) {
                            onMBMediaViewListenerPlus.onEnterFullscreen();
                        }
                        MediaEvents mediaEvents = mBMediaView.u;
                        if (mediaEvents != null) {
                            mediaEvents.playerStateChange(PlayerState.FULLSCREEN);
                        }
                    } catch (Exception e10) {
                        v.d(TAG, e10.getMessage());
                    }
                    FrameLayout frameLayout = (FrameLayout) mBMediaView.getRootView().findViewById(R.id.content);
                    RelativeLayout relativeLayout = new RelativeLayout(mBMediaView.getContext());
                    mBMediaView.E = relativeLayout;
                    relativeLayout.setClickable(true);
                    ViewGroup viewGroup = (ViewGroup) mBMediaView.w.getParent();
                    int childCount = viewGroup.getChildCount();
                    int i = 0;
                    while (i < childCount && viewGroup.getChildAt(i) != mBMediaView.w) {
                        i++;
                    }
                    mBMediaView.L = i;
                    FrameLayout frameLayout2 = new FrameLayout(mBMediaView.getContext());
                    frameLayout2.setId(100);
                    viewGroup.addView(frameLayout2, i, new ViewGroup.LayoutParams(mBMediaView.getWidth(), mBMediaView.getHeight()));
                    viewGroup.removeView(mBMediaView.w);
                    ViewGroup.LayoutParams layoutParams = new FrameLayout.LayoutParams(-1, -1);
                    relativeLayout.setId(101);
                    new RelativeLayout.LayoutParams(-1, -1);
                    mBMediaView.K.addView(mBMediaView.w, new RelativeLayout.LayoutParams(-1, -1));
                    frameLayout.addView(relativeLayout, layoutParams);
                    int i10 = AnonymousClass10.a[mBMediaView.F.style.ordinal()] != 2 ? -16777216 : -1;
                    int i11 = mBMediaView.v;
                    if (i11 != 0) {
                        relativeLayout.setBackgroundColor(i11);
                    } else {
                        relativeLayout.setBackgroundColor(i10);
                    }
                    mBMediaView.F.setId(103);
                    RelativeLayout.LayoutParams layoutParams2 = new RelativeLayout.LayoutParams(-1, -1);
                    int[] iArr = new int[2];
                    frameLayout.getLocationInWindow(iArr);
                    int i12 = iArr[1];
                    mBMediaView.f439ae = i12;
                    if (i12 == 0 && (rootWindowInsets = mBMediaView.getRootWindowInsets()) != null) {
                        layoutParams2.setMargins(0, rootWindowInsets.getStableInsetTop(), 0, 0);
                    }
                    relativeLayout.addView(mBMediaView.F, layoutParams2);
                    try {
                        mBMediaView.y();
                        mBMediaView.a(mBMediaView.G, mBMediaView.A(), mBMediaView.B());
                        com.mbridge.msdk.nativex.view.mbfullview.a.a(mBMediaView.getContext()).a(mBMediaView.F, mBMediaView.i);
                        if (mBMediaView.i) {
                            mBMediaView.D();
                        } else {
                            mBMediaView.C();
                        }
                        mBMediaView.M.postDelayed(new Runnable() {
                            @Override
                            public final void run() {
                                MBMediaView.this.r = true;
                                if (MBMediaView.this.h) {
                                    TextView unused = MBMediaView.this.I;
                                }
                            }
                        }, 3000L);
                    } catch (Throwable th) {
                        v.d(TAG, th.getMessage());
                    }
                    try {
                        mBMediaView.E.setFocusableInTouchMode(true);
                        mBMediaView.E.requestFocus();
                        mBMediaView.E.setOnKeyListener(new View.OnKeyListener() {
                            @Override
                            public final boolean onKey(View view, int i13, KeyEvent keyEvent) {
                                try {
                                    if (keyEvent.getKeyCode() != 4) {
                                        return false;
                                    }
                                    MBMediaView.this.w();
                                    return true;
                                } catch (Throwable th2) {
                                    v.d(MBMediaView.TAG, th2.getMessage());
                                    return false;
                                }
                            }
                        });
                        mBMediaView.E.setOnClickListener(new View.OnClickListener() {
                            @Override
                            public final void onClick(View view) {
                                MBMediaView.i(MBMediaView.this);
                            }
                        });
                        mBMediaView.H.setOnClickListener(new View.OnClickListener() {
                            @Override
                            public final void onClick(View view) {
                                MBMediaView.this.w();
                            }
                        });
                        mBMediaView.I.setOnClickListener(new com.mbridge.msdk.widget.a() {
                            public final void a(View view) {
                                try {
                                    MBMediaView.this.b(view.getContext());
                                    if (MBMediaView.this.u != null) {
                                        MBMediaView.this.u.adUserInteraction(InteractionType.CLICK);
                                    }
                                } catch (Exception e11) {
                                    v.d(MBMediaView.TAG, e11.getMessage());
                                }
                            }
                        });
                    } catch (Exception e11) {
                        v.d(TAG, e11.getMessage());
                    }
                    MediaViewPlayerView mediaViewPlayerView2 = mBMediaView.w;
                    if (mediaViewPlayerView2 != null) {
                        mediaViewPlayerView2.openSound();
                    }
                    MediaViewPlayerView mediaViewPlayerView3 = mBMediaView.w;
                    mediaViewPlayerView3.setMediaViewPlayListener(new MediaViewPlayerView.a(mediaViewPlayerView3) {
                        @Override
                        public final void a() {
                            int nvT2 = MBMediaView.this.N.getNvT2();
                            if (!MBMediaView.this.h || (nvT2 != 3 && nvT2 != 4)) {
                                super.a();
                                return;
                            }
                            WindVaneWebViewForNV F = MBMediaView.this.F();
                            if (F == null) {
                                super.a();
                                return;
                            }
                            View v = MBMediaView.this.v();
                            if (v == null) {
                                super.a();
                                return;
                            }
                            if (nvT2 == 3 && MBMediaView.this.af) {
                                com.mbridge.msdk.nativex.view.mbfullview.a.a(MBMediaView.this.getContext()).a(v, MBMediaView.this.F);
                                Context context = MBMediaView.this.getContext();
                                CampaignEx campaignEx = MBMediaView.this.N;
                                String campaignUnitId = MBMediaView.this.N.getCampaignUnitId();
                                if (campaignEx != null) {
                                    try {
                                        if (campaignEx.getNativeVideoTracking() != null && campaignEx.getNativeVideoTracking().j() != null) {
                                            for (String str : campaignEx.getNativeVideoTracking().j()) {
                                                if (!TextUtils.isEmpty(str)) {
                                                    com.mbridge.msdk.click.a.a(context, campaignEx, campaignUnitId, str, false, true);
                                                }
                                            }
                                        }
                                    } catch (Exception e12) {
                                        e12.printStackTrace();
                                    }
                                }
                            } else {
                                if (nvT2 != 4) {
                                    super.a();
                                    return;
                                }
                                com.mbridge.msdk.nativex.view.mbfullview.a.a(MBMediaView.this.getContext()).a(v, MBMediaView.this.F);
                                String clickURL = MBMediaView.this.N.getClickURL();
                                if (!TextUtils.isEmpty(clickURL)) {
                                    com.mbridge.msdk.click.a.a(MBMediaView.this.getContext(), MBMediaView.this.N, MBMediaView.this.o(), MBMediaView.this.getAddNVT2ToNoticeURL(), true, false, com.mbridge.msdk.click.a.a.i);
                                    MBMediaView.this.B.loadUrl(clickURL);
                                }
                            }
                            F.webViewShow(MBMediaView.this.N, MBMediaView.this.o());
                            F.orientation(MBMediaView.this.i);
                        }
                    });
                    mBMediaView.b(false);
                    CampaignEx campaignEx = mBMediaView.N;
                    if (campaignEx == null || campaignEx.getMediaViewHolder() == null || mBMediaView.N.getMediaViewHolder().k || TextUtils.isEmpty(mBMediaView.N.getCampaignUnitId()) || mBMediaView.N.getNativeVideoTracking() == null || mBMediaView.N.getNativeVideoTracking().a() == null) {
                        return;
                    }
                    mBMediaView.N.getMediaViewHolder().k = true;
                    mBMediaView.E();
                    return;
                }
                return;
            }
            v.b(TAG, "rootView is null");
        } catch (Exception e12) {
            v.d(TAG, e12.getMessage());
        }
    }

    public static void d(MBMediaView mBMediaView) {
        CampaignEx.b mediaViewHolder;
        CampaignEx campaignEx = mBMediaView.N;
        if (campaignEx == null || (mediaViewHolder = campaignEx.getMediaViewHolder()) == null || mediaViewHolder.g || mBMediaView.N.getNativeVideoTracking() == null || mBMediaView.N.getNativeVideoTracking().l() == null) {
            return;
        }
        mediaViewHolder.g = true;
        Context context = mBMediaView.getContext();
        CampaignEx campaignEx2 = mBMediaView.N;
        com.mbridge.msdk.click.a.a(context, campaignEx2, campaignEx2.getCampaignUnitId(), mBMediaView.N.getNativeVideoTracking().l(), false, false);
    }

    private void b(boolean z10) {
        try {
            int nvT2 = this.N.getNvT2();
            if (this.B == null) {
                WindVaneWebViewForNV windVaneWebViewForNV = new WindVaneWebViewForNV(getContext());
                this.B = windVaneWebViewForNV;
                windVaneWebViewForNV.setObject(this);
                this.B.setBackListener(new com.mbridge.msdk.nativex.listener.b() {
                    @Override
                    public final void a() {
                        MBMediaView.this.exitFullScreen();
                    }
                });
                this.B.setWebViewListener(new com.mbridge.msdk.mbsignalcommon.b.b() {
                    @Override
                    public final void a(WebView webView, String str) {
                        super.a(webView, str);
                        MBMediaView.this.af = true;
                    }

                    @Override
                    public final void a(WebView webView, int i, String str, String str2) {
                        super.a(webView, i, str, str2);
                        MBMediaView.this.af = false;
                    }
                });
            }
            if (nvT2 != 3) {
                if (nvT2 == 4) {
                    this.ag = true;
                    CampaignEx campaignEx = this.N;
                    if (campaignEx != null) {
                        BrowserView.MBDownloadListener mBDownloadListener = new BrowserView.MBDownloadListener(campaignEx);
                        mBDownloadListener.setTitle(this.N.getAppName());
                        this.B.setDownloadListener(mBDownloadListener);
                        this.B.setFilter(new d());
                        return;
                    }
                    return;
                }
                return;
            }
            String str = this.N.getendcard_url();
            if (TextUtils.isEmpty(str)) {
                return;
            }
            this.N.getMediaViewHolder();
            if (str.contains(".zip") && str.contains("md5filename")) {
                String b10 = com.mbridge.msdk.videocommon.download.g.a().b(str);
                if (ae.b(b10)) {
                    this.ag = true;
                    this.B.loadUrl(b10);
                    return;
                }
                return;
            }
            String b11 = com.mbridge.msdk.videocommon.download.h.a().b(str);
            if (ae.b(b11)) {
                v.a(TAG, "load html...");
                this.ag = true;
                this.B.loadDataWithBaseURL(str, b11, "text/html", "UTF-8", null);
            }
        } catch (Exception e10) {
            v.d(TAG, e10.getMessage());
        }
    }

    public MBMediaView(Context context, AttributeSet attributeSet) {
        super(context, attributeSet);
        this.a = true;
        this.b = true;
        this.c = true;
        this.d = true;
        this.e = true;
        this.f = false;
        this.g = true;
        this.h = false;
        this.i = false;
        this.j = false;
        this.k = true;
        this.l = true;
        this.m = new ArrayList<>();
        this.n = new ArrayList<>();
        this.q = false;
        this.r = false;
        this.s = null;
        this.t = null;
        this.u = null;
        this.v = 0;
        this.f435aa = null;
        this.f436ab = null;
        this.af = false;
        this.ag = false;
        this.ak = false;
        this.am = false;
        this.an = new Runnable() {
            @Override
            public final void run() {
                try {
                    if (!MBMediaView.this.h) {
                        MBMediaView mBMediaView = MBMediaView.this;
                        if (mBMediaView.a((View) mBMediaView)) {
                            MBMediaView.T(MBMediaView.this);
                        } else {
                            MBMediaView.S(MBMediaView.this);
                        }
                    }
                    MBMediaView.this.M.postDelayed(this, 300L);
                } catch (Exception e10) {
                    v.d(MBMediaView.TAG, e10.getMessage());
                }
            }
        };
        a(context);
    }

    public static void p(MBMediaView mBMediaView) {
        try {
            ProgressBar progressBar = mBMediaView.D;
            if (progressBar != null) {
                progressBar.setVisibility(8);
            }
        } catch (Exception e10) {
            v.d(TAG, e10.getMessage());
        }
    }

    public boolean a(View view) {
        if (view != null) {
            try {
                if (view.getVisibility() == 0) {
                    Rect rect = new Rect();
                    if (!view.getLocalVisibleRect(rect)) {
                        return false;
                    }
                    long height = rect.height() * rect.width();
                    long height2 = view.getHeight() * view.getWidth();
                    long j = (long) (height2 * 0.5f);
                    if (height2 > 0 && aa.l(getContext()) && this.e && height >= j) {
                        if (isShown()) {
                            return true;
                        }
                    }
                }
            } catch (Throwable th) {
                v.d(TAG, th.getMessage());
            }
        }
        return false;
    }

    private void a(View view, float f10, float f11) {
        if (view == null) {
            return;
        }
        try {
            double d10 = this.Q;
            double d11 = 0.0d;
            if (d10 > 0.0d) {
                double d12 = this.R;
                if (d12 > 0.0d) {
                    double d13 = d10 / d12;
                    if (f10 > 0.0f && f11 > 0.0f) {
                        d11 = f10 / f11;
                    }
                    double a10 = aa.a(Double.valueOf(d13));
                    double a11 = aa.a(Double.valueOf(d11));
                    RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) this.f440x.getLayoutParams();
                    RelativeLayout.LayoutParams layoutParams2 = (RelativeLayout.LayoutParams) view.getLayoutParams();
                    boolean z10 = c(getContext()) && this.i;
                    int i = -1;
                    if (a10 > a11) {
                        double d14 = (f10 * this.R) / this.Q;
                        layoutParams2.width = -1;
                        if (!z10) {
                            i = (int) d14;
                        }
                        layoutParams2.height = i;
                        layoutParams2.addRule(13);
                        layoutParams.width = this.P;
                        layoutParams.height = (int) d14;
                        layoutParams.addRule(13);
                    } else if (a10 < a11) {
                        double d15 = f11 * d13;
                        layoutParams2.width = z10 ? -1 : (int) d15;
                        layoutParams2.height = -1;
                        layoutParams2.addRule(13);
                        layoutParams.width = (int) d15;
                        layoutParams.height = this.O;
                        layoutParams.addRule(13);
                    } else {
                        layoutParams2.width = -1;
                        layoutParams2.height = -1;
                        layoutParams.width = this.P;
                        layoutParams.height = this.O;
                        layoutParams.addRule(13);
                    }
                    if (!this.h) {
                        this.f440x.setLayoutParams(layoutParams);
                    }
                    view.setLayoutParams(layoutParams2);
                    return;
                }
            }
            b(view);
        } catch (Throwable th) {
            v.d(TAG, th.getMessage());
        }
    }

    public class e implements SensorEventListener {
        private e() {
        }

        @Override
        public final void onSensorChanged(SensorEvent sensorEvent) {
            int i;
            if (MBMediaView.this.ak) {
                return;
            }
            try {
                float[] fArr = sensorEvent.values;
                float f = -fArr[0];
                float f10 = -fArr[1];
                float f11 = -fArr[2];
                if (((f10 * f10) + (f * f)) * 4.0f >= f11 * f11) {
                    i = 90 - Math.round(((float) Math.atan2(-f10, f)) * 57.29578f);
                    while (i >= 360) {
                        i -= 360;
                    }
                    while (i < 0) {
                        i += 360;
                    }
                } else {
                    i = -1;
                }
                float A = MBMediaView.this.A();
                int j = aa.j(MBMediaView.this.getContext());
                if ((i > 45 && i < 135) || (i > 225 && i < 315)) {
                    if (A < j || MBMediaView.this.j) {
                        return;
                    }
                    MBMediaView.this.i = true;
                    MBMediaView.this.j = true;
                    MBMediaView.this.M.postDelayed(new Runnable() {
                        @Override
                        public final void run() {
                            try {
                                com.mbridge.msdk.nativex.view.mbfullview.a.a(MBMediaView.this.getContext()).a(MBMediaView.this.F, MBMediaView.this.i);
                                MBMediaView.this.D();
                                MBMediaView.this.h();
                                MBMediaView.this.f();
                                MBMediaView.this.g();
                                if (MBMediaView.this.B != null) {
                                    MBMediaView.this.B.orientation(MBMediaView.this.i);
                                }
                            } catch (Exception e) {
                                v.d(MBMediaView.TAG, e.getMessage());
                            }
                        }
                    }, 200L);
                    return;
                }
                if (((i <= 135 || i >= 225) && ((i <= 315 || i >= 360) && ((i < 0 || i > 45) && i != -1))) || A > j || !MBMediaView.this.j) {
                    return;
                }
                MBMediaView.this.i = false;
                MBMediaView.this.j = false;
                MBMediaView.this.M.postDelayed(new Runnable() {
                    @Override
                    public final void run() {
                        try {
                            com.mbridge.msdk.nativex.view.mbfullview.a.a(MBMediaView.this.getContext()).a(MBMediaView.this.F, MBMediaView.this.i);
                            MBMediaView.this.C();
                            MBMediaView.this.h();
                            MBMediaView.this.f();
                            MBMediaView.this.g();
                            if (MBMediaView.this.B != null) {
                                MBMediaView.this.B.orientation(MBMediaView.this.i);
                            }
                        } catch (Exception e) {
                            v.d(MBMediaView.TAG, e.getMessage());
                        }
                    }
                }, 200L);
            } catch (Throwable th) {
                v.a(MBMediaView.TAG, th.getMessage(), th);
            }
        }

        @Override
        public final void onAccuracyChanged(Sensor sensor, int i) {
        }
    }

    public void b(Context context) {
        try {
            try {
                OnMBMediaViewListener onMBMediaViewListener = this.f437ac;
                if (onMBMediaViewListener != null) {
                    onMBMediaViewListener.onVideoAdClicked(this.N);
                }
                OnMBMediaViewListenerPlus onMBMediaViewListenerPlus = this.f438ad;
                if (onMBMediaViewListenerPlus != null) {
                    onMBMediaViewListenerPlus.onVideoAdClicked(this.N);
                }
            } catch (Exception e10) {
                v.d(TAG, e10.getMessage());
            }
            if (this.N != null && !ae.a(o())) {
                if (!this.N.isReportClick()) {
                    this.N.setReportClick(true);
                    CampaignEx campaignEx = this.N;
                    if (campaignEx != null && campaignEx.getNativeVideoTracking() != null && this.N.getNativeVideoTracking().e() != null) {
                        Context context2 = getContext();
                        CampaignEx campaignEx2 = this.N;
                        com.mbridge.msdk.click.a.a(context2, campaignEx2, campaignEx2.getCampaignUnitId(), this.N.getNativeVideoTracking().e(), false, false);
                    }
                }
                com.mbridge.msdk.click.a aVar = new com.mbridge.msdk.click.a(getContext(), o());
                aVar.a(new NativeListener.NativeTrackingListener() {
                    @Override
                    public final void onFinishRedirection(Campaign campaign, String str) {
                        try {
                            MBMediaView.p(MBMediaView.this);
                            MBMediaView.q(MBMediaView.this);
                            MBMediaView.c(MBMediaView.this, campaign, str);
                        } catch (Exception e11) {
                            v.d(MBMediaView.TAG, e11.getMessage());
                        }
                    }

                    @Override
                    public final boolean onInterceptDefaultLoadingDialog() {
                        return true;
                    }

                    @Override
                    public final void onRedirectionFailed(Campaign campaign, String str) {
                        try {
                            MBMediaView.p(MBMediaView.this);
                            MBMediaView.q(MBMediaView.this);
                            MBMediaView.b(MBMediaView.this, campaign, str);
                        } catch (Exception e11) {
                            v.d(MBMediaView.TAG, e11.getMessage());
                        }
                    }

                    @Override
                    public final void onStartRedirection(Campaign campaign, String str) {
                        try {
                            MBMediaView.n(MBMediaView.this);
                            MBMediaView.o(MBMediaView.this);
                            MBMediaView.a(MBMediaView.this, campaign, str);
                        } catch (Exception e11) {
                            v.d(MBMediaView.TAG, e11.getMessage());
                        }
                    }

                    @Override
                    public final void onDismissLoading(Campaign campaign) {
                    }

                    @Override
                    public final void onDownloadFinish(Campaign campaign) {
                    }

                    @Override
                    public final void onDownloadProgress(int i) {
                    }

                    @Override
                    public final void onDownloadStart(Campaign campaign) {
                    }

                    @Override
                    public final void onShowLoading(Campaign campaign) {
                    }
                });
                aVar.a(this.N);
            }
        } catch (Exception e11) {
            v.d(TAG, e11.getMessage());
        }
    }

    public void handlerPlayableException(Object obj, String str) {
    }

    public void notifyCloseBtn(Object obj, String str) {
    }

    @Override
    public void onPlayProgressMS(int i, int i10) {
    }

    public void setOrientation(Object obj, String str) {
    }

    public static void b(MBMediaView mBMediaView) {
        CampaignEx campaignEx = mBMediaView.N;
        if (campaignEx == null || campaignEx.getMediaViewHolder() == null) {
            return;
        }
        com.mbridge.msdk.foundation.controller.a.d().a(mBMediaView.getContext());
        com.mbridge.msdk.mbnative.d.b.a(mBMediaView.N, mBMediaView.getContext(), mBMediaView.o(), null);
        CampaignEx.b mediaViewHolder = mBMediaView.N.getMediaViewHolder();
        if (!mediaViewHolder.a && mBMediaView.f436ab == a.VIDEO && ae.b(mBMediaView.N.getImpressionURL())) {
            mediaViewHolder.a = true;
            String impressionURL = mBMediaView.N.getImpressionURL();
            if (!impressionURL.contains("is_video=1")) {
                StringBuilder sb2 = new StringBuilder(impressionURL);
                if (impressionURL.contains("?")) {
                    sb2.append("&is_video=1");
                } else {
                    sb2.append("?is_video=1");
                }
                impressionURL = sb2.toString();
            }
            Context context = mBMediaView.getContext();
            CampaignEx campaignEx2 = mBMediaView.N;
            com.mbridge.msdk.click.a.a(context, campaignEx2, campaignEx2.getCampaignUnitId(), impressionURL, false, true, com.mbridge.msdk.click.a.a.g);
        }
    }

    private String a(int i) {
        try {
            JSONObject jSONObject = new JSONObject();
            jSONObject.put("code", i);
            String jSONObject2 = jSONObject.toString();
            return !TextUtils.isEmpty(jSONObject2) ? Base64.encodeToString(jSONObject2.getBytes(), 2) : "";
        } catch (Throwable unused) {
            v.d(TAG, "code to string is error");
            return "";
        }
    }

    public static void b(MBMediaView mBMediaView, Campaign campaign, String str) {
        try {
            OnMBMediaViewListener onMBMediaViewListener = mBMediaView.f437ac;
            if (onMBMediaViewListener != null) {
                onMBMediaViewListener.onRedirectionFailed(campaign, str);
            }
            OnMBMediaViewListenerPlus onMBMediaViewListenerPlus = mBMediaView.f438ad;
            if (onMBMediaViewListenerPlus != null) {
                onMBMediaViewListenerPlus.onRedirectionFailed(campaign, str);
            }
        } catch (Exception e10) {
            v.d(TAG, e10.getMessage());
        }
    }

    private String a(List<CampaignEx> list, String str, String str2) {
        if (list == null) {
            return null;
        }
        try {
            if (list.size() <= 0) {
                return null;
            }
            JSONArray parseCamplistToJson = CampaignEx.parseCamplistToJson(list);
            JSONObject jSONObject = new JSONObject();
            jSONObject.put("campaignList", parseCamplistToJson);
            jSONObject.put("unit_id", str);
            jSONObject.put("sdk_info", str2);
            return jSONObject.toString();
        } catch (Exception e10) {
            v.d(TAG, e10.getMessage());
            return null;
        }
    }

    public static void a(MBMediaView mBMediaView, Campaign campaign, String str) {
        try {
            OnMBMediaViewListener onMBMediaViewListener = mBMediaView.f437ac;
            if (onMBMediaViewListener != null) {
                onMBMediaViewListener.onStartRedirection(campaign, str);
            }
            OnMBMediaViewListenerPlus onMBMediaViewListenerPlus = mBMediaView.f438ad;
            if (onMBMediaViewListenerPlus != null) {
                onMBMediaViewListenerPlus.onStartRedirection(campaign, str);
            }
        } catch (Exception e10) {
            v.d(TAG, e10.getMessage());
        }
    }

    public static void a(MBMediaView mBMediaView, String str) {
        m mVar;
        try {
            com.mbridge.msdk.foundation.db.p a10 = com.mbridge.msdk.foundation.db.p.a(com.mbridge.msdk.foundation.db.g.a(mBMediaView.getContext()));
            if (!TextUtils.isEmpty(mBMediaView.N.getNoticeUrl())) {
                int o10 = r.o(mBMediaView.getContext());
                mVar = new m("2000021", o10, mBMediaView.N.getNoticeUrl(), str, r.a(mBMediaView.getContext(), o10));
            } else if (TextUtils.isEmpty(mBMediaView.N.getClickURL())) {
                mVar = null;
            } else {
                int o11 = r.o(mBMediaView.getContext());
                mVar = new m("2000021", o11, mBMediaView.N.getClickURL(), str, r.a(mBMediaView.getContext(), o11));
            }
            if (mVar != null) {
                mVar.n(mBMediaView.N.getId());
                mVar.e(mBMediaView.N.getVideoUrlEncode());
                mVar.p(str);
                mVar.k(mBMediaView.N.getRequestId());
                mVar.l(mBMediaView.N.getRequestIdNotice());
                mVar.m(mBMediaView.o());
                a10.a(mVar);
            }
        } catch (Exception e10) {
            v.d(TAG, e10.getMessage());
        }
    }
}