package com.sunny.app.soft.timberkeyboardnew.tools

import android.content.Context
import android.provider.Settings
import android.view.inputmethod.InputMethodManager
import com.sunny.app.soft.timberkeyboardnew.App

object KeyboardManager {

    private val inputManager = App.appContext.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager

    fun isChoose(): Boolean {
        return Settings.Secure.getString(App.appContext.contentResolver, Settings.Secure.DEFAULT_INPUT_METHOD)
            .startsWith(App.appContext.packageName)
    }

    fun isEnable(): Boolean {
        for (inputMethodInfo in inputManager.enabledInputMethodList) {
            if (inputMethodInfo.id.startsWith(App.appContext.packageName)) {
                return true
            }
        }
        return false
    }

}