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


package com.sigmob.sdk.videoAd;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.media.MediaPlayer;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.text.TextUtils;
import android.util.Base64;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.view.animation.LinearInterpolator;
import android.view.animation.RotateAnimation;
import android.webkit.DownloadListener;
import android.webkit.JavascriptInterface;
import android.webkit.WebResourceError;
import android.webkit.WebResourceRequest;
import android.webkit.WebView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import androidx.core.app.NotificationCompat;
import com.czhj.sdk.common.ClientMetadata;
import com.czhj.sdk.common.Constants;
import com.czhj.sdk.common.utils.Dips;
import com.czhj.sdk.common.utils.Preconditions;
import com.czhj.sdk.logger.SigmobLog;
import com.czhj.volley.toolbox.ImageLoader;
import com.google.android.material.timepicker.TimeModel;
import com.sigmob.sdk.base.common.d;
import com.sigmob.sdk.base.common.h;
import com.sigmob.sdk.base.common.j;
import com.sigmob.sdk.base.common.k;
import com.sigmob.sdk.base.common.p;
import com.sigmob.sdk.base.common.u;
import com.sigmob.sdk.base.common.v;
import com.sigmob.sdk.base.common.x;
import com.sigmob.sdk.base.e;
import com.sigmob.sdk.base.models.BaseAdUnit;
import com.sigmob.sdk.base.models.ClickCommon;
import com.sigmob.sdk.base.models.IntentActions;
import com.sigmob.sdk.base.models.SigMacroCommon;
import com.sigmob.sdk.base.models.rtb.ClickAreaSetting;
import com.sigmob.sdk.base.models.rtb.CompanionEndcard;
import com.sigmob.sdk.base.models.rtb.MaterialMeta;
import com.sigmob.sdk.base.mta.PointCategory;
import com.sigmob.sdk.base.mta.PointEntitySigmob;
import com.sigmob.sdk.base.network.b;
import com.sigmob.sdk.base.views.c;
import com.sigmob.sdk.base.views.i;
import com.sigmob.sdk.base.views.k;
import com.sigmob.sdk.base.views.m;
import com.sigmob.sdk.base.views.n;
import com.sigmob.sdk.base.views.p;
import com.sigmob.sdk.base.views.s;
import com.sigmob.sdk.base.views.w;
import com.sigmob.sdk.base.views.x;
import com.sigmob.sdk.videoAd.h;
import com.ss.android.download.api.constant.BaseConstants;
import com.tencent.smtt.sdk.TbsListener;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

public class l extends c implements d.a, v {
    static final String e = "video_config";
    private static final String g = "current_position";
    private static final String h = "video_finished";
    private static final String i = "companionAd_visable";
    private static final long j = 50;
    private static final int k = -1;
    private static final int l = 0;
    private static int m;
    private Handler A = new Handler();
    private boolean B = true;
    private c C;
    private String D;
    private int E;
    private boolean F;
    private a G;
    private int H;
    private b I;
    private BaseAdUnit J;

    /* renamed from: K  reason: collision with root package name */
    private View f136K;
    private p L;
    private x M;
    private w N;
    private com.sigmob.sdk.base.views.v O;
    private h P;
    private d Q;
    private int R = 0;
    private int S;
    private boolean T;
    private boolean U;
    private int V;
    private boolean W = false;
    private RelativeLayout X;
    private boolean Y = false;
    private w Z;
    private boolean aa = false;
    private boolean ab = false;
    private ImageLoader.ImageContainer ac;
    private i ad;
    private boolean ae = false;
    private boolean af;
    private boolean ag;
    private int ah;
    private s ai;
    private boolean aj = false;
    private com.sigmob.sdk.base.views.p ak;
    private boolean al = false;
    private boolean am;
    String f;
    private com.sigmob.sdk.base.views.a n;
    private u o;
    private ImageView p;
    private RelativeLayout q;
    private int r = 0;
    private boolean s = false;
    private int t = 0;
    private String u = "undone";
    private List<String> v = new ArrayList();
    private List<String> w = new ArrayList();
    private long x;
    private String y = "none";
    private boolean z;

