diff src/com/five_ten_sg/connectbot/service/TerminalBridge.java @ 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 cb9e359ea2bd
children fd4ca38f38c9
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