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

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


package com.flurry.sdk;

import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Build;
import android.text.TextUtils;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.FrameLayout;
import android.widget.RelativeLayout;
import com.facebook.ads.AudienceNetworkActivity;
import com.flurry.android.AdCreative;
import com.flurry.sdk.ha;
import com.flurry.sdk.hb;
import com.flurry.sdk.le;
import com.ironsource.mediationsdk.utils.IronSourceConstants;
import java.io.File;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
@SuppressLint({"SetJavaScriptEnabled", "ViewConstructor"})
public class gz extends ha implements DialogInterface.OnKeyListener {
    private boolean A;
    private ha.a B;
    String a;
    kr<hb> b;
    private final String c;
    private gg d;
    private boolean e;
    private hm f;
    private int g;
    private boolean h;
    private WebViewClient i;
    private WebChromeClient j;
    private hr k;
    private View l;
    private int m;
    private WebChromeClient.CustomViewCallback n;
    private Dialog o;
    private FrameLayout p;
    private int q;
    private Dialog r;
    private FrameLayout s;
    private boolean t;
    private boolean u;
    private boolean v;
    private boolean w;
    private boolean x;
    private AlertDialog y;
    private dc z;

    static gg c(gz gzVar) {
        gzVar.d = null;
        return null;
    }

    static AlertDialog h(gz gzVar) {
        gzVar.y = null;
        return null;
    }

    static boolean i(gz gzVar) {
        gzVar.w = true;
        return true;
    }

    static class AnonymousClass8 {
        static final int[] a = new int[hb.a.a().length];

        static {
            try {
                a[hb.a.a - 1] = 1;
            } catch (NoSuchFieldError unused) {
            }
            try {
                a[hb.a.b - 1] = 2;
            } catch (NoSuchFieldError unused2) {
            }
            try {
                a[hb.a.d - 1] = 3;
            } catch (NoSuchFieldError unused3) {
            }
            try {
                a[hb.a.c - 1] = 4;
            } catch (NoSuchFieldError unused4) {
            }
            try {
                a[hb.a.e - 1] = 5;
            } catch (NoSuchFieldError unused5) {
            }
        }
    }

    public gz(Context context, aw awVar, ha.a aVar) {
        super(context, awVar, aVar);
        this.c = gz.class.getSimpleName();
        this.a = null;
        this.x = false;
        this.B = new ha.a() {
            @Override
            public final void a() {
                if (gz.this.getCurrentBinding() != 3 || gz.this.d == null) {
                    return;
                }
                if (gz.this.isViewAttachedToActivity() && gz.this.a((View) gz.this.d)) {
                    gz.this.removeView(gz.this.d);
                }
                gz.this.d.cleanupLayout();
                gz.c(gz.this);
            }

            @Override
            public final void b() {
                if (gz.this.getCurrentBinding() != 3 || gz.this.d == null) {
                    return;
                }
                if (gz.this.isViewAttachedToActivity() && gz.this.a((View) gz.this.d)) {
                    gz.this.removeView(gz.this.d);
                }
                gz.this.d.cleanupLayout();
                gz.c(gz.this);
            }

            @Override
            public final void c() {
                if (gz.this.getCurrentBinding() != 3 || gz.this.d == null) {
                    return;
                }
                gz.this.d.cleanupLayout();
                gz.c(gz.this);
            }
        };
        this.b = new kr<hb>() {
            @Override
            public final void a(hb hbVar) {
                final hb hbVar2 = hbVar;
                kh.a().a(new Runnable() {
                    @Override
                    public final void run() {
                        switch (AnonymousClass8.a[hbVar2.a - 1]) {
                            case 1:
                                gz.a(gz.this, hbVar2);
                                return;
                            case 2:
                                gz.d(gz.this);
                                return;
                            case 3:
                                gz.a(gz.this, hbVar2.b);
                                return;
                            case 4:
                                gz.b(gz.this, hbVar2.b);
                                return;
                            case 5:
                                gz.this.c(hbVar2.b.c.a.an);
                                return;
                            default:
                                return;
                        }
                    }
                });
            }
        };
        setClickable(true);
        if (getContext() instanceof Activity) {
            this.g = ((Activity) getContext()).getRequestedOrientation();
        }
        if (getAdUnit() != null) {
            this.v = getAdUnit().u;
        } else {
            kx.a(3, this.c, "adunit is Null");
        }
        setBackgroundColor(-16777216);
    }

    public final void a(cj cjVar, Map<String, String> map, bz bzVar, int i) {
        String str = this.c;
        kx.a(3, str, "fireEvent(event=" + cjVar + ",params=" + map + ")");
        ez.a(cjVar, map, getContext(), getAdObject(), bzVar, i);
    }

    public boolean a() {
        return getCurrentFormat().equals(AdCreative.kFormatTakeover);
    }

    private String getCurrentFormat() {
        return getCurrentAdFrame().d.d;
    }

    private dd getCurrentAdFrame() {
        return getAdController().c();
    }

