[IL64] Pull up X,Y processing, step 3

Bug: 8636060
Change-Id: Ic051e5d5514d270101b0571a2d30e2caa8f85bc1
This commit is contained in:
Jean Chalard 2013-12-27 16:38:13 +09:00
parent b8216a4e7e
commit 352286a43b
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