导航菜单

页面标题

页面副标题

凤凰之城 v1.0.3 - c.java 源代码

正在查看: 凤凰之城 v1.0.3 应用的 c.java JAVA 源代码文件

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


package com.octopus.ad.internal.nativead;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Matrix;
import android.graphics.SurfaceTexture;
import android.graphics.drawable.BitmapDrawable;
import android.media.MediaPlayer;
import android.os.Handler;
import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Surface;
import android.view.SurfaceHolder;
import android.view.TextureView;
import android.view.View;
import android.view.ViewGroup;
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 android.widget.VideoView;
import androidx.annotation.NonNull;
import androidx.appcompat.widget.AppCompatTextView;
import com.octopus.ad.NativeAdResponse;
import com.octopus.ad.Octopus;
import com.octopus.ad.OnSensorListener;
import com.octopus.ad.R;
import com.octopus.ad.internal.a.h;
import com.octopus.ad.internal.g;
import com.octopus.ad.internal.k;
import com.octopus.ad.internal.m;
import com.octopus.ad.internal.n;
import com.octopus.ad.internal.network.ServerResponse;
import com.octopus.ad.internal.o;
import com.octopus.ad.internal.utilities.HTTPGet;
import com.octopus.ad.internal.utilities.ImageManager;
import com.octopus.ad.internal.utilities.JsonUtil;
import com.octopus.ad.internal.utilities.UrlUtil;
import com.octopus.ad.internal.utilities.ViewUtil;
import com.octopus.ad.internal.v;
import com.octopus.ad.internal.video.a;
import com.octopus.ad.internal.view.AdViewImpl;
import com.octopus.ad.internal.view.f;
import com.octopus.ad.model.ComplianceInfo;
import com.octopus.ad.model.c;
import com.octopus.ad.utils.ThreadUtils;
import com.octopus.ad.utils.b.f;
import com.octopus.ad.utils.d;
import com.octopus.ad.utils.i;
import com.octopus.ad.utils.l;
import com.octopus.ad.widget.RegionClickView;
import com.sigmob.sdk.downloader.f;
import io.flutter.embedding.android.FlutterActivityLaunchConfigs;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

public class c implements NativeAdResponse {
    private String C;
    private HashMap<String, Object> D;
    private ServerResponse.AdLogoInfo K;
    private ServerResponse.AdLogoInfo L;
    private ServerResponse M;
    private a N;
    private Context O;
    private AppCompatTextView P;
    private c.u Q;
    private l R;
    private View S;
    private VideoView T;
    private TextureView U;
    private ImageView V;
    private LinearLayout W;
    private MediaPlayer X;
    private ProgressBar Y;
    private Handler Z;
    private NativeAdResponse.b a;
    private com.octopus.ad.a.a aA;
    private c.b aB;
    private ComplianceInfo aC;
    private Runnable aa;
    private com.octopus.ad.model.a ab;
    private String ac;
    private boolean ad;
    private boolean ae;
    private boolean af;
    private boolean ag;
    private boolean ah;
    private boolean ai;
    private int aj;
    private int ak;
    private ViewGroup al;
    private View am;
    private View an;
    private List<View> ao;
    private List<View> ap;
    private NativeAdEventListener aq;
    private com.octopus.ad.internal.video.b ar;
    private View.OnClickListener as;
    private View.OnTouchListener at;
    private View.OnClickListener au;
    private v av;
    private g aw;
    private ArrayList<m> ax;
    private List<? extends View> ay;
    private OnSensorListener az;
    private String b;
    private String c;
    private String d;
    private String e;
    private Bitmap f;
    private Bitmap g;
    private String h;
    private String i;
    private double j;
    private String k;
    private int l;
    private int m;
    private boolean n;
    private boolean o;
    private boolean p;
    private boolean q;
    private boolean s;
    private boolean t;
    private boolean v;
    private boolean w;
    private Boolean z;
    private boolean r = false;
    private boolean u = false;
    private int x = 0;
    private int y = 0;
    private boolean A = false;
    private boolean B = false;
    private boolean E = false;
    private final ArrayList<String> F = new ArrayList<>();
    private final ArrayList<String> G = new ArrayList<>();
    private final ArrayList<String> H = new ArrayList<>();
    private ArrayList<String> I = new ArrayList<>();
    private ArrayList<String> J = new ArrayList<>();

    public class AnonymousClass1 implements Runnable {
        public final float a;
        public final ImageView b;
        public final ImageView c;
        public final TextView d;
        public final ImageView e;
        public final TextView f;
        public final TextView g;
        public final FrameLayout h;
        public final ImageView i;
        public final FrameLayout j;

        public class AnonymousClass2 implements ImageManager.BitmapLoadedListener {
            public AnonymousClass2() {
            }

            @Override
            public void onBitmapLoadFailed() {
                if (c.this.aq != null) {
                    c.this.aq.onAdRenderFailed(80101);
                }
            }

            @Override
            public void onBitmapLoaded(final Bitmap bitmap) {
                d.a(c.this.O, bitmap, new d.a() {
                    @Override
                    public void a(final Bitmap bitmap2) {
                        ThreadUtils.runOnUIThread(new Runnable() {
                            @Override
                            public void run() {
                                try {
                                    if (bitmap2 != null) {
                                        AnonymousClass1.this.i.setBackground(new BitmapDrawable(c.this.O.getResources(), bitmap2));
                                    }
                                    C00051 c00051 = C00051.this;
                                    AnonymousClass1.this.i.setImageBitmap(bitmap);
                                    if (c.this.Y != null) {
                                        c.this.Y.setVisibility(8);
                                    }
                                    c.this.u();
                                } catch (Exception unused) {
                                    if (c.this.aq != null) {
                                        c.this.aq.onAdRenderFailed(80101);
                                    }
                                }
                            }
                        });
                    }
                });
            }
        }

        public AnonymousClass1(float f, ImageView imageView, ImageView imageView2, TextView textView, ImageView imageView3, TextView textView2, TextView textView3, FrameLayout frameLayout, ImageView imageView4, FrameLayout frameLayout2) {
            this.a = f;
            this.b = imageView;
            this.c = imageView2;
            this.d = textView;
            this.e = imageView3;
            this.f = textView2;
            this.g = textView3;
            this.h = frameLayout;
            this.i = imageView4;
            this.j = frameLayout2;
        }

