Kufar v3.2.0版本的 MD5 值为:6a4d203db1c561c7e3bcd50d23fed59f
以下内容为反编译后的 a5.java 源代码,内容仅作参考
package com.my.target;
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.graphics.Rect;
import android.net.Uri;
import android.text.TextUtils;
import android.webkit.ConsoleMessage;
import android.webkit.JsResult;
import android.webkit.WebChromeClient;
import android.webkit.WebResourceRequest;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import com.mbridge.msdk.foundation.entity.CampaignEx;
import com.mbridge.msdk.playercommon.exoplayer2.C;
import com.mbridge.msdk.playercommon.exoplayer2.text.ttml.TtmlNode;
import com.my.target.f5;
import java.net.URI;
import java.util.ArrayList;
import org.json.JSONObject;
public class a5 {
@NonNull
public final String f50232a;
@NonNull
public final WebViewClient f50233b = new c();
@Nullable
public b f50234c;
@Nullable
public f5 f50235d;
public boolean f50236e;
public boolean f50237f;
public interface b {
void a(@NonNull a5 a5Var, @NonNull WebView webView);
void a(boolean z11);
boolean a(float f11, float f12);
boolean a(int i11, int i12, int i13, int i14, boolean z11, int i15);
boolean a(@Nullable Uri uri);
boolean a(@NonNull ConsoleMessage consoleMessage, @NonNull a5 a5Var);
boolean a(@NonNull String str);
boolean a(@NonNull String str, @NonNull JsResult jsResult);
boolean a(boolean z11, c5 c5Var);
void b(@NonNull Uri uri);
void c();
void d();
boolean f();
void g();
}
public class c extends WebViewClient {
public c() {
}
@Override
public void onPageFinished(WebView webView, String str) {
a5.this.b();
}
@Override
public void onReceivedError(WebView webView, int i11, String str, String str2) {
c9.a("MraidBridge: Error - " + str);
super.onReceivedError(webView, i11, str, str2);
}
@Override
@TargetApi(24)
public boolean shouldOverrideUrlLoading(WebView webView, WebResourceRequest webResourceRequest) {
a5.this.a(webResourceRequest.getUrl());
return true;
}
@Override
public boolean shouldOverrideUrlLoading(WebView webView, String str) {
a5.this.a(Uri.parse(str));
return true;
}
}
@SuppressLint({"RtlHardcoded"})
public static class d {
public static int a(@Nullable String str) {
char c11;
if (str == null) {
return 53;
}
switch (str.hashCode()) {
case -1364013995:
if (str.equals(TtmlNode.CENTER)) {
c11 = 1;
break;
}
c11 = 65535;
break;
case -1314880604:
if (str.equals("top-right")) {
c11 = 6;
break;
}
c11 = 65535;
break;
case -1012429441:
if (str.equals("top-left")) {
c11 = 0;
break;
}
c11 = 65535;
break;
case -655373719:
if (str.equals("bottom-left")) {
c11 = 2;
break;
}
c11 = 65535;
break;
case 1163912186:
if (str.equals("bottom-right")) {
c11 = 3;
break;
}
c11 = 65535;
break;
case 1288627767:
if (str.equals("bottom-center")) {
c11 = 5;
break;
}
c11 = 65535;
break;
case 1755462605:
if (str.equals("top-center")) {
c11 = 4;
break;
}
c11 = 65535;
break;
default:
c11 = 65535;
break;
}
if (c11 != 0) {
if (c11 != 1) {
if (c11 != 2) {
if (c11 != 3) {
if (c11 != 4) {
if (c11 != 5) {
return 53;
}
return 81;
}
return 49;
}
return 85;
}
return 83;
}
return 17;
}
return 51;
}
}
public class e extends WebChromeClient {
public e() {
}
@Override
public boolean onConsoleMessage(ConsoleMessage consoleMessage) {
c9.a("MraidBridge: JS console message - " + consoleMessage.message() + " - at line " + consoleMessage.lineNumber());
if (a5.this.f50234c != null) {
return a5.this.f50234c.a(consoleMessage, a5.this);
}
return super.onConsoleMessage(consoleMessage);
}
@Override
public boolean onJsAlert(WebView webView, String str, String str2, JsResult jsResult) {
if (a5.this.f50234c != null) {
return a5.this.f50234c.a(str2, jsResult);
}
return super.onJsAlert(webView, str, str2, jsResult);
}
}
public class f implements f5.a {
public f() {
}
@Override
public void a(boolean z11) {
if (a5.this.f50234c != null) {
a5.this.f50234c.a(z11);
}
}
@Override
public void c() {
if (a5.this.f50234c != null) {
a5.this.f50234c.c();
}
}
}
public a5(@NonNull String str) {
this.f50232a = str;
}
@NonNull
public final String a(Rect rect) {
return rect.left + "," + rect.top + "," + rect.width() + "," + rect.height();
}
public final void c(@NonNull String str) {
a("mraidbridge.nativeComplete(" + JSONObject.quote(str) + ")");
}
public void d() {
a("mraidbridge.fireReadyEvent()");
}
public void e(String str) {
a("mraidbridge.setState(" + JSONObject.quote(str) + ")");
}
public void f(@NonNull String str) {
f5 f5Var = this.f50235d;
if (f5Var == null) {
c9.a("MraidBridge: MRAID bridge called setContentHtml before WebView was attached");
} else {
this.f50236e = false;
f5Var.a("https://ad.mail.ru/", str, "text/html", C.UTF8_NAME, null);
}
}
public static a5 b(@NonNull String str) {
return new a5(str);
}
public void a() {
this.f50235d = null;
}
public boolean c() {
f5 f5Var = this.f50235d;
return f5Var != null && f5Var.h();
}
public void d(String str) {
a("mraidbridge.setPlacementType(" + JSONObject.quote(str) + ")");
}
@VisibleForTesting
public void a(@NonNull Uri uri) {
b bVar;
JSONObject jSONObject;
String scheme = uri.getScheme();
String host = uri.getHost();
if ("mytarget".equals(scheme)) {
if ("onloadmraidjs".equals(host)) {
c9.a("MraidBridge: JS call onLoad");
}
c9.a("MraidBridge: Got mytarget scheme - " + uri);
return;
}
if (!CampaignEx.JSON_KEY_MRAID.equals(scheme)) {
try {
new URI(uri.toString());
f5 f5Var = this.f50235d;
if (f5Var == null || !f5Var.g() || (bVar = this.f50234c) == null) {
return;
}
bVar.b(uri);
return;
} catch (Throwable unused) {
c9.a("MraidBridge: Invalid MRAID URL - " + uri);
a("", "Mraid command sent an invalid URL");
return;
}
}
if (host.contains(",")) {
host = host.substring(0, host.indexOf(",")).trim();
}
c9.a("MraidBridge: Got mraid command - " + uri);
String uri2 = uri.toString();
b5 b5Var = new b5(host, this.f50232a);
c(b5Var.toString());
int indexOf = uri2.indexOf("{");
int lastIndexOf = uri2.lastIndexOf("}") + 1;
if (indexOf >= 0 && lastIndexOf > 0 && indexOf < lastIndexOf) {
try {
if (lastIndexOf <= uri2.length()) {
jSONObject = new JSONObject(uri2.substring(indexOf, lastIndexOf));
a(b5Var, jSONObject);
}
} catch (Throwable th2) {
a(b5Var.toString(), th2.getMessage());
return;
}
}
jSONObject = null;
a(b5Var, jSONObject);
}
@NonNull
public final String b(Rect rect) {
return rect.width() + "," + rect.height();
}
public void a(@Nullable b bVar) {
this.f50234c = bVar;
}
public final void b() {
if (this.f50236e) {
return;
}
this.f50236e = true;
b bVar = this.f50234c;
if (bVar != null) {
bVar.a(this, this.f50235d.getWebView());
}
}
public void a(@NonNull e5 e5Var) {
a("mraidbridge.setScreenSize(" + b(e5Var.d()) + ");window.mraidbridge.setMaxSize(" + b(e5Var.c()) + ");window.mraidbridge.setCurrentPosition(" + a(e5Var.a()) + ");window.mraidbridge.setDefaultPosition(" + a(e5Var.b()) + ")");
StringBuilder sb2 = new StringBuilder();
sb2.append("mraidbridge.fireSizeChangeEvent(");
sb2.append(b(e5Var.a()));
sb2.append(")");
a(sb2.toString());
}
@SuppressLint({"SetJavaScriptEnabled"})
public void a(@NonNull f5 f5Var) {
this.f50235d = f5Var;
WebSettings settings = f5Var.getSettings();
if (settings != null) {
settings.setJavaScriptEnabled(true);
if ("interstitial".equals(this.f50232a)) {
settings.setMediaPlaybackRequiresUserGesture(false);
}
}
this.f50235d.setScrollContainer(false);
this.f50235d.setVerticalScrollBarEnabled(false);
this.f50235d.setHorizontalScrollBarEnabled(false);
this.f50235d.setWebViewClient(this.f50233b);
this.f50235d.setWebChromeClient(new e());
this.f50235d.setVisibilityChangedListener(new f());
}
public final void a(@NonNull String str) {
if (this.f50235d == null) {
c9.a("MraidBridge: Attempted to inject Javascript into MRAID WebView while was not attached - \n\t" + str);
return;
}
String str2 = "javascript:window." + str + ";";
c9.a("MraidBridge: Injecting Javascript into MRAID WebView " + hashCode() + " - " + str2);
this.f50235d.a(str2);
}
public void a(@NonNull String str, @NonNull String str2) {
a("mraidbridge.fireErrorEvent(" + JSONObject.quote(str2) + ", " + JSONObject.quote(str) + ")");
}
public void a(@NonNull ArrayList<String> arrayList) {
a("mraidbridge.setSupports(" + TextUtils.join(",", arrayList) + ")");
}
public void a(boolean z11) {
if (z11 != this.f50237f) {
a("mraidbridge.setIsViewable(" + z11 + ")");
}
this.f50237f = z11;
}
@VisibleForTesting
public boolean a(@NonNull b5 b5Var, @Nullable JSONObject jSONObject) {
f5 f5Var;
String b5Var2 = b5Var.toString();
if (b5Var.f50289a && (f5Var = this.f50235d) != null && !f5Var.g()) {
a(b5Var2, "Cannot execute this command unless the user clicks");
return false;
}
if (this.f50234c == null) {
a(b5Var2, "Invalid state to execute this command");
return false;
}
if (this.f50235d == null) {
a(b5Var2, "The current WebView is being destroyed");
return false;
}
b5Var2.hashCode();
char c11 = 65535;
switch (b5Var2.hashCode()) {
case -1910759310:
if (b5Var2.equals("vpaidInit")) {
c11 = 0;
break;
}
break;
case -1886160473:
if (b5Var2.equals("playVideo")) {
c11 = 1;
break;
}
break;
case -1289167206:
if (b5Var2.equals("expand")) {
c11 = 2;
break;
}
break;
case -934437708:
if (b5Var2.equals("resize")) {
c11 = 3;
break;
}
break;
case -733616544:
if (b5Var2.equals("createCalendarEvent")) {
c11 = 4;
break;
}
break;
case 0:
if (b5Var2.equals("")) {
c11 = 5;
break;
}
break;
case 3417674:
if (b5Var2.equals("open")) {
c11 = 6;
break;
}
break;
case 94756344:
if (b5Var2.equals("close")) {
c11 = 7;
break;
}
break;
case 133423073:
if (b5Var2.equals("setOrientationProperties")) {
c11 = '\b';
break;
}
break;
case 459238621:
if (b5Var2.equals("storePicture")) {
c11 = '\t';
break;
}
break;
case 624734601:
if (b5Var2.equals("setResizeProperties")) {
c11 = '\n';
break;
}
break;
case 892543864:
if (b5Var2.equals("vpaidEvent")) {
c11 = 11;
break;
}
break;
case 1797992422:
if (b5Var2.equals("playheadEvent")) {
c11 = '\f';
break;
}
break;
}
switch (c11) {
case 0:
this.f50234c.g();
return true;
case 1:
c9.a("MraidBridge: playVideo is currently unsupported");
return false;
case 2:
return this.f50234c.a(jSONObject != null ? Uri.parse(jSONObject.getString("url")) : null);
case 3:
return this.f50234c.f();
case 4:
c9.a("MraidBridge: createCalendarEvent is currently unsupported");
return false;
case 5:
a(b5Var2, "Unspecified MRAID Javascript command");
return false;
case 6:
if (jSONObject == null) {
a(b5Var2, "open params cannot be null");
return false;
}
this.f50234c.b(Uri.parse(jSONObject.getString("url")));
return true;
case 7:
this.f50234c.d();
return true;
case '\b':
if (jSONObject == null) {
a(b5Var2, "setOrientationProperties params cannot be null");
return false;
}
boolean z11 = jSONObject.getBoolean("allowOrientationChange");
String string = jSONObject.getString("forceOrientation");
c5 a11 = c5.a(string);
if (a11 != null) {
return this.f50234c.a(z11, a11);
}
a(b5Var2, "wrong orientation " + string);
return false;
case '\t':
c9.a("MraidBridge: storePicture is currently unsupported");
return false;
case '\n':
if (jSONObject != null) {
return this.f50234c.a(jSONObject.getInt("width"), jSONObject.getInt("height"), jSONObject.getInt("offsetX"), jSONObject.getInt("offsetY"), jSONObject.optBoolean("allowOffscreen", false), d.a(jSONObject.optString("customClosePosition")));
}
a(b5Var2, "setResizeProperties params cannot be null");
return false;
case 11:
if (jSONObject != null) {
return this.f50234c.a(jSONObject.getString("event"));
}
a(b5Var2, "vpaidEvent params cannot be null");
return false;
case '\f':
if (jSONObject != null) {
return this.f50234c.a((float) jSONObject.getDouble("remain"), (float) jSONObject.getDouble("duration"));
}
a(b5Var2, "playheadEvent params cannot be null");
return false;
default:
return true;
}
}
}