comparison src/com/five_ten_sg/connectbot/service/TerminalBridge.java @ 223:61ed3984fc1d

proper labels on the soft 24 function keypad
author Carl Byington <carl@five-ten-sg.com>
date Tue, 08 Jul 2014 17:20:07 -0700
parents 2e4ab8c33851
children bc40032ad1da
comparison
equal deleted inserted replaced
219:c438c2ff0052 223:61ed3984fc1d
38 import com.five_ten_sg.connectbot.bean.SelectionArea; 38 import com.five_ten_sg.connectbot.bean.SelectionArea;
39 import com.five_ten_sg.connectbot.transport.AbsTransport; 39 import com.five_ten_sg.connectbot.transport.AbsTransport;
40 import com.five_ten_sg.connectbot.transport.TransportFactory; 40 import com.five_ten_sg.connectbot.transport.TransportFactory;
41 import com.five_ten_sg.connectbot.util.HostDatabase; 41 import com.five_ten_sg.connectbot.util.HostDatabase;
42 import com.five_ten_sg.connectbot.util.PreferenceConstants; 42 import com.five_ten_sg.connectbot.util.PreferenceConstants;
43 import com.five_ten_sg.connectbot.util.StringPickerDialog;
43 import android.app.AlertDialog; 44 import android.app.AlertDialog;
44 import android.content.Context; 45 import android.content.Context;
45 import android.graphics.Bitmap; 46 import android.graphics.Bitmap;
46 import android.graphics.Bitmap.Config; 47 import android.graphics.Bitmap.Config;
47 import android.graphics.Canvas; 48 import android.graphics.Canvas;
1259 1260
1260 /** 1261 /**
1261 * Function keys dialog 1262 * Function keys dialog
1262 */ 1263 */
1263 public boolean showFKeysDialog() { 1264 public boolean showFKeysDialog() {
1264 final String pickerString = "1234567890abcdefghijklmn"; 1265 final String []pickerString = {"F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", "F11", "F12", "F13", "F14", "F15", "F16", "F17", "F18", "F19", "F20", "F21", "F22", "F23", "F24"};
1265 final HashMap<String,Integer> keymap = new HashMap<String,Integer>(); 1266 final HashMap<String,Integer> keymap = new HashMap<String,Integer>();
1266 keymap.put("1", vt320.KEY_F1); 1267 keymap.put("F1", vt320.KEY_F1);
1267 keymap.put("2", vt320.KEY_F2); 1268 keymap.put("F2", vt320.KEY_F2);
1268 keymap.put("3", vt320.KEY_F3); 1269 keymap.put("F3", vt320.KEY_F3);
1269 keymap.put("4", vt320.KEY_F4); 1270 keymap.put("F4", vt320.KEY_F4);
1270 keymap.put("5", vt320.KEY_F5); 1271 keymap.put("F5", vt320.KEY_F5);
1271 keymap.put("6", vt320.KEY_F6); 1272 keymap.put("F6", vt320.KEY_F6);
1272 keymap.put("7", vt320.KEY_F7); 1273 keymap.put("F7", vt320.KEY_F7);
1273 keymap.put("8", vt320.KEY_F8); 1274 keymap.put("F8", vt320.KEY_F8);
1274 keymap.put("9", vt320.KEY_F9); 1275 keymap.put("F9", vt320.KEY_F9);
1275 keymap.put("0", vt320.KEY_F10); 1276 keymap.put("F10", vt320.KEY_F10);
1276 keymap.put("a", vt320.KEY_F11); 1277 keymap.put("F11", vt320.KEY_F11);
1277 keymap.put("b", vt320.KEY_F12); 1278 keymap.put("F12", vt320.KEY_F12);
1278 keymap.put("c", vt320.KEY_F13); 1279 keymap.put("F13", vt320.KEY_F13);
1279 keymap.put("d", vt320.KEY_F14); 1280 keymap.put("F14", vt320.KEY_F14);
1280 keymap.put("e", vt320.KEY_F15); 1281 keymap.put("F15", vt320.KEY_F15);
1281 keymap.put("f", vt320.KEY_F16); 1282 keymap.put("F16", vt320.KEY_F16);
1282 keymap.put("g", vt320.KEY_F17); 1283 keymap.put("F17", vt320.KEY_F17);
1283 keymap.put("h", vt320.KEY_F18); 1284 keymap.put("F18", vt320.KEY_F18);
1284 keymap.put("i", vt320.KEY_F19); 1285 keymap.put("F19", vt320.KEY_F19);
1285 keymap.put("j", vt320.KEY_F20); 1286 keymap.put("F20", vt320.KEY_F20);
1286 keymap.put("k", vt320.KEY_F21); 1287 keymap.put("F21", vt320.KEY_F21);
1287 keymap.put("l", vt320.KEY_F22); 1288 keymap.put("F22", vt320.KEY_F22);
1288 keymap.put("m", vt320.KEY_F23); 1289 keymap.put("F23", vt320.KEY_F23);
1289 keymap.put("n", vt320.KEY_F24); 1290 keymap.put("F24", vt320.KEY_F24);
1290 1291
1291 CharSequence str = ""; 1292 CharSequence str = "";
1292 Editable content = Editable.Factory.getInstance().newEditable(str); 1293 Editable content = Editable.Factory.getInstance().newEditable(str);
1293 1294
1294 if (parent == null) 1295 if (parent == null)
1295 return false; 1296 return false;
1296 1297
1297 CharacterPickerDialog cpd = new CharacterPickerDialog(parent.getContext(), 1298 StringPickerDialog cpd = new StringPickerDialog(parent.getContext(),
1298 parent, content, pickerString, true) { 1299 parent, content, pickerString, true) {
1299 private void buttonPressed(CharSequence result) { 1300 private void buttonPressed(CharSequence result) {
1300 String s = result.toString(); 1301 String s = result.toString();
1301 if (keymap.containsKey(s)) buffer.keyPressed(keymap.get(s), ' ', 0); 1302 if (keymap.containsKey(s)) buffer.keyPressed(keymap.get(s), ' ', 0);
1302 dismiss(); 1303 dismiss();
1303 } 1304 }
1304 @Override 1305 @Override
1305 public void onItemClick(AdapterView p, View v, int pos, long id) { 1306 public void onItemClick(AdapterView p, View v, int pos, long id) {
1306 final String result = String.valueOf(pickerString.charAt(pos)); 1307 final String result = pickerString[pos];
1307 buttonPressed(result); 1308 buttonPressed(result);
1308 } 1309 }
1309 @Override 1310 @Override
1310 public void onClick(View v) { 1311 public void onClick(View v) {
1311 if (v instanceof Button) { 1312 if (v instanceof Button) {