A bus for event notifications.
The eventBus instance can be retrieved only from the KeyboardService after calling super.onCreate.
Event | Description |
---|---|
configurationEvent | A publisher for configuration related events |
dictionaryEvent | A publisher for dictionary related events |
engineEvent | A publisher for engine related events |
monitorEvent | A publisher for monitor related events |
serviceEvent | A publisher for service related events |
activityEvent | A publisher for activity related events |
predictionsEvent | A publisher for prediction events |
genericDataEvent | A publisher for generic data events |
eventBasedDataCapture | A publisher for event based data capture events |
Example:
eventBus.configuration.subscribe {
when (it) {
is ConfigurationEvent.CurrentLanguageChanged -> {
mySettings.setCurrentLanguage(it.locale)
}
}
}
A ConfigurationEvent is sent every time a user makes a configuration change on the keyboard through gestures or buttons. It is advised to store the configuration change in permanent storage, such as SharedPreferences and use that value in the createConfiguration method of the KeyboardService.
CurrentLanguageChanged | The user switched to another language. |
AutoCorrectionChanged | The user toggled the auto correction setting. |
LanguageNotAvailable | The engine failed to load a language. |
Inherits from ConfigurationEvent.
The user switched to another language from the list of userLanguages provided in the LanguageConfiguration.
data class CurrentLanguageChanged(val locale: String)
Fields:
Name | Type | Description |
---|---|---|
locale | String | The locale of the language that the user switched to. |
Inherits from ConfigurationEvent.
The user toggled the auto correction.
data class AutoCorrectionChanged(val enabled: Boolean)
Fields:
Name | Type | Description |
---|---|---|
enabled | Boolean | Whether the auto correction has been enabled or not. |
Inherits from ConfigurationEvent.
An attempt to load a new language has failed and is not recoverable. The next language in the list of userLanguages will be loaded, falling back to the default language (en-US) when the list of available languages is empty.
Notes:
data class LanguageNotAvailable(val brokenLocale: String, val nextLocale: String)
Fields:
Name | Type | Description |
---|---|---|
brokenLocale | String | The locale of the language that was not loaded. |
nextLocale | String | The locale of the language that was loaded after the failed attempt. |
A DictionaryEvent is sent every time a user makes a change to the user dictionary. Chnages can happen via the suggestion gestures to add or remove a word, or via automatic learning when the user corrects words manually.
AddUserWord | The user added a word to their dictionary. |
RemoveUserWord | The user removed a word from their dictionary. |
AutoLearnedWord | The engine learned a new user word automatically. |
Inherits from ConfigurationEvent.
The user added a new word to their dictionary.
data class AddUserWord(val word: String)
Name | Type | Description |
---|---|---|
word | String | The word that the user added |
Inherits from ConfigurationEvent.
The user removed a word from their dictionary.
data class RemoveUserWord(val word: String)
Name | Type | Description |
---|---|---|
word | String | The word that the user removed |
Inherits from ConfigurationEvent.
The engine learned a new user word automatically. This event is sent when the user changes an autocorrected word.
data class AutoLearnedWord(val word: String)
Name | Type | Description |
---|---|---|
word | String | The word that the engine has learned automatically. |
An EngineEvent is sent when the engine has a new tracking message, usually for debugging purposes, when tracking is enabled in the PrivacyConfiguration.
MessageReceived | The engine has sent a message for debugging purposes. |
ReportAnalytics | The engine has sent an analytics report related to autocorrection. |
Inherits from EngineEvent.
The engine sent a tracking message.
data class MessageReceived(val message: String)
Name | Type | Description |
---|---|---|
message | String | The contents of the message. |
Inherits from EngineEvent.
The engine sent an AC analytics report.
data class ReportAnalytics(
val languageCode: String?,
val none: Int,
val missingSpace: Int,
val missTypedSpace: Int,
val eliminated: Int,
val transposition: Int,
val missingTaps: Int,
val others: Int
)
Name | Type | Description |
---|---|---|
languageCode | String? | The language code that the report is intended for. |
none | Int | Number of words not corrected |
missingSpace | Int | Number of corrections done due to missing a space |
missTypedSpace | Int | Number of corrections done due to typing an unwanted space |
eliminated | Int | Number of corrections done to eliminate characters |
transposition | Int | Number of corrections done by changing order or characters |
missingTaps | Int | Number of corrections done when a word misses taps (characters) |
others | Int | Number of corrections not related to all other cases. This includes those corrected directly from the dictionary and other outcome types. |
A MonitorEvent is sent when the content extraction is enabled via the MonitorConfiguration.
PartialExtraction | The underlying editor sent a partial extraction |
TextExtraction | The underlying editor sent a non-partial extraction. |
ComposingExtraction | The engine sent a composition operation |
ComposingCorrection | The engine sent a composition correction operation |
Input | A soft input has been performed. |
EditorChanged | The current editor has changed within the keyboard. |
Inherits from MonitorEvent.
The underlying editor sent a partial extraction. This event is sent when the extraction mode is set to EXTRACTED.
data class PartialExtraction(
val text: CharSequence,
val startOffset: Int,
val partialStartOffset: Int,
val partialEndOffset: Int
)
Name | Type | Description |
---|---|---|
text | CharSequence | The contents of the partial extracted text. |
startOffset | Int | The starting position within the content. |
partialStartOffset | Int | The starting position after the startOffset where the partial extraction occurs. |
partialEndOffset | Int | The final position after the startOffset where the partial extraction occurs. |
Inherits from MonitorEvent.
When the extraction mode is set to EXTRACTED, the underlying editor sends a non-partial extraction. When the extraction mode is set to AGGREGATE, the extracted text from the underlying editor has been aggregated. It is then sent as a complete text extraction.
data class TextExtraction(
val text: CharSequence,
val startOffset: Int,
val partialStartOffset: Int,
val partialEndOffset: Int
)
Name | Type | Description |
---|---|---|
text | CharSequence | The contents of the extracted text. |
startOffset | Int | The starting position within the content. In aggregate extraction mode, this value is always 0. |
Inherits from MonitorEvent.
When composing is enabled in the MonitorConfiguration, engine composing operations are delivered as events.
Notes:
data class ComposingExtraction(
val text: CharSequence,
val start: Int,
val end: Int
)
Name | Type | Description |
---|---|---|
text | CharSequence | The contents of the current composition. |
start | Int | The starting position of the current composition |
end | Int | The end position of the current composition |
Inherits from MonitorEvent.
When an auto correction is triggered during a composition, an event is sent with the correction and the previous text is used.
data class ComposingCorrection(
val corrected: CharSequence,
val original: CharSequence
)
Name | Type | Description |
---|---|---|
corrected | CharSequence | The corrected composition that replaced the original composition |
original | CharSequence | The original composition that has been replaced |
end | Int | The end position of the current composition |
Inherits from MonitorEvent.
When a soft input operation has been performed, such as tapping a letter or spacebar button, an Input event is set, only when MonitorConfiguration has been configured to emit these events. See InputValidator for details on what labels and key codes are sent.
Note:
data class Input(
val label: String,
val keyCode: Int,
val startTimestamp: Long,
val endTimestamp: Long
)
Name | Type | Description |
---|---|---|
label | String | The label of the key or button pressed |
keyCode | Int | The code point for the key or button pressed |
startTimestamp | Long | Timestamp of the start of the event, in milliseconds |
endTimestamp | Long | Timestamp of the end of the event, in milliseconds |
Inherits from MonitorEvent.
When a user switches to a temporary editor (i.e. search box inside a keyboard app), an EditorChanged event is sent with the full contents of the current editor.
Note:
data class EditorChanged(
val text: String
)
Name | Type | Description |
---|---|---|
text | String | The contents of the new editor when the keyboard switched between the main editable and a temporary editable inside a keyboard app. |
A ServiceEvent is a propagated event that the keyboard service receives.
PackageNameChanged | The keyboard service has been opened in a new application. |
CurrentThemeChanged | The keyboard service has received and performed a theme change. |
WindowInsetsChanged | The keyboard service has received and performed a window insets change. |
Inherits from ServiceEvent.
The engine has received new editor information for a new application package.
data class PackageNameChanged(val packageName: String)
Name | Type | Description |
---|---|---|
packageName | String | The new package name. |
Inherits from ServiceEvent.
The engine has received and processed a theme change request.
data class CurrentThemeChanged(val theme: KeyboardTheme)
Name | Type | Description |
---|---|---|
theme | KeyboardTheme | The new theme that has been applied. |
Inherits from ServiceEvent.
The engine has received and processed a window insets change request.
data class WindowInsetsChanged(val windowInsets: KeyboardInsets)
Name | Type | Description |
---|---|---|
windowInsets | KeyboardInsets | The new insets applied to the keyboard window. Note: this does not include the configured keyboard insets that are set in the KeyboardConfiguration. |
An ActivityEvent is used to report user actions.
KeyboardAction | A button or gesture performed on the keyboard layout. |
LanguageChanged | The user changed the language via a gesture. |
EmojiSent | The user selected an emoji from the emoji panel. |
KeyboardShown | The keyboard became visible. |
KeyboardHidden | The keyboard was hidden. |
MagicHold | The user pressed the magic button. |
Prediction | The user tapped on a prediction. |
Inherits from ActivityEvent
The user performed an action or gesture on the keyboard.
data class KeyboardAction(val type: ActionType) : ActivityEvent() {
enum class ActionType {
BACKSPACE,
SPACEBAR,
MICROPHONE,
SWIPE_LEFT,
SWIPE_RIGHT,
PUNCTUATION_HOLD,
SHIFT_HOLD,
SHOW_EMOJIS,
SHOW_STT,
SHOW_TRACKPAD,
HIDE_EMOJIS,
HIDE_TRACKPAD,
HIDE_STT
}
}
Name | Type | Description |
---|---|---|
type | ActionType | The action performed |
Inherits from ActivityEvent
The user performed a language change via a gesture.
data class LanguageChanged(val locale: String) : ActivityEvent()
Name | Type | Description |
---|---|---|
locale | String | The locale of the new selected language |
Inherits from ActivityEvent
The user selected an emoji from the emoji panel. The variationSource field determines the base emoji, if any, which should be used when sending the emoji variations configuration.
data class EmojiSent(
val emoji: String,
val variationSource: String? = null
) : ActivityEvent()
Name | Type | Description |
---|---|---|
emoji | String | The emoji that has been selected |
variationSource | String | The variation source, if any, of the selected emoji. |
Inherits from ActivityEvent
An event sent every time the input view becomes visible.
data class KeyboardShown(val start: Long) : ActivityEvent()
Name | Type | Description |
---|---|---|
start | Long | The current system timestamp, in milliseconds. |
Inherits from ActivityEvent
An event which is sent every time the input view is hidden.
data class KeyboardHidden(
val start: Long,
val end: Long,
val duration: Long
) : ActivityEvent()
Name | Type | Description |
---|---|---|
start | Long | The system timestamp identifying when the keyboard became visible, in milliseconds. |
end | Long | |
duration | Long | The duration that the view was kept visible, in milliseconds. |
Inherits from ActivityEvent
An event sent every time the user holds down the magic button.
data class MagicHold(val icon: Icon) : ActivityEvent()
Name | Type | Description |
---|---|---|
icon | Icon | The icon that was configured for the magic button. |
Inherits from ActivityEvent
An event sent every time the user taps on a word or emoji prediction.
sealed class Prediction : ActivityEvent() {
data class Emoji(val emoji: String) : Prediction()
data class Word(val word: String) : Prediction()
}
Name | Type | Description |
---|---|---|
Emoji(emoji) | String | The emoji prediction content that was selected. |
Word(word) | String | The word prediction content that was selected. |
A PredictionEvent is a propagated event for the predictions being displayed.
Note:
Suggestions | A list of suggested words for the previous word. |
CurrentWordPredictions | A list of suggested words for the current word. |
HighlightSuggestions | A list of suggested words for the next word. |
Inherits from PredictionEvent
The engine has received a list of suggestions for the previous word.
data class Suggestions(
val suggestions: List<String>,
val selectedIndex: Int,
val type: Int
)
Name | Type | Description |
---|---|---|
suggestions | List |
The suggested words |
selectedIndex | Int | The current selected index when using suggestion gestures. |
type | Int | The type of suggested words |
Type can be any of:
Inherits from PredictionEvent
The engine has received a list of suggestions for the current word.
data class CurrentWordPredictions(val predictions: List<Pair<String, Int>>)
Name | Type | Description |
---|---|---|
predictions | List<Pair<String, Int>> | A list of pairs of prediction word and type |
Type of a prediction can be any of:
Inherits from PredictionEvent
The engine has received a list of suggestions and highlights for the next word or service.
data class Suggestions(val enumType: String?, val jsonString: String?)
Name | Type | Description |
---|---|---|
enumType | String | The type of suggestions |
jsonString | String | A json encoded list of suggestions |
enumType can be any of:
A GenericDataEvent is an event for the data captured during the session.
Session | Emit an event when the sdk has received a session data. |
SessionStarted | Emit an event when the sdk has started a new session. |
SessionEnded | Emit an event when the sdk has ended an existing session. |
SessionStored | Emit an event when the sdk has stored a session data. |
This event is emitted when the SDK has received a session data. It includes the data received.
This event is emitted when the SDK has started a new session. It includes the sessionId of the started event.
This event is emitted when the SDK has ended an existing session. It includes the sessionId of the event that has ended.
This event is emitted when the SDK has stored a session data. It includes the path where the data is stored.
An event that reports when the data capture system has data to report. In order to receive data you should do:
All these events should be subscribed as any other event. An example on how to use these events is provided in our github repository.
SessionUpdateCaptureEvent | Emit an event when the data in the session update has changed. |
KeyStrokeCaptureEvent | Emit an event when a key stroke has been pressed. (it reportes after the touch ends.) |
WordCaptureEvent | Emit an event when the last word has been added. |
DeleteCaptureEvent | Emit an event when a delete event has been triggered. |
SwipeCaptureEvent | Emit an event when swipe data has been created. |
KeyPlaneCaptureEvent | Emit an event when the key plane has changed. |
StressUpdateCaptureEvent | Emit an event when the stress data has been updated. |
Emit this event every time the data of the session has changed.
The data of this event is equal for Android and iOS. Check it here the data content.
Emit an event when a key stroke has been pressed. The event is emitted when the touch ends and the system has processed it.
The data of this event is equal for Android and iOS. Check it here the data content.
Emit an event when the last word has been added. This means that a space after a word has been inserted, a predictions has been pressed or the autocorrection has changed the word for another one.
The data of this event is equal for Android and iOS. Check it here the data content.
Emit an event when a delete event has been triggered.
The data of this event is equal for Android and iOS. Check it here the data content.
Emit an event when swipe data has been created.
After the end-user finishes the swipe typing and the word is added in the edittext
.
The data of this event is equal for Android and iOS. Check it here the data content.
Emit an event when the key plane has changed. Note that the keyplane might change automatically depending on the keys that you press.
The data of this event is equal for Android and iOS. Check it here the data content.
Emit an event when the stress data has been updated.
The data of this event is equal for Android and iOS. Check it here the data content.