package com.longtu.sample;

import android.annotation.SuppressLint;
import android.app.AlertDialog.Builder;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.Spinner;
import android.widget.Toast;

import com.acegameproject.burstshooter.R;
import com.bh.sdk.Interface.LTBaseSDK;
import com.bh.sdk.LTProduct;
import com.longtu.sdk.base.Listener.LTBaseGiftExchangeListener;
import com.longtu.sdk.base.Listener.LTBaseSDKActivityDetilsListener;
import com.longtu.sdk.base.Listener.LTBaseUpdatePCDNPathListener;
import com.longtu.sdk.base.Verification.LTVerificationCallback;
import com.longtu.sdk.base.bean.LTBaseDeviceInfo;
import com.longtu.sdk.base.view.LTTip;
import com.longtu.sdk.base.view.LTToast;
import com.longtu.sdk.utils.Log.Logs;

import org.json.JSONException;
import org.json.JSONObject;

/**
 * Demo 主控件， 模拟游戏主要游戏页面， 实现支付，注销，客服等功能和各功能点接口调用
 */

@SuppressLint("NewApi")
public class LTBase_Demo_PayView extends LinearLayout implements OnClickListener {


    public final static String LOGTAG = "ltbase_demo";

    private Context mContext;

    public LTBase_Demo_Analyticslayout mAnalyticslayout;
    public LTBase_Demo_ShareView mShareView;

    private Button mButton_exit;
    private Button mButton_switchaccount;
    private Button mButton_logout;
    private Button mButton_ucenter;
    private Button mButton_question;

    private Button mButton_pay1;
    private Button mButton_pay2;
    private Button mButton_pay3;

    private Button mButton_ShareMsg;
    private Button mButton_ShareImage;

    private Button mButton_giftcode;

    private Button mButton_getpushtoken;

    private Button mButton_Anlytics;

    private Button mButton_BI;

    private Button mButtonVerification;

    private Button mButton_OpenWebView;

    private Button mButton_GameDiyLog;
    private Button mButton_Crashtest;

    private Button mButton_activitynotice;

    private Button mButton_LoginNotice;

    private Button mButton_OPeActivityNotice;

    private Button mButton_multimedia;

    private Button mButton_ads;

    private Button mButton_getCDNPath;

    private Button mButton_getUserVersion;

    private Button mButtonreturnmainactivity;

    private Button mButtonPush;

    private Button mButtonUBIDnaID;

    private Button mButtonAgreement;

    private Button mButtonDeviceInfo;

    private Button mButton_getClientIp;

    private Button mButton_ShowErrorTip;

    public LTBase_Demo_PayView(Context context) {
        super(context);
        mContext = context;
        init();
    }

