android.view.textservice.TextServicesManager Java Examples

The following examples show how to use android.view.textservice.TextServicesManager. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SpellCheckerSessionBridge.java    From delion with Apache License 2.0 6 votes vote down vote up
/**
 * Constructs a SpellCheckerSessionBridge object as well as its SpellCheckerSession object.
 * @param nativeSpellCheckerSessionBridge Pointer to the native SpellCheckerSessionBridge.
 */
private SpellCheckerSessionBridge(long nativeSpellCheckerSessionBridge) {
    mNativeSpellCheckerSessionBridge = nativeSpellCheckerSessionBridge;

    Context context = ContextUtils.getApplicationContext();
    final TextServicesManager textServicesManager =
            (TextServicesManager) context.getSystemService(
                    Context.TEXT_SERVICES_MANAGER_SERVICE);

    // This combination of parameters will cause the spellchecker to be based off of
    // the language specified at "Settings > Language & input > Spell checker > Language".
    // If that setting is set to "Use system language" and the system language is not on the
    // list of supported spellcheck languages, this call will return null.  This call will also
    // return null if the user has turned spellchecking off at "Settings > Language & input >
    // Spell checker".
    mSpellCheckerSession = textServicesManager.newSpellCheckerSession(null, null, this, true);
}
 
Example #2
Source File: SpellCheckerSessionBridge.java    From 365browser with Apache License 2.0 6 votes vote down vote up
/**
 * Constructs a SpellCheckerSessionBridge object as well as its SpellCheckerSession object.
 * @param nativeSpellCheckerSessionBridge Pointer to the native SpellCheckerSessionBridge.
 */
private SpellCheckerSessionBridge(long nativeSpellCheckerSessionBridge) {
    mNativeSpellCheckerSessionBridge = nativeSpellCheckerSessionBridge;

    Context context = ContextUtils.getApplicationContext();
    final TextServicesManager textServicesManager =
            (TextServicesManager) context.getSystemService(
                    Context.TEXT_SERVICES_MANAGER_SERVICE);

    // This combination of parameters will cause the spellchecker to be based off of
    // the language specified at "Settings > Language & input > Spell checker > Language".
    // If that setting is set to "Use system language" and the system language is not on the
    // list of supported spellcheck languages, this call will return null.  This call will also
    // return null if the user has turned spellchecking off at "Settings > Language & input >
    // Spell checker".
    mSpellCheckerSession = textServicesManager.newSpellCheckerSession(null, null, this, true);
}
 
Example #3
Source File: SpellChecker.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
private void resetSession() {
    closeSession();

    mTextServicesManager = (TextServicesManager) mTextView.getContext().
            getSystemService(Context.TEXT_SERVICES_MANAGER_SERVICE);
    if (!mTextServicesManager.isSpellCheckerEnabled()
            || mCurrentLocale == null
            || mTextServicesManager.getCurrentSpellCheckerSubtype(true) == null) {
        mSpellCheckerSession = null;
    } else {
        mSpellCheckerSession = mTextServicesManager.newSpellCheckerSession(
                null /* Bundle not currently used by the textServicesManager */,
                mCurrentLocale, this,
                false /* means any available languages from current spell checker */);
        mIsSentenceSpellCheckSupported = true;
    }

    // Restore SpellCheckSpans in pool
    for (int i = 0; i < mLength; i++) {
        mIds[i] = -1;
    }
    mLength = 0;

    // Remove existing misspelled SuggestionSpans
    mTextView.removeMisspelledSpans((Editable) mTextView.getText());
    mSuggestionSpanCache.evictAll();
}
 
Example #4
Source File: ContextImpl.java    From AndroidComponentPlugin with Apache License 2.0 4 votes vote down vote up
public Object createService(ContextImpl ctx) {
    return TextServicesManager.getInstance();
}
 
Example #5
Source File: ContextImpl.java    From AndroidComponentPlugin with Apache License 2.0 4 votes vote down vote up
public Object createService(ContextImpl ctx) {
    return TextServicesManager.getInstance();
}
 
Example #6
Source File: ContextImpl.java    From AndroidComponentPlugin with Apache License 2.0 4 votes vote down vote up
public Object createService(ContextImpl ctx) {
    return TextServicesManager.getInstance();
}
 
Example #7
Source File: ContextImpl.java    From AndroidComponentPlugin with Apache License 2.0 4 votes vote down vote up
public Object createService(ContextImpl ctx) {
    return TextServicesManager.getInstance();
}
 
Example #8
Source File: ContextImpl.java    From AndroidComponentPlugin with Apache License 2.0 4 votes vote down vote up
public Object createService(ContextImpl ctx) {
    return TextServicesManager.getInstance();
}
 
Example #9
Source File: ContextImpl.java    From AndroidComponentPlugin with Apache License 2.0 4 votes vote down vote up
public Object createService(ContextImpl ctx) {
    return TextServicesManager.getInstance();
}
 
Example #10
Source File: ContextImpl.java    From AndroidComponentPlugin with Apache License 2.0 4 votes vote down vote up
public Object createService(ContextImpl ctx) {
    return TextServicesManager.getInstance();
}
 
Example #11
Source File: SystemServiceRegistry.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
@Override
public TextServicesManager createService() {
    return TextServicesManager.getInstance();
}
 
Example #12
Source File: ServiceUtil.java    From PowerFileExplorer with GNU General Public License v3.0 4 votes vote down vote up
@TargetApi(14)
public static TextServicesManager getTextServicesManager() {
    return (TextServicesManager) getSystemService(Context.TEXT_SERVICES_MANAGER_SERVICE);
}