正在查看: FileWipe Pro v3.0.0 应用的 BaseMBMediaView.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: FileWipe Pro v3.0.0 应用的 BaseMBMediaView.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.mbridge.msdk.nativex.view;
import android.R;
import android.content.Context;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.Base64;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowInsets;
import android.webkit.RenderProcessGoneDetail;
import android.webkit.URLUtil;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.mbridge.msdk.MBridgeConstans;
import com.mbridge.msdk.foundation.download.download.H5DownLoadManager;
import com.mbridge.msdk.foundation.download.download.HTMLResourceManager;
import com.mbridge.msdk.foundation.download.download.ResourceManager;
import com.mbridge.msdk.foundation.entity.CampaignEx;
import com.mbridge.msdk.foundation.tools.a1;
import com.mbridge.msdk.foundation.tools.d1;
import com.mbridge.msdk.foundation.tools.h0;
import com.mbridge.msdk.foundation.tools.l0;
import com.mbridge.msdk.foundation.tools.p0;
import com.mbridge.msdk.foundation.tools.r0;
import com.mbridge.msdk.foundation.tools.t0;
import com.mbridge.msdk.foundation.tools.u0;
import com.mbridge.msdk.foundation.tools.z0;
import com.mbridge.msdk.mbsignalcommon.windvane.WindVaneWebView;
import com.mbridge.msdk.nativex.view.MediaViewPlayerView;
import com.mbridge.msdk.nativex.view.mbfullview.BaseView;
import com.mbridge.msdk.nativex.view.mbfullview.MBridgeTopFullView;
import com.mbridge.msdk.out.BaseTrackingListener;
import com.mbridge.msdk.out.Campaign;
import com.mbridge.msdk.out.NativeListener;
import com.mbridge.msdk.out.OnMBMediaViewListener;
import com.mbridge.msdk.out.OnMBMediaViewListenerPlus;
import com.mbridge.msdk.playercommon.VideoPlayerStatusListener;
import com.mbridge.msdk.playercommon.exoplayer2.C;
import com.mbridge.msdk.playercommon.exoplayer2.text.ttml.TtmlNode;
import com.mbridge.msdk.playercommon.exoplayer2.upstream.DataSchemeDataSource;
import com.mbridge.msdk.video.signal.communication.IRewardCommunication;
import com.mbridge.msdk.videocommon.view.MyImageView;
import com.mbridge.msdk.widget.MBAdChoice;
import java.io.File;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
public abstract class BaseMBMediaView extends LinearLayout implements VideoPlayerStatusListener, IRewardCommunication {
public static final int OPEN_FULLSCREEN_ON_VIDEO_TYPE_1_LANDING_PAGE = 1;
public static final int OPEN_FULLSCREEN_ON_VIDEO_TYPE_2_NORMAL_FULLSCREEN = 2;
public static final int OPEN_FULLSCREEN_ON_VIDEO_TYPE_3_NORMAL_FULLSCREEN_ENDCARD = 3;
public static final int OPEN_FULLSCREEN_ON_VIDEO_TYPE_4_NORMAL_FULLSCREEN_LP = 4;
public static final int OPEN_FULLSCREEN_ON_VIDEO_TYPE_6_SMALLVIDEO = 6;
public static final String TAG = "BaseMBMediaView";
public static final int WHAT_VIEW_FULL_SCREEN = 2;
public static final int WHAT_VIEW_SMALL_SCREEN = 1;
private static int f13875n0 = 2;
private static int f13876o0 = 1;
private WindVaneWebViewForNV A;
private MyImageView B;
private ProgressBar C;
private View D;
private BaseView E;
private RelativeLayout F;
private RelativeLayout G;
private TextView H;
private ProgressBar I;
private RelativeLayout J;
private int K;
private Handler L;
private CampaignEx M;
private int N;
private int O;
private double P;
private double Q;
private int R;
private int S;
private w T;
private SensorManager U;
private Sensor V;
private com.mbridge.msdk.videocommon.download.a W;
private boolean f13877a;
private s f13878a0;
private boolean f13879b;
private OnMBMediaViewListener f13880b0;
private boolean f13881c;
private OnMBMediaViewListenerPlus f13882c0;
private boolean f13883d;
private int f13884d0;
private boolean f13885e;
private boolean f13886e0;
private boolean f13887f;
private boolean f13888f0;
private boolean f13889g;
private RelativeLayout f13890g0;
private boolean f13891h;
private ImageView f13892h0;
private volatile boolean f13893i;
private int f13894i0;
private volatile boolean f13895j;
private boolean f13896j0;
private boolean f13897k;
private Context k0;
private boolean l;
private boolean f13898l0;
private ArrayList<String> m;
private Runnable f13899m0;
private ArrayList<String> f13900n;
private boolean f13901o;
private boolean f13902p;
private rb.b f13903q;
private rb.a f13904r;
private sb.b f13905s;
private int f13906t;
protected boolean f13907u;
private MediaViewPlayerView f13908v;
private RelativeLayout f13909w;
private RelativeLayout f13910x;
private RelativeLayout f13911y;
private WindVaneWebViewForNV f13912z;
public class a implements View.OnClickListener {
public a() {
}
@Override
public void onClick(View view) {
BaseMBMediaView.this.l();
}
}
public class b implements View.OnClickListener {
public b() {
}
@Override
public void onClick(View view) {
BaseMBMediaView.this.g();
}
}
public class c extends com.mbridge.msdk.widget.a {
public c() {
}
public void a(View view) {
try {
BaseMBMediaView.this.a(view.getContext());
if (BaseMBMediaView.this.f13905s != null) {
try {
BaseMBMediaView.this.f13905s.a();
p0.a("omsdk", "bmnv adUserInteraction click");
} catch (Exception e4) {
p0.b("omsdk", e4.getMessage());
}
}
} catch (Exception e6) {
p0.b(BaseMBMediaView.TAG, e6.getMessage());
}
}
}
public class d implements Runnable {
public d() {
}
@Override
public void run() {
BaseMBMediaView.this.f13902p = true;
if (BaseMBMediaView.this.f13891h) {
TextView unused = BaseMBMediaView.this.H;
}
}
}
public class e extends com.mbridge.msdk.nativex.listener.b {
public e() {
}
@Override
public void a() {
BaseMBMediaView.this.exitFullScreen();
}
}
public class g implements Runnable {
public g() {
}
@Override
public void run() {
try {
com.mbridge.msdk.nativex.view.mbfullview.a.a(BaseMBMediaView.this.getContext()).a(BaseMBMediaView.this.E, BaseMBMediaView.this.f13893i);
if (BaseMBMediaView.this.f13894i0 == 0) {
BaseMBMediaView.this.O();
} else {
BaseMBMediaView.this.P();
}
BaseMBMediaView.this.u();
BaseMBMediaView.this.o();
BaseMBMediaView.this.x();
if (BaseMBMediaView.this.A != null) {
BaseMBMediaView.this.A.orientation(BaseMBMediaView.this.f13893i);
}
} catch (Exception e4) {
p0.b(BaseMBMediaView.TAG, e4.getMessage());
}
}
}
public class h implements Runnable {
public h() {
}
@Override
public void run() {
try {
if (!BaseMBMediaView.this.f13891h) {
BaseMBMediaView baseMBMediaView = BaseMBMediaView.this;
if (baseMBMediaView.a((View) baseMBMediaView)) {
BaseMBMediaView.this.a0();
} else {
BaseMBMediaView.this.A();
}
}
BaseMBMediaView.this.L.postDelayed(this, 300L);
} catch (Exception e4) {
p0.b(BaseMBMediaView.TAG, e4.getMessage());
}
}
}
public static class i {
static final int[] f13921a;
static {
int[] iArr = new int[BaseView.a.values().length];
f13921a = iArr;
try {
iArr[BaseView.a.FULL_MIDDLE_VIEW.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
f13921a[BaseView.a.FULL_TOP_VIEW.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
}
}
public class j extends Handler {
public j() {
}
@Override
public void handleMessage(Message message) {
Object obj;
if (message != null) {
try {
int i10 = message.what;
if (i10 == 1) {
BaseMBMediaView.this.S();
return;
}
if (i10 == 3 && (obj = message.obj) != null && (obj instanceof View)) {
if (BaseMBMediaView.this.a((View) obj)) {
BaseMBMediaView.this.E();
}
}
} catch (Exception e4) {
p0.b(BaseMBMediaView.TAG, e4.getMessage());
}
}
}
}
public class k extends com.mbridge.msdk.widget.a {
public k() {
}
public void a(View view) {
try {
if (!BaseMBMediaView.this.f13891h) {
BaseMBMediaView.this.L();
}
BaseMBMediaView.this.f13908v.showSoundIndicator(true);
BaseMBMediaView.this.f13908v.showProgressView(true);
if (BaseMBMediaView.this.f13883d && !BaseMBMediaView.this.f13891h && (BaseMBMediaView.this.D == null || BaseMBMediaView.this.D.getParent() == null)) {
if (!BaseMBMediaView.this.f13908v.halfLoadingViewisVisible() && BaseMBMediaView.this.f13908v.isPlaying()) {
BaseMBMediaView.this.a();
return;
}
p0.c(BaseMBMediaView.TAG, "is loading or no playing return;");
return;
}
if (BaseMBMediaView.this.f13891h) {
p0.c(BaseMBMediaView.TAG, "fullScreenShowUI");
BaseMBMediaView.this.l();
return;
}
if (BaseMBMediaView.this.k0 != null) {
BaseMBMediaView baseMBMediaView = BaseMBMediaView.this;
baseMBMediaView.a(baseMBMediaView.k0);
} else {
BaseMBMediaView.this.a(view.getContext());
}
if (BaseMBMediaView.this.f13905s != null) {
try {
BaseMBMediaView.this.f13905s.a();
p0.a("omsdk", "mnv adUserInteraction click");
} catch (Exception e4) {
p0.b("omsdk", e4.getMessage());
}
}
} catch (Throwable th) {
p0.b(BaseMBMediaView.TAG, th.getMessage(), th);
}
}
}
public class l implements com.mbridge.msdk.foundation.same.image.c {
public class a extends com.mbridge.msdk.widget.a {
public a() {
}
public void a(View view) {
if (BaseMBMediaView.this.k0 == null) {
BaseMBMediaView.this.a(view.getContext());
} else {
BaseMBMediaView baseMBMediaView = BaseMBMediaView.this;
baseMBMediaView.a(baseMBMediaView.k0);
}
}
}
public l() {
}
@Override
public void onFailedLoad(String str, String str2) {
}
@Override
public void onSuccessLoad(Bitmap bitmap, String str) {
if (BaseMBMediaView.this.B == null || BaseMBMediaView.this.f13878a0 != s.BIG_IMAGE) {
return;
}
if (bitmap != null) {
BaseMBMediaView.this.R = bitmap.getWidth();
BaseMBMediaView.this.S = bitmap.getHeight();
BaseMBMediaView.this.B.setImageUrl(str);
BaseMBMediaView.this.B.setImageBitmap(bitmap);
}
a1.a((View) BaseMBMediaView.this.B, BaseMBMediaView.this.M.getLocalRequestId(), BaseMBMediaView.this.M.getLocalAllowTrackClick());
BaseMBMediaView.this.B.setOnClickListener(new a());
}
}
public class m extends com.mbridge.msdk.widget.a {
public m() {
}
public void a(View view) {
if (BaseMBMediaView.this.k0 != null) {
BaseMBMediaView baseMBMediaView = BaseMBMediaView.this;
baseMBMediaView.a(baseMBMediaView.k0);
} else {
BaseMBMediaView.this.a(view.getContext());
}
p0.c(BaseMBMediaView.TAG, "CLICK WEBVIEW LAYOUT ");
}
}
public class n implements NativeListener.NativeTrackingListener {
public n() {
}
@Override
public void onDismissLoading(Campaign campaign) {
}
@Override
public void onDownloadFinish(Campaign campaign) {
}
@Override
public void onDownloadProgress(int i10) {
}
@Override
public void onDownloadStart(Campaign campaign) {
}
@Override
public void onFinishRedirection(Campaign campaign, String str) {
try {
BaseMBMediaView.this.n();
BaseMBMediaView.this.m();
BaseMBMediaView.this.a(campaign, str);
} catch (Exception e4) {
p0.b(BaseMBMediaView.TAG, e4.getMessage());
}
}
@Override
public boolean onInterceptDefaultLoadingDialog() {
return true;
}
@Override
public void onRedirectionFailed(Campaign campaign, String str) {
try {
BaseMBMediaView.this.n();
BaseMBMediaView.this.m();
BaseMBMediaView.this.b(campaign, str);
} catch (Exception e4) {
p0.b(BaseMBMediaView.TAG, e4.getMessage());
}
}
@Override
public void onShowLoading(Campaign campaign) {
}
@Override
public void onStartRedirection(Campaign campaign, String str) {
try {
BaseMBMediaView.this.Y();
BaseMBMediaView.this.W();
BaseMBMediaView.this.c(campaign, str);
} catch (Exception e4) {
p0.b(BaseMBMediaView.TAG, e4.getMessage());
}
}
}
public class o implements Runnable {
final String f13928a;
public o(String str) {
this.f13928a = str;
}
@Override
public void run() {
try {
BaseMBMediaView.this.I();
BaseMBMediaView.this.c(this.f13928a);
u0.a(BaseMBMediaView.this.M.getCampaignUnitId(), BaseMBMediaView.this.M, com.mbridge.msdk.foundation.same.a.f12684x);
} catch (Exception e4) {
if (MBridgeConstans.DEBUG) {
p0.b(BaseMBMediaView.TAG, e4.getMessage());
}
}
}
}
public class p extends MediaViewPlayerView.h {
public p(MediaViewPlayerView mediaViewPlayerView) {
super(mediaViewPlayerView);
}
@Override
public void a() {
int nvT2 = BaseMBMediaView.this.M.getNvT2();
if (!BaseMBMediaView.this.f13891h || (nvT2 != 3 && nvT2 != 4)) {
super.a();
return;
}
WindVaneWebViewForNV endCardWebview = BaseMBMediaView.this.getEndCardWebview();
if (endCardWebview == null) {
super.a();
return;
}
View q10 = BaseMBMediaView.this.q();
if (q10 == null) {
super.a();
return;
}
if (nvT2 == 3 && BaseMBMediaView.this.f13886e0) {
com.mbridge.msdk.nativex.view.mbfullview.a.a(BaseMBMediaView.this.getContext()).a(q10, BaseMBMediaView.this.E);
com.mbridge.msdk.mbnative.report.a.a(BaseMBMediaView.this.getContext(), BaseMBMediaView.this.M, BaseMBMediaView.this.M.getCampaignUnitId());
} else {
if (nvT2 != 4) {
super.a();
return;
}
com.mbridge.msdk.nativex.view.mbfullview.a.a(BaseMBMediaView.this.getContext()).a(q10, BaseMBMediaView.this.E);
String clickURL = BaseMBMediaView.this.M.getClickURL();
if (!TextUtils.isEmpty(clickURL)) {
com.mbridge.msdk.click.a.a(BaseMBMediaView.this.getContext(), BaseMBMediaView.this.M, BaseMBMediaView.this.getUnitId(), BaseMBMediaView.this.getAddNVT2ToNoticeURL(), true, false, com.mbridge.msdk.click.retry.a.f11801o);
BaseMBMediaView.this.A.loadUrl(clickURL);
}
}
endCardWebview.webViewShow(BaseMBMediaView.this.M, BaseMBMediaView.this.getUnitId());
endCardWebview.orientation(BaseMBMediaView.this.f13893i);
}
}
public class q implements View.OnClickListener {
public q() {
}
@Override
public void onClick(View view) {
BaseMBMediaView.this.exitFullScreen();
}
}
public class r implements View.OnKeyListener {
public r() {
}
@Override
public boolean onKey(View view, int i10, KeyEvent keyEvent) {
try {
if (keyEvent.getKeyCode() != 4) {
return false;
}
BaseMBMediaView.this.g();
return true;
} catch (Throwable th) {
p0.b(BaseMBMediaView.TAG, th.getMessage());
return false;
}
}
}
public enum s {
BIG_IMAGE,
VIDEO,
GIF
}
public static final class t implements Runnable {
WeakReference<BaseMBMediaView> f13937a;
public t(BaseMBMediaView baseMBMediaView) {
this.f13937a = new WeakReference<>(baseMBMediaView);
}
@Override
public void run() {
BaseMBMediaView baseMBMediaView = this.f13937a.get();
if (baseMBMediaView != null) {
try {
if (baseMBMediaView.f13878a0 == null || baseMBMediaView.f13878a0 != s.BIG_IMAGE) {
return;
}
baseMBMediaView.U();
baseMBMediaView.f13878a0 = s.VIDEO;
baseMBMediaView.changeNoticeURL();
} catch (Throwable th) {
p0.b(BaseMBMediaView.TAG, th.getMessage(), th);
}
}
}
}
public static final class v implements com.mbridge.msdk.mbsignalcommon.base.a {
private v() {
}
@Override
public boolean a(String str) {
try {
if (!TextUtils.isEmpty(str)) {
if (t0.a.b(str)) {
t0.a(com.mbridge.msdk.foundation.controller.c.m().d(), str, (NativeListener.NativeTrackingListener) null);
return true;
}
if (URLUtil.isNetworkUrl(str)) {
return false;
}
t0.a(com.mbridge.msdk.foundation.controller.c.m().d(), str, (BaseTrackingListener) null);
return true;
}
} catch (Exception e4) {
p0.b(BaseMBMediaView.TAG, e4.getMessage());
}
return false;
}
public v(j jVar) {
this();
}
}
public class w implements SensorEventListener {
public class a implements Runnable {
public a() {
}
@Override
public void run() {
try {
com.mbridge.msdk.nativex.view.mbfullview.a.a(BaseMBMediaView.this.getContext()).a(BaseMBMediaView.this.E, BaseMBMediaView.this.f13893i);
BaseMBMediaView.this.O();
BaseMBMediaView.this.u();
BaseMBMediaView.this.o();
BaseMBMediaView.this.x();
if (BaseMBMediaView.this.A != null) {
BaseMBMediaView.this.A.orientation(BaseMBMediaView.this.f13893i);
}
} catch (Exception e4) {
p0.b(BaseMBMediaView.TAG, e4.getMessage());
}
}
}
public class b implements Runnable {
public b() {
}
@Override
public void run() {
try {
com.mbridge.msdk.nativex.view.mbfullview.a.a(BaseMBMediaView.this.getContext()).a(BaseMBMediaView.this.E, BaseMBMediaView.this.f13893i);
BaseMBMediaView.this.P();
BaseMBMediaView.this.u();
BaseMBMediaView.this.o();
BaseMBMediaView.this.x();
if (BaseMBMediaView.this.A != null) {
BaseMBMediaView.this.A.orientation(BaseMBMediaView.this.f13893i);
}
} catch (Exception e4) {
p0.b(BaseMBMediaView.TAG, e4.getMessage());
}
}
}
private w() {
}
@Override
public void onAccuracyChanged(Sensor sensor, int i10) {
}
@Override
public void onSensorChanged(SensorEvent sensorEvent) {
int i10;
if (BaseMBMediaView.this.f13896j0) {
return;
}
try {
float[] fArr = sensorEvent.values;
float f10 = -fArr[0];
float f11 = -fArr[1];
float f12 = -fArr[2];
if (((f11 * f11) + (f10 * f10)) * 4.0f >= f12 * f12) {
i10 = 90 - Math.round(((float) Math.atan2(-f11, f10)) * 57.29578f);
while (i10 >= 360) {
i10 -= 360;
}
while (i10 < 0) {
i10 += 360;
}
} else {
i10 = -1;
}
float allScreenWidth = BaseMBMediaView.this.getAllScreenWidth();
int h7 = u0.h(BaseMBMediaView.this.getContext());
if ((i10 > 45 && i10 < 135) || (i10 > 225 && i10 < 315)) {
if (allScreenWidth < h7 || BaseMBMediaView.this.f13895j) {
return;
}
BaseMBMediaView.this.f13893i = true;
BaseMBMediaView.this.f13895j = true;
BaseMBMediaView.this.L.postDelayed(new a(), 200L);
return;
}
if (((i10 <= 135 || i10 >= 225) && ((i10 <= 315 || i10 >= 360) && ((i10 < 0 || i10 > 45) && i10 != -1))) || allScreenWidth > h7 || !BaseMBMediaView.this.f13895j) {
return;
}
BaseMBMediaView.this.f13893i = false;
BaseMBMediaView.this.f13895j = false;
BaseMBMediaView.this.L.postDelayed(new b(), 200L);
} catch (Throwable th) {
p0.b(BaseMBMediaView.TAG, th.getMessage(), th);
}
}
public w(BaseMBMediaView baseMBMediaView, j jVar) {
this();
}
}
public static final class x implements com.mbridge.msdk.videocommon.listener.a {
WeakReference<BaseMBMediaView> f13942a;
public x(BaseMBMediaView baseMBMediaView) {
this.f13942a = new WeakReference<>(baseMBMediaView);
}
public void a(String str, String str2) {
}
public void a(String str) {
BaseMBMediaView baseMBMediaView = this.f13942a.get();
if (baseMBMediaView != null) {
baseMBMediaView.L.post(new t(baseMBMediaView));
}
}
}
public static final class y extends WebViewClient {
WeakReference<BaseMBMediaView> f13943a;
public y(BaseMBMediaView baseMBMediaView) {
this.f13943a = new WeakReference<>(baseMBMediaView);
}
@Override
public void onPageFinished(WebView webView, String str) {
super.onPageFinished(webView, str);
try {
BaseMBMediaView baseMBMediaView = this.f13943a.get();
if (baseMBMediaView == null || baseMBMediaView.f13878a0 == null || baseMBMediaView.f13878a0 != s.BIG_IMAGE) {
return;
}
baseMBMediaView.R();
baseMBMediaView.f13878a0 = s.GIF;
baseMBMediaView.changeNoticeURL();
} catch (Exception e4) {
p0.b(BaseMBMediaView.TAG, e4.getMessage());
}
}
@Override
public boolean onRenderProcessGone(WebView webView, RenderProcessGoneDetail renderProcessGoneDetail) {
p0.b(BaseMBMediaView.TAG, "WebView called onRenderProcessGone");
if (webView != null) {
try {
ViewGroup viewGroup = (ViewGroup) webView.getParent();
if (viewGroup != null) {
viewGroup.removeView(webView);
}
if (webView instanceof WindVaneWebView) {
((WindVaneWebView) webView).release();
} else {
webView.destroy();
}
} catch (Throwable th) {
p0.b(BaseMBMediaView.TAG, th.getMessage());
}
}
return true;
}
}
public BaseMBMediaView(Context context) {
super(context);
this.f13877a = true;
this.f13879b = true;
this.f13881c = true;
this.f13883d = true;
this.f13885e = true;
this.f13887f = false;
this.f13889g = true;
this.f13891h = false;
this.f13893i = false;
this.f13895j = false;
this.f13897k = true;
this.l = true;
this.m = new ArrayList<>();
this.f13900n = new ArrayList<>();
this.f13901o = false;
this.f13902p = false;
this.f13903q = null;
this.f13904r = null;
this.f13905s = null;
this.f13906t = 0;
this.f13907u = false;
this.W = null;
this.f13878a0 = null;
this.f13886e0 = false;
this.f13888f0 = false;
this.f13896j0 = false;
this.f13898l0 = false;
this.f13899m0 = new h();
b(context);
}
private void T() {
try {
if (this.f13908v == null) {
return;
}
com.mbridge.msdk.foundation.same.report.metrics.e eVar = new com.mbridge.msdk.foundation.same.report.metrics.e();
eVar.a("adtp", 42);
if (TextUtils.isEmpty(this.M.getBidToken())) {
eVar.a(CampaignEx.JSON_KEY_HB, 0);
} else {
eVar.a(CampaignEx.JSON_KEY_HB, 1);
}
a1.a(this.f13908v, this.M.getLocalRequestId(), this.M.getLocalAllowTrackClick());
this.f13908v.setOnClickListener(new k());
} catch (Throwable th) {
p0.b(TAG, th.getMessage());
}
}
public void U() {
v();
Z();
}
private void V() {
try {
u0.a((ImageView) this.B);
this.B.setVisibility(0);
this.f13909w.setVisibility(8);
this.f13911y.setVisibility(8);
} catch (Throwable th) {
p0.b(TAG, th.getMessage());
}
}
public void W() {
try {
ProgressBar progressBar = this.I;
if (progressBar != null) {
progressBar.setVisibility(0);
}
} catch (Exception e4) {
p0.b(TAG, e4.getMessage());
}
}
private void X() {
try {
this.f13909w.setVisibility(8);
this.B.setVisibility(8);
this.f13911y.setVisibility(0);
this.f13912z.setVisibility(0);
} catch (Throwable th) {
p0.b(TAG, th.getMessage());
}
}
public void Y() {
try {
ProgressBar progressBar = this.C;
if (progressBar != null) {
progressBar.setVisibility(0);
}
} catch (Exception e4) {
p0.b(TAG, e4.getMessage());
}
}
private void Z() {
try {
this.f13909w.setVisibility(0);
this.B.setVisibility(8);
this.f13911y.setVisibility(8);
} catch (Throwable th) {
p0.b(TAG, th.getMessage());
}
}
public void a0() {
try {
MediaViewPlayerView mediaViewPlayerView = this.f13908v;
if (mediaViewPlayerView == null || !mediaViewPlayerView.hasPrepare() || this.f13908v.isPlaying() || this.f13908v.isComplete() || !this.f13908v.hasPrepare()) {
return;
}
this.f13908v.startOrPlayVideo();
} catch (Throwable th) {
p0.b(TAG, th.getMessage());
}
}
private void b0() {
w wVar;
try {
SensorManager sensorManager = this.U;
if (sensorManager == null || (wVar = this.T) == null) {
return;
}
sensorManager.unregisterListener(wVar);
} catch (Throwable th) {
p0.b(TAG, th.getMessage());
}
}
private void c0() {
com.mbridge.msdk.videocommon.download.a aVar = this.W;
if (aVar != null) {
aVar.b((com.mbridge.msdk.videocommon.listener.a) null);
}
}
private float getAllScreenHeight() {
try {
float h7 = u0.h(getContext());
return !this.f13893i ? h7 + u0.c(getContext()) : h7;
} catch (Throwable th) {
p0.b(TAG, th.getMessage());
return 0.0f;
}
}
public float getAllScreenWidth() {
try {
float i10 = u0.i(getContext());
return this.f13893i ? i10 + u0.c(getContext()) : i10;
} catch (Throwable th) {
p0.b(TAG, th.getMessage());
return 0.0f;
}
}
private int getCDRate() {
if (getUnitSetting() != null) {
return getUnitSetting().i();
}
return 0;
}
public WindVaneWebViewForNV getEndCardWebview() {
try {
WindVaneWebViewForNV windVaneWebViewForNV = this.A;
if (windVaneWebViewForNV != null && this.f13888f0) {
return windVaneWebViewForNV;
}
if (this.f13888f0) {
return null;
}
b(true);
return null;
} catch (Exception e4) {
p0.b(TAG, e4.getMessage());
return null;
}
}
private String getPlayUrl() {
try {
} catch (Exception e4) {
p0.b(TAG, e4.getMessage());
}
if (this.M == null) {
return null;
}
com.mbridge.msdk.videocommon.download.a aVar = this.W;
if (aVar != null && aVar.j() == 5) {
String k10 = this.W.k();
if (new File(k10).exists()) {
if (!this.W.q()) {
if (this.W.e() == u0.a(new File(k10))) {
}
}
return k10;
}
}
String videoUrlEncode = this.M.getVideoUrlEncode();
if (z0.b(videoUrlEncode)) {
return videoUrlEncode;
}
return null;
}
private int getReadyRate() {
if (getUnitSetting() != null) {
return getUnitSetting().C();
}
return 100;
}
public String getUnitId() {
try {
CampaignEx campaignEx = this.M;
if (campaignEx == null || !z0.b(campaignEx.getCampaignUnitId())) {
return null;
}
return this.M.getCampaignUnitId();
} catch (Exception e4) {
p0.b(TAG, e4.getMessage());
return null;
}
}
private com.mbridge.msdk.setting.l getUnitSetting() {
try {
CampaignEx campaignEx = this.M;
if (campaignEx != null && !z0.a(campaignEx.getCampaignUnitId())) {
String campaignUnitId = this.M.getCampaignUnitId();
String b10 = com.mbridge.msdk.foundation.controller.c.m().b();
if (!z0.a(campaignUnitId) && !z0.a(b10)) {
com.mbridge.msdk.setting.l e4 = com.mbridge.msdk.setting.h.b().e(b10, campaignUnitId);
return e4 != null ? e4 : com.mbridge.msdk.setting.l.i(campaignUnitId);
}
return com.mbridge.msdk.setting.l.i(campaignUnitId);
}
return null;
} catch (Exception e6) {
p0.b(TAG, e6.getMessage());
return null;
}
}
private void setIsFrontDesk(boolean z3) {
MediaViewPlayerView mediaViewPlayerView = this.f13908v;
if (mediaViewPlayerView != null) {
mediaViewPlayerView.setIsFrontDesk(z3);
}
}
private void setPlayViewParamsDefault(View view) {
if (view == null) {
return;
}
try {
RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) view.getLayoutParams();
layoutParams.width = -1;
if (this.f13893i) {
layoutParams.height = -1;
} else {
layoutParams.height = (((int) getAllScreenWidth()) * 9) / 16;
layoutParams.addRule(13);
}
view.setLayoutParams(layoutParams);
} catch (Exception e4) {
p0.b(TAG, e4.getMessage());
}
}
public void cai(Object obj, String str) {
p0.a(TAG, "cai:" + str);
if (TextUtils.isEmpty(str)) {
com.mbridge.msdk.mbsignalcommon.communication.d.a(obj, "params is null");
return;
}
if (TextUtils.isEmpty(str)) {
return;
}
try {
try {
String optString = new JSONObject(str).optString("packageName");
if (TextUtils.isEmpty(optString)) {
com.mbridge.msdk.mbsignalcommon.communication.d.a(obj, "packageName is empty");
}
int i10 = u0.c(com.mbridge.msdk.foundation.controller.c.m().d(), optString) ? 1 : 2;
try {
JSONObject jSONObject = new JSONObject();
jSONObject.put("code", com.mbridge.msdk.mbsignalcommon.communication.d.f13790b);
JSONObject jSONObject2 = new JSONObject();
jSONObject2.put("result", i10);
jSONObject.put(DataSchemeDataSource.SCHEME_DATA, jSONObject2);
com.mbridge.msdk.mbsignalcommon.windvane.f.a().b(obj, Base64.encodeToString(jSONObject.toString().getBytes(), 2));
} catch (Exception e4) {
com.mbridge.msdk.mbsignalcommon.communication.d.a(obj, e4.getMessage());
p0.a(TAG, e4.getMessage());
}
} catch (Throwable th) {
com.mbridge.msdk.mbsignalcommon.communication.d.a(obj, "exception: " + th.getLocalizedMessage());
p0.b(TAG, "cai", th);
}
} catch (JSONException e6) {
com.mbridge.msdk.mbsignalcommon.communication.d.a(obj, "exception: " + e6.getLocalizedMessage());
p0.b(TAG, "cai", e6);
}
}
public boolean canShowVideo() {
return a(false) == s.VIDEO;
}
public void changeNoticeURL() {
CampaignEx campaignEx = this.M;
if (campaignEx != null) {
String noticeUrl = campaignEx.getNoticeUrl();
if (TextUtils.isEmpty(noticeUrl)) {
return;
}
if (noticeUrl.contains("is_video")) {
s sVar = this.f13878a0;
if (sVar == s.VIDEO) {
if (noticeUrl.contains("is_video=2")) {
noticeUrl = noticeUrl.replace("is_video=2", "is_video=1");
}
} else if (sVar == s.BIG_IMAGE && noticeUrl.contains("is_video=1")) {
noticeUrl = noticeUrl.replace("is_video=1", "is_video=2");
}
} else {
s sVar2 = this.f13878a0;
String str = sVar2 == s.VIDEO ? "1" : sVar2 == s.BIG_IMAGE ? MBridgeConstans.API_REUQEST_CATEGORY_APP : "";
StringBuilder sb2 = new StringBuilder(noticeUrl);
if (noticeUrl.contains("?")) {
sb2.append("&is_video=");
sb2.append(str);
} else {
sb2.append("?is_video=");
sb2.append(str);
}
noticeUrl = sb2.toString();
}
this.M.setNoticeUrl(noticeUrl);
}
}
public void destory() {
try {
MediaViewPlayerView mediaViewPlayerView = this.f13908v;
if (mediaViewPlayerView != null) {
mediaViewPlayerView.release();
}
c0();
} catch (Throwable th) {
p0.b(TAG, th.getMessage());
}
}
public void exitFullScreen() {
try {
g();
if (this.f13879b) {
this.f13908v.onClickPlayButton();
}
} catch (Exception e4) {
p0.b(TAG, e4.getMessage());
}
}
public String getAddNVT2ToNoticeURL() {
CampaignEx campaignEx = this.M;
if (campaignEx == null) {
return null;
}
String noticeUrl = campaignEx.getNoticeUrl();
if (TextUtils.isEmpty(noticeUrl) || noticeUrl.contains(CampaignEx.JSON_KEY_NV_T2)) {
return noticeUrl;
}
return noticeUrl + "&nv_t2=" + this.M.getNvT2();
}
public void getEndScreenInfo(Object obj, String str) {
try {
ArrayList arrayList = new ArrayList();
arrayList.add(this.M);
String a10 = a(arrayList, getUnitId(), "MAL_16.9.91,3.0.1");
String encodeToString = !TextUtils.isEmpty(a10) ? Base64.encodeToString(a10.getBytes(), 2) : "";
p0.b(TAG, "getEndScreenInfo-mCampaign.name:" + this.M.getAppName());
com.mbridge.msdk.mbsignalcommon.windvane.f.a().b(obj, encodeToString);
} catch (Throwable th) {
p0.b(TAG, th.getMessage());
}
}
public com.mbridge.msdk.nativex.view.mbfullview.BaseView getFullScreenViewByStyle(android.content.Context r3, com.mbridge.msdk.nativex.view.mbfullview.BaseView.a r4) {
throw new UnsupportedOperationException("Method not decompiled: com.mbridge.msdk.nativex.view.BaseMBMediaView.getFullScreenViewByStyle(android.content.Context, com.mbridge.msdk.nativex.view.mbfullview.BaseView$a):com.mbridge.msdk.nativex.view.mbfullview.BaseView");
}
public float getMediaContentAspectRatio() {
float f10 = 0.0f;
try {
CampaignEx campaignEx = this.M;
if (campaignEx != null) {
String videoResolution = !TextUtils.isEmpty(campaignEx.getVideoUrlEncode()) ? this.M.getVideoResolution() : this.M.getImageSize();
if (!TextUtils.isEmpty(videoResolution)) {
if (videoResolution.split("x").length == 2) {
f10 = Integer.parseInt(r3[0]) / Integer.parseInt(r3[1]);
}
}
p0.b(TAG, "resource ratio is : " + f10);
}
return f10;
} catch (Throwable th) {
p0.b(TAG, th.getMessage());
return f10;
}
}
public BaseView.a handleViewStyleResult(Context context) {
int nvT2 = this.M.getNvT2();
if (nvT2 == 1) {
a(context);
return null;
}
if (nvT2 == 2 || nvT2 == 3 || nvT2 == 4) {
return BaseView.a.FULL_MIDDLE_VIEW;
}
if (nvT2 != 6) {
return null;
}
return BaseView.a.FULL_TOP_VIEW;
}
public void handlerPlayableException(Object obj, String str) {
}
public void hideEndCardWebViewCloseBtn() {
ImageView imageView = this.f13892h0;
if (imageView == null || imageView.getVisibility() != 0) {
return;
}
this.f13892h0.setVisibility(8);
}
public void install(Object obj, String str) {
WindVaneWebView windVaneWebView;
try {
Context context = this.k0;
if (context != null) {
a(context);
} else {
if (!(obj instanceof com.mbridge.msdk.mbsignalcommon.windvane.a) || (windVaneWebView = ((com.mbridge.msdk.mbsignalcommon.windvane.a) obj).f13833b) == null) {
return;
}
a(windVaneWebView.getContext());
}
} catch (Exception e4) {
p0.b(TAG, e4.getMessage());
}
}
public boolean ismCurIsFullScreen() {
return this.f13891h;
}
public void notifyCloseBtn(Object obj, String str) {
}
@Override
public void onAttachedToWindow() {
super.onAttachedToWindow();
try {
if (this.f13881c) {
B();
}
this.f13889g = isHardwareAccelerated();
this.f13894i0 = getOrientation();
N();
this.L.postDelayed(this.f13899m0, 300L);
} catch (Throwable th) {
p0.b(TAG, th.getMessage());
}
}
@Override
public void onBufferingEnd() {
p0.c("omsdk", "base media end");
sb.b bVar = this.f13905s;
if (bVar != null) {
rb.i iVar = bVar.f19197a;
x4.b.c(iVar);
iVar.f18993e.e("bufferFinish", null);
}
}
@Override
public void onBufferingStart(String str) {
p0.c("omsdk", "base media start");
sb.b bVar = this.f13905s;
if (bVar != null) {
rb.i iVar = bVar.f19197a;
x4.b.c(iVar);
iVar.f18993e.e("bufferStart", null);
}
}
@Override
public void onBufferingTimeOut(String str) {
}
@Override
public void onConfigurationChanged(Configuration configuration) {
super.onConfigurationChanged(configuration);
if (this.f13896j0) {
int i10 = this.f13894i0;
int i11 = configuration.orientation;
if (i10 == i11) {
return;
}
this.f13894i0 = i11;
this.f13893i = i11 == 0;
this.f13895j = this.f13894i0 == 0;
this.L.postDelayed(new g(), 200L);
}
}
@Override
public void onDetachedFromWindow() {
super.onDetachedFromWindow();
try {
if (this.f13903q != null) {
MediaViewPlayerView mediaViewPlayerView = this.f13908v;
if (mediaViewPlayerView != null) {
mediaViewPlayerView.unregisterView();
}
this.f13903q.c();
this.f13903q = null;
}
if (this.f13905s != null) {
this.f13905s = null;
}
if (this.f13904r != null) {
this.f13904r = null;
}
this.L.removeCallbacks(this.f13899m0);
C();
b0();
c0();
} catch (Throwable th) {
p0.b(TAG, th.getMessage());
}
}
@Override
public void onMeasure(int i10, int i11) {
super.onMeasure(i10, i11);
try {
this.N = getHeight();
int width = getWidth();
this.O = width;
if (width == 0) {
this.O = getMeasuredWidth();
}
if (this.N == 0) {
this.N = getMeasuredHeight();
}
if (this.O == 0 && this.N == 0) {
this.O = (int) getAllScreenWidth();
}
s sVar = this.f13878a0;
if (sVar != s.VIDEO || this.f13891h) {
if (sVar == s.BIG_IMAGE && !this.f13891h) {
o();
return;
} else {
if (sVar != s.GIF || this.f13891h) {
return;
}
x();
return;
}
}
ViewGroup.LayoutParams layoutParams = getLayoutParams();
if (this.N == 0 || ((layoutParams != null && layoutParams.height == -2) || (layoutParams != null && layoutParams.height == -1))) {
this.N = (int) ((this.O * this.Q) / this.P);
}
u();
} catch (Throwable th) {
p0.b(TAG, th.getMessage());
}
}
@Override
public void onPlayCompleted() {
sb.b bVar = this.f13905s;
if (bVar != null) {
rb.i iVar = bVar.f19197a;
x4.b.c(iVar);
iVar.f18993e.e(CampaignEx.JSON_NATIVE_VIDEO_COMPLETE, null);
}
}
@Override
public void onPlayError(String str) {
try {
p0.c(CampaignEx.JSON_NATIVE_VIDEO_ERROR, str);
o oVar = new o(str);
if (com.mbridge.msdk.foundation.controller.d.a().e()) {
com.mbridge.msdk.foundation.same.threadpool.a.b().execute(oVar);
} else {
oVar.run();
}
} catch (Throwable th) {
p0.b(TAG, th.getMessage());
}
}
@Override
public void onPlayProgress(int i10, int i11) {
int i12;
String str;
b(i10);
a(i10, i11);
sb.b bVar = this.f13905s;
if (bVar != null) {
int i13 = (i10 * 100) / i11;
int i14 = ((i10 + 1) * 100) / i11;
rb.i iVar = bVar.f19197a;
if (i13 <= 25 && 25 < i14) {
x4.b.c(iVar);
iVar.f18993e.e("firstQuartile", null);
} else if (i13 <= 50 && 50 < i14) {
x4.b.c(iVar);
iVar.f18993e.e(CampaignEx.JSON_NATIVE_VIDEO_MIDPOINT, null);
} else if (i13 <= 75 && 75 < i14) {
x4.b.c(iVar);
iVar.f18993e.e("thirdQuartile", null);
}
}
if (getReadyRate() == 100 || this.f13898l0) {
return;
}
int cDRate = getCDRate();
int readyRate = getReadyRate();
if (readyRate == 0) {
return;
}
if (cDRate > readyRate) {
cDRate = readyRate / 2;
}
if (cDRate < 0 || i10 < (i12 = (i11 * cDRate) / 100)) {
return;
}
if (this.M.getAdType() == 94 || this.M.getAdType() == 287) {
str = this.M.getRequestId() + this.M.getId() + this.M.getVideoUrlEncode();
} else {
str = this.M.getId() + this.M.getVideoUrlEncode() + this.M.getBidToken();
}
com.mbridge.msdk.videocommon.download.a a10 = com.mbridge.msdk.videocommon.download.b.getInstance().a(getUnitId(), str);
if (a10 != null) {
a10.v();
this.f13898l0 = true;
p0.b(TAG, "CDRate is : " + i12 + " and start download !");
}
}
@Override
public void onPlayProgressMS(int i10, int i11) {
}
@Override
public void onPlaySetDataSourceError(String str) {
p0.c("errorstr", str);
}
@Override
public void onPlayStarted(int i10) {
sb.b bVar = this.f13905s;
if (bVar != null) {
try {
bVar.d(i10, this.f13887f ? 1.0f : 0.0f);
} catch (IllegalArgumentException e4) {
p0.a("omsdk", e4.getMessage());
}
}
}
@Override
public void onWindowFocusChanged(boolean z3) {
super.onWindowFocusChanged(z3);
try {
this.f13885e = z3;
if (this.f13878a0 == s.VIDEO) {
setIsFrontDesk(z3);
}
r();
requestLayout();
} catch (Throwable th) {
p0.b(TAG, th.getMessage());
}
}
public void openURL(Object obj, String str) {
WindVaneWebView windVaneWebView;
p0.b(TAG, "openURL:" + str);
if (TextUtils.isEmpty(str)) {
com.mbridge.msdk.mbsignalcommon.communication.d.a(obj, "params is null");
return;
}
Context d4 = com.mbridge.msdk.foundation.controller.c.m().d();
if (TextUtils.isEmpty(str)) {
return;
}
if (d4 == null) {
try {
if ((obj instanceof com.mbridge.msdk.mbsignalcommon.windvane.a) && (windVaneWebView = ((com.mbridge.msdk.mbsignalcommon.windvane.a) obj).f13833b) != null) {
d4 = windVaneWebView.getContext();
}
} catch (Exception e4) {
p0.b(TAG, e4.getMessage());
}
}
if (d4 == null) {
return;
}
try {
JSONObject jSONObject = new JSONObject(str);
String optString = jSONObject.optString("url");
int optInt = jSONObject.optInt("type");
if (optInt == 1) {
com.mbridge.msdk.click.c.c(d4, optString);
} else if (optInt == 2) {
com.mbridge.msdk.click.c.e(d4, optString);
}
} catch (JSONException e6) {
p0.b(TAG, e6.getMessage());
} catch (Throwable th) {
p0.b(TAG, th.getMessage());
}
}
public void setAllowLoopPlay(boolean z3) {
this.f13879b = z3;
}
public void setAllowScreenChange(boolean z3) {
this.f13881c = z3;
}
public void setAllowVideoRefresh(boolean z3) {
this.f13877a = z3;
}
public void setFollowActivityOrientation(boolean z3) {
this.f13896j0 = z3;
}
public void setFullScreenViewBackgroundColor(int i10) {
this.f13906t = i10;
}
public void setIsAllowFullScreen(boolean z3) {
this.f13883d = z3;
}
public void setNativeAd(com.mbridge.msdk.out.Campaign r9) {
throw new UnsupportedOperationException("Method not decompiled: com.mbridge.msdk.nativex.view.BaseMBMediaView.setNativeAd(com.mbridge.msdk.out.Campaign):void");
}
public void setOnMediaViewListener(OnMBMediaViewListener onMBMediaViewListener) {
this.f13880b0 = onMBMediaViewListener;
}
public void setOrientation(Object obj, String str) {
}
public void setProgressVisibility(boolean z3) {
this.f13897k = z3;
MediaViewPlayerView mediaViewPlayerView = this.f13908v;
if (mediaViewPlayerView != null) {
mediaViewPlayerView.showProgressView(z3);
}
}
public void setSoundIndicatorVisibility(boolean z3) {
this.l = z3;
MediaViewPlayerView mediaViewPlayerView = this.f13908v;
if (mediaViewPlayerView != null) {
mediaViewPlayerView.showSoundIndicator(z3);
}
}
public void setVideoSoundOnOff(boolean z3) {
this.f13887f = z3;
MediaViewPlayerView mediaViewPlayerView = this.f13908v;
if (mediaViewPlayerView != null) {
if (z3) {
mediaViewPlayerView.openSound();
} else {
mediaViewPlayerView.closeSound();
}
}
}
public void showEndCardWebViewCloseBtn() {
ImageView imageView = this.f13892h0;
if (imageView == null || imageView.getVisibility() == 0) {
return;
}
this.f13892h0.setVisibility(0);
}
public void toggleCloseBtn(Object obj, String str) {
try {
if (!TextUtils.isEmpty(str)) {
try {
new JSONObject(str).optInt("state", 1);
} catch (Exception e4) {
p0.b(TAG, e4.getMessage());
}
}
p0.b(TAG, "SHOW CLOSE BTN ");
showEndCardWebViewCloseBtn();
com.mbridge.msdk.mbsignalcommon.windvane.f.a().b(obj, a(0));
} catch (Exception e6) {
p0.b(TAG, e6.getMessage());
com.mbridge.msdk.mbsignalcommon.windvane.f.a().a(obj, a(1));
}
}
public void triggerCloseBtn(Object obj, String str) {
try {
exitFullScreen();
com.mbridge.msdk.mbsignalcommon.windvane.f.a().b(obj, a(0));
} catch (Exception e4) {
p0.b(TAG, e4.getMessage());
com.mbridge.msdk.mbsignalcommon.windvane.f.a().a(obj, a(1));
}
}
public void updateViewManger(boolean z3) {
com.mbridge.msdk.nativex.view.mbfullview.a a10 = com.mbridge.msdk.nativex.view.mbfullview.a.a(getContext());
if (a10 != null) {
try {
a10.a(this.E);
a10.a(z3, !this.f13908v.isComplete(), this.E);
a10.a(z3, this.E, this.f13884d0);
} catch (NullPointerException e4) {
e4.printStackTrace();
return;
}
}
BaseView baseView = this.E;
if (!(baseView instanceof MBridgeTopFullView) || a10 == null) {
return;
}
a10.a(!z3, baseView);
}
public class f extends com.mbridge.msdk.mbsignalcommon.listener.b {
public f() {
}
@Override
public void a(WebView webView, String str) {
super.a(webView, str);
BaseMBMediaView.this.f13886e0 = true;
}
@Override
public void a(WebView webView, int i10, String str, String str2) {
super.a(webView, i10, str, str2);
BaseMBMediaView.this.f13886e0 = false;
}
}
public static final class u implements com.mbridge.msdk.nativex.listener.a {
WeakReference<BaseMBMediaView> f13938a;
public u(BaseMBMediaView baseMBMediaView) {
this.f13938a = new WeakReference<>(baseMBMediaView);
}
@Override
public void a() {
BaseMBMediaView baseMBMediaView = this.f13938a.get();
if (baseMBMediaView != null) {
baseMBMediaView.K();
}
}
@Override
public void b() {
BaseMBMediaView baseMBMediaView = this.f13938a.get();
if (baseMBMediaView != null) {
baseMBMediaView.G();
}
}
@Override
public void c() {
BaseMBMediaView baseMBMediaView = this.f13938a.get();
if (baseMBMediaView != null) {
baseMBMediaView.H();
}
}
@Override
public void d() {
BaseMBMediaView baseMBMediaView = this.f13938a.get();
if (baseMBMediaView != null) {
baseMBMediaView.J();
}
}
@Override
public void a(String str) {
BaseMBMediaView baseMBMediaView = this.f13938a.get();
if (baseMBMediaView != null) {
baseMBMediaView.a(str);
}
}
@Override
public void b(String str) {
BaseMBMediaView baseMBMediaView = this.f13938a.get();
if (baseMBMediaView != null) {
baseMBMediaView.b(str);
}
}
}
public void A() {
try {
MediaViewPlayerView mediaViewPlayerView = this.f13908v;
if (mediaViewPlayerView != null && mediaViewPlayerView.hasPrepare() && this.f13908v.isPlaying()) {
z();
}
} catch (Throwable th) {
p0.b(TAG, th.getMessage());
}
}
private void B() {
try {
SensorManager sensorManager = (SensorManager) getContext().getSystemService("sensor");
this.U = sensorManager;
this.V = sensorManager.getDefaultSensor(1);
w wVar = new w(this, null);
this.T = wVar;
this.U.registerListener(wVar, this.V, 2);
} catch (Throwable th) {
p0.b(TAG, th.getMessage());
}
}
private void C() {
Handler handler = this.L;
if (handler != null) {
handler.removeCallbacksAndMessages(null);
}
}
private void D() {
if (this.M.isReportClick()) {
return;
}
this.M.setReportClick(true);
CampaignEx campaignEx = this.M;
if (campaignEx == null || campaignEx.getNativeVideoTracking() == null || this.M.getNativeVideoTracking().d() == null) {
return;
}
Context context = getContext();
CampaignEx campaignEx2 = this.M;
com.mbridge.msdk.click.a.a(context, campaignEx2, campaignEx2.getCampaignUnitId(), this.M.getNativeVideoTracking().d(), false, false);
}
public void E() {
CampaignEx campaignEx = this.M;
if (campaignEx == null || campaignEx.getMediaViewHolder() == null) {
return;
}
com.mbridge.msdk.foundation.controller.c.m().a(getContext());
com.mbridge.msdk.mbnative.report.b.a(this.M, getContext(), getUnitId(), (com.mbridge.msdk.mbnative.listener.a) null);
CampaignEx.b mediaViewHolder = this.M.getMediaViewHolder();
if (!mediaViewHolder.l && this.f13878a0 == s.VIDEO && z0.b(this.M.getImpressionURL())) {
mediaViewHolder.l = true;
String impressionURL = this.M.getImpressionURL();
if (!impressionURL.contains("is_video=1")) {
StringBuilder sb2 = new StringBuilder(impressionURL);
if (impressionURL.contains("?")) {
sb2.append("&is_video=1");
} else {
sb2.append("?is_video=1");
}
impressionURL = sb2.toString();
}
Context context = getContext();
CampaignEx campaignEx2 = this.M;
com.mbridge.msdk.click.a.a(context, campaignEx2, campaignEx2.getCampaignUnitId(), impressionURL, false, true, com.mbridge.msdk.click.retry.a.m);
}
}
private void F() {
CampaignEx campaignEx = this.M;
if (campaignEx == null || campaignEx.getMediaViewHolder() == null || this.M.getMediaViewHolder().f12483e || TextUtils.isEmpty(this.M.getCampaignUnitId()) || this.M.getNativeVideoTracking() == null || this.M.getNativeVideoTracking().c() == null) {
return;
}
this.M.getMediaViewHolder().f12483e = true;
f();
}
public void G() {
CampaignEx.b mediaViewHolder;
CampaignEx campaignEx = this.M;
if (campaignEx == null || (mediaViewHolder = campaignEx.getMediaViewHolder()) == null || mediaViewHolder.f12484f || this.M.getNativeVideoTracking() == null || this.M.getNativeVideoTracking().m() == null) {
return;
}
mediaViewHolder.f12484f = true;
Context context = getContext();
CampaignEx campaignEx2 = this.M;
com.mbridge.msdk.click.a.a(context, campaignEx2, campaignEx2.getCampaignUnitId(), this.M.getNativeVideoTracking().m(), false, false);
}
public void H() {
CampaignEx.b mediaViewHolder;
CampaignEx campaignEx = this.M;
if (campaignEx == null || (mediaViewHolder = campaignEx.getMediaViewHolder()) == null || mediaViewHolder.f12485g || this.M.getNativeVideoTracking() == null || this.M.getNativeVideoTracking().n() == null) {
return;
}
mediaViewHolder.f12485g = true;
Context context = getContext();
CampaignEx campaignEx2 = this.M;
com.mbridge.msdk.click.a.a(context, campaignEx2, campaignEx2.getCampaignUnitId(), this.M.getNativeVideoTracking().n(), false, false);
}
public void I() {
CampaignEx campaignEx = this.M;
if (campaignEx == null || campaignEx.getMediaViewHolder() == null || this.M.getMediaViewHolder().f12482d || TextUtils.isEmpty(this.M.getCampaignUnitId()) || this.M.getNativeVideoTracking() == null || this.M.getNativeVideoTracking().i() == null) {
return;
}
this.M.getMediaViewHolder().f12482d = true;
Context context = getContext();
CampaignEx campaignEx2 = this.M;
com.mbridge.msdk.click.a.a(context, campaignEx2, campaignEx2.getCampaignUnitId(), this.M.getNativeVideoTracking().i(), false, false);
}
public void J() {
CampaignEx.b mediaViewHolder;
CampaignEx campaignEx = this.M;
if (campaignEx == null || (mediaViewHolder = campaignEx.getMediaViewHolder()) == null || mediaViewHolder.f12487i || this.M.getNativeVideoTracking() == null || this.M.getNativeVideoTracking().p() == null) {
return;
}
mediaViewHolder.f12487i = true;
Context context = getContext();
CampaignEx campaignEx2 = this.M;
com.mbridge.msdk.click.a.a(context, campaignEx2, campaignEx2.getCampaignUnitId(), this.M.getNativeVideoTracking().p(), false, false);
}
public void K() {
CampaignEx.b mediaViewHolder;
CampaignEx campaignEx = this.M;
if (campaignEx == null || (mediaViewHolder = campaignEx.getMediaViewHolder()) == null || mediaViewHolder.f12488j || this.M.getNativeVideoTracking() == null || this.M.getNativeVideoTracking().s() == null) {
return;
}
mediaViewHolder.f12488j = true;
Context context = getContext();
CampaignEx campaignEx2 = this.M;
com.mbridge.msdk.click.a.a(context, campaignEx2, campaignEx2.getCampaignUnitId(), this.M.getNativeVideoTracking().s(), false, false);
}
public void L() {
CampaignEx.b mediaViewHolder;
CampaignEx campaignEx = this.M;
if (campaignEx == null || (mediaViewHolder = campaignEx.getMediaViewHolder()) == null || mediaViewHolder.f12489k || this.M.getNativeVideoTracking() == null || this.M.getNativeVideoTracking().t() == null) {
return;
}
mediaViewHolder.f12489k = true;
Context context = getContext();
CampaignEx campaignEx2 = this.M;
com.mbridge.msdk.click.a.a(context, campaignEx2, campaignEx2.getCampaignUnitId(), this.M.getNativeVideoTracking().t(), false, false);
}
private void M() {
this.f13885e = true;
this.f13889g = true;
this.f13891h = false;
this.f13893i = false;
this.f13895j = false;
this.f13902p = false;
}
private void N() {
rb.b bVar;
try {
this.f13878a0 = a(true);
changeNoticeURL();
s sVar = this.f13878a0;
if (sVar == s.BIG_IMAGE) {
CampaignEx campaignEx = this.M;
if (campaignEx != null && TextUtils.isEmpty(campaignEx.getVideoUrlEncode()) && (bVar = this.f13903q) != null) {
try {
bVar.d(this.B);
this.f13904r = rb.a.a(this.f13903q);
this.f13903q.f();
rb.a aVar = this.f13904r;
if (aVar != null) {
aVar.b();
}
} catch (Exception e4) {
p0.a("omsdk", e4.getMessage());
}
}
V();
i();
} else if (sVar == s.VIDEO) {
U();
} else if (sVar == s.GIF) {
j();
R();
}
this.f13901o = true;
} catch (Throwable th) {
p0.b(TAG, th.getMessage(), th);
}
}
public void O() {
try {
if (this.G == null && this.f13892h0 == null) {
return;
}
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(u0.a(getContext(), 30.0f), u0.a(getContext(), 30.0f));
layoutParams.addRule(11);
layoutParams.addRule(10);
if (this.f13884d0 == 0 && com.mbridge.msdk.foundation.tools.e.a(getContext())) {
layoutParams.rightMargin = u0.c(getContext()) + u0.a(getContext(), 8.0f);
} else {
layoutParams.rightMargin = u0.a(getContext(), 8.0f);
}
layoutParams.topMargin = u0.a(getContext(), 8.0f);
RelativeLayout relativeLayout = this.G;
if (relativeLayout != null) {
relativeLayout.setLayoutParams(layoutParams);
}
ImageView imageView = this.f13892h0;
if (imageView != null) {
imageView.setLayoutParams(layoutParams);
}
updateViewManger(true);
} catch (Throwable th) {
p0.b(TAG, th.getMessage());
}
}
public void P() {
try {
if (this.G == null && this.f13892h0 == null) {
return;
}
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(u0.a(getContext(), 30.0f), u0.a(getContext(), 30.0f));
layoutParams.addRule(11);
layoutParams.addRule(10);
layoutParams.topMargin = u0.a(getContext(), 8.0f);
layoutParams.rightMargin = u0.a(getContext(), 8.0f);
RelativeLayout relativeLayout = this.G;
if (relativeLayout != null) {
relativeLayout.setLayoutParams(layoutParams);
}
ImageView imageView = this.f13892h0;
if (imageView != null) {
imageView.setLayoutParams(layoutParams);
}
updateViewManger(false);
} catch (Throwable th) {
p0.b(TAG, th.getMessage());
}
}
private void Q() {
try {
this.D.setFocusableInTouchMode(true);
this.D.requestFocus();
this.D.setOnKeyListener(new r());
this.D.setOnClickListener(new a());
this.G.setOnClickListener(new b());
CampaignEx campaignEx = this.M;
if (campaignEx != null) {
a1.a(this.H, campaignEx.getLocalRequestId(), this.M.getLocalAllowTrackClick());
}
this.H.setOnClickListener(new c());
} catch (Exception e4) {
p0.b(TAG, e4.getMessage());
}
}
public void R() {
X();
}
public void S() {
try {
if (getVisibility() != 0) {
return;
}
CampaignEx campaignEx = this.M;
if (com.mbridge.msdk.foundation.tools.g.b(campaignEx, this.k0, this, campaignEx.getImpReportType())) {
com.mbridge.msdk.setting.l unitSetting = getUnitSetting();
int i10 = 0;
int s8 = unitSetting != null ? unitSetting.s() : 0;
CampaignEx campaignEx2 = this.M;
if (campaignEx2 == null || campaignEx2.getImpReportType() != 1) {
i10 = s8;
}
Message obtainMessage = this.L.obtainMessage();
obtainMessage.what = 3;
obtainMessage.obj = this;
this.L.sendMessageDelayed(obtainMessage, (i10 == 0 ? 0L : i10 * 1000) + 300);
}
if (this.f13878a0 == s.VIDEO) {
MediaViewPlayerView mediaViewPlayerView = this.f13908v;
if (mediaViewPlayerView == null) {
b();
return;
}
if (this.M != mediaViewPlayerView.getCampaign()) {
this.f13908v.release();
b();
if (getParent() != null) {
((View) getParent()).invalidate();
}
requestLayout();
}
}
} catch (Throwable th) {
p0.b(TAG, th.getMessage());
}
}
private void e() {
try {
OnMBMediaViewListener onMBMediaViewListener = this.f13880b0;
if (onMBMediaViewListener != null) {
onMBMediaViewListener.onVideoAdClicked(this.M);
}
OnMBMediaViewListenerPlus onMBMediaViewListenerPlus = this.f13882c0;
if (onMBMediaViewListenerPlus != null) {
onMBMediaViewListenerPlus.onVideoAdClicked(this.M);
}
} catch (Exception e4) {
p0.b(TAG, e4.getMessage());
}
}
private void f() {
try {
CampaignEx campaignEx = this.M;
if (campaignEx == null || campaignEx.getNativeVideoTracking() == null) {
return;
}
String[] c4 = this.M.getNativeVideoTracking().c();
int i10 = this.f13893i ? f13875n0 : f13876o0;
for (String str : c4) {
if (!TextUtils.isEmpty(str)) {
Context context = getContext();
CampaignEx campaignEx2 = this.M;
com.mbridge.msdk.click.a.a(context, campaignEx2, campaignEx2.getCampaignUnitId(), str + "&orienation=" + i10, false, false);
}
}
} catch (Exception e4) {
p0.b(TAG, e4.getMessage());
}
}
public void g() {
try {
FrameLayout frameLayout = (FrameLayout) getRootView().findViewById(R.id.content);
FrameLayout frameLayout2 = (FrameLayout) getRootView().findViewById(100);
RelativeLayout relativeLayout = (RelativeLayout) getRootView().findViewById(101);
RelativeLayout relativeLayout2 = (RelativeLayout) getRootView().findViewById(103);
if (relativeLayout2 == null && relativeLayout != null) {
relativeLayout2 = (RelativeLayout) relativeLayout.findViewById(103);
}
RelativeLayout relativeLayout3 = (RelativeLayout) getRootView().findViewById(h0.a(getContext(), "mbridge_full_rl_playcontainer", "id"));
if (relativeLayout3 == null && relativeLayout2 != null) {
relativeLayout3 = (RelativeLayout) relativeLayout2.findViewById(h0.a(getContext(), "mbridge_full_rl_playcontainer", "id"));
}
RelativeLayout relativeLayout4 = (RelativeLayout) getRootView().findViewById(h0.a(getContext(), "mbridge_full_player_parent", "id"));
if (relativeLayout4 == null && relativeLayout3 != null) {
relativeLayout4 = (RelativeLayout) relativeLayout3.findViewById(h0.a(getContext(), "mbridge_full_player_parent", "id"));
}
ProgressBar progressBar = (ProgressBar) getRootView().findViewById(h0.a(getContext(), "mbridge_full_pb_loading", "id"));
RelativeLayout relativeLayout5 = (RelativeLayout) getRootView().findViewById(h0.a(getContext(), "mbridge_full_rl_install", "id"));
LinearLayout linearLayout = (LinearLayout) getRootView().findViewById(h0.a(getContext(), "mbridge_full_ll_pro_dur", "id"));
ViewGroup viewGroup = frameLayout2 != null ? (ViewGroup) frameLayout2.getParent() : null;
if (relativeLayout2 != null) {
relativeLayout2.removeView(linearLayout);
} else if (linearLayout != null && linearLayout.getParent() != null) {
((ViewGroup) linearLayout.getParent()).removeView(linearLayout);
}
RelativeLayout relativeLayout6 = this.f13890g0;
if (relativeLayout6 != null) {
if (relativeLayout2 != null) {
relativeLayout2.removeView(relativeLayout6);
} else if (relativeLayout6.getParent() != null) {
((ViewGroup) this.f13890g0.getParent()).removeView(this.f13890g0);
}
this.A.setBackListener(null);
this.A.setObject(null);
this.A = null;
this.f13890g0 = null;
}
if (relativeLayout2 != null) {
relativeLayout2.removeView(relativeLayout5);
} else if (relativeLayout5 != null && relativeLayout5.getParent() != null) {
((ViewGroup) relativeLayout5.getParent()).removeView(relativeLayout5);
}
if (relativeLayout2 != null) {
relativeLayout2.removeView(progressBar);
} else if (progressBar != null && progressBar.getParent() != null) {
((ViewGroup) progressBar.getParent()).removeView(progressBar);
}
if (relativeLayout4 != null) {
relativeLayout4.removeView(this.f13908v);
}
if (relativeLayout3 != null) {
relativeLayout3.removeView(relativeLayout4);
} else if (relativeLayout4 != null && relativeLayout4.getParent() != null) {
((ViewGroup) relativeLayout4.getParent()).removeView(relativeLayout4);
}
if (relativeLayout2 != null) {
relativeLayout2.removeView(relativeLayout3);
} else if (relativeLayout3 == null || relativeLayout3.getParent() == null) {
BaseView baseView = this.E;
if (baseView != null) {
baseView.removeView(this.F);
}
} else {
((ViewGroup) relativeLayout3.getParent()).removeView(relativeLayout3);
}
if (relativeLayout != null) {
relativeLayout.removeView(relativeLayout2);
} else if (relativeLayout2 == null || relativeLayout2.getParent() == null) {
View view = this.D;
if (view != null) {
((ViewGroup) view).removeView(this.E);
((ViewGroup) this.D.getParent()).removeView(this.D);
}
} else {
((ViewGroup) relativeLayout2.getParent()).removeView(relativeLayout2);
}
if (frameLayout != null) {
if (relativeLayout != null) {
frameLayout.removeView(relativeLayout);
} else {
frameLayout.removeView(this.D);
if (this.D.getParent() != null) {
((ViewGroup) this.D.getParent()).removeView(this.D);
this.D.setVisibility(8);
}
}
}
setVisibility(0);
requestLayout();
if (viewGroup != null) {
if (this.f13908v.getParent() != null && this.f13908v.getParent() != viewGroup) {
((ViewGroup) this.f13908v.getParent()).removeView(this.f13908v);
}
viewGroup.addView(this.f13908v, this.K);
viewGroup.removeView(frameLayout2);
viewGroup.invalidate();
}
d();
this.f13891h = false;
MediaViewPlayerView mediaViewPlayerView = this.f13908v;
if (mediaViewPlayerView != null) {
mediaViewPlayerView.setExitFullScreen();
if (this.f13887f) {
this.f13908v.openSound();
} else {
this.f13908v.closeSound();
}
this.f13908v.gonePauseView();
}
} catch (Exception e4) {
p0.b(TAG, e4.getMessage());
}
}
private void h() {
try {
e();
if (this.M != null && !z0.a(getUnitId())) {
D();
com.mbridge.msdk.click.a aVar = new com.mbridge.msdk.click.a(getContext(), getUnitId());
aVar.a(new n());
aVar.a(this.M);
}
} catch (Exception e4) {
p0.b(TAG, e4.getMessage());
}
}
private void i() {
try {
CampaignEx campaignEx = this.M;
if (campaignEx == null) {
return;
}
String imageUrl = campaignEx.getImageUrl();
if (!z0.a(imageUrl) && getContext() != null) {
com.mbridge.msdk.foundation.same.image.b.a(com.mbridge.msdk.foundation.controller.c.m().d()).a(imageUrl, new l());
}
} catch (Throwable th) {
p0.b(TAG, th.getMessage());
}
}
private void j() {
try {
CampaignEx campaignEx = this.M;
if (campaignEx == null) {
return;
}
String gifUrl = campaignEx.getGifUrl();
if (!z0.a(gifUrl) && getContext() != null) {
this.f13912z.loadDataWithBaseURL(null, "<!DOCTYPE html><html lang=\"en\"><head> <meta charset=\"UTF-8\"> <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"><meta http-equiv=\"X-UA-Compatible\" content=\"ie=edge\"> <title>Document</title> <style> *{ margin: 0; padding: 0; } html, body{ width: 100%; height: 100%; } body{ background-image: url('gifUrl'); background-position: center; background-size: contain; background-repeat: no-repeat; } </style></head><body></body></html>".replace("gifUrl", gifUrl), "text/html", "utf-8", null);
this.f13912z.setInterceptTouch(true);
CampaignEx campaignEx2 = this.M;
if (campaignEx2 != null) {
a1.a(this.f13911y, campaignEx2.getLocalRequestId(), this.M.getLocalAllowTrackClick());
}
this.f13911y.setOnClickListener(new m());
}
} catch (Throwable th) {
p0.b(TAG, th.getMessage());
}
}
private boolean k() {
try {
this.F = this.E.getMBridgeFullPlayContainer();
this.J = this.E.getMBridgeFullPlayerParent();
this.G = this.E.getMBridgeFullClose();
this.H = this.E.getMBridgeFullTvInstall();
this.I = this.E.getMBridgeFullPb();
return true;
} catch (Throwable th) {
p0.b(TAG, th.getMessage());
return false;
}
}
public void l() {
try {
MediaViewPlayerView mediaViewPlayerView = this.f13908v;
if (mediaViewPlayerView == null) {
return;
}
mediaViewPlayerView.onClickPlayerView();
} catch (Throwable th) {
p0.b(TAG, th.getMessage());
}
}
public void m() {
try {
ProgressBar progressBar = this.I;
if (progressBar != null) {
progressBar.setVisibility(8);
}
} catch (Exception e4) {
p0.b(TAG, e4.getMessage());
}
}
public void n() {
try {
ProgressBar progressBar = this.C;
if (progressBar != null) {
progressBar.setVisibility(8);
}
} catch (Exception e4) {
p0.b(TAG, e4.getMessage());
}
}
public void o() {
int i10;
int i11;
int i12;
try {
if (this.f13878a0 != s.BIG_IMAGE || (i10 = this.O) == 0 || (i11 = this.S) == 0 || (i12 = this.R) == 0) {
return;
}
int i13 = (i10 * i11) / i12;
MyImageView myImageView = this.B;
if (myImageView == null || i13 == 0) {
return;
}
RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) myImageView.getLayoutParams();
layoutParams.width = this.O;
layoutParams.height = i13;
this.B.setLayoutParams(layoutParams);
} catch (Throwable th) {
p0.b(TAG, th.getMessage());
}
}
private void p() {
try {
this.f13893i = u0.i(getContext()) >= u0.h(getContext());
this.f13895j = this.f13893i;
} catch (Throwable th) {
p0.b(TAG, th.getMessage());
}
}
public View q() {
try {
this.f13890g0 = new RelativeLayout(getContext());
this.f13890g0.setLayoutParams(new RelativeLayout.LayoutParams(-1, -1));
ImageView imageView = new ImageView(getContext());
this.f13892h0 = imageView;
imageView.setScaleType(ImageView.ScaleType.FIT_XY);
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(u0.a(getContext(), 30.0f), u0.a(getContext(), 30.0f));
layoutParams.addRule(11);
layoutParams.addRule(10);
layoutParams.topMargin = u0.a(getContext(), 8.0f);
layoutParams.rightMargin = u0.a(getContext(), 8.0f);
this.f13892h0.setLayoutParams(layoutParams);
this.f13892h0.setBackgroundResource(h0.a(getContext(), "mbridge_nativex_close", "drawable"));
this.f13892h0.setOnClickListener(new q());
this.A.setLayoutParams(new RelativeLayout.LayoutParams(-1, -1));
this.f13890g0.addView(this.A);
this.f13890g0.addView(this.f13892h0);
return this.f13890g0;
} catch (Exception e4) {
p0.b(TAG, e4.getMessage());
return null;
}
}
private void r() {
try {
if (this.f13891h) {
MediaViewPlayerView mediaViewPlayerView = this.f13908v;
if (mediaViewPlayerView == null) {
p0.b(TAG, "fullscreen playerview is null return");
return;
}
if (!this.f13885e) {
mediaViewPlayerView.pause();
return;
}
if (mediaViewPlayerView.isPlaying()) {
p0.c(TAG, "fullscreen windowfocuse true isPlaying do nothing return");
return;
}
MediaViewPlayerView mediaViewPlayerView2 = this.f13908v;
if (mediaViewPlayerView2 == null || mediaViewPlayerView2.isComplete() || this.f13908v.getIsActiviePause()) {
return;
}
this.f13908v.onClickPlayButton();
}
} catch (Throwable th) {
p0.b(TAG, th.getMessage());
}
}
private void s() {
try {
p();
a(this.F, getAllScreenWidth(), getAllScreenHeight());
com.mbridge.msdk.nativex.view.mbfullview.a.a(getContext()).a(this.E, this.f13893i);
if (this.f13893i) {
O();
} else {
P();
}
this.L.postDelayed(new d(), 3000L);
} catch (Throwable th) {
p0.b(TAG, th.getMessage());
}
}
private void t() {
this.L = new j();
}
public void u() {
try {
if (this.f13878a0 != s.VIDEO || this.f13909w == null) {
return;
}
int allScreenWidth = (int) getAllScreenWidth();
int h7 = u0.h(getContext());
if (this.f13891h) {
RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) this.F.getLayoutParams();
layoutParams.width = allScreenWidth;
layoutParams.height = h7;
layoutParams.addRule(13);
this.F.setLayoutParams(layoutParams);
} else {
RelativeLayout.LayoutParams layoutParams2 = (RelativeLayout.LayoutParams) this.f13909w.getLayoutParams();
layoutParams2.width = this.O;
layoutParams2.height = this.N;
layoutParams2.addRule(13);
this.f13909w.setLayoutParams(layoutParams2);
}
S();
if (this.f13891h) {
a(this.f13908v, allScreenWidth, h7);
} else {
a(this.f13908v, this.O, this.N);
}
} catch (Exception e4) {
p0.b(TAG, e4.getMessage());
}
}
private void v() {
String[] split;
try {
CampaignEx campaignEx = this.M;
if (campaignEx == null || z0.a(campaignEx.getVideoResolution()) || (split = this.M.getVideoResolution().split("x")) == null || split.length != 2) {
return;
}
String str = split[0];
String str2 = split[1];
double m5 = u0.m(str);
double m7 = u0.m(str2);
if (m5 <= 0.0d || m7 <= 0.0d) {
return;
}
this.P = m5;
this.Q = m7;
} catch (Throwable th) {
p0.b(TAG, th.getMessage());
}
}
private void w() {
int a10 = h0.a(getContext(), "mbridge_nativex_mbmediaview", TtmlNode.TAG_LAYOUT);
if (!h0.a(a10)) {
p0.b(TAG, "can not find mediaview resource");
return;
}
View inflate = LayoutInflater.from(getContext()).inflate(a10, (ViewGroup) null);
this.f13910x = (RelativeLayout) inflate.findViewById(h0.a(getContext(), "mbridge_rl_mediaview_root", "id"));
this.f13909w = (RelativeLayout) inflate.findViewById(h0.a(getContext(), "mbridge_ll_playerview_container", "id"));
this.B = inflate.findViewById(h0.a(getContext(), "mbridge_my_big_img", "id"));
this.C = (ProgressBar) inflate.findViewById(h0.a(getContext(), "mbridge_native_pb", "id"));
this.f13911y = (RelativeLayout) inflate.findViewById(h0.a(getContext(), "mbridge_nativex_webview_layout", "id"));
this.f13912z = (WindVaneWebViewForNV) inflate.findViewById(h0.a(getContext(), "mbridge_nativex_webview_layout_webview", "id"));
this.f13910x.setClickable(true);
addView(inflate, -1, -1);
}
public void x() {
RelativeLayout relativeLayout;
int i10;
int i11;
try {
if (this.f13878a0 == s.GIF) {
int i12 = this.O;
if (i12 == 0 || (i10 = this.S) == 0 || (i11 = this.R) == 0) {
if (i12 == 0 || (relativeLayout = this.f13911y) == null) {
return;
}
RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) relativeLayout.getLayoutParams();
int i13 = this.O;
layoutParams.width = i13;
layoutParams.height = (i13 * 627) / 1200;
layoutParams.addRule(13);
this.f13911y.setLayoutParams(layoutParams);
return;
}
int i14 = (i12 * i10) / i11;
RelativeLayout relativeLayout2 = this.f13911y;
if (relativeLayout2 == null || i14 == 0) {
return;
}
RelativeLayout.LayoutParams layoutParams2 = (RelativeLayout.LayoutParams) relativeLayout2.getLayoutParams();
layoutParams2.width = this.O;
layoutParams2.height = i14;
layoutParams2.addRule(13);
this.f13911y.setLayoutParams(layoutParams2);
}
} catch (Throwable th) {
p0.b(TAG, th.getMessage());
}
}
private boolean y() {
com.mbridge.msdk.setting.l unitSetting;
try {
unitSetting = getUnitSetting();
} catch (Throwable th) {
p0.b(TAG, th.getMessage());
}
if (unitSetting == null) {
return false;
}
int L = unitSetting.L();
if (L == 1) {
return u0.n(getContext());
}
if (L == 2) {
return false;
}
return L == 3 ? !r0.a().a("s_a_w_n_c", true) || u0.l(getContext()) : u0.n(getContext());
}
private void z() {
try {
MediaViewPlayerView mediaViewPlayerView = this.f13908v;
if (mediaViewPlayerView != null) {
mediaViewPlayerView.pause();
}
} catch (Throwable th) {
p0.b(TAG, th.getMessage());
}
}
public void setOnMediaViewListener(OnMBMediaViewListenerPlus onMBMediaViewListenerPlus) {
this.f13882c0 = onMBMediaViewListenerPlus;
}
private void d() {
try {
this.f13908v.showSoundIndicator(this.l);
this.f13908v.showProgressView(this.f13897k);
OnMBMediaViewListener onMBMediaViewListener = this.f13880b0;
if (onMBMediaViewListener != null) {
onMBMediaViewListener.onExitFullscreen();
}
OnMBMediaViewListenerPlus onMBMediaViewListenerPlus = this.f13882c0;
if (onMBMediaViewListenerPlus != null) {
onMBMediaViewListenerPlus.onExitFullscreen();
}
sb.b bVar = this.f13905s;
if (bVar != null) {
sb.c cVar = sb.c.NORMAL;
rb.i iVar = bVar.f19197a;
x4.b.c(iVar);
JSONObject jSONObject = new JSONObject();
xb.b.b(jSONObject, "state", cVar);
iVar.f18993e.e("playerStateChange", jSONObject);
}
} catch (Exception e4) {
p0.b(TAG, e4.getMessage());
}
}
private void c() {
try {
OnMBMediaViewListener onMBMediaViewListener = this.f13880b0;
if (onMBMediaViewListener != null) {
onMBMediaViewListener.onEnterFullscreen();
}
OnMBMediaViewListenerPlus onMBMediaViewListenerPlus = this.f13882c0;
if (onMBMediaViewListenerPlus != null) {
onMBMediaViewListenerPlus.onEnterFullscreen();
}
sb.b bVar = this.f13905s;
if (bVar != null) {
sb.c cVar = sb.c.FULLSCREEN;
rb.i iVar = bVar.f19197a;
x4.b.c(iVar);
JSONObject jSONObject = new JSONObject();
xb.b.b(jSONObject, "state", cVar);
iVar.f18993e.e("playerStateChange", jSONObject);
}
} catch (Exception e4) {
p0.b(TAG, e4.getMessage());
}
}
private void b(Context context) {
try {
t();
w();
this.k0 = context;
} catch (Throwable th) {
p0.b(TAG, th.getMessage());
}
}
public void a(Campaign campaign, String str) {
try {
OnMBMediaViewListener onMBMediaViewListener = this.f13880b0;
if (onMBMediaViewListener != null) {
onMBMediaViewListener.onFinishRedirection(campaign, str);
}
OnMBMediaViewListenerPlus onMBMediaViewListenerPlus = this.f13882c0;
if (onMBMediaViewListenerPlus != null) {
onMBMediaViewListenerPlus.onFinishRedirection(campaign, str);
}
} catch (Exception e4) {
p0.b(TAG, e4.getMessage());
}
}
public void b(Campaign campaign, String str) {
try {
OnMBMediaViewListener onMBMediaViewListener = this.f13880b0;
if (onMBMediaViewListener != null) {
onMBMediaViewListener.onRedirectionFailed(campaign, str);
}
OnMBMediaViewListenerPlus onMBMediaViewListenerPlus = this.f13882c0;
if (onMBMediaViewListenerPlus != null) {
onMBMediaViewListenerPlus.onRedirectionFailed(campaign, str);
}
} catch (Exception e4) {
p0.b(TAG, e4.getMessage());
}
}
public void c(Campaign campaign, String str) {
try {
OnMBMediaViewListener onMBMediaViewListener = this.f13880b0;
if (onMBMediaViewListener != null) {
onMBMediaViewListener.onStartRedirection(campaign, str);
}
OnMBMediaViewListenerPlus onMBMediaViewListenerPlus = this.f13882c0;
if (onMBMediaViewListenerPlus != null) {
onMBMediaViewListenerPlus.onStartRedirection(campaign, str);
}
} catch (Exception e4) {
p0.b(TAG, e4.getMessage());
}
}
public void a(String str) {
try {
if (TextUtils.isEmpty(str) || this.f13900n.contains(str)) {
return;
}
this.f13900n.add(str);
OnMBMediaViewListenerPlus onMBMediaViewListenerPlus = this.f13882c0;
if (onMBMediaViewListenerPlus != null) {
onMBMediaViewListenerPlus.onVideoComplete();
}
} catch (Exception e4) {
p0.b(TAG, e4.getMessage());
}
}
public void b(String str) {
try {
if (TextUtils.isEmpty(str) || this.m.contains(str)) {
return;
}
this.m.add(str);
OnMBMediaViewListener onMBMediaViewListener = this.f13880b0;
if (onMBMediaViewListener != null) {
onMBMediaViewListener.onVideoStart();
}
OnMBMediaViewListenerPlus onMBMediaViewListenerPlus = this.f13882c0;
if (onMBMediaViewListenerPlus != null) {
onMBMediaViewListenerPlus.onVideoStart();
}
} catch (Exception e4) {
p0.b(TAG, e4.getMessage());
}
}
public void a(Context context) {
h();
}
public void c(String str) {
String str2;
com.mbridge.msdk.foundation.entity.n nVar;
try {
com.mbridge.msdk.foundation.db.n a10 = com.mbridge.msdk.foundation.db.n.a(com.mbridge.msdk.foundation.db.g.a(getContext()));
if (!TextUtils.isEmpty(this.M.getNoticeUrl())) {
int s8 = l0.s(getContext());
str2 = str;
nVar = new com.mbridge.msdk.foundation.entity.n("2000021", s8, this.M.getNoticeUrl(), str2, l0.a(getContext(), s8));
} else {
str2 = str;
if (TextUtils.isEmpty(this.M.getClickURL())) {
nVar = null;
} else {
int s10 = l0.s(getContext());
com.mbridge.msdk.foundation.entity.n nVar2 = new com.mbridge.msdk.foundation.entity.n("2000021", s10, this.M.getClickURL(), str2, l0.a(getContext(), s10));
str2 = str2;
nVar = nVar2;
}
}
if (nVar != null) {
nVar.b(this.M.getId());
nVar.v(this.M.getVideoUrlEncode());
nVar.m(str2);
nVar.n(this.M.getRequestId());
nVar.o(this.M.getRequestIdNotice());
nVar.u(getUnitId());
a10.a(nVar);
}
} catch (Exception e4) {
p0.b(TAG, e4.getMessage());
}
}
private s a(boolean z3) {
try {
CampaignEx campaignEx = this.M;
if (campaignEx != null) {
if (z0.a(campaignEx.getVideoUrlEncode())) {
s sVar = z0.b(this.M.getImageUrl()) ? s.BIG_IMAGE : null;
if (z0.b(this.M.getGifUrl())) {
if (z0.a(this.M.getImageUrl())) {
sVar = s.GIF;
}
this.f13912z.setWebViewClient(new y(this));
j();
}
return sVar;
}
if (this.f13889g && this.W != null) {
if (z0.b(this.M.getVideoUrlEncode()) && z0.a(this.M.getImageUrl())) {
return s.VIDEO;
}
if (z0.b(this.M.getVideoUrlEncode()) && z0.b(this.M.getImageUrl())) {
if (com.mbridge.msdk.videocommon.download.l.a(this.W, getReadyRate())) {
return s.VIDEO;
}
s sVar2 = s.BIG_IMAGE;
if (z3 && this.f13877a) {
this.W.b(new x(this));
}
return sVar2;
}
} else {
return s.BIG_IMAGE;
}
}
return null;
} catch (Throwable th) {
p0.b(TAG, th.getMessage());
return s.BIG_IMAGE;
}
}
private void b() {
try {
if (this.M == null) {
p0.c(TAG, "campaign is null addPlayerView return");
}
MediaViewPlayerView mediaViewPlayerView = this.f13908v;
if (mediaViewPlayerView != null && mediaViewPlayerView.getParent() != null) {
((ViewGroup) this.f13908v.getParent()).removeView(this.f13908v);
}
Z();
MediaViewPlayerView mediaViewPlayerView2 = new MediaViewPlayerView(getContext());
this.f13908v = mediaViewPlayerView2;
mediaViewPlayerView2.showProgressView(this.f13897k);
this.f13908v.showSoundIndicator(this.l);
if (this.f13887f) {
this.f13908v.openSound();
} else {
this.f13908v.closeSound();
}
this.f13908v.setAllowLoopPlay(this.f13879b);
} catch (Throwable th) {
th = th;
}
try {
this.f13908v.initPlayerViewData(getPlayUrl(), this.M, y(), this, this.W, getUnitId());
this.f13908v.setOnMediaViewPlayerViewListener(new u(this));
this.f13909w.addView(this.f13908v, -1, -1);
T();
rb.b bVar = this.f13903q;
if (bVar != null) {
MediaViewPlayerView mediaViewPlayerView3 = this.f13908v;
if (mediaViewPlayerView3 != null) {
mediaViewPlayerView3.registerView(bVar);
}
this.f13904r = rb.a.a(this.f13903q);
this.f13905s = sb.b.b(this.f13903q);
this.f13903q.f();
this.f13904r.d(new ha.c(12));
MediaViewPlayerView mediaViewPlayerView4 = this.f13908v;
if (mediaViewPlayerView4 != null) {
mediaViewPlayerView4.setVideoEvents(this.f13905s);
}
try {
rb.a aVar = this.f13904r;
if (aVar != null) {
aVar.b();
}
} catch (Exception e4) {
p0.a("omsdk", e4.getMessage());
}
}
} catch (Throwable th2) {
th = th2;
p0.b(TAG, th.getMessage());
}
}
public BaseMBMediaView(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
this.f13877a = true;
this.f13879b = true;
this.f13881c = true;
this.f13883d = true;
this.f13885e = true;
this.f13887f = false;
this.f13889g = true;
this.f13891h = false;
this.f13893i = false;
this.f13895j = false;
this.f13897k = true;
this.l = true;
this.m = new ArrayList<>();
this.f13900n = new ArrayList<>();
this.f13901o = false;
this.f13902p = false;
this.f13903q = null;
this.f13904r = null;
this.f13905s = null;
this.f13906t = 0;
this.f13907u = false;
this.W = null;
this.f13878a0 = null;
this.f13886e0 = false;
this.f13888f0 = false;
this.f13896j0 = false;
this.f13898l0 = false;
this.f13899m0 = new h();
b(context);
}
private boolean c(Context context) {
return (context.getResources().getConfiguration().screenLayout & 15) >= 3;
}
public boolean a(View view) {
try {
return !d1.a(view, this.M == null ? 0 : r1.getImpReportType());
} catch (Throwable th) {
p0.b(TAG, th.getMessage());
return false;
}
}
public void a() {
WindowInsets rootWindowInsets;
CampaignEx campaignEx;
try {
if (getRootView() != null && (getRootView() instanceof ViewGroup)) {
BaseView.a handleViewStyleResult = handleViewStyleResult(getContext());
if (handleViewStyleResult == null) {
return;
}
BaseView fullScreenViewByStyle = getFullScreenViewByStyle(getContext(), handleViewStyleResult);
this.E = fullScreenViewByStyle;
if (fullScreenViewByStyle != null && k()) {
com.mbridge.msdk.nativex.view.mbfullview.a a10 = com.mbridge.msdk.nativex.view.mbfullview.a.a(getContext());
BaseView baseView = this.E;
a10.a(baseView.style, this.M, baseView);
this.f13891h = true;
this.f13902p = false;
MediaViewPlayerView mediaViewPlayerView = this.f13908v;
if (mediaViewPlayerView != null) {
mediaViewPlayerView.setEnterFullScreen();
this.f13908v.setIsActivePause(false);
}
c();
FrameLayout frameLayout = (FrameLayout) getRootView().findViewById(R.id.content);
RelativeLayout relativeLayout = new RelativeLayout(getContext());
this.D = relativeLayout;
relativeLayout.setClickable(true);
ViewGroup viewGroup = (ViewGroup) this.f13908v.getParent();
int childCount = viewGroup.getChildCount();
int i10 = 0;
while (i10 < childCount && viewGroup.getChildAt(i10) != this.f13908v) {
i10++;
}
this.K = i10;
FrameLayout frameLayout2 = new FrameLayout(getContext());
frameLayout2.setId(100);
viewGroup.addView(frameLayout2, i10, new ViewGroup.LayoutParams(getWidth(), getHeight()));
viewGroup.removeView(this.f13908v);
ViewGroup.LayoutParams layoutParams = new FrameLayout.LayoutParams(-1, -1);
relativeLayout.setId(101);
new RelativeLayout.LayoutParams(-1, -1);
this.J.addView(this.f13908v, new RelativeLayout.LayoutParams(-1, -1));
if (this.J != null && (campaignEx = this.M) != null && campaignEx.getPrivacyButtonTemplateVisibility() != 0) {
try {
View mBAdChoice = new MBAdChoice(com.mbridge.msdk.foundation.controller.c.m().d());
mBAdChoice.setCampaign(this.M);
RelativeLayout.LayoutParams layoutParams2 = new RelativeLayout.LayoutParams(u0.a(com.mbridge.msdk.foundation.controller.c.m().d(), 12.0f), u0.a(com.mbridge.msdk.foundation.controller.c.m().d(), 12.0f));
layoutParams2.addRule(11);
layoutParams2.addRule(12);
this.J.addView(mBAdChoice, layoutParams2);
} catch (Exception e4) {
e4.printStackTrace();
}
}
if (this.f13907u) {
a(frameLayout);
}
frameLayout.addView(relativeLayout, layoutParams);
int i11 = i.f13921a[this.E.style.ordinal()] != 2 ? -16777216 : -1;
int i12 = this.f13906t;
if (i12 != 0) {
relativeLayout.setBackgroundColor(i12);
} else {
relativeLayout.setBackgroundColor(i11);
}
this.E.setId(103);
RelativeLayout.LayoutParams layoutParams3 = new RelativeLayout.LayoutParams(-1, -1);
int[] iArr = new int[2];
frameLayout.getLocationInWindow(iArr);
int i13 = iArr[1];
this.f13884d0 = i13;
if (i13 == 0 && (rootWindowInsets = getRootWindowInsets()) != null) {
layoutParams3.setMargins(0, rootWindowInsets.getStableInsetTop(), 0, 0);
}
relativeLayout.addView(this.E, layoutParams3);
s();
Q();
MediaViewPlayerView mediaViewPlayerView2 = this.f13908v;
if (mediaViewPlayerView2 != null) {
mediaViewPlayerView2.openSound();
MediaViewPlayerView mediaViewPlayerView3 = this.f13908v;
mediaViewPlayerView3.setMediaViewPlayListener(new p(mediaViewPlayerView3));
}
b(false);
F();
return;
}
return;
}
p0.c(TAG, "rootView is null");
} catch (Exception e6) {
p0.b(TAG, e6.getMessage());
}
}
private void b(int i10) {
CampaignEx.b mediaViewHolder;
Map<Integer, String> map;
try {
CampaignEx campaignEx = this.M;
if (campaignEx == null || (mediaViewHolder = campaignEx.getMediaViewHolder()) == null || mediaViewHolder.f12480b || (map = mediaViewHolder.f12479a) == null || map.size() <= 0) {
return;
}
Map<Integer, String> map2 = mediaViewHolder.f12479a;
Iterator<Map.Entry<Integer, String>> it = map2.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<Integer, String> next = it.next();
Integer key = next.getKey();
String value = next.getValue();
if (i10 >= key.intValue() && !TextUtils.isEmpty(value)) {
Context context = getContext();
CampaignEx campaignEx2 = this.M;
com.mbridge.msdk.click.a.a(context, campaignEx2, campaignEx2.getCampaignUnitId(), value, false, false);
it.remove();
}
}
if (map2.size() <= 0) {
mediaViewHolder.f12480b = true;
}
} catch (Exception e4) {
p0.b(TAG, e4.getMessage());
}
}
private void b(boolean z3) {
try {
int nvT2 = this.M.getNvT2();
if (this.A == null) {
WindVaneWebViewForNV windVaneWebViewForNV = new WindVaneWebViewForNV(getContext());
this.A = windVaneWebViewForNV;
windVaneWebViewForNV.setObject(this);
this.A.setBackListener(new e());
this.A.setWebViewListener(new f());
}
if (nvT2 != 3) {
if (nvT2 == 4) {
this.f13888f0 = true;
CampaignEx campaignEx = this.M;
if (campaignEx != null) {
com.mbridge.msdk.foundation.same.webview.a aVar = new com.mbridge.msdk.foundation.same.webview.a(campaignEx);
aVar.a(this.M.getAppName());
this.A.setDownloadListener(aVar);
this.A.setFilter(new v(null));
return;
}
return;
}
return;
}
String str = this.M.getendcard_url();
if (TextUtils.isEmpty(str)) {
return;
}
this.M.getMediaViewHolder();
if (str.contains(".zip") && str.contains(ResourceManager.KEY_MD5FILENAME)) {
String h5ResAddress = H5DownLoadManager.getInstance().getH5ResAddress(str);
if (z0.b(h5ResAddress)) {
this.f13888f0 = true;
this.A.loadUrl(h5ResAddress);
return;
}
return;
}
String htmlContentFromUrl = HTMLResourceManager.getInstance().getHtmlContentFromUrl(str);
if (z0.b(htmlContentFromUrl)) {
p0.a(TAG, "load html...");
this.f13888f0 = true;
this.A.loadDataWithBaseURL(str, htmlContentFromUrl, "text/html", C.UTF8_NAME, null);
}
} catch (Exception e4) {
p0.b(TAG, e4.getMessage());
}
}
private void a(FrameLayout frameLayout) {
BitmapDrawable a10;
if (frameLayout == null || (a10 = com.mbridge.msdk.foundation.controller.c.m().a(getUnitId(), this.M.getAdType())) == null) {
return;
}
ImageView imageView = new ImageView(com.mbridge.msdk.foundation.controller.c.m().d());
u0.a(imageView, a10, getResources().getDisplayMetrics());
this.E.addView(imageView, new RelativeLayout.LayoutParams(-1, -1));
rb.b bVar = this.f13903q;
if (bVar != null) {
bVar.a(imageView, rb.e.f18977d);
}
}
private void a(View view, float f10, float f11) {
if (view == null) {
return;
}
try {
double d4 = this.P;
double d10 = 0.0d;
if (d4 > 0.0d) {
double d11 = this.Q;
if (d11 > 0.0d) {
double d12 = d4 / d11;
if (f10 > 0.0f && f11 > 0.0f) {
d10 = f10 / f11;
}
double a10 = u0.a(Double.valueOf(d12));
double a11 = u0.a(Double.valueOf(d10));
RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) this.f13909w.getLayoutParams();
RelativeLayout.LayoutParams layoutParams2 = (RelativeLayout.LayoutParams) view.getLayoutParams();
boolean z3 = c(getContext()) && this.f13893i;
int i10 = -1;
if (a10 > a11) {
double d13 = (f10 * this.Q) / this.P;
layoutParams2.width = -1;
if (!z3) {
i10 = (int) d13;
}
layoutParams2.height = i10;
layoutParams2.addRule(13);
layoutParams.width = this.O;
layoutParams.height = (int) d13;
layoutParams.addRule(13);
} else if (a10 < a11) {
double d14 = f11 * d12;
layoutParams2.width = z3 ? -1 : (int) d14;
layoutParams2.height = -1;
layoutParams2.addRule(13);
layoutParams.width = (int) d14;
layoutParams.height = this.N;
layoutParams.addRule(13);
} else {
layoutParams2.width = -1;
layoutParams2.height = -1;
layoutParams.width = this.O;
layoutParams.height = this.N;
layoutParams.addRule(13);
}
if (!this.f13891h) {
this.f13909w.setLayoutParams(layoutParams);
}
view.setLayoutParams(layoutParams2);
return;
}
}
setPlayViewParamsDefault(view);
} catch (Throwable th) {
p0.b(TAG, th.getMessage());
}
}
private void a(int i10, int i11) {
CampaignEx.b mediaViewHolder;
try {
CampaignEx campaignEx = this.M;
if (campaignEx == null || (mediaViewHolder = campaignEx.getMediaViewHolder()) == null || mediaViewHolder.f12486h || i11 == 0) {
return;
}
List<Map<Integer, String>> o6 = this.M.getNativeVideoTracking().o();
int i12 = ((i10 + 1) * 100) / i11;
if (o6 != null) {
int i13 = 0;
while (i13 < o6.size()) {
Map<Integer, String> map = o6.get(i13);
if (map != null && map.size() > 0) {
Iterator<Map.Entry<Integer, String>> it = map.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<Integer, String> next = it.next();
int intValue = next.getKey().intValue();
String value = next.getValue();
if (intValue <= i12 && !TextUtils.isEmpty(value)) {
Context context = getContext();
CampaignEx campaignEx2 = this.M;
com.mbridge.msdk.click.a.a(context, campaignEx2, campaignEx2.getCampaignUnitId(), new String[]{value}, false, true);
it.remove();
o6.remove(i13);
i13--;
}
}
}
i13++;
}
if (o6.size() <= 0) {
mediaViewHolder.f12486h = true;
}
}
} catch (Throwable unused) {
p0.b(TAG, "reportPlayPercentageData error");
}
}
private String a(int i10) {
try {
JSONObject jSONObject = new JSONObject();
jSONObject.put("code", i10);
String jSONObject2 = jSONObject.toString();
return !TextUtils.isEmpty(jSONObject2) ? Base64.encodeToString(jSONObject2.getBytes(), 2) : "";
} catch (Throwable unused) {
p0.b(TAG, "code to string is error");
return "";
}
}
private String a(List<CampaignEx> list, String str, String str2) {
if (list == null) {
return null;
}
try {
if (list.size() <= 0) {
return null;
}
JSONArray parseCamplistToJson = CampaignEx.parseCamplistToJson(list);
JSONObject jSONObject = new JSONObject();
jSONObject.put("campaignList", parseCamplistToJson);
jSONObject.put(MBridgeConstans.PROPERTIES_UNIT_ID, str);
jSONObject.put("sdk_info", str2);
return jSONObject.toString();
} catch (Exception e4) {
p0.b(TAG, e4.getMessage());
return null;
}
}
}