Weather Tracker v1.0.0版本的 MD5 值为:3edef27647e42a8ea0e7c0d2dbf56f97

以下内容为反编译后的 g5.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 androidx.core.app.NotificationCompat;
import com.google.android.exoplayer2.text.ttml.TtmlNode;
import com.my.target.l5;
import java.net.URI;
import java.util.ArrayList;
import org.json.JSONObject;
public class g5 {
    @NonNull
    public final String a;
    @NonNull
    public final WebViewClient f4404b = new c();
    @Nullable
    public b c;
    @Nullable
    public l5 d;
    public boolean e;
    public boolean f;

    public interface b {
        void a(@NonNull g5 g5Var, @NonNull WebView webView);

        void a(boolean z);

        boolean a(float f, float f2);

        boolean a(int i, int i2, int i3, int i4, boolean z, int i5);

        boolean a(@Nullable Uri uri);

        boolean a(@NonNull ConsoleMessage consoleMessage, @NonNull g5 g5Var);

        boolean a(@NonNull String str);

        boolean a(@NonNull String str, @NonNull JsResult jsResult);

        boolean a(boolean z, i5 i5Var);

        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) {
            g5.this.b();
        }

        @Override
        public void onReceivedError(WebView webView, int i, String str, String str2) {
            o9.a("MraidBridge: Error - " + str);
            super.onReceivedError(webView, i, str, str2);
        }

        @Override
        @TargetApi(24)
        public boolean shouldOverrideUrlLoading(WebView webView, WebResourceRequest webResourceRequest) {
            g5.this.a(webResourceRequest.getUrl());
            return true;
        }

