AI 143272: am: CL 143256 Make the Term emulator work with the most recent keyboard IME.

+ Makes the "Enter" key work again.
  + Makes the "Delete" key delete just one character each time you press it
  instead of two.
  Original author: jackpal
  Merged from: //branches/cupcake/...

Automated import of CL 143272
This commit is contained in:
Jack Palevich
2009-03-27 20:39:49 -07:00
committed by The Android Open Source Project
parent 5303d5c523
commit 376013596d

View File

@@ -548,16 +548,6 @@ public class Term extends Activity {
+ controlKey + " 6 ==> Control-^"). + controlKey + " 6 ==> Control-^").
show(); show();
} }
private void print(String msg) {
char[] chars = msg.toCharArray();
int len = chars.length;
byte[] bytes = new byte[len];
for (int i = 0; i < len; i++) {
bytes[i] = (byte) chars[i];
}
mEmulatorView.append(bytes, 0, len);
}
} }
@@ -2707,9 +2697,14 @@ class EmulatorView extends View implements GestureDetector.OnGestureListener {
return null; return null;
} }
public boolean hideStatusIcon() { public boolean performEditorAction(int actionCode) {
if(actionCode == EditorInfo.IME_ACTION_UNSPECIFIED) {
// The "return" key has been pressed on the IME.
sendText("\n");
return true; return true;
} }
return false;
}
public boolean performContextMenuAction(int id) { public boolean performContextMenuAction(int id) {
return true; return true;
@@ -2720,14 +2715,13 @@ class EmulatorView extends View implements GestureDetector.OnGestureListener {
} }
public boolean sendKeyEvent(KeyEvent event) { public boolean sendKeyEvent(KeyEvent event) {
if (event.getAction() == KeyEvent.ACTION_DOWN) {
switch(event.getKeyCode()) { switch(event.getKeyCode()) {
case KeyEvent.KEYCODE_ENTER:
sendChar('\r');
break;
case KeyEvent.KEYCODE_DEL: case KeyEvent.KEYCODE_DEL:
sendChar(127); sendChar(127);
break; break;
} }
}
return true; return true;
} }
@@ -2739,10 +2733,6 @@ class EmulatorView extends View implements GestureDetector.OnGestureListener {
return true; return true;
} }
public boolean showStatusIcon(String packageName, int resId) {
return true;
}
private void sendChar(int c) { private void sendChar(int c) {
try { try {
mTermOut.write(c); mTermOut.write(c);