diff options
Diffstat (limited to 'java/src/com/android/inputmethod/latin')
-rw-r--r-- | java/src/com/android/inputmethod/latin/DebugSettings.java | 11 | ||||
-rw-r--r-- | java/src/com/android/inputmethod/latin/LatinIME.java | 7 |
2 files changed, 15 insertions, 3 deletions
diff --git a/java/src/com/android/inputmethod/latin/DebugSettings.java b/java/src/com/android/inputmethod/latin/DebugSettings.java index 731b9baf5..989451b1c 100644 --- a/java/src/com/android/inputmethod/latin/DebugSettings.java +++ b/java/src/com/android/inputmethod/latin/DebugSettings.java @@ -16,6 +16,7 @@ package com.android.inputmethod.latin; +import android.annotation.SuppressLint; import android.content.Context; import android.content.SharedPreferences; import android.content.pm.PackageInfo; @@ -42,6 +43,7 @@ public final class DebugSettings extends PreferenceFragment private boolean mServiceNeedsRestart = false; private CheckBoxPreference mDebugMode; + private CheckBoxPreference mStatisticsLoggingPref; @Override public void onCreate(Bundle icicle) { @@ -59,6 +61,7 @@ public final class DebugSettings extends PreferenceFragment } final Preference statisticsLoggingPref = findPreference(PREF_STATISTICS_LOGGING_KEY); if (statisticsLoggingPref instanceof CheckBoxPreference) { + mStatisticsLoggingPref = (CheckBoxPreference) statisticsLoggingPref; if (!SHOW_STATISTICS_LOGGING) { getPreferenceScreen().removePreference(statisticsLoggingPref); } @@ -80,6 +83,14 @@ public final class DebugSettings extends PreferenceFragment if (key.equals(DEBUG_MODE_KEY)) { if (mDebugMode != null) { mDebugMode.setChecked(prefs.getBoolean(DEBUG_MODE_KEY, false)); + final boolean checked = mDebugMode.isChecked(); + if (mStatisticsLoggingPref != null) { + if (checked) { + getPreferenceScreen().addPreference(mStatisticsLoggingPref); + } else { + getPreferenceScreen().removePreference(mStatisticsLoggingPref); + } + } updateDebugMode(); mServiceNeedsRestart = true; } diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 0b49659e3..8519ad31d 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -1464,7 +1464,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction private static final class BatchInputUpdater implements Handler.Callback { private final Handler mHandler; private LatinIME mLatinIme; - private boolean mInBatchInput; // synchornized using "this". + private boolean mInBatchInput; // synchronized using "this". private BatchInputUpdater() { final HandlerThread handlerThread = new HandlerThread( @@ -1496,6 +1496,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction // Run in the UI thread. public synchronized void onStartBatchInput() { + mHandler.removeMessages(MSG_UPDATE_GESTURE_PREVIEW_AND_SUGGESTION_STRIP); mInBatchInput = true; } @@ -1503,7 +1504,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction private synchronized void updateBatchInput(final InputPointers batchPointers, final LatinIME latinIme) { if (!mInBatchInput) { - // Batch input has ended while the message was being delivered. + // Batch input has ended or canceled while the message was being delivered. return; } final SuggestedWords suggestedWords = getSuggestedWordsGestureLocked( @@ -1523,7 +1524,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction .sendToTarget(); } - public void onCancelBatchInput(final LatinIME latinIme) { + public synchronized void onCancelBatchInput(final LatinIME latinIme) { mInBatchInput = false; latinIme.mHandler.showGesturePreviewAndSuggestionStrip( SuggestedWords.EMPTY, true /* dismissGestureFloatingPreviewText */); |