    public synchronized void b() {
        if (!c()) {
            kx.a(3, this.c, "initializeFlurryJsEnv");
            if (this.f != null) {
                this.f.loadUrl("javascript:(function() {var Hogan={};(function(Hogan,useArrayBuffer){Hogan.Template=function(renderFunc,text,compiler,options){this.r=renderFunc||this.r;this.c=compiler;this.options=options;this.text=text||\"\";this.buf=useArrayBuffer?[]:\"\"};Hogan.Template.prototype={r:function(context,partials,indent){return\"\"},v:hoganEscape,t:coerceToString,render:function render(context,partials,indent){return this.ri([context],partials||{},indent)},ri:function(context,partials,indent){return this.r(context,partials,indent)},rp:function(name,context,partials,indent){var partial=partials[name];if(!partial){return\"\"}if(this.c&&typeof partial==\"string\"){partial=this.c.compile(partial,this.options)}return partial.ri(context,partials,indent)},rs:function(context,partials,section){var tail=context[context.length-1];if(!isArray(tail)){section(context,partials,this);return}for(var i=0;i<tail.length;i++){context.push(tail[i]);section(context,partials,this);context.pop()}},s:function(val,ctx,partials,inverted,start,end,tags){var pass;if(isArray(val)&&val.length===0){return false}if(typeof val==\"function\"){val=this.ls(val,ctx,partials,inverted,start,end,tags)}pass=(val===\"\")||!!val;if(!inverted&&pass&&ctx){ctx.push((typeof val==\"object\")?val:ctx[ctx.length-1])}return pass},d:function(key,ctx,partials,returnFound){var names=key.split(\".\"),val=this.f(names[0],ctx,partials,returnFound),cx=null;if(key===\".\"&&isArray(ctx[ctx.length-2])){return ctx[ctx.length-1]}for(var i=1;i<names.length;i++){if(val&&typeof val==\"object\"&&names[i] in val){cx=val;val=val[names[i]]}else{val=\"\"}}if(returnFound&&!val){return false}if(!returnFound&&typeof val==\"function\"){ctx.push(cx);val=this.lv(val,ctx,partials);ctx.pop()}return val},f:function(key,ctx,partials,returnFound){var val=false,v=null,found=false;for(var i=ctx.length-1;i>=0;i--){v=ctx[i];if(v&&typeof v==\"object\"&&key in v){val=v[key];found=true;break}}if(!found){return(returnFound)?false:\"\"}if(!returnFound&&typeof val==\"function\"){val=this.lv(val,ctx,partials)}return val},ho:function(val,cx,partials,text,tags){var compiler=this.c;var options=this.options;options.delimiters=tags;var text=val.call(cx,text);text=(text==null)?String(text):text.toString();this.b(compiler.compile(text,options).render(cx,partials));return false},b:(useArrayBuffer)?function(s){this.buf.push(s)}:function(s){this.buf+=s},fl:(useArrayBuffer)?function(){var r=this.buf.join(\"\");this.buf=[];return r}:function(){var r=this.buf;this.buf=\"\";return r},ls:function(val,ctx,partials,inverted,start,end,tags){var cx=ctx[ctx.length-1],t=null;if(!inverted&&this.c&&val.length>0){return this.ho(val,cx,partials,this.text.substring(start,end),tags)}t=val.call(cx);if(typeof t==\"function\"){if(inverted){return true}else{if(this.c){return this.ho(t,cx,partials,this.text.substring(start,end),tags)}}}return t},lv:function(val,ctx,partials){var cx=ctx[ctx.length-1];var result=val.call(cx);if(typeof result==\"function\"){result=coerceToString(result.call(cx));if(this.c&&~result.indexOf(\"{\\u007B\")){return this.c.compile(result,this.options).render(cx,partials)}}return coerceToString(result)}};var rAmp=/&/g,rLt=/</g,rGt=/>/g,rApos=/\\'/g,rQuot=/\\\"/g,hChars=/[&<>\\\"\\']/;function coerceToString(val){return String((val===null||val===undefined)?\"\":val)}function hoganEscape(str){str=coerceToString(str);return hChars.test(str)?str.replace(rAmp,\"&amp;\").replace(rLt,\"&lt;\").replace(rGt,\"&gt;\").replace(rApos,\"&#39;\").replace(rQuot,\"&quot;\"):str}var isArray=Array.isArray||function(a){return Object.prototype.toString.call(a)===\"[object Array]\"}})(typeof exports!==\"undefined\"?exports:Hogan);(function(Hogan){var rIsWhitespace=/\\S/,rQuot=/\\\"/g,rNewline=/\\n/g,rCr=/\\r/g,rSlash=/\\\\/g,tagTypes={\"#\":1,\"^\":2,\"/\":3,\"!\":4,\">\":5,\"<\":6,\"=\":7,_v:8,\"{\":9,\"&\":10};Hogan.scan=function scan(text,delimiters){var len=text.length,IN_TEXT=0,IN_TAG_TYPE=1,IN_TAG=2,state=IN_TEXT,tagType=null,tag=null,buf=\"\",tokens=[],seenTag=false,i=0,lineStart=0,otag=\"{{\",ctag=\"}}\";function addBuf(){if(buf.length>0){tokens.push(new String(buf));buf=\"\"}}function lineIsWhitespace(){var isAllWhitespace=true;for(var j=lineStart;j<tokens.length;j++){isAllWhitespace=(tokens[j].tag&&tagTypes[tokens[j].tag]<tagTypes._v)||(!tokens[j].tag&&tokens[j].match(rIsWhitespace)===null);if(!isAllWhitespace){return false}}return isAllWhitespace}function filterLine(haveSeenTag,noNewLine){addBuf();if(haveSeenTag&&lineIsWhitespace()){for(var j=lineStart,next;j<tokens.length;j++){if(!tokens[j].tag){if((next=tokens[j+1])&&next.tag==\">\"){next.indent=tokens[j].toString()}tokens.splice(j,1)}}}else{if(!noNewLine){tokens.push({tag:\"\\n\"})}}seenTag=false;lineStart=tokens.length}function changeDelimiters(text,index){var close=\"=\"+ctag,closeIndex=text.indexOf(close,index),delimiters=trim(text.substring(text.indexOf(\"=\",index)+1,closeIndex)).split(\" \");otag=delimiters[0];ctag=delimiters[1];return closeIndex+close.length-1}if(delimiters){delimiters=delimiters.split(\" \");otag=delimiters[0];ctag=delimiters[1]}for(i=0;i<len;i++){if(state==IN_TEXT){if(tagChange(otag,text,i)){--i;addBuf();state=IN_TAG_TYPE}else{if(text.charAt(i)==\"\\n\"){filterLine(seenTag)}else{buf+=text.charAt(i)}}}else{if(state==IN_TAG_TYPE){i+=otag.length-1;tag=tagTypes[text.charAt(i+1)];tagType=tag?text.charAt(i+1):\"_v\";if(tagType==\"=\"){i=changeDelimiters(text,i);state=IN_TEXT}else{if(tag){i++}state=IN_TAG}seenTag=i}else{if(tagChange(ctag,text,i)){tokens.push({tag:tagType,n:trim(buf),otag:otag,ctag:ctag,i:(tagType==\"/\")?seenTag-ctag.length:i+otag.length});buf=\"\";i+=ctag.length-1;state=IN_TEXT;if(tagType==\"{\"){if(ctag==\"}}\"){i++}else{cleanTripleStache(tokens[tokens.length-1])}}}else{buf+=text.charAt(i)}}}}filterLine(seenTag,true);return tokens};function cleanTripleStache(token){if(token.n.substr(token.n.length-1)===\"}\"){token.n=token.n.substring(0,token.n.length-1)}}function trim(s){if(s.trim){return s.trim()}return s.replace(/^\\s*|\\s*$/g,\"\")}function tagChange(tag,text,index){if(text.charAt(index)!=tag.charAt(0)){return false}for(var i=1,l=tag.length;i<l;i++){if(text.charAt(index+i)!=tag.charAt(i)){return false}}return true}function buildTree(tokens,kind,stack,customTags){var instructions=[],opener=null,token=null;while(tokens.length>0){token=tokens.shift();if(token.tag==\"#\"||token.tag==\"^\"||isOpener(token,customTags)){stack.push(token);token.nodes=buildTree(tokens,token.tag,stack,customTags);instructions.push(token)}else{if(token.tag==\"/\"){if(stack.length===0){throw new Error(\"Closing tag without opener: /\"+token.n)}opener=stack.pop();if(token.n!=opener.n&&!isCloser(token.n,opener.n,customTags)){throw new Error(\"Nesting error: \"+opener.n+\" vs. \"+token.n)}opener.end=token.i;return instructions}else{instructions.push(token)}}}if(stack.length>0){throw new Error(\"missing closing tag: \"+stack.pop().n)}return instructions}function isOpener(token,tags){for(var i=0,l=tags.length;i<l;i++){if(tags[i].o==token.n){token.tag=\"#\";return true}}}function isCloser(close,open,tags){for(var i=0,l=tags.length;i<l;i++){if(tags[i].c==close&&tags[i].o==open){return true}}}Hogan.generate=function(tree,text,options){var code='var _=this;_.b(i=i||\"\");'+walk(tree)+\"return _.fl();\";if(options.asString){return\"function(c,p,i){\"+code+\";}\"}return new Hogan.Template(new Function(\"c\",\"p\",\"i\",code),text,Hogan,options)};function esc(s){return s.replace(rSlash,\"\\\\\\\\\").replace(rQuot,'\\\\\"').replace(rNewline,\"\\\\n\").replace(rCr,\"\\\\r\")}function chooseMethod(s){return(~s.indexOf(\".\"))?\"d\":\"f\"}function walk(tree){var code=\"\";for(var i=0,l=tree.length;i<l;i++){var tag=tree[i].tag;if(tag==\"#\"){code+=section(tree[i].nodes,tree[i].n,chooseMethod(tree[i].n),tree[i].i,tree[i].end,tree[i].otag+\" \"+tree[i].ctag)}else{if(tag==\"^\"){code+=invertedSection(tree[i].nodes,tree[i].n,chooseMethod(tree[i].n))}else{if(tag==\"<\"||tag==\">\"){code+=partial(tree[i])}else{if(tag==\"{\"||tag==\"&\"){code+=tripleStache(tree[i].n,chooseMethod(tree[i].n))}else{if(tag==\"\\n\"){code+=text('\"\\\\n\"'+(tree.length-1==i?\"\":\" + i\"))}else{if(tag==\"_v\"){code+=variable(tree[i].n,chooseMethod(tree[i].n))}else{if(tag===undefined){code+=text('\"'+esc(tree[i])+'\"')}}}}}}}}return code}function section(nodes,id,method,start,end,tags){return\"if(_.s(_.\"+method+'(\"'+esc(id)+'\",c,p,1),c,p,0,'+start+\",\"+end+',\"'+tags+'\")){_.rs(c,p,function(c,p,_){'+walk(nodes)+\"});c.pop();}\"}function invertedSection(nodes,id,method){return\"if(!_.s(_.\"+method+'(\"'+esc(id)+'\",c,p,1),c,p,1,0,0,\"\")){'+walk(nodes)+\"};\"}function partial(tok){return'_.b(_.rp(\"'+esc(tok.n)+'\",c,p,\"'+(tok.indent||\"\")+'\"));'}function tripleStache(id,method){return\"_.b(_.t(_.\"+method+'(\"'+esc(id)+'\",c,p,0)));'}function variable(id,method){return\"_.b(_.v(_.\"+method+'(\"'+esc(id)+'\",c,p,0)));'}function text(id){return\"_.b(\"+id+\");\"}Hogan.parse=function(tokens,text,options){options=options||{};return buildTree(tokens,\"\",[],options.sectionTags||[])},Hogan.cache={};Hogan.compile=function(text,options){options=options||{};var key=text+\"||\"+!!options.asString;var t=this.cache[key];if(t){return t}t=this.generate(this.parse(this.scan(text,options.delimiters),text,options),text,options);return this.cache[key]=t}})(typeof exports!==\"undefined\"?exports:Hogan);var flurryBridgeCtor=function(w){var flurryadapter={};flurryadapter.flurryCallQueue=[];flurryadapter.flurryCallInProgress=false;flurryadapter.callComplete=function(cmd){if(cmd.length > 0){try{if(window.mraid){ mraid.flurryBridgeListenerEvent(cmd);}}catch(error){ }} if(this.flurryCallQueue.length==0){this.flurryCallInProgress=false;return}var adapterCall=this.flurryCallQueue.splice(0,1)[0];this.executeNativeCall(adapterCall);return\"OK\"};flurryadapter.executeCall=function(command){var adapterCall=\"flurry://flurrycall?event=\"+command;var value;for(var i=1;i<arguments.length;i+=2){value=arguments[i+1];if(value==null)continue;adapterCall+=\"&\"+arguments[i]+\"=\"+escape(value)}if(this.flurryCallInProgress)this.flurryCallQueue.push(adapterCall);else this.executeNativeCall(adapterCall)};flurryadapter.executeNativeCall=function(adapterCall){if(adapterCall.length==0)return;this.flurryCallInProgress=true;w.location=adapterCall};return flurryadapter};window.Hogan=Hogan;window.flurryadapter=flurryBridgeCtor(window);window.flurryAdapterAvailable=true;if(typeof window.FlurryAdapterReady === 'function'){window.FlurryAdapterReady();}})();");
            }
            setFlurryJsEnvInitialized(true);
        }
    }

