am 6785b907: Remove touch coordinate from pickSuggestionManually

* commit '6785b9072762e15bb49657ce7b7d228dab76e44a':
  Remove touch coordinate from pickSuggestionManually
This commit is contained in:
Tadashi G. Takaoka 2012-08-21 01:32:39 -07:00 committed by Android Git Automerger
commit abe66a7e5b
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}
// interface
@Override
public void pickSuggestionManually(final int index, final CharSequence suggestion,
final int x, final int y) {
public void pickSuggestionManually(final int index, final CharSequence suggestion) {
final SuggestedWords suggestedWords = mSuggestionStripView.getSuggestions();
// If this is a punctuation picked from the suggestion strip, pass it to onCodeInput
if (suggestion.length() == 1 && isShowingPunctuationList()) {
@ -1893,7 +1892,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
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);
ResearchLogger.latinIME_punctuationSuggestion(index, suggestion);
}
final int primaryCode = suggestion.charAt(0);
onCodeInput(primaryCode,
@ -1926,8 +1925,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
mConnection.commitCompletion(completionInfo);
mConnection.endBatchEdit();
if (ProductionFlag.IS_EXPERIMENTAL) {
ResearchLogger.latinIME_pickApplicationSpecifiedCompletion(index,
completionInfo.getText(), x, y);
ResearchLogger.latinIME_pickApplicationSpecifiedCompletion(
index, completionInfo.getText());
}
return;
}
@ -1938,7 +1937,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
LatinImeLogger.logOnManualSuggestion(replacedWord,
suggestion.toString(), index, suggestedWords);
if (ProductionFlag.IS_EXPERIMENTAL) {
ResearchLogger.latinIME_pickSuggestionManually(replacedWord, index, suggestion, x, y);
ResearchLogger.latinIME_pickSuggestionManually(replacedWord, index, suggestion);
}
mExpectingUpdateSelection = true;
commitChosenWord(suggestion, LastComposedWord.COMMIT_TYPE_MANUAL_PICK,

View file

@ -72,7 +72,7 @@ public class SuggestionStripView extends RelativeLayout implements OnClickListen
OnLongClickListener {
public interface Listener {
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}.
@ -726,9 +726,7 @@ public class SuggestionStripView extends RelativeLayout implements OnClickListen
public boolean onCustomRequest(int requestCode) {
final int index = requestCode;
final CharSequence word = mSuggestedWords.getWord(index);
// TODO: change caller path so coordinates are passed through here
mListener.pickSuggestionManually(index, word, NOT_A_TOUCH_COORDINATE,
NOT_A_TOUCH_COORDINATE);
mListener.pickSuggestionManually(index, word);
dismissMoreSuggestions();
return true;
}
@ -874,7 +872,7 @@ public class SuggestionStripView extends RelativeLayout implements OnClickListen
return;
final CharSequence word = mSuggestedWords.getWord(index);
mListener.pickSuggestionManually(index, word, mLastX, mLastY);
mListener.pickSuggestionManually(index, word);
}
@Override

View file

@ -50,6 +50,7 @@ import android.widget.Toast;
import com.android.inputmethod.keyboard.Key;
import com.android.inputmethod.keyboard.Keyboard;
import com.android.inputmethod.keyboard.KeyboardActionListener;
import com.android.inputmethod.keyboard.KeyboardId;
import com.android.inputmethod.keyboard.KeyboardSwitcher;
import com.android.inputmethod.keyboard.KeyboardView;
@ -1062,9 +1063,11 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
"LatinIMEPickApplicationSpecifiedCompletion", "index", "text", "x", "y"
};
public static void latinIME_pickApplicationSpecifiedCompletion(final int index,
final CharSequence cs, int x, int y) {
final CharSequence cs) {
final Object[] values = {
index, cs, x, y
index, cs,
KeyboardActionListener.SUGGESTION_STRIP_COORDINATE,
KeyboardActionListener.SUGGESTION_STRIP_COORDINATE
};
final ResearchLogger researchLogger = getInstance();
researchLogger.enqueuePotentiallyPrivateEvent(
@ -1075,10 +1078,12 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
"LatinIMEPickSuggestionManually", "replacedWord", "index", "suggestion", "x", "y"
};
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 = {
scrubDigitsFromString(replacedWord), index, suggestion == null ? null :
scrubDigitsFromString(suggestion.toString()), x, y
scrubDigitsFromString(replacedWord), index,
(suggestion == null ? null : scrubDigitsFromString(suggestion.toString())),
KeyboardActionListener.SUGGESTION_STRIP_COORDINATE,
KeyboardActionListener.SUGGESTION_STRIP_COORDINATE
};
final ResearchLogger researchLogger = getInstance();
researchLogger.enqueuePotentiallyPrivateEvent(EVENTKEYS_LATINIME_PICKSUGGESTIONMANUALLY,
@ -1089,9 +1094,11 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
"LatinIMEPunctuationSuggestion", "index", "suggestion", "x", "y"
};
public static void latinIME_punctuationSuggestion(final int index,
final CharSequence suggestion, int x, int y) {
final CharSequence suggestion) {
final Object[] values = {
index, suggestion, x, y
index, suggestion,
KeyboardActionListener.SUGGESTION_STRIP_COORDINATE,
KeyboardActionListener.SUGGESTION_STRIP_COORDINATE
};
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) {
mLatinIME.pickSuggestionManually(index, suggestion,
KeyboardActionListener.NOT_A_TOUCH_COORDINATE,
KeyboardActionListener.NOT_A_TOUCH_COORDINATE);
mLatinIME.pickSuggestionManually(index, suggestion);
}
// Helper to avoid writing the try{}catch block each time