APK反编译源代码展示 - 南明离火平台提供

应用版本信息
应用名称:For S9
版本号:4.5
包名称:com.jb.gokeyboard.theme.emojiztfors9.getjar

MD5 校验值:27cf44ec6e0720408f5ef017a90a3331

反编译源代码说明

IronScrAd.java 文件包含反编译后的源代码,请注意,该内容仅供学习和参考使用,不得用于非法用途。


package com.jiubang.commerce.ad.ironscr;

import android.content.Context;
import android.util.Log;
import android.webkit.JavascriptInterface;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import com.facebook.ads.AudienceNetworkActivity;
import com.jb.ga0.commerce.util.LogUtils;
import com.jb.ga0.commerce.util.thread.CustomThreadExecutorProxy;
import com.jiubang.commerce.ad.AdSdkApi;
import com.jiubang.commerce.ad.manager.AdSdkManager;
import com.jiubang.commerce.utils.AppUtils;
import com.jiubang.commerce.utils.StringUtils;
import com.jiubang.commerce.utils.SystemUtils;

public class IronScrAd extends WebView {
    static final String COMPLETE = "passback";
    static final String DIV = "','";
    static final String FAIL = "error";
    static final String GP_PREFIX = "https://play.google.com/store/apps/details?id=";
    static final String HTMLSTR = "<head><meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no'><style>body {margin: 0;padding: 0;}</style></head><body><script>var width;var height;var bundleId;var appStoreUrl;var appName;var appVersion;var uid;function loadParams(w, h, bId, asUrl, aName, aVersion, aUid){window.AndroidWebView.showInfoFromJs('loadParams');width = w;height = h;bundleId = bId;appStoreUrl = asUrl;appName = aName;appVersion = aVersion;uid = aUid;}function loadVideo(){var result = 'width=' + width + ' height=' + height + ' bundleId=' + bundleId +' appStoreUrl=' + appStoreUrl + ' appName=' + appName + ' appVersion=' + appVersion + ' uid=' + uid;window.AndroidWebView.showInfoFromJs('loadVideo--param=' + result);var ifr = document.createElement('iframe');ifr.width = width;ifr.height = height;ifr.scrolling = 'no';ifr.marginHeight = 0;ifr.marginWidth = 0;ifr.frameBorder = 0;ifr.src = 'http://www.isvd-jhn.com/integ/sungy.html?w=' + width + '&h='+ height + '&bundleId=' + bundleId + '&appStoreUrl=' +encodeURIComponent(appStoreUrl) + '&appName=' +encodeURIComponent(appName) + '&appVersion=' + appVersion + '&uid=' +uid + '&cb=' + new Date().getTime();document.body.appendChild(ifr);}function displayMessage(evt){window.AndroidWebView.handleDisplayMessage(evt.data);}window.addEventListener('message', displayMessage, false);</script></body>";
    public static final String IRON_ID = "IronScrAd";
    static final String SUCCESS = "impression";
    static short sSystemSupportWebView = 0;
    private IronScrAdConfig mAdConfig;
    private Context mContext;
    private boolean mFileLoadFinish;
    private boolean mHasComplete;
    private IIronScrListener mIIronScrListener;
    private boolean mIsLoading;
    private boolean mLoaded;
    private Runnable mTask;

    public interface IIronScrListener {
        void onComplete();

        void onFail(String str);

        void onSuccess(IronScrAd ironScrAd);
    }

    public interface IWebViewCheckListener {
        void onChecked(boolean z);
    }

