diff options
author | 2012-04-11 21:42:22 -0700 | |
---|---|---|
committer | 2012-04-16 16:52:25 -0700 | |
commit | 9bfb6202154e06d7156f2f374dd9359f1be4eb68 (patch) | |
tree | 55597afdc782b7a545da9b856488c86524e529fd /java/src | |
parent | 473a3dd66952711d76e6d3e74292c0d6c7fa38d2 (diff) | |
download | latinime-9bfb6202154e06d7156f2f374dd9359f1be4eb68.tar.gz latinime-9bfb6202154e06d7156f2f374dd9359f1be4eb68.tar.xz latinime-9bfb6202154e06d7156f2f374dd9359f1be4eb68.zip |
add logPoint for manual correction (inc touch pos)
Bug: 6188932
Change-Id: Ibcc4901bcfab6632ee4c59cb58d35452218a288d
Diffstat (limited to 'java/src')
3 files changed, 47 insertions, 5 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index caa7f9312..b30d1e35c 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -1817,7 +1817,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen } @Override - public void pickSuggestionManually(final int index, final CharSequence suggestion) { + public void pickSuggestionManually(final int index, final CharSequence suggestion, + int x, int y) { final SuggestedWords suggestedWords = mSuggestionsView.getSuggestions(); if (SPACE_STATE_PHANTOM == mSpaceState && suggestion.length() > 0) { @@ -1840,6 +1841,10 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen if (ic != null) { final CompletionInfo completionInfo = mApplicationSpecifiedCompletions[index]; ic.commitCompletion(completionInfo); + if (ProductionFlag.IS_EXPERIMENTAL) { + ResearchLogger.latinIME_pickApplicationSpecifiedCompletion(index, + completionInfo.getText(), x, y); + } } return; } @@ -1850,6 +1855,9 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen // So, LatinImeLogger logs "" as a user's input. LatinImeLogger.logOnManualSuggestion("", suggestion.toString(), index, suggestedWords); // Rely on onCodeInput to do the complicated swapping/stripping logic consistently. + if (ProductionFlag.IS_EXPERIMENTAL) { + ResearchLogger.latinIME_punctuationSuggestion(index, suggestion, x, y); + } final int primaryCode = suggestion.charAt(0); onCodeInput(primaryCode, KeyboardActionListener.SUGGESTION_STRIP_COORDINATE, @@ -1858,8 +1866,12 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen } // We need to log before we commit, because the word composer will store away the user // typed word. - LatinImeLogger.logOnManualSuggestion(mWordComposer.getTypedWord().toString(), + final String replacedWord = mWordComposer.getTypedWord().toString(); + LatinImeLogger.logOnManualSuggestion(replacedWord, suggestion.toString(), index, suggestedWords); + if (ProductionFlag.IS_EXPERIMENTAL) { + ResearchLogger.latinIME_pickSuggestionManually(replacedWord, index, suggestion, x, y); + } mExpectingUpdateSelection = true; commitChosenWord(suggestion, LastComposedWord.COMMIT_TYPE_MANUAL_PICK, LastComposedWord.NOT_A_SEPARATOR); diff --git a/java/src/com/android/inputmethod/latin/ResearchLogger.java b/java/src/com/android/inputmethod/latin/ResearchLogger.java index 4e90dd624..27f2e2a59 100644 --- a/java/src/com/android/inputmethod/latin/ResearchLogger.java +++ b/java/src/com/android/inputmethod/latin/ResearchLogger.java @@ -375,6 +375,10 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang private static final boolean SUDDENJUMPINGTOUCHEVENTHANDLER_ONTOUCHEVENT_ENABLED = DEFAULT_ENABLED; private static final boolean SUGGESTIONSVIEW_SETSUGGESTIONS_ENABLED = DEFAULT_ENABLED; + private static final boolean LATINIME_PICKAPPLICATIONSPECIFIEDCOMPLETION_ENABLED + = DEFAULT_ENABLED; + private static final boolean LATINIME_PICKPUNCTUATIONSUGGESTION_ENABLED = DEFAULT_ENABLED; + private static final boolean LATINIME_PICKSUGGESTIONMANUALLY_ENABLED = DEFAULT_ENABLED; } public static void logUnstructured(String logGroup, final String details) { @@ -633,6 +637,30 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang } } + public static void latinIME_pickApplicationSpecifiedCompletion(final int index, + final CharSequence text, int x, int y) { + if (UnsLogGroup.LATINIME_PICKAPPLICATIONSPECIFIEDCOMPLETION_ENABLED) { + final String s = String.valueOf(index) + '\t' + text + '\t' + x + '\t' + y; + logUnstructured("latinIME_pickApplicationSpecifiedCompletion", s); + } + } + + public static void latinIME_pickSuggestionManually(final String replacedWord, + final int index, CharSequence suggestion, int x, int y) { + if (UnsLogGroup.LATINIME_PICKSUGGESTIONMANUALLY_ENABLED) { + final String s = String.valueOf(index) + '\t' + suggestion + '\t' + x + '\t' + y; + logUnstructured("latinIME_pickSuggestionManually", s); + } + } + + public static void latinIME_punctuationSuggestion(final int index, + final CharSequence suggestion, int x, int y) { + if (UnsLogGroup.LATINIME_PICKPUNCTUATIONSUGGESTION_ENABLED) { + final String s = String.valueOf(index) + '\t' + suggestion + '\t' + x + '\t' + y; + logUnstructured("latinIME_pickPunctuationSuggestion", s); + } + } + public static void latinIME_switchToKeyboardView() { if (UnsLogGroup.LATINIME_SWITCHTOKEYBOARDVIEW_ENABLED) { final String s = "Switch to keyboard view."; diff --git a/java/src/com/android/inputmethod/latin/suggestions/SuggestionsView.java b/java/src/com/android/inputmethod/latin/suggestions/SuggestionsView.java index 01d51d463..4e1410415 100644 --- a/java/src/com/android/inputmethod/latin/suggestions/SuggestionsView.java +++ b/java/src/com/android/inputmethod/latin/suggestions/SuggestionsView.java @@ -72,7 +72,7 @@ public class SuggestionsView extends RelativeLayout implements OnClickListener, OnLongClickListener { public interface Listener { public boolean addWordToDictionary(String word); - public void pickSuggestionManually(int index, CharSequence word); + public void pickSuggestionManually(int index, CharSequence word, int x, int y); } // The maximum number of suggestions available. See {@link Suggest#mPrefMaxSuggestions}. @@ -717,7 +717,9 @@ public class SuggestionsView extends RelativeLayout implements OnClickListener, public boolean onCustomRequest(int requestCode) { final int index = requestCode; final CharSequence word = mSuggestedWords.getWord(index); - mListener.pickSuggestionManually(index, word); + // TODO: change caller path so coordinates are passed through here + mListener.pickSuggestionManually(index, word, NOT_A_TOUCH_COORDINATE, + NOT_A_TOUCH_COORDINATE); dismissMoreSuggestions(); return true; } @@ -867,7 +869,7 @@ public class SuggestionsView extends RelativeLayout implements OnClickListener, return; final CharSequence word = mSuggestedWords.getWord(index); - mListener.pickSuggestionManually(index, word); + mListener.pickSuggestionManually(index, word, mLastX, mLastY); } @Override |