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

Bug: 8636060
Change-Id: Ic051e5d5514d270101b0571a2d30e2caa8f85bc1
main
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}.
@Override
public void onCodeInput(final int primaryCode, final int x, final int y) {
mInputLogic.onCodeInput(primaryCode, x, y, mHandler, mKeyboardSwitcher, mSubtypeSwitcher);
public void onCodeInput(final int codePoint, final int x, final int y) {
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

View File

@ -30,7 +30,6 @@ import com.android.inputmethod.compat.SuggestionSpanUtils;
import com.android.inputmethod.event.EventInterpreter;
import com.android.inputmethod.keyboard.Keyboard;
import com.android.inputmethod.keyboard.KeyboardSwitcher;
import com.android.inputmethod.keyboard.MainKeyboardView;
import com.android.inputmethod.latin.Constants;
import com.android.inputmethod.latin.Dictionary;
import com.android.inputmethod.latin.InputPointers;
@ -225,25 +224,10 @@ public final class InputLogic {
}
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) {
case Constants.CODE_DELETE:
handleBackspace(settingsValues, spaceState, handler, keyboardSwitcher);
LatinImeLogger.logOnDelete(keyX, keyY);
LatinImeLogger.logOnDelete(x, y);
break;
case Constants.CODE_SHIFT:
// 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
// enter key that should input a carriage return.
didAutoCorrect = handleNonSpecialCharacter(settingsValues, Constants.CODE_ENTER,
keyX, keyY, spaceState, keyboardSwitcher, handler);
x, y, spaceState, keyboardSwitcher, handler);
}
break;
case Constants.CODE_SHIFT_ENTER:
didAutoCorrect = handleNonSpecialCharacter(settingsValues, Constants.CODE_ENTER,
keyX, keyY, spaceState, keyboardSwitcher, handler);
x, y, spaceState, keyboardSwitcher, handler);
break;
default:
didAutoCorrect = handleNonSpecialCharacter(settingsValues,
code, keyX, keyY, spaceState, keyboardSwitcher, handler);
code, x, y, spaceState, keyboardSwitcher, handler);
break;
}
keyboardSwitcher.onCodeInput(code);

View File

@ -109,7 +109,7 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
// feedback mechanism to generate multiple tests.
private static final boolean FEEDBACK_DIALOG_SHOULD_PRESERVE_TEXT_FIELD = 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
// testing.
/* package for test */ static final boolean IS_LOGGING_EVERYTHING = false