From 724db044957eb3544323c9814cbb4f20e81b8594 Mon Sep 17 00:00:00 2001 From: Ken Wakasa Date: Fri, 9 Aug 2013 21:07:40 +0900 Subject: [PATCH] Deallocate gesture trail bitmap when unneeded further Follow up to I5bc980c4dc41bc304be3c190934c1f7c55c9d244 bug: 8967766 Change-Id: I7b916daa5269cfde359a77555e8ffadf0e4a8f92 --- .../inputmethod/keyboard/MainKeyboardView.java | 16 ++++++++++------ .../com/android/inputmethod/latin/LatinIME.java | 4 ++-- .../latin/settings/SettingsValues.java | 4 ++-- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java b/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java index da8cce1d0..526c2f1ec 100644 --- a/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java +++ b/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java @@ -838,10 +838,10 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack mSlidingKeyInputPreview.dismissSlidingKeyInputPreview(); } - public void setGesturePreviewMode(final boolean drawsGestureTrail, - final boolean drawsGestureFloatingPreviewText) { - mGestureFloatingPreviewText.setPreviewEnabled(drawsGestureFloatingPreviewText); - mGestureTrailsPreview.setPreviewEnabled(drawsGestureTrail); + private void setGesturePreviewMode(final boolean isGestureTrailEnabled, + final boolean isGestureFloatingPreviewTextEnabled) { + mGestureFloatingPreviewText.setPreviewEnabled(isGestureFloatingPreviewTextEnabled); + mGestureTrailsPreview.setPreviewEnabled(isGestureTrailEnabled); } public void showGestureFloatingPreviewText(final SuggestedWords suggestedWords) { @@ -869,8 +869,12 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack PointerTracker.setMainDictionaryAvailability(mainDictionaryAvailable); } - public void setGestureHandlingEnabledByUser(final boolean gestureHandlingEnabledByUser) { - PointerTracker.setGestureHandlingEnabledByUser(gestureHandlingEnabledByUser); + public void setGestureHandlingEnabledByUser(final boolean isGestureHandlingEnabledByUser, + final boolean isGestureTrailEnabled, + final boolean isGestureFloatingPreviewTextEnabled) { + PointerTracker.setGestureHandlingEnabledByUser(isGestureHandlingEnabledByUser); + setGesturePreviewMode(isGestureHandlingEnabledByUser && isGestureTrailEnabled, + isGestureHandlingEnabledByUser && isGestureFloatingPreviewTextEnabled); } @Override diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 6339e9c50..5c5b7b7c0 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -846,8 +846,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen mainKeyboardView.setSlidingKeyInputPreviewEnabled( currentSettingsValues.mSlidingKeyInputPreviewEnabled); mainKeyboardView.setGestureHandlingEnabledByUser( - currentSettingsValues.mGestureInputEnabled); - mainKeyboardView.setGesturePreviewMode(currentSettingsValues.mGesturePreviewTrailEnabled, + currentSettingsValues.mGestureInputEnabled, + currentSettingsValues.mGestureTrailEnabled, currentSettingsValues.mGestureFloatingPreviewTextEnabled); // If we have a user dictionary addition in progress, we should check now if we should diff --git a/java/src/com/android/inputmethod/latin/settings/SettingsValues.java b/java/src/com/android/inputmethod/latin/settings/SettingsValues.java index 8aafb0738..a25cf620c 100644 --- a/java/src/com/android/inputmethod/latin/settings/SettingsValues.java +++ b/java/src/com/android/inputmethod/latin/settings/SettingsValues.java @@ -71,7 +71,7 @@ public final class SettingsValues { // Use bigrams to predict the next word when there is no input for it yet public final boolean mBigramPredictionEnabled; public final boolean mGestureInputEnabled; - public final boolean mGesturePreviewTrailEnabled; + public final boolean mGestureTrailEnabled; public final boolean mGestureFloatingPreviewTextEnabled; public final boolean mSlidingKeyInputPreviewEnabled; public final int mKeyLongpressTimeout; @@ -157,7 +157,7 @@ public final class SettingsValues { mVoiceKeyEnabled = mVoiceMode != null && !mVoiceMode.equals(voiceModeOff); mVoiceKeyOnMain = mVoiceMode != null && mVoiceMode.equals(voiceModeMain); mGestureInputEnabled = Settings.readGestureInputEnabled(prefs, res); - mGesturePreviewTrailEnabled = prefs.getBoolean(Settings.PREF_GESTURE_PREVIEW_TRAIL, true); + mGestureTrailEnabled = prefs.getBoolean(Settings.PREF_GESTURE_PREVIEW_TRAIL, true); mGestureFloatingPreviewTextEnabled = prefs.getBoolean( Settings.PREF_GESTURE_FLOATING_PREVIEW_TEXT, true); mCorrectionEnabled = mAutoCorrectEnabled && !mInputAttributes.mInputTypeNoAutoCorrect;