    public static void systemSupportWebView(final Context context, final IWebViewCheckListener iWebViewCheckListener) {
        if (iWebViewCheckListener != null) {
            if (sSystemSupportWebView == 0) {
                CustomThreadExecutorProxy.getInstance().runOnMainThread(new Runnable() {
                    @Override
                    public void run() {
                        final WebView webView;
                        try {
                            webView = new WebView(context);
                            try {
                                try {
                                    IronScrAd.sSystemSupportWebView = (short) 1;
                                    if (webView != null) {
                                        webView.post(new Runnable() {
                                            @Override
                                            public void run() {
                                                webView.destroy();
                                            }
                                        });
                                    }
                                    iWebViewCheckListener.onChecked(1 == IronScrAd.sSystemSupportWebView);
                                } catch (Throwable th) {
                                    th = th;
                                    IronScrAd.sSystemSupportWebView = (short) 2;
                                    Log.w("wbq", "systemSupportWebView", th);
                                    if (webView != null) {
                                        webView.post(new Runnable() {
                                            @Override
                                            public void run() {
                                                webView.destroy();
                                            }
                                        });
                                    }
                                    iWebViewCheckListener.onChecked(1 == IronScrAd.sSystemSupportWebView);
                                }
                            } catch (Throwable th2) {
                                th = th2;
                                if (webView != null) {
                                    webView.post(new Runnable() {
                                        @Override
                                        public void run() {
                                            webView.destroy();
                                        }
                                    });
                                }
                                iWebViewCheckListener.onChecked(1 == IronScrAd.sSystemSupportWebView);
                                throw th;
                            }
                        } catch (Throwable th3) {
                            th = th3;
                            webView = null;
                        }
                    }
                });
            } else {
                iWebViewCheckListener.onChecked(1 == sSystemSupportWebView);
            }
        }
    }

    public IronScrAd(Context context, IronScrAdConfig ironScrAdConfig) {
        super(context);
        this.mIsLoading = false;
        this.mLoaded = false;
        this.mFileLoadFinish = false;
        this.mHasComplete = false;
        this.mTask = new Runnable() {
            @Override
            public void run() {
                String packageName = IronScrAd.this.mContext.getPackageName();
                String str = "300";
                String str2 = "250";
                if (IronScrAd.this.mAdConfig != null) {
                    str = IronScrAd.this.mAdConfig.getWidthStr();
                    str2 = IronScrAd.this.mAdConfig.getHeightStr();
                }
                String googleId = AdSdkManager.getInstance().getGoogleId();
                if (StringUtils.isEmpty(googleId) || googleId.toUpperCase().contains(AdSdkApi.UNABLE_TO_RETRIEVE)) {
                    IronScrAd.this.mIIronScrListener.onFail("uid is invalid!");
                    return;
                }
                String str3 = IronScrAd.GP_PREFIX + packageName + "&hl=" + StringUtils.toLowerCase(SystemUtils.getLanguage(IronScrAd.this.mContext));
                String appNameInEnglish = IronScrUtil.getAppNameInEnglish(IronScrAd.this.mContext);
                if (StringUtils.isEmpty(appNameInEnglish)) {
                    appNameInEnglish = AppUtils.getAppLabel(IronScrAd.this.mContext, packageName);
                }
                IronScrAd.this.loadParams(str, str2, packageName, str3, appNameInEnglish, AppUtils.getAppVersionName(IronScrAd.this.mContext, packageName), googleId);
                IronScrAd.this.loadVideo();
            }
        };
        constructWebView();
        this.mContext = context.getApplicationContext();
        this.mAdConfig = ironScrAdConfig;
    }

    public void setAdListener(IIronScrListener iIronScrListener) {
        this.mIIronScrListener = iIronScrListener;
    }

    public void loadAd() {
        if (this.mIIronScrListener != null && !this.mLoaded && !this.mIsLoading) {
            this.mIsLoading = true;
            if (checkAssetsFileExist()) {
                LogUtils.d("Ad_SDK", "IronScr-loadHtmlStr");
                this.mFileLoadFinish = false;
                loadData(HTMLSTR, AudienceNetworkActivity.WEBVIEW_MIME_TYPE, AudienceNetworkActivity.WEBVIEW_ENCODING);
            } else {
                LogUtils.w("Ad_SDK", "checkAssetsFileExist fail");
                this.mIsLoading = false;
                this.mIIronScrListener.onFail("checkAssetsFileExist fail");
            }
        }
    }

    private void constructWebView() {
        getSettings().setJavaScriptEnabled(true);
        setWebViewClient(new WebViewClient() {
            @Override
            public void onReceivedError(WebView webView, int i, String str, String str2) {
                super.onReceivedError(webView, i, str, str2);
                if (LogUtils.isShowLog()) {
                    LogUtils.d("Ad_SDK", "IronScrAd:onReceivedError=" + str);
                }
            }
        });
        setWebChromeClient(new WebChromeClient() {
            @Override
            public void onProgressChanged(WebView webView, int i) {
                super.onProgressChanged(webView, i);
                LogUtils.d("Ad_SDK", "IronScrAd newProgress=" + i);
                if (!IronScrAd.this.mFileLoadFinish && i >= 100) {
                    LogUtils.d("Ad_SDK", "IronScrAd file loaded");
                    IronScrAd.this.mFileLoadFinish = true;
                    IronScrAd.this.mTask.run();
                }
            }
        });
        addJavascriptInterface(new JsInterface(), "AndroidWebView");
    }