    private void init() {
        LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        View v = inflater.inflate(R.layout.longtu_demo_ingame, this);

        this.mButton_pay1 = (Button) this.findViewById(R.id.longtu_demo_button_pay_1);
        this.mButton_pay1.setOnClickListener(this);
        this.mButton_pay2 = (Button) this.findViewById(R.id.longtu_demo_button_pay_2);
        this.mButton_pay2.setOnClickListener(this);
        this.mButton_pay3 = (Button) this.findViewById(R.id.longtu_demo_button_pay_3);
        this.mButton_pay3.setOnClickListener(this);
        this.mButton_switchaccount = (Button) this.findViewById(R.id.longtu_demo_button_switchaccount);
        this.mButton_switchaccount.setOnClickListener(this);
        this.mButton_logout = (Button) this.findViewById(R.id.longtu_demo_button_logout);
        this.mButton_logout.setOnClickListener(this);
        this.mButton_ucenter = (Button) this.findViewById(R.id.longtu_demo_button_gocenter);
        this.mButton_ucenter.setOnClickListener(this);
        this.mButton_question = (Button) this.findViewById(R.id.longtu_demo_button_question);
        this.mButton_question.setOnClickListener(this);
        this.mButton_exit = (Button) this.findViewById(R.id.longtu_demo_button_exit);
        this.mButton_exit.setOnClickListener(this);

        this.mButton_ShareMsg = (Button) this.findViewById(R.id.longtu_demo_button_sharemsg);
        this.mButton_ShareMsg.setOnClickListener(this);
        this.mButton_ShareImage = (Button) this.findViewById(R.id.longtu_demo_button_shareimage);
        this.mButton_ShareImage.setOnClickListener(this);

        this.mButton_giftcode = (Button) this.findViewById(R.id.longtu_demo_button_giftcode);
        this.mButton_giftcode.setOnClickListener(this);

        this.mButton_getpushtoken = (Button) this.findViewById(R.id.longtu_demo_button_getpushtoken);
        this.mButton_getpushtoken.setOnClickListener(this);

        this.mButton_Anlytics = (Button) this.findViewById(R.id.longtu_demo_button_anlytics);
        this.mButton_Anlytics.setOnClickListener(this);

        this.mButtonVerification = (Button) this.findViewById(R.id.longtu_demo_button_verification);
        this.mButtonVerification.setOnClickListener(this);

        this.mButton_OpenWebView = (Button) this.findViewById(R.id.longtu_demo_button_openwebview);
        this.mButton_OpenWebView.setOnClickListener(this);

        this.mButton_GameDiyLog = (Button) this.findViewById(R.id.longtu_demo_button_gamediylog);
        this.mButton_GameDiyLog.setOnClickListener(this);


        this.mButton_Crashtest = (Button) this.findViewById(R.id.longtu_demo_button_crashtest);
        this.mButton_Crashtest.setOnClickListener(this);


        this.mButton_activitynotice = (Button) this.findViewById(R.id.longtu_demo_button_getactivitynotice);
        this.mButton_activitynotice.setOnClickListener(this);

        this.mButton_LoginNotice = (Button) this.findViewById(R.id.longtu_demo_button_Loginnotice);
        this.mButton_LoginNotice.setOnClickListener(this);

        this.mButton_OPeActivityNotice = (Button) this.findViewById(R.id.longtu_demo_button_openactivitynotice);
        this.mButton_OPeActivityNotice.setOnClickListener(this);

        this.mButton_multimedia = (Button) this.findViewById(R.id.longtu_demo_button_multimedia);
        this.mButton_multimedia.setOnClickListener(this);

        this.mButton_ads = (Button) this.findViewById(R.id.longtu_demo_button_openactivityclound);
        this.mButton_ads.setOnClickListener(this);

        mButton_getCDNPath = (Button) this.findViewById(R.id.longtu_demo_button_getCDNPath);
        this.mButton_getCDNPath.setOnClickListener(this);

        mButton_getUserVersion = (Button) this.findViewById(R.id.longtu_demo_button_getuserversion);
        this.mButton_getUserVersion.setOnClickListener(this);

        mButtonreturnmainactivity = (Button) this.findViewById(R.id.longtu_demo_button_returnmainactivity);
        this.mButtonreturnmainactivity.setOnClickListener(this);


        mButtonPush = (Button) this.findViewById(R.id.longtu_demo_button_push);
        this.mButtonPush.setOnClickListener(this);

        mButtonUBIDnaID = (Button) this.findViewById(R.id.longtu_demo_button_ubidnaid);
        this.mButtonUBIDnaID.setOnClickListener(this);

        mButtonAgreement = (Button) this.findViewById(R.id.longtu_demo_button_Agreement);
        this.mButtonAgreement.setOnClickListener(this);

        mButtonDeviceInfo = (Button) this.findViewById(R.id.longtu_demo_button_deviceInfo);
        this.mButtonDeviceInfo.setOnClickListener(this);

        mButton_getClientIp = this.findViewById(R.id.longtu_demo_button_getclientip);
        this.mButton_getClientIp.setOnClickListener(this);

        mButton_ShowErrorTip = this.findViewById(R.id.longtu_demo_button_showordererror);
        this.mButton_ShowErrorTip.setOnClickListener(this);
    }