    private synchronized boolean c() {
        return this.h;
    }

    private synchronized void setFlurryJsEnvInitialized(boolean z) {
        this.h = z;
    }

    public synchronized void d() {
        setFlurryJsEnvInitialized(false);
    }

    private String getCurrentContent() {
        return getCurrentAdFrame().c;
    }

    @Override
    @SuppressLint({"InlinedApi"})
    public void initLayout() {
        String str;
        String str2 = this.c;
        kx.a(3, str2, "initLayout: ad creative layout: {width = " + getCurrentAdFrame().d.a + ", height = " + getCurrentAdFrame().d.b + ", adFrameIndex = " + getAdController().c.e + ", context = " + getContext() + "}");
        cleanupLayout();
        ks.a().a("com.flurry.android.impl.ads.views.AdViewEvent", this.b);
        Context context = getContext();
        removeAllViews();
        setFocusable(true);
        setFocusableInTouchMode(true);
        requestLayout();
        switch (getCurrentBinding()) {
            case 1:
                if (this.f == null) {
                    getWebViewFactory().a();
                    hr webViewFactory = getWebViewFactory();
                    getAdObject();
                    webViewFactory.a(context, getCurrentAdFrame());
                    this.f = getWebViewFactory().c();
                    this.f.getSettings().setJavaScriptEnabled(true);
                    if (Build.VERSION.SDK_INT >= 21) {
                        this.f.getSettings().setMixedContentMode(0);
                    }
                    this.f.setVerticalScrollBarEnabled(false);
                    this.f.setHorizontalScrollBarEnabled(false);
                    this.f.setBackgroundColor(0);
                    this.f.clearCache(false);
                    this.j = new a(this, (byte) 0);
                    this.f.setWebChromeClient(this.j);
                    this.i = new b(this, (byte) 0);
                    this.f.setWebViewClient(this.i);
                }
                if (this.a != null) {
                    b(this.a);
                } else if (getAdFrameIndex() == 0 && (str = getAdController().c.i) != null) {
                    String c = mn.c(getCurrentDisplay());
                    this.f.loadDataWithBaseURL(c, str, "text/html", AudienceNetworkActivity.WEBVIEW_ENCODING, c);
                    if (getAdController().a(cj.EV_RENDERED.an)) {
                        a(cj.EV_RENDERED, Collections.emptyMap(), getAdController(), 0);
                        getAdController().b(cj.EV_RENDERED.an);
                    }
                    if (this.u) {
                        c("adLoadComplete");
                    }
                } else {
                    b(getCurrentDisplay());
                }
                this.f.setLayoutParams(new RelativeLayout.LayoutParams(-1, -1));
                dismissProgressDialog();
                if (a()) {
                    showProgressDialog();
                }
                e();
                return;
            case 2:
                fl b2 = getAdController().b(getAdFrameIndex());
                if (b2 != null) {
                    a(b2.a(), gi.a);
                    return;
                }
                if (this.f == null) {
                    getWebViewFactory().a();
                    hr webViewFactory2 = getWebViewFactory();
                    getAdObject();
                    webViewFactory2.a(context, getCurrentAdFrame());
                    this.f = getWebViewFactory().c();
                    this.f.getSettings().setJavaScriptEnabled(true);
                    if (Build.VERSION.SDK_INT >= 21) {
                        this.f.getSettings().setMixedContentMode(0);
                    }
                    this.f.getSettings().setLoadWithOverviewMode(true);
                    this.f.setVerticalScrollBarEnabled(false);
                    this.f.setHorizontalScrollBarEnabled(false);
                    this.f.setBackgroundColor(0);
                    this.f.clearCache(false);
                    this.j = new a(this, (byte) 0);
                    this.f.setWebChromeClient(this.j);
                    this.i = new b(this, (byte) 0);
                    this.f.setWebViewClient(this.i);
                }
                this.f.loadDataWithBaseURL("base://url/", getCurrentDisplay(), "text/html", AudienceNetworkActivity.WEBVIEW_ENCODING, "base://url/");
                if (getAdController().a(cj.EV_RENDERED.an)) {
                    a(cj.EV_RENDERED, Collections.emptyMap(), getAdController(), 0);
                    getAdController().b(cj.EV_RENDERED.an);
                }
                if (this.u) {
                    c("adLoadComplete");
                }
                this.f.setLayoutParams(new RelativeLayout.LayoutParams(-1, -1));
                dismissProgressDialog();
                if (a()) {
                    showProgressDialog();
                }
                e();
                return;
            case 3:
                a(getCurrentDisplay(), gi.c);
                return;
            default:
                HashMap hashMap = new HashMap();
                hashMap.put(IronSourceConstants.ERROR_CODE_KEY, Integer.toString(ci.kInvalidAdUnit.z));
                a(cj.EV_RENDER_FAILED, hashMap, getAdController(), 0);
                return;
        }
    }

    @Override
    public void cleanupLayout() {
        if (this.d != null) {
            this.d.cleanupLayout();
            this.d = null;
        }
        ks.a().a(this.b);
    }

    @Override
    public void onViewLoadTimeout() {
        HashMap hashMap = new HashMap();
        hashMap.put(IronSourceConstants.ERROR_CODE_KEY, Integer.toString(ci.kNoNetworkConnectivity.z));
        ez.a(cj.EV_AD_WILL_CLOSE, hashMap, getContext(), getAdObject(), getAdController(), 0);
    }

