全民灭僵尸 v1.3.2版本的 MD5 值为:3e5a0825178a9706b17f30863f73a9f5

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


package com.appabc.island;

import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Rect;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Process;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.widget.Toast;
import cn.egame.terminal.paysdk.EgamePay;
import cn.egame.terminal.paysdk.EgamePayListener;
import cn.egame.terminal.sdk.log.EgameAgent;
import cn.play.dserv.CheckTool;
import cn.play.dserv.ExitCallBack;
import com.baidu.location.BDGeofence;
import com.baidu.location.BDLocation;
import com.baidu.location.BDLocationListener;
import com.baidu.location.LocationClient;
import com.baidu.location.LocationClientOption;
import com.tencent.mm.sdk.modelbase.BaseReq;
import com.tencent.mm.sdk.modelbase.BaseResp;
import com.tencent.mm.sdk.modelmsg.SendMessageToWX;
import com.tencent.mm.sdk.modelmsg.WXMediaMessage;
import com.tencent.mm.sdk.modelmsg.WXWebpageObject;
import com.tencent.mm.sdk.openapi.IWXAPI;
import com.tencent.mm.sdk.openapi.IWXAPIEventHandler;
import com.tencent.mm.sdk.openapi.WXAPIFactory;
import com.tendcloud.tenddata.TalkingDataGA;
import java.io.ByteArrayOutputStream;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.HashMap;
import java.util.Map;
import mm.sms.purchasesdk.SMSPurchase;
import org.cocos2dx.lib.Cocos2dxActivity;
import org.cocos2dx.lib.Cocos2dxGLSurfaceView;
public class JapanZombie extends Cocos2dxActivity implements IWXAPIEventHandler {
    private static final String DEBUG_TAG = "com.appabc.JapanZombie";
    private static final boolean IS_DEBUG = false;
    public static JapanZombie instance = null;
    public static Intent intent = null;
    private static String m_mnc = null;
    public static SMSPurchase m_purchase = null;
    private static final String td_app_id = "7243BD0BDEE293BCAF3D9A83BF32D38D";
    private static final String wx_app_id = "wx38262c7e91dd45c3";
    public LocationClient mLocationClient;
    public MyLocationListener mMyLocationListener;
    private ProgressDialog mProgressDialog;
    public boolean m_billRet;
    public boolean m_failCancel;
    private IWXAPI wxApi;
    private boolean m_isDoOrder = false;
    private String m_APPID = null;
    private String m_APPKEY = null;
    public IAPListener mListener = null;
    private Handler mBsSdkHandler = null;
    public EnumOperatorType m_opertorType = EnumOperatorType.EnumOperatorNull;
    private String m_curPayCode = "0000";
    private int m_curPayType = 1;
    public int m_sdkFeeStartStep = 2;
    public int m_sdkFeeCallbackStep = 2;
    public boolean mPhoneCalled = false;
    Runnable updateThread = new Runnable() {
        @Override
        public void run() {
            System.out.println("----------UpdateThread---");
            if (JapanZombie.this.m_sdkFeeCallbackStep >= JapanZombie.this.m_sdkFeeStartStep) {
                JapanZombie.this.mBsSdkHandler.removeCallbacks(JapanZombie.this.updateThread);
                JapanZombie.instance.runOnGLThread(new Runnable() {
                    @Override
                    public void run() {
                        JapanHelper.NotifyBillingFinish(JapanZombie.this.m_billRet, JapanZombie.instance.getCurPayCode(), JapanZombie.instance.getCurPayType(), JapanZombie.this.m_failCancel);
                        if (JapanZombie.this.m_billRet) {
                            JapanZombie.Log_show("----------pay success " + JapanZombie.instance.getCurPayType());
                            return;
                        }
                        JapanZombie.Log_show("----------pay fail " + JapanZombie.instance.getCurPayType());
                        JapanZombie.instance.showPurchaseFailDlg();
                    }
                });
                return;
            }
            JapanZombie.this.mBsSdkHandler.postDelayed(JapanZombie.this.updateThread, 500L);
        }
    };

