翰林优商.apk(点击下载) / MBMediaView.java


package com.mbridge.msdk.nativex.view;

import aegon.chrome.net.NetError;
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.Build;
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.baidu.idl.face.platform.utils.BitmapUtils;
import com.bytedance.sdk.openadsdk.api.plugin.PluginConstants;
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.MBridgeConstans;
import com.mbridge.msdk.foundation.db.i;
import com.mbridge.msdk.foundation.db.t;
import com.mbridge.msdk.foundation.download.download.H5DownLoadManager;
import com.mbridge.msdk.foundation.download.download.HTMLResourceManager;
import com.mbridge.msdk.foundation.download.download.ResourceManager;
import com.mbridge.msdk.foundation.entity.CampaignEx;
import com.mbridge.msdk.foundation.entity.p;
import com.mbridge.msdk.foundation.tools.aa;
import com.mbridge.msdk.foundation.tools.ae;
import com.mbridge.msdk.foundation.tools.q;
import com.mbridge.msdk.foundation.tools.s;
import com.mbridge.msdk.foundation.tools.w;
import com.mbridge.msdk.foundation.tools.z;
import com.mbridge.msdk.foundation.webview.BrowserView;
import com.mbridge.msdk.mbjscommon.windvane.WindVaneWebView;
import com.mbridge.msdk.mbjscommon.windvane.h;
import com.mbridge.msdk.mbnative.controller.NativeController;
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.video.js.bridge.IRewardBridge;
import com.mbridge.msdk.videocommon.view.MyImageView;
import com.umeng.analytics.pro.am;
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, IRewardBridge {
    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;

    /* renamed from: K  reason: collision with root package name */
    private RelativeLayout f117K;
    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 = true;
    private com.mbridge.msdk.videocommon.download.a aa = null;
    private a ab = null;
    private OnMBMediaViewListener ac;
    private OnMBMediaViewListenerPlus ad;
    private int ae;
    private boolean af = false;
    private boolean ag = false;
    private RelativeLayout ah;
    private ImageView ai;
    private int aj;
    private boolean ak = false;
    private Context al;
    private boolean am = false;
    private Runnable an = new Runnable() {
        /* class com.mbridge.msdk.nativex.view.MBMediaView.AnonymousClass10 */

        public final void run() {
            try {
                if (!MBMediaView.this.h) {
                    MBMediaView mBMediaView = MBMediaView.this;
                    if (!mBMediaView.a(mBMediaView)) {
                        MBMediaView.S(MBMediaView.this);
                    } else {
                        MBMediaView.T(MBMediaView.this);
                    }
                }
                MBMediaView.this.M.postDelayed(this, 300);
            } catch (Exception e) {
                w.d(MBMediaView.TAG, e.getMessage());
            }
        }
    };
    private boolean b = true;
    private boolean c = true;
    private boolean d = true;
    private boolean e = true;
    private boolean f = false;
    private boolean g = true;
    private boolean h = false;
    private volatile boolean i = false;
    private volatile boolean j = false;
    private boolean k = true;
    private boolean l = true;
    private ArrayList<String> m = new ArrayList<>();
    private ArrayList<String> n = new ArrayList<>();
    private boolean q = false;
    private boolean r = false;
    private AdSession s = null;
    private AdEvents t = null;
    private MediaEvents u = null;
    private int v = 0;
    private MediaViewPlayerView w;
    private RelativeLayout x;
    private RelativeLayout y;
    private RelativeLayout z;

    /* access modifiers changed from: private */
    public enum a {
        BIG_IMAGE,
        VIDEO,
        GIF
    }

    @Override // com.mbridge.msdk.video.js.bridge.IRewardBridge
    public void handlerPlayableException(Object obj, String str) {
    }

    @Override // com.mbridge.msdk.video.js.bridge.IRewardBridge
    public void notifyCloseBtn(Object obj, String str) {
    }

    @Override // com.mbridge.msdk.playercommon.VideoPlayerStatusListener
    public void onPlayProgressMS(int i2, int i3) {
    }

    @Override // com.mbridge.msdk.video.js.bridge.IRewardBridge
    public void setOrientation(Object obj, String str) {
    }

    public MBMediaView(Context context) {
        super(context);
        a(context);
    }

    public MBMediaView(Context context, AttributeSet attributeSet) {
        super(context, attributeSet);
        a(context);
    }

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

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

    private void b() {
        w.d(TAG, "initView");
        int a2 = q.a(getContext(), "mbridge_nativex_mbmediaview", TtmlNode.TAG_LAYOUT);
        if (a2 == -1) {
            w.d(TAG, "can not find mediaview resource");
            return;
        }
        View inflate = LayoutInflater.from(getContext()).inflate(a2, (ViewGroup) null);
        this.y = (RelativeLayout) inflate.findViewById(q.a(getContext(), "mbridge_rl_mediaview_root", "id"));
        this.x = (RelativeLayout) inflate.findViewById(q.a(getContext(), "mbridge_ll_playerview_container", "id"));
        this.C = (MyImageView) inflate.findViewById(q.a(getContext(), "mbridge_my_big_img", "id"));
        this.D = (ProgressBar) inflate.findViewById(q.a(getContext(), "mbridge_native_pb", "id"));
        this.z = (RelativeLayout) inflate.findViewById(q.a(getContext(), "mbridge_nativex_webview_layout", "id"));
        this.A = (WindVaneWebViewForNV) inflate.findViewById(q.a(getContext(), "mbridge_nativex_webview_layout_webview", "id"));
        this.y.setClickable(true);
        addView(inflate, -1, -1);
    }

    private void c() {
        this.M = new Handler() {
            /* class com.mbridge.msdk.nativex.view.MBMediaView.AnonymousClass1 */

            public final void handleMessage(Message message) {
                if (message != null) {
                    try {
                        int i = message.what;
                        if (i == 1) {
                            MBMediaView.this.r();
                        } else if (i == 3) {
                            Object obj = message.obj;
                            if (obj != null && (obj instanceof View)) {
                                if (MBMediaView.this.a((MBMediaView) ((View) obj))) {
                                    MBMediaView.b(MBMediaView.this);
                                }
                            }
                        }
                    } catch (Exception e) {
                        w.d(MBMediaView.TAG, e.getMessage());
                    }
                }
            }
        };
    }

    /* access modifiers changed from: protected */
    public void onAttachedToWindow() {
        super.onAttachedToWindow();
        try {
            StringBuilder sb = new StringBuilder();
            sb.append("onAttachedToWindow start:");
            CampaignEx campaignEx = this.N;
            sb.append(campaignEx == null ? "" : campaignEx.getAppName());
            w.b(TAG, sb.toString());
            if (this.c) {
                try {
                    SensorManager sensorManager = (SensorManager) getContext().getSystemService(am.ac);
                    this.V = sensorManager;
                    this.W = sensorManager.getDefaultSensor(1);
                    e eVar = new e();
                    this.U = eVar;
                    this.V.registerListener(eVar, this.W, 2);
                    w.b(TAG, "register sensorlistener");
                } catch (Throwable th) {
                    w.d(TAG, th.getMessage());
                }
            }
            if (Build.VERSION.SDK_INT >= 11) {
                this.g = isHardwareAccelerated();
            }
            this.aj = getOrientation();
            d();
            this.M.postDelayed(this.an, 300);
            w.b(TAG, "onAttachedToWindow setDisplay finalmCurDisplayMode:" + this.ab);
        } catch (Throwable th2) {
            w.d(TAG, th2.getMessage());
        }
    }

    /* access modifiers changed from: protected */
    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;
                w.a("omsdk", "adSession finish");
            }
            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);
                    w.b(TAG, "unRegister sensorlistener");
                }
            } catch (Throwable th) {
                w.d(TAG, th.getMessage());
            }
            a();
        } catch (Throwable th2) {
            w.d(TAG, th2.getMessage());
        }
    }

    public void onWindowFocusChanged(boolean z2) {
        MediaViewPlayerView mediaViewPlayerView;
        super.onWindowFocusChanged(z2);
        try {
            w.d(TAG, "hasWindowFocus:" + z2);
            this.e = z2;
            if (this.ab == a.VIDEO && (mediaViewPlayerView = this.w) != null) {
                mediaViewPlayerView.setIsFrontDesk(z2);
            }
            try {
                if (!this.h) {
                    w.b(TAG, "initFullPlayerOnWindowFocus 在半屏 return");
                } else {
                    MediaViewPlayerView mediaViewPlayerView2 = this.w;
                    if (mediaViewPlayerView2 == null) {
                        w.d(TAG, "fullscreen playerview is null return");
                    } else if (!this.e) {
                        w.b(TAG, "fullscreen windowfocuse false pasue======");
                        this.w.pause();
                    } else if (mediaViewPlayerView2.isPlaying()) {
                        w.b(TAG, "fullscreen windowfocuse true isPlaying do nothing return");
                    } else {
                        MediaViewPlayerView mediaViewPlayerView3 = this.w;
                        if (mediaViewPlayerView3 != null && !mediaViewPlayerView3.isComplete() && !this.w.getIsActiviePause()) {
                            w.d(TAG, "fullscreen windowfocuse true startOrPlayVideo");
                            this.w.onClickPlayButton();
                        }
                    }
                }
            } catch (Throwable th) {
                w.d(TAG, th.getMessage());
            }
            requestLayout();
            w.b(TAG, "onWindowFocusChanged reqeusetlaytout");
        } catch (Throwable th2) {
            w.d(TAG, th2.getMessage());
        }
    }

    /* access modifiers changed from: protected */
    public void onMeasure(int i2, int i3) {
        super.onMeasure(i2, i3);
        try {
            this.O = getHeight();
            int width = getWidth();
            this.P = width;
            if (width == 0) {
                this.P = getMeasuredWidth();
                w.c(TAG, "onMeasure 宽度为0 调用getMeasuredWidth mDevWidth:" + this.P);
            }
            if (this.O == 0) {
                this.O = getMeasuredHeight();
                w.c(TAG, "onMeasure 高度为0 调用getMeasuredHeight mDevWidth:" + this.O);
            }
            w.b(TAG, "onMeasure pre mDevWidth " + this.P + " mDevHeight:" + this.O + " mCurDisplayMode:" + this.ab + " mCurIsLandScape:" + this.i);
            if (this.P == 0 && this.O == 0) {
                this.P = (int) B();
                w.d(TAG, "onMeasure 宽度和高度都为0 宽度取屏幕宽度mDevWidth:" + this.P);
            }
            if (this.ab == a.VIDEO && !this.h) {
                ViewGroup.LayoutParams layoutParams = getLayoutParams();
                if (this.O == 0 || ((layoutParams != null && layoutParams.height == -2) || (layoutParams != null && layoutParams.height == -1))) {
                    this.O = (int) ((((double) this.P) * this.R) / this.Q);
                    w.b(TAG, "onMeasure mDevHeight为0并且设置WRAP_CONTENT 拿视频宽高算高度mDevHeight:" + this.O);
                }
                w.b(TAG, "onMeasure after mDevWidth " + this.P + " * mDevHeight *****" + this.O);
                h();
            } else if (this.ab == a.BIG_IMAGE && !this.h) {
                f();
            } else if (this.ab == a.GIF && !this.h) {
                g();
            }
        } catch (Throwable th) {
            w.d(TAG, th.getMessage());
        }
    }

    /* JADX WARNING: Removed duplicated region for block: B:24:0x00f8  */
    /* JADX WARNING: Removed duplicated region for block: B:43:0x0172  */
    /* JADX WARNING: Removed duplicated region for block: B:47:? A[RETURN, SYNTHETIC] */
    public void setNativeAd(Campaign campaign) {
        String str;
        if (campaign == null) {
            try {
                w.d(TAG, "setNativeAd campaign is null return");
            } catch (Throwable th) {
                w.d(TAG, th.getMessage());
            }
        } else {
            CampaignEx campaignEx = this.N;
            if (campaignEx == null || campaignEx != campaign) {
                this.e = true;
                this.g = true;
                this.h = false;
                this.i = false;
                this.j = false;
                this.r = false;
                z();
                CampaignEx campaignEx2 = (CampaignEx) campaign;
                this.N = campaignEx2;
                if (campaignEx2.getMediaViewHolder() == null) {
                    CampaignEx.b bVar = new CampaignEx.b();
                    bVar.l = this.N.getAdvImpList();
                    this.N.setMediaViewHolder(bVar);
                    w.b(TAG, "setNativeAd mediaViewHolder appname:" + this.N.getAppName());
                }
                if (this.N.getAdType() != 94) {
                    if (this.N.getAdType() != 287) {
                        str = this.N.getId() + this.N.getVideoUrlEncode() + this.N.getBidToken();
                        this.aa = com.mbridge.msdk.videocommon.download.b.getInstance().a(p(), str);
                        w.d(TAG, "setNativeAd cid" + this.N.getId() + " appname:" + this.N.getAppName());
                        if (this.q) {
                            if (this.s != null) {
                                MediaViewPlayerView mediaViewPlayerView = this.w;
                                if (mediaViewPlayerView != null) {
                                    mediaViewPlayerView.unregisterView();
                                }
                                this.s.finish();
                                this.s = null;
                                w.a("omsdk", "adSession finish");
                            }
                            if (this.u != null) {
                                this.u = null;
                            }
                            if (this.t != null) {
                                this.t = null;
                            }
                        }
                        CampaignEx campaignEx3 = this.N;
                        if (campaignEx3 != null && campaignEx3.isActiveOm()) {
                            this.s = com.mbridge.msdk.a.b.a(getContext(), TextUtils.isEmpty(this.N.getVideoUrlEncode()), this.N.getOmid(), this.N.getRequestId(), this.N.getId(), p(), "", ((CampaignEx) campaign).getRequestIdNotice());
                            w.a("omsdk", "adSession.Create " + this.s);
                        }
                        if (!this.q) {
                            w.b(TAG, "setNativeAd setDisplay appname:" + this.N.getAppName());
                            d();
                            return;
                        }
                        return;
                    }
                }
                str = this.N.getRequestId() + this.N.getId() + this.N.getVideoUrlEncode();
                this.aa = com.mbridge.msdk.videocommon.download.b.getInstance().a(p(), str);
                w.d(TAG, "setNativeAd cid" + this.N.getId() + " appname:" + this.N.getAppName());
                if (this.q) {
                }
                CampaignEx campaignEx32 = this.N;
                this.s = com.mbridge.msdk.a.b.a(getContext(), TextUtils.isEmpty(this.N.getVideoUrlEncode()), this.N.getOmid(), this.N.getRequestId(), this.N.getId(), p(), "", ((CampaignEx) campaign).getRequestIdNotice());
                w.a("omsdk", "adSession.Create " + this.s);
                if (!this.q) {
                }
            } else {
                w.b(TAG, "setNativeAd has init return");
            }
        }
    }

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

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

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

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

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

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

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

    private void d() {
        AdSession adSession;
        try {
            this.ab = a(true);
            w.d(TAG, "setDisplay mCurDisplayMode:" + this.ab);
            changeNoticeURL();
            if (this.ab == 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 e2) {
                        w.a("omsdk", e2.getMessage());
                    }
                    w.a("omsdk", "native adSession start, impressionOccurred");
                }
                k();
                n();
            } else if (this.ab == a.VIDEO) {
                e();
            } else if (this.ab == a.GIF) {
                o();
                m();
            }
            this.q = true;
        } catch (Throwable th) {
            w.b(TAG, th.getMessage(), th);
        }
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void e() {
        A();
        l();
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void f() {
        int i2;
        int i3;
        int i4;
        try {
            if (this.ab == a.BIG_IMAGE && (i2 = this.P) != 0 && (i3 = this.T) != 0 && (i4 = this.S) != 0) {
                int i5 = (i2 * i3) / i4;
                MyImageView myImageView = this.C;
                if (myImageView != null && i5 != 0) {
                    RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) myImageView.getLayoutParams();
                    layoutParams.width = this.P;
                    layoutParams.height = i5;
                    this.C.setLayoutParams(layoutParams);
                    w.d(TAG, "initBitImageViewWHByDevWh onMeasure mdevWidth:" + this.P + " mDevHeight:" + this.O + " finalHeigt:" + i5);
                }
            }
        } catch (Throwable th) {
            w.d(TAG, th.getMessage());
        }
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void g() {
        RelativeLayout relativeLayout;
        int i2;
        int i3;
        try {
            if (this.ab == a.GIF) {
                int i4 = this.P;
                if (i4 != 0 && (i2 = this.T) != 0 && (i3 = this.S) != 0) {
                    int i5 = (i4 * i2) / i3;
                    RelativeLayout relativeLayout2 = this.z;
                    if (relativeLayout2 != null && i5 != 0) {
                        RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) relativeLayout2.getLayoutParams();
                        layoutParams.width = this.P;
                        layoutParams.height = i5;
                        layoutParams.addRule(13);
                        this.z.setLayoutParams(layoutParams);
                        w.d(TAG, "initGifImageViewWHByDevWh onMeasure mdevWidth:" + this.P + " mDevHeight:" + this.O + " finalHeigt:" + i5 + this.N.getAppName());
                    }
                } else if (i4 != 0 && (relativeLayout = this.z) != null) {
                    RelativeLayout.LayoutParams layoutParams2 = (RelativeLayout.LayoutParams) relativeLayout.getLayoutParams();
                    layoutParams2.width = this.P;
                    layoutParams2.height = (this.P * 627) / 1200;
                    layoutParams2.addRule(13);
                    this.z.setLayoutParams(layoutParams2);
                    w.d(TAG, "initGifImageViewWHByDevWh onMeasure mdevWidth:" + this.P + " mDevHeight:" + this.O + this.N.getAppName());
                }
            }
        } catch (Throwable th) {
            w.d(TAG, th.getMessage());
        }
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void h() {
        try {
            if (this.ab == a.VIDEO && this.x != null) {
                int B2 = (int) B();
                int j2 = aa.j(getContext());
                if (!this.h) {
                    RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) this.x.getLayoutParams();
                    layoutParams.width = this.P;
                    layoutParams.height = this.O;
                    layoutParams.addRule(13);
                    this.x.setLayoutParams(layoutParams);
                } else {
                    RelativeLayout.LayoutParams layoutParams2 = (RelativeLayout.LayoutParams) this.G.getLayoutParams();
                    layoutParams2.width = B2;
                    layoutParams2.height = j2;
                    layoutParams2.addRule(13);
                    this.G.setLayoutParams(layoutParams2);
                }
                r();
                if (!this.h) {
                    a(this.w, (float) this.P, (float) this.O);
                } else {
                    a(this.w, (float) B2, (float) j2);
                }
            }
        } catch (Exception e2) {
            w.d(TAG, e2.getMessage());
        }
    }

    private void i() {
        try {
            this.w.showSoundIndicator(this.l);
            this.w.showProgressView(this.k);
            OnMBMediaViewListener onMBMediaViewListener = this.ac;
            if (onMBMediaViewListener != null) {
                onMBMediaViewListener.onExitFullscreen();
            }
            OnMBMediaViewListenerPlus onMBMediaViewListenerPlus = this.ad;
            if (onMBMediaViewListenerPlus != null) {
                onMBMediaViewListenerPlus.onExitFullscreen();
            }
            MediaEvents mediaEvents = this.u;
            if (mediaEvents != null) {
                mediaEvents.playerStateChange(PlayerState.NORMAL);
                w.a("omsdk", "NV playerStateChange, NORMAL");
            }
        } catch (Exception e2) {
            w.d(TAG, e2.getMessage());
        }
    }

    private void j() {
        try {
            OnMBMediaViewListener onMBMediaViewListener = this.ac;
            if (onMBMediaViewListener != null) {
                onMBMediaViewListener.onVideoAdClicked(this.N);
            }
            OnMBMediaViewListenerPlus onMBMediaViewListenerPlus = this.ad;
            if (onMBMediaViewListenerPlus != null) {
                onMBMediaViewListenerPlus.onVideoAdClicked(this.N);
            }
        } catch (Exception e2) {
            w.d(TAG, e2.getMessage());
        }
    }

    /* access modifiers changed from: protected */
    public final void a(String str) {
        try {
            if (!TextUtils.isEmpty(str) && !this.m.contains(str)) {
                this.m.add(str);
                OnMBMediaViewListener onMBMediaViewListener = this.ac;
                if (onMBMediaViewListener != null) {
                    onMBMediaViewListener.onVideoStart();
                }
                OnMBMediaViewListenerPlus onMBMediaViewListenerPlus = this.ad;
                if (onMBMediaViewListenerPlus != null) {
                    onMBMediaViewListenerPlus.onVideoStart();
                }
            }
        } catch (Exception e2) {
            w.d(TAG, e2.getMessage());
        }
    }

    /* access modifiers changed from: protected */
    public final void b(String str) {
        try {
            if (!TextUtils.isEmpty(str) && !this.n.contains(str)) {
                this.n.add(str);
                OnMBMediaViewListenerPlus onMBMediaViewListenerPlus = this.ad;
                if (onMBMediaViewListenerPlus != null) {
                    onMBMediaViewListenerPlus.onVideoComplete();
                }
            }
        } catch (Exception e2) {
            w.d(TAG, e2.getMessage());
        }
    }

    private void k() {
        try {
            aa.a((ImageView) this.C);
            this.C.setVisibility(0);
            this.x.setVisibility(8);
            this.z.setVisibility(8);
        } catch (Throwable th) {
            w.d(TAG, th.getMessage());
        }
    }

    private void l() {
        try {
            this.x.setVisibility(0);
            this.C.setVisibility(8);
            this.z.setVisibility(8);
        } catch (Throwable th) {
            w.d(TAG, th.getMessage());
        }
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void m() {
        try {
            this.x.setVisibility(8);
            this.C.setVisibility(8);
            this.z.setVisibility(0);
            this.A.setVisibility(0);
        } catch (Throwable th) {
            w.d(TAG, th.getMessage());
        }
    }

    private void n() {
        try {
            CampaignEx campaignEx = this.N;
            if (campaignEx != null) {
                String imageUrl = campaignEx.getImageUrl();
                if (!ae.a(imageUrl) && getContext() != null) {
                    w.b(TAG, "fillBigimage startOrPlayVideo");
                    com.mbridge.msdk.foundation.same.c.b.a(com.mbridge.msdk.foundation.controller.a.f().j()).a(imageUrl, new com.mbridge.msdk.foundation.same.c.c() {
                        /* class com.mbridge.msdk.nativex.view.MBMediaView.AnonymousClass13 */

                        @Override // com.mbridge.msdk.foundation.same.c.c
                        public final void onFailedLoad(String str, String str2) {
                            w.c(MBMediaView.TAG, "load image fail in mbmediaview");
                        }

                        @Override // com.mbridge.msdk.foundation.same.c.c
                        public final void onSuccessLoad(Bitmap bitmap, String str) {
                            w.b(MBMediaView.TAG, "fillBigimage onSuccessLoad mCurDisplayMode:" + MBMediaView.this.ab);
                            if (MBMediaView.this.C != null && MBMediaView.this.ab == a.BIG_IMAGE) {
                                if (bitmap != null) {
                                    w.b(MBMediaView.TAG, "setimgeBitmap=======");
                                    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() {
                                    /* class com.mbridge.msdk.nativex.view.MBMediaView.AnonymousClass13.AnonymousClass1 */

                                    /* access modifiers changed from: protected */
                                    @Override // com.mbridge.msdk.widget.a
                                    public final void a(View view) {
                                        if (MBMediaView.this.al != null) {
                                            MBMediaView.this.b((MBMediaView) MBMediaView.this.al);
                                        } else {
                                            MBMediaView.this.b((MBMediaView) view.getContext());
                                        }
                                    }
                                });
                            }
                        }
                    });
                }
            }
        } catch (Throwable th) {
            w.d(TAG, th.getMessage());
        }
    }

    private void o() {
        try {
            CampaignEx campaignEx = this.N;
            if (campaignEx != null) {
                String gifUrl = campaignEx.getGifUrl();
                if (!ae.a(gifUrl) && getContext() != null) {
                    w.b(TAG, "fillGifimage");
                    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.z.setOnClickListener(new com.mbridge.msdk.widget.a() {
                        /* class com.mbridge.msdk.nativex.view.MBMediaView.AnonymousClass14 */

                        /* access modifiers changed from: protected */
                        @Override // com.mbridge.msdk.widget.a
                        public final void a(View view) {
                            if (MBMediaView.this.al != null) {
                                MBMediaView mBMediaView = MBMediaView.this;
                                mBMediaView.b((MBMediaView) mBMediaView.al);
                            } else {
                                MBMediaView.this.b((MBMediaView) view.getContext());
                            }
                            w.b(MBMediaView.TAG, "CLICK WEBVIEW LAYOUT ");
                        }
                    });
                }
            }
        } catch (Throwable th) {
            w.d(TAG, th.getMessage());
        }
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void b(Context context) {
        final com.mbridge.msdk.click.b bVar = new com.mbridge.msdk.click.b(getContext(), p());
        try {
            CampaignEx campaignEx = this.N;
            if (campaignEx != null && campaignEx.needShowIDialog()) {
                AnonymousClass15 r7 = new com.mbridge.msdk.widget.dialog.a() {
                    /* class com.mbridge.msdk.nativex.view.MBMediaView.AnonymousClass15 */

                    @Override // com.mbridge.msdk.widget.dialog.a
                    public final void b() {
                    }

                    @Override // com.mbridge.msdk.widget.dialog.a
                    public final void a() {
                        MBMediaView.this.a((MBMediaView) bVar);
                    }

                    @Override // com.mbridge.msdk.widget.dialog.a
                    public final void c() {
                        a();
                    }
                };
                if (com.mbridge.msdk.click.c.a(this.N) && this.N.needShowIDialog()) {
                    if (!bVar.b(this.N)) {
                        com.mbridge.msdk.mbjscommon.confirmation.e.a().a("", this.N, context, p(), r7);
                        return;
                    }
                    F();
                    j();
                    return;
                }
            }
        } catch (Throwable th) {
            w.a(TAG, th.getMessage());
        }
        a(bVar);
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void a(com.mbridge.msdk.click.b bVar) {
        try {
            j();
            if (this.N == null) {
                return;
            }
            if (!ae.a(p())) {
                F();
                bVar.a(new NativeListener.NativeTrackingListener() {
                    /* class com.mbridge.msdk.nativex.view.MBMediaView.AnonymousClass16 */

                    @Override // com.mbridge.msdk.out.NativeListener.NativeTrackingListener
                    public final void onDismissLoading(Campaign campaign) {
                    }

                    @Override // com.mbridge.msdk.out.NativeListener.NativeTrackingListener
                    public final void onDownloadFinish(Campaign campaign) {
                    }

                    @Override // com.mbridge.msdk.out.NativeListener.NativeTrackingListener
                    public final void onDownloadProgress(int i) {
                    }

                    @Override // com.mbridge.msdk.out.NativeListener.NativeTrackingListener
                    public final void onDownloadStart(Campaign campaign) {
                    }

                    @Override // com.mbridge.msdk.out.NativeListener.NativeTrackingListener
                    public final boolean onInterceptDefaultLoadingDialog() {
                        return true;
                    }

                    @Override // com.mbridge.msdk.out.NativeListener.NativeTrackingListener
                    public final void onShowLoading(Campaign campaign) {
                    }

                    @Override // com.mbridge.msdk.out.NativeListener.NativeTrackingListener
                    public final void onStartRedirection(Campaign campaign, String str) {
                        try {
                            MBMediaView.n(MBMediaView.this);
                            MBMediaView.o(MBMediaView.this);
                            MBMediaView.a(MBMediaView.this, campaign, str);
                            w.d(MBMediaView.TAG, "=====showloading");
                        } catch (Exception e) {
                            w.d(MBMediaView.TAG, e.getMessage());
                        }
                    }

                    @Override // com.mbridge.msdk.out.NativeListener.NativeTrackingListener
                    public final void onRedirectionFailed(Campaign campaign, String str) {
                        try {
                            MBMediaView.p(MBMediaView.this);
                            MBMediaView.q(MBMediaView.this);
                            MBMediaView.b(MBMediaView.this, campaign, str);
                            w.d(MBMediaView.TAG, "=====hideloading");
                        } catch (Exception e) {
                            w.d(MBMediaView.TAG, e.getMessage());
                        }
                    }

                    @Override // com.mbridge.msdk.out.NativeListener.NativeTrackingListener
                    public final void onFinishRedirection(Campaign campaign, String str) {
                        try {
                            MBMediaView.p(MBMediaView.this);
                            MBMediaView.q(MBMediaView.this);
                            MBMediaView.c(MBMediaView.this, campaign, str);
                            w.d(MBMediaView.TAG, "=====hideloading");
                        } catch (Exception e) {
                            w.d(MBMediaView.TAG, e.getMessage());
                        }
                    }
                });
                bVar.c(this.N);
            }
        } catch (Exception e2) {
            w.d(TAG, e2.getMessage());
        }
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private String p() {
        try {
            CampaignEx campaignEx = this.N;
            if (campaignEx == null || !ae.b(campaignEx.getCampaignUnitId())) {
                return null;
            }
            return this.N.getCampaignUnitId();
        } catch (Exception e2) {
            w.d(TAG, e2.getMessage());
            return null;
        }
    }

    private a a(boolean z2) {
        a aVar = null;
        try {
            if (this.N == null) {
                return null;
            }
            w.b(TAG, "initCurDisplayMode appname:" + this.N.getAppName());
            if (ae.a(this.N.getVideoUrlEncode())) {
                if (ae.b(this.N.getImageUrl())) {
                    aVar = a.BIG_IMAGE;
                    w.b(TAG, "没有视频 只有大图 显示大图");
                }
                if (!ae.b(this.N.getGifUrl())) {
                    return aVar;
                }
                w.b(TAG, "没有视频 有gif图 显示gif图");
                if (ae.a(this.N.getImageUrl())) {
                    w.b(TAG, "没有视频 没有大图 有gif图 显示gif图");
                    aVar = a.GIF;
                }
                this.A.setWebViewClient(new g(this));
                o();
                return aVar;
            } else if (Build.VERSION.SDK_INT < 14 || !this.g || this.aa == null) {
                StringBuilder sb = new StringBuilder();
                sb.append("版本小于4.0或者没有开启硬件加速 显示大图 isHard:");
                sb.append(this.g);
                sb.append(" downloadtask:");
                sb.append(this.aa != null);
                w.d(TAG, sb.toString());
                return a.BIG_IMAGE;
            } else if (ae.b(this.N.getVideoUrlEncode()) && ae.a(this.N.getImageUrl())) {
                a aVar2 = a.VIDEO;
                w.b(TAG, "只有视频 没有大图 显示视频");
                return aVar2;
            } else if (!ae.b(this.N.getVideoUrlEncode()) || !ae.b(this.N.getImageUrl())) {
                return null;
            } else {
                w.b(TAG, "有视频 又有大图 进入判断逻辑");
                int t2 = t();
                w.b(TAG, "readyRate:" + t2);
                if (com.mbridge.msdk.videocommon.download.d.a(this.aa, t2)) {
                    a aVar3 = a.VIDEO;
                    w.b(TAG, "满足readyrate 显示视频");
                    return aVar3;
                }
                a aVar4 = a.BIG_IMAGE;
                w.b(TAG, "没有满足readyrate 暂时显示大图 判断是否监听下载");
                if (!z2) {
                    return aVar4;
                }
                if (this.a) {
                    w.b(TAG, "可以监听下载 下载满足readyrate之后 显示大图");
                    this.aa.b(new f(this));
                    return aVar4;
                }
                w.b(TAG, "开发者禁止监听下载 一直显示大图");
                return aVar4;
            }
        } catch (Throwable th) {
            w.d(TAG, th.getMessage());
            w.b(TAG, "默认显示大图");
            return a.BIG_IMAGE;
        }
    }

    private void q() {
        try {
            if (this.N == null) {
                w.b(TAG, "campaign is null addPlayerView return");
            }
            w.b(TAG, "specSize addPlayerView");
            MediaViewPlayerView mediaViewPlayerView = this.w;
            if (!(mediaViewPlayerView == null || mediaViewPlayerView.getParent() == null)) {
                ((ViewGroup) this.w.getParent()).removeView(this.w);
            }
            l();
            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(s(), this.N, v(), this, this.aa, p());
            this.w.setOnMediaViewPlayerViewListener(new c(this));
            this.x.addView(this.w, -1, -1);
            try {
                MediaViewPlayerView mediaViewPlayerView3 = this.w;
                if (mediaViewPlayerView3 == null) {
                    w.b(TAG, "setPlayerViewListener playerview is null return");
                } else {
                    mediaViewPlayerView3.setOnClickListener(new com.mbridge.msdk.widget.a() {
                        /* class com.mbridge.msdk.nativex.view.MBMediaView.AnonymousClass12 */

                        /* access modifiers changed from: protected */
                        @Override // 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()) {
                                        if (MBMediaView.this.w.isPlaying()) {
                                            MBMediaView.h(MBMediaView.this);
                                            return;
                                        }
                                    }
                                    w.b(MBMediaView.TAG, "is loading or no playing return;");
                                } else if (MBMediaView.this.h) {
                                    w.b(MBMediaView.TAG, "fullScreenShowUI");
                                    MBMediaView.i(MBMediaView.this);
                                } else {
                                    if (MBMediaView.this.al != null) {
                                        MBMediaView mBMediaView = MBMediaView.this;
                                        mBMediaView.b((MBMediaView) mBMediaView.al);
                                    } else {
                                        MBMediaView.this.b((MBMediaView) view.getContext());
                                    }
                                    w.d(MBMediaView.TAG, "不允许全屏 跳gp");
                                    if (MBMediaView.this.u != null) {
                                        MBMediaView.this.u.adUserInteraction(InteractionType.CLICK);
                                    }
                                }
                            } catch (Throwable th) {
                                w.b(MBMediaView.TAG, th.getMessage(), th);
                            }
                        }
                    });
                }
            } catch (Throwable th) {
                w.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 e2) {
                    w.a("omsdk", e2.getMessage());
                }
                w.a("omsdk", "NV adSession start, impressionOccurred");
            }
        } catch (Throwable th2) {
            w.d(TAG, th2.getMessage());
        }
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void r() {
        try {
            if (getVisibility() == 0) {
                if (a((View) this)) {
                    int i2 = 0;
                    com.mbridge.msdk.c.d u2 = u();
                    if (u2 != null) {
                        i2 = u2.d();
                    }
                    Message obtainMessage = this.M.obtainMessage();
                    obtainMessage.what = 3;
                    obtainMessage.obj = this;
                    this.M.sendMessageDelayed(obtainMessage, (long) ((i2 * 1000) + 300));
                }
                if (this.ab == a.VIDEO) {
                    MediaViewPlayerView mediaViewPlayerView = this.w;
                    if (mediaViewPlayerView == null) {
                        w.b(TAG, "setPlayerByVisibilityChange : player is null and addPlayerView");
                        q();
                    } else if (this.N != mediaViewPlayerView.getCampaign()) {
                        this.w.release();
                        q();
                        if (getParent() != null) {
                            ((View) getParent()).invalidate();
                        }
                        requestLayout();
                        w.b(TAG, "setPlayerByVisibilityChange : addplayerview andr requestLayout");
                    }
                }
            }
        } catch (Throwable th) {
            w.d(TAG, th.getMessage());
        }
    }

    private String s() {
        try {
            if (this.N == null) {
                return null;
            }
            w.b(TAG, "getPlayUrl curDisplay:" + this.ab);
            com.mbridge.msdk.videocommon.download.a aVar = this.aa;
            if (aVar != null) {
                int f2 = aVar.f();
                w.b(TAG, "downloadState:" + f2);
                if (f2 == 5) {
                    String d2 = this.aa.d();
                    if (new File(d2).exists() && this.aa.e() == aa.a(new File(d2))) {
                        w.b(TAG, "本地已下载完 拿本地播放地址:" + d2 + " state:" + f2);
                        return d2;
                    }
                }
            }
            String videoUrlEncode = this.N.getVideoUrlEncode();
            if (ae.b(videoUrlEncode)) {
                w.b(TAG, "本地尚未下载完 拿网络地址:" + videoUrlEncode);
                return videoUrlEncode;
            }
            return null;
        } catch (Exception e2) {
            w.d(TAG, e2.getMessage());
        }
    }

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

    private int t() {
        if (u() != null) {
            return u().f();
        }
        return 100;
    }

    private com.mbridge.msdk.c.d u() {
        try {
            CampaignEx campaignEx = this.N;
            if (campaignEx == null) {
                return null;
            }
            if (ae.a(campaignEx.getCampaignUnitId())) {
                return null;
            }
            String campaignUnitId = this.N.getCampaignUnitId();
            String k2 = com.mbridge.msdk.foundation.controller.a.f().k();
            if (!ae.a(campaignUnitId)) {
                if (!ae.a(k2)) {
                    com.mbridge.msdk.c.d e2 = com.mbridge.msdk.c.b.a().e(k2, campaignUnitId);
                    if (e2 != null) {
                        return e2;
                    }
                    return com.mbridge.msdk.c.d.d(campaignUnitId);
                }
            }
            return com.mbridge.msdk.c.d.d(campaignUnitId);
        } catch (Exception e3) {
            w.d(TAG, e3.getMessage());
            return null;
        }
    }

    private boolean v() {
        try {
            com.mbridge.msdk.c.d u2 = u();
            if (u2 == null) {
                return false;
            }
            int j2 = u2.j();
            w.b(TAG, "========autoPlayType:" + j2);
            if (j2 == 1) {
                if (aa.b(getContext())) {
                    w.b(TAG, "========wifi下自动播放");
                    return true;
                }
                w.b(TAG, "========wifi下自动播放 但目前不是wifi环境 现在为点击播放");
                return false;
            } else if (j2 == 2) {
                w.b(TAG, "========点击播放");
                return false;
            } else if (j2 == 3) {
                w.b(TAG, "========有网自动播放");
                if (aa.c(getContext())) {
                    return true;
                }
                return false;
            } else if (aa.b(getContext())) {
                w.b(TAG, "========else wifi下自动播放");
                return true;
            } else {
                w.b(TAG, "========else wifi下自动播放 但目前不是wifi环境 现在为点击播放");
                return false;
            }
        } catch (Throwable th) {
            w.d(TAG, th.getMessage());
        }
    }

    @Override // com.mbridge.msdk.playercommon.VideoPlayerStatusListener
    public void onPlayStarted(int i2) {
        MediaEvents mediaEvents = this.u;
        if (mediaEvents != null) {
            try {
                mediaEvents.start((float) i2, this.f ? 1.0f : 0.0f);
            } catch (IllegalArgumentException e2) {
                w.a("omsdk", e2.getMessage());
            }
            w.a("omsdk", "videoEvents.start()");
        }
    }

    @Override // com.mbridge.msdk.playercommon.VideoPlayerStatusListener
    public void onPlayCompleted() {
        MediaEvents mediaEvents = this.u;
        if (mediaEvents != null) {
            mediaEvents.complete();
            w.a("omsdk", "videoEvents.complete()");
        }
    }

    @Override // com.mbridge.msdk.playercommon.VideoPlayerStatusListener
    public void onPlayError(final String str) {
        try {
            w.b("error", str);
            AnonymousClass17 r0 = new Runnable() {
                /* class com.mbridge.msdk.nativex.view.MBMediaView.AnonymousClass17 */

                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(r0);
            } else {
                r0.run();
            }
        } catch (Throwable th) {
            w.d(TAG, th.getMessage());
        }
    }

    @Override // com.mbridge.msdk.playercommon.VideoPlayerStatusListener
    public void onBufferingStart(String str) {
        w.b("bufferMsg", str);
        MediaEvents mediaEvents = this.u;
        if (mediaEvents != null) {
            mediaEvents.bufferStart();
            w.a("omsdk", "videoEvents.bufferStart()");
        }
    }

    @Override // com.mbridge.msdk.playercommon.VideoPlayerStatusListener
    public void onBufferingEnd() {
        MediaEvents mediaEvents = this.u;
        if (mediaEvents != null) {
            mediaEvents.bufferFinish();
            w.a("omsdk", "videoEvents.bufferFinish()");
        }
        w.b("bufferend", "bufferend");
    }

    @Override // com.mbridge.msdk.playercommon.VideoPlayerStatusListener
    public void onPlaySetDataSourceError(String str) {
        w.b("errorstr", str);
    }

    /* access modifiers changed from: package-private */
    /* renamed from: com.mbridge.msdk.nativex.view.MBMediaView$11  reason: invalid class name */
    public static /* synthetic */ class AnonymousClass11 {
        static final /* synthetic */ int[] a;

        /* JADX WARNING: Can't wrap try/catch for region: R(6:0|1|2|3|4|6) */
        /* JADX WARNING: Code restructure failed: missing block: B:7:?, code lost:
            return;
         */
        /* JADX WARNING: Failed to process nested try/catch */
        /* JADX WARNING: Missing exception handler attribute for start block: B:3:0x0012 */
        static {
            int[] iArr = new int[BaseView.a.values().length];
            a = iArr;
            iArr[BaseView.a.FULL_MIDDLE_VIEW.ordinal()] = 1;
            a[BaseView.a.FULL_TOP_VIEW.ordinal()] = 2;
        }
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private View w() {
        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(q.a(getContext(), "mbridge_nativex_close", "drawable"));
            this.ai.setOnClickListener(new View.OnClickListener() {
                /* class com.mbridge.msdk.nativex.view.MBMediaView.AnonymousClass19 */

                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 e2) {
            w.d(TAG, e2.getMessage());
            return null;
        }
    }

    public void exitFullScreen() {
        try {
            x();
            w.b(TAG, "=========webview close mAllowLoopPlay:" + this.b);
            if (this.b) {
                w.b(TAG, "播放结束 调用onClickPlayButton");
                this.w.onClickPlayButton();
            }
        } catch (Exception e2) {
            w.d(TAG, e2.getMessage());
        }
    }

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

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

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void x() {
        try {
            FrameLayout frameLayout = (FrameLayout) getRootView().findViewById(16908290);
            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(q.a(getContext(), "mbridge_full_rl_playcontainer", "id"));
            if (relativeLayout3 == null && relativeLayout2 != null) {
                relativeLayout3 = (RelativeLayout) relativeLayout2.findViewById(q.a(getContext(), "mbridge_full_rl_playcontainer", "id"));
            }
            RelativeLayout relativeLayout4 = (RelativeLayout) getRootView().findViewById(q.a(getContext(), "mbridge_full_player_parent", "id"));
            if (relativeLayout4 == null && relativeLayout3 != null) {
                relativeLayout4 = (RelativeLayout) relativeLayout3.findViewById(q.a(getContext(), "mbridge_full_player_parent", "id"));
            }
            ProgressBar progressBar = (ProgressBar) getRootView().findViewById(q.a(getContext(), "mbridge_full_pb_loading", "id"));
            RelativeLayout relativeLayout5 = (RelativeLayout) getRootView().findViewById(q.a(getContext(), "mbridge_full_rl_install", "id"));
            LinearLayout linearLayout = (LinearLayout) getRootView().findViewById(q.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 e2) {
            w.d(TAG, e2.getMessage());
        }
    }

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

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

    private void A() {
        try {
            CampaignEx campaignEx = this.N;
            if (campaignEx != null) {
                if (!ae.a(campaignEx.getVideoResolution())) {
                    String videoResolution = this.N.getVideoResolution();
                    w.d(TAG, "videoResolution:" + videoResolution);
                    String[] split = videoResolution.split("x");
                    if (split != null && split.length == 2) {
                        String str = split[0];
                        String str2 = split[1];
                        double b2 = aa.b(str);
                        double b3 = aa.b(str2);
                        if (b2 > 0.0d && b3 > 0.0d) {
                            this.Q = b2;
                            this.R = b3;
                            return;
                        }
                        return;
                    }
                    return;
                }
            }
            w.b(TAG, "campaign is null initVideoWH return");
        } catch (Throwable th) {
            w.d(TAG, th.getMessage());
        }
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private float B() {
        try {
            float i2 = (float) aa.i(getContext());
            return this.i ? i2 + ((float) aa.k(getContext())) : i2;
        } catch (Throwable th) {
            w.d(TAG, th.getMessage());
            return 0.0f;
        }
    }

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

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

    private void a(View view, float f2, float f3) {
        if (view == null) {
            try {
                w.b(TAG, "setPlayViewParamsByVidoWH view is null");
            } catch (Throwable th) {
                w.d(TAG, th.getMessage());
            }
        } else {
            double d2 = this.Q;
            double d3 = 0.0d;
            if (d2 > 0.0d) {
                double d4 = this.R;
                if (d4 > 0.0d) {
                    double d5 = d2 / d4;
                    if (f2 > 0.0f && f3 > 0.0f) {
                        d3 = (double) (f2 / f3);
                    }
                    double a2 = aa.a(Double.valueOf(d5));
                    double a3 = aa.a(Double.valueOf(d3));
                    RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) this.x.getLayoutParams();
                    RelativeLayout.LayoutParams layoutParams2 = (RelativeLayout.LayoutParams) view.getLayoutParams();
                    boolean z2 = c(getContext()) && this.i;
                    int i2 = -1;
                    if (a2 > a3) {
                        double d6 = (((double) f2) * this.R) / this.Q;
                        w.b(TAG, " setPlayView 宽铺满 playerViewHeight:" + d6 + " onMeasure mDevWidth " + this.P + " * mDevHeight *****" + this.O);
                        layoutParams2.width = -1;
                        if (!z2) {
                            i2 = (int) d6;
                        }
                        layoutParams2.height = i2;
                        layoutParams2.addRule(13);
                        layoutParams.width = this.P;
                        layoutParams.height = (int) d6;
                        layoutParams.addRule(13);
                    } else if (a2 < a3) {
                        double d7 = ((double) f3) * d5;
                        layoutParams2.width = z2 ? -1 : (int) d7;
                        layoutParams2.height = -1;
                        layoutParams2.addRule(13);
                        layoutParams.width = (int) d7;
                        layoutParams.height = this.O;
                        layoutParams.addRule(13);
                        w.b(TAG, "setPlayView 高铺满 playerViewWidth:" + d7 + " mDevWidth " + this.P + " * mDevHeight *****" + this.O);
                    } else {
                        layoutParams2.width = -1;
                        layoutParams2.height = -1;
                        layoutParams.width = this.P;
                        layoutParams.height = this.O;
                        layoutParams.addRule(13);
                        w.b(TAG, "setPlayView 铺满父布局  videoWHDivide_final:" + a2 + "  screenWHDivide_final:" + a3);
                    }
                    if (!this.h) {
                        this.x.setLayoutParams(layoutParams);
                    }
                    view.setLayoutParams(layoutParams2);
                    return;
                }
            }
            b(view);
        }
    }

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

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void D() {
        try {
            if (this.H != null || this.ai != null) {
                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) {
            w.d(TAG, th.getMessage());
        }
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void E() {
        try {
            if (this.H != null || this.ai != null) {
                RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(aa.b(getContext(), 30.0f), aa.b(getContext(), 30.0f));
                layoutParams.addRule(11);
                layoutParams.addRule(10);
                if (this.ae != 0 || !aa.a(getContext())) {
                    layoutParams.rightMargin = aa.b(getContext(), 8.0f);
                } else {
                    layoutParams.rightMargin = aa.k(getContext()) + 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) {
            w.d(TAG, th.getMessage());
        }
    }

    public void updateViewManger(boolean z2) {
        com.mbridge.msdk.nativex.view.mbfullview.a a2 = com.mbridge.msdk.nativex.view.mbfullview.a.a(getContext());
        boolean z3 = true;
        int i2 = 0;
        if (a2 != null) {
            try {
                this.F.getmAnimationPlayer().clearAnimation();
                a2.a(z2, !this.w.isComplete(), this.F);
                a2.a(z2, this.F, this.ae);
            } catch (NullPointerException e2) {
                e2.printStackTrace();
                return;
            }
        }
        BaseView baseView = this.F;
        if ((baseView instanceof MBridgeTopFullView) && a2 != null) {
            if (z2) {
                z3 = false;
            }
            if (baseView instanceof MBridgeTopFullView) {
                MBridgeTopFullView mBridgeTopFullView = (MBridgeTopFullView) baseView;
                if (!z3) {
                    i2 = 8;
                }
                mBridgeTopFullView.getMBridgeFullViewDisplayIcon().setVisibility(i2);
                mBridgeTopFullView.getMBridgeFullViewDisplayTitle().setVisibility(i2);
                mBridgeTopFullView.getMBridgeFullViewDisplayDscription().setVisibility(i2);
                mBridgeTopFullView.getStarLevelLayoutView().setVisibility(i2);
            }
        }
    }

    private void F() {
        if (!this.N.isReportClick()) {
            this.N.setReportClick(true);
            CampaignEx campaignEx = this.N;
            if (campaignEx != null && campaignEx.getNativeVideoTracking() != null && this.N.getNativeVideoTracking().h() != null) {
                Context context = getContext();
                CampaignEx campaignEx2 = this.N;
                com.mbridge.msdk.click.b.a(context, campaignEx2, campaignEx2.getCampaignUnitId(), this.N.getNativeVideoTracking().h(), false, false);
            }
        }
    }

    private void a(int i2, int i3) {
        CampaignEx.b mediaViewHolder;
        try {
            CampaignEx campaignEx = this.N;
            if (campaignEx != null && (mediaViewHolder = campaignEx.getMediaViewHolder()) != null && !mediaViewHolder.i && i3 != 0) {
                List<Map<Integer, String>> e2 = this.N.getNativeVideoTracking().e();
                int i4 = ((i2 + 1) * 100) / i3;
                if (e2 != null) {
                    int i5 = 0;
                    while (i5 < e2.size()) {
                        Map<Integer, String> map = e2.get(i5);
                        if (map != null && map.size() > 0) {
                            Iterator<Map.Entry<Integer, String>> it = map.entrySet().iterator();
                            while (it.hasNext()) {
                                Map.Entry<Integer, String> next = it.next();
                                int intValue = next.getKey().intValue();
                                String value = next.getValue();
                                if (intValue <= i4 && !TextUtils.isEmpty(value)) {
                                    Context context = getContext();
                                    CampaignEx campaignEx2 = this.N;
                                    com.mbridge.msdk.click.b.a(context, campaignEx2, campaignEx2.getCampaignUnitId(), new String[]{value}, false, true);
                                    it.remove();
                                    e2.remove(i5);
                                    i5--;
                                }
                            }
                        }
                        i5++;
                    }
                    if (e2.size() <= 0) {
                        mediaViewHolder.i = true;
                    }
                }
            }
        } catch (Throwable unused) {
            w.d(TAG, "reportPlayPercentageData error");
        }
    }

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

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

    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 boolean canShowVideo() {
        if (a(false) == a.VIDEO) {
            return true;
        }
        return false;
    }

    private class e implements SensorEventListener {
        public final void onAccuracyChanged(Sensor sensor, int i) {
        }

        private e() {
        }

        public final void onSensorChanged(SensorEvent sensorEvent) {
            int i;
            if (!MBMediaView.this.ak) {
                try {
                    float[] fArr = sensorEvent.values;
                    float f = -fArr[0];
                    float f2 = -fArr[1];
                    float f3 = -fArr[2];
                    if (((f * f) + (f2 * f2)) * 4.0f >= f3 * f3) {
                        i = 90 - Math.round(((float) Math.atan2((double) (-f2), (double) f)) * 57.29578f);
                        while (i >= 360) {
                            i += NetError.ERR_HTTP2_INADEQUATE_TRANSPORT_SECURITY;
                        }
                        while (i < 0) {
                            i += BitmapUtils.ROTATE360;
                        }
                    } else {
                        i = -1;
                    }
                    float B = MBMediaView.this.B();
                    int j = aa.j(MBMediaView.this.getContext());
                    if ((i <= 45 || i >= 135) && (i <= 225 || i >= 315)) {
                        if (((i > 135 && i < 225) || ((i > 315 && i < 360) || ((i >= 0 && i <= 45) || i == -1))) && B <= ((float) j) && MBMediaView.this.j) {
                            w.b(MBMediaView.TAG, "onSensorChanged: to protrait: |||||||||||||||||");
                            MBMediaView.this.i = false;
                            MBMediaView.this.j = false;
                            MBMediaView.this.M.postDelayed(new Runnable() {
                                /* class com.mbridge.msdk.nativex.view.MBMediaView.e.AnonymousClass2 */

                                public final void run() {
                                    try {
                                        w.b(MBMediaView.TAG, "onSensorChanged: is portrait: |||||||||||||||||");
                                        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) {
                                            w.a(MBMediaView.TAG, "=====orientation|||||");
                                            MBMediaView.this.B.orientation(MBMediaView.this.i);
                                        }
                                    } catch (Exception e) {
                                        w.d(MBMediaView.TAG, e.getMessage());
                                    }
                                }
                            }, 200);
                        }
                    } else if (B >= ((float) j) && !MBMediaView.this.j) {
                        w.b(MBMediaView.TAG, "onSensorChanged: to LandScape: --------------");
                        MBMediaView.this.i = true;
                        MBMediaView.this.j = true;
                        MBMediaView.this.M.postDelayed(new Runnable() {
                            /* class com.mbridge.msdk.nativex.view.MBMediaView.e.AnonymousClass1 */

                            public final void run() {
                                try {
                                    w.b(MBMediaView.TAG, "onSensorChanged: is LandScape: --------------");
                                    com.mbridge.msdk.nativex.view.mbfullview.a.a(MBMediaView.this.getContext()).a(MBMediaView.this.F, MBMediaView.this.i);
                                    MBMediaView.this.E();
                                    MBMediaView.this.h();
                                    MBMediaView.this.f();
                                    MBMediaView.this.g();
                                    if (MBMediaView.this.B != null) {
                                        w.a(MBMediaView.TAG, "=====orientation----");
                                        MBMediaView.this.B.orientation(MBMediaView.this.i);
                                    }
                                } catch (Exception e) {
                                    w.d(MBMediaView.TAG, e.getMessage());
                                }
                            }
                        }, 200);
                    }
                } catch (Throwable th) {
                    w.b(MBMediaView.TAG, th.getMessage(), th);
                }
            }
        }
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private WindVaneWebViewForNV H() {
        try {
            w.d(TAG, "getEndCardWebview hadStarLoad:" + this.ag + "-endCardWebview:" + this.B);
            WindVaneWebViewForNV windVaneWebViewForNV = this.B;
            if (windVaneWebViewForNV != null && this.ag) {
                return windVaneWebViewForNV;
            }
            if (this.ag) {
                return null;
            }
            b(true);
            return null;
        } catch (Exception e2) {
            w.d(TAG, e2.getMessage());
            return null;
        }
    }

    private void b(boolean z2) {
        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() {
                    /* class com.mbridge.msdk.nativex.view.MBMediaView.AnonymousClass7 */

                    @Override // com.mbridge.msdk.nativex.listener.b
                    public final void a() {
                        MBMediaView.this.exitFullScreen();
                    }
                });
                this.B.setWebViewListener(new com.mbridge.msdk.mbjscommon.c.b() {
                    /* class com.mbridge.msdk.nativex.view.MBMediaView.AnonymousClass8 */

                    @Override // com.mbridge.msdk.mbjscommon.c.b, com.mbridge.msdk.mbjscommon.windvane.d
                    public final void a(WebView webView, String str) {
                        super.a(webView, str);
                        MBMediaView.this.af = true;
                    }

                    @Override // com.mbridge.msdk.mbjscommon.c.b, com.mbridge.msdk.mbjscommon.windvane.d
                    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) {
                String str = this.N.getendcard_url();
                if (!TextUtils.isEmpty(str)) {
                    this.N.getMediaViewHolder();
                    if (!str.contains(".zip") || !str.contains(ResourceManager.KEY_MD5FILENAME)) {
                        String htmlContentFromUrl = HTMLResourceManager.getInstance().getHtmlContentFromUrl(str);
                        if (ae.b(htmlContentFromUrl)) {
                            w.a(TAG, "load html...");
                            this.ag = true;
                            this.B.loadDataWithBaseURL(str, htmlContentFromUrl, "text/html", "UTF-8", null);
                            return;
                        }
                        return;
                    }
                    String h5ResAddress = H5DownLoadManager.getInstance().getH5ResAddress(str);
                    if (ae.b(h5ResAddress)) {
                        this.ag = true;
                        this.B.loadUrl(h5ResAddress);
                    }
                }
            } else if (nvT2 == 4) {
                this.ag = true;
                if (this.N != null) {
                    BrowserView.MBDownloadListener mBDownloadListener = new BrowserView.MBDownloadListener(this.N);
                    mBDownloadListener.setTitle(this.N.getAppName());
                    this.B.setDownloadListener(mBDownloadListener);
                    this.B.setFilter(new d());
                }
            }
        } catch (Exception e2) {
            w.d(TAG, e2.getMessage());
        }
    }

    /* access modifiers changed from: private */
    public static final class g extends WebViewClient {
        WeakReference<MBMediaView> a;

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

        public final void onPageFinished(WebView webView, String str) {
            super.onPageFinished(webView, str);
            try {
                MBMediaView mBMediaView = this.a.get();
                if (mBMediaView != null && mBMediaView.ab != null && mBMediaView.ab == a.BIG_IMAGE) {
                    mBMediaView.m();
                    mBMediaView.ab = a.GIF;
                    mBMediaView.changeNoticeURL();
                }
            } catch (Exception e) {
                w.d(MBMediaView.TAG, e.getMessage());
            }
        }
    }

    /* access modifiers changed from: private */
    public static final class f implements com.mbridge.msdk.videocommon.listener.a {
        WeakReference<MBMediaView> a;

        @Override // com.mbridge.msdk.videocommon.listener.a
        public final void a(String str, String str2) {
        }

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

        @Override // com.mbridge.msdk.videocommon.listener.a
        public final void a(String str) {
            MBMediaView mBMediaView = this.a.get();
            if (mBMediaView != null) {
                mBMediaView.M.post(new b(mBMediaView));
            }
        }
    }

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

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

        public final void run() {
            MBMediaView mBMediaView = this.a.get();
            if (mBMediaView != null) {
                try {
                    if (mBMediaView.ab != null && mBMediaView.ab == a.BIG_IMAGE) {
                        mBMediaView.e();
                        mBMediaView.ab = a.VIDEO;
                        mBMediaView.changeNoticeURL();
                    }
                } catch (Throwable th) {
                    w.b(MBMediaView.TAG, th.getMessage(), th);
                }
            }
        }
    }

    /* access modifiers changed from: private */
    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 // com.mbridge.msdk.nativex.listener.a
        public final void a() {
            MBMediaView mBMediaView = this.a.get();
            if (mBMediaView != null) {
                MBMediaView.N(mBMediaView);
            }
        }

        @Override // com.mbridge.msdk.nativex.listener.a
        public final void b() {
            MBMediaView mBMediaView = this.a.get();
            if (mBMediaView != null) {
                MBMediaView.O(mBMediaView);
            }
        }

        @Override // com.mbridge.msdk.nativex.listener.a
        public final void c() {
            MBMediaView mBMediaView = this.a.get();
            if (mBMediaView != null) {
                MBMediaView.P(mBMediaView);
            }
        }

        @Override // com.mbridge.msdk.nativex.listener.a
        public final void d() {
            MBMediaView mBMediaView = this.a.get();
            if (mBMediaView != null) {
                MBMediaView.Q(mBMediaView);
            }
        }

        @Override // com.mbridge.msdk.nativex.listener.a
        public final void a(String str) {
            MBMediaView mBMediaView = this.a.get();
            if (mBMediaView != null) {
                mBMediaView.a(str);
            }
        }

        @Override // com.mbridge.msdk.nativex.listener.a
        public final void b(String str) {
            MBMediaView mBMediaView = this.a.get();
            if (mBMediaView != null) {
                mBMediaView.b(str);
            }
        }
    }

    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;
        } else {
            if (nvT2 == 6) {
                return BaseView.a.FULL_TOP_VIEW;
            }
        }
        return null;
    }

    /* access modifiers changed from: private */
    public static final class d implements com.mbridge.msdk.mbjscommon.base.a {
        private d() {
        }

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

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

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

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

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

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

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

    /* access modifiers changed from: protected */
    public void onConfigurationChanged(Configuration configuration) {
        super.onConfigurationChanged(configuration);
        w.d(TAG, "onConfigurationChange " + configuration.orientation);
        if (this.ak && this.aj != configuration.orientation) {
            int i2 = configuration.orientation;
            this.aj = i2;
            boolean z2 = true;
            this.i = i2 == 0;
            if (this.aj != 0) {
                z2 = false;
            }
            this.j = z2;
            this.M.postDelayed(new Runnable() {
                /* class com.mbridge.msdk.nativex.view.MBMediaView.AnonymousClass9 */

                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.E();
                        } else {
                            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) {
                        w.d(MBMediaView.TAG, e.getMessage());
                    }
                }
            }, 200);
        }
    }

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

    /* access modifiers changed from: protected */
    public void onVisibilityChanged(View view, int i2) {
        super.onVisibilityChanged(view, i2);
        w.d(TAG, "onVisibilityChanged invoked");
    }

    @Override // com.mbridge.msdk.video.js.bridge.IRewardBridge
    public void getEndScreenInfo(Object obj, String str) {
        try {
            ArrayList arrayList = new ArrayList();
            arrayList.add(this.N);
            String a2 = a(arrayList, p(), "MAL_16.1.87,3.0.1");
            String encodeToString = !TextUtils.isEmpty(a2) ? Base64.encodeToString(a2.getBytes(), 2) : "";
            w.d(TAG, "====getEndScreenInfo-mCampaign.name:" + this.N.getAppName());
            h.a().a(obj, encodeToString);
        } catch (Throwable th) {
            w.d(TAG, th.getMessage());
        }
    }

    @Override // com.mbridge.msdk.video.js.bridge.IRewardBridge
    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.mbjscommon.windvane.a) && (windVaneWebView = ((com.mbridge.msdk.mbjscommon.windvane.a) obj).a) != null) {
                b(windVaneWebView.getContext());
            }
        } catch (Exception e2) {
            w.d(TAG, e2.getMessage());
        }
    }

    @Override // com.mbridge.msdk.video.js.bridge.IRewardBridge
    public void openURL(Object obj, String str) {
        WindVaneWebView windVaneWebView;
        w.d(TAG, "openURL:" + str);
        if (TextUtils.isEmpty(str)) {
            com.mbridge.msdk.mbjscommon.bridge.b.a(obj, "params is null");
            return;
        }
        Context j2 = com.mbridge.msdk.foundation.controller.a.f().j();
        if (!TextUtils.isEmpty(str)) {
            if (j2 == null) {
                try {
                    if ((obj instanceof com.mbridge.msdk.mbjscommon.windvane.a) && (windVaneWebView = ((com.mbridge.msdk.mbjscommon.windvane.a) obj).a) != null) {
                        j2 = windVaneWebView.getContext();
                    }
                } catch (Exception e2) {
                    w.d(TAG, e2.getMessage());
                }
            }
            if (j2 != null) {
                try {
                    JSONObject jSONObject = new JSONObject(str);
                    String optString = jSONObject.optString("url");
                    int optInt = jSONObject.optInt("type");
                    if (optInt == 1) {
                        com.mbridge.msdk.click.c.a(j2, optString);
                    } else if (optInt == 2) {
                        com.mbridge.msdk.click.c.b(j2, optString);
                    }
                } catch (JSONException e3) {
                    w.d(TAG, e3.getMessage());
                } catch (Throwable th) {
                    w.d(TAG, th.getMessage());
                }
            }
        }
    }

    @Override // com.mbridge.msdk.video.js.bridge.IRewardBridge
    public void cai(Object obj, String str) {
        w.a(TAG, "cai:" + str);
        if (TextUtils.isEmpty(str)) {
            com.mbridge.msdk.mbjscommon.bridge.b.a(obj, "params is null");
        } else if (!TextUtils.isEmpty(str)) {
            try {
                String optString = new JSONObject(str).optString("packageName");
                if (TextUtils.isEmpty(optString)) {
                    com.mbridge.msdk.mbjscommon.bridge.b.a(obj, "packageName is empty");
                }
                int i2 = aa.c(com.mbridge.msdk.foundation.controller.a.f().j(), optString) ? 1 : 2;
                try {
                    JSONObject jSONObject = new JSONObject();
                    jSONObject.put(PluginConstants.KEY_ERROR_CODE, com.mbridge.msdk.mbjscommon.bridge.b.b);
                    JSONObject jSONObject2 = new JSONObject();
                    jSONObject2.put("result", i2);
                    jSONObject.put("data", jSONObject2);
                    h.a().a(obj, Base64.encodeToString(jSONObject.toString().getBytes(), 2));
                } catch (Exception e2) {
                    com.mbridge.msdk.mbjscommon.bridge.b.a(obj, e2.getMessage());
                    w.a(TAG, e2.getMessage());
                }
            } catch (JSONException e3) {
                com.mbridge.msdk.mbjscommon.bridge.b.a(obj, "exception: " + e3.getLocalizedMessage());
                w.b(TAG, "cai", e3);
            } catch (Throwable th) {
                com.mbridge.msdk.mbjscommon.bridge.b.a(obj, "exception: " + th.getLocalizedMessage());
                w.b(TAG, "cai", th);
            }
        }
    }

    @Override // com.mbridge.msdk.video.js.bridge.IRewardBridge
    public void gial(Object obj, String str) {
        w.a(TAG, "gial:" + str);
        try {
            JSONObject jSONObject = new JSONObject();
            jSONObject.put(PluginConstants.KEY_ERROR_CODE, com.mbridge.msdk.mbjscommon.bridge.b.b);
            JSONObject jSONObject2 = new JSONObject();
            List<String> list = com.mbridge.msdk.foundation.controller.a.c;
            JSONArray jSONArray = new JSONArray();
            if (list != null && list.size() > 0) {
                int size = list.size();
                for (int i2 = 0; i2 < size; i2++) {
                    jSONArray.put(list.get(i2));
                }
            }
            jSONObject2.put("packageNameList", jSONArray);
            jSONObject.put("data", jSONObject2);
            h.a().a(obj, Base64.encodeToString(jSONObject.toString().getBytes(), 2));
        } catch (Exception e2) {
            com.mbridge.msdk.mbjscommon.bridge.b.a(obj, e2.getMessage());
            w.a(TAG, e2.getMessage());
        } catch (Throwable th) {
            com.mbridge.msdk.mbjscommon.bridge.b.a(obj, th.getMessage());
            w.a(TAG, th.getMessage());
        }
    }

    @Override // com.mbridge.msdk.video.js.bridge.IRewardBridge
    public void toggleCloseBtn(Object obj, String str) {
        try {
            if (!TextUtils.isEmpty(str)) {
                try {
                    new JSONObject(str).optInt("state", 1);
                } catch (Exception unused) {
                }
            }
            w.d(TAG, "SHOW CLOSE BTN ");
            showEndCardWebViewCloseBtn();
            h.a().a(obj, a(0));
        } catch (Exception e2) {
            w.d(TAG, e2.getMessage());
            h.a().b(obj, a(1));
        }
    }

    @Override // com.mbridge.msdk.video.js.bridge.IRewardBridge
    public void triggerCloseBtn(Object obj, String str) {
        try {
            exitFullScreen();
            h.a().a(obj, a(0));
        } catch (Exception e2) {
            w.d(TAG, e2.getMessage());
            h.a().b(obj, a(1));
        }
    }

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

    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(MBridgeConstans.PROPERTIES_UNIT_ID, str);
            jSONObject.put("sdk_info", str2);
            return jSONObject.toString();
        } catch (Exception e2) {
            w.d(TAG, e2.getMessage());
            return null;
        }
    }

    @Override // com.mbridge.msdk.playercommon.VideoPlayerStatusListener
    public void onPlayProgress(int i2, int i3) {
        int i4;
        String str;
        CampaignEx.b mediaViewHolder;
        try {
            CampaignEx campaignEx = this.N;
            if (!(campaignEx == null || (mediaViewHolder = campaignEx.getMediaViewHolder()) == null || mediaViewHolder.h || mediaViewHolder.l == null || mediaViewHolder.l.size() <= 0)) {
                Map<Integer, String> map = mediaViewHolder.l;
                w.b(TAG, "reportAdvImp pre advImpMap.size:" + map.size());
                Iterator<Map.Entry<Integer, String>> it = map.entrySet().iterator();
                while (it.hasNext()) {
                    Map.Entry<Integer, String> next = it.next();
                    String value = next.getValue();
                    if (i2 >= next.getKey().intValue() && !TextUtils.isEmpty(value)) {
                        Context context = getContext();
                        CampaignEx campaignEx2 = this.N;
                        com.mbridge.msdk.click.b.a(context, campaignEx2, campaignEx2.getCampaignUnitId(), value, false, false);
                        it.remove();
                        w.b(TAG, "reportAdvImp remove value:" + value);
                    }
                }
                w.b(TAG, "reportAdvImp advImpMap after size:" + map.size());
                if (map.size() <= 0) {
                    mediaViewHolder.h = true;
                }
            }
        } catch (Exception e2) {
            w.d(TAG, e2.getMessage());
        }
        a(i2, i3);
        if (this.u != null) {
            int i5 = (i2 * 100) / i3;
            int i6 = ((i2 + 1) * 100) / i3;
            w.a("omsdk", "onPlayProgress: mCurPlayPosition = " + i2 + " percent = " + i5 + " nextPercent = " + i6);
            if (i5 <= 25 && 25 < i6) {
                this.u.firstQuartile();
                w.a("omsdk", "videoEvents.firstQuartile()");
            } else if (i5 <= 50 && 50 < i6) {
                this.u.midpoint();
                w.a("omsdk", "videoEvents.midpoint()");
            } else if (i5 <= 75 && 75 < i6) {
                this.u.thirdQuartile();
                w.a("omsdk", "videoEvents.thirdQuartile()");
            }
        }
        if (t() != 100 && !this.am) {
            int i7 = 0;
            if (u() != null) {
                i7 = u().g();
            }
            int t2 = t();
            if (t2 != 0) {
                if (i7 > t2) {
                    i7 = t2 / 2;
                }
                if (i7 >= 0 && i2 >= (i4 = (i7 * i3) / 100)) {
                    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 a2 = com.mbridge.msdk.videocommon.download.b.getInstance().a(p(), str);
                    if (a2 != null) {
                        a2.j();
                        this.am = true;
                        w.d(TAG, "CDRate is : " + i4 + " and start download !");
                    }
                }
            }
        }
    }

    static /* synthetic */ void b(MBMediaView mBMediaView) {
        CampaignEx campaignEx = mBMediaView.N;
        if (campaignEx != null && campaignEx.getMediaViewHolder() != null) {
            com.mbridge.msdk.foundation.controller.a.f().a(mBMediaView.getContext());
            com.mbridge.msdk.mbnative.d.b.a(mBMediaView.N, mBMediaView.getContext(), mBMediaView.p(), null);
            CampaignEx.b mediaViewHolder = mBMediaView.N.getMediaViewHolder();
            if (!mediaViewHolder.a && mBMediaView.ab == a.VIDEO && ae.b(mBMediaView.N.getImpressionURL())) {
                mediaViewHolder.a = true;
                String impressionURL = mBMediaView.N.getImpressionURL();
                if (!impressionURL.contains("is_video=1")) {
                    StringBuilder sb = new StringBuilder(impressionURL);
                    if (impressionURL.contains("?")) {
                        sb.append("&is_video=1");
                    } else {
                        sb.append("?is_video=1");
                    }
                    impressionURL = sb.toString();
                }
                w.b(TAG, "change impressionurl:" + impressionURL);
                Context context = mBMediaView.getContext();
                CampaignEx campaignEx2 = mBMediaView.N;
                com.mbridge.msdk.click.b.a(context, campaignEx2, campaignEx2.getCampaignUnitId(), impressionURL, false, true, com.mbridge.msdk.click.a.a.g);
            }
        }
    }

    static /* synthetic */ 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().o() != null) {
            mediaViewHolder.g = true;
            Context context = mBMediaView.getContext();
            CampaignEx campaignEx2 = mBMediaView.N;
            com.mbridge.msdk.click.b.a(context, campaignEx2, campaignEx2.getCampaignUnitId(), mBMediaView.N.getNativeVideoTracking().o(), false, false);
        }
    }

    static /* synthetic */ void h(MBMediaView mBMediaView) {
        try {
            if (mBMediaView.getRootView() != null) {
                if (mBMediaView.getRootView() instanceof ViewGroup) {
                    BaseView.a handleViewStyleResult = mBMediaView.handleViewStyleResult(mBMediaView.getContext());
                    if (handleViewStyleResult != null) {
                        BaseView fullScreenViewByStyle = mBMediaView.getFullScreenViewByStyle(mBMediaView.getContext(), handleViewStyleResult);
                        mBMediaView.F = fullScreenViewByStyle;
                        if (fullScreenViewByStyle == null) {
                            w.b(TAG, "mFullScreenViewUI is null");
                            return;
                        } else if (!mBMediaView.y()) {
                            w.d(TAG, "fullViewFailed return");
                            return;
                        } else {
                            com.mbridge.msdk.nativex.view.mbfullview.a.a(mBMediaView.getContext()).a(mBMediaView.F.style, mBMediaView.N, mBMediaView.F);
                            mBMediaView.h = true;
                            mBMediaView.r = false;
                            MediaViewPlayerView mediaViewPlayerView = mBMediaView.w;
                            if (mediaViewPlayerView != null) {
                                mediaViewPlayerView.setEnterFullScreen();
                                mBMediaView.w.setIsActivePause(false);
                            }
                            try {
                                OnMBMediaViewListener onMBMediaViewListener = mBMediaView.ac;
                                if (onMBMediaViewListener != null) {
                                    onMBMediaViewListener.onEnterFullscreen();
                                }
                                OnMBMediaViewListenerPlus onMBMediaViewListenerPlus = mBMediaView.ad;
                                if (onMBMediaViewListenerPlus != null) {
                                    onMBMediaViewListenerPlus.onEnterFullscreen();
                                }
                                MediaEvents mediaEvents = mBMediaView.u;
                                if (mediaEvents != null) {
                                    mediaEvents.playerStateChange(PlayerState.FULLSCREEN);
                                    w.a("omsdk", "NV playerStateChange, FULLSCREEN");
                                }
                            } catch (Exception e2) {
                                w.d(TAG, e2.getMessage());
                            }
                            FrameLayout frameLayout = (FrameLayout) mBMediaView.getRootView().findViewById(16908290);
                            RelativeLayout relativeLayout = new RelativeLayout(mBMediaView.getContext());
                            mBMediaView.E = relativeLayout;
                            relativeLayout.setClickable(true);
                            ViewGroup viewGroup = (ViewGroup) mBMediaView.w.getParent();
                            int childCount = viewGroup.getChildCount();
                            int i2 = 0;
                            while (i2 < childCount && viewGroup.getChildAt(i2) != mBMediaView.w) {
                                i2++;
                            }
                            mBMediaView.L = i2;
                            FrameLayout frameLayout2 = new FrameLayout(mBMediaView.getContext());
                            frameLayout2.setId(100);
                            viewGroup.addView(frameLayout2, i2, 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.f117K.addView(mBMediaView.w, new RelativeLayout.LayoutParams(-1, -1));
                            frameLayout.addView(relativeLayout, layoutParams);
                            int i3 = -16777216;
                            if (AnonymousClass11.a[mBMediaView.F.style.ordinal()] == 2) {
                                i3 = -1;
                            }
                            int i4 = mBMediaView.v;
                            if (i4 != 0) {
                                relativeLayout.setBackgroundColor(i4);
                            } else {
                                relativeLayout.setBackgroundColor(i3);
                            }
                            mBMediaView.F.setId(103);
                            RelativeLayout.LayoutParams layoutParams2 = new RelativeLayout.LayoutParams(-1, -1);
                            int[] iArr = new int[2];
                            frameLayout.getLocationInWindow(iArr);
                            mBMediaView.ae = iArr[1];
                            w.b(TAG, "mFullViewStartY:" + mBMediaView.ae);
                            if (mBMediaView.ae == 0) {
                                w.b(TAG, "addfullview 增加状态栏高度 沉浸式时contentview的高度和屏幕高度一样");
                                if (Build.VERSION.SDK_INT >= 23) {
                                    WindowInsets rootWindowInsets = mBMediaView.getRootWindowInsets();
                                    if (rootWindowInsets != null) {
                                        layoutParams2.setMargins(0, rootWindowInsets.getStableInsetTop(), 0, 0);
                                    }
                                } else {
                                    layoutParams2.setMargins(0, aa.e(mBMediaView.getContext()), 0, 0);
                                }
                            }
                            relativeLayout.addView(mBMediaView.F, layoutParams2);
                            try {
                                mBMediaView.z();
                                mBMediaView.a(mBMediaView.G, mBMediaView.B(), mBMediaView.C());
                                com.mbridge.msdk.nativex.view.mbfullview.a.a(mBMediaView.getContext()).a(mBMediaView.F, mBMediaView.i);
                                if (mBMediaView.i) {
                                    mBMediaView.E();
                                } else {
                                    mBMediaView.D();
                                }
                                mBMediaView.M.postDelayed(new Runnable() {
                                    /* class com.mbridge.msdk.nativex.view.MBMediaView.AnonymousClass6 */

                                    public final void run() {
                                        MBMediaView.this.r = true;
                                        if (MBMediaView.this.h) {
                                            TextView unused = MBMediaView.this.I;
                                        }
                                    }
                                }, 3000);
                            } catch (Throwable th) {
                                w.d(TAG, th.getMessage());
                            }
                            try {
                                mBMediaView.E.setFocusableInTouchMode(true);
                                mBMediaView.E.requestFocus();
                                mBMediaView.E.setOnKeyListener(new View.OnKeyListener() {
                                    /* class com.mbridge.msdk.nativex.view.MBMediaView.AnonymousClass2 */

                                    public final boolean onKey(View view, int i, KeyEvent keyEvent) {
                                        try {
                                            if (keyEvent.getKeyCode() != 4) {
                                                return false;
                                            }
                                            MBMediaView.this.x();
                                            return true;
                                        } catch (Throwable th) {
                                            w.d(MBMediaView.TAG, th.getMessage());
                                            return false;
                                        }
                                    }
                                });
                                mBMediaView.E.setOnClickListener(new View.OnClickListener() {
                                    /* class com.mbridge.msdk.nativex.view.MBMediaView.AnonymousClass3 */

                                    public final void onClick(View view) {
                                        MBMediaView.i(MBMediaView.this);
                                    }
                                });
                                mBMediaView.H.setOnClickListener(new View.OnClickListener() {
                                    /* class com.mbridge.msdk.nativex.view.MBMediaView.AnonymousClass4 */

                                    public final void onClick(View view) {
                                        MBMediaView.this.x();
                                    }
                                });
                                mBMediaView.I.setOnClickListener(new com.mbridge.msdk.widget.a() {
                                    /* class com.mbridge.msdk.nativex.view.MBMediaView.AnonymousClass5 */

                                    /* access modifiers changed from: protected */
                                    @Override // com.mbridge.msdk.widget.a
                                    public final void a(View view) {
                                        try {
                                            w.b(MBMediaView.TAG, "点击安装 click");
                                            MBMediaView.this.b((MBMediaView) view.getContext());
                                            if (MBMediaView.this.u != null) {
                                                MBMediaView.this.u.adUserInteraction(InteractionType.CLICK);
                                            }
                                        } catch (Exception e) {
                                            w.d(MBMediaView.TAG, e.getMessage());
                                        }
                                    }
                                });
                            } catch (Exception e3) {
                                w.d(TAG, e3.getMessage());
                            }
                            MediaViewPlayerView mediaViewPlayerView2 = mBMediaView.w;
                            if (mediaViewPlayerView2 != null) {
                                mediaViewPlayerView2.openSound();
                            }
                            MediaViewPlayerView mediaViewPlayerView3 = mBMediaView.w;
                            mediaViewPlayerView3.setMediaViewPlayListener(new MediaViewPlayerView.a(mediaViewPlayerView3) {
                                /* class com.mbridge.msdk.nativex.view.MBMediaView.AnonymousClass18 */

                                @Override // com.mbridge.msdk.nativex.view.MediaViewPlayerView.a
                                public final void a() {
                                    int nvT2 = MBMediaView.this.N.getNvT2();
                                    if (!MBMediaView.this.h || !(nvT2 == 3 || nvT2 == 4)) {
                                        super.a();
                                        return;
                                    }
                                    WindVaneWebViewForNV H = MBMediaView.this.H();
                                    if (H != null) {
                                        View w = MBMediaView.this.w();
                                        if (w == null) {
                                            super.a();
                                            return;
                                        }
                                        if (nvT2 == 3 && MBMediaView.this.af) {
                                            com.mbridge.msdk.nativex.view.mbfullview.a.a(MBMediaView.this.getContext()).a(w, 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().m() == null)) {
                                                        String[] m = campaignEx.getNativeVideoTracking().m();
                                                        for (String str : m) {
                                                            if (!TextUtils.isEmpty(str)) {
                                                                com.mbridge.msdk.click.b.a(context, campaignEx, campaignUnitId, str, false, true);
                                                            }
                                                        }
                                                    }
                                                } catch (Exception e) {
                                                    e.printStackTrace();
                                                }
                                            }
                                        } else if (nvT2 == 4) {
                                            com.mbridge.msdk.nativex.view.mbfullview.a.a(MBMediaView.this.getContext()).a(w, MBMediaView.this.F);
                                            String clickURL = MBMediaView.this.N.getClickURL();
                                            if (!TextUtils.isEmpty(clickURL)) {
                                                com.mbridge.msdk.click.b.a(MBMediaView.this.getContext(), MBMediaView.this.N, MBMediaView.this.p(), MBMediaView.this.getAddNVT2ToNoticeURL(), true, false, com.mbridge.msdk.click.a.a.i);
                                                MBMediaView.this.B.loadUrl(clickURL);
                                            }
                                        } else {
                                            super.a();
                                            return;
                                        }
                                        H.webViewShow(MBMediaView.this.N, MBMediaView.this.p());
                                        H.orientation(MBMediaView.this.i);
                                        return;
                                    }
                                    super.a();
                                }
                            });
                            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().d() == null)) {
                                mBMediaView.N.getMediaViewHolder().k = true;
                                mBMediaView.G();
                            }
                            w.b(TAG, "mediaview add to full screen");
                            return;
                        }
                    } else {
                        return;
                    }
                }
            }
            w.b(TAG, "rootView is null");
        } catch (Exception e4) {
            w.d(TAG, e4.getMessage());
        }
    }

    static /* synthetic */ void i(MBMediaView mBMediaView) {
        try {
            MediaViewPlayerView mediaViewPlayerView = mBMediaView.w;
            if (mediaViewPlayerView == null) {
                w.b(TAG, "playerview is null return");
            } else {
                mediaViewPlayerView.onClickPlayerView();
            }
        } catch (Throwable th) {
            w.d(TAG, th.getMessage());
        }
    }

    static /* synthetic */ void n(MBMediaView mBMediaView) {
        try {
            ProgressBar progressBar = mBMediaView.D;
            if (progressBar != null) {
                progressBar.setVisibility(0);
            }
        } catch (Exception e2) {
            w.d(TAG, e2.getMessage());
        }
    }

    static /* synthetic */ void o(MBMediaView mBMediaView) {
        try {
            ProgressBar progressBar = mBMediaView.J;
            if (progressBar != null) {
                progressBar.setVisibility(0);
            }
        } catch (Exception e2) {
            w.d(TAG, e2.getMessage());
        }
    }

    static /* synthetic */ void a(MBMediaView mBMediaView, Campaign campaign, String str) {
        try {
            OnMBMediaViewListener onMBMediaViewListener = mBMediaView.ac;
            if (onMBMediaViewListener != null) {
                onMBMediaViewListener.onStartRedirection(campaign, str);
            }
            OnMBMediaViewListenerPlus onMBMediaViewListenerPlus = mBMediaView.ad;
            if (onMBMediaViewListenerPlus != null) {
                onMBMediaViewListenerPlus.onStartRedirection(campaign, str);
            }
        } catch (Exception e2) {
            w.d(TAG, e2.getMessage());
        }
    }

    static /* synthetic */ void p(MBMediaView mBMediaView) {
        try {
            ProgressBar progressBar = mBMediaView.D;
            if (progressBar != null) {
                progressBar.setVisibility(8);
            }
        } catch (Exception e2) {
            w.d(TAG, e2.getMessage());
        }
    }

    static /* synthetic */ void q(MBMediaView mBMediaView) {
        try {
            ProgressBar progressBar = mBMediaView.J;
            if (progressBar != null) {
                progressBar.setVisibility(8);
            }
        } catch (Exception e2) {
            w.d(TAG, e2.getMessage());
        }
    }

    static /* synthetic */ void b(MBMediaView mBMediaView, Campaign campaign, String str) {
        try {
            OnMBMediaViewListener onMBMediaViewListener = mBMediaView.ac;
            if (onMBMediaViewListener != null) {
                onMBMediaViewListener.onRedirectionFailed(campaign, str);
            }
            OnMBMediaViewListenerPlus onMBMediaViewListenerPlus = mBMediaView.ad;
            if (onMBMediaViewListenerPlus != null) {
                onMBMediaViewListenerPlus.onRedirectionFailed(campaign, str);
            }
        } catch (Exception e2) {
            w.d(TAG, e2.getMessage());
        }
    }

    static /* synthetic */ void c(MBMediaView mBMediaView, Campaign campaign, String str) {
        try {
            OnMBMediaViewListener onMBMediaViewListener = mBMediaView.ac;
            if (onMBMediaViewListener != null) {
                onMBMediaViewListener.onFinishRedirection(campaign, str);
            }
            OnMBMediaViewListenerPlus onMBMediaViewListenerPlus = mBMediaView.ad;
            if (onMBMediaViewListenerPlus != null) {
                onMBMediaViewListenerPlus.onFinishRedirection(campaign, str);
            }
        } catch (Exception e2) {
            w.d(TAG, e2.getMessage());
        }
    }

    static /* synthetic */ 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().k() != null) {
            mBMediaView.N.getMediaViewHolder().d = true;
            Context context = mBMediaView.getContext();
            CampaignEx campaignEx2 = mBMediaView.N;
            com.mbridge.msdk.click.b.a(context, campaignEx2, campaignEx2.getCampaignUnitId(), mBMediaView.N.getNativeVideoTracking().k(), false, false);
        }
    }

    static /* synthetic */ void a(MBMediaView mBMediaView, String str) {
        try {
            t a2 = t.a(i.a(mBMediaView.getContext()));
            p pVar = null;
            if (!TextUtils.isEmpty(mBMediaView.N.getNoticeUrl())) {
                int D2 = s.D(mBMediaView.getContext());
                pVar = new p("2000021", D2, mBMediaView.N.getNoticeUrl(), str, s.a(mBMediaView.getContext(), D2));
            } else if (!TextUtils.isEmpty(mBMediaView.N.getClickURL())) {
                int D3 = s.D(mBMediaView.getContext());
                pVar = new p("2000021", D3, mBMediaView.N.getClickURL(), str, s.a(mBMediaView.getContext(), D3));
            }
            if (pVar != null) {
                pVar.n(mBMediaView.N.getId());
                pVar.e(mBMediaView.N.getVideoUrlEncode());
                pVar.p(str);
                pVar.k(mBMediaView.N.getRequestId());
                pVar.l(mBMediaView.N.getRequestIdNotice());
                pVar.m(mBMediaView.p());
                a2.a(pVar);
            }
        } catch (Exception e2) {
            w.d(TAG, e2.getMessage());
        }
    }

    static /* synthetic */ 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().f() != null) {
            mediaViewHolder.b = true;
            Context context = mBMediaView.getContext();
            CampaignEx campaignEx2 = mBMediaView.N;
            com.mbridge.msdk.click.b.a(context, campaignEx2, campaignEx2.getCampaignUnitId(), mBMediaView.N.getNativeVideoTracking().f(), false, false);
        }
    }

    static /* synthetic */ 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().g() != null) {
            mediaViewHolder.c = true;
            Context context = mBMediaView.getContext();
            CampaignEx campaignEx2 = mBMediaView.N;
            com.mbridge.msdk.click.b.a(context, campaignEx2, campaignEx2.getCampaignUnitId(), mBMediaView.N.getNativeVideoTracking().g(), false, false);
        }
    }

    static /* synthetic */ 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().i() != null) {
            mediaViewHolder.e = true;
            Context context = mBMediaView.getContext();
            CampaignEx campaignEx2 = mBMediaView.N;
            com.mbridge.msdk.click.b.a(context, campaignEx2, campaignEx2.getCampaignUnitId(), mBMediaView.N.getNativeVideoTracking().i(), false, false);
        }
    }

    static /* synthetic */ 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().j() != null) {
            mediaViewHolder.f = true;
            Context context = mBMediaView.getContext();
            CampaignEx campaignEx2 = mBMediaView.N;
            com.mbridge.msdk.click.b.a(context, campaignEx2, campaignEx2.getCampaignUnitId(), mBMediaView.N.getNativeVideoTracking().j(), false, false);
        }
    }

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

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