    @Override
    @TargetApi(11)
    public void onActivityResume() {
        ks.a().a("com.flurry.android.impl.ads.views.AdViewEvent", this.b);
        if (this.f != null) {
            this.e = true;
            this.f.onResume();
        }
        if (this.d != null) {
            this.d.onActivityResume();
        }
        if (this.d != null) {
            this.e = true;
        }
    }

    @Override
    @TargetApi(11)
    public void onActivityPause() {
        if (this.f != null) {
            this.f.onPause();
        }
        if (this.d != null) {
            this.d.onActivityPause();
        }
        this.e = false;
    }

    @Override
    @TargetApi(11)
    public void onActivityStop() {
        if (this.y != null && this.y.isShowing()) {
            this.y.dismiss();
            this.y = null;
        }
        if (this.d != null) {
            this.d.onActivityStop();
        }
        dismissProgressDialog();
    }

    @Override
    @TargetApi(11)
    public void onActivityDestroy() {
        kx.a(3, this.c, "onDestroy");
        if (this.y != null && this.y.isShowing()) {
            this.y.dismiss();
            this.y = null;
        }
        dismissProgressDialog();
        if (this.d != null) {
            this.d.onActivityDestroy();
        }
        if (this.f != null) {
            if (this.j != null) {
                this.j.onHideCustomView();
            }
            if (this.r != null) {
                a(0, 0);
            }
            this.x = false;
            cleanupLayout();
            removeView(this.f);
            this.f.stopLoading();
            this.f.onPause();
            this.f.destroy();
            this.f = null;
            getWebViewFactory().a();
            this.k = null;
        }
    }

    @Override
    public boolean onBackKey() {
        a(cj.EV_AD_WILL_CLOSE, Collections.emptyMap(), getAdController(), 0);
        return true;
    }

    private void a(int i, int i2) {
        if (!(getContext() instanceof Activity)) {
            kx.a(3, this.c, "no activity present");
            return;
        }
        Activity activity = (Activity) getContext();
        am.a().b.b(getContext());
        if (this.r == null) {
            return;
        }
        String str = this.c;
        kx.a(3, str, "collapse(" + i + "," + i2 + ")");
        if (this.r != null && this.r.isShowing()) {
            this.r.hide();
            this.r.setOnDismissListener(null);
            this.r.dismiss();
        }
        this.r = null;
        ex.a(activity, this.q);
        if (this.s != null) {
            if (this.f != null && -1 != this.s.indexOfChild(this.f)) {
                this.s.removeView(this.f);
            }
            this.s = null;
        }
        if (this.f == null || this.f.getParent() != null) {
            return;
        }
        addView(this.f);
    }

    public hr getWebViewFactory() {
        if (this.k == null) {
            this.k = new hr();
            kx.e("WebViewFactory:", "Created new WebViewFactory: " + this.k);
            return this.k;
        }
        return this.k;
    }

    private void a(String str, int i) {
        if (str == null) {
            return;
        }
        Context context = getContext();
        if (this.d == null) {
            this.d = gh.a(context, i, getAdObject(), this.B);
            this.d.setVideoUri(a(str));
            this.d.setLayoutParams(new RelativeLayout.LayoutParams(-1, -1));
            this.d.initLayout();
        }
        addView(this.d);
    }

    private Uri a(String str) {
        Uri uri = null;
        try {
            String str2 = this.c;
            kx.a(3, str2, "Precaching: Getting video from cache: " + str);
            File a2 = am.a().h.a(str);
            if (a2 != null) {
                uri = Uri.parse("file://" + a2.getAbsolutePath());
            }
        } catch (Exception e) {
            kx.a(3, this.c, "Precaching: Error accessing cached file.", e);
        }
        if (uri == null) {
            String str3 = this.c;
            kx.a(3, str3, "Precaching: Error using cached file. Loading with url: " + str);
            return Uri.parse(str);
        }
        return uri;
    }

    private void b(final String str) {
        le leVar = new le();
        leVar.g = str;
        leVar.u = 10000;
        leVar.d = new lt();
        leVar.a = new le.a<Void, String>() {
            @Override
            public final void a(le<Void, String> leVar2, String str2) {
                final String str3 = str2;
                int i = leVar2.q;
                String str4 = gz.this.c;
                kx.a(3, str4, "Prerender: HTTP status code is:" + i + " for url: " + str);
                if (leVar2.b()) {
                    final String c = mn.c(str);
                    if (gz.this.getAdController().a(cj.EV_RENDERED.an)) {
                        gz.this.a(cj.EV_RENDERED, Collections.emptyMap(), gz.this.getAdController(), 0);
                        gz.this.getAdController().b(cj.EV_RENDERED.an);
                    }
                    kh.a().a(new mk() {
                        @Override
                        public final void a() {
                            if (gz.this.f != null) {
                                gz.this.f.loadDataWithBaseURL(c, str3, "text/html", AudienceNetworkActivity.WEBVIEW_ENCODING, c);
                            }
                        }
                    });
                    return;
                }
                kh.a().a(new mk() {
                    @Override
                    public final void a() {
                        HashMap hashMap = new HashMap();
                        hashMap.put(IronSourceConstants.ERROR_CODE_KEY, Integer.toString(ci.kPrerenderDownloadFailed.z));
                        gz.this.a(cj.EV_RENDER_FAILED, hashMap, gz.this.getAdController(), 0);
                    }
                });
            }
        };
        kd.a().a((Object) this, (gz) leVar);
    }

    public void c(String str) {
        if (this.f != null) {
            String str2 = this.c;
            kx.a(3, str2, "Callcomplete " + str);
            hm hmVar = this.f;
            hmVar.loadUrl("javascript:flurryadapter.callComplete('" + str + "');");
        }
    }

    public int getCurrentBinding() {
        return getCurrentAdFrame().a;
    }

    private String getCurrentDisplay() {
        return getCurrentAdFrame().b;
    }

    final boolean a(View view) {
        ViewParent parent = view.getParent();
        return parent != null && parent == this;
    }

    private void e() {
        int a2;
        if (getContext() instanceof Activity) {
            Activity activity = (Activity) getContext();
            if (!a() || -1 == (a2 = ex.a(activity, getAdUnit().y))) {
                return;
            }
            ex.b(activity, a2);
        }
    }

    public void setMraidButtonVisibility(boolean z) {
        if (this.z != null) {
            if (z) {
                this.z.setVisibility(0);
            } else {
                this.z.setVisibility(4);
            }
        }
    }

    public class b extends WebViewClient {
        private b() {
        }

        b(gz gzVar, byte b) {
            this();
        }

