From 2ddaf9543da569af980a402d178a1af3819ed799 Mon Sep 17 00:00:00 2001
From: "Tadashi G. Takaoka" <takaoka@google.com>
Date: Thu, 15 May 2014 17:43:04 +0900
Subject: [PATCH] Remove unused auto correction led for spacebar feature

Change-Id: Ie1544bd0d28684d9b7887fddff37b224ed4f8201
---
 .../sym_keyboard_space_led_holo.9.png         | Bin 322 -> 0 bytes
 .../sym_keyboard_space_led_holo.9.png         | Bin 201 -> 0 bytes
 .../sym_keyboard_space_led_holo.9.png         | Bin 381 -> 0 bytes
 java/res/values/attrs.xml                     |   2 --
 java/res/values/themes-ics.xml                |   2 --
 java/res/values/themes-klp.xml                |   2 --
 java/res/values/themes-lxx.xml                |   2 --
 .../keyboard/KeyboardSwitcher.java            |  19 ------------
 .../keyboard/MainKeyboardView.java            |  27 +-----------------
 .../android/inputmethod/latin/LatinIME.java   |   2 --
 10 files changed, 1 insertion(+), 55 deletions(-)
 delete mode 100644 java/res/drawable-hdpi/sym_keyboard_space_led_holo.9.png
 delete mode 100644 java/res/drawable-mdpi/sym_keyboard_space_led_holo.9.png
 delete mode 100644 java/res/drawable-xhdpi/sym_keyboard_space_led_holo.9.png

diff --git a/java/res/drawable-hdpi/sym_keyboard_space_led_holo.9.png b/java/res/drawable-hdpi/sym_keyboard_space_led_holo.9.png
deleted file mode 100644
index 34a1ebde2910f04c9f0f07254a04052bfc10a625..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001

literal 322
zcmV-I0lof-P)<h;3K|Lk000e1NJLTq001}u001=z1^@s66c{ML0003ANkl<Zc-rmO
zze>YU7>4mSG?-Iz30{JOm*7Pd+=`POI@Jp>-=g5+qR>Bs61&yK$<;*!Ib9su?s^sN
z@|m7iD2OQ3oEm(7@IWCU@aE9cQpqn}1^@s6000000002FPzC}h?iXAnaH#}e-lJM}
zE${o>;yQ0L*OU4<g*97!-d|f-{*_jrw@KmQX(PUUlWIDVs6R=fwoRgo=k>cDB~dzZ
zpW~ZxbL-@;>3y6zyRVtc$C>F3)pTvXUA<_yf7I|huw!ecJDlY{ZeBXpuzu`!VBEGl
z)sB7jFmRd;oQ4OoTa2Gtd8oJsPv%F72Cl-`lghm9*17q<RyHvEb0AWnfdKxUca|om
Uazgl|@Bjb+07*qoM6N<$g1H%yZU6uP

diff --git a/java/res/drawable-mdpi/sym_keyboard_space_led_holo.9.png b/java/res/drawable-mdpi/sym_keyboard_space_led_holo.9.png
deleted file mode 100644
index abd8b742ef3aacd3b169f3ba2f08ad997d1ba07e..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001

literal 201
zcmeAS@N?(olHy`uVBq!ia0vp^sz9vF!3HFSj~|u;QWHE~978H@B_}M9`@w&7ae_!s
zQ=kEt+d&NpRuG5j)a`4F`=nSGGvqhrWF#;p@_hXNUox?%;E#OEf8)L>3mAV*5#hP)
zoO{6ZbBUFJdBGW*SbsgXSLc__YPLw9!}oAb<u7r8|I3-|{6*bA`q-~!HhCi`D)VJ>
y^0AdJzm{!n`>VrKd)%V%QQLo?#i>_27#Qx)-``!d_Ky?LZ492SelF{r5}E+(woU8+

diff --git a/java/res/drawable-xhdpi/sym_keyboard_space_led_holo.9.png b/java/res/drawable-xhdpi/sym_keyboard_space_led_holo.9.png
deleted file mode 100644
index ba4e9ec4967f64c67071fb7430cb73e6e56390f5..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001

