aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
diff options
context:
space:
mode:
authorYohei Yukawa <yukawa@google.com>2014-08-26 21:32:25 -0700
committerYohei Yukawa <yukawa@google.com>2014-08-27 01:30:45 -0700
commit29200b0abe1d65aa2f9ddefd247ab91563d666f8 (patch)
tree1d320bc3795fb4e793e2a006456769c395553fc0 /java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
parenta475c85480b2bc2a8d036b4b1ea29f6a8e749ac5 (diff)
downloadlatinime-29200b0abe1d65aa2f9ddefd247ab91563d666f8.tar.gz
latinime-29200b0abe1d65aa2f9ddefd247ab91563d666f8.tar.xz
latinime-29200b0abe1d65aa2f9ddefd247ab91563d666f8.zip
Set the text bgcolor only when CursorAnchorInfo is available
When CursorAnchorInfo is unavailable, we shouldn't try to show the commit indicator and set the text highlight color. With this CL, RichInputConnection can be used to track if the application responded that it does support CursorAnchorInfo or not. This result will be taken into consideration when InputLogic needs to determine whether the commit indicator should be displayed or not. Change-Id: I945d70eeb02a7a5f3d9b22459b23d7028508910f
Diffstat (limited to 'java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java')
-rw-r--r--java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java21
1 files changed, 18 insertions, 3 deletions
diff --git a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
index e83f494b3..de62f9786 100644
--- a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
+++ b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
@@ -50,6 +50,7 @@ import com.android.inputmethod.latin.SuggestedWords;
import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo;
import com.android.inputmethod.latin.WordComposer;
import com.android.inputmethod.latin.define.DebugFlags;
+import com.android.inputmethod.latin.define.ProductionFlags;
import com.android.inputmethod.latin.settings.SettingsValues;
import com.android.inputmethod.latin.settings.SettingsValuesForSuggestion;
import com.android.inputmethod.latin.settings.SpacingAndPunctuations;
@@ -140,8 +141,9 @@ public final class InputLogic {
* Call this when input starts or restarts in some editor (typically, in onStartInputView).
*
* @param combiningSpec the combining spec string for this subtype
+ * @param settingsValues the current settings values
*/
- public void startInput(final String combiningSpec) {
+ public void startInput(final String combiningSpec, final SettingsValues settingsValues) {
mEnteredText = null;
mWordComposer.restartCombining(combiningSpec);
resetComposingState(true /* alsoResetLastComposedWord */);
@@ -159,15 +161,24 @@ public final class InputLogic {
} else {
mInputLogicHandler.reset();
}
+
+ if (ProductionFlags.ENABLE_CURSOR_ANCHOR_INFO_CALLBACK) {
+ // AcceptTypedWord feature relies on CursorAnchorInfo.
+ if (settingsValues.mShouldShowUiToAcceptTypedWord) {
+ mConnection.requestUpdateCursorAnchorInfo(true /* enableMonitor */,
+ true /* requestImmediateCallback */);
+ }
+ }
}
/**
* Call this when the subtype changes.
* @param combiningSpec the spec string for the combining rules
+ * @param settingsValues the current settings values
*/
- public void onSubtypeChanged(final String combiningSpec) {
+ public void onSubtypeChanged(final String combiningSpec, final SettingsValues settingsValues) {
finishInput();
- startInput(combiningSpec);
+ startInput(combiningSpec, settingsValues);
}
/**
@@ -2238,6 +2249,10 @@ public final class InputLogic {
*/
private boolean shouldShowCommitIndicator(final SuggestedWords suggestedWords,
final SettingsValues settingsValues) {
+ if (!mConnection.isCursorAnchorInfoMonitorEnabled()) {
+ // We cannot help in this case because we are heavily relying on this new API.
+ return false;
+ }
if (!settingsValues.mShouldShowUiToAcceptTypedWord) {
return false;
}