Wolves Themes v1.0版本的 MD5 值为:cddc92b47f6b7c4a195c9625507eb51c
以下内容为反编译后的 VungleNativeView.java 源代码,内容仅作参考
package com.vungle.warren.ui;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import android.view.View;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.RelativeLayout;
import com.google.android.gms.common.util.CrashUtils;
import com.ironsource.sdk.constants.Constants;
import com.vungle.warren.DirectDownloadAdapter;
import com.vungle.warren.VungleNativeAd;
import com.vungle.warren.error.VungleException;
import com.vungle.warren.persistence.GraphicDesigner;
import com.vungle.warren.persistence.PepperidgeFarm;
import com.vungle.warren.presenter.AdvertisementPresenter;
import com.vungle.warren.presenter.AdvertisementPresenterFactory;
import java.net.URISyntaxException;
public class VungleNativeView extends WebView implements AdView, VungleNativeAd {
private static final String TAG = VungleNativeView.class.getName();
private Handler handler;
private AdvertisementPresenter presenter;
@Override
public void onResume() {
super.onResume();
Log.d(TAG, "Resuming Flex");
this.presenter.play();
}
@Override
public void onPause() {
super.onPause();
this.presenter.stop(false, false);
}
public VungleNativeView(Context context, String placementID, DirectDownloadAdapter directDownloadAdapter, AdvertisementPresenter.EventListener listener) {
super(context);
this.presenter = AdvertisementPresenterFactory.getAdRenderer(placementID, new PepperidgeFarm(context), new GraphicDesigner(), null, null);
if (this.presenter == null) {
if (listener != null) {
listener.onError(new VungleException(10));
return;
}
return;
}
this.presenter.attach(this);
if (directDownloadAdapter != null) {
directDownloadAdapter.getSdkDownloadClient().setAdWebView(this);
this.presenter.setDirectDownloadAdapter(directDownloadAdapter);
}
this.presenter.setEventListener(listener);
this.presenter.prepare();
this.handler = new Handler();
prepare(null);
}
@SuppressLint({"AddJavascriptInterface", "SetJavaScriptEnabled"})
private void prepare(Bundle savedInstanceState) {
WebViewClient webViewClient = this.presenter.getWebViewClient();
setWebViewClient(webViewClient);
WebSettings webSettings = getSettings();
webSettings.setBuiltInZoomControls(false);
webSettings.setJavaScriptEnabled(true);
webSettings.setLoadWithOverviewMode(true);
webSettings.setSaveFormData(true);
webSettings.setUseWideViewPort(false);
if (Build.VERSION.SDK_INT >= 17) {
webSettings.setMediaPlaybackRequiresUserGesture(false);
}
if (Build.VERSION.SDK_INT >= 19) {
WebView.setWebContentsDebuggingEnabled(true);
}
addJavascriptInterface(new JavascriptBridge(this.presenter), Constants.JAVASCRIPT_INTERFACE_NAME);
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(-1, -1);
setLayoutParams(params);
getSettings().setJavaScriptEnabled(true);
getSettings().setPluginState(WebSettings.PluginState.ON);
getSettings().setBuiltInZoomControls(false);
getSettings().setLoadWithOverviewMode(true);
getSettings().setSaveFormData(true);
getSettings().setUseWideViewPort(false);
if (Build.VERSION.SDK_INT >= 17) {
getSettings().setMediaPlaybackRequiresUserGesture(false);
} else {
setAdVisibility(true);
}
setVisibility(4);
}
@Override
public void finishDisplayingAd() {
loadUrl("about:blank");
this.presenter.stop(false, true);
}
@Override
public View renderNativeView() {
return this;
}
@Override
public void setAdVisibility(boolean isVisible) {
loadUrl("javascript:window.vungle.mraidBridge.notifyPropertiesChange({\"isViewable\":" + isVisible + "},false)");
}
@Override
public void setOrientation(int orientation) {
}
@Override
public void playVideo(Uri uri, boolean startMuted) {
throw new UnsupportedOperationException("VungleNativeView does not implement a video player.");
}
@Override
public void showWebsite(String url) {
loadUrl(url);
}
@Override
public void close() {
if (this.presenter.handleExit(null)) {
finishDisplayingAd();
}
}
@Override
public void showCloseButton() {
throw new UnsupportedOperationException("VungleNativeView does not implement a close button");
}
@Override
public void showCTAOverlay(boolean clickEnabled, boolean enabled, int size) {
}
@Override
public void open(String url) {
Log.v(TAG, "Opening " + url);
try {
Intent i = Intent.parseUri(url, 0);
i.addFlags(CrashUtils.ErrorDialogData.BINDER_CRASH);
getContext().startActivity(i);
} catch (URISyntaxException e) {
e.printStackTrace();
}
}
@Override
public void showDialog(String title, String body, String resume, String close, DialogInterface.OnClickListener responseListener) {
throw new UnsupportedOperationException("VungleNativeView does not implement a dialog.");
}
@Override
public void updateWindow(boolean isFlexView) {
}
@Override
public void setVisibility(boolean isVisible) {
int setVisibilityState = isVisible ? 0 : 4;
setVisibility(setVisibilityState);
}
}