am abe66a7e: am 6785b907: Remove touch coordinate from pickSuggestionManually

* commit 'abe66a7e5bcbd324dca57d597fa37772100a396f':
  Remove touch coordinate from pickSuggestionManually
main
Tadashi G. Takaoka 2012-08-21 01:33:49 -07:00 committed by Android Git Automerger
commit 8e479140bf
4 changed files with 23 additions and 21 deletions

View File

@ -1883,8 +1883,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
// Called from {@link SuggestionStripView} through the {@link SuggestionStripView#Listener} // Called from {@link SuggestionStripView} through the {@link SuggestionStripView#Listener}
// interface // interface
@Override @Override
public void pickSuggestionManually(final int index, final CharSequence suggestion, public void pickSuggestionManually(final int index, final CharSequence suggestion) {
final int x, final int y) {
final SuggestedWords suggestedWords = mSuggestionStripView.getSuggestions(); final SuggestedWords suggestedWords = mSuggestionStripView.getSuggestions();
// If this is a punctuation picked from the suggestion strip, pass it to onCodeInput // If this is a punctuation picked from the suggestion strip, pass it to onCodeInput
if (suggestion.length() == 1 && isShowingPunctuationList()) { if (suggestion.length() == 1 && isShowingPunctuationList()) {
@ -1893,7 +1892,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
LatinImeLogger.logOnManualSuggestion("", suggestion.toString(), index, suggestedWords); LatinImeLogger.logOnManualSuggestion("", suggestion.toString(), index, suggestedWords);
// Rely on onCodeInput to do the complicated swapping/stripping logic consistently. // Rely on onCodeInput to do the complicated swapping/stripping logic consistently.
if (ProductionFlag.IS_EXPERIMENTAL) { if (ProductionFlag.IS_EXPERIMENTAL) {
ResearchLogger.latinIME_punctuationSuggestion(index, suggestion, x, y); ResearchLogger.latinIME_punctuationSuggestion(index, suggestion);
} }
final int primaryCode = suggestion.charAt(0); final int primaryCode = suggestion.charAt(0);
onCodeInput(primaryCode, onCodeInput(primaryCode,
@ -1926,8 +1925,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
mConnection.commitCompletion(completionInfo); mConnection.commitCompletion(completionInfo);
mConnection.endBatchEdit(); mConnection.endBatchEdit();
if (ProductionFlag.IS_EXPERIMENTAL) { if (ProductionFlag.IS_EXPERIMENTAL) {
ResearchLogger.latinIME_pickApplicationSpecifiedCompletion(index, ResearchLogger.latinIME_pickApplicationSpecifiedCompletion(
completionInfo.getText(), x, y); index, completionInfo.getText());
} }
return; return;
} }
@ -1938,7 +1937,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
LatinImeLogger.logOnManualSuggestion(replacedWord, LatinImeLogger.logOnManualSuggestion(replacedWord,
suggestion.toString(), index, suggestedWords); suggestion.toString(), index, suggestedWords);
if (ProductionFlag.IS_EXPERIMENTAL) { if (ProductionFlag.IS_EXPERIMENTAL) {
ResearchLogger.latinIME_pickSuggestionManually(replacedWord, index, suggestion, x, y); ResearchLogger.latinIME_pickSuggestionManually(replacedWord, index, suggestion);
} }
mExpectingUpdateSelection = true; mExpectingUpdateSelection = true;
commitChosenWord(suggestion, LastComposedWord.COMMIT_TYPE_MANUAL_PICK, commitChosenWord(suggestion, LastComposedWord.COMMIT_TYPE_MANUAL_PICK,

View File

@ -72,7 +72,7 @@ public class SuggestionStripView extends RelativeLayout implements OnClickListen
OnLongClickListener { OnLongClickListener {
public interface Listener { public interface Listener {
public boolean addWordToUserDictionary(String word); public boolean addWordToUserDictionary(String word);
public void pickSuggestionManually(int index, CharSequence word, int x, int y); public void pickSuggestionManually(int index, CharSequence word);
} }
// The maximum number of suggestions available. See {@link Suggest#mPrefMaxSuggestions}. // The maximum number of suggestions available. See {@link Suggest#mPrefMaxSuggestions}.
@ -726,9 +726,7 @@ public class SuggestionStripView extends RelativeLayout implements OnClickListen
public boolean onCustomRequest(int requestCode) { public boolean onCustomRequest(int requestCode) {
final int index = requestCode; final int index = requestCode;
final CharSequence word = mSuggestedWords.getWord(index); final CharSequence word = mSuggestedWords.getWord(index);
// TODO: change caller path so coordinates are passed through here mListener.pickSuggestionManually(index, word);
mListener.pickSuggestionManually(index, word, NOT_A_TOUCH_COORDINATE,
NOT_A_TOUCH_COORDINATE);
dismissMoreSuggestions(); dismissMoreSuggestions();
return true; return true;
} }
@ -874,7 +872,7 @@ public class SuggestionStripView extends RelativeLayout implements OnClickListen
return; return;
final CharSequence word = mSuggestedWords.getWord(index); final CharSequence word = mSuggestedWords.getWord(index);
mListener.pickSuggestionManually(index, word, mLastX, mLastY); mListener.pickSuggestionManually(index, word);
} }
@Override @Override

View File

@ -50,6 +50,7 @@ import android.widget.Toast;
import com.android.inputmethod.keyboard.Key; import com.android.inputmethod.keyboard.Key;
import com.android.inputmethod.keyboard.Keyboard; import com.android.inputmethod.keyboard.Keyboard;
import com.android.inputmethod.keyboard.KeyboardActionListener;
import com.android.inputmethod.keyboard.KeyboardId; import com.android.inputmethod.keyboard.KeyboardId;
import com.android.inputmethod.keyboard.KeyboardSwitcher; import com.android.inputmethod.keyboard.KeyboardSwitcher;
import com.android.inputmethod.keyboard.KeyboardView; import com.android.inputmethod.keyboard.KeyboardView;
@ -1062,9 +1063,11 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
"LatinIMEPickApplicationSpecifiedCompletion", "index", "text", "x", "y" "LatinIMEPickApplicationSpecifiedCompletion", "index", "text", "x", "y"
}; };
public static void latinIME_pickApplicationSpecifiedCompletion(final int index, public static void latinIME_pickApplicationSpecifiedCompletion(final int index,
final CharSequence cs, int x, int y) { final CharSequence cs) {
final Object[] values = { final Object[] values = {
index, cs, x, y index, cs,
KeyboardActionListener.SUGGESTION_STRIP_COORDINATE,
KeyboardActionListener.SUGGESTION_STRIP_COORDINATE
}; };
final ResearchLogger researchLogger = getInstance(); final ResearchLogger researchLogger = getInstance();
researchLogger.enqueuePotentiallyPrivateEvent( researchLogger.enqueuePotentiallyPrivateEvent(
@ -1075,10 +1078,12 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
"LatinIMEPickSuggestionManually", "replacedWord", "index", "suggestion", "x", "y" "LatinIMEPickSuggestionManually", "replacedWord", "index", "suggestion", "x", "y"
}; };
public static void latinIME_pickSuggestionManually(final String replacedWord, public static void latinIME_pickSuggestionManually(final String replacedWord,
final int index, CharSequence suggestion, int x, int y) { final int index, CharSequence suggestion) {
final Object[] values = { final Object[] values = {
scrubDigitsFromString(replacedWord), index, suggestion == null ? null : scrubDigitsFromString(replacedWord), index,
scrubDigitsFromString(suggestion.toString()), x, y (suggestion == null ? null : scrubDigitsFromString(suggestion.toString())),
KeyboardActionListener.SUGGESTION_STRIP_COORDINATE,
KeyboardActionListener.SUGGESTION_STRIP_COORDINATE
}; };
final ResearchLogger researchLogger = getInstance(); final ResearchLogger researchLogger = getInstance();
researchLogger.enqueuePotentiallyPrivateEvent(EVENTKEYS_LATINIME_PICKSUGGESTIONMANUALLY, researchLogger.enqueuePotentiallyPrivateEvent(EVENTKEYS_LATINIME_PICKSUGGESTIONMANUALLY,
@ -1089,9 +1094,11 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
"LatinIMEPunctuationSuggestion", "index", "suggestion", "x", "y" "LatinIMEPunctuationSuggestion", "index", "suggestion", "x", "y"
}; };
public static void latinIME_punctuationSuggestion(final int index, public static void latinIME_punctuationSuggestion(final int index,
final CharSequence suggestion, int x, int y) { final CharSequence suggestion) {
final Object[] values = { final Object[] values = {
index, suggestion, x, y index, suggestion,
KeyboardActionListener.SUGGESTION_STRIP_COORDINATE,
KeyboardActionListener.SUGGESTION_STRIP_COORDINATE
}; };
getInstance().enqueueEvent(EVENTKEYS_LATINIME_PUNCTUATIONSUGGESTION, values); getInstance().enqueueEvent(EVENTKEYS_LATINIME_PUNCTUATIONSUGGESTION, values);
} }

View File

@ -260,9 +260,7 @@ public class InputTestsBase extends ServiceTestCase<LatinIME> {
} }
protected void pickSuggestionManually(final int index, final CharSequence suggestion) { protected void pickSuggestionManually(final int index, final CharSequence suggestion) {
mLatinIME.pickSuggestionManually(index, suggestion, mLatinIME.pickSuggestionManually(index, suggestion);
KeyboardActionListener.NOT_A_TOUCH_COORDINATE,
KeyboardActionListener.NOT_A_TOUCH_COORDINATE);
} }
// Helper to avoid writing the try{}catch block each time // Helper to avoid writing the try{}catch block each time