development
Revisão | 729ff799f77fff783ba1fa46d9adb57e500e4150 (tree) |
---|---|
Hora | 2009-03-28 07:49:45 |
Autor | Jack Palevich <> |
Commiter | The Android Open Source Project |
AI 143256: Make the Term emulator work with the most recent keyboard IME.
Automated import of CL 143256
@@ -548,16 +548,6 @@ public class Term extends Activity { | ||
548 | 548 | + controlKey + " 6 ==> Control-^"). |
549 | 549 | show(); |
550 | 550 | } |
551 | - | |
552 | - private void print(String msg) { | |
553 | - char[] chars = msg.toCharArray(); | |
554 | - int len = chars.length; | |
555 | - byte[] bytes = new byte[len]; | |
556 | - for (int i = 0; i < len; i++) { | |
557 | - bytes[i] = (byte) chars[i]; | |
558 | - } | |
559 | - mEmulatorView.append(bytes, 0, len); | |
560 | - } | |
561 | 551 | } |
562 | 552 | |
563 | 553 |
@@ -2707,8 +2697,13 @@ class EmulatorView extends View implements GestureDetector.OnGestureListener { | ||
2707 | 2697 | return null; |
2708 | 2698 | } |
2709 | 2699 | |
2710 | - public boolean hideStatusIcon() { | |
2711 | - return true; | |
2700 | + public boolean performEditorAction(int actionCode) { | |
2701 | + if(actionCode == EditorInfo.IME_ACTION_UNSPECIFIED) { | |
2702 | + // The "return" key has been pressed on the IME. | |
2703 | + sendText("\n"); | |
2704 | + return true; | |
2705 | + } | |
2706 | + return false; | |
2712 | 2707 | } |
2713 | 2708 | |
2714 | 2709 | public boolean performContextMenuAction(int id) { |
@@ -2720,13 +2715,12 @@ class EmulatorView extends View implements GestureDetector.OnGestureListener { | ||
2720 | 2715 | } |
2721 | 2716 | |
2722 | 2717 | public boolean sendKeyEvent(KeyEvent event) { |
2723 | - switch(event.getKeyCode()) { | |
2724 | - case KeyEvent.KEYCODE_ENTER: | |
2725 | - sendChar('\r'); | |
2726 | - break; | |
2727 | - case KeyEvent.KEYCODE_DEL: | |
2728 | - sendChar(127); | |
2729 | - break; | |
2718 | + if (event.getAction() == KeyEvent.ACTION_DOWN) { | |
2719 | + switch(event.getKeyCode()) { | |
2720 | + case KeyEvent.KEYCODE_DEL: | |
2721 | + sendChar(127); | |
2722 | + break; | |
2723 | + } | |
2730 | 2724 | } |
2731 | 2725 | return true; |
2732 | 2726 | } |
@@ -2739,10 +2733,6 @@ class EmulatorView extends View implements GestureDetector.OnGestureListener { | ||
2739 | 2733 | return true; |
2740 | 2734 | } |
2741 | 2735 | |
2742 | - public boolean showStatusIcon(String packageName, int resId) { | |
2743 | - return true; | |
2744 | - } | |
2745 | - | |
2746 | 2736 | private void sendChar(int c) { |
2747 | 2737 | try { |
2748 | 2738 | mTermOut.write(c); |