From 97eaa543d5fd4ac57516a586477641c129828b5d Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Fri, 14 Jun 2013 16:21:37 +0900 Subject: [PATCH] Don't count Spacer into histograms Change-Id: I202a25da4e1a722aa35c57665d73bc5990404c4e --- .../keyboard/internal/KeyboardParams.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyboardParams.java b/java/src/com/android/inputmethod/keyboard/internal/KeyboardParams.java index 15eb690e1..84319eb33 100644 --- a/java/src/com/android/inputmethod/keyboard/internal/KeyboardParams.java +++ b/java/src/com/android/inputmethod/keyboard/internal/KeyboardParams.java @@ -84,11 +84,16 @@ public class KeyboardParams { public void onAddKey(final Key newKey) { final Key key = (mKeysCache != null) ? mKeysCache.get(newKey) : newKey; - final boolean zeroWidthSpacer = key.isSpacer() && key.mWidth == 0; - if (!zeroWidthSpacer) { - mKeys.add(key); - updateHistogram(key); + final boolean isSpacer = key.isSpacer(); + if (isSpacer && key.mWidth == 0) { + // Ignore zero width {@link Spacer}. + return; } + mKeys.add(key); + if (isSpacer) { + return; + } + updateHistogram(key); if (key.mCode == Constants.CODE_SHIFT) { mShiftKeys.add(key); }