Files
rr3-apk/decompiled/sources/csdk/gluads/jsevaluator/WebViewWrapper.java
Daniel Elliott f9d20bb3fc Add decompiled APK source code (JADX)
- 28,932 files
- Full Java source code
- Smali files
- Resources

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-02-18 14:52:23 -08:00

65 lines
2.4 KiB
Java

package csdk.gluads.jsevaluator;
import android.annotation.SuppressLint;
import android.content.Context;
import android.util.Base64;
import android.webkit.WebSettings;
import android.webkit.WebView;
import com.ironsource.nb;
import com.unity3d.ads.adplayer.AndroidWebViewClient;
import csdk.gluads.jsevaluator.interfaces.CallJavaResultInterface;
import csdk.gluads.jsevaluator.interfaces.WebViewWrapperInterface;
import java.io.UnsupportedEncodingException;
@SuppressLint({"SetJavaScriptEnabled"})
/* loaded from: classes4.dex */
public class WebViewWrapper implements WebViewWrapperInterface {
protected WebView mWebView;
@Override // csdk.gluads.jsevaluator.interfaces.WebViewWrapperInterface
public WebView getWebView() {
return this.mWebView;
}
public WebViewWrapper(Context context, CallJavaResultInterface callJavaResultInterface) {
try {
WebView webView = new WebView(context);
this.mWebView = webView;
webView.setWillNotDraw(true);
WebSettings settings = this.mWebView.getSettings();
settings.setJavaScriptEnabled(true);
settings.setDefaultTextEncodingName(nb.N);
this.mWebView.addJavascriptInterface(new JavaScriptInterface(callJavaResultInterface), JsEvaluator.JS_NAMESPACE);
} catch (Exception e) {
e.printStackTrace();
}
}
@Override // csdk.gluads.jsevaluator.interfaces.WebViewWrapperInterface
public void loadJavaScript(String str) {
if (this.mWebView != null) {
try {
String encodeToString = Base64.encodeToString(("<script>" + str + "</script>").getBytes("UTF-8"), 0);
this.mWebView.loadUrl("data:text/html;charset=utf-8;base64," + encodeToString);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
}
@Override // csdk.gluads.jsevaluator.interfaces.WebViewWrapperInterface
public void destroy() {
WebView webView = this.mWebView;
if (webView != null) {
webView.removeJavascriptInterface(JsEvaluator.JS_NAMESPACE);
this.mWebView.loadUrl(AndroidWebViewClient.BLANK_PAGE);
this.mWebView.stopLoading();
this.mWebView.clearHistory();
this.mWebView.removeAllViews();
this.mWebView.destroyDrawingCache();
this.mWebView.destroy();
this.mWebView = null;
}
}
}