package com.longtu.sample;

import com.bh.sdk.Interface.LTBaseSDK;
import com.bh.sdk.LTProduct;
import com.longtu.sdk.base.Listener.LTBaseGiftExchangeListener;
import com.longtu.sdk.base.Listener.LTBaseReceivePreRewardListener;
import com.longtu.sdk.base.Listener.LTBaseSDKActivityDetilsListener;
import com.longtu.sdk.base.Listener.LTBaseSDKPushListener;
import com.longtu.sdk.base.Listener.LTBaseUserAgreementListener;
import com.longtu.sdk.base.Verification.LTVerificationCallback;
import com.longtu.sdk.base.bean.LTPushLocalData;
import com.longtu.sdk.base.view.LTToast;
import com.longtu.sdk.utils.Log.Logs;
import com.longtugame.globalsample.R;

import android.annotation.SuppressLint;
import android.app.AlertDialog.Builder;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.util.Log;
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 org.json.JSONObject;

import java.util.HashMap;

/**
 * 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_OPeActivityNotice;

    private Button mButton_multimedia;

    private Button mButton_PayCurrency;

    private Button mButton_PayCurrencyList;

    private Button mButton_UcenterPrivacy;

    private Button mButton_localpush;

    private Button mButton_houstondevices;

    private Button mButton_transferToGooglePlay;

    private Button mButton_WeMix;

    private Button mButton_ReceivePreReware;

    // 检查绑定关系
    private Button mButton_CheckBing;

    // 绑定wemix
    private Button mButton_BingWemix;

    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_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_PayCurrency = (Button) this.findViewById(R.id.longtu_demo_button_getpayCurrency);
        this.mButton_PayCurrency.setOnClickListener(this);

        mButton_UcenterPrivacy = (Button) this.findViewById(R.id.longtu_demo_button_ucenterprivacy);
        this.mButton_UcenterPrivacy.setOnClickListener(this);

        mButton_localpush = (Button) this.findViewById(R.id.longtu_demo_button_localpush);
        this.mButton_localpush.setOnClickListener(this);

        mButton_houstondevices = (Button) this.findViewById(R.id.longtu_demo_button_sethoustondevices);
        this.mButton_houstondevices.setOnClickListener(this);

        mButton_PayCurrencyList = this.findViewById(R.id.longtu_demo_button_getpayCurrencyList);
        this.mButton_PayCurrencyList.setOnClickListener(this);

        mButton_transferToGooglePlay = this.findViewById(R.id.longtu_demo_button_transferToGooglePlay);
        this.mButton_transferToGooglePlay.setOnClickListener(this);

        mButton_WeMix = this.findViewById(R.id.longtu_demo_button_wemixsign);
        mButton_WeMix.setOnClickListener(this);

        mButton_ReceivePreReware = this.findViewById(R.id.longtu_demo_button_ReceivePreReward);
        this.mButton_ReceivePreReware.setOnClickListener(this);

        mButton_CheckBing = this.findViewById(R.id.longtu_demo_button_checkbing);
        this.mButton_CheckBing.setOnClickListener(this);

        mButton_BingWemix = this.findViewById(R.id.longtu_demo_button_bingwemix);
        this.mButton_BingWemix.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) {

            LTBaseSDK.getInstance(LTBase_Demo_MainActivity.mMainActivity)
                    .LTPushSetPushListener(mLTBaseSDKPushListener);
            LTBaseSDK.getInstance(LTBase_Demo_MainActivity.mMainActivity).LTPushGetPushToken();
        } 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)
                            .LTBaseSDKOpenWebviewWithNavbar("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_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_PayCurrency) {

            LTBaseSDK.getInstance(LTBase_Demo_MainActivity.mMainActivity)
                    .LTBaseSDKChannelExtend("getPayCurrency");

        } else if (view == this.mButton_UcenterPrivacy) {
            LTBaseSDK.getInstance(LTBase_Demo_MainActivity.mMainActivity).LTBaseOpenUserAgreement();
        } else if (view == this.mButton_localpush) {
            LTBaseSDK.getInstance(LTBase_Demo_MainActivity.mMainActivity).LTPushAddLocalNotification(AssemblyData());
        } else if (view == this.mButton_houstondevices) {
            LTBaseSDK.getInstance(LTBase_Demo_MainActivity.mMainActivity).LTBaseSetHoustonDevices_id("testHoustonDevicesid");
        } else if (view == this.mButton_PayCurrencyList) {
            LTBaseSDK.getInstance(LTBase_Demo_MainActivity.mMainActivity)
                    .LTBaseSDKChannelExtend("SkuDetails");
        } else if (view == this.mButton_transferToGooglePlay) {
            LTBaseSDK.getInstance(LTBase_Demo_MainActivity.mMainActivity)
                    .LTBaseSDKChannelExtend("transferToGooglePlay");
        } else if (view == this.mButton_WeMix) {
            // wemix
            Log.i("LTBaseSDKLog", "  LTMethodName_WeMixSign start ");
            LTBaseSDK.getInstance(LTBase_Demo_MainActivity.mMainActivity)
                    .LTBaseSDKChannelExtend("LTMethodName_WeMixSign", null, null, null);

        } else if (view == this.mButton_ReceivePreReware) {
            LTBaseSDK.getInstance(LTBase_Demo_MainActivity.mMainActivity).
                    LTBaseReceivePreReward("2", "", "我是扩展参数", new LTBaseReceivePreRewardListener() {
                        @Override
                        public void LTBaseReceivePreRewardSuccess(int code, String value) {
                            LTToast.makeText(LTBase_Demo_MainActivity.mMainActivity, "领取成功", Toast.LENGTH_LONG);
                        }

                        @Override
                        public void LTBaseReceivePreRewardFail(int code, String msg) {
                            LTToast.makeText(LTBase_Demo_MainActivity.mMainActivity, "领取失败 code:"
                                    + code + " msg:" + msg, Toast.LENGTH_LONG);
                        }
                    });

        } else if (view == mButton_CheckBing) {
            Log.i("LTBaseSDKLog", "  mButton_CheckBing start ");

            LTBaseSDK.getInstance(LTBase_Demo_MainActivity.mMainActivity).
                    LTBaseSDKChannelExtend("LTMethodName_CheckBindWemix");

        } else if (view == mButton_BingWemix) {
            Log.i("LTBaseSDKLog", "  mButton_BingWemix start ");

            LTBaseSDK.getInstance(LTBase_Demo_MainActivity.mMainActivity).
                    LTBaseSDKChannelExtend("LTMethodName_BindWemix");

        }
    }


    /**
     * 获取推送token
     */
    private LTBaseSDKPushListener mLTBaseSDKPushListener = new LTBaseSDKPushListener() {
        @Override
        public void LTBaseSDKPushToken(int code, String token) {
            Logs.i(LTBase_Demo_MainActivity.LOGTAG, "获取push  token code: " + code + "  token: " + token);
        }
    };


    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,
                                        " 礼包码兑换失败", Toast.LENGTH_SHORT);
                            }
                        });

    }

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

    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);
            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();
        }
    };


    /**
     * 用户协议点击事件
     */
    private LTBaseUserAgreementListener mLTBaseUserAgreementListener = new LTBaseUserAgreementListener() {

        @Override
        public void UserAgreementOpen() {

        }

        @Override
        public void UserAgreementResult(boolean b, JSONObject jsonObject) {
            Logs.i(LOGTAG, "  UserAgreementResult b:" + b + " jsonObject：" + jsonObject.toString());
        }
    };


    /**
     * 拼装本地数据
     */
    public LTPushLocalData AssemblyData() {
        LTPushLocalData mLTPushLocalData = new LTPushLocalData();

        mLTPushLocalData.setTitle("title");
        mLTPushLocalData.setContent("contentcontentcontentcontentcontentcontentcontentcontentcontentcontentcontentcontentcontentcontentcontentcontentcontentcontentcontentcontentcontentcontentcontentcontent");
        mLTPushLocalData.setSubtext("subtext");
        mLTPushLocalData.setTicker("ticker");
        mLTPushLocalData.setAutocancel(true);
        mLTPushLocalData.setPushChannelID("ltbase_push_google");
        mLTPushLocalData.setPushChannelName("pushChannelName");
        mLTPushLocalData.setBroadcastTime(System.currentTimeMillis() + 5000);

        return mLTPushLocalData;
    }

}