    @Override
    public void onClick(View view) {
        // TODO Auto-generated method stub

        if (view == this.mButton_pay1) {
            // 调用支付接口，游戏必须调用
            this.Pay("元宝", "10", "1");
        } else if (view == this.mButton_pay2) {
            // 调用支付接口，游戏必须调用
            this.Pay("月卡", "1", "600");
        } else if (view == this.mButton_pay3) {
            LayoutInflater inflater = (LayoutInflater) LTBase_Demo_MainActivity.mMainActivity
                    .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            final View view_libao = inflater.inflate(R.layout.longtu_demo_inputprice_dialog, null);

            final EditText edit = (EditText) view_libao.findViewById(R.id.editText_price);
            final Spinner spinner = (Spinner) view_libao.findViewById(R.id.longtu_spinner1);
            Builder builder = new Builder(LTBase_Demo_MainActivity.mMainActivity);
            builder.setTitle("请输入价格");
            builder.setView(view_libao);
            builder.setPositiveButton("确定", new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int whichButton) {
                    // 调用支付接口，游戏必须调用
                    Logs.e("ltdemo", " spinner = " + spinner);
                    Pay("自定义价格商品", "1", edit.getText().toString(),
                            String.valueOf(spinner.getSelectedItemPosition() + 1));
                }
            });
            builder.setNegativeButton("取消", new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int whichButton) {

                }
            });
            builder.setOnKeyListener(new DialogInterface.OnKeyListener() {
                @Override
                public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
                    // TODO Auto-generated method stub
                    switch (keyCode) {
                        case KeyEvent.KEYCODE_BACK:
                            return true;
                        case KeyEvent.KEYCODE_MENU:
                            return true;
                        case KeyEvent.KEYCODE_SEARCH:
                            return true;
                    }
                    return false;
                }
            });
            builder.setCancelable(false);
            builder.show();
        } else if (view == this.mButton_exit) {
            // 调用退出游戏接口，游戏必须调用(SDK接口)
            LTBaseSDK.getInstance(LTBase_Demo_MainActivity.mMainActivity).LTBaseSDKExitGame();
        } else if (view == this.mButton_switchaccount) {
            // 调用切换账号接口，游戏必须调用(SDK接口)
            if (LTBase_Demo_MainActivity.canswitchaccount) {
                LTBaseSDK.getInstance(LTBase_Demo_MainActivity.mMainActivity).LTBaseSDKSwitchAccount();
            } else {
                Toast.makeText(LTBase_Demo_MainActivity.mMainActivity, "当前渠道SDK不需要切换账号功能", Toast.LENGTH_SHORT).show();
            }
        } else if (view == this.mButton_logout) {
            // 调用注销接口，游戏必须调用(SDK接口)
            if (LTBase_Demo_MainActivity.canlogout) {
                LTBaseSDK.getInstance(LTBase_Demo_MainActivity.mMainActivity).LTBaseSDKLogout();
            } else {
                Toast.makeText(LTBase_Demo_MainActivity.mMainActivity, "当前渠道SDK不需要账号注销功能", Toast.LENGTH_SHORT).show();
            }
        } else if (view == this.mButton_ucenter) {
            // 调用用户中心接口，游戏必须调用(SDK接口)
            if (LTBase_Demo_MainActivity.cangocenter) {
                LTBaseSDK.getInstance(LTBase_Demo_MainActivity.mMainActivity).LTBaseSDKShowUserCenter();
            } else {
                Toast.makeText(LTBase_Demo_MainActivity.mMainActivity, "当前渠道SDK不需要用户中心或者论坛功能", Toast.LENGTH_SHORT)
                        .show();
            }

        } else if (view == this.mButton_question) {
            // 进入问题反馈界面，游戏可选择调用(SDK接口)
            LTBaseSDK.getInstance(LTBase_Demo_MainActivity.mMainActivity).LTBaseSDKFeedback();
        } else if (view == this.mButton_ShareMsg) {


            initShareView();


        } else if (view == this.mButton_ShareImage) {

            initShareView();

        } else if (view == this.mButton_giftcode) {

            LayoutInflater inflater = (LayoutInflater) LTBase_Demo_MainActivity.mMainActivity
                    .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            final View view_libao = inflater.inflate(R.layout.longtu_demo_inputweburl_dialog, null);

            final EditText edit = (EditText) view_libao.findViewById(R.id.editText_weburl);
            edit.setHint("请输入礼包码");
            Builder builder = new Builder(LTBase_Demo_MainActivity.mMainActivity);
            builder.setTitle("请输入礼包码");
            builder.setView(view_libao);
            builder.setPositiveButton("确定", new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int whichButton) {
                    Logs.i(LOGTAG, "礼包码 =" + edit.getText().toString());
                    cdkPay(edit.getText().toString());
                }
            });
            builder.setNegativeButton("取消", new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int whichButton) {

                }
            });
            builder.setOnKeyListener(new DialogInterface.OnKeyListener() {
                @Override
                public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
                    // TODO Auto-generated method stub
                    switch (keyCode) {
                        case KeyEvent.KEYCODE_BACK:
                            return true;
                        case KeyEvent.KEYCODE_MENU:
                            return true;
                        case KeyEvent.KEYCODE_SEARCH:
                            return true;
                        default:
                    }
                    return false;
                }
            });
            builder.setCancelable(false);
            builder.show();


        } else if (view == this.mButton_getpushtoken) {

            String code = LTBaseSDK.getInstance(LTBase_Demo_MainActivity.mMainActivity).LTBaseSDKgetServicecode();
            Logs.i(LOGTAG, " code = " + code);
        } else if (view == this.mButton_Anlytics) {
            initAnalytics();
        } else if (view == this.mButtonVerification) {
            startVerification();
        } else if (view == this.mButton_OpenWebView) {


            LayoutInflater inflater = (LayoutInflater) LTBase_Demo_MainActivity.mMainActivity
                    .getSystemService(Context.LAYOUT_INFLATER_SERVICE);


            final View view_libao = inflater.inflate(R.layout.longtu_demo_inputweburl_dialog, null);
            final EditText edit = (EditText) view_libao.findViewById(R.id.editText_weburl);
            Builder builder = new Builder(LTBase_Demo_MainActivity.mMainActivity);
            builder.setTitle("请输入web页面url");
            builder.setView(view_libao);
            builder.setPositiveButton("确定", new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int whichButton) {
                    Logs.i(LOGTAG, " weburl = " + edit.getText().toString());

                    LTBaseSDK.getInstance(LTBase_Demo_MainActivity.mMainActivity)
                            .LTBaseSDKOpenSpecificWebView("http://hero.longtugame.com/t2/247/4975.html");

                }
            });
            builder.setNegativeButton("取消", new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int whichButton) {

                }
            });
            builder.setOnKeyListener(new DialogInterface.OnKeyListener() {
                @Override
                public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
                    // TODO Auto-generated method stub
                    switch (keyCode) {
                        case KeyEvent.KEYCODE_BACK:
                            return true;
                        case KeyEvent.KEYCODE_MENU:
                            return true;
                        case KeyEvent.KEYCODE_SEARCH:
                            return true;
                        default:
                    }
                    return false;
                }
            });
            builder.setCancelable(false);
            builder.show();
        } else if (view == this.mButton_GameDiyLog) {
            Intent mintent = new Intent();
            mintent.setClass(LTBase_Demo_MainActivity.mMainActivity, LTBase_Demo_BITest.class);
            LTBase_Demo_MainActivity.mMainActivity.startActivity(mintent);
        } else if (view == this.mButton_Crashtest) {
            Intent mintent = new Intent();
            mintent.setClass(LTBase_Demo_MainActivity.mMainActivity, LTBase_Demo_CrashTest.class);
            LTBase_Demo_MainActivity.mMainActivity.startActivity(mintent);
        } else if (view == this.mButton_activitynotice) {
            /**
             *打开游戏内公告
             */
            LTBaseSDK.getInstance(LTBase_Demo_MainActivity.mMainActivity).LTBaseOpenActivityNotice();


        } else if (view == this.mButton_LoginNotice) {
            /**
             *打开游戏内登录公告
             */
            LTBaseSDK.getInstance(LTBase_Demo_MainActivity.mMainActivity).LTBaseOpenLoginNotice();
        } else if (view == this.mButton_OPeActivityNotice) {
            LayoutInflater inflater = (LayoutInflater) LTBase_Demo_MainActivity.mMainActivity
                    .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            final View view_libao = inflater.inflate(R.layout.longtu_demo_inputweburl_dialog, null);

            final EditText edit = (EditText) view_libao.findViewById(R.id.editText_weburl);
            edit.setHint("公告ID");
            Builder builder = new Builder(LTBase_Demo_MainActivity.mMainActivity);
            builder.setTitle("公告ID");
            builder.setView(view_libao);
            builder.setPositiveButton("确定", new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int whichButton) {
                    Logs.i(LOGTAG, "公告ID =" + edit.getText().toString());
                    /**
                     * 根据活动ID打开活动页面
                     */
                    LTBaseSDK.getInstance(LTBase_Demo_MainActivity.mMainActivity).LTBaseOpenAvtivtyDetils(edit.getText().toString(),
                            "10", "10", mLTBaseSDKActivityDetilsListener);
                }
            });
            builder.setNegativeButton("取消", new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int whichButton) {

                }
            });
            builder.show();
        } else if (view == this.mButton_multimedia) {
            Intent mintent = new Intent();
            mintent.setClass(LTBase_Demo_MainActivity.mMainActivity, LTBase_Demo_MultiMedia.class);
            LTBase_Demo_MainActivity.mMainActivity.startActivity(mintent);
        } else if (view == this.mButton_ads) {
            Intent mintent = new Intent();
            mintent.setClass(LTBase_Demo_MainActivity.mMainActivity, LTBase_Demo_Ads.class);
            LTBase_Demo_MainActivity.mMainActivity.startActivity(mintent);
        } else if (view == mButton_getCDNPath) {

            LTBaseSDK.getInstance(LTBase_Demo_MainActivity.mMainActivity).LTBaseSDKgetUpdateCDNPath(mLTBaseUpdatePCDNPathListener);
        } else if (view == mButton_getUserVersion) {
            Toast.makeText(LTBase_Demo_MainActivity.mMainActivity, "当前用户id: "
                    + LTBase_Demo_MainActivity.LONGTU_UserId, Toast.LENGTH_LONG).show();
        } else if (view == this.mButtonreturnmainactivity) {
            LTBase_Demo_MainActivity.mMainActivity.initGameLogin();
        } else if (view == this.mButtonPush) {

            Intent mintent = new Intent();
            mintent.setClass(LTBase_Demo_MainActivity.mMainActivity, LTBase_Demo_PushActivity.class);
            LTBase_Demo_MainActivity.mMainActivity.startActivity(mintent);


        } else if (view == this.mButtonUBIDnaID) {
            LTBaseSDK.getInstance(LTBase_Demo_MainActivity.mMainActivity).LTBaseSDKSetUbiDnaId("1234567890");
        } else if (view == this.mButtonAgreement) {
            // 隐私协议
            LTBaseSDK.getInstance(LTBase_Demo_MainActivity.mMainActivity).LTBaseOpenAgreement();
        } else if (view == this.mButtonDeviceInfo) {

            showDevciesDialog();
        } else if (view == this.mButton_getClientIp) {
            String clentip = LTBaseSDK.getInstance(LTBase_Demo_MainActivity.mMainActivity).LTBaseGetClientIP();
            Toast.makeText(LTBase_Demo_MainActivity.mMainActivity, clentip, Toast.LENGTH_LONG).show();
        } else if (view == this.mButton_ShowErrorTip) {
            LTBaseSDK.getInstance(LTBase_Demo_MainActivity.mMainActivity).LTBaseShowOrderErrorTip();
        }
    }


    private void showDevciesDialog() {
        LTBaseDeviceInfo mLTBaseDeviceInfo = LTBaseSDK.getInstance(LTBase_Demo_MainActivity.mMainActivity).LTBaseGetCurrentDeviceInfo();

        String brand = mLTBaseDeviceInfo.getDeviceBrand();
        String model = mLTBaseDeviceInfo.getDeviceModel();
        String ScreenName = mLTBaseDeviceInfo.getDeviceScreenName();
        int ScreenType = mLTBaseDeviceInfo.getDeviceScreenType();
        int Width, Height;
        Height = mLTBaseDeviceInfo.getHeightPixels();
        Width = mLTBaseDeviceInfo.getWidthPixels();

        StringBuffer DeviceInfoSb = new StringBuffer();
        DeviceInfoSb.append("品牌:" + brand + " \n ");
        DeviceInfoSb.append("型号:" + model + " \n ");
        DeviceInfoSb.append("屏幕类型名:" + ScreenName + " \n ");
        DeviceInfoSb.append("屏幕类型:" + ScreenType + " \n ");
        DeviceInfoSb.append("屏幕Width:" + Height + " \n ");
        DeviceInfoSb.append("屏幕高:" + Width + " \n ");

        LTTip mLTTip = new LTTip(LTBase_Demo_MainActivity.mMainActivity, true, "确定", "取消",
                DeviceInfoSb.toString(), new LTTip.OnTipClickListener() {

            @Override
            public void onClickConfirm() {

            }

            @Override
            public void onClickCancel() {

            }
        });

        mLTTip.show();
    }


    private void cdkPay(String code) {

        LTBaseSDK.getInstance(LTBase_Demo_MainActivity.mMainActivity).
                LTBaseSDKGiftExchange(code,
                        "",
                        "我是扩展接口",
                        new LTBaseGiftExchangeListener() {

                            @Override
                            public void Success(String giftid, String extendParams) {
                                Logs.i(LOGTAG, " LTBaseSDKGiftExchange Success giftid = "
                                        + giftid + " extendParams = " + extendParams);

                                LTToast.makeText(LTBase_Demo_MainActivity.mMainActivity,
                                        " 礼包码兑换成功", Toast.LENGTH_SHORT);
                            }

                            @Override
                            public void Fail(int code) {
                                Logs.i(LOGTAG, " LTBaseSDKGiftExchange Fail code = "
                                        + code);

                                LTToast.makeText(LTBase_Demo_MainActivity.mMainActivity,
                                        " 礼包码兑换失败:" + code, Toast.LENGTH_SHORT);
                            }
                        });

    }

    // 支付
    private void Pay(String propName, String propCount, String price) {
        Pay(propName, propCount, price, "1");
    }

    private void Pay(String propName, String propCount, String price, String currencyType) {
        Logs.i(LOGTAG, " Pay price =  " + price);
        // 游戏必须调用

        LTProduct product = new LTProduct();
        product.setBuyNum(propCount);
        product.setCurrency(propName);
        product.setCurrencyType(currencyType);
        product.setExtension("我是扩展字段");
        product.setPrice(price);
        product.setProductDesc(propName);
        product.setProductId("1000");
        product.setProductName(propName);

        LTBaseSDK.getInstance(LTBase_Demo_MainActivity.mMainActivity).LTBaseSDKPay(product);
    }

    /**
     * 初始化统计日志
     */
    private void initAnalytics() {
        System.gc();
        mAnalyticslayout = new LTBase_Demo_Analyticslayout(LTBase_Demo_MainActivity.mMainActivity);
        LTBase_Demo_MainActivity.mMainActivity.setContentView(mAnalyticslayout);

    }

    private void initShareView() {
        System.gc();
        mShareView = new LTBase_Demo_ShareView(LTBase_Demo_MainActivity.mMainActivity);
        LTBase_Demo_MainActivity.mMainActivity.setContentView(mShareView);
    }


    /**
     * 极验功能测试
     */
    private void startVerification() {
        LTBaseSDK.getInstance(LTBase_Demo_MainActivity.mMainActivity).LTBaseStartVerification("扩展参数",
                new LTVerificationCallback() {
                    @Override
                    public void LTBaseVerificationSuccess(String extend) {
                        Logs.i(LOGTAG, " LTVerificationCallback 扩展参数 extend = "
                                + extend);
                        Toast.makeText(LTBase_Demo_MainActivity.mMainActivity,
                                " 极验功能验证成功 ", Toast.LENGTH_LONG).show();
                    }

                    @Override
                    public void LTBaseVerificationFail(int code, String extend) {
                        Logs.i(LOGTAG, " LTVerificationCallback 扩展参数 extend = "
                                + extend);
                        Toast.makeText(LTBase_Demo_MainActivity.mMainActivity,
                                " 极验功能验证失败 code " + code, Toast.LENGTH_LONG).show();
                    }
                });
    }


    private LTBaseSDKActivityDetilsListener mLTBaseSDKActivityDetilsListener = new LTBaseSDKActivityDetilsListener() {
        @Override
        public void LTBaseSDKActivityDetilsStart(String activityId) {
            Logs.i(LOGTAG, " mLTBaseSDKActivityDetilsListener 活动详情打开 活动ID activityId = "
                    + activityId);
            Toast.makeText(LTBase_Demo_MainActivity.mMainActivity,
                    " 活动详情打开 活动ID = " + activityId, Toast.LENGTH_LONG).show();
        }

        @Override
        public void LTBaseSDKActivityDetilsClose(String activityId, String data) {

            Logs.i(LOGTAG, " mLTBaseSDKActivityDetilsListener 动详情关闭 活动ID activityId = "
                    + activityId + " data = " + data);
            Toast.makeText(LTBase_Demo_MainActivity.mMainActivity,
                    " 活动详情关闭 活动ID = " + activityId, Toast.LENGTH_LONG).show();
        }

        @Override
        public void LTBaseSDKNoActivityDetils(String activityId) {
            Logs.i(LOGTAG, " mLTBaseSDKActivityDetilsListener 活动不存在 活动ID activityId = "
                    + activityId);
            Toast.makeText(LTBase_Demo_MainActivity.mMainActivity,
                    " 活动不存在 活动ID = " + activityId, Toast.LENGTH_LONG).show();
        }
    };

    /**
     * 获取CDN地址回调
     */
    private LTBaseUpdatePCDNPathListener mLTBaseUpdatePCDNPathListener = new LTBaseUpdatePCDNPathListener() {

        @Override
        public void getPathSuccess(JSONObject cdnPath) {
            Logs.i(LOGTAG, " mLTBaseUpdatePCDNPathListener getPathSuccess cdnPath = "
                    + cdnPath.toString());

            // cdn地址集合，逗号分隔，研发可以按照顺序尝试使用
            try {
                String domainList = cdnPath.getString("domainList");
                // cdn回源地址， cdn地址尝试均是失败时，可以直接使用回源地址获取数据更新
                String sourceDomain = cdnPath.getString("sourceDomain");
            } catch (JSONException e) {
                e.printStackTrace();
            }

        }

        @Override
        public void getPathFail(int code) {
            Logs.i(LOGTAG, " mLTBaseUpdatePCDNPathListener getPathFail code = "
                    + code);
        }
    };

}
