diff options
author | Kenny Root <kenny@the-b.org> | 2010-07-27 03:04:28 +0000 |
---|---|---|
committer | Kenny Root <kenny@the-b.org> | 2010-07-27 03:04:28 +0000 |
commit | 95002b798dc238983638a04a3046591a6f7a32a1 (patch) | |
tree | f26f53b78d39adbb0f485c10a4ce1d8b253df9b6 /src | |
parent | 32bc0edb89e708b873533de94d3e58d5099cc3ba (diff) | |
download | connectbot-95002b798dc238983638a04a3046591a6f7a32a1.tar.gz connectbot-95002b798dc238983638a04a3046591a6f7a32a1.tar.bz2 connectbot-95002b798dc238983638a04a3046591a6f7a32a1.zip |
Add CTRL/ESC on-screen
git-svn-id: https://connectbot.googlecode.com/svn/trunk/connectbot@507 df292f66-193f-0410-a5fc-6d59da041ff2
Diffstat (limited to 'src')
-rw-r--r-- | src/org/connectbot/ConsoleActivity.java | 29 | ||||
-rw-r--r-- | src/org/connectbot/service/TerminalKeyListener.java | 9 |
2 files changed, 33 insertions, 5 deletions
diff --git a/src/org/connectbot/ConsoleActivity.java b/src/org/connectbot/ConsoleActivity.java index 0240131..65ca40a 100644 --- a/src/org/connectbot/ConsoleActivity.java +++ b/src/org/connectbot/ConsoleActivity.java @@ -23,6 +23,7 @@ import java.util.List; import org.connectbot.bean.SelectionArea; import org.connectbot.service.PromptHelper; import org.connectbot.service.TerminalBridge; +import org.connectbot.service.TerminalKeyListener; import org.connectbot.service.TerminalManager; import org.connectbot.util.PreferenceConstants; @@ -116,7 +117,6 @@ public class ConsoleActivity extends Activity { private Animation slide_left_in, slide_left_out, slide_right_in, slide_right_out, fade_stay_hidden, fade_out_delayed; private Animation keyboard_fade_in, keyboard_fade_out; - private ImageView keyboardButton; private float lastX, lastY; private InputMethodManager inputManager; @@ -347,7 +347,8 @@ public class ConsoleActivity extends Activity { keyboard_fade_out = AnimationUtils.loadAnimation(this, R.anim.keyboard_fade_out); inputManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); - keyboardButton = (ImageView) findViewById(R.id.keyboard_button); + + final ImageView keyboardButton = (ImageView) findViewById(R.id.button_keyboard); keyboardButton.setOnClickListener(new OnClickListener() { public void onClick(View view) { View flip = findCurrentView(R.id.console_flip); @@ -359,6 +360,30 @@ public class ConsoleActivity extends Activity { } }); + final ImageView ctrlButton = (ImageView) findViewById(R.id.button_keyboard); + ctrlButton.setOnClickListener(new OnClickListener() { + public void onClick(View view) { + View flip = findCurrentView(R.id.console_flip); + if (flip == null) return; + TerminalView terminal = (TerminalView)flip; + + TerminalKeyListener handler = terminal.bridge.getKeyHandler(); + handler.metaPress(TerminalKeyListener.META_CTRL_ON); + } + }); + + final ImageView escButton = (ImageView) findViewById(R.id.button_keyboard); + escButton.setOnClickListener(new OnClickListener() { + public void onClick(View view) { + View flip = findCurrentView(R.id.console_flip); + if (flip == null) return; + TerminalView terminal = (TerminalView)flip; + + TerminalKeyListener handler = terminal.bridge.getKeyHandler(); + handler.sendEscape(); + } + }); + // detect fling gestures to switch between terminals final GestureDetector detect = new GestureDetector(new GestureDetector.SimpleOnGestureListener() { private float totalY = 0; diff --git a/src/org/connectbot/service/TerminalKeyListener.java b/src/org/connectbot/service/TerminalKeyListener.java index deba880..e768134 100644 --- a/src/org/connectbot/service/TerminalKeyListener.java +++ b/src/org/connectbot/service/TerminalKeyListener.java @@ -375,10 +375,10 @@ public class TerminalKeyListener implements OnKeyListener, OnSharedPreferenceCha } } else { if ((metaState & META_CTRL_ON) != 0) { - ((vt320)buffer).keyTyped(vt320.KEY_ESCAPE, ' ', 0); + sendEscape(); metaState &= ~META_CTRL_ON; } else - metaState |= META_CTRL_ON; + metaPress(META_CTRL_ON); } bridge.redraw(); @@ -402,6 +402,9 @@ public class TerminalKeyListener implements OnKeyListener, OnSharedPreferenceCha return false; } + public void sendEscape() { + ((vt320)buffer).keyTyped(vt320.KEY_ESCAPE, ' ', 0); + } /** * @param key @@ -453,7 +456,7 @@ public class TerminalKeyListener implements OnKeyListener, OnSharedPreferenceCha * * @param code */ - private void metaPress(int code) { + public void metaPress(int code) { if ((metaState & (code << 1)) != 0) { metaState &= ~(code << 1); } else if ((metaState & code) != 0) { |