use of android.text.method.MovementMethod in project android_frameworks_base by crdroidandroid.
the class InputMethodService method doMovementKey.
boolean doMovementKey(int keyCode, KeyEvent event, int count) {
final ExtractEditText eet = getExtractEditTextIfVisible();
if (eet != null) {
// If we are in fullscreen mode, the cursor will move around
// the extract edit text, but should NOT cause focus to move
// to other fields.
MovementMethod movement = eet.getMovementMethod();
Layout layout = eet.getLayout();
if (movement != null && layout != null) {
// cursor will properly move in our own word wrapping.
if (count == MOVEMENT_DOWN) {
if (movement.onKeyDown(eet, eet.getText(), keyCode, event)) {
reportExtractedMovement(keyCode, 1);
return true;
}
} else if (count == MOVEMENT_UP) {
if (movement.onKeyUp(eet, eet.getText(), keyCode, event)) {
return true;
}
} else {
if (movement.onKeyOther(eet, eet.getText(), event)) {
reportExtractedMovement(keyCode, count);
} else {
KeyEvent down = KeyEvent.changeAction(event, KeyEvent.ACTION_DOWN);
if (movement.onKeyDown(eet, eet.getText(), keyCode, down)) {
KeyEvent up = KeyEvent.changeAction(event, KeyEvent.ACTION_UP);
movement.onKeyUp(eet, eet.getText(), keyCode, up);
while (--count > 0) {
movement.onKeyDown(eet, eet.getText(), keyCode, down);
movement.onKeyUp(eet, eet.getText(), keyCode, up);
}
reportExtractedMovement(keyCode, count);
}
}
}
}
// we never allow DPAD navigation to the application.
switch(keyCode) {
case KeyEvent.KEYCODE_DPAD_LEFT:
case KeyEvent.KEYCODE_DPAD_RIGHT:
case KeyEvent.KEYCODE_DPAD_UP:
case KeyEvent.KEYCODE_DPAD_DOWN:
return true;
}
}
return false;
}
Aggregations