From c74ffe8edcf468effec2833299a219dfbd59de70 Mon Sep 17 00:00:00 2001 From: Mohammadinamul Sheik Date: Sun, 7 Sep 2014 20:43:48 -0700 Subject: [PATCH] Add StatsUtils.onPickSuggestionManually and SuggestedWords.indexOf. Change-Id: I1588448154d086569cb026825fdc36cd1812a582 --- .../com/android/inputmethod/latin/utils/StatsUtils.java | 6 ++++++ .../com/android/inputmethod/latin/SuggestedWords.java | 9 +++++++++ .../android/inputmethod/latin/inputlogic/InputLogic.java | 3 +++ 3 files changed, 18 insertions(+) diff --git a/java-overridable/src/com/android/inputmethod/latin/utils/StatsUtils.java b/java-overridable/src/com/android/inputmethod/latin/utils/StatsUtils.java index 9cfcc3d4f..c867fee33 100644 --- a/java-overridable/src/com/android/inputmethod/latin/utils/StatsUtils.java +++ b/java-overridable/src/com/android/inputmethod/latin/utils/StatsUtils.java @@ -17,6 +17,7 @@ package com.android.inputmethod.latin.utils; import com.android.inputmethod.latin.RichInputMethodManager; +import com.android.inputmethod.latin.SuggestedWords; import com.android.inputmethod.latin.settings.SettingsValues; public final class StatsUtils { @@ -24,4 +25,9 @@ public final class StatsUtils { public static void onCreate(final SettingsValues settingsValues, RichInputMethodManager richImm) { } + + public static void onPickSuggestionManually(final SuggestedWords suggestedWords, + final SuggestedWords.SuggestedWordInfo suggestionInfo) { + + } } diff --git a/java/src/com/android/inputmethod/latin/SuggestedWords.java b/java/src/com/android/inputmethod/latin/SuggestedWords.java index 6bc3da885..dcfaa3f6d 100644 --- a/java/src/com/android/inputmethod/latin/SuggestedWords.java +++ b/java/src/com/android/inputmethod/latin/SuggestedWords.java @@ -142,6 +142,15 @@ public class SuggestedWords { return mSuggestedWordInfoList.get(index); } + /** + * Gets the suggestion index from the suggestions list. + * @param suggestedWordInfo The {@link SuggestedWordInfo} to find the index. + * @return The position of the suggestion in the suggestion list. + */ + public int indexOf(SuggestedWordInfo suggestedWordInfo) { + return mSuggestedWordInfoList.indexOf(suggestedWordInfo); + } + public String getDebugString(final int pos) { if (!DebugFlags.DEBUG_ENABLED) { return null; diff --git a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java index 233a22512..2d5bd85dd 100644 --- a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java +++ b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java @@ -60,6 +60,7 @@ import com.android.inputmethod.latin.suggestions.SuggestionStripViewAccessor; import com.android.inputmethod.latin.utils.AsyncResultHolder; import com.android.inputmethod.latin.utils.InputTypeUtils; import com.android.inputmethod.latin.utils.RecapitalizeStatus; +import com.android.inputmethod.latin.utils.StatsUtils; import com.android.inputmethod.latin.utils.StringUtils; import com.android.inputmethod.latin.utils.TextRange; @@ -361,6 +362,8 @@ public final class InputLogic { if (shouldShowAddToDictionaryIndicator) { mTextDecorator.showAddToDictionaryIndicator(suggestionInfo); } + + StatsUtils.onPickSuggestionManually(mSuggestedWords, suggestionInfo); return inputTransaction; }