    /* renamed from: com.sigmob.sdk.videoAd.l$13  reason: invalid class name */
    static /* synthetic */ class AnonymousClass13 {
        static final /* synthetic */ int[] a;

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

    /* access modifiers changed from: package-private */
    public static class a {
        a() {
        }

        @JavascriptInterface
        public int getInteractionType() {
            return l.m;
        }

        @JavascriptInterface
        public String getSdkVersion() {
            return "4.3.0";
        }
    }

    public l(Activity activity, BaseAdUnit baseAdUnit, Bundle bundle, Bundle bundle2, String str, h hVar) throws IllegalStateException {
        super(activity, str, hVar);
        this.J = baseAdUnit;
        a aVar = (a) baseAdUnit.getAdConfig();
        this.G = aVar;
        aVar.a(k(), this.J, (p.b) null);
        this.G.a(this);
        this.D = this.J.getAdslot_id();
        m = this.J.getMaterial().interaction_type.intValue();
        int intValue = this.J.getAd().display_orientation.intValue();
        this.H = intValue != 1 ? intValue != 2 ? bundle.getInt(com.sigmob.sdk.base.h.v, 3) : 6 : 7;
        h().a(this.H);
        k().requestWindowFeature(1);
        k().getWindow().addFlags(1024);
        b(bundle);
        this.J.getMacroCommon().addMarcoKey(SigMacroCommon._PLAYLASTFRAME_, "1");
        this.B = this.J.getMaterial().creative_type.intValue() != j.CreativeTypeVideo_transparent_html.a();
        if (bundle2 != null) {
            this.S = bundle2.getInt(g, -1);
            this.T = bundle2.getBoolean(h, false);
            this.W = bundle2.getBoolean(i, false);
        }
        if (this.G.e() != null) {
            int b = com.sigmob.sdk.base.d.b();
            if (b != 0) {
                k().setTheme(b);
            }
            j().setBackgroundColor(-16777216);
            RelativeLayout relativeLayout = new RelativeLayout(activity);
            this.q = relativeLayout;
            relativeLayout.setBackgroundColor(-16777216);
            this.I = a(activity, 0);
            RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(-1, -2);
            layoutParams.addRule(13);
            this.q.addView(this.I, layoutParams);
            j().addView(this.q, new RelativeLayout.LayoutParams(-1, -1));
            if (this.s) {
                a(activity);
                z();
            }
            m();
            this.q.setClickable(true);
            this.q.setOnTouchListener(new View.OnTouchListener() {
                /* class com.sigmob.sdk.videoAd.l.AnonymousClass1 */
                MotionEvent a = null;

                /* JADX WARNING: Code restructure failed: missing block: B:13:0x0039, code lost:
                    if (r5.getAction() == 0) goto L_0x009a;
                 */
                /* JADX WARNING: Code restructure failed: missing block: B:28:0x0098, code lost:
                    if (r5.getAction() == 0) goto L_0x009a;
                 */
                public boolean onTouch(View view, MotionEvent motionEvent) {
                    if (l.this.J.getFullClickOnVideo()) {
                        if (l.this.C == null || l.this.C.getVisibility() != 0) {
                            if (motionEvent.getAction() == 1) {
                                if (this.a == null) {
                                    this.a = motionEvent;
                                }
                                l.this.a((l) this.a, motionEvent);
                            }
                        }
                        return true;
                    } else if (motionEvent.getAction() == 1) {
                        if (l.this.J.getMaterial().enable_collapse_tool_bar.booleanValue() && l.this.ad != null && l.this.ad.a()) {
                            if (l.this.ad.b()) {
                                l.this.ad.setVisibility(0);
                            } else {
                                l.this.ad.setVisibility(4);
                            }
                        }
                        com.sigmob.sdk.base.common.x.a(l.this.J, motionEvent, "useless_video_click", false);
                    }
                    this.a = MotionEvent.obtain(motionEvent);
                    return true;
                }
            });
            return;
        }
        throw new IllegalStateException("BaseVideoConfig does not have a video disk path");
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void A() {
        RelativeLayout relativeLayout = this.X;
        if (relativeLayout != null && relativeLayout.getVisibility() == 0) {
            this.v.add(String.format(TimeModel.NUMBER_FORMAT, Long.valueOf(System.currentTimeMillis() - this.x)));
            this.w.add(String.format("%.2f", Float.valueOf(((float) t()) / 1000.0f)));
            this.y = PointCategory.PLAY;
            this.A.removeCallbacksAndMessages(null);
            this.X.setVisibility(4);
        }
    }

    private void B() {
        try {
            if (!this.T) {
                I();
                if (this.S > 0) {
                    SigmobLog.d("video seek to " + this.S);
                    this.I.seekTo(this.S);
                }
                c cVar = this.C;
                if ((cVar == null || cVar.getVisibility() != 0) && !this.al) {
                    this.I.start();
                }
                if (this.S != -1) {
                    this.G.a(i(), this.S);
                }
            }
        } catch (Throwable th) {
            SigmobLog.e(th.getMessage());
        }
    }

    private void C() {
        try {
            if (!this.T) {
                J();
                this.I.pause();
                SigmobLog.i("videoView.pause()");
                this.S = t();
                n().a(com.sigmob.sdk.base.common.a.AD_PAUSE, t());
                this.G.b(i(), this.S);
            }
        } catch (Throwable th) {
            SigmobLog.e(th.getMessage());
        }
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private float D() {
        return ((float) t()) / ((float) s());
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void E() {
        try {
            this.R = this.G.j(s());
        } catch (Throwable th) {
            SigmobLog.e(th.getMessage());
        }
    }

    private void F() {
        com.sigmob.sdk.base.common.x.a(PointCategory.PLAY_LOADING, (String) null, this.J, new x.a() {
            /* class com.sigmob.sdk.videoAd.l.AnonymousClass17 */

            @Override // com.sigmob.sdk.base.common.x.a
            public void a(Object obj) {
                if (obj instanceof PointEntitySigmob) {
                    HashMap hashMap = new HashMap();
                    l lVar = l.this;
                    hashMap.put("duration_seq", lVar.a((l) lVar.v));
                    l lVar2 = l.this;
                    hashMap.put("video_time_seq", lVar2.a((l) lVar2.w));
                    hashMap.put("skip_state", l.this.y);
                    hashMap.put("video_duration", String.format("%.2f", Float.valueOf(((float) l.this.s()) / 1000.0f)));
                    hashMap.put("endcard_loading_state", l.this.u);
                    ((PointEntitySigmob) obj).setOptions(hashMap);
                }
            }
        });
    }

    private void G() {
        int s2 = this.G.s();
        int s3 = s() - 2;
        if (s2 == 99999999) {
            s2 = 0;
        } else if (s2 == -99999999) {
            a(s3);
            return;
        } else if (s2 <= 0) {
            s2 += s3;
        }
        a(s2);
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void H() {
        ImageView imageView;
        u();
        if (!this.B && (imageView = this.p) != null) {
            ViewParent parent = imageView.getParent();
            if (parent != null && (parent instanceof ViewGroup)) {
                ((ViewGroup) parent).removeView(this.p);
            }
            j().addView(this.p, 0);
        }
        d.e().b(this);
        w wVar = this.N;
        if (wVar == null) {
            e(i(), 0);
        } else {
            wVar.setVisibility(0);
        }
        com.sigmob.sdk.base.views.a aVar = this.n;
        if (aVar != null) {
            aVar.setVisibility(8);
        }
        F();
        A();
        if (this.f136K == null) {
            SigmobLog.e("endcard can't show " + this.J.getEndCardIndexPath());
            HashMap hashMap = new HashMap();
            hashMap.put("error", "endcard can't show");
            a(IntentActions.ACTION_REWARDED_VIDEO_PLAYFAIL, hashMap);
            this.d.a();
        }
        View view = this.f136K;
        if (view != null) {
            view.setVisibility(0);
            this.f136K.bringToFront();
        }
        RelativeLayout relativeLayout = this.q;
        if (relativeLayout != null) {
            relativeLayout.setVisibility(4);
            a(IntentActions.ACTION_REWARDED_VIDEO_CLOSE);
        }
        com.sigmob.sdk.base.views.v vVar = this.O;
        if (vVar != null) {
            vVar.setVisibility(8);
        }
        w wVar2 = this.Z;
        if (wVar2 != null) {
            wVar2.setVisibility(8);
        }
        if (this.ae) {
            this.M.setVisibility(8);
        }
        i iVar = this.ad;
        if (iVar != null) {
            iVar.setVisibility(8);
        }
        this.W = true;
    }

    private void I() {
        d dVar = this.Q;
        if (dVar != null) {
            dVar.startRepeating(j);
        }
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void J() {
        d dVar = this.Q;
        if (dVar != null) {
            dVar.stop();
        }
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void K() {
        new Handler(Looper.getMainLooper()).post(new Runnable() {
            /* class com.sigmob.sdk.videoAd.l.AnonymousClass10 */

            public void run() {
                l.this.a((l) IntentActions.ACTION_INTERSTITIAL_CLICK);
            }
        });
    }

    private View a(Context context, h hVar, int i2) {
        Preconditions.NoThrow.checkNotNull(context);
        if (hVar == null) {
            View view = new View(context);
            view.setVisibility(4);
            return view;
        }
        RelativeLayout relativeLayout = new RelativeLayout(context);
        relativeLayout.setGravity(17);
        j().addView(relativeLayout, 0, new RelativeLayout.LayoutParams(-1, -1));
        k a2 = a(context, hVar);
        a2.setVisibility(i2);
        relativeLayout.addView(a2, new LinearLayout.LayoutParams(-1, -1));
        return a2;
    }

    private k a(Context context, h hVar) {
        Preconditions.NoThrow.checkNotNull(context);
        Preconditions.NoThrow.checkNotNull(hVar);
        Preconditions.NoThrow.checkNotNull(hVar.a());
        k a2 = k.a(context, this.J.getAd_source_logo(), false, this.J.getInvisibleAdLabel());
        a2.addJavascriptInterface(new a(), "sigVersion");
        a2.setWebViewClickListener(new k.a() {
            /* class com.sigmob.sdk.videoAd.l.AnonymousClass7 */

            @Override // com.sigmob.sdk.base.views.k.a
            public void a(MotionEvent motionEvent, MotionEvent motionEvent2) {
                String str;
                if (l.this.N.getVisibility() != 0 || l.this.Y) {
                    SigmobLog.w("ignore invalid click");
                    return;
                }
                com.sigmob.sdk.base.common.x.a(l.this.J, motionEvent2, PointCategory.ENDCARDCLICK, true);
                l lVar = l.this;
                Object[] objArr = new Object[4];
                if (motionEvent == null) {
                    objArr[0] = Integer.valueOf((int) motionEvent2.getRawX());
                    objArr[1] = Integer.valueOf((int) motionEvent2.getRawY());
                    objArr[2] = Integer.valueOf((int) motionEvent2.getRawX());
                    objArr[3] = Integer.valueOf((int) motionEvent2.getRawY());
                    str = String.format("%d,%d,%d,%d", objArr);
                } else {
                    objArr[0] = Integer.valueOf((int) motionEvent.getRawX());
                    objArr[1] = Integer.valueOf((int) motionEvent.getRawY());
                    objArr[2] = Integer.valueOf((int) motionEvent2.getRawX());
                    objArr[3] = Integer.valueOf((int) motionEvent2.getRawY());
                    str = String.format("%d,%d,%d,%d", objArr);
                }
                lVar.f = str;
                SigMacroCommon macroCommon = l.this.J.getMacroCommon();
                if (macroCommon instanceof SigMacroCommon) {
                    macroCommon.addMarcoKey(SigMacroCommon._DOWNX_, String.valueOf((int) motionEvent.getRawX()));
                    macroCommon.addMarcoKey(SigMacroCommon._DOWNY_, String.valueOf((int) motionEvent.getRawY()));
                    macroCommon.addMarcoKey(SigMacroCommon._UPX_, String.valueOf((int) motionEvent2.getRawX()));
                    macroCommon.addMarcoKey(SigMacroCommon._UPY_, String.valueOf((int) motionEvent2.getRawY()));
                }
                l.this.z = true;
                if (l.this.J.getMaterial().click_type.intValue() != com.sigmob.sdk.base.common.i.FullScreen.a() || TextUtils.isEmpty(l.this.J.getMaterial().landing_page) || l.this.J.getMaterial().creative_type.intValue() == j.CreativeTypeVideo_EndCardURL.a()) {
                    l.this.af = true;
                } else {
                    l.this.G.a(com.sigmob.sdk.base.a.ENDCARD, l.this.f, true);
                }
            }
        });
        a2.setDownloadListener(new DownloadListener() {
            /* class com.sigmob.sdk.videoAd.l.AnonymousClass8 */

            public void onDownloadStart(String str, String str2, String str3, String str4, long j) {
                if (l.this.z) {
                    if (TextUtils.isEmpty(l.this.J.getMaterial().landing_page) || l.this.J.getInteractionType() == 2) {
                        l.this.J.setCustomLandPageUrl(str);
                    }
                    l.this.G.a(com.sigmob.sdk.base.a.ENDCARD, l.this.f, true);
                    SigmobLog.d("onDownloadStart() called with: url = [" + str + "], userAgent = [" + str2 + "], contentDisposition = [" + str3 + "], mimetype = [" + str4 + "], contentLength = [" + j + "]");
                }
            }
        });
        a2.setAdUnit(this.J);
        a2.setWebViewClient(new e() {
            /* class com.sigmob.sdk.videoAd.l.AnonymousClass9 */

            public void onPageFinished(WebView webView, String str) {
                super.onPageFinished(webView, str);
                SigmobLog.d("onPageFinished: ");
                l.this.u = "done";
            }

            public void onPageStarted(WebView webView, String str, Bitmap bitmap) {
                super.onPageStarted(webView, str, bitmap);
                SigmobLog.d("onPageStarted: ");
            }

            public void onReceivedError(WebView webView, int i, String str, String str2) {
                super.onReceivedError(webView, i, str, str2);
                if (!str2.startsWith("http://")) {
                    l.this.u = "error";
                }
            }

            public void onReceivedError(WebView webView, WebResourceRequest webResourceRequest, WebResourceError webResourceError) {
                super.onReceivedError(webView, webResourceRequest, webResourceError);
                if (Build.VERSION.SDK_INT >= 21) {
                    String host = webResourceRequest.getUrl().getHost();
                    if (!TextUtils.isEmpty(host) && host.equals(b.a)) {
                        l.this.u = "error";
                    }
                }
            }

            @Override // android.webkit.WebViewClient
            public boolean shouldOverrideUrlLoading(WebView webView, String str) {
                a aVar;
                com.sigmob.sdk.base.a aVar2;
                l lVar;
                try {
                    SigmobLog.d("load url " + str);
                    webView.getContext();
                    Uri parse = Uri.parse(str);
                    if ("sigmobAd".equalsIgnoreCase(parse.getScheme())) {
                        String host = parse.getHost();
                        if (!TextUtils.isEmpty(host)) {
                            if (!"track".equals(host)) {
                                if (!"active".equals(host)) {
                                    if ("openFourElements".equals(host)) {
                                        l.this.b((l) 2);
                                        return true;
                                    }
                                }
                            }
                            String queryParameter = parse.getQueryParameter("data");
                            String queryParameter2 = parse.getQueryParameter(NotificationCompat.CATEGORY_EVENT);
                            if (!TextUtils.isEmpty(queryParameter2) && !TextUtils.isEmpty(queryParameter)) {
                                final String str2 = new String(Base64.decode(queryParameter, 0), "utf-8");
                                com.sigmob.sdk.base.common.x.a(host, queryParameter2, l.this.J, new x.a() {
                                    /* class com.sigmob.sdk.videoAd.l.AnonymousClass9.AnonymousClass1 */

                                    @Override // com.sigmob.sdk.base.common.x.a
                                    public void a(Object obj) {
                                        if (obj instanceof PointEntitySigmob) {
                                            ((PointEntitySigmob) obj).setUrl(str2);
                                        }
                                    }
                                });
                            }
                            return true;
                        }
                    }
                    if (l.this.Y) {
                        return true;
                    }
                    if (l.this.J.getMaterial().disable_auto_deeplink.booleanValue() && !l.this.z) {
                        return TextUtils.isEmpty(str) || !str.startsWith(Constants.HTTP);
                    }
                    if (l.this.J.getMaterial().click_type.intValue() != com.sigmob.sdk.base.common.i.Button.a() && !TextUtils.isEmpty(l.this.J.getMaterial().landing_page) && l.this.J.getMaterial().creative_type.intValue() != j.CreativeTypeVideo_EndCardURL.a()) {
                        if (l.this.J.getMaterial().click_type.intValue() == com.sigmob.sdk.base.common.i.FullScreen.a()) {
                            TextUtils.isEmpty(l.this.J.getMaterial().landing_page);
                            return true;
                        }
                        return true;
                    } else if (l.this.N.getVisibility() != 0 || TextUtils.isEmpty(parse.getScheme()) || parse.getScheme().equals(Constants.HTTP) || parse.getScheme().equals(Constants.HTTPS)) {
                        if (!TextUtils.isEmpty(parse.getScheme()) && (parse.getScheme().equals(Constants.HTTP) || parse.getScheme().equals(Constants.HTTPS))) {
                            if (l.this.af) {
                                l.this.K();
                                l.this.af = false;
                            }
                            webView.loadUrl(str);
                        }
                        return true;
                    } else {
                        if (!parse.getScheme().equalsIgnoreCase("sigmobAd") || TextUtils.isEmpty(parse.getHost()) || !parse.getHost().equalsIgnoreCase("download") || TextUtils.isEmpty(l.this.J.getMaterial().landing_page)) {
                            l.this.J.setCustomDeeplink(str);
                            aVar = l.this.G;
                            aVar2 = com.sigmob.sdk.base.a.ENDCARD;
                            lVar = l.this;
                        } else {
                            aVar = l.this.G;
                            aVar2 = com.sigmob.sdk.base.a.ENDCARD;
                            lVar = l.this;
                        }
                        aVar.a(aVar2, lVar.f, true);
                        return true;
                    }
                } catch (Throwable unused) {
                    SigmobLog.e("webview");
                }
            }
        });
        hVar.a().a(a2);
        a2.a((k.a) null);
        return a2;
    }

    private b a(Context context, int i2) {
        Uri uri;
        if (this.G.e() != null) {
            final b bVar = new b(context);
            bVar.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
                /* class com.sigmob.sdk.videoAd.l.AnonymousClass14 */

                public void onPrepared(MediaPlayer mediaPlayer) {
                    l.this.V = mediaPlayer.getDuration();
                    if (l.this.P != null) {
                        l.this.P.a(l.this.V);
                    }
                    mediaPlayer.setOnSeekCompleteListener(new MediaPlayer.OnSeekCompleteListener() {
                        /* class com.sigmob.sdk.videoAd.l.AnonymousClass14.AnonymousClass1 */

                        public void onSeekComplete(MediaPlayer mediaPlayer) {
                            if (l.this.T) {
                                return;
                            }
                            if ((l.this.C == null || l.this.C.getVisibility() != 0) && !l.this.al) {
                                l.this.A();
                                mediaPlayer.start();
                                SigmobLog.i("mediaplayer omPrepared start");
                            }
                        }
                    });
                    if (l.this.ah > 0) {
                        SigmobLog.i("seek to " + (l.this.ah / 1000));
                        mediaPlayer.seekTo(l.this.ah + -500);
                    } else {
                        SigmobLog.i("seek to 0");
                        mediaPlayer.seekTo(0);
                    }
                    if (Build.VERSION.SDK_INT >= 3) {
                        mediaPlayer.setOnVideoSizeChangedListener(new MediaPlayer.OnVideoSizeChangedListener() {
                            /* class com.sigmob.sdk.videoAd.l.AnonymousClass14.AnonymousClass2 */

                            public void onVideoSizeChanged(MediaPlayer mediaPlayer, int i, int i2) {
                                bVar.a(mediaPlayer.getVideoWidth(), mediaPlayer.getVideoHeight());
                                bVar.requestLayout();
                            }
                        });
                    }
                    try {
                        if (Build.VERSION.SDK_INT >= 16) {
                            String str = "";
                            for (MediaPlayer.TrackInfo trackInfo : mediaPlayer.getTrackInfo()) {
                                str = str.concat(trackInfo.toString());
                            }
                        }
                    } catch (Throwable unused) {
                    }
                    if (l.this.aa) {
                        l.this.Z.a(n.SOUND_MUTE.a());
                        l.this.I.setVolume(0.0f);
                    }
                    l.this.n().a(l.this.V, l.this.G.l());
                    if (!l.this.T && (l.this.S == 0 || l.this.S == -1)) {
                        SigMacroCommon macroCommon = l.this.J.getMacroCommon();
                        if (macroCommon instanceof SigMacroCommon) {
                            macroCommon.addMarcoKey(SigMacroCommon._COMPLETED_, "0");
                            macroCommon.addMarcoKey(SigMacroCommon._VIDEOTIME_, String.valueOf(l.this.V / 1000));
                        }
                    }
                    l.this.E();
                    if (l.this.ae) {
                        l.this.M.a(l.this.s(), 0);
                    }
                    mediaPlayer.setOnInfoListener(new MediaPlayer.OnInfoListener() {
                        /* class com.sigmob.sdk.videoAd.l.AnonymousClass14.AnonymousClass3 */

                        public boolean onInfo(MediaPlayer mediaPlayer, int i, int i2) {
                            String str;
                            if (l.this.s && mediaPlayer.isPlaying()) {
                                if (i == 3) {
                                    mediaPlayer.start();
                                    str = "mediaplayer onInfo start";
                                } else if (i == 804 && !l.this.ag) {
                                    l.this.z();
                                    l.this.ag = true;
                                    l.this.ah = mediaPlayer.getCurrentPosition();
                                    l.this.J();
                                    bVar.pause();
                                    str = "videoView.pause()";
                                }
                                SigmobLog.i(str);
                            }
                            return true;
                        }
                    });
                }
            });
            try {
                if (!this.B) {
                    bVar.a.setDataSource(this.G.e());
                    this.p = b(context);
                }
            } catch (Throwable unused) {
            }
            bVar.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
                /* class com.sigmob.sdk.videoAd.l.AnonymousClass15 */

                public void onCompletion(MediaPlayer mediaPlayer) {
                    if (!l.this.s || (!l.this.ag && l.this.D() >= 0.5f)) {
                        l.this.y = "none";
                        l.this.b(true);
                        return;
                    }
                    l.this.z();
                }
            });
            bVar.setOnErrorListener(new MediaPlayer.OnErrorListener() {
                /* class com.sigmob.sdk.videoAd.l.AnonymousClass16 */

                public boolean onError(MediaPlayer mediaPlayer, int i, int i2) {
                    SigmobLog.e(String.format("what %d, extra %d", Integer.valueOf(i), Integer.valueOf(i2)));
                    if (l.this.s) {
                        l.this.z();
                        l.this.ag = true;
                        l.this.ah = mediaPlayer.getCurrentPosition();
                        l.this.J();
                        bVar.pause();
                        SigmobLog.i("videoView.pause()");
                        return true;
                    }
                    l.this.U = true;
                    l.this.n().a(com.sigmob.sdk.base.common.a.AD_ERROR, l.this.t());
                    l.this.J();
                    String str = "";
                    try {
                        if (Build.VERSION.SDK_INT >= 16) {
                            for (MediaPlayer.TrackInfo trackInfo : mediaPlayer.getTrackInfo()) {
                                str = str.concat(trackInfo.toString());
                            }
                        }
                    } catch (Throwable unused) {
                    }
                    l.this.G.a(l.this.i(), str + String.format("what %d, extra %d", Integer.valueOf(i), Integer.valueOf(i2)), l.this.J, "video", l.this.t());
                    HashMap hashMap = new HashMap();
                    hashMap.put("error", "ad_unit_key Serializable is null");
                    l.this.a((l) IntentActions.ACTION_REWARDED_VIDEO_PLAYFAIL, (String) hashMap);
                    l.this.H();
                    return false;
                }
            });
            if (this.J.isVideoExist()) {
                uri = Uri.fromFile(new File(this.G.e()));
            } else {
                this.s = true;
                d.e().a(this.J, (d.b) null);
                uri = Uri.parse(this.J.getProxyVideoUrl());
            }
            bVar.setVideoURI(uri);
            bVar.setVisibility(i2);
            return bVar;
        }
        throw new IllegalStateException("BaseVideoConfig does not have a video disk path");
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private String a(List<String> list) {
        if (list == null || list.size() == 0) {
            return "";
        }
        StringBuilder sb = new StringBuilder();
        int i2 = 0;
        sb.append('[');
        do {
            if (i2 != 0) {
                sb.append(',');
            }
            sb.append(list.get(i2));
            i2++;
        } while (i2 < list.size());
        sb.append(']');
        return sb.toString();
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void a(int i2) {
        try {
            SigmobLog.d("get video image begin" + System.currentTimeMillis());
            Bitmap frameAtTime = this.I.a.getFrameAtTime((long) (i2 * 1000), 2);
            SigmobLog.d("get video image end" + System.currentTimeMillis());
            this.p.setScaleType(ImageView.ScaleType.FIT_XY);
            this.p.setImageBitmap(frameAtTime);
        } catch (RuntimeException e2) {
            SigmobLog.e(e2.getMessage());
        }
    }

    private void a(int i2, RelativeLayout.LayoutParams layoutParams) {
        int dipsToIntPixels = Dips.dipsToIntPixels(10.0f, this.b);
        layoutParams.addRule(10);
        w wVar = this.Z;
        if (wVar != null) {
            layoutParams.addRule(i2, wVar.getId());
            layoutParams.setMargins(0, dipsToIntPixels * 2, 0, 0);
            return;
        }
        layoutParams.addRule(i2, wVar.getId());
        layoutParams.setMargins(dipsToIntPixels, dipsToIntPixels * 2, dipsToIntPixels, dipsToIntPixels);
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void a(int i2, boolean z2) {
        com.sigmob.sdk.base.views.v vVar = this.O;
        if (vVar != null && !vVar.a()) {
            this.O.b();
            n().a(z2, i2);
            n().a(com.sigmob.sdk.base.common.a.AD_SHOW_SKIP, i2);
        }
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void a(MotionEvent motionEvent, MotionEvent motionEvent2) {
        ClickAreaSetting clickAreaSetting = this.J.getClickAreaSetting();
        float floatValue = clickAreaSetting.left.floatValue() * ((float) ClientMetadata.getInstance().getDisplayMetrics().widthPixels);
        float floatValue2 = (1.0f - clickAreaSetting.right.floatValue()) * ((float) ClientMetadata.getInstance().getDisplayMetrics().widthPixels);
        float floatValue3 = clickAreaSetting.top.floatValue() * ((float) ClientMetadata.getInstance().getDisplayMetrics().heightPixels);
        float floatValue4 = (1.0f - clickAreaSetting.bottom.floatValue()) * ((float) ClientMetadata.getInstance().getDisplayMetrics().heightPixels);
        boolean z2 = false;
        if (floatValue < motionEvent2.getRawX() && motionEvent2.getRawX() < floatValue2 && floatValue3 < motionEvent2.getRawY() && motionEvent2.getRawY() < floatValue4) {
            SigMacroCommon macroCommon = this.J.getMacroCommon();
            if (macroCommon instanceof SigMacroCommon) {
                macroCommon.addMarcoKey(SigMacroCommon._PROGRESS_, String.valueOf((t() * 100) / s()));
                macroCommon.addMarcoKey(SigMacroCommon._DOWNX_, String.valueOf((int) motionEvent.getRawX()));
                macroCommon.addMarcoKey(SigMacroCommon._DOWNY_, String.valueOf((int) motionEvent.getRawY()));
                macroCommon.addMarcoKey(SigMacroCommon._UPX_, String.valueOf((int) motionEvent2.getRawX()));
                macroCommon.addMarcoKey(SigMacroCommon._UPY_, String.valueOf((int) motionEvent2.getRawY()));
            }
            this.f = String.format("%d,%d,%d,%d", Integer.valueOf((int) motionEvent.getRawX()), Integer.valueOf((int) motionEvent.getRawY()), Integer.valueOf((int) motionEvent2.getRawX()), Integer.valueOf((int) motionEvent2.getRawY()));
            if (this.P == null) {
                u();
            }
            this.G.a(com.sigmob.sdk.base.a.VIDEO_CLICK, this.f, true);
            z2 = true;
        }
        com.sigmob.sdk.base.common.x.a(this.J, motionEvent2, "useless_video_click", z2);
    }

    private ImageView b(Context context) {
        ImageView imageView = new ImageView(context);
        imageView.setLayoutParams(new RelativeLayout.LayoutParams(-1, -1));
        return imageView;
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void b(final int i2) {
        if (this.ak == null) {
            com.sigmob.sdk.base.views.p pVar = new com.sigmob.sdk.base.views.p(k(), this.J);
            this.ak = pVar;
            pVar.a(new p.b() {
                /* class com.sigmob.sdk.videoAd.l.AnonymousClass6 */

                @Override // com.sigmob.sdk.base.views.p.b
                public void a() {
                    if (l.this.ak != null) {
                        l.this.ak.dismiss();
                        l.this.ak.c();
                        l.this.ak = null;
                        l.this.al = false;
                    }
                    if (l.this.I != null && i2 == 1) {
                        l.this.I.start();
                    }
                    l.this.n().a(com.sigmob.sdk.base.common.a.AD_FOUR_ELEMENTS_CLOSE, l.this.t());
                }

                @Override // com.sigmob.sdk.base.views.p.b
                public void a(String str, String str2) {
                    if (l.this.P == null) {
                        l.this.u();
                    }
                    l.this.G.a(com.sigmob.sdk.base.a.ENDCARD, str, str2, true);
                }

                @Override // com.sigmob.sdk.base.views.p.b
                public void b() {
                    if (l.this.I != null && l.this.I.isPlaying() && i2 == 1) {
                        l.this.I.pause();
                    }
                    l.this.n().a(com.sigmob.sdk.base.common.a.AD_FOUR_ELEMENTS_SHOW, l.this.t());
                }
            });
        }
        com.sigmob.sdk.base.views.p pVar2 = this.ak;
        if (pVar2 != null && pVar2.a() && !this.al) {
            this.ak.show();
            this.al = true;
        }
    }

    private void b(int i2, RelativeLayout.LayoutParams layoutParams) {
        int i3;
        int dipsToIntPixels = Dips.dipsToIntPixels(10.0f, this.b);
        if (i2 == 1 || i2 == 2) {
            layoutParams.addRule(10);
            i3 = 9;
        } else if (i2 == 3 || i2 == 4) {
            layoutParams.addRule(10);
            i3 = 11;
        } else {
            return;
        }
        layoutParams.addRule(i3);
        layoutParams.setMargins(dipsToIntPixels, dipsToIntPixels * 2, dipsToIntPixels, dipsToIntPixels);
    }

    private void b(Context context, int i2) {
        com.sigmob.sdk.base.views.x xVar = new com.sigmob.sdk.base.views.x(context);
        this.M = xVar;
        xVar.setAnchorId(this.I.getId());
        this.M.setVisibility(i2);
        j().addView(this.M);
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void c(Context context, int i2) {
        if (this.C == null) {
            c cVar = new c(context, this.G.u());
            this.C = cVar;
            cVar.setVisibility(i2);
            j().addView(this.C);
            this.C.setDialogListener(new c.a() {
                /* class com.sigmob.sdk.videoAd.l.AnonymousClass18 */

                @Override // com.sigmob.sdk.base.views.c.a
                public void a() {
                    if (!l.this.T) {
                        l.this.n().a(com.sigmob.sdk.base.common.a.AD_SKIP, l.this.t());
                        l.this.G.b(l.this.b, l.this.t(), l.this.s(), l.this.J);
                    }
                    l.this.C.setVisibility(8);
                    if (!(l.this.ad == null || l.this.ad.getFourElementsLayout() == null)) {
                        l.this.ad.getFourElementsLayout().setClickable(true);
                    }
                    if (l.this.G.m()) {
                        l.this.h().a();
                        return;
                    }
                    if (!l.this.B) {
                        l lVar = l.this;
                        lVar.a((l) lVar.t());
                    }
                    l.this.I.stopPlayback();
                    l.this.J();
                    l.this.H();
                    l.this.T = true;
                    if (l.this.L != null) {
                        l.this.L.a(com.sigmob.sdk.base.common.a.AD_SHOW, 0);
                    }
                }

                @Override // com.sigmob.sdk.base.views.c.a
                public void b() {
                    l.this.I.start();
                    l.this.C.setVisibility(8);
                    if (l.this.ad != null && l.this.ad.getFourElementsLayout() != null) {
                        l.this.ad.getFourElementsLayout().setClickable(true);
                    }
                }
            });
        }
    }

    /* JADX WARNING: Removed duplicated region for block: B:46:0x00fb A[Catch:{ all -> 0x0106 }] */
    /* JADX WARNING: Removed duplicated region for block: B:47:0x0102  */
    /* JADX WARNING: Removed duplicated region for block: B:58:0x012d  */
    /* JADX WARNING: Removed duplicated region for block: B:59:0x0130  */
    /* JADX WARNING: Removed duplicated region for block: B:62:0x0181  */
    /* JADX WARNING: Removed duplicated region for block: B:65:0x01c1  */
    /* JADX WARNING: Removed duplicated region for block: B:66:0x01d3  */
    private void d(Context context, int i2) {
        int i3;
        int i4;
        int i5;
        int i6;
        int i7;
        String str;
        LinearLayout fourElementsLayout;
        boolean z2;
        int i8;
        CompanionEndcard companionEndcard = this.J.getMaterial().companion;
        if (companionEndcard == null || TextUtils.isEmpty(companionEndcard.icon_url) || TextUtils.isEmpty(companionEndcard.title) || (TextUtils.isEmpty(companionEndcard.desc) && companionEndcard.score.floatValue() < 1.0f)) {
            SigmobLog.e("ompanionEnd lose informations of UI Display");
            return;
        }
        int i9 = m.a;
        int i10 = TbsListener.ErrorCode.INSTALL_FROM_UNZIP;
        int i11 = -1;
        try {
            if (companionEndcard.button_color != null && ((double) companionEndcard.button_color.alpha.floatValue()) > 0.01d) {
                try {
                    i9 = Color.argb((int) (companionEndcard.button_color.alpha.floatValue() * 255.0f), companionEndcard.button_color.red.intValue(), companionEndcard.button_color.green.intValue(), companionEndcard.button_color.blue.intValue());
                } catch (Throwable unused) {
                }
            }
            if (companionEndcard.button_text_color != null && ((double) companionEndcard.button_text_color.alpha.floatValue()) > 0.01d) {
                try {
                    i8 = Color.argb((int) (companionEndcard.button_text_color.alpha.floatValue() * 255.0f), companionEndcard.button_text_color.red.intValue(), companionEndcard.button_text_color.green.intValue(), companionEndcard.button_text_color.blue.intValue());
                } catch (Throwable unused2) {
                }
                if (companionEndcard.bar_color != null && ((double) companionEndcard.bar_color.alpha.floatValue()) > 0.01d) {
                    try {
                        i10 = (int) (companionEndcard.bar_color.alpha.floatValue() * 255.0f);
                        i11 = Color.rgb(companionEndcard.button_text_color.red.intValue(), companionEndcard.button_text_color.green.intValue(), companionEndcard.button_text_color.blue.intValue());
                    } catch (Throwable unused3) {
                    }
                }
                i6 = i9;
                i3 = i10;
                i4 = i11;
                i5 = i8;
                i7 = companionEndcard.click_type == null ? companionEndcard.click_type.intValue() : 0;
                str = companionEndcard.button_text;
                if (TextUtils.isEmpty(str) || str.length() > 4) {
                    str = a().getMaterial().interaction_type.intValue() != 2 ? "下载" : "详情";
                }
                i iVar = new i(context, this.J, companionEndcard.title, str, companionEndcard.score.floatValue(), companionEndcard.desc, companionEndcard.animate_type.intValue(), this.J.getMaterial().template_type.intValue(), companionEndcard.icon_url, i6, i5, i7, i4, i3, 70.0f);
                this.ad = iVar;
                iVar.setId(ClientMetadata.generateViewId());
                fourElementsLayout = this.ad.getFourElementsLayout();
                if (fourElementsLayout != null) {
                    fourElementsLayout.setClickable(true);
                    fourElementsLayout.setOnClickListener(new View.OnClickListener() {
                        /* class com.sigmob.sdk.videoAd.l.AnonymousClass19 */

                        public void onClick(View view) {
                            l.this.b((l) 1);
                        }
                    });
                }
                RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams((Math.max(context.getResources().getDisplayMetrics().widthPixels, context.getResources().getDisplayMetrics().heightPixels) * 3) / 5, Dips.asIntPixels(70.0f, context));
                int asIntPixels = Dips.asIntPixels(8.0f, context);
                if (this.n == null) {
                    z2 = false;
                    layoutParams.setMargins(asIntPixels, 0, asIntPixels, 0);
                    layoutParams.addRule(11);
                    layoutParams.addRule(2, this.n.getId());
                } else {
                    z2 = false;
                    layoutParams.setMargins(asIntPixels, 0, asIntPixels, this.r + asIntPixels);
                    layoutParams.addRule(11);
                    layoutParams.addRule(12);
                }
                j().addView(this.ad, layoutParams);
                this.F = z2;
                this.ad.setClickable(true);
                this.ad.setOnTouchListener(new View.OnTouchListener() {
                    /* class com.sigmob.sdk.videoAd.l.AnonymousClass20 */
                    MotionEvent a;

                    public boolean onTouch(View view, MotionEvent motionEvent) {
                        SigmobLog.d("mCompanionAdsWidget click" + motionEvent.toString());
                        if (motionEvent.getAction() == 1) {
                            com.sigmob.sdk.base.common.x.a(l.this.J, motionEvent, com.sigmob.sdk.base.common.a.AD_COMPANION_CLICK.a(), true);
                            if (this.a == null) {
                                this.a = motionEvent;
                            }
                            SigMacroCommon macroCommon = l.this.J.getMacroCommon();
                            if (macroCommon instanceof SigMacroCommon) {
                                macroCommon.addMarcoKey(SigMacroCommon._PROGRESS_, String.valueOf((l.this.t() * 100) / l.this.s()));
                                macroCommon.addMarcoKey(SigMacroCommon._DOWNX_, String.valueOf((int) this.a.getRawX()));
                                macroCommon.addMarcoKey(SigMacroCommon._DOWNY_, String.valueOf((int) this.a.getRawY()));
                                macroCommon.addMarcoKey(SigMacroCommon._UPX_, String.valueOf((int) motionEvent.getRawX()));
                                macroCommon.addMarcoKey(SigMacroCommon._UPY_, String.valueOf((int) motionEvent.getRawY()));
                            }
                            l.this.f = String.format("%d,%d,%d,%d", Integer.valueOf((int) this.a.getRawX()), Integer.valueOf((int) this.a.getRawY()), Integer.valueOf((int) motionEvent.getRawX()), Integer.valueOf((int) motionEvent.getRawY()));
                            if (l.this.P == null) {
                                l.this.u();
                            }
                            l.this.G.a(com.sigmob.sdk.base.a.COMPANION, l.this.f, true);
                        } else if (motionEvent.getAction() == 0) {
                            this.a = MotionEvent.obtain(motionEvent);
                        }
                        return true;
                    }
                });
            }
            i8 = -1;
            try {
                i10 = (int) (companionEndcard.bar_color.alpha.floatValue() * 255.0f);
                i11 = Color.rgb(companionEndcard.button_text_color.red.intValue(), companionEndcard.button_text_color.green.intValue(), companionEndcard.button_text_color.blue.intValue());
                i6 = i9;
                i3 = i10;
                i4 = i11;
                i5 = i8;
            } catch (Throwable unused4) {
                i6 = i9;
                i5 = i8;
                i4 = -1;
                i3 = TbsListener.ErrorCode.INSTALL_FROM_UNZIP;
                i7 = companionEndcard.click_type == null ? companionEndcard.click_type.intValue() : 0;
                str = companionEndcard.button_text;
                if (a().getMaterial().interaction_type.intValue() != 2) {
                }
                i iVar2 = new i(context, this.J, companionEndcard.title, str, companionEndcard.score.floatValue(), companionEndcard.desc, companionEndcard.animate_type.intValue(), this.J.getMaterial().template_type.intValue(), companionEndcard.icon_url, i6, i5, i7, i4, i3, 70.0f);
                this.ad = iVar2;
                iVar2.setId(ClientMetadata.generateViewId());
                fourElementsLayout = this.ad.getFourElementsLayout();
                if (fourElementsLayout != null) {
                }
                RelativeLayout.LayoutParams layoutParams2 = new RelativeLayout.LayoutParams((Math.max(context.getResources().getDisplayMetrics().widthPixels, context.getResources().getDisplayMetrics().heightPixels) * 3) / 5, Dips.asIntPixels(70.0f, context));
                int asIntPixels2 = Dips.asIntPixels(8.0f, context);
                if (this.n == null) {
                }
                j().addView(this.ad, layoutParams2);
                this.F = z2;
                this.ad.setClickable(true);
                this.ad.setOnTouchListener(new View.OnTouchListener() {
                    /* class com.sigmob.sdk.videoAd.l.AnonymousClass20 */
                    MotionEvent a;

                    public boolean onTouch(View view, MotionEvent motionEvent) {
                        SigmobLog.d("mCompanionAdsWidget click" + motionEvent.toString());
                        if (motionEvent.getAction() == 1) {
                            com.sigmob.sdk.base.common.x.a(l.this.J, motionEvent, com.sigmob.sdk.base.common.a.AD_COMPANION_CLICK.a(), true);
                            if (this.a == null) {
                                this.a = motionEvent;
                            }
                            SigMacroCommon macroCommon = l.this.J.getMacroCommon();
                            if (macroCommon instanceof SigMacroCommon) {
                                macroCommon.addMarcoKey(SigMacroCommon._PROGRESS_, String.valueOf((l.this.t() * 100) / l.this.s()));
                                macroCommon.addMarcoKey(SigMacroCommon._DOWNX_, String.valueOf((int) this.a.getRawX()));
                                macroCommon.addMarcoKey(SigMacroCommon._DOWNY_, String.valueOf((int) this.a.getRawY()));
                                macroCommon.addMarcoKey(SigMacroCommon._UPX_, String.valueOf((int) motionEvent.getRawX()));
                                macroCommon.addMarcoKey(SigMacroCommon._UPY_, String.valueOf((int) motionEvent.getRawY()));
                            }
                            l.this.f = String.format("%d,%d,%d,%d", Integer.valueOf((int) this.a.getRawX()), Integer.valueOf((int) this.a.getRawY()), Integer.valueOf((int) motionEvent.getRawX()), Integer.valueOf((int) motionEvent.getRawY()));
                            if (l.this.P == null) {
                                l.this.u();
                            }
                            l.this.G.a(com.sigmob.sdk.base.a.COMPANION, l.this.f, true);
                        } else if (motionEvent.getAction() == 0) {
                            this.a = MotionEvent.obtain(motionEvent);
                        }
                        return true;
                    }
                });
            }
        } catch (Throwable unused5) {
            i8 = -1;
            i6 = i9;
            i5 = i8;
            i4 = -1;
            i3 = TbsListener.ErrorCode.INSTALL_FROM_UNZIP;
            i7 = companionEndcard.click_type == null ? companionEndcard.click_type.intValue() : 0;
            str = companionEndcard.button_text;
            if (a().getMaterial().interaction_type.intValue() != 2) {
            }
            i iVar22 = new i(context, this.J, companionEndcard.title, str, companionEndcard.score.floatValue(), companionEndcard.desc, companionEndcard.animate_type.intValue(), this.J.getMaterial().template_type.intValue(), companionEndcard.icon_url, i6, i5, i7, i4, i3, 70.0f);
            this.ad = iVar22;
            iVar22.setId(ClientMetadata.generateViewId());
            fourElementsLayout = this.ad.getFourElementsLayout();
            if (fourElementsLayout != null) {
            }
            RelativeLayout.LayoutParams layoutParams22 = new RelativeLayout.LayoutParams((Math.max(context.getResources().getDisplayMetrics().widthPixels, context.getResources().getDisplayMetrics().heightPixels) * 3) / 5, Dips.asIntPixels(70.0f, context));
            int asIntPixels22 = Dips.asIntPixels(8.0f, context);
            if (this.n == null) {
            }
            j().addView(this.ad, layoutParams22);
            this.F = z2;
            this.ad.setClickable(true);
            this.ad.setOnTouchListener(new View.OnTouchListener() {
                /* class com.sigmob.sdk.videoAd.l.AnonymousClass20 */
                MotionEvent a;

                public boolean onTouch(View view, MotionEvent motionEvent) {
                    SigmobLog.d("mCompanionAdsWidget click" + motionEvent.toString());
                    if (motionEvent.getAction() == 1) {
                        com.sigmob.sdk.base.common.x.a(l.this.J, motionEvent, com.sigmob.sdk.base.common.a.AD_COMPANION_CLICK.a(), true);
                        if (this.a == null) {
                            this.a = motionEvent;
                        }
                        SigMacroCommon macroCommon = l.this.J.getMacroCommon();
                        if (macroCommon instanceof SigMacroCommon) {
                            macroCommon.addMarcoKey(SigMacroCommon._PROGRESS_, String.valueOf((l.this.t() * 100) / l.this.s()));
                            macroCommon.addMarcoKey(SigMacroCommon._DOWNX_, String.valueOf((int) this.a.getRawX()));
                            macroCommon.addMarcoKey(SigMacroCommon._DOWNY_, String.valueOf((int) this.a.getRawY()));
                            macroCommon.addMarcoKey(SigMacroCommon._UPX_, String.valueOf((int) motionEvent.getRawX()));
                            macroCommon.addMarcoKey(SigMacroCommon._UPY_, String.valueOf((int) motionEvent.getRawY()));
                        }
                        l.this.f = String.format("%d,%d,%d,%d", Integer.valueOf((int) this.a.getRawX()), Integer.valueOf((int) this.a.getRawY()), Integer.valueOf((int) motionEvent.getRawX()), Integer.valueOf((int) motionEvent.getRawY()));
                        if (l.this.P == null) {
                            l.this.u();
                        }
                        l.this.G.a(com.sigmob.sdk.base.a.COMPANION, l.this.f, true);
                    } else if (motionEvent.getAction() == 0) {
                        this.a = MotionEvent.obtain(motionEvent);
                    }
                    return true;
                }
            });
        }
        try {
            i7 = companionEndcard.click_type == null ? companionEndcard.click_type.intValue() : 0;
        } catch (Throwable unused6) {
            i7 = 0;
        }
        str = companionEndcard.button_text;
        if (a().getMaterial().interaction_type.intValue() != 2) {
        }
        i iVar222 = new i(context, this.J, companionEndcard.title, str, companionEndcard.score.floatValue(), companionEndcard.desc, companionEndcard.animate_type.intValue(), this.J.getMaterial().template_type.intValue(), companionEndcard.icon_url, i6, i5, i7, i4, i3, 70.0f);
        this.ad = iVar222;
        iVar222.setId(ClientMetadata.generateViewId());
        fourElementsLayout = this.ad.getFourElementsLayout();
        if (fourElementsLayout != null) {
        }
        RelativeLayout.LayoutParams layoutParams222 = new RelativeLayout.LayoutParams((Math.max(context.getResources().getDisplayMetrics().widthPixels, context.getResources().getDisplayMetrics().heightPixels) * 3) / 5, Dips.asIntPixels(70.0f, context));
        int asIntPixels222 = Dips.asIntPixels(8.0f, context);
        if (this.n == null) {
        }
        j().addView(this.ad, layoutParams222);
        this.F = z2;
        this.ad.setClickable(true);
        this.ad.setOnTouchListener(new View.OnTouchListener() {
            /* class com.sigmob.sdk.videoAd.l.AnonymousClass20 */
            MotionEvent a;

            public boolean onTouch(View view, MotionEvent motionEvent) {
                SigmobLog.d("mCompanionAdsWidget click" + motionEvent.toString());
                if (motionEvent.getAction() == 1) {
                    com.sigmob.sdk.base.common.x.a(l.this.J, motionEvent, com.sigmob.sdk.base.common.a.AD_COMPANION_CLICK.a(), true);
                    if (this.a == null) {
                        this.a = motionEvent;
                    }
                    SigMacroCommon macroCommon = l.this.J.getMacroCommon();
                    if (macroCommon instanceof SigMacroCommon) {
                        macroCommon.addMarcoKey(SigMacroCommon._PROGRESS_, String.valueOf((l.this.t() * 100) / l.this.s()));
                        macroCommon.addMarcoKey(SigMacroCommon._DOWNX_, String.valueOf((int) this.a.getRawX()));
                        macroCommon.addMarcoKey(SigMacroCommon._DOWNY_, String.valueOf((int) this.a.getRawY()));
                        macroCommon.addMarcoKey(SigMacroCommon._UPX_, String.valueOf((int) motionEvent.getRawX()));
                        macroCommon.addMarcoKey(SigMacroCommon._UPY_, String.valueOf((int) motionEvent.getRawY()));
                    }
                    l.this.f = String.format("%d,%d,%d,%d", Integer.valueOf((int) this.a.getRawX()), Integer.valueOf((int) this.a.getRawY()), Integer.valueOf((int) motionEvent.getRawX()), Integer.valueOf((int) motionEvent.getRawY()));
                    if (l.this.P == null) {
                        l.this.u();
                    }
                    l.this.G.a(com.sigmob.sdk.base.a.COMPANION, l.this.f, true);
                } else if (motionEvent.getAction() == 0) {
                    this.a = MotionEvent.obtain(motionEvent);
                }
                return true;
            }
        });
    }

    private void e(Context context, int i2) {
        if (this.N == null) {
            w wVar = new w(context, this.G.n());
            this.N = wVar;
            wVar.setVisibility(i2);
            RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(Dips.dipsToIntPixels(30.0f, context), Dips.dipsToIntPixels(30.0f, context));
            b(this.G.n(), layoutParams);
            j().addView(this.N, layoutParams);
            BaseAdUnit baseAdUnit = this.J;
            if (baseAdUnit != null && !TextUtils.isEmpty(baseAdUnit.getCloseCardHtmlData()) && !this.am) {
                s sVar = new s(k(), this.J, this.G);
                this.ai = sVar;
                sVar.a(new s.a() {
                    /* class com.sigmob.sdk.videoAd.l.AnonymousClass2 */

                    @Override // com.sigmob.sdk.base.views.s.a
                    public void a() {
                        if (l.this.ai != null) {
                            l.this.ai.dismiss();
                            l.this.ai.c();
                        }
                        l.this.Y = true;
                        l.this.G.b(l.this.i(), l.this.s(), l.this.J);
                        l.this.h().a();
                    }
                });
            }
            this.N.setOnTouchListener(new View.OnTouchListener() {
                /* class com.sigmob.sdk.videoAd.l.AnonymousClass3 */

                public boolean onTouch(View view, MotionEvent motionEvent) {
                    if (motionEvent.getAction() == 1) {
                        if (l.this.am || l.this.ai == null || l.this.ai.a() || l.this.aj) {
                            l.this.Y = true;
                            l.this.G.b(l.this.i(), l.this.s(), l.this.J);
                            l.this.h().a();
                        } else {
                            l.this.ai.show();
                            l.this.aj = true;
                        }
                    }
                    return true;
                }
            });
            this.N.a(this.J);
            String h2 = this.G.h();
            if (h2 != null) {
                this.N.a(h2);
            }
        }
    }

    /* JADX WARNING: Removed duplicated region for block: B:11:0x0060  */
    private void f(final Context context, int i2) {
        com.sigmob.sdk.base.views.v vVar = new com.sigmob.sdk.base.views.v(context);
        this.O = vVar;
        vVar.setId(ClientMetadata.generateViewId());
        this.O.setVisibility(i2);
        RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(-2, -2);
        if (this.G.p() <= 2) {
            if (this.G.o() <= 2) {
                a(1, layoutParams);
                j().addView(this.O, layoutParams);
                this.O.setOnClickListener(new View.OnClickListener() {
                    /* class com.sigmob.sdk.videoAd.l.AnonymousClass4 */

                    public void onClick(View view) {
                        if (l.this.O.a()) {
                            l.this.n().a(com.sigmob.sdk.base.common.a.AD_CLICK_SKIP, l.this.t());
                            if (l.this.ab || l.this.J.getAd_type() == 4) {
                                l.this.n().a(com.sigmob.sdk.base.common.a.AD_SKIP, l.this.t());
                                l.this.G.b(l.this.b, l.this.t(), l.this.s(), l.this.J);
                                l.this.b(false);
                                return;
                            }
                            l.this.I.pause();
                            SigmobLog.i("videoView.pause()");
                            if (l.this.C == null) {
                                l.this.c((l) context, (Context) 4);
                            }
                            l.this.C.setduration(l.this.O.getTime());
                            l.this.C.setVisibility(0);
                            if (l.this.ad != null && l.this.ad.getFourElementsLayout() != null) {
                                l.this.ad.getFourElementsLayout().setClickable(false);
                            }
                        }
                    }
                });
                if ((this.G.w() != 0 && this.G.y() < 0) || this.G.y() == 0) {
                    a(0, false);
                    return;
                }
            }
        } else if (this.G.o() > 2) {
            a(0, layoutParams);
            j().addView(this.O, layoutParams);
            this.O.setOnClickListener(new View.OnClickListener() {
                /* class com.sigmob.sdk.videoAd.l.AnonymousClass4 */

                public void onClick(View view) {
                    if (l.this.O.a()) {
                        l.this.n().a(com.sigmob.sdk.base.common.a.AD_CLICK_SKIP, l.this.t());
                        if (l.this.ab || l.this.J.getAd_type() == 4) {
                            l.this.n().a(com.sigmob.sdk.base.common.a.AD_SKIP, l.this.t());
                            l.this.G.b(l.this.b, l.this.t(), l.this.s(), l.this.J);
                            l.this.b(false);
                            return;
                        }
                        l.this.I.pause();
                        SigmobLog.i("videoView.pause()");
                        if (l.this.C == null) {
                            l.this.c((l) context, (Context) 4);
                        }
                        l.this.C.setduration(l.this.O.getTime());
                        l.this.C.setVisibility(0);
                        if (l.this.ad != null && l.this.ad.getFourElementsLayout() != null) {
                            l.this.ad.getFourElementsLayout().setClickable(false);
                        }
                    }
                }
            });
            if (this.G.w() != 0) {
            }
        }
        b(this.G.o(), layoutParams);
        j().addView(this.O, layoutParams);
        this.O.setOnClickListener(new View.OnClickListener() {
            /* class com.sigmob.sdk.videoAd.l.AnonymousClass4 */

            public void onClick(View view) {
                if (l.this.O.a()) {
                    l.this.n().a(com.sigmob.sdk.base.common.a.AD_CLICK_SKIP, l.this.t());
                    if (l.this.ab || l.this.J.getAd_type() == 4) {
                        l.this.n().a(com.sigmob.sdk.base.common.a.AD_SKIP, l.this.t());
                        l.this.G.b(l.this.b, l.this.t(), l.this.s(), l.this.J);
                        l.this.b(false);
                        return;
                    }
                    l.this.I.pause();
                    SigmobLog.i("videoView.pause()");
                    if (l.this.C == null) {
                        l.this.c((l) context, (Context) 4);
                    }
                    l.this.C.setduration(l.this.O.getTime());
                    l.this.C.setVisibility(0);
                    if (l.this.ad != null && l.this.ad.getFourElementsLayout() != null) {
                        l.this.ad.getFourElementsLayout().setClickable(false);
                    }
                }
            }
        });
        if (this.G.w() != 0) {
        }
    }

    private void g(Context context, int i2) {
        w wVar = new w(context, this.G.p());
        this.Z = wVar;
        wVar.setId(ClientMetadata.generateViewId());
        this.Z.setVisibility(i2);
        RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(Dips.dipsToIntPixels(30.0f, context), Dips.dipsToIntPixels(30.0f, context));
        b(this.G.p(), layoutParams);
        j().addView(this.Z, layoutParams);
        this.Z.setOnTouchListener(new View.OnTouchListener() {
            /* class com.sigmob.sdk.videoAd.l.AnonymousClass5 */

            public boolean onTouch(View view, MotionEvent motionEvent) {
                b bVar;
                float f;
                if (motionEvent.getAction() == 1) {
                    if (l.this.aa) {
                        l.this.n().a(com.sigmob.sdk.base.common.a.AD_UNMUTE, l.this.t());
                        l.this.Z.a(n.SOUND_ON.a());
                        bVar = l.this.I;
                        f = 1.0f;
                    } else {
                        l.this.n().a(com.sigmob.sdk.base.common.a.AD_MUTE, l.this.t());
                        l.this.Z.a(n.SOUND_MUTE.a());
                        bVar = l.this.I;
                        f = 0.0f;
                    }
                    bVar.setVolume(f);
                    l lVar = l.this;
                    lVar.aa = !lVar.aa;
                }
                return true;
            }
        });
        if (this.G.r() != 0) {
            this.Z.a(n.SOUND_MUTE.a());
            this.I.setVolume(0.0f);
            this.aa = true;
            return;
        }
        this.Z.a(n.SOUND_ON.a());
    }

    public static int l() {
        return 0;
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void z() {
        RelativeLayout relativeLayout = this.X;
        if (relativeLayout != null && relativeLayout.getVisibility() != 0) {
            this.x = System.currentTimeMillis();
            this.X.setVisibility(0);
            this.y = "loading";
            int i2 = this.t + 1;
            this.t = i2;
            if (i2 > 2) {
                a(t(), true);
            } else {
                this.A.postDelayed(new Runnable() {
                    /* class com.sigmob.sdk.videoAd.l.AnonymousClass12 */

                    public void run() {
                        l.this.A.removeCallbacksAndMessages(null);
                        l lVar = l.this;
                        lVar.a((l) lVar.t(), true);
                    }
                }, 5000);
            }
        }
    }

    @Override // com.sigmob.sdk.base.common.d.a
    public BaseAdUnit a() {
        return this.J;
    }

    @Override // com.sigmob.sdk.base.common.g
    public void a(int i2, int i3, Intent intent) {
        if (i3 == -1) {
            h().a();
        }
    }

    public void a(Context context) {
        this.X = new RelativeLayout(context);
        ImageView imageView = new ImageView(context);
        imageView.setImageBitmap(n.LOADING.a());
        imageView.setId(ClientMetadata.generateViewId());
        RotateAnimation rotateAnimation = new RotateAnimation(0.0f, (float) BaseConstants.Time.HOUR, 1, 0.5f, 1, 0.5f);
        rotateAnimation.setDuration((long) 8000000);
        rotateAnimation.setInterpolator(new LinearInterpolator());
        rotateAnimation.setRepeatCount(-1);
        rotateAnimation.setRepeatMode(1);
        RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(-2, -2);
        layoutParams.addRule(13);
        imageView.setAnimation(rotateAnimation);
        this.X.addView(imageView, layoutParams);
        this.X.setVisibility(4);
        RelativeLayout.LayoutParams layoutParams2 = new RelativeLayout.LayoutParams(-2, -2);
        layoutParams2.addRule(13);
        j().addView(this.X, layoutParams2);
    }

    @Override // com.sigmob.sdk.base.common.g
    public void a(Configuration configuration) {
        if (this.G != null && this.P == null) {
            h g2 = a.g(this.J);
            this.P = g2;
            g2.a(this.G);
        }
        if (n() != null) {
            n().a(com.sigmob.sdk.base.common.a.AD_ROTATION, t());
        }
    }

    @Override // com.sigmob.sdk.base.common.g
    public void a(Bundle bundle) {
        try {
            bundle.putBoolean(h, this.T);
            bundle.putInt(g, this.S);
            bundle.putBoolean(i, this.W);
        } catch (Throwable th) {
            SigmobLog.e(th.getMessage());
        }
    }

    /* access modifiers changed from: package-private */
    public void a(com.sigmob.sdk.base.common.a aVar) {
        if (com.sigmob.sdk.base.common.a.AD_START.equals(aVar)) {
            a(IntentActions.ACTION_INTERSTITIAL_SHOW);
            a(IntentActions.ACTION_REWARDED_VIDEO_PLAY);
        }
        if (n() != null) {
            n().a(aVar, t());
        }
    }

    @Override // com.sigmob.sdk.base.common.d.a
    public void a(BaseAdUnit baseAdUnit) {
        if (baseAdUnit.getUuid().equals(this.J.getUuid()) && baseAdUnit.isEndCardIndexExist()) {
            new Handler(Looper.getMainLooper()).post(new Runnable() {
                /* class com.sigmob.sdk.videoAd.l.AnonymousClass11 */

                public void run() {
                    l.this.u();
                }
            });
        }
    }

    @Override // com.sigmob.sdk.base.common.v
    public void a(boolean z2, com.sigmob.sdk.base.a aVar) {
        com.sigmob.sdk.base.common.a aVar2;
        com.sigmob.sdk.base.common.p pVar;
        this.am = true;
        K();
        if (z2) {
            int i2 = AnonymousClass13.a[aVar.ordinal()];
            if (i2 == 1) {
                ClickCommon clickCommon = this.J.getClickCommon();
                com.sigmob.sdk.base.common.x.a(com.sigmob.sdk.base.a.COMPANION, "click", this.J, clickCommon.isDeeplink, clickCommon.clickUrl, clickCommon.clickCoordinate, (long) this.V);
                pVar = n();
                aVar2 = com.sigmob.sdk.base.common.a.AD_COMPANION_CLICK;
            } else if (i2 != 2) {
                ClickCommon clickCommon2 = this.J.getClickCommon();
                com.sigmob.sdk.base.common.x.a(com.sigmob.sdk.base.a.ENDCARD, "click", this.J, clickCommon2.isDeeplink, clickCommon2.clickUrl, clickCommon2.clickCoordinate, (long) this.V);
                pVar = n();
                aVar2 = com.sigmob.sdk.base.common.a.AD_CLICK;
            } else {
                ClickCommon clickCommon3 = this.J.getClickCommon();
                com.sigmob.sdk.base.common.x.a(com.sigmob.sdk.base.a.VIDEO_CLICK, "click", this.J, clickCommon3.isDeeplink, clickCommon3.clickUrl, clickCommon3.clickCoordinate, (long) this.V);
                pVar = n();
                aVar2 = com.sigmob.sdk.base.common.a.AD_VIDEO_CLICK;
            }
            pVar.a(aVar2, t());
        }
    }

    @Override // com.sigmob.sdk.videoAd.c, com.sigmob.sdk.base.common.g
    public void b() {
        super.b();
        MaterialMeta material = this.J.getMaterial();
        this.r = ClientMetadata.getInstance().getInsetBottom();
        if (this.W) {
            H();
        } else if (this.G != null) {
            if (this.ae) {
                b(i(), 4);
            }
            if (!(material.has_companion_endcard == null || !material.has_companion_endcard.booleanValue() || material.companion == null)) {
                d(i(), 4);
                this.E = material.companion.show_delay_secs.intValue();
            }
            g(i(), 0);
            f(i(), 0);
            this.Q = new d(this, this.G, new Handler(Looper.getMainLooper()));
        } else {
            throw new IllegalStateException("BaseVideoConfig does not have a video disk path");
        }
    }

    @Override // com.sigmob.sdk.base.common.d.a
    public void b(BaseAdUnit baseAdUnit) {
    }

    public void b(boolean z2) {
        if (!this.ab) {
            c(z2);
        }
        if (this.ab || !this.G.m()) {
            if (!this.B) {
                if (z2) {
                    G();
                } else {
                    a(t());
                }
            }
            this.I.stopPlayback();
            J();
            if (z2) {
                this.J.getMacroCommon().addMarcoKey(SigMacroCommon._PLAYLASTFRAME_, "1");
                this.G.a(this.b, t(), s(), this.J);
                if (!this.U) {
                    n().a(com.sigmob.sdk.base.common.a.AD_COMPLETE, t());
                }
            }
            H();
            this.T = true;
            com.sigmob.sdk.base.common.p pVar = this.L;
            if (pVar != null) {
                pVar.a(com.sigmob.sdk.base.common.a.AD_SHOW, 0);
                return;
            }
            return;
        }
        h().a();
    }

    @Override // com.sigmob.sdk.base.common.g
    public void c() {
        if (this.Y) {
            a(IntentActions.ACTION_INTERSTITIAL_DISMISS);
        } else if (!this.W) {
            C();
        }
    }

    /* access modifiers changed from: package-private */
    public void c(boolean z2) {
        if (this.J.getAd_type() != 4) {
            this.ab = true;
            int s2 = z2 ? s() : t();
            a(IntentActions.ACTION_REWARDED_VIDEO_COMPLETE);
            n().a(com.sigmob.sdk.base.common.a.AD_FINISH, s2);
            this.G.c(i().getApplicationContext(), s2, s(), a());
        }
    }

    @Override // com.sigmob.sdk.base.common.g
    public void d() {
        if (!this.W) {
            B();
        }
    }

    @Override // com.sigmob.sdk.base.common.g
    public void e() {
        try {
            SigmobLog.d("VideoViewController onDestroy() called");
            J();
            d.e().b(this);
            if (!this.Y) {
                a(IntentActions.ACTION_INTERSTITIAL_DISMISS);
            }
            this.G.k();
            ImageLoader.ImageContainer imageContainer = this.ac;
            if (imageContainer != null) {
                imageContainer.cancelRequest();
                this.ac = null;
            }
            com.sigmob.sdk.base.common.p pVar = this.L;
            if (pVar != null) {
                pVar.a(com.sigmob.sdk.base.common.a.AD_VCLOSE, 0);
                this.L.a();
                this.L = null;
            }
            h hVar = this.P;
            if (hVar != null) {
                hVar.a((h.a) null);
            }
            if (this.I.a != null) {
                this.I.a.release();
            }
            w wVar = this.N;
            if (wVar != null) {
                wVar.setOnTouchListener(null);
            }
            com.sigmob.sdk.base.views.v vVar = this.O;
            if (vVar != null) {
                vVar.setOnTouchListener(null);
            }
            w wVar2 = this.Z;
            if (wVar2 != null) {
                wVar2.setOnTouchListener(null);
            }
            b bVar = this.I;
            if (bVar != null) {
                bVar.a();
            }
            View view = this.f136K;
            if (view != null && (view instanceof com.sigmob.sdk.base.views.k)) {
                ((com.sigmob.sdk.base.views.k) view).setWebViewClickListener(null);
            }
            this.f136K = null;
            this.M = null;
        } catch (Throwable th) {
            SigmobLog.e(th.getMessage());
        }
    }

    @Override // com.sigmob.sdk.base.common.g
    public void f() {
    }

    @Override // com.sigmob.sdk.base.common.g
    public boolean g() {
        return false;
    }

    public void m() {
        com.sigmob.sdk.base.views.a aVar = new com.sigmob.sdk.base.views.a(i(), 0);
        this.n = aVar;
        aVar.setId(ClientMetadata.generateViewId());
        RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(-2, Dips.dipsToIntPixels(16.0f, i()));
        int dipsToIntPixels = Dips.dipsToIntPixels(10.0f, this.b);
        i iVar = this.ad;
        if (iVar != null) {
            layoutParams.addRule(8, iVar.getId());
        } else {
            layoutParams.addRule(12);
            layoutParams.setMargins(0, 0, 0, dipsToIntPixels);
        }
        try {
            this.n.a(this.J.getAd_source_logo());
            if (!this.J.getInvisibleAdLabel()) {
                this.n.b(com.sigmob.sdk.base.d.g());
            }
        } catch (Throwable unused) {
        }
        j().addView(this.n, layoutParams);
    }

    public com.sigmob.sdk.base.common.p n() {
        if (this.L == null) {
            com.sigmob.sdk.base.common.p pVar = new com.sigmob.sdk.base.common.p();
            this.L = pVar;
            pVar.a(a());
        }
        return this.L;
    }

    public String o() {
        return this.D;
    }

    public boolean p() {
        try {
            long t2 = (long) t();
            if (this.G.y() > -1) {
                if ((((float) t2) / 1000.0f) + 0.3f >= ((float) this.G.y())) {
                    return true;
                }
            } else if (((float) this.R) / 1000.0f < ((float) t2) / 1000.0f) {
                return true;
            }
            return false;
        } catch (Throwable th) {
            SigmobLog.e(th.getMessage());
            return true;
        }
    }

    public boolean q() {
        i iVar = this.ad;
        if (iVar != null && iVar.a()) {
            return true;
        }
        try {
            boolean z2 = ((long) t()) / 1000 >= ((long) this.E);
            if (z2) {
                SigmobLog.d("showAble CompanionAds");
            }
            return z2;
        } catch (Throwable th) {
            SigmobLog.e("shouldBeShowCompanionAds", th);
            return true;
        }
    }

    public void r() {
        i iVar;
        if (!this.F && (iVar = this.ad) != null) {
            iVar.bringToFront();
            this.ad.setVisibility(0);
            this.F = true;
        }
    }

    /* access modifiers changed from: package-private */
    public int s() {
        b bVar = this.I;
        if (bVar == null) {
            return 0;
        }
        int i2 = this.V;
        return i2 > 0 ? this.G.b(i2) : this.G.b(bVar.getDuration());
    }

    /* access modifiers changed from: package-private */
    public int t() {
        b bVar = this.I;
        if (bVar == null) {
            return 0;
        }
        return bVar.getCurrentPosition();
    }

    /* access modifiers changed from: package-private */
    public void u() {
        if (this.f136K == null && this.J.isEndCardIndexExist()) {
            try {
                h g2 = a.g(this.J);
                this.P = g2;
                g2.a(this.G);
                this.f136K = a(k(), this.P, 4);
                this.P.a(this.V);
                e(i(), 4);
            } catch (Throwable th) {
                this.P = null;
                SigmobLog.e(th.getMessage());
                HashMap hashMap = new HashMap();
                hashMap.put("error", th.getMessage());
                a(IntentActions.ACTION_REWARDED_VIDEO_PLAYFAIL, hashMap);
                this.d.a();
            }
        }
    }

    /* access modifiers changed from: package-private */
    public void v() {
        if (this.J.getMaterial().disable_auto_deeplink.booleanValue()) {
            u();
        }
        a(t(), false);
        int s2 = (int) ((((float) (s() - t())) / 1000.0f) + 0.5f);
        this.O.a(s2);
        c cVar = this.C;
        if (cVar != null) {
            cVar.setduration(s2);
        }
    }

    /* access modifiers changed from: package-private */
    public boolean w() {
        return !this.ab && D() >= this.G.q();
    }

    /* access modifiers changed from: package-private */
    public void x() {
        int s2 = (int) ((((float) (s() - t())) / 1000.0f) + 0.5f);
        this.O.a(s2);
        c cVar = this.C;
        if (cVar != null) {
            cVar.setduration(s2);
        }
        if (this.ae) {
            this.M.a(t());
        }
    }
}