Loading java/src/com/android/inputmethod/latin/Dictionary.java +10 −0 Original line number Diff line number Diff line Loading @@ -133,6 +133,16 @@ public abstract class Dictionary { return true; } /** * Whether we think this suggestion should trigger an auto-commit. */ public boolean shouldAutoCommit(final SuggestedWordInfo candidate) { // If we don't have support for auto-commit, or if we don't know, we return false to // avoid auto-committing stuff. Implementations of the Dictionary class that know to // determine whether we should auto-commit will override this. return false; } /** * Not a true dictionary. A placeholder used to indicate suggestions that don't come from any * real dictionary. Loading java/src/com/android/inputmethod/latin/LatinIME.java +6 −0 Original line number Diff line number Diff line Loading @@ -1797,6 +1797,12 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen @Override public void onUpdateBatchInput(final InputPointers batchPointers) { final SuggestedWordInfo candidate = mSuggestedWords.getAutoCommitCandidate(); if (null != candidate) { if (candidate.mSourceDict.shouldAutoCommit(candidate)) { // TODO: implement auto-commit } } BatchInputUpdater.getInstance().onUpdateBatchInput(batchPointers); } Loading java/src/com/android/inputmethod/latin/SuggestedWords.java +10 −0 Original line number Diff line number Diff line Loading @@ -143,6 +143,12 @@ public final class SuggestedWords { return suggestionsList; } public SuggestedWordInfo getAutoCommitCandidate() { if (mSuggestedWordInfoList.size() <= 0) return null; final SuggestedWordInfo candidate = mSuggestedWordInfoList.get(0); return candidate.isEligibleForAutoCommit() ? candidate : null; } public static final class SuggestedWordInfo { public static final int NOT_AN_INDEX = -1; public static final int MAX_SCORE = Integer.MAX_VALUE; Loading Loading @@ -186,6 +192,10 @@ public final class SuggestedWords { mIndexOfTouchPointOfSecondWord = indexOfTouchPointOfSecondWord; } public boolean isEligibleForAutoCommit() { return (KIND_CORRECTION == mKind && NOT_AN_INDEX != mIndexOfTouchPointOfSecondWord); } public void setDebugString(final String str) { if (null == str) throw new NullPointerException("Debug info is null"); mDebugString = str; Loading Loading
java/src/com/android/inputmethod/latin/Dictionary.java +10 −0 Original line number Diff line number Diff line Loading @@ -133,6 +133,16 @@ public abstract class Dictionary { return true; } /** * Whether we think this suggestion should trigger an auto-commit. */ public boolean shouldAutoCommit(final SuggestedWordInfo candidate) { // If we don't have support for auto-commit, or if we don't know, we return false to // avoid auto-committing stuff. Implementations of the Dictionary class that know to // determine whether we should auto-commit will override this. return false; } /** * Not a true dictionary. A placeholder used to indicate suggestions that don't come from any * real dictionary. Loading
java/src/com/android/inputmethod/latin/LatinIME.java +6 −0 Original line number Diff line number Diff line Loading @@ -1797,6 +1797,12 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen @Override public void onUpdateBatchInput(final InputPointers batchPointers) { final SuggestedWordInfo candidate = mSuggestedWords.getAutoCommitCandidate(); if (null != candidate) { if (candidate.mSourceDict.shouldAutoCommit(candidate)) { // TODO: implement auto-commit } } BatchInputUpdater.getInstance().onUpdateBatchInput(batchPointers); } Loading
java/src/com/android/inputmethod/latin/SuggestedWords.java +10 −0 Original line number Diff line number Diff line Loading @@ -143,6 +143,12 @@ public final class SuggestedWords { return suggestionsList; } public SuggestedWordInfo getAutoCommitCandidate() { if (mSuggestedWordInfoList.size() <= 0) return null; final SuggestedWordInfo candidate = mSuggestedWordInfoList.get(0); return candidate.isEligibleForAutoCommit() ? candidate : null; } public static final class SuggestedWordInfo { public static final int NOT_AN_INDEX = -1; public static final int MAX_SCORE = Integer.MAX_VALUE; Loading Loading @@ -186,6 +192,10 @@ public final class SuggestedWords { mIndexOfTouchPointOfSecondWord = indexOfTouchPointOfSecondWord; } public boolean isEligibleForAutoCommit() { return (KIND_CORRECTION == mKind && NOT_AN_INDEX != mIndexOfTouchPointOfSecondWord); } public void setDebugString(final String str) { if (null == str) throw new NullPointerException("Debug info is null"); mDebugString = str; Loading