当前位置: 首页>>代码示例>>Java>>正文


Java TextServicesManager类代码示例

本文整理汇总了Java中android.view.textservice.TextServicesManager的典型用法代码示例。如果您正苦于以下问题:Java TextServicesManager类的具体用法?Java TextServicesManager怎么用?Java TextServicesManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


TextServicesManager类属于android.view.textservice包,在下文中一共展示了TextServicesManager类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: SpellCheckerSessionBridge

import android.view.textservice.TextServicesManager; //导入依赖的package包/类
/**
 * 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 = ApplicationStatus.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);
}
 
开发者ID:Smalinuxer,项目名称:Vafrinn,代码行数:21,代码来源:SpellCheckerSessionBridge.java

示例2: SpellCheckerSessionBridge

import android.view.textservice.TextServicesManager; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:21,代码来源:SpellCheckerSessionBridge.java

示例3: onCreate

import android.view.textservice.TextServicesManager; //导入依赖的package包/类
/**
 * Main initialization of the input method component. Be sure to call
 * to super class.
 */

@Override public void onCreate() {
    super.onCreate();
    mInputMethodManager = (InputMethodManager)getSystemService(INPUT_METHOD_SERVICE);
    mWordSeparators = getResources().getString(R.string.word_separators);
    final TextServicesManager tsm = (TextServicesManager) getSystemService(
            Context.TEXT_SERVICES_MANAGER_SERVICE);
    mScs = tsm.newSpellCheckerSession(null, null, this, true);
}
 
开发者ID:VladThodo,项目名称:behe-keyboard,代码行数:14,代码来源:PCKeyboard.java

示例4: onResume

import android.view.textservice.TextServicesManager; //导入依赖的package包/类
@Override
public void onResume() {
    super.onResume();
    final TextServicesManager tsm = (TextServicesManager) getSystemService(
            Context.TEXT_SERVICES_MANAGER_SERVICE);
    mScs = tsm.newSpellCheckerSession(null, null, this, true);

    if (mScs != null) {
        // Instantiate TextInfo for each query
        // TextInfo can be passed a sequence number and a cookie number to identify the result
        if (isSentenceSpellCheckSupported()) {
            // Note that getSentenceSuggestions works on JB or later.
            Log.d(TAG, "Sentence spellchecking supported.");
            mScs.getSentenceSuggestions(new TextInfo[] {new TextInfo("tgisis")}, 3);
            mScs.getSentenceSuggestions(new TextInfo[] {new TextInfo(
                    "I wold like to here form you")}, 3);
            mScs.getSentenceSuggestions(new TextInfo[] {new TextInfo("hell othere")}, 3);
        } else {
            // Note that getSuggestions() is a deprecated API.
            // It is recommended for an application running on Jelly Bean or later
            // to call getSentenceSuggestions() only.
            mScs.getSuggestions(new TextInfo("tgis"), 3);
            mScs.getSuggestions(new TextInfo("hllo"), 3);
            mScs.getSuggestions(new TextInfo("helloworld"), 3);
        }
    } else {
        Log.e(TAG, "Couldn't obtain the spell checker service.");
    }
}
 
开发者ID:sdrausty,项目名称:buildAPKsSamples,代码行数:30,代码来源:HelloSpellCheckerActivity.java

示例5: updateTextServicesLocaleLocked

import android.view.textservice.TextServicesManager; //导入依赖的package包/类
private void updateTextServicesLocaleLocked() {
    final TextServicesManager textServicesManager = (TextServicesManager)
            mContext.getSystemService(Context.TEXT_SERVICES_MANAGER_SERVICE);
    final SpellCheckerSubtype subtype = textServicesManager.getCurrentSpellCheckerSubtype(true);
    final Locale locale;
    if (subtype != null) {
        locale = SpellCheckerSubtype.constructLocaleFromString(subtype.getLocale());
    } else {
        locale = null;
    }
    mCurrentSpellCheckerLocaleCache = locale;
}
 
