Mercurial > 510Connectbot
changeset 50:2cd3d8091e37 tn5250
start tn5250 integration
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Wed, 11 Jun 2014 11:50:25 -0700 |
parents | 8887bff45dee |
children | 8c6de858bb73 |
files | src/com/five_ten_sg/connectbot/service/TerminalKeyListener.java src/com/five_ten_sg/connectbot/transport/TN5250.java |
diffstat | 2 files changed, 19 insertions(+), 25 deletions(-) [+] |
line wrap: on
line diff
--- a/src/com/five_ten_sg/connectbot/service/TerminalKeyListener.java Wed Jun 11 11:28:31 2014 -0700 +++ b/src/com/five_ten_sg/connectbot/service/TerminalKeyListener.java Wed Jun 11 11:50:25 2014 -0700 @@ -85,9 +85,10 @@ private final vt320 buffer; private String encoding; - private String keymode = null; - private boolean hardKeyboard = false; - private String customKeyboard = null; + private String keymode = null; + protected boolean hardKeyboard = false; + protected boolean hardKeyboardHidden; + private String customKeyboard = null; private int metaState = 0; private int mDeadKey = 0; @@ -95,8 +96,8 @@ // TODO add support for the new API. private ClipboardManager clipboard = null; private boolean selectingForCopy = false; - private final SelectionArea selectionArea; - private final SharedPreferences prefs; + private final SelectionArea selectionArea; + protected final SharedPreferences prefs; public TerminalKeyListener(TerminalManager manager, @@ -110,8 +111,8 @@ selectionArea = new SelectionArea(); prefs = PreferenceManager.getDefaultSharedPreferences(manager); prefs.registerOnSharedPreferenceChangeListener(this); - hardKeyboard = (manager.res.getConfiguration().keyboard - == Configuration.KEYBOARD_QWERTY); + hardKeyboard = (manager.res.getConfiguration().keyboard == Configuration.KEYBOARD_QWERTY); + hardKeyboardHidden = manager.hardKeyboardHidden; updateKeymode(); updateCustomKeymap(); } @@ -127,16 +128,12 @@ public boolean onKey(View v, int keyCode, KeyEvent event) { try { // skip keys if we aren't connected yet or have been disconnected - if (bridge.isDisconnected() || bridge.transport == null) - return false; - - final boolean hardKeyboardHidden = manager.hardKeyboardHidden; + if (bridge.isDisconnected()) return false; // Ignore all key-up events except for the special keys if (event.getAction() == KeyEvent.ACTION_UP) { // There's nothing here for virtual keyboard users. - if (!hardKeyboard || (hardKeyboard && hardKeyboardHidden)) - return false; + if (!hardKeyboard || hardKeyboardHidden) return false; // if keycode debugging enabled, log and print the pressed key if (prefs.getBoolean(PreferenceConstants.DEBUG_KEYCODES, false)) { @@ -276,8 +273,7 @@ // If there is no hard keyboard or there is a hard keyboard currently hidden, // CTRL-1 through CTRL-9 will send F1 through F9 - if ((!hardKeyboard || (hardKeyboard && hardKeyboardHidden)) - && sendFunctionKey(keyCode)) + if ((!hardKeyboard || hardKeyboardHidden) && sendFunctionKey(keyCode)) return true; uchar = keyAsControl(uchar); @@ -1135,7 +1131,7 @@ return false; } - private boolean fullKeyboard() { + protected boolean fullKeyboard() { if (customKeyboard.equals(PreferenceConstants.CUSTOM_KEYMAP_FULL) || (customKeyboard.equals(PreferenceConstants.CUSTOM_KEYMAP_ASUS_TF))) return true;
--- a/src/com/five_ten_sg/connectbot/transport/TN5250.java Wed Jun 11 11:28:31 2014 -0700 +++ b/src/com/five_ten_sg/connectbot/transport/TN5250.java Wed Jun 11 11:50:25 2014 -0700 @@ -38,9 +38,12 @@ import com.five_ten_sg.connectbot.service.TerminalKeyListener; import com.five_ten_sg.connectbot.service.TerminalManager; import com.five_ten_sg.connectbot.util.HostDatabase; +import com.five_ten_sg.connectbot.util.PreferenceConstants; import android.content.Context; import android.net.Uri; import android.util.Log; +import android.view.KeyEvent; +import android.view.View; import de.mud.terminal.vt320; @@ -75,7 +78,7 @@ } @Override public void write(int b) { - screen52.sendKeys(new String(new byte[] {b})); + screen52.sendKeys(new String(new byte[] {(byte)b})); } // bridge.monitor placement of new characters @Override @@ -106,16 +109,12 @@ public boolean onKey(View v, int keyCode, KeyEvent event) { try { // skip keys if we aren't connected yet or have been disconnected - if (bridge.isDisconnected() || bridge.transport == null) - return false; - - final boolean hardKeyboardHidden = manager.hardKeyboardHidden; + if (bridge.isDisconnected()) return false; // Ignore all key-up events except for the special keys if (event.getAction() == KeyEvent.ACTION_UP) { // There's nothing here for virtual keyboard users. - if (!hardKeyboard || (hardKeyboard && hardKeyboardHidden)) - return false; + if (!hardKeyboard || hardKeyboardHidden) return false; // if keycode debugging enabled, log and print the pressed key if (prefs.getBoolean(PreferenceConstants.DEBUG_KEYCODES, false)) { @@ -255,8 +254,7 @@ // If there is no hard keyboard or there is a hard keyboard currently hidden, // CTRL-1 through CTRL-9 will send F1 through F9 - if ((!hardKeyboard || (hardKeyboard && hardKeyboardHidden)) - && sendFunctionKey(keyCode)) + if ((!hardKeyboard || hardKeyboardHidden) && sendFunctionKey(keyCode)) return true; uchar = keyAsControl(uchar);