13Poker by gametower unlimited gems v0.4版本的 MD5 值为:51324fc0f195c34821074948ab266846

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


package com.sd.ads;

import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Build;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.JsResult;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.FrameLayout;
import com.adfonic.android.utils.HtmlFormatter;
import com.adsdk.sdk.Const;
import com.flurry.android.AdCreative;
import com.sd.ads.AdActivity;
public class AdView extends WebView {
    private int adHeight;
    private int adWidth;
    private Context m_adContext;
    private AdViewListener m_listener;
    private State m_state;

    public interface AdViewListener {
        void onClicked(AdView adView);

        void onError(AdView adView, String str);

        void onLoaded(AdView adView);

        void willLeaveApplication(AdView adView);
    }

    private enum State {
        NEW,
        LOADING,
        SHOWN,
        CLICKED,
        DONE
    }

    public AdView(Context context) {
        super(context);
        this.m_listener = null;
        this.adWidth = -1;
        this.adHeight = -1;
        setWebViewClient(new AdWebViewClient(context));
        WebChromeClient mWebChromeClient = new WebChromeClient() {
            @Override
            public boolean onJsAlert(WebView view, String url, String message, JsResult result) {
                result.confirm();
                return true;
            }
        };
        setWebChromeClient(mWebChromeClient);
        setHorizontalScrollBarEnabled(false);
        setVerticalScrollBarEnabled(false);
        if (Build.VERSION.SDK_INT >= 9) {
            setOverScrollMode(2);
        }
        getSettings().setJavaScriptEnabled(true);
        getSettings().setLightTouchEnabled(true);
        this.m_state = State.NEW;
        this.m_adContext = null;
    }

    public void setAdContext(Context context) {
        this.m_adContext = context;
    }

    public Context getAdContext() {
        return this.m_adContext;
    }

    public void loadHtml(String html) {
        super.loadDataWithBaseURL("http://push.senddroid.com", html, HtmlFormatter.TEXT_HTML, Const.ENCODING, "about:blank");
    }

    protected void expandToFullscreen() {
        FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(-1, -1);
        setLayoutParams(lp);
        requestLayout();
        setBackgroundColor(-16777216);
    }

    public void moveBannerToAdActivity() {
        Intent intent = new Intent(getContext(), AdActivity.class);
        Sharable sharedAdView = new Sharable(this, "adview self");
        intent.putExtra("com.senddroid.interstitial.AdView", sharedAdView);
        intent.putExtra("com.senddroid.interstitial.showclose", false);
        intent.putExtra("com.senddroid.adType", AdActivity.AdType.ADCONTENT.name());
        intent.putExtra("com.sendroid.interstitial.backgroundColor", 0);
        BannerAd banner = (BannerAd) getParent();
        Sharable sharedlistener = new Sharable(banner.getListener(), "banner listener");
        intent.putExtra("com.senddroid.interstitial.listener", sharedlistener);
        Sharable sharedBanner = new Sharable(banner, AdCreative.kFormatBanner);
        intent.putExtra("com.senddroid.bannerad", sharedBanner);
        getContext().startActivity(intent);
    }

    private class AdWebViewClient extends WebViewClient {
        private Context context;

        public AdWebViewClient(Context context) {
            this.context = context;
        }

        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            if (AdView.this.m_state == State.SHOWN) {
                if (AdView.this.m_listener != null) {
                    AdView.this.m_listener.onClicked(AdView.this);
                }
                AdView.this.m_state = State.CLICKED;
            }
            boolean isGooglePlay = WebUtils.isGooglePlayUrl(url);
            if (isGooglePlay) {
                AdView.this.openUrlInExternalBrowser(this.context, url);
                AdView.this.m_state = State.DONE;
                return true;
            }
            return false;
        }

        @Override
        public void onPageStarted(WebView view, String url, Bitmap favicon) {
            super.onPageStarted(view, url, favicon);
            if (AdView.this.m_state == State.NEW) {
                AdView.this.m_state = State.LOADING;
            }
        }

        @Override
        public void onPageFinished(WebView view, String url) {
            if (AdView.this.m_state == State.LOADING) {
                if (AdView.this.m_listener != null) {
                    AdView.this.m_listener.onLoaded(AdView.this);
                }
                AdView.this.m_state = State.SHOWN;
            } else if (AdView.this.m_state == State.CLICKED) {
                ViewGroup parent = (ViewGroup) AdView.this.getParent();
                if (parent instanceof BannerAd) {
                    AdView.this.moveBannerToAdActivity();
                } else {
                    AdView.this.expandToFullscreen();
                }
                AdView.this.m_state = State.DONE;
            }
        }

        @Override
        public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
            super.onReceivedError(view, errorCode, description, failingUrl);
            if (AdView.this.m_listener != null) {
                String error = description + " (" + failingUrl + ")";
                AdView.this.m_listener.onError(AdView.this, error);
            }
            AdView.this.m_state = State.DONE;
        }
    }

    public void openUrlInExternalBrowser(Context context, String url) {
        if (this.m_listener != null) {
            this.m_listener.willLeaveApplication(this);
        }
        Intent intent = new Intent("android.intent.action.VIEW", Uri.parse(url));
        context.startActivity(intent);
    }

    public void setAdViewListener(AdViewListener listener) {
        this.m_listener = listener;
    }

    void setAdWidth(int width) {
        this.adWidth = width;
    }

    public int getAdWidth() {
        return this.adWidth;
    }

    void setAdHeight(int height) {
        this.adHeight = height;
    }

    public int getAdHeight() {
        return this.adHeight;
    }

    public void setTouchesEnabled(boolean isInteractionEnabled) {
        if (isInteractionEnabled) {
            setOnTouchListener(null);
        } else {
            setOnTouchListener(new View.OnTouchListener() {
                @Override
                public boolean onTouch(View v, MotionEvent event) {
                    return true;
                }
            });
        }
    }
}