Wolves Themes v1.0版本的 MD5 值为:cddc92b47f6b7c4a195c9625507eb51c

以下内容为反编译后的 hp.java 源代码,内容仅作参考


package com.flurry.sdk;

import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.content.Context;
import android.net.NetworkInfo;
import android.net.Uri;
import android.view.View;
import android.webkit.JavascriptInterface;
import android.webkit.WebResourceRequest;
import android.webkit.WebResourceResponse;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.ProgressBar;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.net.URLConnection;
import java.util.Collections;
import java.util.HashMap;
import org.json.JSONException;
import org.json.JSONObject;
public final class hp extends FrameLayout {
    public static final String a = "hp";
    private static final String d = String.format("Javascript:sendMessage('%s');", "{{MESSAGE}}");
    public at b;
    public ProgressBar c;
    private hk e;
    private ImageView f;
    private d g;

    public interface b {
        void a();

        void a(String str);
    }

    public interface d {
        void a();
    }

    public hp(Context context) {
        super(context);
        setBackgroundColor(0);
        this.e = new hk(context);
        this.e.setVisibility(8);
        this.e.setWebViewClient(new WebViewClient() {
            private boolean b = false;

            @Override
            public final void onPageFinished(WebView webView, String str) {
                super.onPageFinished(webView, str);
                if (this.b) {
                    return;
                }
                this.b = true;
                hp.this.e.setVisibility(0);
                hp.this.f.setVisibility(0);
                if (hp.this.c != null) {
                    hp.this.c.setVisibility(8);
                }
            }

            @Override
            public final WebResourceResponse shouldInterceptRequest(WebView webView, String str) {
                return a(Uri.parse(str));
            }

            @Override
            @TargetApi(21)
            public final WebResourceResponse shouldInterceptRequest(WebView webView, WebResourceRequest webResourceRequest) {
                return a(webResourceRequest.getUrl());
            }

            @TargetApi(21)
            private static WebResourceResponse a(Uri uri) {
                String uri2 = uri.toString();
                File a2 = am.a().h.a(uri2);
                if (a2 == null || !a2.exists()) {
                    String str = hp.a;
                    kx.a(4, str, "No cached asset file found for url: " + uri2);
                } else {
                    try {
                        if (a2.length() == 0) {
                            String str2 = hp.a;
                            kx.a(5, str2, "Failed to load requested asset for url: " + uri2 + ". Cached file length: " + a2.length());
                            return null;
                        }
                        String guessContentTypeFromName = URLConnection.guessContentTypeFromName(uri.getPath());
                        FileInputStream fileInputStream = new FileInputStream(a2);
                        if (fh.a(21)) {
                            HashMap hashMap = new HashMap(1);
                            hashMap.put("Access-Control-Allow-Origin", "*");
                            return new WebResourceResponse(guessContentTypeFromName, "UTF-8", 200, "OK", hashMap, fileInputStream);
                        }
                        return new WebResourceResponse(guessContentTypeFromName, "UTF-8", fileInputStream);
                    } catch (FileNotFoundException e2) {
                        String str3 = hp.a;
                        kx.a(6, str3, "Error loading cached asset for url: " + uri2, e2);
                    }
                }
                return null;
            }
        });
        WebSettings settings = this.e.getSettings();
        settings.setSupportZoom(false);
        settings.setBuiltInZoomControls(false);
        settings.setUseWideViewPort(false);
        addView(this.e);
        int b2 = mg.b(30);
        int b3 = mg.b(7);
        FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(b2, b2);
        layoutParams.topMargin = b3;
        layoutParams.leftMargin = b3;
        this.f = new ImageView(context);
        this.f.setLayoutParams(layoutParams);
        this.f.setImageBitmap(hi.d());
        this.f.setBackgroundColor(0);
        this.f.setScaleType(ImageView.ScaleType.FIT_XY);
        this.f.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                hp.this.a();
            }
        });
        this.f.setVisibility(8);
        addView(this.f);
    }

    public final void setAdObject(at atVar) {
        this.b = atVar;
    }

    public final void setOnCloseListener(d dVar) {
        this.g = dVar;
    }

    @SuppressLint({"AddJavascriptInterface"})
    public final void a(String str, String str2) {
        String replace = "<!DOCTYPE html>\n<html>\n    <head>\n        <title></title>\n        <style>body {padding: 0;margin: 0;} html, body { height: 100%}</style>\n        <script>\n            function receiveMessage(event) {\n            FlurryNativeInterface.receiveMessage(JSON.stringify(event.data));\n            }\n            function sendMessage(msg) {\n                iframe = document.getElementById('adframe');\n                iframe.contentWindow.postMessage(JSON.parse(msg), '*');\n            }\n            window.addEventListener(\"message\", receiveMessage, false);\n            window.addEventListener(\"deviceorientation\", function (event) {\n                deviceTilt(event.gamma);\n            });\n\n            function deviceTilt(gamma) {\n                iframe = document.getElementById('adframe');\n                iframe.contentWindow.postMessage({\n                    topic: 'deviceTilt',\n                    data: {\n                        gamma: gamma\n                    }\n                }, '*');\n            }\n\n        </script>\n    </head>\n    <body>\n        <iframe id=\"adframe\" height=\"100%\" width=\"100%\" frameborder=\"0\" srcdoc=\"{{EMBED}}\"/>\n    </body>\n</html>".replace("{{EMBED}}", str.replace("{{SERVING_PAYLOAD_TOKEN}}", str2).replace("{{CSS_OVERRIDES_TOKEN}}", "").replace("\"", "&quot;"));
        this.e.addJavascriptInterface(new e(), "FlurryNativeInterface");
        this.e.loadDataWithBaseURL("http://www.yahoo.com", replace, "text/html", "UTF-8", null);
    }

    public class e {
        public e() {
        }

        @JavascriptInterface
        public final void receiveMessage(final String str) {
            String str2 = hp.a;
            kx.a(str2, "Received message: " + str);
            kh.a().a(new mk() {
                @Override
                public final void a() {
                    try {
                        JSONObject jSONObject = new JSONObject(str);
                        if (!jSONObject.has("topic")) {
                            kx.a(hp.a, "Received message with no topic");
                            return;
                        }
                        String string = jSONObject.getString("topic");
                        char c = 65535;
                        int hashCode = string.hashCode();
                        if (hashCode != -1096746670) {
                            if (hashCode != 44263811) {
                                if (hashCode != 94756344) {
                                    if (hashCode == 1800584395 && string.equals("internalClick")) {
                                        c = 0;
                                    }
                                } else if (string.equals("close")) {
                                    c = 2;
                                }
                            } else if (string.equals("tileRendered")) {
                                c = 3;
                            }
                        } else if (string.equals("setupRequest")) {
                            c = 1;
                        }
                        switch (c) {
                            case 0:
                                hp.a(hp.this, jSONObject.getJSONObject("data").getString("landingPageUrl"));
                                return;
                            case 1:
                                hp.e(hp.this);
                                return;
                            case 2:
                                hp.this.a();
                                return;
                            case 3:
                                hp.this.a(cj.EV_PAGE_LOAD_FINISHED);
                                return;
                            default:
                                kx.a(hp.a, "Received message with unknown topic");
                                return;
                        }
                    } catch (JSONException e) {
                        kx.a(hp.a, "Error parsing received message", e);
                    } catch (Exception e2) {
                        kx.a(hp.a, "Error processing received message", e2);
                    }
                }
            });
        }
    }

    @TargetApi(19)
    public final void a(String str, Object obj) {
        try {
            JSONObject jSONObject = new JSONObject();
            jSONObject.put("topic", str);
            if (obj != null) {
                jSONObject.put("data", obj);
            }
            String replace = d.replace("{{MESSAGE}}", jSONObject.toString());
            if (fh.a(19)) {
                this.e.evaluateJavascript(replace, null);
            } else {
                this.e.loadUrl(replace);
            }
            String str2 = a;
            kx.c(str2, "Sent message: " + replace);
        } catch (Exception e2) {
            kx.a(a, "Error sending message", e2);
        }
    }

    public final void a() {
        a(cj.EV_AD_CLOSED);
        if (this.g != null) {
            this.g.a();
        }
    }

    public void a(cj cjVar) {
        String str = a;
        kx.a(str, "Fired event: " + cjVar);
        ez.a(cjVar, Collections.emptyMap(), getContext(), this.b, this.b.h, 0);
    }

    public enum c {
        NONE("NONE"),
        WIFI("WIFI"),
        METERED_SLOW("METERED_SLOW"),
        METERED_FAST("METERED_FAST");
        
        private final String e;

        c(String str) {
            this.e = str;
        }

        @Override
        public final String toString() {
            return this.e;
        }
    }

    public static class a {
        private a() {
        }

        public a(byte b) {
            this();
        }
    }

    static void a(hp hpVar, String str) {
        fg.a(hpVar.getContext(), hpVar.b.b, str);
    }

    static void e(hp hpVar) {
        try {
            JSONObject jSONObject = new JSONObject();
            Context context = hpVar.getContext();
            c cVar = c.NONE;
            NetworkInfo a2 = com.flurry.sdk.e.a(context);
            if (a2 != null) {
                if (a2.getType() == 1) {
                    cVar = c.WIFI;
                } else {
                    switch (a2.getSubtype()) {
                        case 1:
                        case 2:
                        case 3:
                        case 4:
                        case 5:
                        case 6:
                        case 7:
                        case 8:
                        case 9:
                        case 10:
                        case 11:
                        case 12:
                        case 14:
                        case 15:
                            cVar = c.METERED_SLOW;
                            break;
                        case 13:
                            cVar = c.METERED_FAST;
                            break;
                        default:
                            cVar = c.METERED_SLOW;
                            break;
                    }
                }
            }
            jSONObject.put("showCloseButton", false);
            jSONObject.put("network", cVar);
            String str = "NONE";
            NetworkInfo a3 = com.flurry.sdk.e.a(hpVar.getContext());
            if (a3 != null) {
                if (a3.getType() != 1) {
                    int subtype = a3.getSubtype();
                    switch (subtype) {
                        case 1:
                            str = "GPRS";
                            break;
                        case 2:
                            str = "EDGE";
                            break;
                        case 3:
                            str = "UMTS";
                            break;
                        case 4:
                            str = "CDMA";
                            break;
                        case 5:
                            str = "CDMA - EvDo rev. 0";
                            break;
                        case 6:
                            str = "CDMA - EvDo rev. A";
                            break;
                        case 7:
                            str = "CDMA - 1xRTT";
                            break;
                        case 8:
                            str = "HSDPA";
                            break;
                        case 9:
                            str = "HSUPA";
                            break;
                        case 10:
                            str = "HSPA";
                            break;
                        case 11:
                            str = "iDEN";
                            break;
                        case 12:
                            str = "CDMA - EvDo rev. B";
                            break;
                        case 13:
                            str = "LTE";
                            break;
                        case 14:
                            str = "CDMA - eHRPD";
                            break;
                        case 15:
                            str = "HSPA+";
                            break;
                        default:
                            str = String.valueOf(subtype);
                            break;
                    }
                } else {
                    str = "WIFI";
                }
            }
            jSONObject.put("network_type", str);
            hpVar.a("setupResponse", jSONObject);
        } catch (JSONException e2) {
            kx.a(a, "Error creating SetupResponse JSONObject", e2);
        }
    }
}