changeset 176:6e07ea418b90

add f13 thru f24 keys
author Carl Byington <carl@five-ten-sg.com>
date Wed, 02 Jul 2014 12:36:54 -0700
parents 2a7199ad90be
children fd4ca38f38c9
files src/com/five_ten_sg/connectbot/service/TerminalBridge.java src/com/five_ten_sg/connectbot/service/TerminalMonitor.java
diffstat 2 files changed, 41 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/src/com/five_ten_sg/connectbot/service/TerminalBridge.java	Wed Jul 02 10:13:15 2014 -0700
+++ b/src/com/five_ten_sg/connectbot/service/TerminalBridge.java	Wed Jul 02 12:36:54 2014 -0700
@@ -1261,7 +1261,33 @@
      * Function keys dialog
      */
     public boolean showFKeysDialog() {
-        final String pickerString = "1234567890";
+        final String pickerString = "1234567890abcdefghijklmn";
+        HashMap<String,Integer> keymap = new HashMap<String,Integer>();
+        keymap.put("1", vt320.KEY_F1);
+        keymap.put("2", vt320.KEY_F2);
+        keymap.put("3", vt320.KEY_F3);
+        keymap.put("4", vt320.KEY_F4);
+        keymap.put("5", vt320.KEY_F5);
+        keymap.put("6", vt320.KEY_F6);
+        keymap.put("7", vt320.KEY_F7);
+        keymap.put("8", vt320.KEY_F8);
+        keymap.put("9", vt320.KEY_F9);
+        keymap.put("0", vt320.KEY_F10);
+        keymap.put("a", vt320.KEY_F11);
+        keymap.put("b", vt320.KEY_F12);
+        keymap.put("c", vt320.KEY_F13);
+        keymap.put("d", vt320.KEY_F14);
+        keymap.put("e", vt320.KEY_F15);
+        keymap.put("f", vt320.KEY_F16);
+        keymap.put("g", vt320.KEY_F17);
+        keymap.put("h", vt320.KEY_F18);
+        keymap.put("i", vt320.KEY_F19);
+        keymap.put("j", vt320.KEY_F20);
+        keymap.put("k", vt320.KEY_F21);
+        keymap.put("l", vt320.KEY_F22);
+        keymap.put("m", vt320.KEY_F23);
+        keymap.put("n", vt320.KEY_F24);
+
         CharSequence str = "";
         Editable content = Editable.Factory.getInstance().newEditable(str);
 
@@ -1271,31 +1297,8 @@
         CharacterPickerDialog cpd = new CharacterPickerDialog(parent.getContext(),
         parent, content, pickerString, true) {
             private void buttonPressed(CharSequence result) {
-                int key = 0;
-
-                if (result.equals("1"))
-                    key = vt320.KEY_F1;
-                else if (result.equals("2"))
-                    key = vt320.KEY_F2;
-                else if (result.equals("3"))
-                    key = vt320.KEY_F3;
-                else if (result.equals("4"))
-                    key = vt320.KEY_F4;
-                else if (result.equals("5"))
-                    key = vt320.KEY_F5;
-                else if (result.equals("6"))
-                    key = vt320.KEY_F6;
-                else if (result.equals("7"))
-                    key = vt320.KEY_F7;
-                else if (result.equals("8"))
-                    key = vt320.KEY_F8;
-                else if (result.equals("9"))
-                    key = vt320.KEY_F9;
-                else if (result.equals("0"))
-                    key = vt320.KEY_F10;
-
-                if (key != 0) buffer.keyPressed(key, ' ', 0);
-
+                String s = new String(result);
+                if (keymap.containsKey(s)) buffer.keyPressed(keymap.get(s), ' ', 0);
                 dismiss();
             }
             @Override
--- a/src/com/five_ten_sg/connectbot/service/TerminalMonitor.java	Wed Jul 02 10:13:15 2014 -0700
+++ b/src/com/five_ten_sg/connectbot/service/TerminalMonitor.java	Wed Jul 02 12:36:54 2014 -0700
@@ -226,6 +226,18 @@
         keymap.put(0x79, vt320.KEY_F10);         // vk_f10
         keymap.put(0x7a, vt320.KEY_F11);         // vk_f11
         keymap.put(0x7b, vt320.KEY_F12);         // vk_f12
+        keymap.put(0x7c, vt320.KEY_F13);         // vk_f13
+        keymap.put(0x7d, vt320.KEY_F14);         // vk_f14
+        keymap.put(0x7e, vt320.KEY_F15);         // vk_f15
+        keymap.put(0x7f, vt320.KEY_F16);         // vk_f16
+        keymap.put(0x80, vt320.KEY_F17);         // vk_f17
+        keymap.put(0x81, vt320.KEY_F18);         // vk_f18
+        keymap.put(0x82, vt320.KEY_F19);         // vk_f19
+        keymap.put(0x83, vt320.KEY_F20);         // vk_f20
+        keymap.put(0x84, vt320.KEY_F21);         // vk_f21
+        keymap.put(0x85, vt320.KEY_F22);         // vk_f22
+        keymap.put(0x86, vt320.KEY_F23);         // vk_f23
+        keymap.put(0x87, vt320.KEY_F24);         // vk_f24
         // bind to the monitor service
         Intent intent = new Intent("com.five_ten_sg.connectbot.monitor.MonitorService");
         parent.bindService(intent, monitor_connection, Context.BIND_AUTO_CREATE);