    public void loadParams(String str, String str2, String str3, String str4, String str5, String str6, String str7) {
        LogUtils.d("Ad_SDK", "IronScr-loadParams");
        StringBuffer stringBuffer = new StringBuffer("javascript:loadParams('");
        stringBuffer.append(str);
        stringBuffer.append(DIV);
        stringBuffer.append(str2);
        stringBuffer.append(DIV);
        stringBuffer.append(str3);
        stringBuffer.append(DIV);
        stringBuffer.append(str4);
        stringBuffer.append(DIV);
        stringBuffer.append(str5);
        stringBuffer.append(DIV);
        stringBuffer.append(str6);
        stringBuffer.append(DIV);
        stringBuffer.append(str7);
        stringBuffer.append("')");
        loadUrl(stringBuffer.toString());
    }

    public void loadVideo() {
        LogUtils.d("Ad_SDK", "IronScr-loadVideo");
        loadUrl("javascript:loadVideo()");
    }

    private boolean checkAssetsFileExist() {
        return true;
    }

    public class JsInterface {
        private JsInterface() {
        }

        @JavascriptInterface
        public void showInfoFromJs(String str) {
            LogUtils.d("Ad_SDK", "JsInterface:showInfoFromJs=" + str);
        }

        @JavascriptInterface
        public void handleDisplayMessage(String str) {
            LogUtils.d("Ad_SDK", "JsInterface:handleDisplayMessage=" + str);
            if (IronScrAd.this.mIIronScrListener != null) {
                boolean z = IronScrAd.this.mLoaded;
                if (IronScrAd.SUCCESS.equals(str)) {
                    IronScrAd.this.mIsLoading = false;
                    IronScrAd.this.mLoaded = true;
                    if (!z) {
                        IronScrAd.this.mIIronScrListener.onSuccess(IronScrAd.this);
                        return;
                    }
                    return;
                }
                if (IronScrAd.FAIL.equals(str)) {
                    IronScrAd.this.mIsLoading = false;
                    IronScrAd.this.mLoaded = true;
                    IronScrAd.this.post(new Runnable() {
                        @Override
                        public void run() {
                            IronScrAd.this.destroy();
                        }
                    });
                    if (!z) {
                        IronScrAd.this.mIIronScrListener.onFail("IronScr fail");
                        return;
                    }
                    return;
                }
                if (IronScrAd.COMPLETE.equals(str) && !IronScrAd.this.mHasComplete) {
                    IronScrAd.this.mHasComplete = true;
                    IronScrAd.this.mIIronScrListener.onComplete();
                }
            }
        }
    }

    public static class IronScrAdConfig {
        static final long DEFAULT_TIMEOUT = 35000;
        private int mHeight;
        private long mTimeOut = DEFAULT_TIMEOUT;
        private int mWidth;

        public IronScrAdConfig(int i, int i2) {
            if (i <= 0 || i2 <= 0) {
                throw new IllegalArgumentException("IronScrAdConfig--invalid width or height");
            }
            this.mWidth = i;
            this.mHeight = i2;
        }

        public int getWidth() {
            return this.mWidth;
        }

        public int getHeight() {
            return this.mHeight;
        }

        public String getWidthStr() {
            return "" + this.mWidth;
        }

        public String getHeightStr() {
            return "" + this.mHeight;
        }

        public void setTimeOut(long j) {
            if (j <= 0) {
                throw new IllegalArgumentException("IronScrAdConfig--invalid timeout time");
            }
            this.mTimeOut = j;
        }

        public static long getTimeOut(IronScrAdConfig ironScrAdConfig) {
            return ironScrAdConfig != null ? ironScrAdConfig.mTimeOut : DEFAULT_TIMEOUT;
        }
    }
}