        @Override
        public void run() {
            if (c.this.al == null) {
                return;
            }
            if (c.this.aj <= 0) {
                c cVar = c.this;
                cVar.aj = cVar.am.getWidth();
                if (c.this.aj <= 0) {
                    c cVar2 = c.this;
                    cVar2.aj = ViewUtil.getScreenWidth(cVar2.am.getContext());
                    c.this.am.getLayoutParams().width = c.this.aj;
                }
                c.this.am.getLayoutParams().height = (int) (c.this.aj / this.a);
            }
            Log.i("native_size", "adWidth:" + c.this.aj + "  adHeight:" + c.this.am.getLayoutParams().height);
            int px2dip = ViewUtil.px2dip(c.this.al.getContext(), (float) c.this.aj);
            float f = px2dip > 0 ? px2dip / 360.0f : 1.0f;
            float f4 = f <= 1.0f ? f : 1.0f;
            ArrayList arrayList = new ArrayList();
            arrayList.add(this.b);
            arrayList.add(this.c);
            arrayList.add(this.d);
            arrayList.add(this.e);
            arrayList.add(this.f);
            arrayList.add(this.g);
            arrayList.add(c.this.Y);
            c.this.a((ArrayList<View>) arrayList, f4);
            if (c.this.aC != null) {
                c cVar3 = c.this;
                cVar3.P = ViewUtil.createComplianceView(cVar3.al.getContext(), c.this.aC, f4, true);
                if (c.this.x == 3 || c.this.x == 4) {
                    c.this.P.post(new Runnable() {
                        @Override
                        public void run() {
                            c.this.am.getLayoutParams().height += c.this.P.getHeight();
                        }
                    });
                }
            }
            if (c.this.isVideo()) {
                if (!c.this.getVideoUrls().isEmpty()) {
                    this.h.setBackgroundColor(com.sigmob.sdk.base.blurkit.d.a);
                    if (c.this.ae) {
                        c.this.U.setVisibility(0);
                        c.this.p();
                    } else {
                        c.this.T.setVisibility(0);
                        c.this.o();
                    }
                }
            } else if (!TextUtils.isEmpty(c.this.getImageUrl())) {
                ImageManager.with(null).getBitmap(c.this.getImageUrl(), new AnonymousClass2());
            }
            c.this.a(this.j);
            c.this.a((ViewGroup) this.h);
            c.this.a(this.f);
            c.this.e();
            if (c.this.M != null) {
                final String replaceFeedBackUrl = UrlUtil.replaceFeedBackUrl("https://www.adintl.cn/sdkFeedback.html?slotId=${SLOT_ID}&sdkVersion=${SDK_VERSION}&deviceId=${DEVICE_ID}", c.this.M.b(), Octopus.getOaid(c.this.O));
                this.g.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        ViewUtil.openLocalBrowser(replaceFeedBackUrl, 0);
                    }
                });
            }
        }
    }

    public class AnonymousClass7 implements ImageManager.BitmapLoadedListener {
        public final Context a;

        public AnonymousClass7(Context context) {
            this.a = context;
        }

        @Override
        public void onBitmapLoadFailed() {
        }

        @Override
        public void onBitmapLoaded(final Bitmap bitmap) {
            d.a(this.a, bitmap, new d.a() {
                @Override
                public void a(final Bitmap bitmap2) {
                    ThreadUtils.runOnUIThread(new Runnable() {
                        @Override
                        public void run() {
                            try {
                                if (bitmap2 != null) {
                                    c.this.V.setBackground(new BitmapDrawable(AnonymousClass7.this.a.getResources(), bitmap2));
                                }
                                c.this.V.setImageBitmap(bitmap);
                            } catch (Exception e) {
                                f.a("OctopusAd", "An Exception Caught", e);
                            }
                        }
                    });
                }
            });
        }
    }

    public void addShakeView(final ViewGroup viewGroup, final int i, final float f) {
        if (viewGroup == null) {
            return;
        }
        viewGroup.post(new Runnable() {
            @Override
            public void run() {
                if (c.this.Q == null || c.this.Q.a() == 0) {
                    c.this.Q = new c.u(1.5d, 0.0d, 0, "摇动或点击了解更多", 1, 0, 0);
                }
                c.this.a(viewGroup, i, f);
            }
        });
    }

    public void bindUnifiedView(ViewGroup viewGroup, List<View> list, NativeAdEventListener nativeAdEventListener) {
        bindUnifiedView(viewGroup, list, null, nativeAdEventListener);
    }

    public void bindView(ViewGroup viewGroup, NativeAdEventListener nativeAdEventListener) {
        this.ah = true;
        this.al = viewGroup;
        this.aq = nativeAdEventListener;
        j();
    }

    public void destroy() {
        this.o = true;
        this.E = true;
        v();
        g gVar = this.aw;
        if (gVar != null) {
            gVar.a();
        }
        l lVar = this.R;
        if (lVar != null) {
            lVar.a();
            this.R = null;
        }
        Handler handler = this.Z;
        if (handler != null) {
            handler.removeCallbacksAndMessages(null);
            this.Z = null;
        }
        v vVar = this.av;
        if (vVar != null) {
            vVar.c();
            this.av = null;
        }
        ServerResponse serverResponse = this.M;
        if (serverResponse != null) {
            serverResponse.ac();
            this.M = null;
        }
        Bitmap bitmap = this.g;
        if (bitmap != null) {
            bitmap.recycle();
            this.g = null;
        }
        Bitmap bitmap2 = this.f;
        if (bitmap2 != null) {
            bitmap2.recycle();
            this.f = null;
        }
        MediaPlayer mediaPlayer = this.X;
        if (mediaPlayer != null) {
            mediaPlayer.release();
            this.X = null;
        }
        this.aa = null;
        this.an = null;
        this.ao = null;
        this.ap = null;
        this.al = null;
        this.ax = null;
        this.aq = null;
    }

    public String getAdvertiser() {
        return this.C;
    }

    public View getBlurView(Context context) {
        return b(context);
    }

    public String getButtonText() {
        return TextUtils.isEmpty(this.i) ? "查看详情" : this.i;
    }

    public ComplianceInfo getComplianceInfo() {
        return this.aC;
    }

    public View getComplianceView(Context context) {
        ComplianceInfo complianceInfo = this.aC;
        if (complianceInfo != null) {
            return ViewUtil.createComplianceView(context, complianceInfo, 1.0f, true);
        }
        return null;
    }

    public String getDescription() {
        return this.c;
    }

    public Bitmap getIcon() {
        return this.g;
    }

    public String getIconUrl() {
        return this.e;
    }

    public Bitmap getImage() {
        return this.f;
    }

    public String getImageUrl() {
        return this.d;
    }

    public ArrayList<String> getImageUrls() {
        return this.F;
    }

    public int getInteractionType() {
        c.b bVar = this.aB;
        if (bVar != null) {
            return bVar.d();
        }
        return 4;
    }

    public String getLandingPageUrl() {
        return this.h;
    }

    @NonNull
    public Bitmap getLogo(@NonNull Context context) {
        return BitmapFactory.decodeResource(context.getResources(), R.drawable.oct_logo);
    }

    public ServerResponse.AdLogoInfo getLogoInfo() {
        return this.L;
    }

    public String getLogoUrl() {
        ServerResponse.AdLogoInfo adLogoInfo = this.L;
        if (adLogoInfo == null || adLogoInfo.getType() != ServerResponse.AdLogoInfo.TYPE_PIC) {
            return null;
        }
        return this.L.getAdurl();
    }

    public int getMaterialType() {
        return isVideo() ? 2 : 1;
    }

    public Map<String, Object> getMediaExtraInfo() {
        ServerResponse serverResponse = this.M;
        return serverResponse != null ? serverResponse.T() : Collections.emptyMap();
    }

    public NativeAdResponse.b getNativeAdType() {
        return this.a;
    }

    public HashMap<String, Object> getNativeElements() {
        return this.D;
    }

    public List<? extends View> getNativeInfoListView() {
        return this.ay;
    }

    public View getNativeView() {
        return this.al;
    }

    public NativeAdResponse.a getNetworkIdentifier() {
        return NativeAdResponse.a.a;
    }

    public int getPictureHeight() {
        ServerResponse serverResponse = this.M;
        if (serverResponse != null) {
            return serverResponse.k();
        }
        return 0;
    }

    public int getPictureWidth() {
        ServerResponse serverResponse = this.M;
        if (serverResponse != null) {
            return serverResponse.l();
        }
        return 0;
    }

    public int getPrice() {
        return this.l;
    }

    public double getStarRating() {
        return this.j;
    }

    public String getStore() {
        return this.k;
    }

    public ArrayList<String> getTextList() {
        return this.H;
    }

    @NonNull
    public Bitmap getTextLogo(@NonNull Context context) {
        return BitmapFactory.decodeResource(context.getResources(), R.drawable.oct_logo_text);
    }

    public ServerResponse.AdLogoInfo getTextLogoInfo() {
        return this.K;
    }

    public String getTextLogoUrl() {
        ServerResponse.AdLogoInfo adLogoInfo = this.K;
        if (adLogoInfo == null || adLogoInfo.getType() != ServerResponse.AdLogoInfo.TYPE_PIC) {
            return null;
        }
        return this.K.getAdurl();
    }

    public String getTitle() {
        return this.b;
    }

    public ArrayList<String> getVideoUrls() {
        return this.G;
    }

    public View getVideoView(Context context) {
        if (context == null || !isVideo() || getVideoUrls().isEmpty()) {
            return null;
        }
        if (this.ae) {
            if (this.U == null) {
                this.U = new TextureView(context);
                p();
            }
            return this.U;
        }
        if (this.T == null) {
            this.T = new VideoView(context);
            o();
        }
        return this.T;
    }

    public boolean hasExpired() {
        return this.E;
    }

    public boolean isShakeAd() {
        return this.ag;
    }

    public boolean isVideo() {
        return this.af;
    }

    public void setAdWidth(int i) {
        this.aj = i;
    }

    public void setIcon(Bitmap bitmap) {
        this.g = bitmap;
    }

    public void setImage(Bitmap bitmap) {
        this.f = bitmap;
    }

    public void setNativeAdEventListener(NativeAdEventListener nativeAdEventListener) {
        if (this.O == null) {
            this.O = o.a().k();
        }
        this.ah = false;
        FrameLayout frameLayout = new FrameLayout(this.O);
        this.al = frameLayout;
        frameLayout.setLayoutParams(new ViewGroup.LayoutParams(-1, -1));
        this.aq = nativeAdEventListener;
        ServerResponse serverResponse = this.M;
        if (serverResponse != null) {
            if (serverResponse.i() == n.DRAW) {
                l();
            } else if (this.M.i() == n.BANNER) {
                m();
            } else {
                j();
            }
        }
    }

    public void setNativeInfoListView(List<? extends View> list) {
        this.ay = list;
    }

    public void setOnSensorListener(OnSensorListener onSensorListener) {
        this.az = onSensorListener;
    }

    public void setVideoStateListener(com.octopus.ad.internal.video.b bVar) {
        this.ar = bVar;
    }

    public void showCloseButton(boolean z) {
        this.t = z;
    }

    public void unregisterViews() {
        View view = this.an;
        if (view != null) {
            view.setOnClickListener(null);
        }
        List<View> list = this.ao;
        if (list != null && !list.isEmpty()) {
            for (View view2 : this.ao) {
                if (view2 != null) {
                    view2.setOnClickListener(null);
                }
            }
        }
        List<View> list2 = this.ap;
        if (list2 != null && !list2.isEmpty()) {
            for (View view3 : this.ap) {
                if (view3 != null) {
                    view3.setOnClickListener(null);
                }
            }
        }
        destroy();
    }

    private void A() {
        this.au = new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (c.this.M != null) {
                    c cVar = c.this;
                    cVar.B = cVar.M.O();
                }
                if (c.this.B && !c.this.p) {
                    c.this.y = 2;
                    c cVar2 = c.this;
                    cVar2.a(cVar2.t());
                    return;
                }
                if (c.this.aq != null) {
                    c.this.aq.onAdClose();
                }
                if (c.this.M != null) {
                    c.this.M.U();
                }
                if (c.this.al != null) {
                    if (c.this.ah) {
                        c.this.al.removeAllViews();
                    } else {
                        ViewUtil.removeChildFromParent(c.this.al);
                    }
                }
                c.this.destroy();
            }
        };
    }

    public void g(boolean z) {
        NativeAdEventListener nativeAdEventListener;
        ServerResponse serverResponse;
        if (this.ad) {
            return;
        }
        this.ad = true;
        if (z && (serverResponse = this.M) != null) {
            z = serverResponse.L();
        }
        if (z && (nativeAdEventListener = this.aq) != null) {
            nativeAdEventListener.onADExposed();
        }
        if (this.ab == null || !f().equals(this.ab.a())) {
            return;
        }
        o.a().g.remove(this.ab.b());
    }

    private void j() {
        if (this.al == null) {
            NativeAdEventListener nativeAdEventListener = this.aq;
            if (nativeAdEventListener != null) {
                nativeAdEventListener.onAdRenderFailed(80101);
                return;
            }
            return;
        }
        s();
        int i = this.x;
        if (i == 1) {
            a(R.layout.oct_native_text_above_img, 1.4f);
            return;
        }
        if (i == 2) {
            a(R.layout.oct_native_text_below_img, 1.4f);
            return;
        }
        if (i == 3) {
            a(R.layout.oct_native_text_right_img, 4.74f);
        } else if (i != 4) {
            a(R.layout.oct_native_one_img, 1.78f);
        } else {
            a(R.layout.oct_native_text_left_img, 4.74f);
        }
    }

    private void k() {
        if (this.al != null) {
            e();
            s();
        } else {
            NativeAdEventListener nativeAdEventListener = this.aq;
            if (nativeAdEventListener != null) {
                nativeAdEventListener.onAdRenderFailed(80101);
            }
        }
    }

    private void l() {
        if (this.al == null) {
            NativeAdEventListener nativeAdEventListener = this.aq;
            if (nativeAdEventListener != null) {
                nativeAdEventListener.onAdRenderFailed(80101);
                return;
            }
            return;
        }
        s();
        View inflate = LayoutInflater.from(this.al.getContext()).inflate(R.layout.oct_layout_draw, this.al);
        this.am = inflate;
        this.aj = ViewUtil.getScreenWidth(inflate.getContext());
        a(1.0f);
    }

    private void m() {
        if (this.al != null) {
            s();
            a(isVideo() ? R.layout.oct_layout_banner_video : R.layout.oct_layout_banner, 6.4f);
        } else {
            NativeAdEventListener nativeAdEventListener = this.aq;
            if (nativeAdEventListener != null) {
                nativeAdEventListener.onAdRenderFailed(80101);
            }
        }
    }

    private void n() {
        ViewGroup viewGroup = this.al;
        if (viewGroup != null) {
            viewGroup.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    try {
                        if (c.this.isVideo()) {
                            if (c.this.ae) {
                                if (c.this.X != null) {
                                    if (c.this.X.isPlaying()) {
                                        c.this.X.pause();
                                        c.this.u = true;
                                        if (c.this.ar != null) {
                                            c.this.ar.c();
                                        }
                                    } else {
                                        c.this.X.start();
                                        c.this.u = false;
                                        if (c.this.ar != null) {
                                            c.this.ar.d();
                                        }
                                    }
                                }
                            } else if (c.this.T != null) {
                                if (c.this.T.isPlaying()) {
                                    c.this.T.pause();
                                    c.this.u = true;
                                    if (c.this.ar != null) {
                                        c.this.ar.c();
                                    }
                                } else {
                                    c.this.T.start();
                                    c.this.u = false;
                                    if (c.this.ar != null) {
                                        c.this.ar.d();
                                    }
                                }
                            }
                        }
                    } catch (Exception e) {
                        f.a("OctopusAd", "An Exception Caught", e);
                    }
                }
            });
        }
    }

    public void o() {
        if (this.T == null) {
            return;
        }
        this.Z = new Handler();
        this.aa = new Runnable() {
            @Override
            public void run() {
                if (c.this.T == null || c.this.T.getDuration() <= 0) {
                    return;
                }
                int duration = c.this.T.getDuration();
                c cVar = c.this;
                cVar.ak = cVar.T.getCurrentPosition();
                if (!c.this.T.isPlaying()) {
                    if (c.this.ak <= 0 || c.this.ai || c.this.M == null) {
                        return;
                    }
                    c.this.M.Z();
                    return;
                }
                c.this.r();
                f.a("OctopusAd", "currentPosition:" + c.this.ak + FlutterActivityLaunchConfigs.DEFAULT_INITIAL_ROUTE + duration);
                int i = 0;
                if (c.this.ak / 1000 == duration / 4000) {
                    i = 1;
                } else if (c.this.ak / 1000 == duration / f.a.f) {
                    i = 2;
                } else if (c.this.ak / 1000 == (duration * 3) / 4000) {
                    i = 3;
                }
                if (i > 0 && c.this.M != null) {
                    c.this.M.b(i);
                }
                com.octopus.ad.utils.b.f.a("OctopusAd", "video progress:" + i);
            }
        };
        this.T.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
            @Override
            public void onCompletion(MediaPlayer mediaPlayer) {
                c.this.ai = true;
                c.this.ak = 0;
                if (c.this.M != null) {
                    c.this.M.aa();
                }
                if (c.this.ar != null) {
                    c.this.ar.e();
                }
            }
        });
        this.T.setOnErrorListener(new MediaPlayer.OnErrorListener() {
            @Override
            public boolean onError(MediaPlayer mediaPlayer, int i, int i4) {
                if (c.this.ar == null) {
                    return true;
                }
                c.this.ar.a(i, i4);
                return true;
            }
        });
        this.T.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
            @Override
            public void onPrepared(MediaPlayer mediaPlayer) {
                float f = o.a().f();
                if (c.this.M != null && c.this.M.w() && o.a().g()) {
                    mediaPlayer.setVolume(com.sigmob.sdk.base.blurkit.c.d, com.sigmob.sdk.base.blurkit.c.d);
                } else if (f > com.sigmob.sdk.base.blurkit.c.d) {
                    mediaPlayer.setVolume(f, f);
                } else {
                    mediaPlayer.setVolume(1.0f, 1.0f);
                }
                if (c.this.Y != null) {
                    c.this.Y.setVisibility(8);
                }
                if (c.this.M != null) {
                    c.this.M.Y();
                }
                if (c.this.ar != null) {
                    c.this.ar.b();
                }
                c.this.r();
                c.this.u();
                c cVar = c.this;
                cVar.b(cVar.T);
            }
        });
        this.T.getHolder().addCallback(new SurfaceHolder.Callback() {
            @Override
            public void surfaceChanged(@NonNull SurfaceHolder surfaceHolder, int i, int i4, int i5) {
            }

            @Override
            public void surfaceCreated(@NonNull SurfaceHolder surfaceHolder) {
                if (c.this.T == null || c.this.T.isPlaying()) {
                    return;
                }
                if (c.this.ak > 0) {
                    c.this.T.seekTo(c.this.ak);
                }
                c.this.T.start();
                if (c.this.Y != null) {
                    c.this.Y.setVisibility(0);
                }
                if (c.this.ar != null) {
                    c.this.ar.a();
                }
            }

            @Override
            public void surfaceDestroyed(@NonNull SurfaceHolder surfaceHolder) {
            }
        });
        c();
    }

    public void p() {
        TextureView textureView = this.U;
        if (textureView == null) {
            return;
        }
        textureView.setSurfaceTextureListener(new TextureView.SurfaceTextureListener() {
            @Override
            public void onSurfaceTextureAvailable(@NonNull SurfaceTexture surfaceTexture, int i, int i4) {
                Surface surface = new Surface(surfaceTexture);
                c.this.X = new MediaPlayer();
                c.this.X.setSurface(surface);
                c.this.X.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
                    @Override
                    public void onCompletion(MediaPlayer mediaPlayer) {
                        c.this.ai = true;
                        c.this.ak = 0;
                        if (c.this.M != null) {
                            c.this.M.aa();
                        }
                        if (c.this.ar != null) {
                            c.this.ar.e();
                        }
                    }
                });
                c.this.X.setOnErrorListener(new MediaPlayer.OnErrorListener() {
                    @Override
                    public boolean onError(MediaPlayer mediaPlayer, int i5, int i6) {
                        if (c.this.ar == null) {
                            return true;
                        }
                        c.this.ar.a(i5, i6);
                        return true;
                    }
                });
                c.this.X.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
                    @Override
                    public void onPrepared(MediaPlayer mediaPlayer) {
                        c.this.q();
                        float f = o.a().f();
                        if (c.this.M != null && c.this.M.w() && o.a().g()) {
                            mediaPlayer.setVolume(com.sigmob.sdk.base.blurkit.c.d, com.sigmob.sdk.base.blurkit.c.d);
                        } else if (f > com.sigmob.sdk.base.blurkit.c.d) {
                            mediaPlayer.setVolume(f, f);
                        } else {
                            mediaPlayer.setVolume(1.0f, 1.0f);
                        }
                        if (c.this.Y != null) {
                            c.this.Y.setVisibility(8);
                        }
                        if (c.this.M != null) {
                            c.this.M.Y();
                        }
                        if (c.this.ar != null) {
                            c.this.ar.b();
                        }
                        c.this.r();
                        c.this.u();
                        c cVar = c.this;
                        cVar.b(cVar.U);
                    }
                });
                c.this.d();
            }

            @Override
            public boolean onSurfaceTextureDestroyed(@NonNull SurfaceTexture surfaceTexture) {
                if (c.this.Z != null) {
                    c.this.Z.removeCallbacksAndMessages(null);
                    c.this.Z = null;
                }
                if (c.this.X != null) {
                    c.this.X.release();
                    c.this.X = null;
                }
                c.this.aa = null;
                return true;
            }

            @Override
            public void onSurfaceTextureSizeChanged(@NonNull SurfaceTexture surfaceTexture, int i, int i4) {
            }

            @Override
            public void onSurfaceTextureUpdated(@NonNull SurfaceTexture surfaceTexture) {
            }
        });
        this.Z = new Handler();
        this.aa = new Runnable() {
            @Override
            public void run() {
                if (c.this.X == null || c.this.X.getDuration() <= 0) {
                    return;
                }
                int duration = c.this.X.getDuration();
                c cVar = c.this;
                cVar.ak = cVar.X.getCurrentPosition();
                if (!c.this.X.isPlaying()) {
                    if (c.this.ak <= 0 || c.this.ai || c.this.M == null) {
                        return;
                    }
                    c.this.M.Z();
                    return;
                }
                c.this.r();
                com.octopus.ad.utils.b.f.a("OctopusAd", "currentPosition:" + c.this.ak + FlutterActivityLaunchConfigs.DEFAULT_INITIAL_ROUTE + duration);
                int i = 0;
                if (c.this.ak / 1000 == duration / 4000) {
                    i = 1;
                } else if (c.this.ak / 1000 == duration / f.a.f) {
                    i = 2;
                } else if (c.this.ak / 1000 == (duration * 3) / 4000) {
                    i = 3;
                }
                if (i > 0 && c.this.M != null) {
                    c.this.M.b(i);
                }
                com.octopus.ad.utils.b.f.a("OctopusAd", "video progress:" + i);
            }
        };
    }

    public void q() {
        Matrix a;
        TextureView textureView = this.U;
        if (textureView == null || this.X == null || (a = new com.octopus.ad.internal.video.a(new a.c(textureView.getWidth(), this.U.getHeight()), new a.c(this.X.getVideoWidth(), this.X.getVideoHeight())).a(a.b.FIT_CENTER)) == null) {
            return;
        }
        this.U.setTransform(a);
    }

    public void r() {
        Handler handler = this.Z;
        if (handler == null || this.aa == null) {
            return;
        }
        handler.removeCallbacksAndMessages(null);
        this.Z.postDelayed(this.aa, 1000L);
    }

    private void s() {
        ServerResponse serverResponse;
        c.o F;
        if (this.al == null || (serverResponse = this.M) == null || this.Q != null || (F = serverResponse.F()) == null) {
            return;
        }
        c.u c = F.c();
        this.Q = c;
        if (c == null || c.a() != 1) {
            return;
        }
        b(this.al);
    }

    public com.octopus.ad.model.d t() {
        int screenWidth;
        float f;
        int i;
        try {
            float f4 = 1.4f;
            if (!this.r && !this.n) {
                ViewGroup viewGroup = this.al;
                screenWidth = 0;
                if (viewGroup != null) {
                    screenWidth = viewGroup.getWidth();
                    i = this.al.getHeight();
                } else {
                    i = 0;
                }
                if (screenWidth == 0 || i == 0) {
                    screenWidth = ViewUtil.getScreenWidth(o.a().k());
                    f = screenWidth;
                    i = (int) (f / f4);
                }
                int a = i.a(screenWidth);
                int a5 = i.a(i);
                int a6 = i.a(150) + 50;
                com.octopus.ad.model.d dVar = new com.octopus.ad.model.d(1);
                float f5 = a;
                dVar.a(f5);
                float f6 = a5;
                dVar.b(f6);
                dVar.a(String.valueOf(System.currentTimeMillis()));
                dVar.c(f5);
                dVar.d(f6);
                dVar.b(String.valueOf(System.currentTimeMillis() + a6));
                dVar.a(screenWidth);
                dVar.b(i);
                return dVar;
            }
            screenWidth = ViewUtil.getScreenWidth(o.a().k());
            f = screenWidth;
            int i4 = (int) (f / 1.4f);
            ServerResponse serverResponse = this.M;
            if (serverResponse != null) {
                if (serverResponse.i() == n.DRAW) {
                    i = ViewUtil.getScreenHeight(o.a().k());
                    int a7 = i.a(screenWidth);
                    int a52 = i.a(i);
                    int a62 = i.a(150) + 50;
                    com.octopus.ad.model.d dVar2 = new com.octopus.ad.model.d(1);
                    float f52 = a7;
                    dVar2.a(f52);
                    float f62 = a52;
                    dVar2.b(f62);
                    dVar2.a(String.valueOf(System.currentTimeMillis()));
                    dVar2.c(f52);
                    dVar2.d(f62);
                    dVar2.b(String.valueOf(System.currentTimeMillis() + a62));
                    dVar2.a(screenWidth);
                    dVar2.b(i);
                    return dVar2;
                }
                if (this.M.i() == n.BANNER) {
                    f4 = 6.4f;
                    i = (int) (f / f4);
                    int a72 = i.a(screenWidth);
                    int a522 = i.a(i);
                    int a622 = i.a(150) + 50;
                    com.octopus.ad.model.d dVar22 = new com.octopus.ad.model.d(1);
                    float f522 = a72;
                    dVar22.a(f522);
                    float f622 = a522;
                    dVar22.b(f622);
                    dVar22.a(String.valueOf(System.currentTimeMillis()));
                    dVar22.c(f522);
                    dVar22.d(f622);
                    dVar22.b(String.valueOf(System.currentTimeMillis() + a622));
                    dVar22.a(screenWidth);
                    dVar22.b(i);
                    return dVar22;
                }
            }
            i = i4;
            int a722 = i.a(screenWidth);
            int a5222 = i.a(i);
            int a6222 = i.a(150) + 50;
            com.octopus.ad.model.d dVar222 = new com.octopus.ad.model.d(1);
            float f5222 = a722;
            dVar222.a(f5222);
            float f6222 = a5222;
            dVar222.b(f6222);
            dVar222.a(String.valueOf(System.currentTimeMillis()));
            dVar222.c(f5222);
            dVar222.d(f6222);
            dVar222.b(String.valueOf(System.currentTimeMillis() + a6222));
            dVar222.a(screenWidth);
            dVar222.b(i);
            return dVar222;
        } catch (Exception e) {
            com.octopus.ad.utils.b.f.a("OctopusAd", "An Exception Caught", e);
            return null;
        }
    }

    public void u() {
        ServerResponse serverResponse;
        if (this.w || this.am == null || (serverResponse = this.M) == null || serverResponse.i() != n.DRAW) {
            return;
        }
        this.w = true;
        c.y g = this.M.g();
        if (g == null || g.a() != 1) {
            return;
        }
        this.W = (LinearLayout) this.am.findViewById(R.id.rl_auto);
        final TextView textView = (TextView) this.am.findViewById(R.id.tv_auto);
        TextView textView2 = (TextView) this.am.findViewById(R.id.tv_stop);
        this.W.setVisibility(0);
        com.octopus.ad.a.a aVar = new com.octopus.ad.a.a(g.b() * 1000, 50L);
        this.aA = aVar;
        aVar.a(new com.octopus.ad.a.b() {
            public void a(long j) {
                int i = (int) ((j / 1000) + 1);
                textView.setText(String.format(Locale.US, "%d秒后自动跳转详情页", Integer.valueOf(i)));
                if (i <= 3) {
                    textView.setBackgroundResource(R.drawable.oct_bg_common_orange);
                }
            }

            public void b() {
            }

            public void a() {
                c.this.y = 3;
                c.this.q = true;
                c cVar = c.this;
                cVar.a(cVar.t());
                c.this.v();
            }
        });
        this.aA.a();
        textView2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                c.this.v();
            }
        });
    }

    public void v() {
        com.octopus.ad.a.a aVar = this.aA;
        if (aVar != null) {
            aVar.d();
        }
        LinearLayout linearLayout = this.W;
        if (linearLayout != null) {
            linearLayout.setVisibility(8);
        }
    }

    public void w() {
        ArrayList<String> arrayList = this.I;
        if (arrayList == null) {
            return;
        }
        Iterator<String> it = arrayList.iterator();
        while (it.hasNext()) {
            String next = it.next();
            if (next.contains("?rv=1")) {
                ViewUtil.openLocalBrowser(next, 0);
            } else {
                if (next.contains("track=oct")) {
                    if (this.n) {
                        next = next + "&opt=10";
                    } else if (this.r) {
                        next = next + "&opt=1";
                    }
                }
                new com.octopus.ad.internal.i(next).execute();
            }
        }
    }

    private void x() {
        ServerResponse serverResponse = this.M;
        if (serverResponse != null) {
            this.A = serverResponse.N();
        }
        y();
        z();
        A();
        List<View> list = this.ao;
        if (list == null || list.isEmpty()) {
            ViewGroup viewGroup = this.al;
            if (viewGroup != null) {
                viewGroup.setOnClickListener(this.as);
                this.al.setOnTouchListener(this.at);
            }
        } else {
            for (View view : this.ao) {
                if (view != null) {
                    view.setOnClickListener(this.as);
                    view.setOnTouchListener(this.at);
                }
            }
        }
        List<View> list2 = this.ap;
        if (list2 == null || list2.isEmpty()) {
            return;
        }
        for (View view2 : this.ap) {
            if (view2 != null) {
                view2.setOnClickListener(this.au);
            }
        }
    }

    private void y() {
        this.as = new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                c cVar = c.this;
                cVar.a(cVar.t());
            }
        };
    }

    private void z() {
        this.at = new com.octopus.ad.internal.view.f(this.al, this.A, new f.a() {
            @Override
            public void a(View view, com.octopus.ad.model.d dVar) {
                c.this.a(dVar);
            }
        });
    }

    public void bindUnifiedView(ViewGroup viewGroup, List<View> list, List<View> list2, NativeAdEventListener nativeAdEventListener) {
        this.ah = true;
        this.al = viewGroup;
        this.aq = nativeAdEventListener;
        this.ao = list;
        this.ap = list2;
        k();
    }

    public void h() {
        c.w G;
        c.p c;
        ServerResponse serverResponse = this.M;
        if (serverResponse == null || (G = serverResponse.G()) == null || (c = G.c()) == null) {
            return;
        }
        if (c.a() == 1) {
            e(true);
            new Handler().postDelayed(new Runnable() {
                @Override
                public void run() {
                    c.this.w();
                }
            }, c.c());
            if (c.b() == 1) {
                this.q = true;
                final k.a aVar = new k.a() {
                    @Override
                    public void a(String str) {
                        if ("AppBackground".equals(str)) {
                            c.this.s = true;
                        }
                    }
                };
                k.a().a(aVar);
                new Handler().postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        if (!c.this.s) {
                            c cVar = c.this;
                            cVar.a(cVar.t());
                        }
                        k.a().b(aVar);
                    }
                }, c.d());
            }
        }
    }

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

    public void d() {
        String str = getVideoUrls().get(0);
        if (this.X == null || TextUtils.isEmpty(str)) {
            return;
        }
        try {
            h b = o.a().b();
            if (b != null) {
                String a = b.a(str);
                if (b.b(str)) {
                    str = a;
                }
            }
            this.X.setDataSource(str);
            this.X.prepare();
            this.X.start();
            com.octopus.ad.internal.video.b bVar = this.ar;
            if (bVar != null) {
                bVar.a();
            }
        } catch (Exception e) {
            com.octopus.ad.utils.b.f.a("OctopusAd", "An Exception Caught", e);
            NativeAdEventListener nativeAdEventListener = this.aq;
            if (nativeAdEventListener != null) {
                nativeAdEventListener.onAdRenderFailed(80202);
            }
        }
    }

    public void e() {
        x();
        a(new NativeAdShownListener() {
            @Override
            public void onAdShown(boolean z) {
                c.this.g(z);
            }
        });
    }

    public String f() {
        if (this.ac == null) {
            this.ac = "";
        }
        return this.ac;
    }

    public View getComplianceView(Context context, int i) {
        if (this.aC == null) {
            return null;
        }
        float screenWidthDp = ViewUtil.getScreenWidthDp(context);
        float f = 1.0f;
        if (screenWidthDp > com.sigmob.sdk.base.blurkit.c.d && i > 0) {
            float f4 = i;
            if (screenWidthDp > f4) {
                f = f4 / screenWidthDp;
            }
        }
        return ViewUtil.createComplianceView(context, this.aC, f, true);
    }

    public void c() {
        String str = getVideoUrls().get(0);
        if (this.T == null || TextUtils.isEmpty(str)) {
            return;
        }
        try {
            h b = o.a().b();
            if (b != null) {
                String a = b.a(str);
                if (b.b(str)) {
                    this.T.setVideoPath(a);
                } else {
                    this.T.setVideoPath(str);
                }
            } else {
                this.T.setVideoPath(str);
            }
        } catch (Exception e) {
            com.octopus.ad.utils.b.f.a("OctopusAd", "An Exception Caught", e);
            NativeAdEventListener nativeAdEventListener = this.aq;
            if (nativeAdEventListener != null) {
                nativeAdEventListener.onAdRenderFailed(80202);
            }
        }
    }

    public void b(ServerResponse.AdLogoInfo adLogoInfo) {
        this.L = adLogoInfo;
    }

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

    public String b() {
        ServerResponse serverResponse = this.M;
        return serverResponse != null ? serverResponse.c() : "";
    }

    public void f(boolean z) {
        ServerResponse serverResponse = this.M;
        if (serverResponse != null) {
            serverResponse.a(z);
        }
    }

    public void b(View view) {
        ServerResponse serverResponse;
        if (view == null || (serverResponse = this.M) == null || serverResponse.i() != n.DRAW || this.aw != null) {
            return;
        }
        this.aw = g.a(view, new NativeAdShownListener() {
            @Override
            public void onAdShown(boolean z) {
                try {
                    if (c.this.ae) {
                        if (c.this.X != null) {
                            if (z) {
                                if (!c.this.u && !c.this.X.isPlaying()) {
                                    c.this.X.start();
                                }
                            } else if (c.this.X.isPlaying()) {
                                c.this.X.pause();
                            }
                        }
                    } else if (z) {
                        if (!c.this.u && !c.this.T.isPlaying()) {
                            c.this.T.start();
                        }
                    } else if (c.this.T.isPlaying()) {
                        c.this.T.pause();
                    }
                } catch (Exception e) {
                    com.octopus.ad.utils.b.f.a("OctopusAd", "An Exception Caught", e);
                }
            }
        });
    }

    public void g() {
        ServerResponse serverResponse;
        c.w G;
        c.p c;
        if (this.r || (serverResponse = this.M) == null || (G = serverResponse.G()) == null || (c = G.c()) == null) {
            return;
        }
        if (c.a() == 1) {
            d(true);
            new Handler().postDelayed(new Runnable() {
                @Override
                public void run() {
                    c.this.w();
                }
            }, c.c());
            if (c.b() == 1) {
                this.q = true;
                final k.a aVar = new k.a() {
                    @Override
                    public void a(String str) {
                        if ("AppBackground".equals(str)) {
                            c.this.s = true;
                        }
                    }
                };
                k.a().a(aVar);
                new Handler().postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        if (!c.this.s) {
                            c cVar = c.this;
                            cVar.a(cVar.t());
                        }
                        k.a().b(aVar);
                    }
                }, c.d());
            }
        }
    }

    private void b(ViewGroup viewGroup) {
        if (viewGroup == null) {
            return;
        }
        if (this.R == null) {
            l lVar = new l(viewGroup.getContext());
            this.R = lVar;
            lVar.a(this.Q);
            this.R.a(viewGroup);
            this.R.a(new l.a() {
                @Override
                public void a(com.octopus.ad.model.d dVar) {
                    c.this.a(dVar);
                    if (c.this.az != null) {
                        c.this.az.onShakeTrigger(1, dVar.m(), dVar.n());
                    }
                }
            });
        }
        this.R.b();
    }

    private void c(ViewGroup viewGroup) {
        View view;
        if (viewGroup == null || (view = this.S) == null) {
            return;
        }
        ViewUtil.removeChildFromParent(view);
        if (viewGroup instanceof RelativeLayout) {
            RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(-2, -2);
            layoutParams.addRule(13, -1);
            viewGroup.addView(this.S, layoutParams);
            return;
        }
        viewGroup.addView(this.S);
    }

    public void a(Context context) {
        this.O = context;
        if (context == null) {
            this.O = o.a().k();
        }
    }

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

    public void a(ServerResponse.AdLogoInfo adLogoInfo) {
        this.K = adLogoInfo;
    }

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

    public void d(String str) {
        this.J.add(str);
    }

    private View b(Context context) {
        if (this.V == null) {
            this.V = new ImageView(context);
            ImageManager.with(context).getBitmap(getImageUrl(), new AnonymousClass7(context));
        }
        return this.V;
    }

    public void a(int i) {
        this.m = i;
    }

    public int a() {
        return this.m;
    }

    public static c a(JSONObject jSONObject) throws JSONException {
        if (jSONObject == null) {
            return null;
        }
        ArrayList<String> stringArrayList = JsonUtil.getStringArrayList(JsonUtil.getJSONArray(jSONObject, "ImpressionTrackers"));
        c cVar = new c();
        if (stringArrayList != null) {
            cVar.I = stringArrayList;
        }
        cVar.b = JsonUtil.getJSONString(jSONObject, "Headline");
        cVar.c = JsonUtil.getJSONString(jSONObject, "Body");
        cVar.d = JsonUtil.getJSONString(jSONObject, "Image");
        cVar.x = JsonUtil.getJSONInt(jSONObject, "LayoutType");
        cVar.t = JsonUtil.getJSONBoolean(jSONObject, "IsShowClose");
        JSONArray jSONArray = JsonUtil.getJSONArray(jSONObject, "Images");
        JSONArray jSONArray2 = JsonUtil.getJSONArray(jSONObject, "Videos");
        JSONArray jSONArray3 = JsonUtil.getJSONArray(jSONObject, "Texts");
        if (jSONArray != null) {
            for (int i = 0; i < jSONArray.length(); i++) {
                cVar.F.add((String) jSONArray.get(i));
            }
        }
        if (jSONArray2 != null) {
            for (int i4 = 0; i4 < jSONArray2.length(); i4++) {
                cVar.G.add((String) jSONArray2.get(i4));
            }
        }
        if (jSONArray3 != null) {
            for (int i5 = 0; i5 < jSONArray3.length(); i5++) {
                cVar.H.add((String) jSONArray3.get(i5));
            }
        }
        if (jSONObject.has("AppIcon")) {
            cVar.a = NativeAdResponse.b.b;
            cVar.e = JsonUtil.getJSONString(jSONObject, "AppIcon");
            cVar.i = JsonUtil.getJSONString(jSONObject, "Action");
            cVar.j = JsonUtil.getJSONDouble(jSONObject, "Star");
            cVar.k = JsonUtil.getJSONString(jSONObject, "Store");
            cVar.l = JsonUtil.getJSONInt(jSONObject, "Price");
        } else {
            cVar.a = NativeAdResponse.b.a;
            cVar.e = JsonUtil.getJSONString(jSONObject, "Logo");
            cVar.i = JsonUtil.getJSONString(jSONObject, "Action");
            cVar.C = JsonUtil.getJSONString(jSONObject, "Advertiser");
        }
        ArrayList<String> stringArrayList2 = JsonUtil.getStringArrayList(JsonUtil.getJSONArray(jSONObject, "ClickTrackers"));
        if (stringArrayList2 != null) {
            cVar.J = stringArrayList2;
        }
        cVar.D = JsonUtil.getStringObjectHashMap(JsonUtil.getJSONObject(jSONObject, "Custom"));
        return cVar;
    }

    public void b(String str) {
        this.h = str;
    }

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

    public void b(int i) {
        ServerResponse serverResponse = this.M;
        if (serverResponse != null) {
            serverResponse.a(i);
        }
    }

    public void c(String str) {
        this.I.add(str);
    }

    private void a(int i, float f) {
        ViewGroup viewGroup = this.al;
        if (viewGroup != null) {
            View inflate = LayoutInflater.from(viewGroup.getContext()).inflate(i, (ViewGroup) null);
            this.am = inflate;
            if (this.aj > 0) {
                int i4 = this.aj;
                this.al.addView(this.am, new ViewGroup.LayoutParams(i4, (int) (i4 / f)));
            } else {
                this.al.addView(inflate);
            }
            a(f);
            return;
        }
        NativeAdEventListener nativeAdEventListener = this.aq;
        if (nativeAdEventListener != null) {
            nativeAdEventListener.onAdRenderFailed(80101);
        }
    }

    private void a(float f) {
        View view;
        if (this.al == null || (view = this.am) == null) {
            return;
        }
        FrameLayout frameLayout = (FrameLayout) view.findViewById(R.id.fl_container);
        ImageView imageView = (ImageView) this.am.findViewById(R.id.ad_image);
        TextView textView = (TextView) this.am.findViewById(R.id.ad_feedback);
        FrameLayout frameLayout2 = (FrameLayout) this.am.findViewById(R.id.ad_compliance);
        ImageView imageView2 = (ImageView) this.am.findViewById(R.id.ad_logo);
        ImageView imageView3 = (ImageView) this.am.findViewById(R.id.ad_logo_text);
        ImageView imageView4 = (ImageView) this.am.findViewById(R.id.ad_close);
        TextView textView2 = (TextView) this.am.findViewById(R.id.ad_title);
        TextView textView3 = (TextView) this.am.findViewById(R.id.ad_action);
        this.T = (VideoView) this.am.findViewById(R.id.ad_video);
        this.U = (TextureView) this.am.findViewById(R.id.ad_texture);
        this.Y = (ProgressBar) this.am.findViewById(R.id.ad_loading);
        if (!TextUtils.isEmpty(getTitle())) {
            textView2.setText(getTitle());
        }
        if (!TextUtils.isEmpty(getButtonText())) {
            textView3.setText(getButtonText());
        }
        if (!TextUtils.isEmpty(getLogoUrl()) && getLogoUrl().endsWith("octlogo.png")) {
            imageView2.setImageResource(R.drawable.oct_logo);
        } else {
            ImageManager.with(null).load(getLogoUrl()).into(imageView2);
        }
        if (!TextUtils.isEmpty(getTextLogoUrl()) && getTextLogoUrl().endsWith("remdad.png")) {
            imageView3.setImageResource(R.drawable.oct_logo_text);
        } else {
            ImageManager.with(null).load(getTextLogoUrl()).into(imageView3);
        }
        ArrayList arrayList = new ArrayList();
        this.ao = arrayList;
        arrayList.add(this.am);
        if (this.t) {
            imageView4.setVisibility(0);
            ArrayList arrayList2 = new ArrayList();
            this.ap = arrayList2;
            arrayList2.add(imageView4);
        } else {
            imageView4.setVisibility(8);
        }
        this.al.post(new AnonymousClass1(f, imageView2, imageView3, textView2, imageView4, textView3, textView, frameLayout, imageView, frameLayout2));
    }

    public void a(View view) {
        c.o F;
        c.r b;
        ServerResponse serverResponse = this.M;
        if (serverResponse == null || serverResponse.i() != n.DRAW || (F = this.M.F()) == null || (b = F.b()) == null || b.a() != 1) {
            return;
        }
        a(view, b.b());
    }

    private void a(View view, String str) {
        View view2;
        try {
            if (this.al != null && (view2 = this.am) != null) {
                RegionClickView regionClickView = (RegionClickView) view2.findViewById(R.id.regionClickView);
                if (TextUtils.isEmpty(str)) {
                    str = "点击跳转至第三方应用或详情页";
                }
                regionClickView.setTitle(str);
                regionClickView.setVisibility(0);
                this.ao.clear();
                this.ao.add(view);
                this.ao.add(regionClickView);
                n();
            }
        } catch (Exception e) {
            Log.e("OctopusAd", "An Exception Caught: " + e.getMessage());
        }
    }

    public void a(FrameLayout frameLayout) {
        AppCompatTextView appCompatTextView;
        if (frameLayout == null || (appCompatTextView = this.P) == null) {
            return;
        }
        ViewUtil.removeChildFromParent(appCompatTextView);
        frameLayout.addView((View) this.P, (ViewGroup.LayoutParams) new FrameLayout.LayoutParams(-1, -2));
    }

    public void a(ViewGroup viewGroup) {
        c.u uVar;
        if (viewGroup == null || (uVar = this.Q) == null || uVar.a() != 1) {
            return;
        }
        int i = this.x;
        if (i != 3 && i != 4) {
            addShakeView(viewGroup, 100, 10.0f);
        } else {
            addShakeView(viewGroup, 130, 13.0f);
        }
    }

    public void a(ArrayList<View> arrayList, final float f) {
        final View next;
        if (arrayList == null || arrayList.isEmpty()) {
            return;
        }
        Iterator<View> it = arrayList.iterator();
        while (it.hasNext() && (next = it.next()) != null) {
            if (next instanceof TextView) {
                TextView textView = (TextView) next;
                textView.setTextSize(0, textView.getTextSize() * f);
            } else {
                next.post(new Runnable() {
                    @Override
                    public void run() {
                        ViewGroup.LayoutParams layoutParams = next.getLayoutParams();
                        if (layoutParams != null) {
                            layoutParams.width = (int) (next.getWidth() * f);
                            layoutParams.height = (int) (next.getHeight() * f);
                            next.setLayoutParams(layoutParams);
                        }
                    }
                });
            }
        }
    }

    public void a(boolean z) {
        this.af = z;
    }

    public void a(ViewGroup viewGroup, int i, float f) {
        if (viewGroup != null) {
            try {
                c.u uVar = this.Q;
                if (uVar == null) {
                    return;
                }
                if (TextUtils.isEmpty(uVar.e())) {
                    if (this.Q.h() == 0) {
                        this.Q.a("摇动或点击了解更多");
                    } else {
                        this.Q.a("转动或点击了解更多");
                    }
                }
                if (this.R == null) {
                    b(viewGroup);
                }
                this.R.a("50%", "50%", i + "", i + "");
                if (this.M != null) {
                    this.S = this.R.a(this.al, viewGroup, f, this.Q.e(), this.M.i());
                }
                if (this.S != null) {
                    if (this.Q.b() == 1) {
                        this.y = 7;
                    }
                    if (this.Q.g() == 1) {
                        c(viewGroup);
                    }
                }
            } catch (Exception e) {
                com.octopus.ad.utils.b.f.a("OctopusAd", "An Exception Caught", e);
            }
        }
    }

    public void a(com.octopus.ad.model.d dVar) {
        if (this.ad || this.n || this.r) {
            if (System.currentTimeMillis() - l.a > 2000) {
                this.p = true;
                v();
                a aVar = this.N;
                boolean z = aVar != null && aVar.g();
                NativeAdEventListener nativeAdEventListener = this.aq;
                if (nativeAdEventListener != null && z) {
                    Boolean bool = Boolean.TRUE;
                    Boolean bool2 = this.z;
                    if (bool == bool2 || (Boolean.FALSE != bool2 && !this.q && !this.A && !this.B)) {
                        nativeAdEventListener.onAdClick();
                    }
                }
                ServerResponse serverResponse = this.M;
                if (serverResponse != null) {
                    serverResponse.a(this.O, this.y, this.n, this.r, z, dVar);
                }
                l.a = System.currentTimeMillis();
                return;
            }
            this.q = false;
            this.y = 0;
        }
    }

    private void a(final NativeAdShownListener nativeAdShownListener) {
        if (this.E || this.al == null) {
            return;
        }
        v vVar = this.av;
        if (vVar != null) {
            vVar.c();
        }
        Object tag = this.al.getTag(55665918);
        if (tag instanceof v) {
            ((v) tag).c();
        }
        v a = v.a(this.al);
        this.av = a;
        this.al.setTag(55665918, a);
        if (this.av == null) {
            return;
        }
        if (this.N != null) {
            com.octopus.ad.internal.h.a(this.al, (NativeAdShownListener) null);
            this.ax = new ArrayList<>();
            Iterator<String> it = this.I.iterator();
            while (it.hasNext()) {
                String next = it.next();
                if (next.contains("?rv=1")) {
                    ViewUtil.openLocalBrowser(next, 0);
                } else {
                    if (next.contains("track=oct")) {
                        if (!this.N.g()) {
                            next = next + "&opt=4";
                        } else {
                            ServerResponse serverResponse = this.M;
                            if (serverResponse != null && !serverResponse.L()) {
                                next = next + "&opt=11";
                            }
                        }
                    }
                    m a5 = m.a(f(), this.N.c(), "imp", next, this.av, this.al.getContext(), this.I);
                    if (a5 != null && next.contains("track=octimp")) {
                        a5.a(new HTTPGet.ResponseListener() {
                            @Override
                            public void getResponse(boolean z, String str) {
                                if (nativeAdShownListener != null) {
                                    if (z && c.this.N != null) {
                                        z = c.this.N.g();
                                    }
                                    nativeAdShownListener.onAdShown(z);
                                }
                            }
                        });
                    }
                    if (a5 != null) {
                        this.ax.add(a5);
                    }
                }
            }
        } else {
            this.ad = true;
        }
        this.an = this.al;
        ServerResponse serverResponse2 = this.M;
        if (serverResponse2 == null || this.v) {
            return;
        }
        this.v = true;
        AdViewImpl.a(serverResponse2, new AdViewImpl.c() {
            @Override
            public void a() {
                if (c.this.o || c.this.p || c.this.an == null || c.this.M == null) {
                    return;
                }
                if (AdViewImpl.a(c.this.M)) {
                    c.this.q = false;
                    c.this.y = 0;
                } else {
                    c.this.q = true;
                    c.this.y = 9;
                }
                c cVar = c.this;
                cVar.a(cVar.t());
            }
        });
        this.z = this.M.M();
    }

    public void a(ServerResponse serverResponse) {
        this.M = serverResponse;
    }

    public void a(String str) {
        this.ac = str;
    }

    public void a(a aVar) {
        this.N = aVar;
    }

    public void a(long j, long j4) {
        c.l f;
        if (this.M == null || !o.a().e() || (f = this.M.f()) == null || TextUtils.isEmpty(f.c())) {
            return;
        }
        o.a().d();
        if (f.b() == 1) {
            this.ab = o.a().g.get(f.c());
        }
        com.octopus.ad.model.a aVar = this.ab;
        if (aVar == null || !aVar.j() || this.ab.g() < getPrice()) {
            com.octopus.ad.model.a aVar2 = new com.octopus.ad.model.a();
            this.ab = aVar2;
            aVar2.a(getPrice());
            this.ab.a(j);
            this.ab.b(j4);
            this.ab.a(f());
            this.ab.b(f.a());
            this.ab.b(f.c());
            this.ab.c(f.d());
            this.ab.a(this.M.P());
            this.ab.e(this.M.S());
            if (this.M.a() != null) {
                this.ab.d(this.M.Q());
                this.ab.a(this.M.a().s());
            }
            o.a().g.put(f.c(), this.ab);
        }
    }

    public void a(c.b bVar) {
        this.aB = bVar;
        if (bVar != null) {
            this.aC = bVar.i();
        }
    }

    public void a(int i, String str, String str2) {
        ServerResponse serverResponse = this.M;
        if (serverResponse != null) {
            serverResponse.a(i, str, str2);
        }
    }
}