use of android.view.inputmethod.EditorInfo in project android_packages_inputmethods_LatinIME by CyanogenMod.
the class InputLogic method getCurrentAutoCapsState.
/**
* Gets the current auto-caps state, factoring in the space state.
*
* This method tries its best to do this in the most efficient possible manner. It avoids
* getting text from the editor if possible at all.
* This is called from the KeyboardSwitcher (through a trampoline in LatinIME) because it
* needs to know auto caps state to display the right layout.
*
* @param settingsValues the relevant settings values
* @return a caps mode from TextUtils.CAP_MODE_* or Constants.TextUtils.CAP_MODE_OFF.
*/
public int getCurrentAutoCapsState(final SettingsValues settingsValues) {
if (!settingsValues.mAutoCap)
return Constants.TextUtils.CAP_MODE_OFF;
final EditorInfo ei = getCurrentInputEditorInfo();
if (ei == null)
return Constants.TextUtils.CAP_MODE_OFF;
final int inputType = ei.inputType;
// mSpaceState gets updated later, whoever called this may need to be told about it.
return mConnection.getCursorCapsMode(inputType, settingsValues.mSpacingAndPunctuations, SpaceState.PHANTOM == mSpaceState);
}
use of android.view.inputmethod.EditorInfo in project android_packages_inputmethods_LatinIME by CyanogenMod.
the class LatinIME method loadSettings.
// Has to be package-visible for unit tests
@UsedForTesting
void loadSettings() {
final Locale locale = mRichImm.getCurrentSubtypeLocale();
final EditorInfo editorInfo = getCurrentInputEditorInfo();
final InputAttributes inputAttributes = new InputAttributes(editorInfo, isFullscreenMode(), getPackageName());
mSettings.loadSettings(this, locale, inputAttributes);
final SettingsValues currentSettingsValues = mSettings.getCurrent();
AudioAndHapticFeedbackManager.getInstance().onSettingsChanged(currentSettingsValues);
// asynchronously loaded.
if (!mHandler.hasPendingReopenDictionaries()) {
resetDictionaryFacilitator(locale);
}
refreshPersonalizationDictionarySession(currentSettingsValues);
resetDictionaryFacilitatorIfNecessary();
mStatsUtilsManager.onLoadSettings(this, /* context */
currentSettingsValues);
}
use of android.view.inputmethod.EditorInfo in project android_packages_inputmethods_LatinIME by CyanogenMod.
the class AndroidSpellCheckerService method createKeyboardSetForSpellChecker.
private KeyboardLayoutSet createKeyboardSetForSpellChecker(final InputMethodSubtype subtype) {
final EditorInfo editorInfo = new EditorInfo();
editorInfo.inputType = InputType.TYPE_CLASS_TEXT;
final KeyboardLayoutSet.Builder builder = new KeyboardLayoutSet.Builder(this, editorInfo);
builder.setKeyboardGeometry(SPELLCHECKER_DUMMY_KEYBOARD_WIDTH, SPELLCHECKER_DUMMY_KEYBOARD_HEIGHT);
builder.setSubtype(RichInputMethodSubtype.getRichInputMethodSubtype(subtype));
builder.setIsSpellChecker(true);
builder.disableTouchPositionCorrectionData();
return builder.build();
}
use of android.view.inputmethod.EditorInfo in project wifikeyboard by IvanVolosyuk.
the class WiFiInputMethod method shouldSend.
private boolean shouldSend() {
if (pressedKeys.contains(KEY_CONTROL)) {
// Log.d("ivan", "Control pressed");
return true;
}
EditorInfo editorInfo = getCurrentInputEditorInfo();
if (editorInfo == null) {
// Log.d("ivan", "No editor info");
return false;
}
if ((editorInfo.inputType & InputType.TYPE_CLASS_TEXT) == 0) {
// Log.d("ivan", "Not text, sending enter");
return false;
}
if ((editorInfo.inputType & InputType.TYPE_TEXT_FLAG_MULTI_LINE) != 0) {
// Log.d("ivan", "Multi-line, sending ordinary enter");
return false;
}
int action = editorInfo.imeOptions & EditorInfo.IME_MASK_ACTION;
if (action == EditorInfo.IME_ACTION_NONE || action == EditorInfo.IME_ACTION_DONE) {
// Log.d("ivan", "No useful action, sending enter");
return false;
}
// Log.d("ivan", "Useful action to be performed");
return true;
}
use of android.view.inputmethod.EditorInfo in project double-espresso by JakeWharton.
the class ViewMatchers method hasImeAction.
/**
* Returns a matcher that matches views that support input methods (e.g. EditText) and have the
* specified IME action set in its {@link EditorInfo}.
*
* @param imeActionMatcher a matcher for the IME action
*/
public static Matcher<View> hasImeAction(final Matcher<Integer> imeActionMatcher) {
return new TypeSafeMatcher<View>() {
@Override
public void describeTo(Description description) {
description.appendText("has ime action: ");
imeActionMatcher.describeTo(description);
}
@Override
public boolean matchesSafely(View view) {
EditorInfo editorInfo = new EditorInfo();
InputConnection inputConnection = view.onCreateInputConnection(editorInfo);
if (inputConnection == null) {
return false;
}
int actionId = editorInfo.actionId != 0 ? editorInfo.actionId : editorInfo.imeOptions & EditorInfo.IME_MASK_ACTION;
return imeActionMatcher.matches(actionId);
}
};
}
Aggregations