diff options
15 files changed, 159 insertions, 116 deletions
diff --git a/java/src/com/android/inputmethod/accessibility/AccessibleKeyboardViewProxy.java b/java/src/com/android/inputmethod/accessibility/AccessibleKeyboardViewProxy.java index 77940c086..01220a58a 100644 --- a/java/src/com/android/inputmethod/accessibility/AccessibleKeyboardViewProxy.java +++ b/java/src/com/android/inputmethod/accessibility/AccessibleKeyboardViewProxy.java @@ -105,15 +105,15 @@ public class AccessibleKeyboardViewProxy extends AccessibilityDelegateCompat { } /** - * Receives motion events when touch exploration is turned on in SDK - * versions ICS and higher. + * Intercepts touch events before dispatch when touch exploration is turned + * on in ICS and higher. * - * @param event The motion event. + * @param event The motion event being dispatched. * @return {@code true} if the event is handled */ - public boolean onTouchEvent(MotionEvent event) { + public boolean dispatchTouchEvent(MotionEvent event) { // To avoid accidental key presses during touch exploration, always drop - // non-hover touch events. + // touch events generated by the user. return false; } diff --git a/java/src/com/android/inputmethod/keyboard/Key.java b/java/src/com/android/inputmethod/keyboard/Key.java index 03c216474..cb120a33e 100644 --- a/java/src/com/android/inputmethod/keyboard/Key.java +++ b/java/src/com/android/inputmethod/keyboard/Key.java @@ -52,7 +52,7 @@ import java.util.Locale; /** * Class for describing the position and characteristics of a single key in the keyboard. */ -public class Key { +public class Key implements Comparable<Key> { private static final String TAG = Key.class.getSimpleName(); /** @@ -410,7 +410,7 @@ public class Key { }); } - private boolean equals(final Key o) { + private boolean equalsInternal(final Key o) { if (this == o) return true; return o.mX == mX && o.mY == mY @@ -428,13 +428,20 @@ public class Key { } @Override + public int compareTo(Key o) { + if (equalsInternal(o)) return 0; + if (mHashCode > o.mHashCode) return 1; + return -1; + } + + @Override public int hashCode() { return mHashCode; } @Override public boolean equals(final Object o) { - return o instanceof Key && equals((Key)o); + return o instanceof Key && equalsInternal((Key)o); } @Override diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardView.java b/java/src/com/android/inputmethod/keyboard/KeyboardView.java index db3a7b1e9..27c3cc3e3 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyboardView.java +++ b/java/src/com/android/inputmethod/keyboard/KeyboardView.java @@ -182,7 +182,7 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy { private final Region mClipRegion = new Region(); private Bitmap mOffscreenBuffer; /** The canvas for the above mutable keyboard bitmap */ - private Canvas mOffscreenCanvas; + private final Canvas mOffscreenCanvas = new Canvas(); private final Paint mPaint = new Paint(); private final Paint.FontMetrics mFontMetrics = new Paint.FontMetrics(); // This sparse array caches key label text height in pixel indexed by key label text size. @@ -365,7 +365,8 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy { if (bufferNeedsUpdates || mOffscreenBuffer == null) { if (maybeAllocateOffscreenBuffer()) { mInvalidateAllKeys = true; - maybeCreateOffscreenCanvas(); + // TODO: Stop using the offscreen canvas even when in software rendering + mOffscreenCanvas.setBitmap(mOffscreenBuffer); } onDrawKeyboard(mOffscreenCanvas); } @@ -394,15 +395,6 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy { } } - private void maybeCreateOffscreenCanvas() { - // TODO: Stop using the offscreen canvas even when in software rendering - if (mOffscreenCanvas != null) { - mOffscreenCanvas.setBitmap(mOffscreenBuffer); - } else { - mOffscreenCanvas = new Canvas(mOffscreenBuffer); - } - } - private void onDrawKeyboard(final Canvas canvas) { if (mKeyboard == null) return; diff --git a/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java b/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java index f6b66a79e..4ed0f58e1 100644 --- a/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java +++ b/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java @@ -661,13 +661,18 @@ public class MainKeyboardView extends KeyboardView implements PointerTracker.Key } @Override + public boolean dispatchTouchEvent(MotionEvent event) { + if (AccessibilityUtils.getInstance().isTouchExplorationEnabled()) { + return AccessibleKeyboardViewProxy.getInstance().dispatchTouchEvent(event); + } + return super.dispatchTouchEvent(event); + } + + @Override public boolean onTouchEvent(final MotionEvent me) { if (getKeyboard() == null) { return false; } - if (AccessibilityUtils.getInstance().isTouchExplorationEnabled()) { - return AccessibleKeyboardViewProxy.getInstance().onTouchEvent(me); - } return mTouchScreenRegulator.onTouchEvent(me); } diff --git a/java/src/com/android/inputmethod/keyboard/internal/GesturePreviewTrail.java b/java/src/com/android/inputmethod/keyboard/internal/GesturePreviewTrail.java index 95c9572b3..4311fa775 100644 --- a/java/src/com/android/inputmethod/keyboard/internal/GesturePreviewTrail.java +++ b/java/src/com/android/inputmethod/keyboard/internal/GesturePreviewTrail.java @@ -17,9 +17,7 @@ package com.android.inputmethod.keyboard.internal; import android.content.res.TypedArray; import android.graphics.Canvas; import android.graphics.Paint; -import android.graphics.PorterDuff; -import android.graphics.PorterDuffXfermode; -import android.graphics.Xfermode; +import android.graphics.Rect; import android.os.SystemClock; import com.android.inputmethod.latin.Constants; @@ -118,17 +116,16 @@ final class GesturePreviewTrail { / params.mTrailLingerDuration, 0.0f); } - private final static Xfermode PORTER_DUFF_MODE_SRC = - new PorterDuffXfermode(PorterDuff.Mode.SRC); - /** * Draw gesture preview trail * @param canvas The canvas to draw the gesture preview trail * @param paint The paint object to be used to draw the gesture preview trail + * @param outBoundsRect the bounding box of this gesture trail drawing * @param params The drawing parameters of gesture preview trail * @return true if some gesture preview trails remain to be drawn */ - public boolean drawGestureTrail(final Canvas canvas, final Paint paint, final Params params) { + public boolean drawGestureTrail(final Canvas canvas, final Paint paint, + final Rect outBoundsRect, final Params params) { final int trailSize = mEventTimes.getLength(); if (trailSize == 0) { return false; @@ -149,12 +146,14 @@ final class GesturePreviewTrail { mTrailStartIndex = startIndex; if (startIndex < trailSize) { - int lastX = getXCoordValue(xCoords[startIndex]); - int lastY = yCoords[startIndex]; paint.setColor(params.mTrailColor); paint.setStyle(Paint.Style.STROKE); paint.setStrokeCap(Paint.Cap.ROUND); - paint.setXfermode(PORTER_DUFF_MODE_SRC); + int lastX = getXCoordValue(xCoords[startIndex]); + int lastY = yCoords[startIndex]; + float maxWidth = getWidth(sinceDown - eventTimes[startIndex], params); + // Initialize bounds rectangle. + outBoundsRect.set(lastX, lastY, lastX, lastY); for (int i = startIndex + 1; i < trailSize - 1; i++) { final int x = xCoords[i]; final int y = yCoords[i]; @@ -166,10 +165,16 @@ final class GesturePreviewTrail { final float width = getWidth(elapsedTime, params); paint.setStrokeWidth(width); canvas.drawLine(lastX, lastY, x, y, paint); + // Take union for the bounds. + outBoundsRect.union(x, y); + maxWidth = Math.max(maxWidth, width); } lastX = getXCoordValue(x); lastY = y; } + // Take care of trail line width. + final int inset = -((int)maxWidth + 1); + outBoundsRect.inset(inset, inset); } final int newSize = trailSize - startIndex; diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyboardParams.java b/java/src/com/android/inputmethod/keyboard/internal/KeyboardParams.java index ab5d31d42..e6fe50e02 100644 --- a/java/src/com/android/inputmethod/keyboard/internal/KeyboardParams.java +++ b/java/src/com/android/inputmethod/keyboard/internal/KeyboardParams.java @@ -24,7 +24,7 @@ import com.android.inputmethod.keyboard.KeyboardId; import com.android.inputmethod.latin.CollectionUtils; import java.util.ArrayList; -import java.util.HashSet; +import java.util.TreeSet; public class KeyboardParams { public KeyboardId mId; @@ -58,7 +58,7 @@ public class KeyboardParams { public int GRID_WIDTH; public int GRID_HEIGHT; - public final HashSet<Key> mKeys = CollectionUtils.newHashSet(); + public final TreeSet<Key> mKeys = CollectionUtils.newTreeSet(); // ordered set public final ArrayList<Key> mShiftKeys = CollectionUtils.newArrayList(); public final ArrayList<Key> mAltCodeKeysWhileTyping = CollectionUtils.newArrayList(); public final KeyboardIconsSet mIconsSet = new KeyboardIconsSet(); diff --git a/java/src/com/android/inputmethod/keyboard/internal/MoreKeySpec.java b/java/src/com/android/inputmethod/keyboard/internal/MoreKeySpec.java index 5da26543f..550391b49 100644 --- a/java/src/com/android/inputmethod/keyboard/internal/MoreKeySpec.java +++ b/java/src/com/android/inputmethod/keyboard/internal/MoreKeySpec.java @@ -16,12 +16,14 @@ package com.android.inputmethod.keyboard.internal; +import android.text.TextUtils; + import com.android.inputmethod.keyboard.Keyboard; import com.android.inputmethod.latin.StringUtils; import java.util.Locale; -public class MoreKeySpec { +public final class MoreKeySpec { public final int mCode; public final String mLabel; public final String mOutputText; @@ -47,6 +49,29 @@ public class MoreKeySpec { } @Override + public int hashCode() { + int hashCode = 1; + hashCode = 31 + mCode; + hashCode = hashCode * 31 + mIconId; + hashCode = hashCode * 31 + (mLabel == null ? 0 : mLabel.hashCode()); + hashCode = hashCode * 31 + (mOutputText == null ? 0 : mOutputText.hashCode()); + return hashCode; + } + + @Override + public boolean equals(final Object o) { + if (this == o) return true; + if (o instanceof MoreKeySpec) { + final MoreKeySpec other = (MoreKeySpec)o; + return mCode == other.mCode + && mIconId == other.mIconId + && TextUtils.equals(mLabel, other.mLabel) + && TextUtils.equals(mOutputText, other.mOutputText); + } + return false; + } + + @Override public String toString() { final String label = (mIconId == KeyboardIconsSet.ICON_UNDEFINED ? mLabel : KeySpecParser.PREFIX_ICON + KeyboardIconsSet.getIconName(mIconId)); diff --git a/java/src/com/android/inputmethod/keyboard/internal/PreviewPlacerView.java b/java/src/com/android/inputmethod/keyboard/internal/PreviewPlacerView.java index dbde4ef39..7104e3a12 100644 --- a/java/src/com/android/inputmethod/keyboard/internal/PreviewPlacerView.java +++ b/java/src/com/android/inputmethod/keyboard/internal/PreviewPlacerView.java @@ -18,7 +18,9 @@ package com.android.inputmethod.keyboard.internal; import android.content.Context; import android.content.res.TypedArray; +import android.graphics.Bitmap; import android.graphics.Canvas; +import android.graphics.Color; import android.graphics.Paint; import android.graphics.Paint.Align; import android.graphics.PorterDuff; @@ -54,6 +56,10 @@ public class PreviewPlacerView extends RelativeLayout { private final Params mGesturePreviewTrailParams; private final Paint mGesturePaint; private boolean mDrawsGesturePreviewTrail; + private Bitmap mOffscreenBuffer; + private final Canvas mOffscreenCanvas = new Canvas(); + private final Rect mOffscreenDirtyRect = new Rect(); + private final Rect mGesturePreviewTrailBoundsRect = new Rect(); // per trail private final Paint mTextPaint; private String mGestureFloatingPreviewText; @@ -154,6 +160,7 @@ public class PreviewPlacerView extends RelativeLayout { final Paint gesturePaint = new Paint(); gesturePaint.setAntiAlias(true); + gesturePaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC)); mGesturePaint = gesturePaint; final Paint textPaint = new Paint(); @@ -199,10 +206,30 @@ public class PreviewPlacerView extends RelativeLayout { } @Override + protected void onDetachedFromWindow() { + if (mOffscreenBuffer != null) { + mOffscreenBuffer.recycle(); + mOffscreenBuffer = null; + } + } + + @Override public void onDraw(final Canvas canvas) { super.onDraw(canvas); canvas.translate(mXOrigin, mYOrigin); if (mDrawsGesturePreviewTrail) { + if (mOffscreenBuffer == null) { + mOffscreenBuffer = Bitmap.createBitmap( + getWidth(), getHeight(), Bitmap.Config.ARGB_8888); + mOffscreenCanvas.setBitmap(mOffscreenBuffer); + } + if (!mOffscreenDirtyRect.isEmpty()) { + // Clear previous dirty rectangle. + mGesturePaint.setColor(Color.TRANSPARENT); + mGesturePaint.setStyle(Paint.Style.FILL); + mOffscreenCanvas.drawRect(mOffscreenDirtyRect, mGesturePaint); + mOffscreenDirtyRect.setEmpty(); + } boolean needsUpdatingGesturePreviewTrail = false; synchronized (mGesturePreviewTrails) { // Trails count == fingers count that have ever been active. @@ -210,10 +237,18 @@ public class PreviewPlacerView extends RelativeLayout { for (int index = 0; index < trailsCount; index++) { final GesturePreviewTrail trail = mGesturePreviewTrails.valueAt(index); needsUpdatingGesturePreviewTrail |= - trail.drawGestureTrail(canvas, mGesturePaint, - mGesturePreviewTrailParams); + trail.drawGestureTrail(mOffscreenCanvas, mGesturePaint, + mGesturePreviewTrailBoundsRect, mGesturePreviewTrailParams); + // {@link #mGesturePreviewTrailBoundsRect} has bounding box of the trail. + mOffscreenDirtyRect.union(mGesturePreviewTrailBoundsRect); } } + if (!mOffscreenDirtyRect.isEmpty()) { + canvas.drawBitmap(mOffscreenBuffer, mOffscreenDirtyRect, mOffscreenDirtyRect, + mGesturePaint); + // Note: Defer clearing the dirty rectangle here because we will get cleared + // rectangle on the canvas. + } if (needsUpdatingGesturePreviewTrail) { mDrawingHandler.postUpdateGestureTrailPreview(); } @@ -263,7 +298,6 @@ public class PreviewPlacerView extends RelativeLayout { final float round = mGestureFloatingPreviewRoundRadius; paint.setColor(mGestureFloatingPreviewColor); canvas.drawRoundRect(rectangle, round, round, paint); - // Paint the text preview paint.setColor(mGestureFloatingPreviewTextColor); final float textX = rectX + hPad + textWidth / 2.0f; diff --git a/java/src/com/android/inputmethod/latin/AutoCorrection.java b/java/src/com/android/inputmethod/latin/AutoCorrection.java index 01ba30077..f425e360a 100644 --- a/java/src/com/android/inputmethod/latin/AutoCorrection.java +++ b/java/src/com/android/inputmethod/latin/AutoCorrection.java @@ -73,11 +73,11 @@ public class AutoCorrection { return maxFreq; } - // Returns true if this isn't in any dictionary. - public static boolean isNotAWord( + // Returns true if this is in any of the dictionaries. + public static boolean isInTheDictionary( final ConcurrentHashMap<String, Dictionary> dictionaries, final CharSequence word, final boolean ignoreCase) { - return !isValidWord(dictionaries, word, ignoreCase); + return isValidWord(dictionaries, word, ignoreCase); } public static boolean suggestionExceedsAutoCorrectionThreshold(SuggestedWordInfo suggestion, diff --git a/java/src/com/android/inputmethod/latin/Suggest.java b/java/src/com/android/inputmethod/latin/Suggest.java index 51ed09604..f922bc9e0 100644 --- a/java/src/com/android/inputmethod/latin/Suggest.java +++ b/java/src/com/android/inputmethod/latin/Suggest.java @@ -214,10 +214,12 @@ public class Suggest { whitelistedWord = suggestionsSet.first().mWord; } + // The word can be auto-corrected if it has a whitelist entry that is not itself, + // or if it's a 2+ characters non-word (i.e. it's not in the dictionary). final boolean allowsToBeAutoCorrected = (null != whitelistedWord && !whitelistedWord.equals(consideredWord)) - || AutoCorrection.isNotAWord(mDictionaries, consideredWord, - wordComposer.isFirstCharCapitalized()); + || (consideredWord.length() > 1 && !AutoCorrection.isInTheDictionary(mDictionaries, + consideredWord, wordComposer.isFirstCharCapitalized())); final boolean hasAutoCorrection; // TODO: using isCorrectionEnabled here is not very good. It's probably useless, because diff --git a/java/src/com/android/inputmethod/latin/UserHistoryDictIOUtils.java b/java/src/com/android/inputmethod/latin/UserHistoryDictIOUtils.java index d6fa66131..1f5f1f7e6 100644 --- a/java/src/com/android/inputmethod/latin/UserHistoryDictIOUtils.java +++ b/java/src/com/android/inputmethod/latin/UserHistoryDictIOUtils.java @@ -91,6 +91,11 @@ public class UserHistoryDictIOUtils { public void position(int position) { mPosition = position; } + + @Override + public void put(final byte b) { + mBuffer[mPosition++] = b; + } } /** diff --git a/java/src/com/android/inputmethod/latin/makedict/BinaryDictInputOutput.java b/java/src/com/android/inputmethod/latin/makedict/BinaryDictInputOutput.java index 6775144de..fbcb5eacc 100644 --- a/java/src/com/android/inputmethod/latin/makedict/BinaryDictInputOutput.java +++ b/java/src/com/android/inputmethod/latin/makedict/BinaryDictInputOutput.java @@ -232,6 +232,7 @@ public class BinaryDictInputOutput { public int readInt(); public int position(); public void position(int newPosition); + public void put(final byte b); } public static final class ByteBufferWrapper implements FusionDictionaryBufferInterface { @@ -271,6 +272,11 @@ public class BinaryDictInputOutput { public void position(int newPos) { mBuffer.position(newPos); } + + @Override + public void put(final byte b) { + mBuffer.put(b); + } } /** diff --git a/native/jni/src/debug.h b/native/jni/src/debug.h deleted file mode 100644 index 8f6b69d77..000000000 --- a/native/jni/src/debug.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (C) 2011, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef LATINIME_DEBUG_H -#define LATINIME_DEBUG_H - -#include "defines.h" - -static inline unsigned char *convertToUnibyteString(unsigned short *input, unsigned char *output, - const unsigned int length) { - unsigned int i = 0; - for (; i < length && input[i] != 0; ++i) - output[i] = input[i] & 0xFF; - output[i] = 0; - return output; -} - -static inline unsigned char *convertToUnibyteStringAndReplaceLastChar(unsigned short *input, - unsigned char *output, const unsigned int length, unsigned char c) { - unsigned int i = 0; - for (; i < length && input[i] != 0; ++i) - output[i] = input[i] & 0xFF; - if (i > 0) output[i-1] = c; - output[i] = 0; - return output; -} - -static inline void LOGI_S16(unsigned short *string, const unsigned int length) { - unsigned char tmp_buffer[length]; - convertToUnibyteString(string, tmp_buffer, length); - AKLOGI(">> %s", tmp_buffer); - // The log facility is throwing out log that comes too fast. The following - // is a dirty way of slowing down processing so that we can see all log. - // TODO : refactor this in a blocking log or something. - // usleep(10); -} - -static inline void LOGI_S16_PLUS(unsigned short *string, const unsigned int length, - unsigned char c) { - unsigned char tmp_buffer[length+1]; - convertToUnibyteStringAndReplaceLastChar(string, tmp_buffer, length, c); - AKLOGI(">> %s", tmp_buffer); - // Likewise - // usleep(10); -} - -static inline void printDebug(const char *tag, int *codes, int codesSize, int MAX_PROXIMITY_CHARS) { - unsigned char *buf = static_cast<unsigned char *>(malloc((1 + codesSize) * sizeof(*buf))); - - buf[codesSize] = 0; - while (--codesSize >= 0) { - buf[codesSize] = static_cast<unsigned char>(codes[codesSize * MAX_PROXIMITY_CHARS]); - } - AKLOGI("%s, WORD = %s", tag, buf); - - free(buf); -} -#endif // LATINIME_DEBUG_H diff --git a/native/jni/src/defines.h b/native/jni/src/defines.h index 95a90275d..ad526fb7f 100644 --- a/native/jni/src/defines.h +++ b/native/jni/src/defines.h @@ -220,7 +220,11 @@ static inline void prof_out(void) { #define DEBUG_CORRECTION_FREQ false #define DEBUG_WORDS_PRIORITY_QUEUE false +#ifdef FLAG_FULL_DBG +#define DEBUG_GEO_FULL true +#else #define DEBUG_GEO_FULL false +#endif #else // FLAG_DBG diff --git a/native/jni/src/proximity_info_state.cpp b/native/jni/src/proximity_info_state.cpp index a4eb7e353..208b69356 100644 --- a/native/jni/src/proximity_info_state.cpp +++ b/native/jni/src/proximity_info_state.cpp @@ -98,6 +98,10 @@ void ProximityInfoState::initInputParams(const int pointerId, const float maxPoi mDistanceCache.clear(); mNearKeysVector.clear(); } + if (DEBUG_GEO_FULL) { + AKLOGI("Init ProximityInfoState: reused points = %d, last input size = %d", + pushTouchPointStartIndex, lastSavedInputSize); + } mInputSize = 0; if (xCoordinates && yCoordinates) { @@ -109,6 +113,9 @@ void ProximityInfoState::initInputParams(const int pointerId, const float maxPoi lastInputIndex = i; } } + if (DEBUG_GEO_FULL) { + AKLOGI("Init ProximityInfoState: last input index = %d", lastInputIndex); + } // Working space to save near keys distances for current, prev and prevprev input point. NearKeysDistanceMap nearKeysDistances[3]; // These pointers are swapped for each inputs points. @@ -119,13 +126,16 @@ void ProximityInfoState::initInputParams(const int pointerId, const float maxPoi for (int i = pushTouchPointStartIndex; i <= lastInputIndex; ++i) { // Assuming pointerId == 0 if pointerIds is null. const int pid = pointerIds ? pointerIds[i] : 0; + if (DEBUG_GEO_FULL) { + AKLOGI("Init ProximityInfoState: (%d)PID = %d", i, pid); + } if (pointerId == pid) { const int c = isGeometric ? NOT_A_COORDINATE : getPrimaryCharAt(i); const int x = proximityOnly ? NOT_A_COORDINATE : xCoordinates[i]; const int y = proximityOnly ? NOT_A_COORDINATE : yCoordinates[i]; const int time = times ? times[i] : -1; - if (pushTouchPoint(i, c, x, y, time, isGeometric, i == lastInputIndex, - currentNearKeysDistances, prevNearKeysDistances, + if (pushTouchPoint(i, c, x, y, time, isGeometric /* do sampling */, + i == lastInputIndex, currentNearKeysDistances, prevNearKeysDistances, prevPrevNearKeysDistances)) { // Previous point information was popped. NearKeysDistanceMap *tmp = prevNearKeysDistances; @@ -218,6 +228,10 @@ void ProximityInfoState::initInputParams(const int pointerId, const float maxPoi } } } + + if (DEBUG_GEO_FULL) { + AKLOGI("ProximityState init finished: %d points out of %d", mInputSize, inputSize); + } } bool ProximityInfoState::checkAndReturnIsContinuationPossible(const int inputSize, @@ -363,6 +377,13 @@ bool ProximityInfoState::pushTouchPoint(const int inputIndex, const int nodeChar if (isLastPoint) { if (size > 0 && getDistanceFloat(x, y, mInputXs.back(), mInputYs.back()) < mProximityInfo->getMostCommonKeyWidth() * LAST_POINT_SKIP_DISTANCE_SCALE) { + if (DEBUG_GEO_FULL) { + AKLOGI("p0: size = %zd, x = %d, y = %d, lx = %d, ly = %d, dist = %f, " + "width = %f", size, x, y, mInputXs.back(), mInputYs.back(), + getDistanceFloat(x, y, mInputXs.back(), mInputYs.back()), + mProximityInfo->getMostCommonKeyWidth() + * LAST_POINT_SKIP_DISTANCE_SCALE); + } return popped; } else if (size > 1) { int minChar = 0; @@ -376,6 +397,10 @@ bool ProximityInfoState::pushTouchPoint(const int inputIndex, const int nodeChar } NearKeysDistanceMap::const_iterator itPP = prevNearKeysDistances->find(minChar); + if (DEBUG_GEO_FULL) { + AKLOGI("p1: char = %c, minDist = %f, prevNear key minDist = %f", + minChar, itPP->second, minDist); + } if (itPP != prevNearKeysDistances->end() && minDist > itPP->second) { return popped; } @@ -402,6 +427,10 @@ bool ProximityInfoState::pushTouchPoint(const int inputIndex, const int nodeChar mInputYs.push_back(y); mTimes.push_back(time); mInputIndice.push_back(inputIndex); + if (DEBUG_GEO_FULL) { + AKLOGI("pushTouchPoint: x = %03d, y = %03d, time = %d, index = %d, popped ? %01d", + x, y, time, inputIndex, popped); + } return popped; } |