        @Override
        public final boolean shouldOverrideUrlLoading(WebView webView, String str) {
            String str2;
            Uri parse;
            boolean z;
            kx.a(3, gz.this.c, "shouldOverrideUrlLoading: url = " + str);
            if (str == null || webView == null || webView != gz.this.f) {
                return false;
            }
            String c = mn.c(gz.this.f.getUrl());
            if (!TextUtils.isEmpty(c) && str.startsWith(c)) {
                String substring = str.substring(c.length());
                Uri parse2 = Uri.parse(substring);
                if (parse2.isHierarchical() && !TextUtils.isEmpty(parse2.getScheme()) && !TextUtils.isEmpty(parse2.getAuthority())) {
                    kx.a(3, gz.this.c, "shouldOverrideUrlLoading: target url = " + substring);
                    str2 = substring;
                    parse = Uri.parse(str2);
                    kx.a(3, gz.this.c, "shouldOverrideUrlLoading: getScheme = " + parse.getScheme());
                    if (!"flurry".equals(parse.getScheme())) {
                        String queryParameter = parse.getQueryParameter("event");
                        kx.a(3, gz.this.c, "event is " + queryParameter);
                        if (!TextUtils.isEmpty(queryParameter)) {
                            cj a = ae.a(queryParameter);
                            if (a.equals(cj.EV_AD_LISTENER_ADDED)) {
                                gz.i(gz.this);
                                if (gz.this.a()) {
                                    gz.k(gz.this);
                                    gz.l(gz.this);
                                }
                            }
                            hm c2 = gz.this.getWebViewFactory().c();
                            if (a.equals(cj.EV_AD_LISTENER_ADDED)) {
                                if (!(c2.getContext() instanceof Activity)) {
                                    kx.a(3, c2.a, "no activity present");
                                } else {
                                    Activity activity = (Activity) c2.getContext();
                                    if (c2.a()) {
                                        ex.b(activity, ex.a());
                                    }
                                }
                            }
                            gz gzVar = gz.this;
                            if (a.equals(cj.EV_MRAID_CLOSE_BUTTON_VISIBLE)) {
                                String queryParameter2 = parse.getQueryParameter("useCustomClose");
                                if (!TextUtils.isEmpty(queryParameter2) && queryParameter2.equals("true")) {
                                    gzVar.setMraidButtonVisibility(false);
                                } else {
                                    gzVar.setMraidButtonVisibility(true);
                                }
                            }
                            Map<String, String> g = mi.g(parse.getEncodedQuery());
                            g.put("requiresCallComplete", "true");
                            gz.this.a(a, g, gz.this.getAdController(), 0);
                        }
                        return true;
                    }
                    gz.this.a(cj.EV_CLICKED, Collections.emptyMap(), gz.this.getAdController(), 0);
                    if (!gz.this.getAdController().d()) {
                        kx.a(3, gz.this.c, "shouldOverrideUrlLoading: doGenericLaunch ");
                        am.a();
                        am.e().a(gz.this.getContext(), str2, true, gz.this.getAdObject(), true);
                    } else {
                        if (mn.d(str2)) {
                            kx.a(3, gz.this.c, "shouldOverrideUrlLoading: isMarketUrl ");
                            z = fg.a(gz.this.getContext(), str2);
                        } else {
                            z = false;
                        }
                        if (!z && mn.e(str2)) {
                            kx.a(3, gz.this.c, "shouldOverrideUrlLoading: isGooglePlayUrl ");
                            z = fg.b(gz.this.getContext(), str2);
                        }
                        if (!z) {
                            kx.a(3, gz.this.c, "shouldOverrideUrlLoading: loadUrl doGenericLaunch ");
                            am.a();
                            am.e().a(gz.this.getContext(), str2, true, gz.this.getAdObject(), true);
                        } else {
                            gz.this.a(cj.INTERNAL_EV_APP_EXIT, Collections.emptyMap(), gz.this.getAdController(), 0);
                        }
                    }
                    return true;
                }
            }
            str2 = str;
            parse = Uri.parse(str2);
            kx.a(3, gz.this.c, "shouldOverrideUrlLoading: getScheme = " + parse.getScheme());
            if (!"flurry".equals(parse.getScheme())) {
            }
        }

        @Override
        public final void onPageStarted(WebView webView, String str, Bitmap bitmap) {
            String str2 = gz.this.c;
            kx.a(3, str2, "onPageStarted: url = " + str);
            if (str == null || webView == null || webView != gz.this.f) {
                return;
            }
            gz.this.d();
            gz.this.getWebViewFactory().c().c();
            gz.this.t = false;
            gz.this.u = false;
        }

        @Override
        public final void onPageFinished(WebView webView, String str) {
            String str2 = gz.this.c;
            kx.a(3, str2, "onPageFinished: url = " + str + " adcontroller index: " + gz.this.getAdController().c.e);
            if (str == null || webView == null || webView != gz.this.f) {
                return;
            }
            gz.this.b();
            gz.p(gz.this);
            gz.this.dismissProgressDialog();
            if (!gz.this.a(gz.this.f) && (gz.this.getCurrentBinding() == 2 || gz.this.getCurrentBinding() == 1)) {
                kx.a(3, gz.this.c, "adding WebView to AdUnityView");
                if (((ViewGroup) webView.getParent()) == null) {
                    gz.this.addView(gz.this.f);
                    gz.this.getWebViewFactory().c().d();
                }
            }
            gz.this.t = true;
            if (gz.this.v) {
                if (gz.this.u) {
                    gz.this.getWebViewFactory().c().d();
                }
            } else if (gz.this.u) {
                cj a = ae.a("mraidAdNotSupported");
                hm c = gz.this.getWebViewFactory().c();
                if (a.equals(cj.EV_MRAID_NOT_SUPPORTED)) {
                    c.loadUrl("javascript:if(window.mraid && typeof window.mraid.disable === 'function'){window.mraid.disable();}");
                }
                gz.this.a(a, new HashMap(), gz.this.getAdController(), 0);
                if (gz.this.a() && gz.this.getCurrentBinding() == 2 && !gz.this.A) {
                    gz.this.getWebViewFactory().b();
                }
            }
        }

        @Override
        public final void onLoadResource(WebView webView, String str) {
            String str2 = gz.this.c;
            kx.a(3, str2, "onLoadResource: url = " + str);
            super.onLoadResource(webView, str);
            if (str == null || webView == null || webView != gz.this.f) {
                return;
            }
            if (!str.equalsIgnoreCase(gz.this.f.getUrl())) {
                gz.this.b();
            }
            if (gz.this.u || Uri.parse(str).getLastPathSegment() == null) {
                return;
            }
            if (gz.this.v) {
                gz.this.u = true;
                gz.this.getWebViewFactory().c().b();
                if (gz.this.t) {
                    gz.this.getWebViewFactory().c().d();
                }
            } else if (gz.this.t && gz.this.a() && gz.this.getCurrentBinding() == 2 && !gz.this.A) {
                gz.this.getWebViewFactory().b();
            }
        }

        @Override
        public final void onReceivedError(WebView webView, int i, String str, String str2) {
            String str3 = gz.this.c;
            kx.a(3, str3, "onReceivedError: url = " + str2);
            gz.this.dismissProgressDialog();
            Uri parse = Uri.parse(str2);
            if ("market".equals(parse.getScheme())) {
                Intent intent = new Intent("android.intent.action.VIEW");
                intent.setData(parse);
                gz.this.getContext().startActivity(intent);
                gz.d(gz.this);
                return;
            }
            HashMap hashMap = new HashMap();
            hashMap.put(IronSourceConstants.ERROR_CODE_KEY, Integer.toString(ci.kAdDisplayError.z));
            hashMap.put("webViewErrorCode", Integer.toString(i));
            hashMap.put("failingUrl", str2);
            gz.this.a(cj.EV_RENDER_FAILED, hashMap, gz.this.getAdController(), 0);
        }
    }

    public final class a extends WebChromeClient {
        private a() {
        }

        a(gz gzVar, byte b) {
            this();
        }

        @Override
        public final void onShowCustomView(View view, WebChromeClient.CustomViewCallback customViewCallback) {
            kx.a(3, gz.this.c, "onShowCustomView(7)");
            if (!(gz.this.getContext() instanceof Activity)) {
                kx.a(3, gz.this.c, "no activity present");
            } else {
                onShowCustomView(view, ((Activity) gz.this.getContext()).getRequestedOrientation(), customViewCallback);
            }
        }