    public enum EnumOperatorType {
        EnumOperatorNull,
        EnumOperatorMM,
        EnumOperatorTelecom,
        EnumOperatorUnicom;

        public static EnumOperatorType[] valuesCustom() {
            EnumOperatorType[] valuesCustom = values();
            int length = valuesCustom.length;
            EnumOperatorType[] enumOperatorTypeArr = new EnumOperatorType[length];
            System.arraycopy(valuesCustom, 0, enumOperatorTypeArr, 0, length);
            return enumOperatorTypeArr;
        }
    }

    static {
        System.loadLibrary("cocos2dcpp");
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        this.mBsSdkHandler = new Handler();
        super.onCreate(savedInstanceState);
        instance = this;
        TalkingDataGA.init(this, td_app_id, "V1.3.2");
        regWx();
        SharedPreferencesUtils.init(getApplicationContext());
        SharedPreferencesUtils.setValue(JapanService.PLAY_LAST_TIME, Long.valueOf(System.currentTimeMillis()));
        startService(new Intent("com.appabc.japan.service2"));
        this.mLocationClient = new LocationClient(getApplicationContext());
        this.mLocationClient.setDebug(true);
        this.mMyLocationListener = new MyLocationListener();
        this.mLocationClient.registerLocationListener(this.mMyLocationListener);
    }

    @Override
    protected void onStart() {
        super.onStart();
    }

    @Override
    public void onResume() {
        super.onResume();
        TalkingDataGA.onResume(this);
        if (this.m_opertorType == EnumOperatorType.EnumOperatorTelecom) {
            EgameAgent.onResume(this);
        }
    }

    @Override
    public void onPause() {
        super.onPause();
        TalkingDataGA.onPause(this);
        if (this.m_opertorType == EnumOperatorType.EnumOperatorTelecom) {
            EgameAgent.onPause(this);
        }
    }

    public static JapanZombie getInstance() {
        return instance;
    }

    public static void playVideo() {
        Intent intent2 = new Intent(instance, VideoActivity.class);
        instance.startActivity(intent2);
    }

    public static String getDeviceID() {
        TelephonyManager TelephonyMgr = (TelephonyManager) instance.getSystemService("phone");
        String deviceID = TelephonyMgr.getSubscriberId();
        if (TextUtils.isEmpty(deviceID)) {
            String deviceID2 = TelephonyMgr.getDeviceId();
            if (TextUtils.isEmpty(deviceID2) || deviceID2.compareTo("000000000000000") == 0) {
                String deviceID3 = String.valueOf(Build.BOARD) + Build.BRAND + Build.CPU_ABI + Build.DEVICE + Build.DISPLAY + Build.HOST + Build.ID + Build.MANUFACTURER + Build.MODEL + Build.PRODUCT + Build.TAGS + Build.TYPE + Build.USER;
                try {
                    MessageDigest m = MessageDigest.getInstance("MD5");
                    m.update(deviceID3.getBytes(), 0, deviceID3.length());
                    byte[] p_md5Data = m.digest();
                    String newUniqueID = new String();
                    for (byte b : p_md5Data) {
                        int b2 = b & 255;
                        if (b2 <= 15) {
                            newUniqueID = String.valueOf(newUniqueID) + "0";
                        }
                        newUniqueID = String.valueOf(newUniqueID) + Integer.toHexString(b2);
                    }
                    return "35" + newUniqueID.toUpperCase();
                } catch (NoSuchAlgorithmException e) {
                    return "";
                }
            }
            return deviceID2;
        }
        return deviceID;
    }

    public int initOperatertype() throws Exception {
        getOpertorMnc(this);
        m_mnc = "03";
        if (m_mnc == null) {
            Log_show("---unkown operator----");
            this.m_opertorType = EnumOperatorType.EnumOperatorNull;
        } else if (m_mnc.equals("00") || m_mnc.equals("02") || m_mnc.equals("07") || m_mnc.equals("20")) {
            Log_show("---China Mobile operator----");
            this.m_opertorType = EnumOperatorType.EnumOperatorMM;
        } else if (m_mnc.equals("06") || m_mnc.equals("01")) {
            Log_show("---China unicom----");
            this.m_opertorType = EnumOperatorType.EnumOperatorUnicom;
        } else if (m_mnc.equals("03") || m_mnc.equals("05")) {
            Log_show("---China Telcom----");
            this.m_opertorType = EnumOperatorType.EnumOperatorTelecom;
        }
        return this.m_opertorType.ordinal();
    }

