# HG changeset patch # User Carl Byington # Date 1404270432 25200 # Node ID cb9e359ea2bd3a31ad68c3297a567c602091162a # Parent 18aceeae6681a36aed01e36e0f234b8d4c8b2c96 add switch session command from the monitor diff -r 18aceeae6681 -r cb9e359ea2bd AndroidManifest.xml --- a/AndroidManifest.xml Sun Jun 29 12:41:26 2014 -0700 +++ b/AndroidManifest.xml Tue Jul 01 20:07:12 2014 -0700 @@ -17,7 +17,7 @@ --> diff -r 18aceeae6681 -r cb9e359ea2bd src/com/five_ten_sg/connectbot/service/ConnectionNotifier.java --- a/src/com/five_ten_sg/connectbot/service/ConnectionNotifier.java Sun Jun 29 12:41:26 2014 -0700 +++ b/src/com/five_ten_sg/connectbot/service/ConnectionNotifier.java Tue Jul 01 20:07:12 2014 -0700 @@ -56,7 +56,7 @@ String contentText = res.getString( R.string.notification_text, host.getNickname()); Intent notificationIntent = new Intent(context, ConsoleActivity.class); - notificationIntent.setAction("android.intent.action.VIEW"); + notificationIntent.setAction(Intent.ACTION_VIEW); notificationIntent.setData(host.getUri()); PendingIntent contentIntent = PendingIntent.getActivity(context, 0, notificationIntent, 0); diff -r 18aceeae6681 -r cb9e359ea2bd src/com/five_ten_sg/connectbot/service/TerminalBridge.java --- a/src/com/five_ten_sg/connectbot/service/TerminalBridge.java Sun Jun 29 12:41:26 2014 -0700 +++ b/src/com/five_ten_sg/connectbot/service/TerminalBridge.java Tue Jul 01 20:07:12 2014 -0700 @@ -222,7 +222,7 @@ String monitor_init = host.getMonitor(); if ((monitor_init != null) && (monitor_init.length() > 0)) { - monitor = new TerminalMonitor(manager, buffer, parent, monitor_init); + monitor = new TerminalMonitor(manager, buffer, parent, host, monitor_init); } transport.setCompression(host.getCompression()); diff -r 18aceeae6681 -r cb9e359ea2bd src/com/five_ten_sg/connectbot/service/TerminalMonitor.java --- a/src/com/five_ten_sg/connectbot/service/TerminalMonitor.java Sun Jun 29 12:41:26 2014 -0700 +++ b/src/com/five_ten_sg/connectbot/service/TerminalMonitor.java Tue Jul 01 20:07:12 2014 -0700 @@ -23,17 +23,18 @@ public class TerminalMonitor { public final static String TAG = "ConnectBot.TerminalMonitor"; - public static final char MONITOR_CMD_INIT = 0; - public static final char MONITOR_CMD_ACTIVATE = 1; - public static final char MONITOR_CMD_KEYSTATE = 2; - public static final char MONITOR_CMD_CURSORMOVE = 3; - public static final char MONITOR_CMD_SCREENCHANGE = 4; - public static final char MONITOR_CMD_FIELDVALUE = 5; - public static final char MONITOR_CMD_SETFIELD = 5; - public static final char MONITOR_CMD_GETFIELD = 6; - public static final char MONITOR_CMD_SCREENWATCH = 7; - public static final char MONITOR_CMD_DEPRESS = 8; - public static final char MONITOR_CMD_SHOWURL = 9; + public static final char MONITOR_CMD_INIT = 0; + public static final char MONITOR_CMD_ACTIVATE = 1; + public static final char MONITOR_CMD_KEYSTATE = 2; + public static final char MONITOR_CMD_CURSORMOVE = 3; + public static final char MONITOR_CMD_SCREENCHANGE = 4; + public static final char MONITOR_CMD_FIELDVALUE = 5; + public static final char MONITOR_CMD_SETFIELD = 5; + public static final char MONITOR_CMD_GETFIELD = 6; + public static final char MONITOR_CMD_SCREENWATCH = 7; + public static final char MONITOR_CMD_DEPRESS = 8; + public static final char MONITOR_CMD_SHOWURL = 9; + public static final char MONITOR_CMD_SWITCHSESSION = 10; private static final int MONITORPORT = 6000; private static final String LOCALHOST = "127.0.0.1"; @@ -130,6 +131,12 @@ break; + case MONITOR_CMD_SHOWURL: + if (packet.length == 1) + switchSession(); + + break; + default: break; } @@ -179,10 +186,11 @@ }; - public TerminalMonitor(Context parent, vt320 buffer, View view, String init) { + public TerminalMonitor(Context parent, vt320 buffer, View view, HostBean host, String init) { this.parent = parent; this.buffer = buffer; this.view = view; + this.host = host; this.init = init; // setup the windows->android keymapping // http://msdn.microsoft.com/en-us/library/windows/desktop/dd375731 @@ -413,4 +421,13 @@ Integer x = keymap.get(new Integer(vk_key)); if (x != null) buffer.keyPressed(x, ' ', 0); } + + public synchronized void switchSession() { + Log.i(TAG, "switchSession()"); + Intent intent = new Intent(parent, ConsoleActivity.class); + intent.setAction(Intent.ACTION_VIEW); + intent.setData(host.getUri()); + parent.startActivity(intent); + } + }