Mercurial > 510Connectbot
diff src/com/five_ten_sg/connectbot/service/TerminalMonitor.java @ 155:156b53fc4815
add showurl command
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Mon, 23 Jun 2014 17:54:39 -0700 |
parents | 3ca280646f2d |
children | cb9e359ea2bd |
line wrap: on
line diff
--- a/src/com/five_ten_sg/connectbot/service/TerminalMonitor.java Mon Jun 23 11:54:26 2014 -0700 +++ b/src/com/five_ten_sg/connectbot/service/TerminalMonitor.java Mon Jun 23 17:54:39 2014 -0700 @@ -4,6 +4,7 @@ import android.content.Context; import android.content.Intent; import android.content.ServiceConnection; +import android.net.Uri; import android.os.IBinder; import android.util.Log; import android.view.View; @@ -32,6 +33,7 @@ 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; private static final int MONITORPORT = 6000; private static final String LOCALHOST = "127.0.0.1"; @@ -122,6 +124,12 @@ break; + case MONITOR_CMD_SHOWURL: + if (packet.length > 1) + showUrl(packet, 1); + + break; + default: break; } @@ -369,6 +377,19 @@ buffer.setField(l, c, da); } + public synchronized void showUrl(char [] data, int offset) { + Log.i(TAG, "setField()"); + char[] da = new char[data.length - offset]; + int i; + + for (i = 0; i < da.length; i++) { + da[i] = data[i + offset]; + } + String url = new String(da); + Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); + parent.startActivity(intent); + } + public synchronized void getField(int l, int c, int len) { Log.i(TAG, "getField()"); char[] arg2 = new char[4 + len];