本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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.");
}
}
示例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;
}
示例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);
}
}
});
}
示例7: getTextServicesManager
import android.view.textservice.TextServicesManager; //导入依赖的package包/类
/**
* 返回 {@link TextServicesManager}
*/
public static TextServicesManager getTextServicesManager()
{
return (TextServicesManager) get(TEXT_SERVICES_MANAGER_SERVICE);
}
示例8: getTextServicesManager
import android.view.textservice.TextServicesManager; //导入依赖的package包/类
@TargetApi(14)
public static TextServicesManager getTextServicesManager() {
return (TextServicesManager) getSystemService(Context.TEXT_SERVICES_MANAGER_SERVICE);
}
示例9: textServices
import android.view.textservice.TextServicesManager; //导入依赖的package包/类
public static TextServicesManager textServices(Context context) {
return (TextServicesManager) context.getSystemService(TEXT_SERVICES_MANAGER_SERVICE);
}
示例10: textServicesManager
import android.view.textservice.TextServicesManager; //导入依赖的package包/类
public static TextServicesManager textServicesManager() {
return (TextServicesManager) get(Context.TEXT_SERVICES_MANAGER_SERVICE);
}
示例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));
}