literal 381
zcmeAS@N?(olHy`uVBq!ia0vp^UO?=|!3HF=g_uARjKx9jP7LeL$-D$|6iZwqN`mv#
zO3D+9QW@Nf5(_dilb!SP%2JC;Qi~KcJo8FYb2Q7_e@Oy0a(TKqhE&XXbIXzMpo2tP
zq7=8NdjZSwLPl-wb_4YdOT!B|t+_WBuy0TJ{F=wr?Qs7Uk@u7LI9^)zR{XS?l&O-^
zzsEm9yYBA@;}LEX>REck0q6i^pmFr{QZJsRN3>6K?YX^Hc@M{W<(?%+0=#%w|HvAu
zS*oj5R_yV(TwWVDLqxX!?~&q=cb@|M`9$Z0-{a?PoqXDU!K_2CkJMcIzGL?KO&_f8
zFPMBYa9-h7W9!bqy0;s(zloI_USWQDhp%Sl-RGXZw~pL<%I2(Dn!fG*sr<a?=Ekyh
z-)d}o_MYZ#>pG|tz3-(~t)_D4`{#4pUg?It)c$)ufPq0_6Eo1g|Nk>HOynupn5Gt_
P0dl^ltDnm{r-UW|;`fw4

diff --git a/java/res/values/attrs.xml b/java/res/values/attrs.xml
index 701d195727..7363b6108e 100644
--- a/java/res/values/attrs.xml
+++ b/java/res/values/attrs.xml
@@ -72,8 +72,6 @@
     </declare-styleable>
 
     <declare-styleable name="MainKeyboardView">
-        <attr name="autoCorrectionSpacebarLedEnabled" format="boolean" />
-        <attr name="autoCorrectionSpacebarLedIcon" format="reference" />
         <!-- Size of the text for spacebar language label, in the proportion of key height. -->
         <attr name="languageOnSpacebarTextRatio" format="fraction" />
         <attr name="languageOnSpacebarTextColor" format="color" />
diff --git a/java/res/values/themes-ics.xml b/java/res/values/themes-ics.xml
index 79f90365b7..22fb2c822f 100644
--- a/java/res/values/themes-ics.xml
+++ b/java/res/values/themes-ics.xml
@@ -71,8 +71,6 @@
         <item name="gestureFloatingPreviewColor">@color/gesture_floating_preview_color_holo</item>
         <item name="gestureTrailColor">@color/highlight_color_ics</item>
         <item name="slidingKeyInputPreviewColor">@color/highlight_translucent_color_ics</item>
-        <item name="autoCorrectionSpacebarLedEnabled">false</item>
-        <item name="autoCorrectionSpacebarLedIcon">@drawable/sym_keyboard_space_led_holo</item>
         <item name="languageOnSpacebarTextColor">@color/spacebar_text_color_holo</item>
         <item name="languageOnSpacebarTextShadowRadius">1.0</item>
         <item name="languageOnSpacebarTextShadowColor">@color/spacebar_text_shadow_color_holo</item>
diff --git a/java/res/values/themes-klp.xml b/java/res/values/themes-klp.xml
index dfeca1c273..212f5db014 100644
--- a/java/res/values/themes-klp.xml
+++ b/java/res/values/themes-klp.xml
@@ -71,8 +71,6 @@
         <item name="gestureFloatingPreviewColor">@color/gesture_floating_preview_color_holo</item>
         <item name="gestureTrailColor">@color/highlight_color_klp</item>
         <item name="slidingKeyInputPreviewColor">@color/highlight_translucent_color_klp</item>
-        <item name="autoCorrectionSpacebarLedEnabled">false</item>
-        <item name="autoCorrectionSpacebarLedIcon">@drawable/sym_keyboard_space_led_holo</item>
         <item name="languageOnSpacebarTextColor">@color/spacebar_text_color_holo</item>
         <item name="languageOnSpacebarTextShadowRadius">1.0</item>
         <item name="languageOnSpacebarTextShadowColor">@color/spacebar_text_shadow_color_holo</item>
diff --git a/java/res/values/themes-lxx.xml b/java/res/values/themes-lxx.xml
index 899d26a7e9..3c7a2b511b 100644
--- a/java/res/values/themes-lxx.xml
+++ b/java/res/values/themes-lxx.xml
@@ -71,8 +71,6 @@
         <item name="gestureFloatingPreviewColor">@color/gesture_floating_preview_color_holo</item>
         <item name="gestureTrailColor">@color/highlight_color_lxx</item>
         <item name="slidingKeyInputPreviewColor">@color/highlight_translucent_color_lxx</item>
-        <item name="autoCorrectionSpacebarLedEnabled">false</item>
-        <item name="autoCorrectionSpacebarLedIcon">@drawable/sym_keyboard_space_led_holo</item>
         <item name="languageOnSpacebarTextColor">@color/key_text_inactive_color_lxx</item>
         <!-- A negative value to disable text shadow layer. -->
         <item name="languageOnSpacebarTextShadowRadius">-1.0</item>
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
index b7a76944e6..61d51d1c9b 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
@@ -61,10 +61,6 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions {
     private final KeyboardTextsSet mKeyboardTextsSet = new KeyboardTextsSet();
     private SettingsValues mCurrentSettingsValues;
 
-    /** mIsAutoCorrectionActive indicates that auto corrected word will be input instead of
-     * what user actually typed. */
-    private boolean mIsAutoCorrectionActive;
-
     private KeyboardTheme mKeyboardTheme;
     private Context mThemeContext;
 
@@ -142,12 +138,7 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions {
         }
     }
 
-    public void onFinishInputView() {
-        mIsAutoCorrectionActive = false;
-    }
-
     public void onHideWindow() {
-        mIsAutoCorrectionActive = false;
         if (mKeyboardView != null) {
             mKeyboardView.onHideWindow();
         }
@@ -168,7 +159,6 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions {
                 mCurrentSettingsValues.mKeyPreviewShowUpDuration,
                 mCurrentSettingsValues.mKeyPreviewDismissEndScale,
                 mCurrentSettingsValues.mKeyPreviewDismissDuration);
-        keyboardView.updateAutoCorrectionState(mIsAutoCorrectionActive);
         keyboardView.updateShortcutKey(mSubtypeSwitcher.isShortcutImeReady());
         final boolean subtypeChanged = (oldKeyboard == null)
                 || !keyboard.mId.mLocale.equals(oldKeyboard.mId.mLocale);
@@ -367,15 +357,6 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions {
         }
     }
 
-    public void onAutoCorrectionStateChanged(final boolean isAutoCorrection) {
-        if (mIsAutoCorrectionActive != isAutoCorrection) {
-            mIsAutoCorrectionActive = isAutoCorrection;
-            if (mKeyboardView != null) {
-                mKeyboardView.updateAutoCorrectionState(isAutoCorrection);
-            }
-        }
-    }
-
     public int getKeyboardShiftMode() {
         final Keyboard keyboard = getKeyboard();
         if (keyboard == null) {
diff --git a/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java b/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java
index 4a0976845f..ac11dca974 100644
--- a/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java
+++ b/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java
@@ -70,8 +70,6 @@ import java.util.WeakHashMap;
 /**
  * A view that is responsible for detecting key presses and touch movements.
  *
- * @attr ref R.styleable#MainKeyboardView_autoCorrectionSpacebarLedEnabled
- * @attr ref R.styleable#MainKeyboardView_autoCorrectionSpacebarLedIcon
  * @attr ref R.styleable#MainKeyboardView_languageOnSpacebarTextRatio
  * @attr ref R.styleable#MainKeyboardView_languageOnSpacebarTextColor
  * @attr ref R.styleable#MainKeyboardView_languageOnSpacebarTextShadowRadius
@@ -133,11 +131,6 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
     private static final float LANGUAGE_ON_SPACEBAR_TEXT_SHADOW_RADIUS_DISABLED = -1.0f;
     // The minimum x-scale to fit the language name on spacebar.
     private static final float MINIMUM_XSCALE_OF_LANGUAGE_NAME = 0.8f;
-    // Stuff to draw auto correction LED on spacebar.
-    private boolean mAutoCorrectionSpacebarLedOn;
-    private final boolean mAutoCorrectionSpacebarLedEnabled;
-    private final Drawable mAutoCorrectionSpacebarLedIcon;
-    private static final int SPACE_LED_LENGTH_PERCENT = 80;
 
     // Stuff to draw altCodeWhileTyping keys.
     private final ObjectAnimator mAltCodeKeyWhileTypingFadeoutAnimator;
@@ -221,10 +214,6 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
                 R.styleable.MainKeyboardView_backgroundDimAlpha, 0);
         mBackgroundDimAlphaPaint.setColor(Color.BLACK);
         mBackgroundDimAlphaPaint.setAlpha(backgroundDimAlpha);
-        mAutoCorrectionSpacebarLedEnabled = mainKeyboardViewAttr.getBoolean(
-                R.styleable.MainKeyboardView_autoCorrectionSpacebarLedEnabled, false);
-        mAutoCorrectionSpacebarLedIcon = mainKeyboardViewAttr.getDrawable(
-                R.styleable.MainKeyboardView_autoCorrectionSpacebarLedIcon);
         mLanguageOnSpacebarTextRatio = mainKeyboardViewAttr.getFraction(
                 R.styleable.MainKeyboardView_languageOnSpacebarTextRatio, 1, 1, 1.0f);
         mLanguageOnSpacebarTextColor = mainKeyboardViewAttr.getColor(
@@ -834,14 +823,6 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
         invalidateKey(mSpaceKey);
     }
 
-    public void updateAutoCorrectionState(final boolean isAutoCorrection) {
-        if (!mAutoCorrectionSpacebarLedEnabled) {
-            return;
-        }
-        mAutoCorrectionSpacebarLedOn = isAutoCorrection;
-        invalidateKey(mSpaceKey);
-    }
-
     private void dimEntireKeyboard(final boolean dimmed) {
         final boolean needsRedrawing = mNeedsToDimEntireKeyboard != dimmed;
         mNeedsToDimEntireKeyboard = dimmed;
@@ -946,13 +927,7 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
         }
 
         // Draw the spacebar icon at the bottom
-        if (mAutoCorrectionSpacebarLedOn) {
-            final int iconWidth = width * SPACE_LED_LENGTH_PERCENT / 100;
-            final int iconHeight = mAutoCorrectionSpacebarLedIcon.getIntrinsicHeight();
-            int x = (width - iconWidth) / 2;
-            int y = height - iconHeight;
-            drawIcon(canvas, mAutoCorrectionSpacebarLedIcon, x, y, iconWidth, iconHeight);
-        } else if (mSpacebarIcon != null) {
+        if (mSpacebarIcon != null) {
             final int iconWidth = mSpacebarIcon.getIntrinsicWidth();
             final int iconHeight = mSpacebarIcon.getIntrinsicHeight();
             int x = (width - iconWidth) / 2;
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 1ccf5854a7..74b83c1bb8 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -905,7 +905,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
 
     private void onFinishInputViewInternal(final boolean finishingInput) {
         super.onFinishInputView(finishingInput);
-        mKeyboardSwitcher.onFinishInputView();
         mKeyboardSwitcher.deallocateMemory();
         // Remove pending messages related to update suggestions
         mHandler.cancelUpdateSuggestionStrip();
@@ -1388,7 +1387,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
         if (!hasSuggestionStripView()) {
             return;
         }
-        mKeyboardSwitcher.onAutoCorrectionStateChanged(suggestedWords.mWillAutoCorrect);
         if (!onEvaluateInputViewShown()) {
             return;
         }
-- 
GitLab