        @Override
        public final void onShowCustomView(View view, int i, WebChromeClient.CustomViewCallback customViewCallback) {
            kx.a(3, gz.this.c, "onShowCustomView(14)");
            if (!(gz.this.getContext() instanceof Activity)) {
                kx.a(3, gz.this.c, "no activity present");
                return;
            }
            final Activity activity = (Activity) gz.this.getContext();
            if (gz.this.l == null || gz.this.j == null) {
                gz.this.l = view;
                gz.this.m = activity.getRequestedOrientation();
                gz.this.n = customViewCallback;
                gz.this.p = new FrameLayout(activity);
                gz.this.p.setBackgroundColor(-16777216);
                gz.this.p.addView(gz.this.l, new FrameLayout.LayoutParams(-1, -1, 17));
                ((ViewGroup) activity.getWindow().getDecorView()).addView(gz.this.p, -1, -1);
                if (gz.this.o == null) {
                    gz.this.o = new Dialog(activity) {
                        @Override
                        public final boolean dispatchTouchEvent(MotionEvent motionEvent) {
                            return activity.dispatchTouchEvent(motionEvent);
                        }

                        @Override
                        public final boolean dispatchTrackballEvent(MotionEvent motionEvent) {
                            return activity.dispatchTrackballEvent(motionEvent);
                        }
                    };
                    gz.this.o.getWindow().setType(1000);
                    gz.this.o.setOnShowListener(new DialogInterface.OnShowListener() {
                        @Override
                        public final void onShow(DialogInterface dialogInterface) {
                            if (gz.this.r != null) {
                                gz.this.r.hide();
                            }
                        }
                    });
                    gz.this.o.setOnDismissListener(new DialogInterface.OnDismissListener() {
                        @Override
                        public final void onDismiss(DialogInterface dialogInterface) {
                            kx.a(3, gz.this.c, "customViewFullScreenDialog.onDismiss()");
                            if (gz.this.l == null || gz.this.j == null) {
                                return;
                            }
                            gz.this.j.onHideCustomView();
                        }
                    });
                    gz.this.o.setCancelable(true);
                    gz.this.o.show();
                }
                ex.b(activity, i);
                return;
            }
            gz.this.j.onHideCustomView();
        }

        @Override
        public final void onHideCustomView() {
            kx.a(3, gz.this.c, "onHideCustomView()");
            if (!(gz.this.getContext() instanceof Activity)) {
                kx.a(3, gz.this.c, "no activity present");
                return;
            }
            Activity activity = (Activity) gz.this.getContext();
            if (gz.this.l == null) {
                return;
            }
            if (gz.this.r != null) {
                gz.this.r.show();
            }
            ((ViewGroup) activity.getWindow().getDecorView()).removeView(gz.this.p);
            gz.this.p.removeView(gz.this.l);
            if (gz.this.o != null && gz.this.o.isShowing()) {
                gz.this.o.hide();
                gz.this.o.setOnDismissListener(null);
                gz.this.o.dismiss();
            }
            gz.this.o = null;
            if (gz.this.f != null) {
                gz.this.f.stopLoading();
            }
            ex.a(activity, gz.this.m);
            gz.this.n.onCustomViewHidden();
            gz.this.n = null;
            gz.this.p = null;
            gz.this.l = null;
        }
    }

    static void a(gz gzVar, hb hbVar) {
        kx.a(6, gzVar.c, "show Video dialog.");
        final aa aaVar = hbVar.b;
        final int i = hbVar.c;
        if (gzVar.y != null) {
            kx.a(6, gzVar.c, "Already showing a dialog.");
        } else if (!gzVar.isViewAttachedToActivity()) {
            kx.a(6, gzVar.c, "View not attached to any window.");
        } else {
            AlertDialog.Builder builder = new AlertDialog.Builder(gzVar.getContext());
            String b2 = aaVar.b("message");
            String b3 = aaVar.b("confirmDisplay");
            String b4 = aaVar.b("cancelDisplay");
            if (TextUtils.isEmpty(b2) || TextUtils.isEmpty(b3) || TextUtils.isEmpty(b4)) {
                b2 = "Are you sure?";
                b3 = "Cancel";
                b4 = "OK";
            }
            builder.setMessage(b2);
            builder.setCancelable(false);
            builder.setPositiveButton(b4, new DialogInterface.OnClickListener() {
                @Override
                public final void onClick(DialogInterface dialogInterface, int i2) {
                    HashMap hashMap = new HashMap();
                    hashMap.put("sourceEvent", aaVar.c.a.an);
                    gz.this.a(cj.EV_USER_CONFIRMED, hashMap, gz.this.getAdController(), i + 1);
                    if (dialogInterface == null || !gz.this.isViewAttachedToActivity()) {
                        return;
                    }
                    dialogInterface.dismiss();
                    if (dialogInterface == gz.this.y) {
                        gz.h(gz.this);
                        kx.a(3, gz.this.c, "Setting fAlertDialog to null.");
                    }
                }
            });
            builder.setNegativeButton(b3, new DialogInterface.OnClickListener() {
                @Override
                public final void onClick(DialogInterface dialogInterface, int i2) {
                    HashMap hashMap = new HashMap();
                    hashMap.put("sourceEvent", aaVar.c.a.an);
                    gz.this.a(cj.EV_USER_CANCELLED, hashMap, gz.this.getAdController(), i + 1);
                    if (dialogInterface != null && gz.this.isViewAttachedToActivity()) {
                        dialogInterface.dismiss();
                        if (dialogInterface == gz.this.y) {
                            gz.h(gz.this);
                            kx.a(3, gz.this.c, "Setting fAlertDialog to null.");
                        }
                    }
                    if (gz.this.d != null) {
                        gz.this.d.a(gz.this.getAdController().e().a);
                    }
                }
            });
            if (gzVar.d == null || !gzVar.isViewAttachedToActivity()) {
                return;
            }
            gzVar.y = builder.create();
            gzVar.y.show();
            gzVar.d.B();
        }
    }

    static void d(gz gzVar) {
        kx.a(3, gzVar.c, "closing ad unity view");
        if (gzVar.d != null) {
            gzVar.d.C();
        }
        gzVar.onViewClose();
    }

    static void a(gz gzVar, aa aaVar) {
        int i = gzVar.getCurrentAdFrame().d.a;
        int i2 = gzVar.getCurrentAdFrame().d.b;
        int b2 = mg.b(i);
        int b3 = mg.b(i2);
        if (gzVar.a != null) {
            gzVar.a = null;
            gzVar.initLayout();
        }
        aw awVar = aaVar.c.d;
        if (!(awVar instanceof ax) || ((ax) awVar).v() == null) {
            return;
        }
        gzVar.a(b2, b3);
    }

    static void b(gz gzVar, aa aaVar) {
        int i = mg.d().x;
        int i2 = mg.d().y;
        String str = gzVar.c;
        kx.a(3, str, "expand to width = " + i + " height = " + i2);
        aw awVar = aaVar.c.d;
        bz bzVar = aaVar.c.e;
        if ((awVar instanceof ax) && ((ax) awVar).v() != null) {
            gzVar.a(cj.EV_CLICKED, Collections.emptyMap(), bzVar, 0);
            if (!(gzVar.getContext() instanceof Activity)) {
                kx.a(3, gzVar.c, "no activity present");
            } else {
                Activity activity = (Activity) gzVar.getContext();
                if (gzVar.r == null) {
                    String str2 = gzVar.c;
                    kx.a(3, str2, "expand(" + i + "," + i2 + ")");
                    am.a().b.a(gzVar.getContext());
                    if (gzVar.f != null && -1 != gzVar.indexOfChild(gzVar.f)) {
                        gzVar.removeView(gzVar.f);
                    }
                    gzVar.q = activity.getRequestedOrientation();
                    if (gzVar.s == null) {
                        gzVar.s = new FrameLayout(activity);
                        gzVar.s.setBackgroundColor(-16777216);
                        if (gzVar.f != null && gzVar.f.getParent() == null) {
                            gzVar.s.addView(gzVar.f, new FrameLayout.LayoutParams(-1, -1, 17));
                        }
                    }
                    if (gzVar.r == null) {
                        gzVar.r = new Dialog(activity, 16973834);
                        fk.a(gzVar.r.getWindow());
                        gzVar.r.setContentView(gzVar.s, new ViewGroup.LayoutParams(-1, -1));
                        gzVar.r.setOnDismissListener(new DialogInterface.OnDismissListener() {
                            @Override
                            public final void onDismiss(DialogInterface dialogInterface) {
                                kx.a(3, gz.this.c, "extendedWebViewDialog.onDismiss()");
                                if (gz.this.f != null) {
                                    gz.this.f.loadUrl("javascript:if(window.mraid){window.mraid.close();};");
                                }
                            }
                        });
                        gzVar.r.setCancelable(true);
                        gzVar.r.show();
                    }
                    if (gzVar.w) {
                        if (gzVar.a()) {
                            ex.a(activity, 1);
                        } else if (gzVar.getAdObject() instanceof ax) {
                            ex.a(activity);
                        }
                    } else {
                        ex.b(activity, ex.a());
                    }
                }
            }
        }
        if (aaVar.c.b.containsKey("url")) {
            gzVar.a = aaVar.c.b.get("url");
            bzVar.i();
            fg.b(gzVar.getContext(), gzVar.a, awVar);
        }
    }

