package com.zengame.demo;

import android.os.Bundle;
import android.view.View;
import androidx.appcompat.app.AppCompatActivity;

import com.zengame.oggame.applog.AppLog;
import com.zengame.oggame.applog.InitConfig;
import com.zengame.www.javademo.R;

import java.util.ArrayList;

public class JavaGameActivity extends AppCompatActivity {
    public static final String TAG = "JsGameActivity";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.dash_board_main);

        AppLog.setUserUniqueID("123afa");
        String appId = "10000";
        String channel = "huawei.demo";
        InitConfig config = new InitConfig(appId, channel);
        // 心跳上报 游戏时长统计
        config.setEnablePlay(true);
        // 设置调试模式
//        config.setDebug(true);
//        config.setImeiEnable(false);
//        config.setAndroidIdEnabled(false);
//        config.setIccIdEnabled(false);
        AppLog.init(this, config);

        findViewById(R.id.game_register).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                AppLog.onEventRegister("wechat",true);
            }
        });

        findViewById(R.id.game_login).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                AppLog.onEventLogin("wechat",true);
            }
        });

        findViewById(R.id.game_shop).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                AppLog.onEventPurchase("gold","test", "1","wechat","¥", true, 1);
            }
        });

        findViewById(R.id.game_custom).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ArrayList<String> list = new ArrayList<>();
                list.add("levelup5");
                list.add("5");
                list.add("600");
                AppLog.onEvent("first_launch", list);
            }
        });
    }
}

