am 352286a4: [IL64] Pull up X,Y processing, step 3

* commit '352286a43b0f951a5082ca741c2bd7f501f48c81':
  [IL64] Pull up X,Y processing, step 3
main
Jean Chalard 2014-01-22 18:44:48 -08:00 committed by Android Git Automerger
commit 0f06d8801a
3 changed files with 23 additions and 23 deletions

View File

@ -1246,8 +1246,24 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
// Implementation of {@link KeyboardActionListener}. // Implementation of {@link KeyboardActionListener}.
@Override @Override
public void onCodeInput(final int primaryCode, final int x, final int y) { public void onCodeInput(final int codePoint, final int x, final int y) {
mInputLogic.onCodeInput(primaryCode, x, y, mHandler, mKeyboardSwitcher, mSubtypeSwitcher); final int keyX, keyY;
final Keyboard keyboard = mKeyboardSwitcher.getKeyboard();
final MainKeyboardView mainKeyboardView = mKeyboardSwitcher.getMainKeyboardView();
// x and y include some padding, but everything down the line (especially native
// code) needs the coordinates in the keyboard frame.
// TODO: We should reconsider which coordinate system should be used to represent
// keyboard event. Also we should pull this up -- LatinIME has no business doing
// this transformation, it should be done already before calling onCodeInput.
if (keyboard != null && keyboard.hasProximityCharsCorrection(codePoint)) {
keyX = mainKeyboardView.getKeyX(x);
keyY = mainKeyboardView.getKeyY(y);
} else {
keyX = Constants.NOT_A_COORDINATE;
keyY = Constants.NOT_A_COORDINATE;
}
mInputLogic.onCodeInput(codePoint, keyX, keyY, mHandler, mKeyboardSwitcher,
mSubtypeSwitcher);
} }
// Called from PointerTracker through the KeyboardActionListener interface // Called from PointerTracker through the KeyboardActionListener interface

View File

@ -30,7 +30,6 @@ import com.android.inputmethod.compat.SuggestionSpanUtils;
import com.android.inputmethod.event.EventInterpreter; import com.android.inputmethod.event.EventInterpreter;
import com.android.inputmethod.keyboard.Keyboard; import com.android.inputmethod.keyboard.Keyboard;
import com.android.inputmethod.keyboard.KeyboardSwitcher; import com.android.inputmethod.keyboard.KeyboardSwitcher;
import com.android.inputmethod.keyboard.MainKeyboardView;
import com.android.inputmethod.latin.Constants; import com.android.inputmethod.latin.Constants;
import com.android.inputmethod.latin.Dictionary; import com.android.inputmethod.latin.Dictionary;
import com.android.inputmethod.latin.InputPointers; import com.android.inputmethod.latin.InputPointers;
@ -225,25 +224,10 @@ public final class InputLogic {
} }
boolean didAutoCorrect = false; boolean didAutoCorrect = false;
final int keyX, keyY;
final Keyboard keyboard = keyboardSwitcher.getKeyboard();
final MainKeyboardView mainKeyboardView = keyboardSwitcher.getMainKeyboardView();
// TODO: We should reconsider which coordinate system should be used to represent
// keyboard event.
if (keyboard != null && keyboard.hasProximityCharsCorrection(code)) {
// x and y include some padding, but everything down the line (especially native
// code) needs the coordinates in the keyboard frame.
// TODO: move this frame change up
keyX = mainKeyboardView.getKeyX(x);
keyY = mainKeyboardView.getKeyY(y);
} else {
keyX = Constants.NOT_A_COORDINATE;
keyY = Constants.NOT_A_COORDINATE;
}
switch (code) { switch (code) {
case Constants.CODE_DELETE: case Constants.CODE_DELETE:
handleBackspace(settingsValues, spaceState, handler, keyboardSwitcher); handleBackspace(settingsValues, spaceState, handler, keyboardSwitcher);
LatinImeLogger.logOnDelete(keyX, keyY); LatinImeLogger.logOnDelete(x, y);
break; break;
case Constants.CODE_SHIFT: case Constants.CODE_SHIFT:
// Note: Calling back to the keyboard on Shift key is handled in // Note: Calling back to the keyboard on Shift key is handled in
@ -304,16 +288,16 @@ public final class InputLogic {
// No action label, and the action from imeOptions is NONE: this is a regular // No action label, and the action from imeOptions is NONE: this is a regular
// enter key that should input a carriage return. // enter key that should input a carriage return.
didAutoCorrect = handleNonSpecialCharacter(settingsValues, Constants.CODE_ENTER, didAutoCorrect = handleNonSpecialCharacter(settingsValues, Constants.CODE_ENTER,
keyX, keyY, spaceState, keyboardSwitcher, handler); x, y, spaceState, keyboardSwitcher, handler);
} }
break; break;
case Constants.CODE_SHIFT_ENTER: case Constants.CODE_SHIFT_ENTER:
didAutoCorrect = handleNonSpecialCharacter(settingsValues, Constants.CODE_ENTER, didAutoCorrect = handleNonSpecialCharacter(settingsValues, Constants.CODE_ENTER,
keyX, keyY, spaceState, keyboardSwitcher, handler); x, y, spaceState, keyboardSwitcher, handler);
break; break;
default: default:
didAutoCorrect = handleNonSpecialCharacter(settingsValues, didAutoCorrect = handleNonSpecialCharacter(settingsValues,
code, keyX, keyY, spaceState, keyboardSwitcher, handler); code, x, y, spaceState, keyboardSwitcher, handler);
break; break;
} }
keyboardSwitcher.onCodeInput(code); keyboardSwitcher.onCodeInput(code);

View File

@ -109,7 +109,7 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
// feedback mechanism to generate multiple tests. // feedback mechanism to generate multiple tests.
private static final boolean FEEDBACK_DIALOG_SHOULD_PRESERVE_TEXT_FIELD = false; private static final boolean FEEDBACK_DIALOG_SHOULD_PRESERVE_TEXT_FIELD = false;
/* package */ static boolean sIsLogging = false; /* package */ static boolean sIsLogging = false;
private static final int OUTPUT_FORMAT_VERSION = 5; private static final int OUTPUT_FORMAT_VERSION = 6;
// Whether all words should be recorded, leaving unsampled word between bigrams. Useful for // Whether all words should be recorded, leaving unsampled word between bigrams. Useful for
// testing. // testing.
/* package for test */ static final boolean IS_LOGGING_EVERYTHING = false /* package for test */ static final boolean IS_LOGGING_EVERYTHING = false