diff src/com/five_ten_sg/connectbot/transport/TN5250.java @ 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
line wrap: on
line diff
--- 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);