List of usage examples for android.view.inputmethod InputMethodInfo getPackageName
public String getPackageName()
From source file:Main.java
/** * Get {@link InputMethodInfo} of the IME specified by the package name. * CAVEAT: This may cause a round trip IPC. * * @param packageName package name of the IME. * @param imm the {@link InputMethodManager}. * @return the {@link InputMethodInfo} of the IME specified by the <code>packageName</code>, * or null if not found./*from w w w. j a va 2 s . co m*/ */ public static InputMethodInfo getInputMethodInfoOf(final String packageName, final InputMethodManager imm) { for (final InputMethodInfo imi : imm.getInputMethodList()) { if (packageName.equals(imi.getPackageName())) { return imi; } } return null; }
From source file:Main.java
/** * Check if the IME specified by the context is enabled. * CAVEAT: This may cause a round trip IPC. * * @param context package context of the IME to be checked. * @param imm the {@link InputMethodManager}. * @return true if this IME is enabled./*from w w w . j a v a2 s. co m*/ */ public static boolean isThisImeEnabled(final Context context, final InputMethodManager imm) { final String packageName = context.getPackageName(); for (final InputMethodInfo imi : imm.getEnabledInputMethodList()) { if (packageName.equals(imi.getPackageName())) { return true; } } return false; }
From source file:net.HeZi.Android.HeInputLibrary.HeInput_Activation_Fragment.java
private void updateUI() { boolean bActivated = false; boolean bDefaultKeyboard = false; boolean bDialectSelected = false; activeHeInputBtn.setEnabled(true);//from w w w . ja v a 2 s .co m selectDefaultMethodBtn.setEnabled(false); selectDefaultMethodBtn.setTextColor(Color.GRAY); selectChineseDialectBtn.setEnabled(false); selectChineseDialectBtn.setTextColor(Color.GRAY); //Check Activited //http://stackoverflow.com/questions/4210086/how-can-i-get-a-list-of-all-the-input-methods-and-their-names-that-are-install InputMethodManager imeManager = (InputMethodManager) getActivity().getApplicationContext() .getSystemService(Context.INPUT_METHOD_SERVICE); List<InputMethodInfo> InputMethods = imeManager.getEnabledInputMethodList(); for (InputMethodInfo item : InputMethods) { if (item.getPackageName().toLowerCase().equals(hostApplicationName.toLowerCase())) { bActivated = true; inputId = item.getId(); Log.d("Input Id: ", "InputId: " + inputId); setting_instruction.setText(getString(R.string.instruction_2_steps)); activeHeInputBtn.setEnabled(false); activeHeInputBtn.setTextColor(Color.GRAY); activeHeInputBtn.setText(getString(R.string.heInput_activated)); selectDefaultMethodBtn.setEnabled(true); selectDefaultMethodBtn.setTextColor(Color.RED); selectChineseDialectBtn.setEnabled(false); selectChineseDialectBtn.setTextColor(Color.GRAY); break; } } // Check default keyboard if (bActivated) { String defaultName = Settings.Secure.getString(getActivity().getContentResolver(), Settings.Secure.DEFAULT_INPUT_METHOD); if (defaultName.toLowerCase().contains(hostApplicationName.toLowerCase())) { bDefaultKeyboard = true; } } if (bActivated && bDefaultKeyboard) { setting_instruction.setText(getString(R.string.instruction_setting_done)); selectDefaultMethodBtn.setEnabled(false); selectDefaultMethodBtn.setTextColor(Color.GRAY); selectDefaultMethodBtn.setText(getString(R.string.heInput_is_default)); selectChineseDialectBtn.setEnabled(true); selectChineseDialectBtn.setTextColor(Color.RED); editText.setVisibility(View.VISIBLE); editText.requestFocus(); } }
From source file:org.awesomeapp.messenger.MainActivity.java
private void checkCustomFont() { if (Preferences.isLanguageTibetan()) { CustomTypefaceManager.loadFromAssets(this, true); } else {//from w w w . j a v a 2s .c o m InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); List<InputMethodInfo> mInputMethodProperties = imm.getEnabledInputMethodList(); final int N = mInputMethodProperties.size(); boolean loadTibetan = false; for (int i = 0; i < N; i++) { InputMethodInfo imi = mInputMethodProperties.get(i); //imi contains the information about the keyboard you are using if (imi.getPackageName().equals("org.ironrabbit.bhoboard")) { // CustomTypefaceManager.loadFromKeyboard(this); loadTibetan = true; break; } } CustomTypefaceManager.loadFromAssets(this, loadTibetan); } }
From source file:info.guardianproject.otr.app.im.app.NewChatActivity.java
private void checkCustomFont() { if (CustomTypefaceManager.getCurrentTypeface(this) == null) { InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); List<InputMethodInfo> mInputMethodProperties = imm.getEnabledInputMethodList(); final int N = mInputMethodProperties.size(); for (int i = 0; i < N; i++) { InputMethodInfo imi = mInputMethodProperties.get(i); //imi contains the information about the keyboard you are using if (imi.getPackageName().equals("org.ironrabbit.bhoboard")) { CustomTypefaceManager.loadFromKeyboard(this); break; }/*from w w w.ja v a 2 s . co m*/ } } }