    private static void getOpertorMnc(Context context) throws Exception {
        TelephonyManager manager = (TelephonyManager) context.getSystemService("phone");
        int type = manager.getNetworkType();
        Log_show("getCellIDInfo-->         NetworkType = " + type);
        int phoneType = manager.getPhoneType();
        Log_show("getCellIDInfo-->         phoneType = " + phoneType);
        String deviceID = manager.getSubscriberId();
        if (deviceID != null && deviceID.length() >= 5) {
            m_mnc = deviceID.substring(3, 5);
        }
    }

    public void openUrlByBrowser(String szUrl) {
        Intent intent2 = new Intent("android.intent.action.VIEW");
        intent2.setData(Uri.parse(szUrl));
        startActivity(intent2);
    }

    public void unWoStartPurchase(String mPaycode, int payType) {
        if (this.m_sdkFeeCallbackStep >= this.m_sdkFeeStartStep) {
            this.m_curPayCode = mPaycode;
            this.m_curPayType = payType;
            this.m_sdkFeeStartStep = 2;
            this.m_sdkFeeCallbackStep = 1;
            Log_show("-----unWoStartPurchase " + payType + " " + mPaycode);
            runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    JapanZombie.this.mBsSdkHandler.post(JapanZombie.this.updateThread);
                }
            });
        }
    }

    public void startInit(String theAppID, String thisAppKEY) throws Exception {
        this.m_APPID = theAppID;
        this.m_APPKEY = thisAppKEY;
        runOnUiThread(new Runnable() {
            @Override
            public void run() {
                if (JapanZombie.this.m_opertorType == EnumOperatorType.EnumOperatorMM) {
                    if (JapanZombie.instance.mListener != null) {
                        JapanHelper.NotifyInitFinish(true, JapanZombie.instance.m_opertorType.ordinal());
                    } else {
                        JapanZombie.this.initIAPListener();
                    }
                } else if (JapanZombie.this.m_opertorType == EnumOperatorType.EnumOperatorTelecom) {
                    EgamePay.init(JapanZombie.instance);
                    JapanHelper.NotifyInitFinish(true, EnumOperatorType.EnumOperatorTelecom.ordinal());
                } else if (JapanZombie.this.m_opertorType == EnumOperatorType.EnumOperatorUnicom) {
                    JapanHelper.NotifyInitFinish(true, EnumOperatorType.EnumOperatorUnicom.ordinal());
                } else {
                    JapanHelper.NotifyInitFinish(true, EnumOperatorType.EnumOperatorNull.ordinal());
                }
            }
        });
    }

    public void initIAPListener() {
        showProgressDialog("正在初始化数据,请稍后,谢谢...");
        IAPHandler iapHandler = new IAPHandler(instance);
        instance.mListener = new IAPListener(instance, iapHandler);
        m_purchase = SMSPurchase.getInstance();
        try {
            m_purchase.setAppInfo(this.m_APPID, this.m_APPKEY, 1);
            try {
                m_purchase.smsInit(instance, instance.mListener);
                Log_show("--------init pay sdk");
            } catch (Exception e) {
                e.printStackTrace();
                JapanHelper.NotifyInitFinish(false, EnumOperatorType.EnumOperatorMM.ordinal());
            }
        } catch (Exception e1) {
            JapanHelper.NotifyInitFinish(false, EnumOperatorType.EnumOperatorMM.ordinal());
            e1.printStackTrace();
        }
    }

    public void showProgressDialog(String msg) {
        if (this.mProgressDialog == null) {
            this.mProgressDialog = new ProgressDialog(instance);
            this.mProgressDialog.setCancelable(false);
            this.mProgressDialog.setIndeterminate(true);
            this.mProgressDialog.setMessage(msg);
        }
        this.mProgressDialog.setMessage(msg);
        if (!this.mProgressDialog.isShowing()) {
            this.mProgressDialog.show();
        }
    }

    @Override
    public Cocos2dxGLSurfaceView onCreateView() {
        Cocos2dxGLSurfaceView glSurfaceView = new Cocos2dxGLSurfaceView(this);
        glSurfaceView.setEGLConfigChooser(5, 6, 5, 0, 16, 8);
        return glSurfaceView;
    }

    public void startPurchase(final String mPaycode, int payType) {
        Log_show("startPurchase " + mPaycode);
        if (this.m_sdkFeeCallbackStep >= this.m_sdkFeeStartStep) {
            this.m_curPayCode = mPaycode;
            this.m_curPayType = payType;
            if (this.m_opertorType == EnumOperatorType.EnumOperatorMM || this.m_opertorType == EnumOperatorType.EnumOperatorTelecom) {
                this.m_sdkFeeStartStep = 2;
                this.m_sdkFeeCallbackStep = 1;
                this.m_billRet = false;
            }
            runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    try {
                        if (JapanZombie.this.m_opertorType == EnumOperatorType.EnumOperatorMM) {
                            JapanZombie.this.m_isDoOrder = true;
                            JapanZombie.this.mBsSdkHandler.post(JapanZombie.this.updateThread);
                            JapanZombie.this.showProgressDialog("正在购买中,请稍后");
                            JapanZombie.m_purchase.smsOrder(JapanZombie.instance, JapanZombie.this.m_curPayCode, JapanZombie.instance.mListener);
                        } else if (JapanZombie.this.m_opertorType == EnumOperatorType.EnumOperatorTelecom) {
                            HashMap<String, String> payParams = new HashMap<>();
                            payParams.put(EgamePay.PAY_PARAMS_KEY_TOOLS_ALIAS, mPaycode);
                            payParams.put(EgamePay.PAY_PARAMS_KEY_TOOLS_DESC, "");
                            JapanZombie.this.mBsSdkHandler.post(JapanZombie.this.updateThread);
                            EgamePay.pay(JapanZombie.instance, payParams, new EgamePayListener() {
                                @Override
                                public void paySuccess(Map<String, String> arg0) {
                                    JapanZombie.this.m_sdkFeeCallbackStep = JapanZombie.this.m_sdkFeeStartStep;
                                    JapanZombie.this.m_billRet = true;
                                    JapanZombie.this.m_failCancel = false;
                                }

                                @Override
                                public void payFailed(Map<String, String> arg0, int arg1) {
                                    System.out.println("-----tele buy error:" + arg1);
                                    Toast.makeText(JapanZombie.instance, "购买支付失败,请重新购买!", 1).show();
                                    JapanZombie.this.m_sdkFeeCallbackStep = JapanZombie.this.m_sdkFeeStartStep;
                                    JapanZombie.this.m_billRet = false;
                                    JapanZombie.this.m_failCancel = false;
                                }

                                @Override
                                public void payCancel(Map<String, String> arg0) {
                                    JapanZombie.this.m_sdkFeeCallbackStep = JapanZombie.this.m_sdkFeeStartStep;
                                    JapanZombie.this.m_billRet = false;
                                    JapanZombie.this.m_failCancel = true;
                                }
                            });
                        }
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
            });
        }
    }

    public String getCurPayCode() {
        return this.m_curPayCode;
    }

    public int getCurPayType() {
        return this.m_curPayType;
    }

    public void showPurchaseFailDlg() {
        runOnUiThread(new Runnable() {
            @Override
            public void run() {
                Toast.makeText(JapanZombie.instance, "购买支付失败,请重新购买!", 1).show();
            }
        });
    }

    public void showPurchaseSuccessDlg() {
        runOnUiThread(new Runnable() {
            @Override
            public void run() {
                Toast.makeText(JapanZombie.instance, "购买道具成功!", 1).show();
            }
        });
    }

    public void SendWxTxt(String title, String content, String url, int scene) {
        try {
            if (this.wxApi.isWXAppInstalled()) {
                WXWebpageObject webpage = new WXWebpageObject();
                webpage.webpageUrl = url;
                WXMediaMessage wxmsg = new WXMediaMessage(webpage);
                wxmsg.title = content;
                Bitmap thumb = BitmapFactory.decodeResource(getResources(), R.drawable.icon);
                wxmsg.thumbData = bmpToByteArray(thumb, true);
                SendMessageToWX.Req req = new SendMessageToWX.Req();
                req.transaction = buildTransaction("webpage");
                req.message = wxmsg;
                req.scene = scene;
                this.wxApi.sendReq(req);
            } else {
                Toast.makeText(instance, "您没有安装微信!", 1).show();
            }
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }

    public static byte[] bmpToByteArray(Bitmap bmp, boolean needRecycle) {
        int i;
        int j;
        if (bmp.getHeight() > bmp.getWidth()) {
            i = bmp.getWidth();
            j = bmp.getWidth();
        } else {
            i = bmp.getHeight();
            j = bmp.getHeight();
        }
        Bitmap localBitmap = Bitmap.createBitmap(i, j, Bitmap.Config.RGB_565);
        Canvas localCanvas = new Canvas(localBitmap);
        while (true) {
            localCanvas.drawBitmap(bmp, new Rect(0, 0, i, j), new Rect(0, 0, i, j), (Paint) null);
            if (needRecycle) {
                bmp.recycle();
            }
            ByteArrayOutputStream localByteArrayOutputStream = new ByteArrayOutputStream();
            localBitmap.compress(Bitmap.CompressFormat.JPEG, 100, localByteArrayOutputStream);
            localBitmap.recycle();
            byte[] arrayOfByte = localByteArrayOutputStream.toByteArray();
            try {
                localByteArrayOutputStream.close();
                return arrayOfByte;
            } catch (Exception e) {
                i = bmp.getHeight();
                j = bmp.getHeight();
            }
        }
    }

    public void dismissProgressDialog() {
        this.m_isDoOrder = false;
        if (this.mProgressDialog != null && this.mProgressDialog.isShowing()) {
            this.mProgressDialog.dismiss();
        }
    }

    public static String buildTransaction(String type) {
        return type == null ? String.valueOf(System.currentTimeMillis()) : String.valueOf(type) + System.currentTimeMillis();
    }

    private void regWx() {
        this.wxApi = WXAPIFactory.createWXAPI(this, wx_app_id, true);
        this.wxApi.registerApp(wx_app_id);
        this.wxApi.handleIntent(getIntent(), this);
    }

    @Override
    public void onReq(BaseReq req) {
        switch (req.getType()) {
            case 3:
            case 4:
            default:
                return;
        }
    }

    @Override
    public void onResp(BaseResp resp) {
        switch (resp.errCode) {
            case -4:
            case -3:
            case -2:
            case -1:
            case 0:
            default:
                Toast.makeText(this, 0, 1).show();
                return;
        }
    }

    public void bsNotifyBillFinish(boolean bRet, boolean failCancel) {
        if (bRet) {
            System.out.println("pay success!");
        } else {
            System.out.println("pay fail!");
        }
        this.m_failCancel = failCancel;
        this.m_billRet = bRet;
        this.m_sdkFeeCallbackStep++;
    }

    public void jniExit() {
        if (this.m_opertorType == EnumOperatorType.EnumOperatorTelecom) {
            instance.runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    CheckTool.exit(JapanZombie.instance, new ExitCallBack() {
                        @Override
                        public void exit() {
                            Process.killProcess(Process.myPid());
                        }

                        @Override
                        public void cancel() {
                        }
                    });
                }
            });
        }
    }

    public void setServiceParam(int maxHeartNum, int curHeartNum, long startTimeStamp) {
        SharedPreferencesUtils.setValue(JapanService.HEART_NUM, Integer.valueOf(curHeartNum));
        SharedPreferencesUtils.setValue(JapanService.HEART_NUM_MAX_KEY, Integer.valueOf(maxHeartNum));
        if (startTimeStamp == 0) {
            SharedPreferencesUtils.setValue(JapanService.HEART_LAST_TIME, Long.valueOf(startTimeStamp));
        } else {
            SharedPreferencesUtils.setValue(JapanService.HEART_LAST_TIME, Long.valueOf(System.currentTimeMillis()));
        }
    }

    public boolean getUserProvince() {
        LocationClientOption option = new LocationClientOption();
        option.setNeedDeviceDirect(false);
        option.setCoorType(BDGeofence.COORD_TYPE_GCJ);
        option.setLocationMode(LocationClientOption.LocationMode.Battery_Saving);
        option.setIsNeedAddress(true);
        this.mLocationClient.setLocOption(option);
        this.mLocationClient.start();
        if (this.mLocationClient == null || !this.mLocationClient.isStarted()) {
            return false;
        }
        this.mLocationClient.requestLocation();
        return true;
    }

    public void callCustomerPhone() {
        if (!this.mPhoneCalled) {
            this.mPhoneCalled = true;
            runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    AlertDialog.Builder builder = new AlertDialog.Builder(JapanZombie.instance);
                    builder.setMessage("拨打客服电话吗?");
                    builder.setTitle("呼叫客服");
                    builder.setPositiveButton("确认", new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialog, int which) {
                            dialog.dismiss();
                            JapanZombie.instance.mPhoneCalled = false;
                            Intent intent2 = new Intent("android.intent.action.CALL", Uri.parse("tel:15919724391"));
                            JapanZombie.this.startActivity(intent2);
                        }
                    });
                    builder.setNegativeButton("取消", new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialog, int which) {
                            dialog.dismiss();
                            JapanZombie.instance.mPhoneCalled = false;
                        }
                    });
                    builder.create().show();
                }
            });
        }
    }

    public class MyLocationListener implements BDLocationListener {
        String szProvince = "";

        public MyLocationListener() {
        }

        @Override
        public void onReceiveLocation(BDLocation location) {
            StringBuffer sb = new StringBuffer(256);
            sb.append("time : ");
            sb.append(location.getTime());
            sb.append("\nerror code : ");
            sb.append(location.getLocType());
            sb.append("\nlatitude : ");
            sb.append(location.getLatitude());
            sb.append("\nlontitude : ");
            sb.append(location.getLongitude());
            sb.append("\nradius : ");
            sb.append(location.getRadius());
            if (location.getLocType() == 61) {
                sb.append("\nspeed : ");
                sb.append(location.getSpeed());
                sb.append("\nsatellite : ");
                sb.append(location.getSatelliteNumber());
                sb.append("\ndirection : ");
                sb.append("\naddr : ");
                sb.append(location.getAddrStr());
                sb.append(location.getDirection());
            } else if (location.getLocType() == 161) {
                sb.append("\naddr : ");
                sb.append(location.getAddrStr());
                sb.append("\nprovince : ");
                this.szProvince = location.getProvince();
                if (this.szProvince != null) {
                    int strLength = this.szProvince.length();
                    String tailString = this.szProvince.substring(strLength - 1, strLength);
                    if (tailString.compareToIgnoreCase("省") == 0 || tailString.compareToIgnoreCase("市") == 0) {
                        this.szProvince = this.szProvince.substring(0, strLength - 1);
                    } else if (strLength > 3) {
                        if (this.szProvince.substring(0, 3).compareToIgnoreCase("内蒙古") == 0) {
                            this.szProvince = this.szProvince.substring(0, 3);
                        } else {
                            this.szProvince = this.szProvince.substring(0, 2);
                        }
                    }
                    sb.append(this.szProvince);
                    JapanZombie.instance.mLocationClient.stop();
                    JapanHelper.NotifyGetProvince(this.szProvince);
                    return;
                }
                JapanHelper.NotifyGetProvince("unknown");
            }
        }
    }

    public static void Log_show(String msg) {
    }
}