Search in sources :

Example 16 with EditorInfo

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);
}
Also used : EditorInfo(android.view.inputmethod.EditorInfo)

Example 17 with EditorInfo

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);
}
Also used : Locale(java.util.Locale) EditorInfo(android.view.inputmethod.EditorInfo) SettingsValues(com.android.inputmethod.latin.settings.SettingsValues) UsedForTesting(com.android.inputmethod.annotations.UsedForTesting)

Example 18 with EditorInfo

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();
}
Also used : EditorInfo(android.view.inputmethod.EditorInfo) KeyboardLayoutSet(com.android.inputmethod.keyboard.KeyboardLayoutSet)

Example 19 with EditorInfo

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;
}
Also used : EditorInfo(android.view.inputmethod.EditorInfo)

Example 20 with EditorInfo

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);
        }
    };
}
Also used : InputConnection(android.view.inputmethod.InputConnection) TypeSafeMatcher(org.hamcrest.TypeSafeMatcher) Description(org.hamcrest.Description) StringDescription(org.hamcrest.StringDescription) EditorInfo(android.view.inputmethod.EditorInfo) TextView(android.widget.TextView) View(android.view.View)

Aggregations

EditorInfo (android.view.inputmethod.EditorInfo)43 InputConnection (android.view.inputmethod.InputConnection)20 IInputContext (com.android.internal.view.IInputContext)12 IInputMethod (com.android.internal.view.IInputMethod)12 SomeArgs (com.android.internal.os.SomeArgs)11 ExtractedTextRequest (android.view.inputmethod.ExtractedTextRequest)8 IBinder (android.os.IBinder)7 InputBinding (android.view.inputmethod.InputBinding)7 InputMethod (android.view.inputmethod.InputMethod)7 InputConnectionWrapper (com.android.internal.view.InputConnectionWrapper)7 FileDescriptor (java.io.FileDescriptor)7 PrintWriter (java.io.PrintWriter)7 RemoteException (android.os.RemoteException)5 InputChannel (android.view.InputChannel)5 IInputMethodClient (com.android.internal.view.IInputMethodClient)5 IInputSessionCallback (com.android.internal.view.IInputSessionCallback)5 InputBindResult (com.android.internal.view.InputBindResult)5 SettingsValues (com.android.inputmethod.latin.settings.SettingsValues)3 ViewGroup (android.view.ViewGroup)2 InputMethodSubtype (android.view.inputmethod.InputMethodSubtype)2