Session
abstract class Session
kotlin.Any | |
↳ | android.service.textservice.SpellCheckerService.Session |
This abstract class should be overridden by a concrete implementation of a spell checker.
Summary
Public constructors | |
---|---|
Session() |
Public methods | |
---|---|
open Bundle! | |
open String! | |
open Int |
Returns result attributes supported for this session. |
open Unit |
onCancel() Request to abort all tasks executed in SpellChecker. |
open Unit |
onClose() Request to close this session. |
abstract Unit |
onCreate() This is called after the class is initialized, at which point it knows it can call getLocale() etc. |
open Array<SentenceSuggestionsInfo!>! |
onGetSentenceSuggestionsMultiple(textInfos: Array<TextInfo!>!, suggestionsLimit: Int) Get sentence suggestions for specified texts in an array of TextInfo. |
abstract SuggestionsInfo! |
onGetSuggestions(textInfo: TextInfo!, suggestionsLimit: Int) Get suggestions for specified text in TextInfo. |
open Array<SuggestionsInfo!>! |
onGetSuggestionsMultiple(textInfos: Array<TextInfo!>!, suggestionsLimit: Int, sequentialWords: Boolean) A batch process of onGetSuggestions. |
Public constructors
Session
Session()
Public methods
getBundle
open fun getBundle(): Bundle!
Return | |
---|---|
Bundle! |
Bundle for this session |
getLocale
open fun getLocale(): String!
Return | |
---|---|
String! |
Locale for this session |
getSupportedAttributes
open fun getSupportedAttributes(): Int
Returns result attributes supported for this session.
The session implementation should not set attributes that are not included in the return value of getSupportedAttributes()
when creating SuggestionsInfo
.
Return | |
---|---|
Int |
The supported result attributes for this session Value is either 0 or a combination of android.view.textservice.SuggestionsInfo#RESULT_ATTR_IN_THE_DICTIONARY , android.view.textservice.SuggestionsInfo#RESULT_ATTR_LOOKS_LIKE_TYPO , android.view.textservice.SuggestionsInfo#RESULT_ATTR_HAS_RECOMMENDED_SUGGESTIONS , android.view.textservice.SuggestionsInfo#RESULT_ATTR_LOOKS_LIKE_GRAMMAR_ERROR , and android.view.textservice.SuggestionsInfo#RESULT_ATTR_DONT_SHOW_UI_FOR_SUGGESTIONS |
onCancel
open fun onCancel(): Unit
Request to abort all tasks executed in SpellChecker. This function will run on the incoming IPC thread. So, this is not called on the main thread, but will be called in series on another thread.
onClose
open fun onClose(): Unit
Request to close this session. This function will run on the incoming IPC thread. So, this is not called on the main thread, but will be called in series on another thread.
onCreate
abstract fun onCreate(): Unit
This is called after the class is initialized, at which point it knows it can call getLocale() etc...
onGetSentenceSuggestionsMultiple
open fun onGetSentenceSuggestionsMultiple(
textInfos: Array<TextInfo!>!,
suggestionsLimit: Int
): Array<SentenceSuggestionsInfo!>!
Get sentence suggestions for specified texts in an array of TextInfo. The default implementation splits the input text to words and returns SentenceSuggestionsInfo
which contains suggestions for each word. This function will run on the incoming IPC thread. So, this is not called on the main thread, but will be called in series on another thread. When you override this method, make sure that suggestionsLimit is applied to suggestions that share the same start position and length.
Parameters | |
---|---|
textInfos |
Array<TextInfo!>!: an array of the text metadata |
suggestionsLimit |
Int: the maximum number of suggestions to be returned |
Return | |
---|---|
Array<SentenceSuggestionsInfo!>! |
an array of SentenceSuggestionsInfo returned by SpellCheckerService.Session.onGetSuggestions(TextInfo, int) |
onGetSuggestions
abstract fun onGetSuggestions(
textInfo: TextInfo!,
suggestionsLimit: Int
): SuggestionsInfo!
Get suggestions for specified text in TextInfo. This function will run on the incoming IPC thread. So, this is not called on the main thread, but will be called in series on another thread.
Parameters | |
---|---|
textInfo |
TextInfo!: the text metadata |
suggestionsLimit |
Int: the maximum number of suggestions to be returned |
Return | |
---|---|
SuggestionsInfo! |
SuggestionsInfo which contains suggestions for textInfo |
onGetSuggestionsMultiple
open fun onGetSuggestionsMultiple(
textInfos: Array<TextInfo!>!,
suggestionsLimit: Int,
sequentialWords: Boolean
): Array<SuggestionsInfo!>!
A batch process of onGetSuggestions. This function will run on the incoming IPC thread. So, this is not called on the main thread, but will be called in series on another thread.
Parameters | |
---|---|
textInfos |
Array<TextInfo!>!: an array of the text metadata |
suggestionsLimit |
Int: the maximum number of suggestions to be returned |
sequentialWords |
Boolean: true if textInfos can be treated as sequential words. |
Return | |
---|---|
Array<SuggestionsInfo!>! |
an array of SentenceSuggestionsInfo returned by SpellCheckerService.Session.onGetSuggestions(TextInfo, int) |