comparison 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
comparison
equal deleted inserted replaced
175:2a7199ad90be 176:6e07ea418b90
1259 1259
1260 /** 1260 /**
1261 * Function keys dialog 1261 * Function keys dialog
1262 */ 1262 */
1263 public boolean showFKeysDialog() { 1263 public boolean showFKeysDialog() {
1264 final String pickerString = "1234567890"; 1264 final String pickerString = "1234567890abcdefghijklmn";
1265 HashMap<String,Integer> keymap = new HashMap<String,Integer>();
1266 keymap.put("1", vt320.KEY_F1);
1267 keymap.put("2", vt320.KEY_F2);
1268 keymap.put("3", vt320.KEY_F3);
1269 keymap.put("4", vt320.KEY_F4);
1270 keymap.put("5", vt320.KEY_F5);
1271 keymap.put("6", vt320.KEY_F6);
1272 keymap.put("7", vt320.KEY_F7);
1273 keymap.put("8", vt320.KEY_F8);
1274 keymap.put("9", vt320.KEY_F9);
1275 keymap.put("0", vt320.KEY_F10);
1276 keymap.put("a", vt320.KEY_F11);
1277 keymap.put("b", vt320.KEY_F12);
1278 keymap.put("c", vt320.KEY_F13);
1279 keymap.put("d", vt320.KEY_F14);
1280 keymap.put("e", vt320.KEY_F15);
1281 keymap.put("f", vt320.KEY_F16);
1282 keymap.put("g", vt320.KEY_F17);
1283 keymap.put("h", vt320.KEY_F18);
1284 keymap.put("i", vt320.KEY_F19);
1285 keymap.put("j", vt320.KEY_F20);
1286 keymap.put("k", vt320.KEY_F21);
1287 keymap.put("l", vt320.KEY_F22);
1288 keymap.put("m", vt320.KEY_F23);
1289 keymap.put("n", vt320.KEY_F24);
1290
1265 CharSequence str = ""; 1291 CharSequence str = "";
1266 Editable content = Editable.Factory.getInstance().newEditable(str); 1292 Editable content = Editable.Factory.getInstance().newEditable(str);
1267 1293
1268 if (parent == null) 1294 if (parent == null)
1269 return false; 1295 return false;
1270 1296
1271 CharacterPickerDialog cpd = new CharacterPickerDialog(parent.getContext(), 1297 CharacterPickerDialog cpd = new CharacterPickerDialog(parent.getContext(),
1272 parent, content, pickerString, true) { 1298 parent, content, pickerString, true) {
1273 private void buttonPressed(CharSequence result) { 1299 private void buttonPressed(CharSequence result) {
1274 int key = 0; 1300 String s = new String(result);
1275 1301 if (keymap.containsKey(s)) buffer.keyPressed(keymap.get(s), ' ', 0);
1276 if (result.equals("1"))
1277 key = vt320.KEY_F1;
1278 else if (result.equals("2"))
1279 key = vt320.KEY_F2;
1280 else if (result.equals("3"))
1281 key = vt320.KEY_F3;
1282 else if (result.equals("4"))
1283 key = vt320.KEY_F4;
1284 else if (result.equals("5"))
1285 key = vt320.KEY_F5;
1286 else if (result.equals("6"))
1287 key = vt320.KEY_F6;
1288 else if (result.equals("7"))
1289 key = vt320.KEY_F7;
1290 else if (result.equals("8"))
1291 key = vt320.KEY_F8;
1292 else if (result.equals("9"))
1293 key = vt320.KEY_F9;
1294 else if (result.equals("0"))
1295 key = vt320.KEY_F10;
1296
1297 if (key != 0) buffer.keyPressed(key, ' ', 0);
1298
1299 dismiss(); 1302 dismiss();
1300 } 1303 }
1301 @Override 1304 @Override
1302 public void onItemClick(AdapterView p, View v, int pos, long id) { 1305 public void onItemClick(AdapterView p, View v, int pos, long id) {
1303 final String result = String.valueOf(pickerString.charAt(pos)); 1306 final String result = String.valueOf(pickerString.charAt(pos));