package com.input.board.appskey.keyboard.fileTools;

import android.content.Context;
import android.provider.Settings;
import android.view.inputmethod.InputMethodInfo;
import android.view.inputmethod.InputMethodManager;

import com.input.board.appskey.keyboard.KeyBoardApp;

public class InputMethodCom {
   private static Object systemService = KeyBoardApp.appInstance.getSystemService(Context.INPUT_METHOD_SERVICE);
    private static InputMethodManager inputMethodManager = (InputMethodManager) systemService;
    public static boolean checkSetDefault(Context con){
        String defaultId = Settings.Secure.getString(con.getContentResolver(), Settings.Secure.DEFAULT_INPUT_METHOD);
        if(defaultId != null && defaultId.startsWith(con.getPackageName())){
            return true;
        }else {
            return false;
        }
    }

    public static boolean checkEnable(Context con){
        for (InputMethodInfo methodInfo : inputMethodManager.getEnabledInputMethodList()) {
            if(methodInfo.getId().startsWith(con.getPackageName())){
                return  true;
            }
        }
        return false;

    }
}
