package com.genlot.ninglottery.application;

import android.app.Application;

import com.blankj.utilcode.util.Utils;
import com.genlot.devicesdk.HWInfoTool;
import com.genlot.devicesdk.SystemTool;
import com.genlot.nativesdk.SystemNI;
import com.genlot.ninglottery.game.GameManager;
import com.genlot.ninglottery.model.Constant;
import com.genlot.ninglottery.toolkit.SharedUtil;

public class LotteryApplication extends Application {
    private static LotteryApplication mApplication;
    private SystemTool mSystemTool;
    private HWInfoTool mHWInfoTool;

    @Override
    public void onCreate() {
        super.onCreate();
        mApplication = this;
        mSystemTool = new SystemTool(this);
        mHWInfoTool = new HWInfoTool(this);
        Utils.init(this);
        SharedUtil.init(this);
        initNative();
        GameManager.isTrainMode = SharedUtil.getBoolean(Constant.KEY_TRAIN_MODE, false);
    }

    private void initNative() {
        SystemNI.initNative(this, getFilesDir().getAbsolutePath());
        SystemNI.startGateway();
        GameManager.initManager();
        GameManager.initLastTicket();
    }

    public static LotteryApplication getInstance() {
        return mApplication;
    }

    public SystemTool getSystemTool() {
        return mSystemTool;
    }

    public HWInfoTool getHWInfoTool() {
        return mHWInfoTool;
    }

}