    static void k(gz gzVar) {
        gzVar.f.loadUrl("javascript:(function() { document.getElementById('flurry_interstitial_close').style.display = 'none'; })()");
    }

    static void l(gz gzVar) {
        if (!gzVar.a() || gzVar.A) {
            return;
        }
        gzVar.A = true;
        gzVar.z = new dc(gzVar.getContext());
        RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(-2, -2);
        layoutParams.addRule(10);
        layoutParams.addRule(11);
        gzVar.z.setDefaultLayoutParams(layoutParams);
        gzVar.z.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                gz.this.a(cj.EV_AD_WILL_CLOSE, Collections.emptyMap(), gz.this.getAdController(), 0);
            }
        });
        gzVar.setMraidButtonVisibility(true);
        gzVar.addView(gzVar.z);
    }

    static void p(gz gzVar) {
        kx.a(3, gzVar.c, "activateFlurryJsEnv");
        String currentContent = gzVar.getCurrentContent();
        if (currentContent == null || currentContent.length() <= 0 || currentContent.equals("{}")) {
            return;
        }
        String url = gzVar.f.getUrl();
        String b2 = mn.b(url);
        String a2 = mn.a(b2, url);
        if (!TextUtils.isEmpty(a2) && !a2.equals(b2)) {
            String str = gzVar.c;
            kx.a(3, str, "content before {{mustached}} tags replacement = '" + currentContent + "'");
            currentContent = currentContent.replace(b2, a2);
            String str2 = gzVar.c;
            kx.a(3, str2, "content after {{mustached}} tags replacement = '" + currentContent + "'");
        }
        StringBuilder sb = new StringBuilder();
        sb.append("javascript:");
        sb.append("(function(){");
        sb.append("if(!window.Hogan){var Hogan={};(function(Hogan,useArrayBuffer){Hogan.Template=function(renderFunc,text,compiler,options){this.r=renderFunc||this.r;this.c=compiler;this.options=options;this.text=text||\"\";this.buf=useArrayBuffer?[]:\"\"};Hogan.Template.prototype={r:function(context,partials,indent){return\"\"},v:hoganEscape,t:coerceToString,render:function render(context,partials,indent){return this.ri([context],partials||{},indent)},ri:function(context,partials,indent){return this.r(context,partials,indent)},rp:function(name,context,partials,indent){var partial=partials[name];if(!partial){return\"\"}if(this.c&&typeof partial==\"string\"){partial=this.c.compile(partial,this.options)}return partial.ri(context,partials,indent)},rs:function(context,partials,section){var tail=context[context.length-1];if(!isArray(tail)){section(context,partials,this);return}for(var i=0;i<tail.length;i++){context.push(tail[i]);section(context,partials,this);context.pop()}},s:function(val,ctx,partials,inverted,start,end,tags){var pass;if(isArray(val)&&val.length===0){return false}if(typeof val==\"function\"){val=this.ls(val,ctx,partials,inverted,start,end,tags)}pass=(val===\"\")||!!val;if(!inverted&&pass&&ctx){ctx.push((typeof val==\"object\")?val:ctx[ctx.length-1])}return pass},d:function(key,ctx,partials,returnFound){var names=key.split(\".\"),val=this.f(names[0],ctx,partials,returnFound),cx=null;if(key===\".\"&&isArray(ctx[ctx.length-2])){return ctx[ctx.length-1]}for(var i=1;i<names.length;i++){if(val&&typeof val==\"object\"&&names[i] in val){cx=val;val=val[names[i]]}else{val=\"\"}}if(returnFound&&!val){return false}if(!returnFound&&typeof val==\"function\"){ctx.push(cx);val=this.lv(val,ctx,partials);ctx.pop()}return val},f:function(key,ctx,partials,returnFound){var val=false,v=null,found=false;for(var i=ctx.length-1;i>=0;i--){v=ctx[i];if(v&&typeof v==\"object\"&&key in v){val=v[key];found=true;break}}if(!found){return(returnFound)?false:\"\"}if(!returnFound&&typeof val==\"function\"){val=this.lv(val,ctx,partials)}return val},ho:function(val,cx,partials,text,tags){var compiler=this.c;var options=this.options;options.delimiters=tags;var text=val.call(cx,text);text=(text==null)?String(text):text.toString();this.b(compiler.compile(text,options).render(cx,partials));return false},b:(useArrayBuffer)?function(s){this.buf.push(s)}:function(s){this.buf+=s},fl:(useArrayBuffer)?function(){var r=this.buf.join(\"\");this.buf=[];return r}:function(){var r=this.buf;this.buf=\"\";return r},ls:function(val,ctx,partials,inverted,start,end,tags){var cx=ctx[ctx.length-1],t=null;if(!inverted&&this.c&&val.length>0){return this.ho(val,cx,partials,this.text.substring(start,end),tags)}t=val.call(cx);if(typeof t==\"function\"){if(inverted){return true}else{if(this.c){return this.ho(t,cx,partials,this.text.substring(start,end),tags)}}}return t},lv:function(val,ctx,partials){var cx=ctx[ctx.length-1];var result=val.call(cx);if(typeof result==\"function\"){result=coerceToString(result.call(cx));if(this.c&&~result.indexOf(\"{\\u007B\")){return this.c.compile(result,this.options).render(cx,partials)}}return coerceToString(result)}};var rAmp=/&/g,rLt=/</g,rGt=/>/g,rApos=/\\'/g,rQuot=/\\\"/g,hChars=/[&<>\\\"\\']/;function coerceToString(val){return String((val===null||val===undefined)?\"\":val)}function hoganEscape(str){str=coerceToString(str);return hChars.test(str)?str.replace(rAmp,\"&amp;\").replace(rLt,\"&lt;\").replace(rGt,\"&gt;\").replace(rApos,\"&#39;\").replace(rQuot,\"&quot;\"):str}var isArray=Array.isArray||function(a){return Object.prototype.toString.call(a)===\"[object Array]\"}})(typeof exports!==\"undefined\"?exports:Hogan);(function(Hogan){var rIsWhitespace=/\\S/,rQuot=/\\\"/g,rNewline=/\\n/g,rCr=/\\r/g,rSlash=/\\\\/g,tagTypes={\"#\":1,\"^\":2,\"/\":3,\"!\":4,\">\":5,\"<\":6,\"=\":7,_v:8,\"{\":9,\"&\":10};Hogan.scan=function scan(text,delimiters){var len=text.length,IN_TEXT=0,IN_TAG_TYPE=1,IN_TAG=2,state=IN_TEXT,tagType=null,tag=null,buf=\"\",tokens=[],seenTag=false,i=0,lineStart=0,otag=\"{{\",ctag=\"}}\";function addBuf(){if(buf.length>0){tokens.push(new String(buf));buf=\"\"}}function lineIsWhitespace(){var isAllWhitespace=true;for(var j=lineStart;j<tokens.length;j++){isAllWhitespace=(tokens[j].tag&&tagTypes[tokens[j].tag]<tagTypes._v)||(!tokens[j].tag&&tokens[j].match(rIsWhitespace)===null);if(!isAllWhitespace){return false}}return isAllWhitespace}function filterLine(haveSeenTag,noNewLine){addBuf();if(haveSeenTag&&lineIsWhitespace()){for(var j=lineStart,next;j<tokens.length;j++){if(!tokens[j].tag){if((next=tokens[j+1])&&next.tag==\">\"){next.indent=tokens[j].toString()}tokens.splice(j,1)}}}else{if(!noNewLine){tokens.push({tag:\"\\n\"})}}seenTag=false;lineStart=tokens.length}function changeDelimiters(text,index){var close=\"=\"+ctag,closeIndex=text.indexOf(close,index),delimiters=trim(text.substring(text.indexOf(\"=\",index)+1,closeIndex)).split(\" \");otag=delimiters[0];ctag=delimiters[1];return closeIndex+close.length-1}if(delimiters){delimiters=delimiters.split(\" \");otag=delimiters[0];ctag=delimiters[1]}for(i=0;i<len;i++){if(state==IN_TEXT){if(tagChange(otag,text,i)){--i;addBuf();state=IN_TAG_TYPE}else{if(text.charAt(i)==\"\\n\"){filterLine(seenTag)}else{buf+=text.charAt(i)}}}else{if(state==IN_TAG_TYPE){i+=otag.length-1;tag=tagTypes[text.charAt(i+1)];tagType=tag?text.charAt(i+1):\"_v\";if(tagType==\"=\"){i=changeDelimiters(text,i);state=IN_TEXT}else{if(tag){i++}state=IN_TAG}seenTag=i}else{if(tagChange(ctag,text,i)){tokens.push({tag:tagType,n:trim(buf),otag:otag,ctag:ctag,i:(tagType==\"/\")?seenTag-ctag.length:i+otag.length});buf=\"\";i+=ctag.length-1;state=IN_TEXT;if(tagType==\"{\"){if(ctag==\"}}\"){i++}else{cleanTripleStache(tokens[tokens.length-1])}}}else{buf+=text.charAt(i)}}}}filterLine(seenTag,true);return tokens};function cleanTripleStache(token){if(token.n.substr(token.n.length-1)===\"}\"){token.n=token.n.substring(0,token.n.length-1)}}function trim(s){if(s.trim){return s.trim()}return s.replace(/^\\s*|\\s*$/g,\"\")}function tagChange(tag,text,index){if(text.charAt(index)!=tag.charAt(0)){return false}for(var i=1,l=tag.length;i<l;i++){if(text.charAt(index+i)!=tag.charAt(i)){return false}}return true}function buildTree(tokens,kind,stack,customTags){var instructions=[],opener=null,token=null;while(tokens.length>0){token=tokens.shift();if(token.tag==\"#\"||token.tag==\"^\"||isOpener(token,customTags)){stack.push(token);token.nodes=buildTree(tokens,token.tag,stack,customTags);instructions.push(token)}else{if(token.tag==\"/\"){if(stack.length===0){throw new Error(\"Closing tag without opener: /\"+token.n)}opener=stack.pop();if(token.n!=opener.n&&!isCloser(token.n,opener.n,customTags)){throw new Error(\"Nesting error: \"+opener.n+\" vs. \"+token.n)}opener.end=token.i;return instructions}else{instructions.push(token)}}}if(stack.length>0){throw new Error(\"missing closing tag: \"+stack.pop().n)}return instructions}function isOpener(token,tags){for(var i=0,l=tags.length;i<l;i++){if(tags[i].o==token.n){token.tag=\"#\";return true}}}function isCloser(close,open,tags){for(var i=0,l=tags.length;i<l;i++){if(tags[i].c==close&&tags[i].o==open){return true}}}Hogan.generate=function(tree,text,options){var code='var _=this;_.b(i=i||\"\");'+walk(tree)+\"return _.fl();\";if(options.asString){return\"function(c,p,i){\"+code+\";}\"}return new Hogan.Template(new Function(\"c\",\"p\",\"i\",code),text,Hogan,options)};function esc(s){return s.replace(rSlash,\"\\\\\\\\\").replace(rQuot,'\\\\\"').replace(rNewline,\"\\\\n\").replace(rCr,\"\\\\r\")}function chooseMethod(s){return(~s.indexOf(\".\"))?\"d\":\"f\"}function walk(tree){var code=\"\";for(var i=0,l=tree.length;i<l;i++){var tag=tree[i].tag;if(tag==\"#\"){code+=section(tree[i].nodes,tree[i].n,chooseMethod(tree[i].n),tree[i].i,tree[i].end,tree[i].otag+\" \"+tree[i].ctag)}else{if(tag==\"^\"){code+=invertedSection(tree[i].nodes,tree[i].n,chooseMethod(tree[i].n))}else{if(tag==\"<\"||tag==\">\"){code+=partial(tree[i])}else{if(tag==\"{\"||tag==\"&\"){code+=tripleStache(tree[i].n,chooseMethod(tree[i].n))}else{if(tag==\"\\n\"){code+=text('\"\\\\n\"'+(tree.length-1==i?\"\":\" + i\"))}else{if(tag==\"_v\"){code+=variable(tree[i].n,chooseMethod(tree[i].n))}else{if(tag===undefined){code+=text('\"'+esc(tree[i])+'\"')}}}}}}}}return code}function section(nodes,id,method,start,end,tags){return\"if(_.s(_.\"+method+'(\"'+esc(id)+'\",c,p,1),c,p,0,'+start+\",\"+end+',\"'+tags+'\")){_.rs(c,p,function(c,p,_){'+walk(nodes)+\"});c.pop();}\"}function invertedSection(nodes,id,method){return\"if(!_.s(_.\"+method+'(\"'+esc(id)+'\",c,p,1),c,p,1,0,0,\"\")){'+walk(nodes)+\"};\"}function partial(tok){return'_.b(_.rp(\"'+esc(tok.n)+'\",c,p,\"'+(tok.indent||\"\")+'\"));'}function tripleStache(id,method){return\"_.b(_.t(_.\"+method+'(\"'+esc(id)+'\",c,p,0)));'}function variable(id,method){return\"_.b(_.v(_.\"+method+'(\"'+esc(id)+'\",c,p,0)));'}function text(id){return\"_.b(\"+id+\");\"}Hogan.parse=function(tokens,text,options){options=options||{};return buildTree(tokens,\"\",[],options.sectionTags||[])},Hogan.cache={};Hogan.compile=function(text,options){options=options||{};var key=text+\"||\"+!!options.asString;var t=this.cache[key];if(t){return t}t=this.generate(this.parse(this.scan(text,options.delimiters),text,options),text,options);return this.cache[key]=t}})(typeof exports!==\"undefined\"?exports:Hogan);window.Hogan=Hogan;}");
        sb.append("if(!window.flurryadapter){var flurryBridgeCtor=function(w){var flurryadapter={};flurryadapter.flurryCallQueue=[];flurryadapter.flurryCallInProgress=false;flurryadapter.callComplete=function(cmd){if(cmd.length > 0){try{if(window.mraid){ mraid.flurryBridgeListenerEvent(cmd);}}catch(error){ }} if(this.flurryCallQueue.length==0){this.flurryCallInProgress=false;return}var adapterCall=this.flurryCallQueue.splice(0,1)[0];this.executeNativeCall(adapterCall);return\"OK\"};flurryadapter.executeCall=function(command){var adapterCall=\"flurry://flurrycall?event=\"+command;var value;for(var i=1;i<arguments.length;i+=2){value=arguments[i+1];if(value==null)continue;adapterCall+=\"&\"+arguments[i]+\"=\"+escape(value)}if(this.flurryCallInProgress)this.flurryCallQueue.push(adapterCall);else this.executeNativeCall(adapterCall)};flurryadapter.executeNativeCall=function(adapterCall){if(adapterCall.length==0)return;this.flurryCallInProgress=true;w.location=adapterCall};return flurryadapter};window.flurryadapter=flurryBridgeCtor(window);}");
        sb.append("if(!window.flurryAdapterAvailable){window.flurryAdapterAvailable=true;if(typeof window.FlurryAdapterReady === 'function'){window.FlurryAdapterReady();} }");
        String f = mi.f(currentContent);
        sb.append("var content='");
        sb.append(f);
        sb.append("';var compiled=window.Hogan.compile(document.body.innerHTML);var rendered=compiled.render(JSON.parse(content));document.body.innerHTML=rendered;");
        sb.append("})();");
        if (gzVar.f != null) {
            gzVar.f.loadUrl(sb.toString());
        }
    }
}