开发者ID:AungThiha,项目名称:Tada,代码行数:13,代码来源:TextView.java

示例6: onCreate

import android.view.textservice.TextServicesManager; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.spellchecker);
	check = (Button) findViewById(R.id.checkerbuttoncheck);
	checktext = (EditText) findViewById(R.id.checkeredittext);
	suggestbox = (TextView) findViewById(R.id.checkersuggestview);
	rightbox = (TextView) findViewById(R.id.righttext);
	preferences = this.getSharedPreferences("team7663.project.camword",Context.MODE_PRIVATE);
	preferences.edit().putBoolean("team7663.project.camword.OCR.mainoff",true).apply();
	checktext.setText(preferences.getString("team7663.project.camword.OCR.savespell",""));
	TextServicesManager tsm = (TextServicesManager) getSystemService(Context.TEXT_SERVICES_MANAGER_SERVICE);
	scs = tsm.newSpellCheckerSession(null,null, SpellChecker.this,true);
	MainActivity.spell.setBackgroundResource(R.drawable.spell);
	check.setOnClickListener(new View.OnClickListener() {
		
		
		@SuppressWarnings("deprecation")
		@Override
		public void onClick(View v){
			value = checktext.getText().toString();
			rightbox.setText("");
			if(value.isEmpty()==false)
			{
			scs.getSuggestions(new TextInfo(value), 5);
			}
			}
	});
   }
 
开发者ID:zoebchhatriwala,项目名称:CamWord,代码行数:30,代码来源:SpellChecker.java

示例7: getTextServicesManager

import android.view.textservice.TextServicesManager; //导入依赖的package包/类
/**
 * 返回 {@link TextServicesManager}
 */
public static TextServicesManager getTextServicesManager()
{
    return (TextServicesManager) get(TEXT_SERVICES_MANAGER_SERVICE);
}
 
开发者ID:Ayvytr,项目名称:EasyAndroid,代码行数:8,代码来源:Managers.java

示例8: getTextServicesManager

import android.view.textservice.TextServicesManager; //导入依赖的package包/类
@TargetApi(14)
public static TextServicesManager getTextServicesManager() {
    return (TextServicesManager) getSystemService(Context.TEXT_SERVICES_MANAGER_SERVICE);
}
 
开发者ID:simplesoft-duongdt3,项目名称:Android-App-Template,代码行数:5,代码来源:ServiceUtil.java

示例9: textServices

import android.view.textservice.TextServicesManager; //导入依赖的package包/类
public static TextServicesManager textServices(Context context) {
    return (TextServicesManager) context.getSystemService(TEXT_SERVICES_MANAGER_SERVICE);
}
 
开发者ID:pushbit,项目名称:sprockets-android,代码行数:4,代码来源:Managers.java

示例10: textServicesManager

import android.view.textservice.TextServicesManager; //导入依赖的package包/类
public static TextServicesManager textServicesManager() {
    return (TextServicesManager) get(Context.TEXT_SERVICES_MANAGER_SERVICE);
}
 
开发者ID:shkschneider,项目名称:android_Skeleton,代码行数:4,代码来源:SystemServices.java

示例11: getTextServicesManager

import android.view.textservice.TextServicesManager; //导入依赖的package包/类
/**
 * Obtain a {@link TextServicesManager} instance associated with specified {@link Context}
 *
 * @param context Context
 * @return {@link TextServicesManager} associated with specified {@link Context}
 * @throws InvalidContextException if {@link TextServicesManager} can't be obtained
 *                                 from specified {@link Context}
 */
@NonNull
public static TextServicesManager getTextServicesManager(@NonNull Context context) {
    return validate(context.getSystemService(Context.TEXT_SERVICES_MANAGER_SERVICE));
}
 
开发者ID:yuriy-budiyev,项目名称:android-wheels,代码行数:13,代码来源:ContextUtils.java


注:本文中的android.view.textservice.TextServicesManager类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。