导航菜单

页面标题

页面副标题

小柿子 v1.3.8 - BaseMBMediaView.java 源代码

正在查看: 小柿子 v1.3.8 应用的 BaseMBMediaView.java JAVA 源代码文件

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


package com.mbridge.msdk.nativex.view;

import android.R;
import android.content.Context;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
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.iab.omid.library.mmadbridge.adsession.media.InteractionType;
import com.iab.omid.library.mmadbridge.adsession.media.PlayerState;
import com.iab.omid.library.mmadbridge.adsession.media.Position;
import com.mbridge.msdk.c.h;
import com.mbridge.msdk.c.l;
import com.mbridge.msdk.foundation.db.u;
import com.mbridge.msdk.foundation.download.download.H5DownLoadManager;
import com.mbridge.msdk.foundation.download.download.HTMLResourceManager;
import com.mbridge.msdk.foundation.entity.CampaignEx;
import com.mbridge.msdk.foundation.entity.q;
import com.mbridge.msdk.foundation.tools.ab;
import com.mbridge.msdk.foundation.tools.af;
import com.mbridge.msdk.foundation.tools.aj;
import com.mbridge.msdk.foundation.tools.ak;
import com.mbridge.msdk.foundation.tools.ap;
import com.mbridge.msdk.foundation.tools.at;
import com.mbridge.msdk.foundation.tools.x;
import com.mbridge.msdk.mbnative.controller.NativeController;
import com.mbridge.msdk.mbsignalcommon.windvane.WindVaneWebView;
import com.mbridge.msdk.mbsignalcommon.windvane.i;
import com.mbridge.msdk.nativex.view.MediaViewPlayerView;
import com.mbridge.msdk.nativex.view.mbfullview.BaseView;
import com.mbridge.msdk.nativex.view.mbfullview.MBridgeTopFullView;
import com.mbridge.msdk.out.BaseTrackingListener;
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.C;
import com.mbridge.msdk.playercommon.exoplayer2.text.ttml.TtmlNode;
import com.mbridge.msdk.playercommon.exoplayer2.upstream.DataSchemeDataSource;
import com.mbridge.msdk.video.signal.communication.IRewardCommunication;
import com.mbridge.msdk.videocommon.download.j;
import com.mbridge.msdk.videocommon.view.MyImageView;
import com.mbridge.msdk.widget.MBAdChoice;
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 abstract class BaseMBMediaView extends LinearLayout implements VideoPlayerStatusListener, IRewardCommunication {
    public static final int OPEN_FULLSCREEN_ON_VIDEO_TYPE_1_LANDING_PAGE = 1;
    public static final int OPEN_FULLSCREEN_ON_VIDEO_TYPE_2_NORMAL_FULLSCREEN = 2;
    public static final int OPEN_FULLSCREEN_ON_VIDEO_TYPE_3_NORMAL_FULLSCREEN_ENDCARD = 3;
    public static final int OPEN_FULLSCREEN_ON_VIDEO_TYPE_4_NORMAL_FULLSCREEN_LP = 4;
    public static final int OPEN_FULLSCREEN_ON_VIDEO_TYPE_6_SMALLVIDEO = 6;
    public static final String TAG = "BaseMBMediaView";
    public static final int WHAT_VIEW_FULL_SCREEN = 2;
    public static final int WHAT_VIEW_SMALL_SCREEN = 1;
    private static int p = 2;
    private static int q = 1;
    private RelativeLayout A;
    private WindVaneWebViewForNV B;
    private WindVaneWebViewForNV C;
    private MyImageView D;
    private ProgressBar E;
    private View F;
    private BaseView G;
    private RelativeLayout H;
    private RelativeLayout I;
    private TextView J;
    private ProgressBar K;
    private RelativeLayout L;
    private int M;
    private Handler N;
    private CampaignEx O;
    private int P;
    private int Q;
    private double R;
    private double S;
    private int T;
    private int U;
    private e V;
    private SensorManager W;
    public boolean a;
    private Sensor aa;
    private com.mbridge.msdk.videocommon.download.a ab;
    private a ac;
    private OnMBMediaViewListener ad;
    private OnMBMediaViewListenerPlus ae;
    private int af;
    private boolean ag;
    private boolean ah;
    private RelativeLayout ai;
    private ImageView aj;
    private int ak;
    private boolean al;
    private Context am;
    private boolean an;
    private Runnable ao;
    private boolean b;
    private boolean c;
    private boolean d;
    private boolean e;
    private boolean f;

    private boolean f83g;
    private boolean h;
    private boolean i;
    private volatile boolean j;
    private volatile boolean k;
    private boolean l;
    private boolean m;
    private ArrayList<String> n;
    private ArrayList<String> o;
    private boolean r;
    private boolean s;
    private x.b t;
    private x.a u;
    private y.a v;
    private int w;
    private MediaViewPlayerView x;
    private RelativeLayout y;
    private RelativeLayout z;

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

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

    public enum a {
        BIG_IMAGE,
        VIDEO,
        GIF
    }

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

        public b(BaseMBMediaView baseMBMediaView) {
            this.a = new WeakReference<>(baseMBMediaView);
        }

        @Override
        public final void run() {
            BaseMBMediaView baseMBMediaView = this.a.get();
            if (baseMBMediaView != null) {
                try {
                    if (baseMBMediaView.ac == null || baseMBMediaView.ac != a.BIG_IMAGE) {
                        return;
                    }
                    baseMBMediaView.f();
                    baseMBMediaView.ac = a.VIDEO;
                    baseMBMediaView.changeNoticeURL();
                } catch (Throwable th) {
                    af.b(BaseMBMediaView.TAG, th.getMessage(), th);
                }
            }
        }
    }

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

        @Override
        public final boolean a(String str) {
            try {
                if (!TextUtils.isEmpty(str)) {
                    if (aj.a.b(str)) {
                        aj.a(com.mbridge.msdk.foundation.controller.c.q().c(), str, (NativeListener.NativeTrackingListener) null);
                        return true;
                    }
                    if (URLUtil.isNetworkUrl(str)) {
                        return false;
                    }
                    aj.a(com.mbridge.msdk.foundation.controller.c.q().c(), str, (BaseTrackingListener) null);
                    return true;
                }
            } catch (Exception e) {
                af.b(BaseMBMediaView.TAG, e.getMessage());
            }
            return false;
        }
    }

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

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

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

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

        public f(BaseMBMediaView baseMBMediaView) {
            this.a = new WeakReference<>(baseMBMediaView);
        }

        @Override
        public final void a(String str) {
            BaseMBMediaView baseMBMediaView = this.a.get();
            if (baseMBMediaView != null) {
                baseMBMediaView.N.post(new b(baseMBMediaView));
            }
        }

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

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

        public g(BaseMBMediaView baseMBMediaView) {
            this.a = new WeakReference<>(baseMBMediaView);
        }

        @Override
        public final void onPageFinished(WebView webView, String str) {
            super.onPageFinished(webView, str);
            try {
                BaseMBMediaView baseMBMediaView = this.a.get();
                if (baseMBMediaView == null || baseMBMediaView.ac == null || baseMBMediaView.ac != a.BIG_IMAGE) {
                    return;
                }
                baseMBMediaView.m();
                baseMBMediaView.ac = a.GIF;
                baseMBMediaView.changeNoticeURL();
            } catch (Exception e) {
                af.b(BaseMBMediaView.TAG, e.getMessage());
            }
        }
    }

    public BaseMBMediaView(Context context) {
        super(context);
        this.b = true;
        this.c = true;
        this.d = true;
        this.e = true;
        this.f = true;
        this.f83g = false;
        this.h = true;
        this.i = false;
        this.j = false;
        this.k = false;
        this.l = true;
        this.m = true;
        this.n = new ArrayList<>();
        this.o = new ArrayList<>();
        this.r = false;
        this.s = false;
        this.t = null;
        this.u = null;
        this.v = null;
        this.w = 0;
        this.a = false;
        this.ab = null;
        this.ac = null;
        this.ag = false;
        this.ah = false;
        this.al = false;
        this.an = false;
        this.ao = new Runnable() {
            @Override
            public final void run() {
                try {
                    if (!BaseMBMediaView.this.i) {
                        BaseMBMediaView baseMBMediaView = BaseMBMediaView.this;
                        if (baseMBMediaView.a((View) baseMBMediaView)) {
                            BaseMBMediaView.S(BaseMBMediaView.this);
                        } else {
                            BaseMBMediaView.R(BaseMBMediaView.this);
                        }
                    }
                    BaseMBMediaView.this.N.postDelayed(this, 300L);
                } catch (Exception e5) {
                    af.b(BaseMBMediaView.TAG, e5.getMessage());
                }
            }
        };
        a(context);
    }

    public static void M(BaseMBMediaView baseMBMediaView) {
        CampaignEx.b mediaViewHolder;
        CampaignEx campaignEx = baseMBMediaView.O;
        if (campaignEx == null || (mediaViewHolder = campaignEx.getMediaViewHolder()) == null || mediaViewHolder.f || baseMBMediaView.O.getNativeVideoTracking() == null || baseMBMediaView.O.getNativeVideoTracking().j() == null) {
            return;
        }
        mediaViewHolder.f = true;
        Context context = baseMBMediaView.getContext();
        CampaignEx campaignEx2 = baseMBMediaView.O;
        com.mbridge.msdk.click.b.a(context, campaignEx2, campaignEx2.getCampaignUnitId(), baseMBMediaView.O.getNativeVideoTracking().j(), false, false);
    }

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

    public static void O(BaseMBMediaView baseMBMediaView) {
        CampaignEx.b mediaViewHolder;
        CampaignEx campaignEx = baseMBMediaView.O;
        if (campaignEx == null || (mediaViewHolder = campaignEx.getMediaViewHolder()) == null || mediaViewHolder.f5g || baseMBMediaView.O.getNativeVideoTracking() == null || baseMBMediaView.O.getNativeVideoTracking().m() == null) {
            return;
        }
        mediaViewHolder.f5g = true;
        Context context = baseMBMediaView.getContext();
        CampaignEx campaignEx2 = baseMBMediaView.O;
        com.mbridge.msdk.click.b.a(context, campaignEx2, campaignEx2.getCampaignUnitId(), baseMBMediaView.O.getNativeVideoTracking().m(), false, false);
    }

    public static void P(BaseMBMediaView baseMBMediaView) {
        CampaignEx.b mediaViewHolder;
        CampaignEx campaignEx = baseMBMediaView.O;
        if (campaignEx == null || (mediaViewHolder = campaignEx.getMediaViewHolder()) == null || mediaViewHolder.i || baseMBMediaView.O.getNativeVideoTracking() == null || baseMBMediaView.O.getNativeVideoTracking().n() == null) {
            return;
        }
        mediaViewHolder.i = true;
        Context context = baseMBMediaView.getContext();
        CampaignEx campaignEx2 = baseMBMediaView.O;
        com.mbridge.msdk.click.b.a(context, campaignEx2, campaignEx2.getCampaignUnitId(), baseMBMediaView.O.getNativeVideoTracking().n(), false, false);
    }

    public static void R(BaseMBMediaView baseMBMediaView) {
        try {
            MediaViewPlayerView mediaViewPlayerView = baseMBMediaView.x;
            if (mediaViewPlayerView != null && mediaViewPlayerView.hasPrepare() && baseMBMediaView.x.isPlaying()) {
                try {
                    MediaViewPlayerView mediaViewPlayerView2 = baseMBMediaView.x;
                    if (mediaViewPlayerView2 != null) {
                        mediaViewPlayerView2.pause();
                    }
                } catch (Throwable th) {
                    af.b(TAG, th.getMessage());
                }
            }
        } catch (Throwable th2) {
            af.b(TAG, th2.getMessage());
        }
    }

    public static void S(BaseMBMediaView baseMBMediaView) {
        try {
            MediaViewPlayerView mediaViewPlayerView = baseMBMediaView.x;
            if (mediaViewPlayerView == null || !mediaViewPlayerView.hasPrepare() || baseMBMediaView.x.isPlaying() || baseMBMediaView.x.isComplete() || !baseMBMediaView.x.hasPrepare()) {
                return;
            }
            baseMBMediaView.x.startOrPlayVideo();
        } catch (Throwable th) {
            af.b(TAG, th.getMessage());
        }
    }

    public void h() {
        RelativeLayout relativeLayout;
        int i;
        int i5;
        try {
            if (this.ac == a.GIF) {
                int i6 = this.Q;
                if (i6 != 0 && (i = this.U) != 0 && (i5 = this.T) != 0) {
                    int i7 = (i6 * i) / i5;
                    RelativeLayout relativeLayout2 = this.A;
                    if (relativeLayout2 != null && i7 != 0) {
                        RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) relativeLayout2.getLayoutParams();
                        layoutParams.width = this.Q;
                        layoutParams.height = i7;
                        layoutParams.addRule(13);
                        this.A.setLayoutParams(layoutParams);
                    }
                } else if (i6 != 0 && (relativeLayout = this.A) != null) {
                    RelativeLayout.LayoutParams layoutParams2 = (RelativeLayout.LayoutParams) relativeLayout.getLayoutParams();
                    int i8 = this.Q;
                    layoutParams2.width = i8;
                    layoutParams2.height = (i8 * 627) / 1200;
                    layoutParams2.addRule(13);
                    this.A.setLayoutParams(layoutParams2);
                }
            }
        } catch (Throwable th) {
            af.b(TAG, th.getMessage());
        }
    }

    public void m() {
        try {
            this.y.setVisibility(8);
            this.D.setVisibility(8);
            this.A.setVisibility(0);
            this.B.setVisibility(0);
        } catch (Throwable th) {
            af.b(TAG, th.getMessage());
        }
    }

    private void n() {
        try {
            CampaignEx campaignEx = this.O;
            if (campaignEx == null) {
                return;
            }
            String imageUrl = campaignEx.getImageUrl();
            if (ap.a(imageUrl) || getContext() == null) {
                return;
            }
            com.mbridge.msdk.foundation.same.c.b.a(com.mbridge.msdk.foundation.controller.c.q().c()).a(imageUrl, new com.mbridge.msdk.foundation.same.c.c() {
                @Override
                public final void onFailedLoad(String str, String str2) {
                }

                @Override
                public final void onSuccessLoad(Bitmap bitmap, String str) {
                    if (BaseMBMediaView.this.D == null || BaseMBMediaView.this.ac != a.BIG_IMAGE) {
                        return;
                    }
                    if (bitmap != null) {
                        BaseMBMediaView.this.T = bitmap.getWidth();
                        BaseMBMediaView.this.U = bitmap.getHeight();
                        BaseMBMediaView.this.D.setImageUrl(str);
                        BaseMBMediaView.this.D.setImageBitmap(bitmap);
                    }
                    BaseMBMediaView.this.D.setOnClickListener(new com.mbridge.msdk.widget.a() {
                        @Override
                        public final void a(View view) {
                            if (BaseMBMediaView.this.am == null) {
                                BaseMBMediaView.this.b(view.getContext());
                            } else {
                                BaseMBMediaView baseMBMediaView = BaseMBMediaView.this;
                                baseMBMediaView.b(baseMBMediaView.am);
                            }
                        }
                    });
                }
            });
        } catch (Throwable th) {
            af.b(TAG, th.getMessage());
        }
    }

    private void o() {
        try {
            CampaignEx campaignEx = this.O;
            if (campaignEx == null) {
                return;
            }
            String gifUrl = campaignEx.getGifUrl();
            if (ap.a(gifUrl) || getContext() == null) {
                return;
            }
            this.B.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.B.setInterceptTouch(true);
            this.A.setOnClickListener(new com.mbridge.msdk.widget.a() {
                @Override
                public final void a(View view) {
                    if (BaseMBMediaView.this.am != null) {
                        BaseMBMediaView baseMBMediaView = BaseMBMediaView.this;
                        baseMBMediaView.b(baseMBMediaView.am);
                    } else {
                        BaseMBMediaView.this.b(view.getContext());
                    }
                    af.c(BaseMBMediaView.TAG, "CLICK WEBVIEW LAYOUT ");
                }
            });
        } catch (Throwable th) {
            af.b(TAG, th.getMessage());
        }
    }

    public String p() {
        try {
            CampaignEx campaignEx = this.O;
            if (campaignEx == null || !ap.b(campaignEx.getCampaignUnitId())) {
                return null;
            }
            return this.O.getCampaignUnitId();
        } catch (Exception e5) {
            af.b(TAG, e5.getMessage());
            return null;
        }
    }

    private void q() {
        try {
            if (this.O == null) {
                af.c(TAG, "campaign is null addPlayerView return");
            }
            MediaViewPlayerView mediaViewPlayerView = this.x;
            if (mediaViewPlayerView != null && mediaViewPlayerView.getParent() != null) {
                ((ViewGroup) this.x.getParent()).removeView(this.x);
            }
            l();
            MediaViewPlayerView mediaViewPlayerView2 = new MediaViewPlayerView(getContext());
            this.x = mediaViewPlayerView2;
            mediaViewPlayerView2.showProgressView(this.l);
            this.x.showSoundIndicator(this.m);
            if (this.f83g) {
                this.x.openSound();
            } else {
                this.x.closeSound();
            }
            this.x.setAllowLoopPlay(this.c);
            this.x.initPlayerViewData(s(), this.O, v(), this, this.ab, p());
            this.x.setOnMediaViewPlayerViewListener(new c(this));
            this.y.addView(this.x, -1, -1);
            try {
                MediaViewPlayerView mediaViewPlayerView3 = this.x;
                if (mediaViewPlayerView3 != null) {
                    mediaViewPlayerView3.setOnClickListener(new com.mbridge.msdk.widget.a() {
                        @Override
                        public final void a(View view) {
                            try {
                                if (!BaseMBMediaView.this.i) {
                                    BaseMBMediaView.d(BaseMBMediaView.this);
                                }
                                BaseMBMediaView.this.x.showSoundIndicator(true);
                                BaseMBMediaView.this.x.showProgressView(true);
                                if (BaseMBMediaView.this.e && !BaseMBMediaView.this.i && (BaseMBMediaView.this.F == null || BaseMBMediaView.this.F.getParent() == null)) {
                                    if (!BaseMBMediaView.this.x.halfLoadingViewisVisible() && BaseMBMediaView.this.x.isPlaying()) {
                                        BaseMBMediaView.this.a();
                                        return;
                                    }
                                    af.c(BaseMBMediaView.TAG, "is loading or no playing return;");
                                    return;
                                }
                                if (BaseMBMediaView.this.i) {
                                    af.c(BaseMBMediaView.TAG, "fullScreenShowUI");
                                    BaseMBMediaView.h(BaseMBMediaView.this);
                                    return;
                                }
                                if (BaseMBMediaView.this.am != null) {
                                    BaseMBMediaView baseMBMediaView = BaseMBMediaView.this;
                                    baseMBMediaView.b(baseMBMediaView.am);
                                } else {
                                    BaseMBMediaView.this.b(view.getContext());
                                }
                                if (BaseMBMediaView.this.v != null) {
                                    try {
                                        BaseMBMediaView.this.v.a(InteractionType.CLICK);
                                        af.a("omsdk", "mnv adUserInteraction click");
                                    } catch (Exception e5) {
                                        af.b("omsdk", e5.getMessage());
                                    }
                                }
                            } catch (Throwable th) {
                                af.b(BaseMBMediaView.TAG, th.getMessage(), th);
                            }
                        }
                    });
                }
            } catch (Throwable th) {
                af.b(TAG, th.getMessage());
            }
            x.b bVar = this.t;
            if (bVar != null) {
                MediaViewPlayerView mediaViewPlayerView4 = this.x;
                if (mediaViewPlayerView4 != null) {
                    mediaViewPlayerView4.registerView(bVar);
                }
                this.u = x.a.a(this.t);
                this.v = y.a.g(this.t);
                this.t.g();
                this.u.d(y.b.b(true, Position.STANDALONE));
                MediaViewPlayerView mediaViewPlayerView5 = this.x;
                if (mediaViewPlayerView5 != null) {
                    mediaViewPlayerView5.setVideoEvents(this.v);
                }
                try {
                    x.a aVar = this.u;
                    if (aVar != null) {
                        aVar.b();
                    }
                } catch (Exception e5) {
                    af.a("omsdk", e5.getMessage());
                }
            }
        } catch (Throwable th2) {
            af.b(TAG, th2.getMessage());
        }
    }

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

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

    public void changeNoticeURL() {
        CampaignEx campaignEx = this.O;
        if (campaignEx != null) {
            String noticeUrl = campaignEx.getNoticeUrl();
            if (TextUtils.isEmpty(noticeUrl)) {
                return;
            }
            if (noticeUrl.contains("is_video")) {
                a aVar = this.ac;
                if (aVar == a.VIDEO) {
                    if (noticeUrl.contains("is_video=2")) {
                        noticeUrl = noticeUrl.replace("is_video=2", "is_video=1");
                    }
                } else if (aVar == a.BIG_IMAGE && noticeUrl.contains("is_video=1")) {
                    noticeUrl = noticeUrl.replace("is_video=1", "is_video=2");
                }
            } else {
                a aVar2 = this.ac;
                String str = aVar2 == a.VIDEO ? "1" : aVar2 == 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();
            }
            this.O.setNoticeUrl(noticeUrl);
        }
    }

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

    public void exitFullScreen() {
        try {
            x();
            if (this.c) {
                this.x.onClickPlayButton();
            }
        } catch (Exception e5) {
            af.b(TAG, e5.getMessage());
        }
    }

    public String getAddNVT2ToNoticeURL() {
        CampaignEx campaignEx = this.O;
        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.O.getNvT2();
    }

    @Override
    public void getEndScreenInfo(Object obj, String str) {
        try {
            ArrayList arrayList = new ArrayList();
            arrayList.add(this.O);
            String a5 = a(arrayList, p(), "MAL_16.7.42,3.0.1");
            String encodeToString = !TextUtils.isEmpty(a5) ? Base64.encodeToString(a5.getBytes(), 2) : "";
            af.b(TAG, "getEndScreenInfo-mCampaign.name:" + this.O.getAppName());
            i.a().a(obj, encodeToString);
        } catch (Throwable th) {
            af.b(TAG, th.getMessage());
        }
    }

    public com.mbridge.msdk.nativex.view.mbfullview.BaseView getFullScreenViewByStyle(android.content.Context r3, com.mbridge.msdk.nativex.view.mbfullview.BaseView.a r4) {
        throw new UnsupportedOperationException("Method not decompiled: com.mbridge.msdk.nativex.view.BaseMBMediaView.getFullScreenViewByStyle(android.content.Context, com.mbridge.msdk.nativex.view.mbfullview.BaseView$a):com.mbridge.msdk.nativex.view.mbfullview.BaseView");
    }

    public float getMediaContentAspectRatio() {
        float f5 = com.sigmob.sdk.base.blurkit.c.d;
        try {
            CampaignEx campaignEx = this.O;
            if (campaignEx != null) {
                String videoResolution = !TextUtils.isEmpty(campaignEx.getVideoUrlEncode()) ? this.O.getVideoResolution() : this.O.getImageSize();
                if (!TextUtils.isEmpty(videoResolution)) {
                    if (videoResolution.split("x").length == 2) {
                        f5 = Integer.parseInt(r2[0]) / Integer.parseInt(r2[1]);
                    }
                }
                af.b(TAG, "resource ratio is : " + f5);
            }
        } catch (Throwable th) {
            af.b(TAG, th.getMessage());
        }
        return f5;
    }

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

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

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

    @Override
    public void install(Object obj, String str) {
        WindVaneWebView windVaneWebView;
        try {
            Context context = this.am;
            if (context != null) {
                b(context);
            } else {
                if (!(obj instanceof com.mbridge.msdk.mbsignalcommon.windvane.b) || (windVaneWebView = ((com.mbridge.msdk.mbsignalcommon.windvane.b) obj).b) == null) {
                    return;
                }
                b(windVaneWebView.getContext());
            }
        } catch (Exception e5) {
            af.b(TAG, e5.getMessage());
        }
    }

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

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

    @Override
    public void onAttachedToWindow() {
        super.onAttachedToWindow();
        try {
            if (this.d) {
                try {
                    SensorManager sensorManager = (SensorManager) getContext().getSystemService(am.ac);
                    this.W = sensorManager;
                    this.aa = sensorManager.getDefaultSensor(1);
                    e eVar = new e();
                    this.V = eVar;
                    this.W.registerListener(eVar, this.aa, 2);
                } catch (Throwable th) {
                    af.b(TAG, th.getMessage());
                }
            }
            if (Build.VERSION.SDK_INT >= 11) {
                this.h = isHardwareAccelerated();
            }
            this.ak = getOrientation();
            e();
            this.N.postDelayed(this.ao, 300L);
        } catch (Throwable th2) {
            af.b(TAG, th2.getMessage());
        }
    }

    @Override
    public void onBufferingEnd() {
        af.c("omsdk", "base media end");
        y.a aVar = this.v;
        if (aVar != null) {
            aVar.b();
        }
    }

    @Override
    public void onBufferingStart(String str) {
        af.c("omsdk", "base media start");
        y.a aVar = this.v;
        if (aVar != null) {
            aVar.c();
        }
    }

    @Override
    public void onConfigurationChanged(Configuration configuration) {
        super.onConfigurationChanged(configuration);
        if (this.al) {
            int i = this.ak;
            int i5 = configuration.orientation;
            if (i == i5) {
                return;
            }
            this.ak = i5;
            this.j = i5 == 0;
            this.k = this.ak == 0;
            this.N.postDelayed(new Runnable() {
                @Override
                public final void run() {
                    try {
                        com.mbridge.msdk.nativex.view.mbfullview.a.a(BaseMBMediaView.this.getContext()).a(BaseMBMediaView.this.G, BaseMBMediaView.this.j);
                        if (BaseMBMediaView.this.ak == 0) {
                            BaseMBMediaView.this.E();
                        } else {
                            BaseMBMediaView.this.D();
                        }
                        BaseMBMediaView.this.i();
                        BaseMBMediaView.this.g();
                        BaseMBMediaView.this.h();
                        if (BaseMBMediaView.this.C != null) {
                            BaseMBMediaView.this.C.orientation(BaseMBMediaView.this.j);
                        }
                    } catch (Exception e5) {
                        af.b(BaseMBMediaView.TAG, e5.getMessage());
                    }
                }
            }, 200L);
        }
    }

    @Override
    public void onDetachedFromWindow() {
        e eVar;
        super.onDetachedFromWindow();
        try {
            if (this.t != null) {
                MediaViewPlayerView mediaViewPlayerView = this.x;
                if (mediaViewPlayerView != null) {
                    mediaViewPlayerView.unregisterView();
                }
                this.t.c();
                this.t = null;
            }
            if (this.v != null) {
                this.v = null;
            }
            if (this.u != null) {
                this.u = null;
            }
            this.N.removeCallbacks(this.ao);
            Handler handler = this.N;
            if (handler != null) {
                handler.removeCallbacksAndMessages(null);
            }
            try {
                SensorManager sensorManager = this.W;
                if (sensorManager != null && (eVar = this.V) != null) {
                    sensorManager.unregisterListener(eVar);
                }
            } catch (Throwable th) {
                af.b(TAG, th.getMessage());
            }
            b();
        } catch (Throwable th2) {
            af.b(TAG, th2.getMessage());
        }
    }

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

    @Override
    public void onPlayCompleted() {
        y.a aVar = this.v;
        if (aVar != null) {
            aVar.d();
        }
    }

    @Override
    public void onPlayError(final String str) {
        try {
            af.c("error", str);
            Runnable runnable = new Runnable() {
                @Override
                public final void run() {
                    BaseMBMediaView.q(BaseMBMediaView.this);
                    BaseMBMediaView.a(BaseMBMediaView.this, str);
                    NativeController.insertExcludeId(BaseMBMediaView.this.O.getCampaignUnitId(), BaseMBMediaView.this.O);
                }
            };
            com.mbridge.msdk.foundation.controller.d.a();
            com.mbridge.msdk.foundation.same.f.b.b().execute(runnable);
        } catch (Throwable th) {
            af.b(TAG, th.getMessage());
        }
    }

    @Override
    public void onPlayProgress(int i, int i5) {
        int i6;
        String str;
        CampaignEx.b mediaViewHolder;
        CampaignEx.b mediaViewHolder2;
        Map<Integer, String> map;
        try {
            CampaignEx campaignEx = this.O;
            if (campaignEx != null && (mediaViewHolder2 = campaignEx.getMediaViewHolder()) != null && !mediaViewHolder2.b && (map = mediaViewHolder2.a) != null && map.size() > 0) {
                Map<Integer, String> map2 = mediaViewHolder2.a;
                Iterator<Map.Entry<Integer, String>> it = map2.entrySet().iterator();
                while (it.hasNext()) {
                    Map.Entry<Integer, String> next = it.next();
                    Integer key = next.getKey();
                    String value = next.getValue();
                    if (i >= key.intValue() && !TextUtils.isEmpty(value)) {
                        Context context = getContext();
                        CampaignEx campaignEx2 = this.O;
                        com.mbridge.msdk.click.b.a(context, campaignEx2, campaignEx2.getCampaignUnitId(), value, false, false);
                        it.remove();
                    }
                }
                if (map2.size() <= 0) {
                    mediaViewHolder2.b = true;
                }
            }
        } catch (Exception e5) {
            af.b(TAG, e5.getMessage());
        }
        try {
            CampaignEx campaignEx3 = this.O;
            if (campaignEx3 != null && (mediaViewHolder = campaignEx3.getMediaViewHolder()) != null && !mediaViewHolder.h && i5 != 0) {
                List<Map<Integer, String>> i7 = this.O.getNativeVideoTracking().i();
                int i8 = ((i + 1) * 100) / i5;
                if (i7 != null) {
                    int i9 = 0;
                    while (i9 < i7.size()) {
                        Map<Integer, String> map3 = i7.get(i9);
                        if (map3 != null && map3.size() > 0) {
                            Iterator<Map.Entry<Integer, String>> it2 = map3.entrySet().iterator();
                            while (it2.hasNext()) {
                                Map.Entry<Integer, String> next2 = it2.next();
                                int intValue = next2.getKey().intValue();
                                String value2 = next2.getValue();
                                if (intValue <= i8 && !TextUtils.isEmpty(value2)) {
                                    Context context2 = getContext();
                                    CampaignEx campaignEx4 = this.O;
                                    com.mbridge.msdk.click.b.a(context2, campaignEx4, campaignEx4.getCampaignUnitId(), new String[]{value2}, false, true);
                                    it2.remove();
                                    i7.remove(i9);
                                    i9--;
                                }
                            }
                        }
                        i9++;
                    }
                    if (i7.size() <= 0) {
                        mediaViewHolder.h = true;
                    }
                }
            }
        } catch (Throwable unused) {
            af.b(TAG, "reportPlayPercentageData error");
        }
        y.a aVar = this.v;
        if (aVar != null) {
            int i10 = (i * 100) / i5;
            int i11 = ((i + 1) * 100) / i5;
            if (i10 <= 25 && 25 < i11) {
                aVar.h();
            } else if (i10 <= 50 && 50 < i11) {
                aVar.i();
            } else if (i10 <= 75 && 75 < i11) {
                aVar.o();
            }
        }
        if (t() == 100 || this.an) {
            return;
        }
        int h = u() != null ? u().h() : 0;
        int t = t();
        if (t == 0) {
            return;
        }
        if (h > t) {
            h = t / 2;
        }
        if (h < 0 || i < (i6 = (h * i5) / 100)) {
            return;
        }
        if (this.O.getAdType() == 94 || this.O.getAdType() == 287) {
            str = this.O.getRequestId() + this.O.getId() + this.O.getVideoUrlEncode();
        } else {
            str = this.O.getId() + this.O.getVideoUrlEncode() + this.O.getBidToken();
        }
        com.mbridge.msdk.videocommon.download.a a5 = com.mbridge.msdk.videocommon.download.b.getInstance().a(p(), str);
        if (a5 != null) {
            a5.p();
            this.an = true;
            af.b(TAG, "CDRate is : " + i6 + " and start download !");
        }
    }

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

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

    @Override
    public void onPlayStarted(int i) {
        y.a aVar = this.v;
        if (aVar != null) {
            try {
                aVar.n(i, this.f83g ? 1.0f : com.sigmob.sdk.base.blurkit.c.d);
            } catch (IllegalArgumentException e5) {
                af.a("omsdk", e5.getMessage());
            }
        }
    }

    @Override
    public void onWindowFocusChanged(boolean z) {
        MediaViewPlayerView mediaViewPlayerView;
        super.onWindowFocusChanged(z);
        try {
            this.f = z;
            if (this.ac == a.VIDEO && (mediaViewPlayerView = this.x) != null) {
                mediaViewPlayerView.setIsFrontDesk(z);
            }
            try {
                if (this.i) {
                    MediaViewPlayerView mediaViewPlayerView2 = this.x;
                    if (mediaViewPlayerView2 == null) {
                        af.b(TAG, "fullscreen playerview is null return");
                    } else if (!this.f) {
                        mediaViewPlayerView2.pause();
                    } else if (mediaViewPlayerView2.isPlaying()) {
                        af.c(TAG, "fullscreen windowfocuse true isPlaying do nothing return");
                    } else {
                        MediaViewPlayerView mediaViewPlayerView3 = this.x;
                        if (mediaViewPlayerView3 != null && !mediaViewPlayerView3.isComplete() && !this.x.getIsActiviePause()) {
                            this.x.onClickPlayButton();
                        }
                    }
                }
            } catch (Throwable th) {
                af.b(TAG, th.getMessage());
            }
            requestLayout();
        } catch (Throwable th2) {
            af.b(TAG, th2.getMessage());
        }
    }

    @Override
    public void openURL(Object obj, String str) {
        WindVaneWebView windVaneWebView;
        af.b(TAG, "openURL:" + str);
        if (TextUtils.isEmpty(str)) {
            com.mbridge.msdk.mbsignalcommon.communication.d.a(obj, "params is null");
            return;
        }
        Context c5 = com.mbridge.msdk.foundation.controller.c.q().c();
        if (TextUtils.isEmpty(str)) {
            return;
        }
        if (c5 == null) {
            try {
                if ((obj instanceof com.mbridge.msdk.mbsignalcommon.windvane.b) && (windVaneWebView = ((com.mbridge.msdk.mbsignalcommon.windvane.b) obj).b) != null) {
                    c5 = windVaneWebView.getContext();
                }
            } catch (Exception e5) {
                af.b(TAG, e5.getMessage());
            }
        }
        if (c5 == null) {
            return;
        }
        try {
            JSONObject jSONObject = new JSONObject(str);
            String optString = jSONObject.optString("url");
            int optInt = jSONObject.optInt(com.umeng.analytics.pro.d.y);
            if (optInt == 1) {
                com.mbridge.msdk.click.d.c(c5, optString);
            } else if (optInt == 2) {
                com.mbridge.msdk.click.d.e(c5, optString);
            }
        } catch (JSONException e6) {
            af.b(TAG, e6.getMessage());
        } catch (Throwable th) {
            af.b(TAG, th.getMessage());
        }
    }

    public void setAllowLoopPlay(boolean z) {
        this.c = z;
    }

    public void setAllowScreenChange(boolean z) {
        this.d = z;
    }

    public void setAllowVideoRefresh(boolean z) {
        this.b = z;
    }

    public void setFollowActivityOrientation(boolean z) {
        this.al = z;
    }

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

    public void setIsAllowFullScreen(boolean z) {
        this.e = z;
    }

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

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

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

    public void setProgressVisibility(boolean z) {
        this.l = z;
        MediaViewPlayerView mediaViewPlayerView = this.x;
        if (mediaViewPlayerView != null) {
            mediaViewPlayerView.showProgressView(z);
        }
    }

    public void setSoundIndicatorVisibility(boolean z) {
        this.m = z;
        MediaViewPlayerView mediaViewPlayerView = this.x;
        if (mediaViewPlayerView != null) {
            mediaViewPlayerView.showSoundIndicator(z);
        }
    }

    public void setVideoSoundOnOff(boolean z) {
        this.f83g = z;
        MediaViewPlayerView mediaViewPlayerView = this.x;
        if (mediaViewPlayerView != null) {
            if (z) {
                mediaViewPlayerView.openSound();
            } else {
                mediaViewPlayerView.closeSound();
            }
        }
    }

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

    @Override
    public void toggleCloseBtn(Object obj, String str) {
        try {
            if (!TextUtils.isEmpty(str)) {
                try {
                    new JSONObject(str).optInt("state", 1);
                } catch (Exception e5) {
                    af.b(TAG, e5.getMessage());
                }
            }
            af.b(TAG, "SHOW CLOSE BTN ");
            showEndCardWebViewCloseBtn();
            i.a().a(obj, a(0));
        } catch (Exception e6) {
            af.b(TAG, e6.getMessage());
            i.a().b(obj, a(1));
        }
    }

    @Override
    public void triggerCloseBtn(Object obj, String str) {
        try {
            exitFullScreen();
            i.a().a(obj, a(0));
        } catch (Exception e5) {
            af.b(TAG, e5.getMessage());
            i.a().b(obj, a(1));
        }
    }

    public void updateViewManger(boolean z) {
        com.mbridge.msdk.nativex.view.mbfullview.a a5 = com.mbridge.msdk.nativex.view.mbfullview.a.a(getContext());
        boolean z4 = true;
        int i = 0;
        if (a5 != null) {
            try {
                this.G.getmAnimationPlayer().clearAnimation();
                a5.a(z, !this.x.isComplete(), this.G);
                a5.a(z, this.G, this.af);
            } catch (NullPointerException e5) {
                e5.printStackTrace();
                return;
            }
        }
        BaseView baseView = this.G;
        if (!(baseView instanceof MBridgeTopFullView) || a5 == null) {
            return;
        }
        if (z) {
            z4 = false;
        }
        if (baseView instanceof MBridgeTopFullView) {
            MBridgeTopFullView mBridgeTopFullView = (MBridgeTopFullView) baseView;
            if (!z4) {
                i = 8;
            }
            mBridgeTopFullView.getMBridgeFullViewDisplayIcon().setVisibility(i);
            mBridgeTopFullView.getMBridgeFullViewDisplayTitle().setVisibility(i);
            mBridgeTopFullView.getMBridgeFullViewDisplayDscription().setVisibility(i);
            mBridgeTopFullView.getStarLevelLayoutView().setVisibility(i);
        }
    }

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

        public c(BaseMBMediaView baseMBMediaView) {
            this.a = new WeakReference<>(baseMBMediaView);
        }

        @Override
        public final void a() {
            BaseMBMediaView baseMBMediaView = this.a.get();
            if (baseMBMediaView != null) {
                BaseMBMediaView.M(baseMBMediaView);
            }
        }

        @Override
        public final void b() {
            BaseMBMediaView baseMBMediaView = this.a.get();
            if (baseMBMediaView != null) {
                BaseMBMediaView.N(baseMBMediaView);
            }
        }

        @Override
        public final void c() {
            BaseMBMediaView baseMBMediaView = this.a.get();
            if (baseMBMediaView != null) {
                BaseMBMediaView.O(baseMBMediaView);
            }
        }

        @Override
        public final void d() {
            BaseMBMediaView baseMBMediaView = this.a.get();
            if (baseMBMediaView != null) {
                BaseMBMediaView.P(baseMBMediaView);
            }
        }

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

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

    private void A() {
        String[] split;
        try {
            CampaignEx campaignEx = this.O;
            if (campaignEx == null || ap.a(campaignEx.getVideoResolution()) || (split = this.O.getVideoResolution().split("x")) == null || split.length != 2) {
                return;
            }
            String str = split[0];
            String str2 = split[1];
            double m = ak.m(str);
            double m5 = ak.m(str2);
            if (m <= 0.0d || m5 <= 0.0d) {
                return;
            }
            this.R = m;
            this.S = m5;
        } catch (Throwable th) {
            af.b(TAG, th.getMessage());
        }
    }

    public float B() {
        try {
            float h = ak.h(getContext());
            return this.j ? h + ak.c(getContext()) : h;
        } catch (Throwable th) {
            af.b(TAG, th.getMessage());
            return com.sigmob.sdk.base.blurkit.c.d;
        }
    }

    private float C() {
        try {
            float g6 = ak.g(getContext());
            return !this.j ? g6 + ak.c(getContext()) : g6;
        } catch (Throwable th) {
            af.b(TAG, th.getMessage());
            return com.sigmob.sdk.base.blurkit.c.d;
        }
    }

    public void D() {
        try {
            if (this.I == null && this.aj == null) {
                return;
            }
            RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(ak.a(getContext(), 30.0f), ak.a(getContext(), 30.0f));
            layoutParams.addRule(11);
            layoutParams.addRule(10);
            layoutParams.topMargin = ak.a(getContext(), 8.0f);
            layoutParams.rightMargin = ak.a(getContext(), 8.0f);
            RelativeLayout relativeLayout = this.I;
            if (relativeLayout != null) {
                relativeLayout.setLayoutParams(layoutParams);
            }
            ImageView imageView = this.aj;
            if (imageView != null) {
                imageView.setLayoutParams(layoutParams);
            }
            updateViewManger(false);
        } catch (Throwable th) {
            af.b(TAG, th.getMessage());
        }
    }

    public void E() {
        try {
            if (this.I == null && this.aj == null) {
                return;
            }
            RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(ak.a(getContext(), 30.0f), ak.a(getContext(), 30.0f));
            layoutParams.addRule(11);
            layoutParams.addRule(10);
            if (this.af == 0 && com.mbridge.msdk.foundation.tools.d.a(getContext())) {
                layoutParams.rightMargin = ak.c(getContext()) + ak.a(getContext(), 8.0f);
            } else {
                layoutParams.rightMargin = ak.a(getContext(), 8.0f);
            }
            layoutParams.topMargin = ak.a(getContext(), 8.0f);
            RelativeLayout relativeLayout = this.I;
            if (relativeLayout != null) {
                relativeLayout.setLayoutParams(layoutParams);
            }
            ImageView imageView = this.aj;
            if (imageView != null) {
                imageView.setLayoutParams(layoutParams);
            }
            updateViewManger(true);
        } catch (Throwable th) {
            af.b(TAG, th.getMessage());
        }
    }

    private void F() {
        try {
            CampaignEx campaignEx = this.O;
            if (campaignEx == null || campaignEx.getNativeVideoTracking() == null) {
                return;
            }
            String[] c5 = this.O.getNativeVideoTracking().c();
            int i = this.j ? p : q;
            for (String str : c5) {
                if (!TextUtils.isEmpty(str)) {
                    Context context = getContext();
                    CampaignEx campaignEx2 = this.O;
                    com.mbridge.msdk.click.b.a(context, campaignEx2, campaignEx2.getCampaignUnitId(), str + "&orienation=" + i, false, false);
                }
            }
        } catch (Exception e5) {
            af.b(TAG, e5.getMessage());
        }
    }

    public WindVaneWebViewForNV G() {
        try {
            WindVaneWebViewForNV windVaneWebViewForNV = this.C;
            if (windVaneWebViewForNV != null && this.ah) {
                return windVaneWebViewForNV;
            }
            if (this.ah) {
                return null;
            }
            b(true);
            return null;
        } catch (Exception e5) {
            af.b(TAG, e5.getMessage());
            return null;
        }
    }

    private void d() {
        this.N = new Handler() {
            @Override
            public final void handleMessage(Message message) {
                Object obj;
                if (message != null) {
                    try {
                        int i = message.what;
                        if (i == 1) {
                            BaseMBMediaView.this.r();
                        } else if (i == 3 && (obj = message.obj) != null && (obj instanceof View)) {
                            if (BaseMBMediaView.this.a((View) obj)) {
                                BaseMBMediaView.b(BaseMBMediaView.this);
                            }
                        }
                    } catch (Exception e5) {
                        af.b(BaseMBMediaView.TAG, e5.getMessage());
                    }
                }
            }
        };
    }

    private void e() {
        x.b bVar;
        try {
            this.ac = a(true);
            changeNoticeURL();
            a aVar = this.ac;
            if (aVar == a.BIG_IMAGE) {
                CampaignEx campaignEx = this.O;
                if (campaignEx != null && TextUtils.isEmpty(campaignEx.getVideoUrlEncode()) && (bVar = this.t) != null) {
                    try {
                        bVar.d(this.D);
                        this.u = x.a.a(this.t);
                        this.t.g();
                        x.a aVar2 = this.u;
                        if (aVar2 != null) {
                            aVar2.b();
                        }
                    } catch (Exception e5) {
                        af.a("omsdk", e5.getMessage());
                    }
                }
                k();
                n();
            } else if (aVar == a.VIDEO) {
                f();
            } else if (aVar == a.GIF) {
                o();
                m();
            }
            this.r = true;
        } catch (Throwable th) {
            af.b(TAG, th.getMessage(), th);
        }
    }

    public void f() {
        A();
        l();
    }

    public void g() {
        int i;
        int i5;
        int i6;
        try {
            if (this.ac != a.BIG_IMAGE || (i = this.Q) == 0 || (i5 = this.U) == 0 || (i6 = this.T) == 0) {
                return;
            }
            int i7 = (i * i5) / i6;
            MyImageView myImageView = this.D;
            if (myImageView == null || i7 == 0) {
                return;
            }
            RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) myImageView.getLayoutParams();
            layoutParams.width = this.Q;
            layoutParams.height = i7;
            this.D.setLayoutParams(layoutParams);
        } catch (Throwable th) {
            af.b(TAG, th.getMessage());
        }
    }

    public void i() {
        try {
            if (this.ac != a.VIDEO || this.y == null) {
                return;
            }
            int B = (int) B();
            int g6 = ak.g(getContext());
            if (this.i) {
                RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) this.H.getLayoutParams();
                layoutParams.width = B;
                layoutParams.height = g6;
                layoutParams.addRule(13);
                this.H.setLayoutParams(layoutParams);
            } else {
                RelativeLayout.LayoutParams layoutParams2 = (RelativeLayout.LayoutParams) this.y.getLayoutParams();
                layoutParams2.width = this.Q;
                layoutParams2.height = this.P;
                layoutParams2.addRule(13);
                this.y.setLayoutParams(layoutParams2);
            }
            r();
            if (this.i) {
                a(this.x, B, g6);
            } else {
                a(this.x, this.Q, this.P);
            }
        } catch (Exception e5) {
            af.b(TAG, e5.getMessage());
        }
    }

    private void j() {
        try {
            this.x.showSoundIndicator(this.m);
            this.x.showProgressView(this.l);
            OnMBMediaViewListener onMBMediaViewListener = this.ad;
            if (onMBMediaViewListener != null) {
                onMBMediaViewListener.onExitFullscreen();
            }
            OnMBMediaViewListenerPlus onMBMediaViewListenerPlus = this.ae;
            if (onMBMediaViewListenerPlus != null) {
                onMBMediaViewListenerPlus.onExitFullscreen();
            }
            y.a aVar = this.v;
            if (aVar != null) {
                aVar.k(PlayerState.NORMAL);
            }
        } catch (Exception e5) {
            af.b(TAG, e5.getMessage());
        }
    }

    private void k() {
        try {
            ak.a((ImageView) this.D);
            this.D.setVisibility(0);
            this.y.setVisibility(8);
            this.A.setVisibility(8);
        } catch (Throwable th) {
            af.b(TAG, th.getMessage());
        }
    }

    private void l() {
        try {
            this.y.setVisibility(0);
            this.D.setVisibility(8);
            this.A.setVisibility(8);
        } catch (Throwable th) {
            af.b(TAG, th.getMessage());
        }
    }

    public void r() {
        try {
            if (getVisibility() != 0) {
                return;
            }
            if (a((View) this)) {
                l u = u();
                int i = 0;
                int m = u != null ? u.m() : 0;
                CampaignEx campaignEx = this.O;
                if (campaignEx == null || campaignEx.getImpReportType() != 1) {
                    i = m;
                }
                Message obtainMessage = this.N.obtainMessage();
                obtainMessage.what = 3;
                obtainMessage.obj = this;
                this.N.sendMessageDelayed(obtainMessage, (i == 0 ? 0L : i * 1000) + 300);
            }
            if (this.ac == a.VIDEO) {
                MediaViewPlayerView mediaViewPlayerView = this.x;
                if (mediaViewPlayerView == null) {
                    q();
                    return;
                }
                if (this.O != mediaViewPlayerView.getCampaign()) {
                    this.x.release();
                    q();
                    if (getParent() != null) {
                        ((View) getParent()).invalidate();
                    }
                    requestLayout();
                }
            }
        } catch (Throwable th) {
            af.b(TAG, th.getMessage());
        }
    }

    private String s() {
        try {
        } catch (Exception e5) {
            af.b(TAG, e5.getMessage());
        }
        if (this.O == null) {
            return null;
        }
        com.mbridge.msdk.videocommon.download.a aVar = this.ab;
        if (aVar != null && aVar.k() == 5) {
            String h = this.ab.h();
            if (new File(h).exists() && (this.ab.i() || this.ab.j() == ak.a(new File(h)))) {
                return h;
            }
        }
        String videoUrlEncode = this.O.getVideoUrlEncode();
        if (ap.b(videoUrlEncode)) {
            return videoUrlEncode;
        }
        return null;
    }

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

    private l u() {
        try {
            CampaignEx campaignEx = this.O;
            if (campaignEx != null && !ap.a(campaignEx.getCampaignUnitId())) {
                String campaignUnitId = this.O.getCampaignUnitId();
                String k = com.mbridge.msdk.foundation.controller.c.q().k();
                if (!ap.a(campaignUnitId) && !ap.a(k)) {
                    l d5 = h.a().d(k, campaignUnitId);
                    return d5 != null ? d5 : l.e(campaignUnitId);
                }
                return l.e(campaignUnitId);
            }
            return null;
        } catch (Exception e5) {
            af.b(TAG, e5.getMessage());
            return null;
        }
    }

    private boolean v() {
        l u;
        try {
            u = u();
        } catch (Throwable th) {
            af.b(TAG, th.getMessage());
        }
        if (u == null) {
            return false;
        }
        int w = u.w();
        if (w == 1) {
            return ak.m(getContext());
        }
        if (w == 2) {
            return false;
        }
        return w == 3 ? ak.k(getContext()) : ak.m(getContext());
    }

    public View w() {
        try {
            this.ai = new RelativeLayout(getContext());
            this.ai.setLayoutParams(new RelativeLayout.LayoutParams(-1, -1));
            ImageView imageView = new ImageView(getContext());
            this.aj = imageView;
            imageView.setScaleType(ImageView.ScaleType.FIT_XY);
            RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(ak.a(getContext(), 30.0f), ak.a(getContext(), 30.0f));
            layoutParams.addRule(11);
            layoutParams.addRule(10);
            layoutParams.topMargin = ak.a(getContext(), 8.0f);
            layoutParams.rightMargin = ak.a(getContext(), 8.0f);
            this.aj.setLayoutParams(layoutParams);
            this.aj.setBackgroundResource(x.a(getContext(), "mbridge_nativex_close", "drawable"));
            this.aj.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    BaseMBMediaView.this.exitFullScreen();
                }
            });
            this.C.setLayoutParams(new RelativeLayout.LayoutParams(-1, -1));
            this.ai.addView(this.C);
            this.ai.addView(this.aj);
            return this.ai;
        } catch (Exception e5) {
            af.b(TAG, e5.getMessage());
            return null;
        }
    }

    public void x() {
        try {
            FrameLayout frameLayout = (FrameLayout) getRootView().findViewById(R.id.content);
            FrameLayout frameLayout2 = (FrameLayout) getRootView().findViewById(100);
            RelativeLayout relativeLayout = (RelativeLayout) getRootView().findViewById(101);
            RelativeLayout relativeLayout2 = (RelativeLayout) getRootView().findViewById(103);
            if (relativeLayout2 == null && relativeLayout != null) {
                relativeLayout2 = (RelativeLayout) relativeLayout.findViewById(103);
            }
            RelativeLayout relativeLayout3 = (RelativeLayout) getRootView().findViewById(x.a(getContext(), "mbridge_full_rl_playcontainer", "id"));
            if (relativeLayout3 == null && relativeLayout2 != null) {
                relativeLayout3 = (RelativeLayout) relativeLayout2.findViewById(x.a(getContext(), "mbridge_full_rl_playcontainer", "id"));
            }
            RelativeLayout relativeLayout4 = (RelativeLayout) getRootView().findViewById(x.a(getContext(), "mbridge_full_player_parent", "id"));
            if (relativeLayout4 == null && relativeLayout3 != null) {
                relativeLayout4 = (RelativeLayout) relativeLayout3.findViewById(x.a(getContext(), "mbridge_full_player_parent", "id"));
            }
            ProgressBar progressBar = (ProgressBar) getRootView().findViewById(x.a(getContext(), "mbridge_full_pb_loading", "id"));
            RelativeLayout relativeLayout5 = (RelativeLayout) getRootView().findViewById(x.a(getContext(), "mbridge_full_rl_install", "id"));
            LinearLayout linearLayout = (LinearLayout) getRootView().findViewById(x.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.ai;
            if (relativeLayout6 != null) {
                if (relativeLayout2 != null) {
                    relativeLayout2.removeView(relativeLayout6);
                } else if (relativeLayout6.getParent() != null) {
                    ((ViewGroup) this.ai.getParent()).removeView(this.ai);
                }
                this.C.setBackListener(null);
                this.C.setObject(null);
                this.C = null;
                this.ai = 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.x);
            }
            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.G;
                if (baseView != null) {
                    baseView.removeView(this.H);
                }
            } else {
                ((ViewGroup) relativeLayout3.getParent()).removeView(relativeLayout3);
            }
            if (relativeLayout != null) {
                relativeLayout.removeView(relativeLayout2);
            } else if (relativeLayout2 == null || relativeLayout2.getParent() == null) {
                View view = this.F;
                if (view != null) {
                    ((ViewGroup) view).removeView(this.G);
                    ((ViewGroup) this.F.getParent()).removeView(this.F);
                }
            } else {
                ((ViewGroup) relativeLayout2.getParent()).removeView(relativeLayout2);
            }
            if (frameLayout != null) {
                if (relativeLayout != null) {
                    frameLayout.removeView(relativeLayout);
                } else {
                    frameLayout.removeView(this.F);
                    if (this.F.getParent() != null) {
                        ((ViewGroup) this.F.getParent()).removeView(this.F);
                        this.F.setVisibility(8);
                    }
                }
            }
            setVisibility(0);
            requestLayout();
            if (viewGroup != null) {
                if (this.x.getParent() != null && this.x.getParent() != viewGroup) {
                    ((ViewGroup) this.x.getParent()).removeView(this.x);
                }
                viewGroup.addView(this.x, this.M);
                viewGroup.removeView(frameLayout2);
                viewGroup.invalidate();
            }
            j();
            this.i = false;
            MediaViewPlayerView mediaViewPlayerView = this.x;
            if (mediaViewPlayerView != null) {
                mediaViewPlayerView.setExitFullScreen();
                if (this.f83g) {
                    this.x.openSound();
                } else {
                    this.x.closeSound();
                }
                this.x.gonePauseView();
            }
        } catch (Exception e5) {
            af.b(TAG, e5.getMessage());
        }
    }

    private boolean y() {
        try {
            this.H = this.G.getMBridgeFullPlayContainer();
            this.L = this.G.getMBridgeFullPlayerParent();
            this.I = this.G.getMBridgeFullClose();
            this.J = this.G.getMBridgeFullTvInstall();
            this.K = this.G.getMBridgeFullPb();
            return true;
        } catch (Throwable th) {
            af.b(TAG, th.getMessage());
            return false;
        }
    }

    private void z() {
        try {
            this.j = ak.h(getContext()) >= ak.g(getContext());
            this.k = this.j;
        } catch (Throwable th) {
            af.b(TAG, th.getMessage());
        }
    }

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

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

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

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

    public static void p(BaseMBMediaView baseMBMediaView) {
        try {
            ProgressBar progressBar = baseMBMediaView.K;
            if (progressBar != null) {
                progressBar.setVisibility(8);
            }
        } catch (Exception e5) {
            af.b(TAG, e5.getMessage());
        }
    }

    public final void b(String str) {
        try {
            if (TextUtils.isEmpty(str) || this.o.contains(str)) {
                return;
            }
            this.o.add(str);
            OnMBMediaViewListenerPlus onMBMediaViewListenerPlus = this.ae;
            if (onMBMediaViewListenerPlus != null) {
                onMBMediaViewListenerPlus.onVideoComplete();
            }
        } catch (Exception e5) {
            af.b(TAG, e5.getMessage());
        }
    }

    public static void m(BaseMBMediaView baseMBMediaView) {
        try {
            ProgressBar progressBar = baseMBMediaView.E;
            if (progressBar != null) {
                progressBar.setVisibility(0);
            }
        } catch (Exception e5) {
            af.b(TAG, e5.getMessage());
        }
    }

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

    public static void n(BaseMBMediaView baseMBMediaView) {
        try {
            ProgressBar progressBar = baseMBMediaView.K;
            if (progressBar != null) {
                progressBar.setVisibility(0);
            }
        } catch (Exception e5) {
            af.b(TAG, e5.getMessage());
        }
    }

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

    public static void o(BaseMBMediaView baseMBMediaView) {
        try {
            ProgressBar progressBar = baseMBMediaView.E;
            if (progressBar != null) {
                progressBar.setVisibility(8);
            }
        } catch (Exception e5) {
            af.b(TAG, e5.getMessage());
        }
    }

    public final void a(String str) {
        try {
            if (TextUtils.isEmpty(str) || this.n.contains(str)) {
                return;
            }
            this.n.add(str);
            OnMBMediaViewListener onMBMediaViewListener = this.ad;
            if (onMBMediaViewListener != null) {
                onMBMediaViewListener.onVideoStart();
            }
            OnMBMediaViewListenerPlus onMBMediaViewListenerPlus = this.ae;
            if (onMBMediaViewListenerPlus != null) {
                onMBMediaViewListenerPlus.onVideoStart();
            }
        } catch (Exception e5) {
            af.b(TAG, e5.getMessage());
        }
    }

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

    public static void c(BaseMBMediaView baseMBMediaView, Campaign campaign, String str) {
        try {
            OnMBMediaViewListener onMBMediaViewListener = baseMBMediaView.ad;
            if (onMBMediaViewListener != null) {
                onMBMediaViewListener.onFinishRedirection(campaign, str);
            }
            OnMBMediaViewListenerPlus onMBMediaViewListenerPlus = baseMBMediaView.ae;
            if (onMBMediaViewListenerPlus != null) {
                onMBMediaViewListenerPlus.onFinishRedirection(campaign, str);
            }
        } catch (Exception e5) {
            af.b(TAG, e5.getMessage());
        }
    }

    public static void h(BaseMBMediaView baseMBMediaView) {
        try {
            MediaViewPlayerView mediaViewPlayerView = baseMBMediaView.x;
            if (mediaViewPlayerView == null) {
                return;
            }
            mediaViewPlayerView.onClickPlayerView();
        } catch (Throwable th) {
            af.b(TAG, th.getMessage());
        }
    }

    private a a(boolean z) {
        try {
            CampaignEx campaignEx = this.O;
            if (campaignEx == null) {
                return null;
            }
            if (ap.a(campaignEx.getVideoUrlEncode())) {
                a aVar = ap.b(this.O.getImageUrl()) ? a.BIG_IMAGE : null;
                if (!ap.b(this.O.getGifUrl())) {
                    return aVar;
                }
                if (ap.a(this.O.getImageUrl())) {
                    aVar = a.GIF;
                }
                this.B.setWebViewClient(new g(this));
                o();
                return aVar;
            }
            if (Build.VERSION.SDK_INT >= 14 && this.h && this.ab != null) {
                if (ap.b(this.O.getVideoUrlEncode()) && ap.a(this.O.getImageUrl())) {
                    return a.VIDEO;
                }
                if (!ap.b(this.O.getVideoUrlEncode()) || !ap.b(this.O.getImageUrl())) {
                    return null;
                }
                if (j.a(this.ab, t())) {
                    return a.VIDEO;
                }
                a aVar2 = a.BIG_IMAGE;
                if (!z || !this.b) {
                    return aVar2;
                }
                this.ab.b(new f(this));
                return aVar2;
            }
            return a.BIG_IMAGE;
        } catch (Throwable th) {
            af.b(TAG, th.getMessage());
            return a.BIG_IMAGE;
        }
    }

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

                    @Override
                    public final void a(WebView webView, int i, String str, String str2) {
                        super.a(webView, i, str, str2);
                        BaseMBMediaView.this.ag = false;
                    }
                });
            }
            if (nvT2 != 3) {
                if (nvT2 == 4) {
                    this.ah = true;
                    CampaignEx campaignEx = this.O;
                    if (campaignEx != null) {
                        com.mbridge.msdk.foundation.same.g.a aVar = new com.mbridge.msdk.foundation.same.g.a(campaignEx);
                        aVar.a(this.O.getAppName());
                        this.C.setDownloadListener(aVar);
                        this.C.setFilter(new d());
                        return;
                    }
                    return;
                }
                return;
            }
            String str = this.O.getendcard_url();
            if (TextUtils.isEmpty(str)) {
                return;
            }
            this.O.getMediaViewHolder();
            if (str.contains(".zip") && str.contains("md5filename")) {
                String h5ResAddress = H5DownLoadManager.getInstance().getH5ResAddress(str);
                if (ap.b(h5ResAddress)) {
                    this.ah = true;
                    this.C.loadUrl(h5ResAddress);
                    return;
                }
                return;
            }
            String htmlContentFromUrl = HTMLResourceManager.getInstance().getHtmlContentFromUrl(str);
            if (ap.b(htmlContentFromUrl)) {
                af.a(TAG, "load html...");
                this.ah = true;
                this.C.loadDataWithBaseURL(str, htmlContentFromUrl, "text/html", C.UTF8_NAME, null);
            }
        } catch (Exception e5) {
            af.b(TAG, e5.getMessage());
        }
    }

    public BaseMBMediaView(Context context, AttributeSet attributeSet) {
        super(context, attributeSet);
        this.b = true;
        this.c = true;
        this.d = true;
        this.e = true;
        this.f = true;
        this.f83g = false;
        this.h = true;
        this.i = false;
        this.j = false;
        this.k = false;
        this.l = true;
        this.m = true;
        this.n = new ArrayList<>();
        this.o = new ArrayList<>();
        this.r = false;
        this.s = false;
        this.t = null;
        this.u = null;
        this.v = null;
        this.w = 0;
        this.a = false;
        this.ab = null;
        this.ac = null;
        this.ag = false;
        this.ah = false;
        this.al = false;
        this.an = false;
        this.ao = new Runnable() {
            @Override
            public final void run() {
                try {
                    if (!BaseMBMediaView.this.i) {
                        BaseMBMediaView baseMBMediaView = BaseMBMediaView.this;
                        if (baseMBMediaView.a((View) baseMBMediaView)) {
                            BaseMBMediaView.S(BaseMBMediaView.this);
                        } else {
                            BaseMBMediaView.R(BaseMBMediaView.this);
                        }
                    }
                    BaseMBMediaView.this.N.postDelayed(this, 300L);
                } catch (Exception e5) {
                    af.b(BaseMBMediaView.TAG, e5.getMessage());
                }
            }
        };
        a(context);
    }

    public static void q(BaseMBMediaView baseMBMediaView) {
        CampaignEx campaignEx = baseMBMediaView.O;
        if (campaignEx == null || campaignEx.getMediaViewHolder() == null || baseMBMediaView.O.getMediaViewHolder().d || TextUtils.isEmpty(baseMBMediaView.O.getCampaignUnitId()) || baseMBMediaView.O.getNativeVideoTracking() == null || baseMBMediaView.O.getNativeVideoTracking().o() == null) {
            return;
        }
        baseMBMediaView.O.getMediaViewHolder().d = true;
        Context context = baseMBMediaView.getContext();
        CampaignEx campaignEx2 = baseMBMediaView.O;
        com.mbridge.msdk.click.b.a(context, campaignEx2, campaignEx2.getCampaignUnitId(), baseMBMediaView.O.getNativeVideoTracking().o(), false, false);
    }

    public boolean a(View view) {
        try {
            return !at.a(view, this.O == null ? 0 : r1.getImpReportType());
        } catch (Throwable th) {
            af.b(TAG, th.getMessage());
            return false;
        }
    }

    public final void a() {
        BitmapDrawable a5;
        CampaignEx campaignEx;
        try {
            if (getRootView() != null && (getRootView() instanceof ViewGroup)) {
                BaseView.a handleViewStyleResult = handleViewStyleResult(getContext());
                if (handleViewStyleResult == null) {
                    return;
                }
                BaseView fullScreenViewByStyle = getFullScreenViewByStyle(getContext(), handleViewStyleResult);
                this.G = fullScreenViewByStyle;
                if (fullScreenViewByStyle != null && y()) {
                    com.mbridge.msdk.nativex.view.mbfullview.a a6 = com.mbridge.msdk.nativex.view.mbfullview.a.a(getContext());
                    BaseView baseView = this.G;
                    a6.a(baseView.style, this.O, baseView);
                    this.i = true;
                    this.s = false;
                    MediaViewPlayerView mediaViewPlayerView = this.x;
                    if (mediaViewPlayerView != null) {
                        mediaViewPlayerView.setEnterFullScreen();
                        this.x.setIsActivePause(false);
                    }
                    try {
                        OnMBMediaViewListener onMBMediaViewListener = this.ad;
                        if (onMBMediaViewListener != null) {
                            onMBMediaViewListener.onEnterFullscreen();
                        }
                        OnMBMediaViewListenerPlus onMBMediaViewListenerPlus = this.ae;
                        if (onMBMediaViewListenerPlus != null) {
                            onMBMediaViewListenerPlus.onEnterFullscreen();
                        }
                        y.a aVar = this.v;
                        if (aVar != null) {
                            aVar.k(PlayerState.FULLSCREEN);
                        }
                    } catch (Exception e5) {
                        af.b(TAG, e5.getMessage());
                    }
                    FrameLayout frameLayout = (FrameLayout) getRootView().findViewById(R.id.content);
                    RelativeLayout relativeLayout = new RelativeLayout(getContext());
                    this.F = relativeLayout;
                    relativeLayout.setClickable(true);
                    ViewGroup viewGroup = (ViewGroup) this.x.getParent();
                    int childCount = viewGroup.getChildCount();
                    int i = 0;
                    while (i < childCount && viewGroup.getChildAt(i) != this.x) {
                        i++;
                    }
                    this.M = i;
                    FrameLayout frameLayout2 = new FrameLayout(getContext());
                    frameLayout2.setId(100);
                    viewGroup.addView(frameLayout2, i, new ViewGroup.LayoutParams(getWidth(), getHeight()));
                    viewGroup.removeView(this.x);
                    ViewGroup.LayoutParams layoutParams = new FrameLayout.LayoutParams(-1, -1);
                    relativeLayout.setId(101);
                    new RelativeLayout.LayoutParams(-1, -1);
                    this.L.addView(this.x, new RelativeLayout.LayoutParams(-1, -1));
                    if (this.L != null && (campaignEx = this.O) != null && campaignEx.getPrivacyButtonTemplateVisibility() != 0) {
                        try {
                            MBAdChoice mBAdChoice = new MBAdChoice(com.mbridge.msdk.foundation.controller.c.q().c());
                            mBAdChoice.setCampaign(this.O);
                            RelativeLayout.LayoutParams layoutParams2 = new RelativeLayout.LayoutParams(ak.a(com.mbridge.msdk.foundation.controller.c.q().c(), 12.0f), ak.a(com.mbridge.msdk.foundation.controller.c.q().c(), 12.0f));
                            layoutParams2.addRule(11);
                            layoutParams2.addRule(12);
                            this.L.addView(mBAdChoice, layoutParams2);
                        } catch (Exception e6) {
                            e6.printStackTrace();
                        }
                    }
                    if (this.a && frameLayout != null && (a5 = com.mbridge.msdk.foundation.controller.c.q().a(p(), this.O.getAdType())) != null) {
                        ImageView imageView = new ImageView(com.mbridge.msdk.foundation.controller.c.q().c());
                        ak.a(imageView, a5, getResources().getDisplayMetrics());
                        this.G.addView(imageView, new RelativeLayout.LayoutParams(-1, -1));
                    }
                    frameLayout.addView(relativeLayout, layoutParams);
                    int i5 = com.sigmob.sdk.base.blurkit.d.a;
                    if (AnonymousClass10.a[this.G.style.ordinal()] == 2) {
                        i5 = -1;
                    }
                    int i6 = this.w;
                    if (i6 != 0) {
                        relativeLayout.setBackgroundColor(i6);
                    } else {
                        relativeLayout.setBackgroundColor(i5);
                    }
                    this.G.setId(103);
                    RelativeLayout.LayoutParams layoutParams3 = new RelativeLayout.LayoutParams(-1, -1);
                    int[] iArr = new int[2];
                    frameLayout.getLocationInWindow(iArr);
                    int i7 = iArr[1];
                    this.af = i7;
                    if (i7 == 0) {
                        if (Build.VERSION.SDK_INT >= 23) {
                            WindowInsets rootWindowInsets = getRootWindowInsets();
                            if (rootWindowInsets != null) {
                                layoutParams3.setMargins(0, rootWindowInsets.getStableInsetTop(), 0, 0);
                            }
                        } else {
                            layoutParams3.setMargins(0, ak.j(getContext()), 0, 0);
                        }
                    }
                    relativeLayout.addView(this.G, layoutParams3);
                    try {
                        z();
                        a(this.H, B(), C());
                        com.mbridge.msdk.nativex.view.mbfullview.a.a(getContext()).a(this.G, this.j);
                        if (this.j) {
                            E();
                        } else {
                            D();
                        }
                        this.N.postDelayed(new Runnable() {
                            @Override
                            public final void run() {
                                BaseMBMediaView.this.s = true;
                                if (BaseMBMediaView.this.i) {
                                    TextView unused = BaseMBMediaView.this.J;
                                }
                            }
                        }, 3000L);
                    } catch (Throwable th) {
                        af.b(TAG, th.getMessage());
                    }
                    try {
                        this.F.setFocusableInTouchMode(true);
                        this.F.requestFocus();
                        this.F.setOnKeyListener(new View.OnKeyListener() {
                            @Override
                            public final boolean onKey(View view, int i8, KeyEvent keyEvent) {
                                try {
                                    if (keyEvent.getKeyCode() != 4) {
                                        return false;
                                    }
                                    BaseMBMediaView.this.x();
                                    return true;
                                } catch (Throwable th2) {
                                    af.b(BaseMBMediaView.TAG, th2.getMessage());
                                    return false;
                                }
                            }
                        });
                        this.F.setOnClickListener(new View.OnClickListener() {
                            @Override
                            public final void onClick(View view) {
                                BaseMBMediaView.h(BaseMBMediaView.this);
                            }
                        });
                        this.I.setOnClickListener(new View.OnClickListener() {
                            @Override
                            public final void onClick(View view) {
                                BaseMBMediaView.this.x();
                            }
                        });
                        this.J.setOnClickListener(new com.mbridge.msdk.widget.a() {
                            @Override
                            public final void a(View view) {
                                try {
                                    BaseMBMediaView.this.b(view.getContext());
                                    if (BaseMBMediaView.this.v != null) {
                                        try {
                                            BaseMBMediaView.this.v.a(InteractionType.CLICK);
                                            af.a("omsdk", "bmnv adUserInteraction click");
                                        } catch (Exception e7) {
                                            af.b("omsdk", e7.getMessage());
                                        }
                                    }
                                } catch (Exception e8) {
                                    af.b(BaseMBMediaView.TAG, e8.getMessage());
                                }
                            }
                        });
                    } catch (Exception e7) {
                        af.b(TAG, e7.getMessage());
                    }
                    MediaViewPlayerView mediaViewPlayerView2 = this.x;
                    if (mediaViewPlayerView2 != null) {
                        mediaViewPlayerView2.openSound();
                        MediaViewPlayerView mediaViewPlayerView3 = this.x;
                        mediaViewPlayerView3.setMediaViewPlayListener(new MediaViewPlayerView.a(mediaViewPlayerView3) {
                            @Override
                            public final void a() {
                                int nvT2 = BaseMBMediaView.this.O.getNvT2();
                                if (!BaseMBMediaView.this.i || (nvT2 != 3 && nvT2 != 4)) {
                                    super.a();
                                    return;
                                }
                                WindVaneWebViewForNV G = BaseMBMediaView.this.G();
                                if (G == null) {
                                    super.a();
                                    return;
                                }
                                View w = BaseMBMediaView.this.w();
                                if (w == null) {
                                    super.a();
                                    return;
                                }
                                if (nvT2 == 3 && BaseMBMediaView.this.ag) {
                                    com.mbridge.msdk.nativex.view.mbfullview.a.a(BaseMBMediaView.this.getContext()).a(w, BaseMBMediaView.this.G);
                                    Context context = BaseMBMediaView.this.getContext();
                                    CampaignEx campaignEx2 = BaseMBMediaView.this.O;
                                    String campaignUnitId = BaseMBMediaView.this.O.getCampaignUnitId();
                                    if (campaignEx2 != null) {
                                        try {
                                            if (campaignEx2.getNativeVideoTracking() != null && campaignEx2.getNativeVideoTracking().r() != null) {
                                                for (String str : campaignEx2.getNativeVideoTracking().r()) {
                                                    if (!TextUtils.isEmpty(str)) {
                                                        com.mbridge.msdk.click.b.a(context, campaignEx2, campaignUnitId, str, false, true);
                                                    }
                                                }
                                            }
                                        } catch (Exception e8) {
                                            e8.printStackTrace();
                                        }
                                    }
                                } else {
                                    if (nvT2 != 4) {
                                        super.a();
                                        return;
                                    }
                                    com.mbridge.msdk.nativex.view.mbfullview.a.a(BaseMBMediaView.this.getContext()).a(w, BaseMBMediaView.this.G);
                                    String clickURL = BaseMBMediaView.this.O.getClickURL();
                                    if (!TextUtils.isEmpty(clickURL)) {
                                        com.mbridge.msdk.click.b.a(BaseMBMediaView.this.getContext(), BaseMBMediaView.this.O, BaseMBMediaView.this.p(), BaseMBMediaView.this.getAddNVT2ToNoticeURL(), true, false, com.mbridge.msdk.click.a.a.i);
                                        BaseMBMediaView.this.C.loadUrl(clickURL);
                                    }
                                }
                                G.webViewShow(BaseMBMediaView.this.O, BaseMBMediaView.this.p());
                                G.orientation(BaseMBMediaView.this.j);
                            }
                        });
                    }
                    b(false);
                    CampaignEx campaignEx2 = this.O;
                    if (campaignEx2 == null || campaignEx2.getMediaViewHolder() == null || this.O.getMediaViewHolder().e || TextUtils.isEmpty(this.O.getCampaignUnitId()) || this.O.getNativeVideoTracking() == null || this.O.getNativeVideoTracking().c() == null) {
                        return;
                    }
                    this.O.getMediaViewHolder().e = true;
                    F();
                    return;
                }
                return;
            }
            af.c(TAG, "rootView is null");
        } catch (Exception e8) {
            af.b(TAG, e8.getMessage());
        }
    }

    public void b(Context context) {
        try {
            try {
                OnMBMediaViewListener onMBMediaViewListener = this.ad;
                if (onMBMediaViewListener != null) {
                    onMBMediaViewListener.onVideoAdClicked(this.O);
                }
                OnMBMediaViewListenerPlus onMBMediaViewListenerPlus = this.ae;
                if (onMBMediaViewListenerPlus != null) {
                    onMBMediaViewListenerPlus.onVideoAdClicked(this.O);
                }
            } catch (Exception e5) {
                af.b(TAG, e5.getMessage());
            }
            if (this.O != null && !ap.a(p())) {
                if (!this.O.isReportClick()) {
                    this.O.setReportClick(true);
                    CampaignEx campaignEx = this.O;
                    if (campaignEx != null && campaignEx.getNativeVideoTracking() != null && this.O.getNativeVideoTracking().l() != null) {
                        Context context2 = getContext();
                        CampaignEx campaignEx2 = this.O;
                        com.mbridge.msdk.click.b.a(context2, campaignEx2, campaignEx2.getCampaignUnitId(), this.O.getNativeVideoTracking().l(), false, false);
                    }
                }
                com.mbridge.msdk.click.b bVar = new com.mbridge.msdk.click.b(getContext(), p());
                bVar.a(new NativeListener.NativeTrackingListener() {
                    @Override
                    public final void onDismissLoading(Campaign campaign) {
                    }

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

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

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

                    @Override
                    public final void onFinishRedirection(Campaign campaign, String str) {
                        try {
                            BaseMBMediaView.o(BaseMBMediaView.this);
                            BaseMBMediaView.p(BaseMBMediaView.this);
                            BaseMBMediaView.c(BaseMBMediaView.this, campaign, str);
                        } catch (Exception e6) {
                            af.b(BaseMBMediaView.TAG, e6.getMessage());
                        }
                    }

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

                    @Override
                    public final void onRedirectionFailed(Campaign campaign, String str) {
                        try {
                            BaseMBMediaView.o(BaseMBMediaView.this);
                            BaseMBMediaView.p(BaseMBMediaView.this);
                            BaseMBMediaView.b(BaseMBMediaView.this, campaign, str);
                        } catch (Exception e6) {
                            af.b(BaseMBMediaView.TAG, e6.getMessage());
                        }
                    }

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

                    @Override
                    public final void onStartRedirection(Campaign campaign, String str) {
                        try {
                            BaseMBMediaView.m(BaseMBMediaView.this);
                            BaseMBMediaView.n(BaseMBMediaView.this);
                            BaseMBMediaView.a(BaseMBMediaView.this, campaign, str);
                        } catch (Exception e6) {
                            af.b(BaseMBMediaView.TAG, e6.getMessage());
                        }
                    }
                });
                bVar.a(this.O);
            }
        } catch (Exception e6) {
            af.b(TAG, e6.getMessage());
        }
    }

    public static void b(BaseMBMediaView baseMBMediaView) {
        CampaignEx campaignEx = baseMBMediaView.O;
        if (campaignEx == null || campaignEx.getMediaViewHolder() == null) {
            return;
        }
        com.mbridge.msdk.foundation.controller.c.q().a(baseMBMediaView.getContext());
        com.mbridge.msdk.mbnative.e.b.a(baseMBMediaView.O, baseMBMediaView.getContext(), baseMBMediaView.p(), null);
        CampaignEx.b mediaViewHolder = baseMBMediaView.O.getMediaViewHolder();
        if (!mediaViewHolder.l && baseMBMediaView.ac == a.VIDEO && ap.b(baseMBMediaView.O.getImpressionURL())) {
            mediaViewHolder.l = true;
            String impressionURL = baseMBMediaView.O.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();
            }
            Context context = baseMBMediaView.getContext();
            CampaignEx campaignEx2 = baseMBMediaView.O;
            com.mbridge.msdk.click.b.a(context, campaignEx2, campaignEx2.getCampaignUnitId(), impressionURL, false, true, com.mbridge.msdk.click.a.a.g);
        }
    }

    public static void b(BaseMBMediaView baseMBMediaView, Campaign campaign, String str) {
        try {
            OnMBMediaViewListener onMBMediaViewListener = baseMBMediaView.ad;
            if (onMBMediaViewListener != null) {
                onMBMediaViewListener.onRedirectionFailed(campaign, str);
            }
            OnMBMediaViewListenerPlus onMBMediaViewListenerPlus = baseMBMediaView.ae;
            if (onMBMediaViewListenerPlus != null) {
                onMBMediaViewListenerPlus.onRedirectionFailed(campaign, str);
            }
        } catch (Exception e5) {
            af.b(TAG, e5.getMessage());
        }
    }

    private void a(View view, float f5, float f6) {
        if (view == null) {
            return;
        }
        try {
            double d5 = this.R;
            double d6 = 0.0d;
            if (d5 > 0.0d) {
                double d7 = this.S;
                if (d7 > 0.0d) {
                    double d8 = d5 / d7;
                    if (f5 > com.sigmob.sdk.base.blurkit.c.d && f6 > com.sigmob.sdk.base.blurkit.c.d) {
                        d6 = f5 / f6;
                    }
                    double a5 = ak.a(Double.valueOf(d8));
                    double a6 = ak.a(Double.valueOf(d6));
                    RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) this.y.getLayoutParams();
                    RelativeLayout.LayoutParams layoutParams2 = (RelativeLayout.LayoutParams) view.getLayoutParams();
                    boolean z = c(getContext()) && this.j;
                    int i = -1;
                    if (a5 > a6) {
                        double d9 = (f5 * this.S) / this.R;
                        layoutParams2.width = -1;
                        if (!z) {
                            i = (int) d9;
                        }
                        layoutParams2.height = i;
                        layoutParams2.addRule(13);
                        layoutParams.width = this.Q;
                        layoutParams.height = (int) d9;
                        layoutParams.addRule(13);
                    } else if (a5 < a6) {
                        double d10 = f6 * d8;
                        layoutParams2.width = z ? -1 : (int) d10;
                        layoutParams2.height = -1;
                        layoutParams2.addRule(13);
                        layoutParams.width = (int) d10;
                        layoutParams.height = this.P;
                        layoutParams.addRule(13);
                    } else {
                        layoutParams2.width = -1;
                        layoutParams2.height = -1;
                        layoutParams.width = this.Q;
                        layoutParams.height = this.P;
                        layoutParams.addRule(13);
                    }
                    if (!this.i) {
                        this.y.setLayoutParams(layoutParams);
                    }
                    view.setLayoutParams(layoutParams2);
                    return;
                }
            }
            b(view);
        } catch (Throwable th) {
            af.b(TAG, th.getMessage());
        }
    }

    private String a(int i) {
        try {
            JSONObject jSONObject = new JSONObject();
            jSONObject.put("code", i);
            String jSONObject2 = jSONObject.toString();
            return !TextUtils.isEmpty(jSONObject2) ? Base64.encodeToString(jSONObject2.getBytes(), 2) : "";
        } catch (Throwable unused) {
            af.b(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("unit_id", str);
            jSONObject.put("sdk_info", str2);
            return jSONObject.toString();
        } catch (Exception e5) {
            af.b(TAG, e5.getMessage());
            return null;
        }
    }

    public static void a(BaseMBMediaView baseMBMediaView, Campaign campaign, String str) {
        try {
            OnMBMediaViewListener onMBMediaViewListener = baseMBMediaView.ad;
            if (onMBMediaViewListener != null) {
                onMBMediaViewListener.onStartRedirection(campaign, str);
            }
            OnMBMediaViewListenerPlus onMBMediaViewListenerPlus = baseMBMediaView.ae;
            if (onMBMediaViewListenerPlus != null) {
                onMBMediaViewListenerPlus.onStartRedirection(campaign, str);
            }
        } catch (Exception e5) {
            af.b(TAG, e5.getMessage());
        }
    }

    public static void a(BaseMBMediaView baseMBMediaView, String str) {
        try {
            u a5 = u.a(com.mbridge.msdk.foundation.db.j.a(baseMBMediaView.getContext()));
            q qVar = null;
            if (!TextUtils.isEmpty(baseMBMediaView.O.getNoticeUrl())) {
                int w = ab.w(baseMBMediaView.getContext());
                qVar = new q("2000021", w, baseMBMediaView.O.getNoticeUrl(), str, ab.a(baseMBMediaView.getContext(), w));
            } else if (!TextUtils.isEmpty(baseMBMediaView.O.getClickURL())) {
                int w4 = ab.w(baseMBMediaView.getContext());
                qVar = new q("2000021", w4, baseMBMediaView.O.getClickURL(), str, ab.a(baseMBMediaView.getContext(), w4));
            }
            if (qVar != null) {
                qVar.e(baseMBMediaView.O.getId());
                qVar.m(baseMBMediaView.O.getVideoUrlEncode());
                qVar.h(str);
                qVar.f(baseMBMediaView.O.getRequestId());
                qVar.g(baseMBMediaView.O.getRequestIdNotice());
                qVar.c(baseMBMediaView.p());
                a5.a(qVar);
            }
        } catch (Exception e5) {
            af.b(TAG, e5.getMessage());
        }
    }
}