        @Override
        public boolean shouldOverrideUrlLoading(WebView webView, String str) {
            g5.this.a(Uri.parse(str));
            return true;
        }
    }

    @SuppressLint({"RtlHardcoded"})
    public static class d {
        public static int a(@Nullable String str) {
            if (str == null) {
                return 53;
            }
            char c = 65535;
            switch (str.hashCode()) {
                case -1364013995:
                    if (str.equals("center")) {
                        c = 1;
                        break;
                    }
                    break;
                case -1314880604:
                    if (str.equals(com.inmobi.media.u9.DEFAULT_POSITION)) {
                        c = 6;
                        break;
                    }
                    break;
                case -1012429441:
                    if (str.equals("top-left")) {
                        c = 0;
                        break;
                    }
                    break;
                case -655373719:
                    if (str.equals("bottom-left")) {
                        c = 2;
                        break;
                    }
                    break;
                case 1163912186:
                    if (str.equals("bottom-right")) {
                        c = 3;
                        break;
                    }
                    break;
                case 1288627767:
                    if (str.equals("bottom-center")) {
                        c = 5;
                        break;
                    }
                    break;
                case 1755462605:
                    if (str.equals("top-center")) {
                        c = 4;
                        break;
                    }
                    break;
            }
            if (c != 0) {
                if (c != 1) {
                    if (c != 2) {
                        if (c != 3) {
                            if (c != 4) {
                                return c != 5 ? 53 : 81;
                            }
                            return 49;
                        }
                        return 85;
                    }
                    return 83;
                }
                return 17;
            }
            return 51;
        }
    }

    public class e extends WebChromeClient {
        public e() {
        }

        @Override
        public boolean onConsoleMessage(ConsoleMessage consoleMessage) {
            String message = consoleMessage.message();
            int lineNumber = consoleMessage.lineNumber();
            o9.a("MraidBridge: JS console message - " + message + " - at line " + lineNumber);
            return g5.this.c != null ? g5.this.c.a(consoleMessage, g5.this) : super.onConsoleMessage(consoleMessage);
        }

        @Override
        public boolean onJsAlert(WebView webView, String str, String str2, JsResult jsResult) {
            return g5.this.c != null ? g5.this.c.a(str2, jsResult) : super.onJsAlert(webView, str, str2, jsResult);
        }
    }

    public class f implements l5.a {
        public f() {
        }

        @Override
        public void a(boolean z) {
            if (g5.this.c != null) {
                g5.this.c.a(z);
            }
        }

        @Override
        public void c() {
            if (g5.this.c != null) {
                g5.this.c.c();
            }
        }
    }

    public g5(@NonNull String str) {
        this.a = str;
    }

    public static g5 b(@NonNull String str) {
        return new g5(str);
    }

    @NonNull
    public final String a(Rect rect) {
        return rect.left + "," + rect.top + "," + rect.width() + "," + rect.height();
    }

    public void a() {
        this.d = null;
    }

    @VisibleForTesting
    public void a(@NonNull Uri uri) {
        b bVar;
        String scheme = uri.getScheme();
        String host = uri.getHost();
        if ("mytarget".equals(scheme)) {
            if ("onloadmraidjs".equals(host)) {
                o9.a("MraidBridge: JS call onLoad");
            }
            o9.a("MraidBridge: Got mytarget scheme - " + uri);
        } else if (!"mraid".equals(scheme)) {
            try {
                new URI(uri.toString());
                l5 l5Var = this.d;
                if (l5Var == null || !l5Var.g() || (bVar = this.c) == null) {
                    return;
                }
                bVar.b(uri);
            } catch (Throwable unused) {
                o9.a("MraidBridge: Invalid MRAID URL - " + uri);
                a("", "Mraid command sent an invalid URL");
            }
        } else {
            if (host.contains(",")) {
                host = host.substring(0, host.indexOf(",")).trim();
            }
            o9.a("MraidBridge: Got mraid command - " + uri);
            String uri2 = uri.toString();
            JSONObject jSONObject = null;
            h5 h5Var = new h5(host, this.a);
            c(h5Var.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));
                    }
                } catch (Throwable th) {
                    a(h5Var.toString(), th.getMessage());
                    return;
                }
            }
            a(h5Var, jSONObject);
        }
    }

    public void a(@Nullable b bVar) {
        this.c = bVar;
    }

    public void a(@NonNull k5 k5Var) {
        a("mraidbridge.setScreenSize(" + b(k5Var.d()) + ");window.mraidbridge.setMaxSize(" + b(k5Var.c()) + ");window.mraidbridge.setCurrentPosition(" + a(k5Var.a()) + ");window.mraidbridge.setDefaultPosition(" + a(k5Var.b()) + ")");
        StringBuilder sb = new StringBuilder();
        sb.append("mraidbridge.fireSizeChangeEvent(");
        sb.append(b(k5Var.a()));
        sb.append(")");
        a(sb.toString());
    }

    @SuppressLint({"SetJavaScriptEnabled"})
    public void a(@NonNull l5 l5Var) {
        this.d = l5Var;
        WebSettings settings = l5Var.getSettings();
        if (settings != null) {
            settings.setJavaScriptEnabled(true);
            if ("interstitial".equals(this.a)) {
                settings.setMediaPlaybackRequiresUserGesture(false);
            }
        }
        this.d.setScrollContainer(false);
        this.d.setVerticalScrollBarEnabled(false);
        this.d.setHorizontalScrollBarEnabled(false);
        this.d.setWebViewClient(this.f4404b);
        this.d.setWebChromeClient(new e());
        this.d.setVisibilityChangedListener(new f());
    }

    public final void a(@NonNull String str) {
        if (this.d == null) {
            o9.a("MraidBridge: Attempted to inject Javascript into MRAID WebView while was not attached - \n\t" + str);
            return;
        }
        String str2 = "javascript:window." + str + ";";
        o9.a("MraidBridge: Injecting Javascript into MRAID WebView " + hashCode() + " - " + str2);
        this.d.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 z) {
        if (z != this.f) {
            a("mraidbridge.setIsViewable(" + z + ")");
        }
        this.f = z;
    }

    @VisibleForTesting
    public boolean a(@NonNull h5 h5Var, @Nullable JSONObject jSONObject) {
        l5 l5Var;
        String h5Var2 = h5Var.toString();
        if (h5Var.a && (l5Var = this.d) != null && !l5Var.g()) {
            a(h5Var2, "Cannot execute this command unless the user clicks");
            return false;
        } else if (this.c == null) {
            a(h5Var2, "Invalid state to execute this command");
            return false;
        } else if (this.d == null) {
            a(h5Var2, "The current WebView is being destroyed");
            return false;
        } else {
            h5Var2.hashCode();
            char c2 = 65535;
            switch (h5Var2.hashCode()) {
                case -1910759310:
                    if (h5Var2.equals("vpaidInit")) {
                        c2 = 0;
                        break;
                    }
                    break;
                case -1886160473:
                    if (h5Var2.equals("playVideo")) {
                        c2 = 1;
                        break;
                    }
                    break;
                case -1289167206:
                    if (h5Var2.equals("expand")) {
                        c2 = 2;
                        break;
                    }
                    break;
                case -934437708:
                    if (h5Var2.equals("resize")) {
                        c2 = 3;
                        break;
                    }
                    break;
                case -733616544:
                    if (h5Var2.equals("createCalendarEvent")) {
                        c2 = 4;
                        break;
                    }
                    break;
                case 0:
                    if (h5Var2.equals("")) {
                        c2 = 5;
                        break;
                    }
                    break;
                case 3417674:
                    if (h5Var2.equals(TtmlNode.TEXT_EMPHASIS_MARK_OPEN)) {
                        c2 = 6;
                        break;
                    }
                    break;
                case 94756344:
                    if (h5Var2.equals("close")) {
                        c2 = 7;
                        break;
                    }
                    break;
                case 133423073:
                    if (h5Var2.equals("setOrientationProperties")) {
                        c2 = '\b';
                        break;
                    }
                    break;
                case 459238621:
                    if (h5Var2.equals("storePicture")) {
                        c2 = '\t';
                        break;
                    }
                    break;
                case 624734601:
                    if (h5Var2.equals("setResizeProperties")) {
                        c2 = '\n';
                        break;
                    }
                    break;
                case 892543864:
                    if (h5Var2.equals("vpaidEvent")) {
                        c2 = 11;
                        break;
                    }
                    break;
                case 1797992422:
                    if (h5Var2.equals("playheadEvent")) {
                        c2 = '\f';
                        break;
                    }
                    break;
            }
            switch (c2) {
                case 0:
                    this.c.g();
                    break;
                case 1:
                    o9.a("MraidBridge: playVideo is currently unsupported");
                    return false;
                case 2:
                    return this.c.a(jSONObject != null ? Uri.parse(jSONObject.getString("url")) : null);
                case 3:
                    return this.c.f();
                case 4:
                    o9.a("MraidBridge: createCalendarEvent is currently unsupported");
                    return false;
                case 5:
                    a(h5Var2, "Unspecified MRAID Javascript command");
                    return false;
                case 6:
                    if (jSONObject != null) {
                        this.c.b(Uri.parse(jSONObject.getString("url")));
                        break;
                    } else {
                        a(h5Var2, "open params cannot be null");
                        return false;
                    }
                case 7:
                    this.c.d();
                    break;
                case '\b':
                    if (jSONObject == null) {
                        a(h5Var2, "setOrientationProperties params cannot be null");
                        return false;
                    }
                    boolean z = jSONObject.getBoolean("allowOrientationChange");
                    String string = jSONObject.getString("forceOrientation");
                    i5 a2 = i5.a(string);
                    if (a2 == null) {
                        a(h5Var2, "wrong orientation " + string);
                        return false;
                    }
                    return this.c.a(z, a2);
                case '\t':
                    o9.a("MraidBridge: storePicture is currently unsupported");
                    return false;
                case '\n':
                    if (jSONObject == null) {
                        a(h5Var2, "setResizeProperties params cannot be null");
                        return false;
                    }
                    return this.c.a(jSONObject.getInt("width"), jSONObject.getInt("height"), jSONObject.getInt("offsetX"), jSONObject.getInt("offsetY"), jSONObject.optBoolean("allowOffscreen", false), d.a(jSONObject.optString("customClosePosition")));
                case 11:
                    if (jSONObject == null) {
                        a(h5Var2, "vpaidEvent params cannot be null");
                        return false;
                    }
                    return this.c.a(jSONObject.getString(NotificationCompat.CATEGORY_EVENT));
                case '\f':
                    if (jSONObject == null) {
                        a(h5Var2, "playheadEvent params cannot be null");
                        return false;
                    }
                    return this.c.a((float) jSONObject.getDouble("remain"), (float) jSONObject.getDouble("duration"));
            }
            return true;
        }
    }

    @NonNull
    public final String b(Rect rect) {
        return rect.width() + "," + rect.height();
    }

    public final void b() {
        if (this.e) {
            return;
        }
        this.e = true;
        b bVar = this.c;
        if (bVar != null) {
            bVar.a(this, this.d.getWebView());
        }
    }

    public final void c(@NonNull String str) {
        a("mraidbridge.nativeComplete(" + JSONObject.quote(str) + ")");
    }

    public boolean c() {
        l5 l5Var = this.d;
        return l5Var != null && l5Var.h();
    }

    public void d() {
        a("mraidbridge.fireReadyEvent()");
    }

    public void d(String str) {
        a("mraidbridge.setPlacementType(" + JSONObject.quote(str) + ")");
    }

    public void e(String str) {
        a("mraidbridge.setState(" + JSONObject.quote(str) + ")");
    }

    public void f(@NonNull String str) {
        l5 l5Var = this.d;
        if (l5Var == null) {
            o9.a("MraidBridge: MRAID bridge called setContentHtml before WebView was attached");
            return;
        }
        this.e = false;
        l5Var.a("https://ad.mail.ru/", str, "text/html", "UTF-8", null);
    }
}