Merge "Remove the input connection sidework from handleCharacter"
commit
edf4995a3b
|
@ -1495,12 +1495,19 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
|
||||||
private void handleCharacter(final int primaryCode, final int[] keyCodes, final int x,
|
private void handleCharacter(final int primaryCode, final int[] keyCodes, final int x,
|
||||||
final int y, final int spaceState) {
|
final int y, final int spaceState) {
|
||||||
mVoiceProxy.handleCharacter();
|
mVoiceProxy.handleCharacter();
|
||||||
|
|
||||||
final InputConnection ic = getCurrentInputConnection();
|
final InputConnection ic = getCurrentInputConnection();
|
||||||
if (ic != null) ic.beginBatchEdit();
|
if (null != ic) ic.beginBatchEdit();
|
||||||
|
// TODO: if ic is null, does it make any sense to call this?
|
||||||
|
handleCharacterWhileInBatchEdit(primaryCode, keyCodes, x, y, spaceState, ic);
|
||||||
|
if (null != ic) ic.endBatchEdit();
|
||||||
|
}
|
||||||
|
|
||||||
|
// "ic" may be null without this crashing, but the behavior will be really strange
|
||||||
|
private void handleCharacterWhileInBatchEdit(final int primaryCode, final int[] keyCodes,
|
||||||
|
final int x, final int y, final int spaceState, final InputConnection ic) {
|
||||||
if (SPACE_STATE_MAGIC == spaceState
|
if (SPACE_STATE_MAGIC == spaceState
|
||||||
&& mSettingsValues.isMagicSpaceStripper(primaryCode)) {
|
&& mSettingsValues.isMagicSpaceStripper(primaryCode)) {
|
||||||
removeTrailingSpaceWhileInBatchEdit(ic);
|
if (null != ic) removeTrailingSpaceWhileInBatchEdit(ic);
|
||||||
}
|
}
|
||||||
|
|
||||||
int code = primaryCode;
|
int code = primaryCode;
|
||||||
|
@ -1519,7 +1526,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
|
||||||
if (switcher.isShiftedOrShiftLocked()) {
|
if (switcher.isShiftedOrShiftLocked()) {
|
||||||
if (keyCodes == null || keyCodes[0] < Character.MIN_CODE_POINT
|
if (keyCodes == null || keyCodes[0] < Character.MIN_CODE_POINT
|
||||||
|| keyCodes[0] > Character.MAX_CODE_POINT) {
|
|| keyCodes[0] > Character.MAX_CODE_POINT) {
|
||||||
if (null != ic) ic.endBatchEdit();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
code = keyCodes[0];
|
code = keyCodes[0];
|
||||||
|
@ -1533,7 +1539,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
|
||||||
} else {
|
} else {
|
||||||
// Some keys, such as [eszett], have upper case as multi-characters.
|
// Some keys, such as [eszett], have upper case as multi-characters.
|
||||||
onTextInput(upperCaseString);
|
onTextInput(upperCaseString);
|
||||||
if (null != ic) ic.endBatchEdit();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1563,7 +1568,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
|
||||||
} else {
|
} else {
|
||||||
Utils.Stats.onNonSeparator((char)code, x, y);
|
Utils.Stats.onNonSeparator((char)code, x, y);
|
||||||
}
|
}
|
||||||
if (null != ic) ic.endBatchEdit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleSeparator(final int primaryCode, final int x, final int y,
|
private void handleSeparator(final int primaryCode, final int x, final int y,
|
||||||
|
|
Loading…
Reference in New Issue