Cyber Surfer v5.2.5版本的 MD5 值为:db13c5fce988de393e52d2679f934b22
以下内容为反编译后的 MRAIDView.java 源代码,内容仅作参考
package net.pubnative.lite.sdk.mraid;
import android.app.ActionBar;
import android.app.Activity;
import android.content.Context;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.graphics.Rect;
import android.location.Location;
import android.net.Uri;
import android.net.http.SslError;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.os.SystemClock;
import android.text.TextUtils;
import android.util.Base64;
import android.util.DisplayMetrics;
import android.util.TypedValue;
import android.view.GestureDetector;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.webkit.ClientCertRequest;
import android.webkit.ConsoleMessage;
import android.webkit.HttpAuthHandler;
import android.webkit.JsPromptResult;
import android.webkit.JsResult;
import android.webkit.PermissionRequest;
import android.webkit.RenderProcessGoneDetail;
import android.webkit.SslErrorHandler;
import android.webkit.ValueCallback;
import android.webkit.WebChromeClient;
import android.webkit.WebResourceError;
import android.webkit.WebResourceRequest;
import android.webkit.WebResourceResponse;
import android.webkit.WebStorage;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.FrameLayout;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import com.amazon.device.ads.DtbDeviceDataRetriever;
import com.appsflyer.ServerParameters;
import com.facebook.appevents.internal.ViewHierarchyConstants;
import com.google.android.exoplayer2.text.ttml.TtmlNode;
import com.iab.omid.library.pubnativenet.adsession.FriendlyObstructionPurpose;
import com.safedk.android.analytics.brandsafety.DetectTouchUtils;
import com.safedk.android.analytics.brandsafety.creatives.CreativeInfoManager;
import com.safedk.android.analytics.brandsafety.creatives.discoveries.l;
import com.safedk.android.utils.Logger;
import com.vungle.warren.ui.contract.AdContract;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import net.pubnative.lite.sdk.DeviceInfo;
import net.pubnative.lite.sdk.HyBid;
import net.pubnative.lite.sdk.core.R;
import net.pubnative.lite.sdk.location.HyBidLocationManager;
import net.pubnative.lite.sdk.mraid.MRAIDView;
import net.pubnative.lite.sdk.mraid.internal.MRAIDHtmlProcessor;
import net.pubnative.lite.sdk.mraid.internal.MRAIDLog;
import net.pubnative.lite.sdk.mraid.internal.MRAIDNativeFeatureManager;
import net.pubnative.lite.sdk.mraid.internal.MRAIDParser;
import net.pubnative.lite.sdk.mraid.properties.MRAIDOrientationProperties;
import net.pubnative.lite.sdk.mraid.properties.MRAIDResizeProperties;
import net.pubnative.lite.sdk.viewability.HyBidViewabilityFriendlyObstruction;
import net.pubnative.lite.sdk.viewability.HyBidViewabilityWebAdSession;
import net.pubnative.lite.sdk.views.PNWebView;
import net.pubnative.lite.sdk.vpaid.helpers.BitmapHelper;
import net.pubnative.lite.sdk.vpaid.helpers.SimpleTimer;
import net.pubnative.lite.sdk.vpaid.widget.CountDownView;
import net.pubnative.lite.sdk.vpaid.widget.CountDownViewFactory;
import org.json.JSONException;
import org.json.JSONObject;
public class MRAIDView extends FrameLayout {
private static final int CLOSE_REGION_SIZE = 50;
private static final String MRAID_LOG_TAG = "MRAIDView";
private static final String MRAID_VERSION = "3.0";
public static final int STATE_DEFAULT = 1;
public static final int STATE_EXPANDED = 2;
public static final int STATE_HIDDEN = 4;
public static final int STATE_LOADING = 0;
public static final int STATE_RESIZED = 3;
private int activityInitialOrientation;
private Runnable backButtonClickabilityHandler;
private final String baseUrl;
private MRAIDViewCloseLayoutListener closeLayoutListener;
private ImageButton closeRegion;
private final ViewGroup contentInfo;
private boolean contentInfoAdded;
private int contentViewTop;
private final Context context;
private Rect currentPosition;
private WebView currentWebView;
private Rect defaultPosition;
private final DisplayMetrics displayMetrics;
private RelativeLayout expandedView;
private final GestureDetector gestureDetector;
protected final Handler handler;
private final int injections;
private boolean isActionBarShowing;
private Boolean isBackClickable;
private boolean isClosing;
private final boolean isExpandEnabled;
private boolean isExpanded;
private boolean isExpandingFromDefault;
private boolean isExpandingPart2;
private boolean isForceNotFullScreen;
private boolean isForcingFullScreen;
private boolean isFullScreen;
private final boolean isInterstitial;
protected boolean isLaidOut;
protected boolean isPageFinished;
protected boolean isViewable;
protected final MRAIDViewListener listener;
private Integer mBackButtonDelay;
private SimpleTimer mExpirationTimer;
private Integer mNativeCloseButtonDelay;
private SimpleTimer mNativeCloseButtonTimer;
private CountDownView mSkipCountdownView;
private Integer mSkipTimeMillis;
private final HyBidViewabilityWebAdSession mViewabilityAdSession;
private final List<HyBidViewabilityFriendlyObstruction> mViewabilityFriendlyObstructions;
private final Size maxSize;
private String mraidJs;
private final MRAIDWebChromeClient mraidWebChromeClient;
private final MRAIDWebViewClient mraidWebViewClient;
private final MRAIDNativeFeatureListener nativeFeatureListener;
private final MRAIDNativeFeatureManager nativeFeatureManager;
private final MRAIDOrientationProperties orientationProperties;
private int origTitleBarVisibility;
private final int originalRequestedOrientation;
private final MRAIDResizeProperties resizeProperties;
private RelativeLayout resizedView;
private final Size screenSize;
private Activity showActivity;
private Boolean showTimerBeforeEndCard;
protected int state;
private View titleBar;
private boolean useCustomClose;
private boolean wasTouched;
protected final WebView webView;
private boolean webViewLoaded;
private WebView webViewPart2;
private static final String[] COMMANDS_WITH_NO_PARAM = {"close", "resize"};
private static final String[] COMMANDS_WITH_STRING = {"createCalendarEvent", "expand", TtmlNode.TEXT_EMPHASIS_MARK_OPEN, "playVideo", MRAIDNativeFeature.STORE_PICTURE, "useCustomClose"};
private static final String[] COMMANDS_WITH_MAP = {"setOrientationProperties", "setResizeProperties"};
@Retention(RetentionPolicy.SOURCE)
public @interface MRAIDState {
}
public class MRAIDWebChromeClient extends WebChromeClient {
private MRAIDWebChromeClient() {
}
private boolean handlePopups(JsResult jsResult) {
jsResult.cancel();
return true;
}
@Override
public void onCloseWindow(WebView webView) {
MRAIDLog.d("hz-m MRAIDView ChromeClient - onCloseWindow");
}
@Override
public boolean onConsoleMessage(ConsoleMessage consoleMessage) {
String str;
if (consoleMessage == null || consoleMessage.message() == null) {
return false;
}
StringBuilder sb = new StringBuilder();
sb.append(consoleMessage.message());
if (consoleMessage.sourceId() == null) {
str = "";
} else {
str = " at " + consoleMessage.sourceId();
}
sb.append(str);
sb.append(":");
sb.append(consoleMessage.lineNumber());
MRAIDLog.i("JS console", sb.toString());
return true;
}
@Override
public void onExceededDatabaseQuota(String str, String str2, long j, long j2, long j3, WebStorage.QuotaUpdater quotaUpdater) {
MRAIDLog.d("hz-m MRAIDView WebViewClient - onExceededDatabaseQuota");
quotaUpdater.updateQuota(j);
}
@Override
public boolean onJsAlert(WebView webView, String str, String str2, JsResult jsResult) {
MRAIDLog.d("JS alert", str2);
return handlePopups(jsResult);
}
@Override
public boolean onJsBeforeUnload(WebView webView, String str, String str2, JsResult jsResult) {
MRAIDLog.d("hz-m MRAIDView ChromeClient - onJsBeforeUnload");
return true;
}
@Override
public boolean onJsConfirm(WebView webView, String str, String str2, JsResult jsResult) {
MRAIDLog.d("JS confirm", str2);
return handlePopups(jsResult);
}
@Override
public boolean onJsPrompt(WebView webView, String str, String str2, String str3, JsPromptResult jsPromptResult) {
MRAIDLog.d("JS prompt", str2);
return handlePopups(jsPromptResult);
}
@Override
public boolean onJsTimeout() {
MRAIDLog.d("hz-m MRAIDView WebViewClient - onJsTimeout");
return true;
}
@Override
public void onPermissionRequest(PermissionRequest permissionRequest) {
MRAIDLog.d("hz-m MRAIDView WebViewClient - onPermissionRequest");
}
@Override
public void onProgressChanged(WebView webView, int i) {
MRAIDLog.d("hz-m MRAIDView ChromeClient - onProgressChanged " + i + " wv: " + MRAIDView.this.webView + " view: " + MRAIDView.this);
}
@Override
public void onReachedMaxAppCacheSize(long j, long j2, WebStorage.QuotaUpdater quotaUpdater) {
MRAIDLog.d("hz-m MRAIDView WebViewClient - onReachedMaxAppCacheSize");
quotaUpdater.updateQuota(j2);
}
@Override
public void onShowCustomView(View view, WebChromeClient.CustomViewCallback customViewCallback) {
MRAIDLog.d("hz-m MRAIDView ChromeClient - showCustomView");
}
}
public class MRAIDWebViewClient extends WebViewClient {
private MRAIDWebViewClient() {
}
public void m4341x34e9b5a() {
MRAIDView mRAIDView = MRAIDView.this;
StringBuilder sb = new StringBuilder("mraid.setPlacementType('");
sb.append(MRAIDView.this.isInterstitial ? "interstitial" : "inline");
sb.append("');");
mRAIDView.injectJavaScript(sb.toString());
MRAIDView.this.setSupportedServices();
MRAIDView.this.setEnvironmentVariables();
MRAIDView.this.setLocation();
MRAIDView.this.setScreenSize();
MRAIDView.this.setDefaultPosition();
MRAIDLog.d(MRAIDView.MRAID_LOG_TAG, "calling fireStateChangeEvent 2");
MRAIDView.this.fireStateChangeEvent();
MRAIDView.this.fireReadyEvent();
if (MRAIDView.this.isViewable) {
MRAIDView.this.fireViewableChangeEvent();
}
MRAIDView.this.fireExposureChangeEvent();
}
public void m4342x1388d6bb() {
MRAIDView.injectJavaScript(MRAIDView.this.webView, "mraid.logLevel = mraid.LogLevelEnum.DEBUG;");
}
@Override
public void onLoadResource(WebView webView, String str) {
super.onLoadResource(webView, str);
CreativeInfoManager.onResourceLoaded("net.pubnative", webView, str);
}
@Override
public void onPageCommitVisible(WebView webView, String str) {
MRAIDLog.d("hz-m MRAIDView WebViewClient - onPageCommitVisibile");
}
@Override
public void onPageFinished(WebView webView, String str) {
super.onPageFinished(webView, str);
String str2 = MRAIDView.MRAID_LOG_TAG;
MRAIDLog.d(str2, "onPageFinished: " + str);
if (MRAIDView.this.state == 0) {
MRAIDView.this.isPageFinished = true;
if (MRAIDView.this.isExpandEnabled) {
MRAIDView mRAIDView = MRAIDView.this;
StringBuilder sb = new StringBuilder("mraid.setPlacementType('");
sb.append(MRAIDView.this.isInterstitial ? "interstitial" : "inline");
sb.append("');");
mRAIDView.injectJavaScript(sb.toString());
} else {
MRAIDView mRAIDView2 = MRAIDView.this;
StringBuilder sb2 = new StringBuilder("mraid.setPlacementType('");
sb2.append(MRAIDView.this.isInterstitial ? "interstitial" : "");
sb2.append("');");
mRAIDView2.injectJavaScript(sb2.toString());
}
MRAIDView.this.setEnvironmentVariables();
MRAIDView.this.setSupportedServices();
MRAIDView.this.setLocation();
if (MRAIDView.this.isLaidOut) {
MRAIDView.this.setScreenSize();
MRAIDView.this.setMaxSize();
MRAIDView.this.setCurrentPosition();
MRAIDView.this.setDefaultPosition();
if (MRAIDView.this.isInterstitial) {
MRAIDView mRAIDView3 = MRAIDView.this;
mRAIDView3.showAsInterstitial(mRAIDView3.showActivity, false, null);
} else {
MRAIDView.this.state = 1;
MRAIDView.this.fireStateChangeEvent();
MRAIDView.this.fireReadyEvent();
if (MRAIDView.this.isViewable) {
MRAIDView.this.fireViewableChangeEvent();
}
}
}
if (!MRAIDView.this.isInterstitial) {
MRAIDView mRAIDView4 = MRAIDView.this;
mRAIDView4.addContentInfo(mRAIDView4);
}
if (MRAIDView.this.listener != null && !MRAIDView.this.webViewLoaded) {
MRAIDView.this.mViewabilityAdSession.initAdSession(webView, false);
if (MRAIDView.this.contentInfo != null && MRAIDView.this.contentInfoAdded) {
MRAIDView mRAIDView5 = MRAIDView.this;
mRAIDView5.addViewabilityFriendlyObstruction(mRAIDView5.contentInfo, FriendlyObstructionPurpose.OTHER, "Content info description for the ad");
for (HyBidViewabilityFriendlyObstruction hyBidViewabilityFriendlyObstruction : MRAIDView.this.mViewabilityFriendlyObstructions) {
MRAIDView.this.mViewabilityAdSession.addFriendlyObstruction(hyBidViewabilityFriendlyObstruction.getView(), hyBidViewabilityFriendlyObstruction.getPurpose(), hyBidViewabilityFriendlyObstruction.getReason());
}
}
MRAIDView.this.webViewLoaded = true;
MRAIDView.this.mViewabilityAdSession.fireLoaded();
MRAIDView.this.mViewabilityAdSession.fireImpression();
MRAIDView.this.listener.mraidViewLoaded(MRAIDView.this);
MRAIDView.this.mSkipCountdownView = new CountDownViewFactory().createCountdownView(MRAIDView.this.context, HyBid.getCountdownStyle(), MRAIDView.this);
MRAIDView mRAIDView6 = MRAIDView.this;
mRAIDView6.addView(mRAIDView6.mSkipCountdownView);
MRAIDView.this.mSkipCountdownView.setVisibility(8);
final MRAIDView mRAIDView7 = MRAIDView.this;
mRAIDView7.postDelayed(new Runnable() {
@Override
public final void run() {
MRAIDView.this.startSkipTimer();
}
}, 500L);
}
}
if (MRAIDView.this.isExpandingPart2) {
MRAIDView.this.isExpandingPart2 = false;
MRAIDView.this.handler.post(new Runnable() {
@Override
public final void run() {
MRAIDView.MRAIDWebViewClient.this.m4341x34e9b5a();
}
});
}
}
@Override
public void onPageStarted(WebView webView, String str, Bitmap bitmap) {
MRAIDLog.d("hz-m MRAIDView WebViewClient - onPageStarted");
}
@Override
public void onReceivedClientCertRequest(WebView webView, ClientCertRequest clientCertRequest) {
MRAIDLog.d("hz-m MRAIDView WebViewClient - onReceivedClientCertRequest");
}
@Override
public void onReceivedError(WebView webView, int i, String str, String str2) {
String str3 = MRAIDView.MRAID_LOG_TAG;
MRAIDLog.d(str3, "onReceivedError: " + str);
super.onReceivedError(webView, i, str, str2);
}
@Override
public void onReceivedError(WebView webView, WebResourceRequest webResourceRequest, WebResourceError webResourceError) {
if (Build.VERSION.SDK_INT < 23) {
MRAIDLog.d("hz-m MRAIDView WebViewClient - onReceivedError: " + webResourceError);
return;
}
MRAIDLog.d("hz-m MRAIDView WebViewClient - onReceivedError code: " + webResourceError.getErrorCode());
MRAIDLog.d("hz-m MRAIDView WebViewClient - onReceivedError: " + ((Object) webResourceError.getDescription()));
}
@Override
public void onReceivedHttpAuthRequest(WebView webView, HttpAuthHandler httpAuthHandler, String str, String str2) {
MRAIDLog.d("hz-m MRAIDView WebViewClient - onReceivedHttpAuthRequest");
httpAuthHandler.cancel();
}
@Override
public void onReceivedHttpError(WebView webView, WebResourceRequest webResourceRequest, WebResourceResponse webResourceResponse) {
MRAIDLog.d("hz-m MRAIDView WebViewClient - onReceivedHttpError");
}
@Override
public void onReceivedLoginRequest(WebView webView, String str, String str2, String str3) {
MRAIDLog.d("hz-m MRAIDView WebViewClient - onReceivedLoginRequest");
}
@Override
public void onReceivedSslError(WebView webView, SslErrorHandler sslErrorHandler, SslError sslError) {
MRAIDLog.d("hz-m MRAIDView WebViewClient - onReceivedSslError");
if (sslErrorHandler != null) {
sslErrorHandler.cancel();
}
}
@Override
public boolean onRenderProcessGone(WebView webView, RenderProcessGoneDetail renderProcessGoneDetail) {
MRAIDLog.d("hz-m MRAIDView WebViewClient - onRenderProcessGone");
if (MRAIDView.this.listener != null) {
MRAIDView.this.listener.mraidViewError(MRAIDView.this);
return true;
}
return true;
}
@Override
public void onScaleChanged(WebView webView, float f, float f2) {
MRAIDLog.d("hz-m MRAIDView WebViewClient - onScaleChanged");
}
@Override
public void onTooManyRedirects(WebView webView, Message message, Message message2) {
message.sendToTarget();
MRAIDLog.d("hz-m MRAIDView WebViewClient - onTooManyRedirects");
}
public boolean safedk_MRAIDView$MRAIDWebViewClient_shouldOverrideUrlLoading_47459d4302f584d15663e70eff655513(WebView webView, String str) {
String str2 = MRAIDView.MRAID_LOG_TAG;
MRAIDLog.d(str2, "shouldOverrideUrlLoading: " + str);
if (str.startsWith(l.x)) {
MRAIDView.this.parseCommandUrl(str);
} else if (MRAIDView.this.isVerveCustomExpand(str)) {
MRAIDView.this.expandCreative(str, true, false, null);
} else if (MRAIDView.this.isCloseSignal(str)) {
MRAIDView.this.closeOnMainThread();
} else {
try {
MRAIDView.this.open(URLEncoder.encode(str, "UTF-8"));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
return true;
}
@Override
public WebResourceResponse shouldInterceptRequest(WebView webView, WebResourceRequest webResourceRequest) {
return CreativeInfoManager.onWebViewResponseWithHeaders("net.pubnative", webView, webResourceRequest, super.shouldInterceptRequest(webView, webResourceRequest));
}
@Override
public WebResourceResponse shouldInterceptRequest(WebView webView, String str) {
MRAIDLog.d("hz-m shouldInterceptRequest - " + str);
if (str.contains("mraid.js")) {
MRAIDLog.d("hz-m shouldInterceptRequest - intercepting mraid - " + str);
MRAIDView.this.handler.post(new Runnable() {
@Override
public final void run() {
MRAIDView.MRAIDWebViewClient.this.m4342x1388d6bb();
}
});
return new WebResourceResponse("application/javascript", "UTF-8", MRAIDView.this.getMraidJsStream());
}
return null;
}
@Override
public boolean shouldOverrideKeyEvent(WebView webView, KeyEvent keyEvent) {
MRAIDLog.d("hz-m MRAIDView WebViewClient - shouldOverrideKeyEvent");
return false;
}
@Override
public boolean shouldOverrideUrlLoading(WebView webView, String str) {
Logger.d("PubNative|SafeDK: Execution> Lnet/pubnative/lite/sdk/mraid/MRAIDView$MRAIDWebViewClient;->shouldOverrideUrlLoading(Landroid/webkit/WebView;Ljava/lang/String;)Z");
boolean safedk_MRAIDView$MRAIDWebViewClient_shouldOverrideUrlLoading_47459d4302f584d15663e70eff655513 = safedk_MRAIDView$MRAIDWebViewClient_shouldOverrideUrlLoading_47459d4302f584d15663e70eff655513(webView, str);
CreativeInfoManager.onOverrideUrlLoading("net.pubnative", webView, str, safedk_MRAIDView$MRAIDWebViewClient_shouldOverrideUrlLoading_47459d4302f584d15663e70eff655513);
return safedk_MRAIDView$MRAIDWebViewClient_shouldOverrideUrlLoading_47459d4302f584d15663e70eff655513;
}
}
public interface OnExpandCreativeFailListener {
void onExpandFailed();
}
public static class Size {
public int height;
public int width;
private Size() {
}
}
public MRAIDView(Context context, String str, String str2, Boolean bool, String[] strArr, MRAIDViewListener mRAIDViewListener, MRAIDNativeFeatureListener mRAIDNativeFeatureListener, ViewGroup viewGroup, boolean z, boolean z2) {
super(context);
this.showTimerBeforeEndCard = false;
this.mSkipTimeMillis = -1;
this.mNativeCloseButtonDelay = -1;
this.mBackButtonDelay = -1;
this.isBackClickable = false;
this.backButtonClickabilityHandler = null;
this.activityInitialOrientation = -1;
this.wasTouched = false;
this.contentInfoAdded = false;
this.webViewLoaded = false;
this.injections = 0;
this.context = context;
if (context instanceof Activity) {
Activity activity = (Activity) context;
this.showActivity = activity;
this.activityInitialOrientation = activity.getRequestedOrientation();
}
String str3 = str == null ? "http://example.com/" : str;
this.baseUrl = str3;
this.isInterstitial = z;
this.isExpandEnabled = z2;
this.contentInfo = viewGroup;
this.state = 0;
this.isViewable = false;
this.useCustomClose = false;
this.orientationProperties = new MRAIDOrientationProperties();
this.resizeProperties = new MRAIDResizeProperties();
this.nativeFeatureManager = new MRAIDNativeFeatureManager(context, new ArrayList(Arrays.asList(strArr)));
this.listener = mRAIDViewListener;
this.nativeFeatureListener = mRAIDNativeFeatureListener;
this.showTimerBeforeEndCard = bool;
WindowManager windowManager = (WindowManager) context.getSystemService("window");
if (windowManager != null) {
DisplayMetrics displayMetrics = new DisplayMetrics();
this.displayMetrics = displayMetrics;
windowManager.getDefaultDisplay().getMetrics(displayMetrics);
} else {
this.displayMetrics = null;
}
this.currentPosition = new Rect();
this.defaultPosition = new Rect();
this.maxSize = new Size();
this.screenSize = new Size();
if (context instanceof Activity) {
this.originalRequestedOrientation = ((Activity) context).getRequestedOrientation();
} else {
this.originalRequestedOrientation = -1;
}
String str4 = MRAID_LOG_TAG;
MRAIDLog.d(str4, "originalRequestedOrientation " + getOrientationString(this.originalRequestedOrientation));
this.gestureDetector = new GestureDetector(getContext(), new GestureDetector.SimpleOnGestureListener() {
@Override
public boolean onScroll(MotionEvent motionEvent, MotionEvent motionEvent2, float f, float f2) {
return true;
}
});
this.handler = new Handler(Looper.getMainLooper());
this.mViewabilityAdSession = new HyBidViewabilityWebAdSession(HyBid.getViewabilityManager());
this.mViewabilityFriendlyObstructions = new ArrayList();
this.mraidWebChromeClient = new MRAIDWebChromeClient();
this.mraidWebViewClient = new MRAIDWebViewClient();
WebView createWebView = createWebView();
this.webView = createWebView;
if (createWebView == null) {
if (mRAIDViewListener != null) {
mRAIDViewListener.mraidViewError(this);
return;
}
return;
}
createWebView.setId(R.id.mraid_ad_view);
this.currentWebView = createWebView;
if (TextUtils.isEmpty(str2)) {
MRAIDLog.d("hz-m loading mraid from url: " + str);
createWebView.loadUrl(str);
return;
}
try {
String processRawHtml = MRAIDHtmlProcessor.processRawHtml(str2);
MRAIDLog.d("hz-m loading mraid " + processRawHtml);
createWebView.loadDataWithBaseURL(str3, processRawHtml, "text/html", "UTF-8", null);
} catch (Throwable th) {
HyBid.reportException(th);
this.listener.mraidViewError(this);
}
}
private void addCloseRegion(View view) {
ImageButton imageButton = new ImageButton(this.context);
this.closeRegion = imageButton;
imageButton.setId(R.id.close_view);
this.closeRegion.setBackgroundColor(0);
this.closeRegion.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view2) {
MRAIDView.this.m4334lambda$addCloseRegion$5$netpubnativelitesdkmraidMRAIDView(view2);
}
});
if (view == this.expandedView && !this.useCustomClose) {
showDefaultCloseButton();
}
((ViewGroup) view).addView(this.closeRegion);
}
public void addContentInfo(View view) {
ViewGroup viewGroup = this.contentInfo;
if (viewGroup == null || this.contentInfoAdded) {
return;
}
((ViewGroup) view).addView(viewGroup);
this.contentInfoAdded = true;
}
private void calculateMaxSize() {
if (this.context instanceof Activity) {
Rect rect = new Rect();
Window window = ((Activity) this.context).getWindow();
window.getDecorView().getWindowVisibleDisplayFrame(rect);
String str = MRAID_LOG_TAG;
MRAIDLog.d(str, "calculateMaxSize frame [" + rect.left + "," + rect.top + "][" + rect.right + "," + rect.bottom + "] (" + rect.width() + "x" + rect.height() + ")");
if (window.findViewById(16908290) != null) {
this.contentViewTop = window.findViewById(16908290).getTop();
} else {
this.contentViewTop = rect.top;
}
int i = rect.top;
int i2 = this.contentViewTop - i;
MRAIDLog.d(str, "calculateMaxSize statusHeight " + i);
MRAIDLog.d(str, "calculateMaxSize titleHeight " + i2);
MRAIDLog.d(str, "calculateMaxSize contentViewTop " + this.contentViewTop);
int width = rect.width();
int i3 = this.screenSize.height - this.contentViewTop;
MRAIDLog.d(str, "calculateMaxSize max size " + width + "x" + i3);
if (width == this.maxSize.width && i3 == this.maxSize.height) {
return;
}
this.maxSize.width = width;
this.maxSize.height = i3;
if (this.isPageFinished) {
setMaxSize();
}
}
}
private void calculatePosition(boolean z) {
View view = z ? this.currentWebView : this;
String str = z ? "current" : "default";
int[] iArr = new int[2];
view.getLocationOnScreen(iArr);
int i = iArr[0];
int i2 = iArr[1];
String str2 = MRAID_LOG_TAG;
MRAIDLog.d(str2, "calculatePosition " + str + " locationOnScreen [" + i + "," + i2 + "]");
StringBuilder sb = new StringBuilder("calculatePosition ");
sb.append(str);
sb.append(" contentViewTop ");
sb.append(this.contentViewTop);
MRAIDLog.d(str2, sb.toString());
int i3 = i2 - this.contentViewTop;
int width = view.getWidth();
int height = view.getHeight();
MRAIDLog.d(str2, "calculatePosition " + str + " position [" + i + "," + i3 + "] (" + width + "x" + height + ")");
Rect rect = z ? this.currentPosition : this.defaultPosition;
if (i == rect.left && i3 == rect.top && width == rect.width() && height == rect.height()) {
return;
}
if (z) {
this.currentPosition = new Rect(i, i3, width + i, height + i3);
} else {
this.defaultPosition = new Rect(i, i3, width + i, height + i3);
}
if (this.isPageFinished) {
if (z) {
setCurrentPosition();
} else {
setDefaultPosition();
}
}
}
private void calculateScreenSize() {
boolean z = getResources().getConfiguration().orientation == 1;
String str = MRAID_LOG_TAG;
MRAIDLog.d(str, "calculateScreenSize orientation ".concat(z ? DtbDeviceDataRetriever.ORIENTATION_PORTRAIT : DtbDeviceDataRetriever.ORIENTATION_LANDSCAPE));
DisplayMetrics displayMetrics = this.displayMetrics;
if (displayMetrics != null) {
int i = displayMetrics.widthPixels;
int i2 = this.displayMetrics.heightPixels;
MRAIDLog.d(str, "calculateScreenSize screen size " + i + "x" + i2);
if (i == this.screenSize.width && i2 == this.screenSize.height) {
return;
}
this.screenSize.width = i;
this.screenSize.height = i2;
if (this.isPageFinished) {
setScreenSize();
}
}
}
public void closeOnMainThread() {
new Handler(Looper.getMainLooper()).post(new Runnable() {
@Override
public final void run() {
MRAIDView.this.close();
}
});
}
private void createCalendarEvent(String str) {
MRAIDLog.d(MRAID_LOG_TAG + "-JS callback", "createCalendarEvent " + str);
MRAIDNativeFeatureListener mRAIDNativeFeatureListener = this.nativeFeatureListener;
if (mRAIDNativeFeatureListener != null) {
mRAIDNativeFeatureListener.mraidNativeFeatureCreateCalendarEvent(str);
}
}
public WebView createWebView() {
try {
PNWebView pNWebView = new PNWebView(this.context) {
private static final String TAG = "MRAIDView-WebView";
@Override
public boolean dispatchTouchEvent(MotionEvent motionEvent) {
DetectTouchUtils.viewOnTouch("net.pubnative", this, motionEvent);
return super.dispatchTouchEvent(motionEvent);
}
@Override
public void onConfigurationChanged(Configuration configuration) {
super.onConfigurationChanged(configuration);
MRAIDLog.d(TAG, "onConfigurationChanged ".concat(configuration.orientation == 1 ? DtbDeviceDataRetriever.ORIENTATION_PORTRAIT : DtbDeviceDataRetriever.ORIENTATION_LANDSCAPE));
if (MRAIDView.this.isInterstitial) {
if (Build.VERSION.SDK_INT >= 30) {
MRAIDView.this.context.getDisplay().getMetrics(MRAIDView.this.displayMetrics);
return;
}
WindowManager windowManager = (WindowManager) MRAIDView.this.context.getSystemService("window");
if (windowManager != null) {
windowManager.getDefaultDisplay().getMetrics(MRAIDView.this.displayMetrics);
}
}
}
@Override
protected void onLayout(boolean z, int i, int i2, int i3, int i4) {
super.onLayout(z, i, i2, i3, i4);
MRAIDView.this.onLayoutWebView(this, z, i, i2, i3, i4);
}
@Override
public void onMeasure(int i, int i2) {
if (1 == 0) {
setMeasuredDimension(0, 0);
} else {
super.onMeasure(i, i2);
}
}
@Override
protected void onVisibilityChanged(View view, int i) {
super.onVisibilityChanged(view, i);
MRAIDLog.d(TAG, "onVisibilityChanged " + MRAIDView.getVisibilityString(i));
if (MRAIDView.this.isInterstitial) {
MRAIDView.this.setViewable(i);
}
}
@Override
protected void onWindowVisibilityChanged(int i) {
super.onWindowVisibilityChanged(i);
int visibility = getVisibility();
MRAIDLog.d(TAG, "onWindowVisibilityChanged " + MRAIDView.getVisibilityString(i) + " (actual " + MRAIDView.getVisibilityString(visibility) + ')');
if (MRAIDView.this.isInterstitial) {
MRAIDView.this.setViewable(visibility);
}
}
@Override
public boolean performClick() {
return super.performClick();
}
};
pNWebView.setScrollContainer(false);
pNWebView.setVerticalScrollBarEnabled(false);
pNWebView.setHorizontalScrollBarEnabled(false);
pNWebView.setScrollBarStyle(33554432);
pNWebView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
MRAIDView.this.wasTouched = true;
int action = motionEvent.getAction();
if ((action == 0 || action == 1) && !view.hasFocus()) {
view.requestFocus();
return false;
}
return false;
}
});
pNWebView.getSettings().setJavaScriptEnabled(true);
pNWebView.getSettings().setDomStorageEnabled(true);
pNWebView.getSettings().setAllowContentAccess(false);
pNWebView.enablePlugins(true);
pNWebView.getSettings().setSupportZoom(false);
pNWebView.setWebChromeClient(this.mraidWebChromeClient);
pNWebView.setWebViewClient(this.mraidWebViewClient);
pNWebView.setLayerType(2, null);
pNWebView.getSettings().setMediaPlaybackRequiresUserGesture(false);
return pNWebView;
} catch (RuntimeException e) {
HyBid.reportException((Exception) e);
return null;
}
}
private void decodeURL(String str, final boolean z) {
try {
final String decode = URLDecoder.decode(str, "UTF-8");
if (!decode.startsWith("http://") && !decode.startsWith("https://")) {
decode = this.baseUrl + decode;
}
new Thread(new Runnable() {
@Override
public final void run() {
MRAIDView.this.m4339lambda$decodeURL$1$netpubnativelitesdkmraidMRAIDView(z, decode);
}
}, "2-part-content").start();
} catch (UnsupportedEncodingException e) {
HyBid.reportException((Exception) e);
MRAIDLog.d("hz-m MRAIDView - expand - UnsupportedEncodingException " + e);
}
}
private void expandCreative(String str, boolean z, Boolean bool) {
expandCreative(str, z, bool, null);
}
public void expandCreative(String str, boolean z, Boolean bool, OnExpandCreativeFailListener onExpandCreativeFailListener) {
MRAIDLog.d("hz-m MRAIDView - expand " + str);
StringBuilder sb = new StringBuilder();
String str2 = MRAID_LOG_TAG;
sb.append(str2);
sb.append("-JS callback");
String sb2 = sb.toString();
StringBuilder sb3 = new StringBuilder("expand ");
sb3.append(str != null ? str : "(1-part)");
MRAIDLog.d(sb2, sb3.toString());
MRAIDOrientationProperties mRAIDOrientationProperties = this.orientationProperties;
if (mRAIDOrientationProperties != null) {
mRAIDOrientationProperties.allowOrientationChange = false;
applyOrientationProperties();
}
if (!HyBid.isMraidExpandEnabled() && !bool.booleanValue()) {
MRAIDLog.d(str2 + "-JS callback", "expand disabled by the developer");
} else if (!TextUtils.isEmpty(str)) {
decodeURL(str, z);
} else {
int i = this.state;
if (i == 0 || i == 1) {
if (this.webView.getParent() != null) {
((ViewGroup) this.webView.getParent()).removeView(this.webView);
} else {
removeView(this.webView);
}
} else if (i == 3) {
removeResizeView();
}
expandHelper(this.webView);
MRAIDLog.d("hz-m MRAIDView - expand - empty url");
if (onExpandCreativeFailListener != null) {
onExpandCreativeFailListener.onExpandFailed();
}
}
}
private void forceFullScreen() {
if (this.context instanceof Activity) {
MRAIDLog.d(MRAID_LOG_TAG, "forceFullScreen");
Activity activity = (Activity) this.context;
int i = activity.getWindow().getAttributes().flags;
boolean z = false;
this.isFullScreen = (i & 1024) != 0;
this.isForceNotFullScreen = (i & 2048) != 0;
this.origTitleBarVisibility = -9;
ActionBar actionBar = activity.getActionBar();
if (actionBar != null) {
this.isActionBarShowing = actionBar.isShowing();
actionBar.hide();
z = true;
}
if (!z) {
this.titleBar = null;
try {
if (activity.findViewById(16908310) != null) {
this.titleBar = (View) activity.findViewById(16908310).getParent();
}
} catch (NullPointerException e) {
HyBid.reportException((Exception) e);
}
View view = this.titleBar;
if (view != null) {
this.origTitleBarVisibility = view.getVisibility();
this.titleBar.setVisibility(8);
}
}
String str = MRAID_LOG_TAG;
MRAIDLog.d(str, "isFullScreen " + this.isFullScreen);
MRAIDLog.d(str, "isForceNotFullScreen " + this.isForceNotFullScreen);
MRAIDLog.d(str, "isActionBarShowing " + this.isActionBarShowing);
MRAIDLog.d(str, "origTitleBarVisibility " + getVisibilityString(this.origTitleBarVisibility));
((Activity) this.context).getWindow().addFlags(1024);
((Activity) this.context).getWindow().clearFlags(2048);
this.isForcingFullScreen = !this.isFullScreen;
}
}
public InputStream getMraidJsStream() {
if (TextUtils.isEmpty(this.mraidJs)) {
this.mraidJs = new String(Base64.decode(Assets.mraidJS, 0));
}
return new ByteArrayInputStream(this.mraidJs.getBytes(StandardCharsets.UTF_8));
}
private static String getOrientationString(int i) {
return i != -1 ? i != 0 ? i != 1 ? "UNKNOWN" : "PORTRAIT" : "LANDSCAPE" : "UNSPECIFIED";
}
private String getStringFromFileUrl(String str) {
StringBuilder sb = new StringBuilder();
String[] split = str.split("/");
if (!split[3].equals("android_asset")) {
MRAIDLog.e("Unknown location to fetch file content");
return "";
}
try {
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(this.context.getAssets().open(split[4])));
String readLine = bufferedReader.readLine();
sb.append(readLine);
while (readLine != null) {
readLine = bufferedReader.readLine();
sb.append(readLine);
}
bufferedReader.close();
} catch (IOException e) {
MRAIDLog.e("Error fetching file: " + e.getMessage());
HyBid.reportException((Exception) e);
}
return sb.toString();
}
private String getStringFromUrl(String str) {
HttpURLConnection httpURLConnection;
String str2 = "getContentLength ";
if (str.startsWith("file:///")) {
return getStringFromFileUrl(str);
}
InputStream inputStream = null;
String str3 = null;
inputStream = null;
InputStream inputStream2 = null;
try {
try {
try {
httpURLConnection = (HttpURLConnection) new URL(str).openConnection();
int responseCode = httpURLConnection.getResponseCode();
String str4 = MRAID_LOG_TAG;
MRAIDLog.d(str4, "response code " + responseCode);
if (responseCode == 200) {
MRAIDLog.d(str4, "getContentLength " + httpURLConnection.getContentLength());
InputStream inputStream3 = httpURLConnection.getInputStream();
try {
byte[] bArr = new byte[1500];
StringBuilder sb = new StringBuilder();
while (true) {
int read = inputStream3.read(bArr);
if (read == -1) {
break;
}
sb.append(new String(bArr, 0, read));
}
str3 = sb.toString();
MRAIDLog.d(MRAID_LOG_TAG, "getStringFromUrl ok, length=" + str3.length());
inputStream = inputStream3;
str2 = str3;
} catch (IOException e) {
e = e;
String str5 = str3;
inputStream = inputStream3;
str2 = str5;
HyBid.reportException((Exception) e);
MRAIDLog.e(MRAID_LOG_TAG, "getStringFromUrl failed " + e.getLocalizedMessage());
if (inputStream != null) {
}
return str2;
} catch (Throwable th) {
th = th;
inputStream2 = inputStream3;
if (inputStream2 != null) {
try {
inputStream2.close();
} catch (IOException e2) {
HyBid.reportException((Exception) e2);
}
}
throw th;
}
} else {
str2 = null;
}
} catch (Throwable th2) {
th = th2;
}
} catch (IOException e3) {
e = e3;
str2 = null;
}
try {
httpURLConnection.disconnect();
} catch (IOException e4) {
e = e4;
HyBid.reportException((Exception) e);
MRAIDLog.e(MRAID_LOG_TAG, "getStringFromUrl failed " + e.getLocalizedMessage());
if (inputStream != null) {
inputStream.close();
}
return str2;
}
if (inputStream != null) {
inputStream.close();
}
} catch (IOException e5) {
HyBid.reportException((Exception) e5);
}
return str2;
}
public static String getVisibilityString(int i) {
return i != 0 ? i != 4 ? i != 8 ? "UNKNOWN" : "GONE" : "INVISIBLE" : "VISIBLE";
}
public static void injectJavaScript(WebView webView, String str) {
if (webView == null || TextUtils.isEmpty(str)) {
return;
}
String str2 = MRAID_LOG_TAG;
MRAIDLog.d(str2, "evaluating js: " + str);
webView.evaluateJavascript(str, new ValueCallback() {
@Override
public final void onReceiveValue(Object obj) {
MRAIDLog.d("Evaluated JS: " + ((String) obj));
}
});
}
private void injectMraidJs(WebView webView) {
if (TextUtils.isEmpty(this.mraidJs)) {
this.mraidJs = new String(Base64.decode(Assets.mraidJS, 0));
}
injectJavaScript(this.mraidJs);
}
public boolean isCloseSignal(String str) {
Uri parse;
List<String> pathSegments;
if (!str.contains("https://feedback.verve.com") || (parse = Uri.parse(str)) == null || (pathSegments = parse.getPathSegments()) == null || pathSegments.isEmpty()) {
return false;
}
return parse.getPathSegments().contains("close");
}
public boolean isVerveCustomExpand(String str) {
return !TextUtils.isEmpty(str) && str.contains("tags-prod.vrvm.com") && str.contains("type=expandable");
}
public void onLayoutWebView(WebView webView, boolean z, int i, int i2, int i3, int i4) {
boolean z2 = webView == this.currentWebView;
String str = MRAID_LOG_TAG;
StringBuilder sb = new StringBuilder("onLayoutWebView ");
sb.append(webView == this.webView ? "1 " : "2 ");
sb.append(z2);
sb.append(" (");
sb.append(this.state);
sb.append(") ");
sb.append(z);
sb.append(" ");
sb.append(i);
sb.append(" ");
sb.append(i2);
sb.append(" ");
sb.append(i3);
sb.append(" ");
sb.append(i4);
MRAIDLog.w(str, sb.toString());
if (!z2) {
MRAIDLog.d(str, "onLayoutWebView ignored, not current");
return;
}
int i5 = this.state;
if (i5 == 0 || i5 == 1) {
calculateScreenSize();
calculateMaxSize();
}
if (!this.isClosing) {
calculatePosition(true);
if (this.isInterstitial && !this.defaultPosition.equals(this.currentPosition)) {
this.defaultPosition = new Rect(this.currentPosition);
setDefaultPosition();
}
}
if (this.isExpandingFromDefault) {
this.isExpandingFromDefault = false;
if (this.isInterstitial) {
this.state = 1;
this.isLaidOut = true;
}
if (!this.isExpandingPart2) {
MRAIDLog.d(str, "calling fireStateChangeEvent 1");
fireStateChangeEvent();
}
if (this.isInterstitial) {
fireReadyEvent();
if (this.isViewable) {
fireViewableChangeEvent();
}
fireExposureChangeEvent();
}
MRAIDViewListener mRAIDViewListener = this.listener;
if (mRAIDViewListener != null) {
mRAIDViewListener.mraidViewExpand(this);
}
}
}
public void open(String str) {
try {
String decode = URLDecoder.decode(str, "UTF-8");
StringBuilder sb = new StringBuilder();
String str2 = MRAID_LOG_TAG;
sb.append(str2);
sb.append("-JS callback");
String sb2 = sb.toString();
MRAIDLog.d(sb2, "open " + decode + " touched: " + this.wasTouched);
if (!this.wasTouched) {
MRAIDLog.d(str2 + "- JS callback", "open called, but no touch recorded, aborting");
} else if (this.nativeFeatureListener != null) {
if (decode.startsWith(MRAIDNativeFeature.SMS)) {
this.nativeFeatureListener.mraidNativeFeatureSendSms(decode);
} else if (decode.startsWith(MRAIDNativeFeature.TEL)) {
this.nativeFeatureListener.mraidNativeFeatureCallTel(decode);
} else {
this.nativeFeatureListener.mraidNativeFeatureOpenBrowser(decode);
}
}
} catch (UnsupportedEncodingException e) {
HyBid.reportException((Exception) e);
e.printStackTrace();
}
}
public void parseCommandUrl(String str) {
char c;
String str2;
String str3 = MRAID_LOG_TAG;
MRAIDLog.d(str3, "parseCommandUrl " + str);
Map<String, String> parseCommandUrl = new MRAIDParser().parseCommandUrl(str);
String str4 = parseCommandUrl.get(AdContract.AdvertisementBus.COMMAND);
try {
if (Arrays.asList(COMMANDS_WITH_NO_PARAM).contains(str4)) {
try {
getClass().getDeclaredMethod(str4, new Class[0]).invoke(this, new Object[0]);
return;
} catch (NoSuchMethodException unused) {
getClass().getSuperclass().getDeclaredMethod(str4, new Class[0]).invoke(this, new Object[0]);
return;
}
} else if (!Arrays.asList(COMMANDS_WITH_STRING).contains(str4)) {
if (Arrays.asList(COMMANDS_WITH_MAP).contains(str4)) {
try {
getClass().getDeclaredMethod(str4, Map.class).invoke(this, parseCommandUrl);
return;
} catch (NoSuchMethodException unused2) {
getClass().getSuperclass().getDeclaredMethod(str4, Map.class).invoke(this, parseCommandUrl);
return;
}
}
return;
} else {
int hashCode = str4.hashCode();
String str5 = "useCustomClose";
if (hashCode == -733616544) {
if (str4.equals("createCalendarEvent")) {
c = 0;
if (c != 0) {
}
str2 = parseCommandUrl.get(str5);
getClass().getDeclaredMethod(str4, String.class).invoke(this, str2);
return;
}
c = 65535;
if (c != 0) {
}
str2 = parseCommandUrl.get(str5);
getClass().getDeclaredMethod(str4, String.class).invoke(this, str2);
return;
}
try {
if (hashCode == 1614272768 && str4.equals("useCustomClose")) {
c = 1;
if (c != 0) {
str5 = "eventJSON";
} else if (c != 1) {
str5 = "url";
}
str2 = parseCommandUrl.get(str5);
getClass().getDeclaredMethod(str4, String.class).invoke(this, str2);
return;
}
getClass().getDeclaredMethod(str4, String.class).invoke(this, str2);
return;
} catch (NoSuchMethodException unused3) {
getClass().getSuperclass().getDeclaredMethod(str4, String.class).invoke(this, str2);
return;
}
c = 65535;
if (c != 0) {
}
str2 = parseCommandUrl.get(str5);
}
} catch (Exception e) {
HyBid.reportException(e);
e.printStackTrace();
}
HyBid.reportException(e);
e.printStackTrace();
}
private void playVideo(String str) {
try {
String decode = URLDecoder.decode(str, "UTF-8");
MRAIDLog.d(MRAID_LOG_TAG + "-JS callback", "playVideo " + decode);
MRAIDNativeFeatureListener mRAIDNativeFeatureListener = this.nativeFeatureListener;
if (mRAIDNativeFeatureListener != null) {
mRAIDNativeFeatureListener.mraidNativeFeaturePlayVideo(decode);
}
} catch (UnsupportedEncodingException e) {
HyBid.reportException((Exception) e);
e.printStackTrace();
}
}
private int px2dip(int i) {
DisplayMetrics displayMetrics = this.displayMetrics;
return displayMetrics != null ? (i * 160) / displayMetrics.densityDpi : i;
}
private void removeDefaultCloseButton() {
ImageButton imageButton = this.closeRegion;
if (imageButton != null) {
imageButton.setImageResource(17170445);
}
}
public void removeResizeView() {
RelativeLayout relativeLayout = this.resizedView;
if (relativeLayout != null) {
relativeLayout.removeAllViews();
Context context = this.context;
if (context instanceof Activity) {
((FrameLayout) ((Activity) context).findViewById(16908290)).removeView(this.resizedView);
this.resizedView = null;
this.closeRegion = null;
}
}
}
private void resize() {
MRAIDLog.d(MRAID_LOG_TAG + "-JS callback", "resize");
MRAIDViewListener mRAIDViewListener = this.listener;
if (mRAIDViewListener != null && mRAIDViewListener.mraidViewResize(this, this.resizeProperties.width, this.resizeProperties.height, this.resizeProperties.offsetX, this.resizeProperties.offsetY)) {
this.state = 3;
if (this.resizedView == null) {
this.resizedView = new RelativeLayout(this.context);
removeView(this.webView);
this.resizedView.addView(this.webView);
addCloseRegion(this.resizedView);
((FrameLayout) getRootView().findViewById(16908290)).addView(this.resizedView);
}
setCloseRegionPosition(this.resizedView);
setResizedViewSize();
m4340lambda$onLayout$7$netpubnativelitesdkmraidMRAIDView();
this.handler.post(new Runnable() {
@Override
public final void run() {
MRAIDView.this.fireStateChangeEvent();
}
});
}
}
private void restoreOriginalOrientation() {
if (this.context instanceof Activity) {
MRAIDLog.d(MRAID_LOG_TAG, "restoreOriginalOrientation");
Activity activity = (Activity) this.context;
int requestedOrientation = activity.getRequestedOrientation();
int i = this.originalRequestedOrientation;
if (requestedOrientation != i) {
activity.setRequestedOrientation(i);
}
}
}
private void restoreOriginalScreenState() {
Context context = this.context;
if (context instanceof Activity) {
Activity activity = (Activity) context;
if (!this.isFullScreen) {
activity.getWindow().clearFlags(1024);
}
if (this.isForceNotFullScreen) {
activity.getWindow().addFlags(2048);
}
if (this.isActionBarShowing) {
activity.getActionBar().show();
return;
}
View view = this.titleBar;
if (view != null) {
view.setVisibility(this.origTitleBarVisibility);
}
}
}
private void setCloseRegionPosition(View view) {
DisplayMetrics displayMetrics = this.displayMetrics;
if (displayMetrics != null) {
int applyDimension = (int) TypedValue.applyDimension(1, 50.0f, displayMetrics);
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(applyDimension, applyDimension);
if (view != this.expandedView) {
if (view == this.resizedView) {
switch (this.resizeProperties.customClosePosition) {
case 0:
case 4:
layoutParams.addRule(9);
break;
case 1:
case 3:
case 5:
layoutParams.addRule(14);
break;
case 2:
case 6:
layoutParams.addRule(11);
break;
}
switch (this.resizeProperties.customClosePosition) {
case 0:
case 1:
case 2:
layoutParams.addRule(10);
break;
case 3:
layoutParams.addRule(15);
break;
case 4:
case 5:
case 6:
layoutParams.addRule(12);
break;
}
}
} else {
layoutParams.addRule(10);
layoutParams.addRule(20);
}
this.closeRegion.setLayoutParams(layoutParams);
}
}
public void setCurrentPosition() {
int i = this.currentPosition.left;
int i2 = this.currentPosition.top;
int width = this.currentPosition.width();
int height = this.currentPosition.height();
String str = MRAID_LOG_TAG;
MRAIDLog.d(str, "setCurrentPosition [" + i + "," + i2 + "] (" + width + "x" + height + ")");
injectJavaScript("mraid.setCurrentPosition(" + px2dip(i) + "," + px2dip(i2) + "," + px2dip(width) + "," + px2dip(height) + ");");
}
public void setDefaultPosition() {
int i = this.defaultPosition.left;
int i2 = this.defaultPosition.top;
int width = this.defaultPosition.width();
int height = this.defaultPosition.height();
String str = MRAID_LOG_TAG;
MRAIDLog.d(str, "setDefaultPosition [" + i + "," + i2 + "] (" + width + "x" + height + ")");
injectJavaScript("mraid.setDefaultPosition(" + px2dip(i) + "," + px2dip(i2) + "," + px2dip(width) + "," + px2dip(height) + ");");
}
public void setEnvironmentVariables() {
DeviceInfo deviceInfo = HyBid.getDeviceInfo();
if (getContext() != null && getContext().getApplicationContext() != null && !TextUtils.isEmpty(getContext().getApplicationContext().getPackageName())) {
injectJavaScript("mraid.setAppId(\"" + getContext().getApplicationContext().getPackageName() + "\");");
}
injectJavaScript("mraid.setSdkVersion(\"2.20.0\");");
injectJavaScript("mraid.setCoppa(" + HyBid.isCoppaEnabled() + ");");
if (deviceInfo != null) {
if (!deviceInfo.limitTracking() && !TextUtils.isEmpty(deviceInfo.getAdvertisingId())) {
injectJavaScript("mraid.setIfa(\"" + deviceInfo.getAdvertisingId() + "\");");
}
injectJavaScript("mraid.setLimitAdTracking(" + deviceInfo.limitTracking() + ");");
}
}
public void setLocation() {
if (!this.nativeFeatureManager.isLocationSupported()) {
injectJavaScript("mraid.setLocation(-1);");
return;
}
HyBidLocationManager locationManager = HyBid.getLocationManager();
if (locationManager == null || locationManager.getUserLocation() == null) {
injectJavaScript("mraid.setLocation(-1);");
return;
}
Location userLocation = locationManager.getUserLocation();
JSONObject jSONObject = new JSONObject();
try {
jSONObject.put(ServerParameters.LAT_KEY, userLocation.getLatitude());
jSONObject.put(ServerParameters.LON_KEY, userLocation.getLongitude());
jSONObject.put("type", 1);
jSONObject.put("accuracy", userLocation.getAccuracy());
jSONObject.put("lastfix", (SystemClock.elapsedRealtimeNanos() - userLocation.getElapsedRealtimeNanos()) / 1000000000);
injectJavaScript("mraid.setLocation(" + jSONObject.toString() + ");");
} catch (JSONException e) {
HyBid.reportException((Exception) e);
net.pubnative.lite.sdk.utils.Logger.e(MRAID_LOG_TAG, "Error passing location to MRAID interface");
injectJavaScript("mraid.setLocation(-1);");
}
}
public void setMaxSize() {
String str = MRAID_LOG_TAG;
MRAIDLog.d(str, "setMaxSize");
int i = this.maxSize.width;
int i2 = this.maxSize.height;
MRAIDLog.d(str, "setMaxSize " + i + "x" + i2);
injectJavaScript("mraid.setMaxSize(" + px2dip(i) + "," + px2dip(i2) + ");");
}
private void setOrientationInitialState() {
Context context = this.context;
if (context == null || !(context instanceof Activity)) {
return;
}
((Activity) context).setRequestedOrientation(this.activityInitialOrientation);
}
private void setResizeProperties(Map<String, String> map) {
int parseInt = Integer.parseInt(map.get(ViewHierarchyConstants.DIMENSION_WIDTH_KEY));
int parseInt2 = Integer.parseInt(map.get(ViewHierarchyConstants.DIMENSION_HEIGHT_KEY));
int parseInt3 = Integer.parseInt(map.get("offsetX"));
int parseInt4 = Integer.parseInt(map.get("offsetY"));
String str = map.get("customClosePosition");
boolean parseBoolean = Boolean.parseBoolean(map.get("allowOffscreen"));
MRAIDLog.d(MRAID_LOG_TAG + "-JS callback", "setResizeProperties " + parseInt + " " + parseInt2 + " " + parseInt3 + " " + parseInt4 + " " + str + " " + parseBoolean);
this.resizeProperties.width = parseInt;
this.resizeProperties.height = parseInt2;
this.resizeProperties.offsetX = parseInt3;
this.resizeProperties.offsetY = parseInt4;
this.resizeProperties.customClosePosition = MRAIDResizeProperties.customClosePositionFromString(str);
this.resizeProperties.allowOffscreen = parseBoolean;
}
public void m4340lambda$onLayout$7$netpubnativelitesdkmraidMRAIDView() {
if (this.displayMetrics != null) {
MRAIDLog.d(MRAID_LOG_TAG, "setResizedViewPosition");
if (this.resizedView == null) {
return;
}
int i = this.resizeProperties.width;
int i2 = this.resizeProperties.height;
int i3 = this.resizeProperties.offsetX;
int i4 = this.resizeProperties.offsetY;
int applyDimension = (int) TypedValue.applyDimension(1, i, this.displayMetrics);
int applyDimension2 = (int) TypedValue.applyDimension(1, i2, this.displayMetrics);
int applyDimension3 = this.defaultPosition.left + ((int) TypedValue.applyDimension(1, i3, this.displayMetrics));
int applyDimension4 = this.defaultPosition.top + ((int) TypedValue.applyDimension(1, i4, this.displayMetrics));
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) this.resizedView.getLayoutParams();
layoutParams.leftMargin = applyDimension3;
layoutParams.topMargin = applyDimension4;
this.resizedView.setLayoutParams(layoutParams);
if (applyDimension3 == this.currentPosition.left && applyDimension4 == this.currentPosition.top && applyDimension == this.currentPosition.width() && applyDimension2 == this.currentPosition.height()) {
return;
}
this.currentPosition.left = applyDimension3;
this.currentPosition.top = applyDimension4;
this.currentPosition.right = applyDimension3 + applyDimension;
this.currentPosition.bottom = applyDimension4 + applyDimension2;
setCurrentPosition();
}
}
private void setResizedViewSize() {
if (this.displayMetrics != null) {
String str = MRAID_LOG_TAG;
MRAIDLog.d(str, "setResizedViewSize");
int i = this.resizeProperties.width;
int i2 = this.resizeProperties.height;
MRAIDLog.d(str, "setResizedViewSize " + i + "x" + i2);
this.resizedView.setLayoutParams(new FrameLayout.LayoutParams((int) TypedValue.applyDimension(1, (float) i, this.displayMetrics), (int) TypedValue.applyDimension(1, (float) i2, this.displayMetrics)));
}
}
public void setScreenSize() {
String str = MRAID_LOG_TAG;
MRAIDLog.d(str, "setScreenSize");
int i = this.screenSize.width;
int i2 = this.screenSize.height;
MRAIDLog.d(str, "setScreenSize " + i + "x" + i2);
injectJavaScript("mraid.setScreenSize(" + px2dip(i) + "," + px2dip(i2) + ");");
}
public void setSupportedServices() {
MRAIDLog.d(MRAID_LOG_TAG, "setSupportedServices");
injectJavaScript("mraid.setSupports(mraid.SUPPORTED_FEATURES.CALENDAR, " + this.nativeFeatureManager.isCalendarSupported() + ");");
injectJavaScript("mraid.setSupports(mraid.SUPPORTED_FEATURES.INLINEVIDEO, " + this.nativeFeatureManager.isInlineVideoSupported() + ");");
injectJavaScript("mraid.setSupports(mraid.SUPPORTED_FEATURES.SMS, " + this.nativeFeatureManager.isSmsSupported() + ");");
injectJavaScript("mraid.setSupports(mraid.SUPPORTED_FEATURES.STOREPICTURE, " + this.nativeFeatureManager.isStorePictureSupported() + ");");
injectJavaScript("mraid.setSupports(mraid.SUPPORTED_FEATURES.TEL, " + this.nativeFeatureManager.isTelSupported() + ");");
injectJavaScript("mraid.setSupports(mraid.SUPPORTED_FEATURES.LOCATION, " + this.nativeFeatureManager.isLocationSupported() + ");");
}
public void setViewable(int i) {
boolean z = i == 0;
if (z != this.isViewable) {
this.isViewable = z;
if (this.isPageFinished && this.isLaidOut) {
fireViewableChangeEvent();
fireExposureChangeEvent();
}
}
}
public void showDefaultCloseButton() {
ImageButton imageButton = this.closeRegion;
if (imageButton != null) {
Bitmap bitmap = BitmapHelper.toBitmap(imageButton.getContext(), HyBid.getNormalCloseXmlResource(), Integer.valueOf(R.mipmap.close));
if (bitmap != null) {
this.closeRegion.setImageBitmap(bitmap);
} else {
ImageButton imageButton2 = this.closeRegion;
imageButton2.setImageBitmap(BitmapHelper.decodeResource(imageButton2.getContext(), Integer.valueOf(R.mipmap.close)));
}
this.closeRegion.setScaleType(ImageView.ScaleType.FIT_CENTER);
}
}
public void startSkipTimer() {
Integer num;
if (this.useCustomClose) {
handleNativeCloseButtonDelay();
Runnable runnable = this.backButtonClickabilityHandler;
if (runnable != null) {
runnable.run();
}
num = this.mNativeCloseButtonDelay;
CountDownView countDownView = this.mSkipCountdownView;
if (countDownView != null) {
countDownView.setVisibility(8);
}
} else {
num = this.mSkipTimeMillis;
CountDownView countDownView2 = this.mSkipCountdownView;
if (countDownView2 != null) {
countDownView2.setVisibility(0);
}
}
if (num.intValue() > 0 && this.showTimerBeforeEndCard.booleanValue()) {
SimpleTimer simpleTimer = new SimpleTimer(num.intValue(), new SimpleTimer.Listener() {
@Override
public void onFinish() {
MRAIDView.this.listener.mraidShowCloseButton();
if (MRAIDView.this.mSkipCountdownView != null) {
MRAIDView.this.mSkipCountdownView.setVisibility(8);
}
}
@Override
public void onTick(long j) {
if (MRAIDView.this.mSkipCountdownView != null) {
MRAIDView.this.mSkipCountdownView.setProgress((int) (MRAIDView.this.mSkipTimeMillis.intValue() - j), MRAIDView.this.mSkipTimeMillis.intValue());
}
}
}, 10L);
this.mExpirationTimer = simpleTimer;
simpleTimer.start();
} else if (num.intValue() == 0) {
this.listener.mraidShowCloseButton();
}
if (this.mBackButtonDelay.intValue() > 0) {
new SimpleTimer(this.mBackButtonDelay.intValue(), new SimpleTimer.Listener() {
@Override
public void onFinish() {
MRAIDView.this.isBackClickable = true;
}
@Override
public void onTick(long j) {
MRAIDView.this.isBackClickable = false;
}
}, 10L).start();
}
}
private void storePicture(String str) {
try {
String decode = URLDecoder.decode(str, "UTF-8");
MRAIDLog.d(MRAID_LOG_TAG + "-JS callback", "storePicture " + decode);
MRAIDNativeFeatureListener mRAIDNativeFeatureListener = this.nativeFeatureListener;
if (mRAIDNativeFeatureListener != null) {
mRAIDNativeFeatureListener.mraidNativeFeatureStorePicture(decode);
}
} catch (UnsupportedEncodingException e) {
HyBid.reportException((Exception) e);
e.printStackTrace();
}
}
@Deprecated
private void useCustomClose(String str) {
MRAIDLog.d(MRAID_LOG_TAG + "-JS callback", "useCustomClose " + str);
boolean parseBoolean = Boolean.parseBoolean(str);
if (this.useCustomClose != parseBoolean) {
this.useCustomClose = parseBoolean;
}
}
public void addViewabilityFriendlyObstruction(View view, FriendlyObstructionPurpose friendlyObstructionPurpose, String str) {
if (view == null || TextUtils.isEmpty(str)) {
return;
}
this.mViewabilityFriendlyObstructions.add(new HyBidViewabilityFriendlyObstruction(view, friendlyObstructionPurpose, str));
}
protected void applyOrientationProperties() {
if (this.context instanceof Activity) {
String str = MRAID_LOG_TAG;
MRAIDLog.d(str, "applyOrientationProperties " + this.orientationProperties.allowOrientationChange + " " + this.orientationProperties.forceOrientationString());
Activity activity = (Activity) this.context;
int i = 0;
int i2 = getResources().getConfiguration().orientation == 1 ? 1 : 0;
MRAIDLog.d(str, "currentOrientation ".concat(i2 != 0 ? DtbDeviceDataRetriever.ORIENTATION_PORTRAIT : DtbDeviceDataRetriever.ORIENTATION_LANDSCAPE));
if (this.orientationProperties.forceOrientation == 0) {
i = 1;
} else if (this.orientationProperties.forceOrientation != 1) {
i = this.orientationProperties.allowOrientationChange ? -1 : i2;
}
activity.setRequestedOrientation(i);
}
}
public void clearView() {
WebView webView = this.webView;
if (webView != null) {
webView.setWebChromeClient(null);
this.webView.setWebViewClient(null);
this.webView.loadUrl("about:blank");
}
}
public void close() {
MRAIDLog.d(MRAID_LOG_TAG + "-JS callback", "close");
StringBuilder sb = new StringBuilder("hz-m closing wv: ");
sb.append(this.webView);
MRAIDLog.d(sb.toString());
this.handler.post(new Runnable() {
@Override
public final void run() {
MRAIDView.this.m4335lambda$close$0$netpubnativelitesdkmraidMRAIDView();
}
});
}
public void closeFromExpanded() {
FrameLayout frameLayout;
int i = this.state;
if (i == 2 || i == 3) {
this.state = 1;
}
MRAIDOrientationProperties mRAIDOrientationProperties = this.orientationProperties;
if (mRAIDOrientationProperties != null) {
mRAIDOrientationProperties.allowOrientationChange = true;
}
setOrientationInitialState();
this.isClosing = true;
this.isExpanded = false;
RelativeLayout relativeLayout = this.expandedView;
if (relativeLayout != null) {
relativeLayout.removeAllViews();
}
Context context = this.context;
if (!(context instanceof Activity) || (frameLayout = (FrameLayout) ((Activity) context).findViewById(16908290)) == null) {
return;
}
frameLayout.removeView(this.expandedView);
this.expandedView = null;
this.closeRegion = null;
this.handler.post(new Runnable() {
@Override
public final void run() {
MRAIDView.this.m4336x369d02b5();
}
});
WebView webView = this.webViewPart2;
if (webView == null) {
if (findViewById(R.id.mraid_ad_view) != null) {
removeView(this.webView);
}
addView(this.webView, 0, new FrameLayout.LayoutParams(-1, -2));
} else {
webView.destroy();
this.webView.setWebChromeClient(this.mraidWebChromeClient);
this.webView.setWebViewClient(this.mraidWebViewClient);
MRAIDLog.d("hz-m MRAIDView - closeFromExpanded - setting currentwebview to " + this.webView);
WebView webView2 = this.webView;
this.currentWebView = webView2;
webView2.setLayoutParams(new FrameLayout.LayoutParams(-1, -2));
}
this.handler.post(new Runnable() {
@Override
public final void run() {
MRAIDView.this.m4337x8dbaf394();
}
});
}
protected void closeFromResized() {
this.state = 1;
this.isClosing = true;
removeResizeView();
addView(this.webView, 0);
this.handler.post(new Runnable() {
@Override
public final void run() {
MRAIDView.this.m4338lambda$closeFromResized$4$netpubnativelitesdkmraidMRAIDView();
}
});
}
public void destroy() {
if (this.webView != null) {
MRAIDLog.i("Destroying Main WebView");
this.webView.destroy();
}
if (this.webViewPart2 != null) {
MRAIDLog.i("Destroying Secondary WebView");
this.webViewPart2.destroy();
}
RelativeLayout relativeLayout = this.expandedView;
if (relativeLayout != null) {
ViewGroup viewGroup = (ViewGroup) relativeLayout.getParent();
if (viewGroup != null) {
viewGroup.removeView(this.expandedView);
}
this.expandedView = null;
}
this.currentWebView = null;
this.contentInfoAdded = false;
SimpleTimer simpleTimer = this.mExpirationTimer;
if (simpleTimer != null) {
simpleTimer.onFinish();
this.mExpirationTimer = null;
}
SimpleTimer simpleTimer2 = this.mNativeCloseButtonTimer;
if (simpleTimer2 != null) {
simpleTimer2.onFinish();
this.mNativeCloseButtonTimer = null;
}
}
@Override
public boolean dispatchTouchEvent(MotionEvent motionEvent) {
DetectTouchUtils.viewOnTouch("net.pubnative", this, motionEvent);
return super.dispatchTouchEvent(motionEvent);
}
@Deprecated
protected void expand(String str) {
if (this.isExpandEnabled) {
expandCreative(str, false, false);
}
}
public void expand(String str, Boolean bool, OnExpandCreativeFailListener onExpandCreativeFailListener) {
expandCreative(str, false, bool, onExpandCreativeFailListener);
}
public void expandContentInfo(String str) {
decodeURL(str, false);
}
public void expandHelper(WebView webView) {
applyOrientationProperties();
forceFullScreen();
RelativeLayout relativeLayout = new RelativeLayout(this.context);
this.expandedView = relativeLayout;
relativeLayout.addView(webView, new RelativeLayout.LayoutParams(-1, -1));
if (this.isInterstitial) {
addContentInfo(this.expandedView);
}
addCloseRegion(this.expandedView);
setCloseRegionPosition(this.expandedView);
MRAIDLog.d("hz-m MRAIDView - expandHelper - adding contentview to activity " + this.context);
this.showActivity.addContentView(this.expandedView, new RelativeLayout.LayoutParams(-1, -1));
this.isExpandingFromDefault = true;
this.isExpanded = true;
}
public void fireExposureChangeEvent() {
double d = this.isViewable ? 100.0d : 0.0d;
MRAIDLog.d(MRAID_LOG_TAG, "fireExposureChangeEvent");
JSONObject jSONObject = new JSONObject();
try {
jSONObject.put("x", getX());
jSONObject.put("y", getY());
jSONObject.put(ViewHierarchyConstants.DIMENSION_WIDTH_KEY, (getWidth() * d) / 100.0d);
jSONObject.put(ViewHierarchyConstants.DIMENSION_HEIGHT_KEY, (getHeight() * d) / 100.0d);
} catch (JSONException e) {
HyBid.reportException((Exception) e);
e.printStackTrace();
}
injectJavaScript("mraid.fireExposureChangeEvent(" + d + "," + jSONObject.toString() + ",null);");
}
public void fireReadyEvent() {
MRAIDLog.d(MRAID_LOG_TAG, "fireReadyEvent");
injectJavaScript("mraid.fireReadyEvent();");
}
public void fireStateChangeEvent() {
MRAIDLog.d(MRAID_LOG_TAG, "fireStateChangeEvent");
injectJavaScript("mraid.fireStateChangeEvent('" + new String[]{"loading", "default", "expanded", "resized", "hidden"}[this.state] + "');");
}
public void fireViewableChangeEvent() {
MRAIDLog.d(MRAID_LOG_TAG, "fireViewableChangeEvent");
injectJavaScript("mraid.fireViewableChangeEvent(" + this.isViewable + ");");
}
public int getState() {
return this.state;
}
public void handleNativeCloseButtonDelay() {
SimpleTimer simpleTimer = new SimpleTimer(this.mNativeCloseButtonDelay.intValue(), new SimpleTimer.Listener() {
@Override
public void onFinish() {
if (MRAIDView.this.listener != null) {
MRAIDView.this.listener.mraidShowCloseButton();
}
MRAIDView.this.showDefaultCloseButton();
}
@Override
public void onTick(long j) {
}
}, 1000L);
this.mNativeCloseButtonTimer = simpleTimer;
simpleTimer.start();
}
public void injectJavaScript(String str) {
injectJavaScript(this.currentWebView, str);
}
public boolean isExpanded() {
return this.isExpanded;
}
public boolean isLoaded() {
return this.isPageFinished;
}
public void m4334lambda$addCloseRegion$5$netpubnativelitesdkmraidMRAIDView(View view) {
close();
}
public void m4335lambda$close$0$netpubnativelitesdkmraidMRAIDView() {
int i = this.state;
if (i != 1 && i != 2) {
if (i == 3) {
closeFromResized();
return;
}
return;
}
MRAIDViewCloseLayoutListener mRAIDViewCloseLayoutListener = this.closeLayoutListener;
if (mRAIDViewCloseLayoutListener != null) {
mRAIDViewCloseLayoutListener.onClose();
} else {
closeFromExpanded();
}
}
public void m4336x369d02b5() {
restoreOriginalOrientation();
restoreOriginalScreenState();
}
public void m4337x8dbaf394() {
fireStateChangeEvent();
MRAIDViewListener mRAIDViewListener = this.listener;
if (mRAIDViewListener != null) {
mRAIDViewListener.mraidViewClose(this);
}
}
public void m4338lambda$closeFromResized$4$netpubnativelitesdkmraidMRAIDView() {
fireStateChangeEvent();
MRAIDViewListener mRAIDViewListener = this.listener;
if (mRAIDViewListener != null) {
mRAIDViewListener.mraidViewClose(this);
}
}
public void m4339lambda$decodeURL$1$netpubnativelitesdkmraidMRAIDView(boolean z, final String str) {
MRAIDLog.d("hz-m MRAIDView - expand - url loading thread");
if (z) {
Context context = this.context;
if (context instanceof Activity) {
((Activity) context).runOnUiThread(new Runnable() {
@Override
public void run() {
if (MRAIDView.this.state == 3) {
MRAIDView.this.removeResizeView();
MRAIDView mRAIDView = MRAIDView.this;
mRAIDView.addView(mRAIDView.webView);
}
MRAIDView.this.webView.setWebChromeClient(null);
MRAIDView.this.webView.setWebViewClient(null);
MRAIDView mRAIDView2 = MRAIDView.this;
mRAIDView2.webViewPart2 = mRAIDView2.createWebView();
MRAIDView.this.webViewPart2.loadUrl(str);
MRAIDLog.d("hz-m MRAIDView - expand - switching out currentwebview for " + MRAIDView.this.webViewPart2);
MRAIDView mRAIDView3 = MRAIDView.this;
mRAIDView3.currentWebView = mRAIDView3.webViewPart2;
MRAIDView.this.isExpandingPart2 = true;
MRAIDView mRAIDView4 = MRAIDView.this;
mRAIDView4.expandHelper(mRAIDView4.currentWebView);
}
});
return;
}
MRAIDLog.e("Could not load part 2 expanded content for URL: " + str);
return;
}
final String stringFromUrl = getStringFromUrl(str);
if (!TextUtils.isEmpty(stringFromUrl)) {
Context context2 = this.context;
if (context2 instanceof Activity) {
((Activity) context2).runOnUiThread(new Runnable() {
@Override
public void run() {
if (MRAIDView.this.state == 3) {
MRAIDView.this.removeResizeView();
MRAIDView mRAIDView = MRAIDView.this;
mRAIDView.addView(mRAIDView.webView);
}
MRAIDView.this.webView.setWebChromeClient(null);
MRAIDView.this.webView.setWebViewClient(null);
MRAIDView mRAIDView2 = MRAIDView.this;
mRAIDView2.webViewPart2 = mRAIDView2.createWebView();
MRAIDView.this.webViewPart2.loadDataWithBaseURL(MRAIDView.this.baseUrl, stringFromUrl, "text/html", "UTF-8", null);
MRAIDLog.d("hz-m MRAIDView - expand - switching out currentwebview for " + MRAIDView.this.webViewPart2);
MRAIDView mRAIDView3 = MRAIDView.this;
mRAIDView3.currentWebView = mRAIDView3.webViewPart2;
MRAIDView.this.isExpandingPart2 = true;
MRAIDView mRAIDView4 = MRAIDView.this;
mRAIDView4.expandHelper(mRAIDView4.currentWebView);
}
});
return;
}
}
MRAIDLog.e("Could not load part 2 expanded content for URL: " + str);
}
@Override
protected void onAttachedToWindow() {
MRAIDLog.d(MRAID_LOG_TAG, "onAttachedToWindow");
super.onAttachedToWindow();
}
public boolean onBackPressed() {
MRAIDLog.d("hz-m MRAIDView - onBackPressed");
int i = this.state;
if (i == 0 || i == 4) {
MRAIDLog.d("hz-m MRAIDView - onBackPressed - loading or hidden");
return false;
} else if (this.isBackClickable.booleanValue()) {
close();
return true;
} else {
return true;
}
}
@Override
public void onConfigurationChanged(Configuration configuration) {
super.onConfigurationChanged(configuration);
MRAIDLog.d(MRAID_LOG_TAG, "onConfigurationChanged ".concat(configuration.orientation == 1 ? DtbDeviceDataRetriever.ORIENTATION_PORTRAIT : DtbDeviceDataRetriever.ORIENTATION_LANDSCAPE));
WindowManager windowManager = (WindowManager) this.context.getSystemService("window");
if (windowManager != null) {
windowManager.getDefaultDisplay().getMetrics(this.displayMetrics);
}
}
@Override
protected void onDetachedFromWindow() {
MRAIDLog.d(MRAID_LOG_TAG, "onDetachedFromWindow");
stopAdSession();
super.onDetachedFromWindow();
}
@Override
protected void onLayout(boolean z, int i, int i2, int i3, int i4) {
super.onLayout(z, i, i2, i3, i4);
String str = MRAID_LOG_TAG;
MRAIDLog.w(str, "onLayout (" + this.state + ") " + z + " " + i + " " + i2 + " " + i3 + " " + i4);
if (this.isForcingFullScreen) {
MRAIDLog.d(str, "onLayout ignored");
return;
}
int i5 = this.state;
if (i5 == 2 || i5 == 3) {
calculateScreenSize();
calculateMaxSize();
}
if (this.isClosing) {
this.isClosing = false;
this.currentPosition = new Rect(this.defaultPosition);
setCurrentPosition();
} else {
calculatePosition(false);
}
if (this.state == 3 && z) {
this.handler.post(new Runnable() {
@Override
public final void run() {
MRAIDView.this.m4340lambda$onLayout$7$netpubnativelitesdkmraidMRAIDView();
}
});
}
this.isLaidOut = true;
onLayoutCompleted();
}
protected void onLayoutCompleted() {
}
@Override
public void onMeasure(int i, int i2) {
if (1 == 0) {
setMeasuredDimension(0, 0);
} else {
super.onMeasure(i, i2);
}
}
@Override
public boolean onTouchEvent(MotionEvent motionEvent) {
if (this.gestureDetector.onTouchEvent(motionEvent)) {
motionEvent.setAction(3);
}
return super.onTouchEvent(motionEvent);
}
@Override
protected void onVisibilityChanged(View view, int i) {
super.onVisibilityChanged(view, i);
String str = MRAID_LOG_TAG;
MRAIDLog.d(str, "onVisibilityChanged " + getVisibilityString(i));
setViewable(i);
}
@Override
protected void onWindowVisibilityChanged(int i) {
super.onWindowVisibilityChanged(i);
int visibility = getVisibility();
String str = MRAID_LOG_TAG;
MRAIDLog.d(str, "onWindowVisibilityChanged " + getVisibilityString(i) + " (actual " + getVisibilityString(visibility) + ")");
setViewable(visibility);
}
public void pause() {
SimpleTimer simpleTimer = this.mExpirationTimer;
if (simpleTimer != null) {
simpleTimer.pause();
}
SimpleTimer simpleTimer2 = this.mNativeCloseButtonTimer;
if (simpleTimer2 != null) {
simpleTimer2.pause();
}
}
public void resume() {
SimpleTimer simpleTimer = this.mExpirationTimer;
if (simpleTimer != null) {
simpleTimer.resume();
}
SimpleTimer simpleTimer2 = this.mNativeCloseButtonTimer;
if (simpleTimer2 != null) {
simpleTimer2.resume();
}
}
public void setBackButtonClickabilityHandler(Runnable runnable) {
this.backButtonClickabilityHandler = runnable;
}
public void setBackButtonDelay(Integer num) {
this.mBackButtonDelay = num;
}
public void setCloseLayoutListener(MRAIDViewCloseLayoutListener mRAIDViewCloseLayoutListener) {
this.closeLayoutListener = mRAIDViewCloseLayoutListener;
}
public void setNativeCloseButtonDelay(Integer num) {
this.mNativeCloseButtonDelay = Integer.valueOf(num.intValue() * 1000);
}
protected void setOrientationProperties(Map<String, String> map) {
boolean parseBoolean = Boolean.parseBoolean(map.get("allowOrientationChange"));
String str = map.get("forceOrientation");
MRAIDLog.d(MRAID_LOG_TAG + "-JS callback", "setOrientationProperties " + parseBoolean + " " + str);
this.orientationProperties.allowOrientationChange = parseBoolean;
this.orientationProperties.forceOrientation = MRAIDOrientationProperties.forceOrientationFromString(str);
if ((this instanceof MRAIDInterstitial) || this.state == 2) {
applyOrientationProperties();
}
}
public void setSkipOffset(Integer num) {
this.mSkipTimeMillis = Integer.valueOf(num.intValue() * 1000);
}
public void setUseCustomClose(Boolean bool) {
if (this.useCustomClose != bool.booleanValue()) {
this.useCustomClose = bool.booleanValue();
}
}
public void showAsInterstitial(Activity activity, Boolean bool, OnExpandCreativeFailListener onExpandCreativeFailListener) {
MRAIDLog.d("hz-m MRAIDVIEW - showAsInterstitial");
this.showActivity = activity;
expand(null, bool, onExpandCreativeFailListener);
}
public void showAsInterstitial(Activity activity, Boolean bool, OnExpandCreativeFailListener onExpandCreativeFailListener, String str) {
MRAIDLog.d("hz-m MRAIDVIEW - showAsInterstitial");
this.showActivity = activity;
expand(str, bool, onExpandCreativeFailListener);
}
public void stopAdSession() {
HyBidViewabilityWebAdSession hyBidViewabilityWebAdSession = this.mViewabilityAdSession;
if (hyBidViewabilityWebAdSession != null) {
hyBidViewabilityWebAdSession.stopAdSession();
}
}
protected void unload() {
MRAIDLog.d(MRAID_LOG_TAG + "-JS callback", "unload");
StringBuilder sb = new StringBuilder("hz-m unload wv: ");
sb.append(this.webView);
MRAIDLog.d(sb.toString());
MRAIDViewListener mRAIDViewListener = this.listener;
if (mRAIDViewListener != null) {
mRAIDViewListener.mraidViewError(this);
}
}
}