aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenny Root <kenny@the-b.org>2010-07-27 03:04:28 +0000
committerKenny Root <kenny@the-b.org>2010-07-27 03:04:28 +0000
commit95002b798dc238983638a04a3046591a6f7a32a1 (patch)
treef26f53b78d39adbb0f485c10a4ce1d8b253df9b6
parent32bc0edb89e708b873533de94d3e58d5099cc3ba (diff)
downloadconnectbot-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
-rw-r--r--res/drawable/button_ctrl.png (renamed from res/drawable/keyboard_icon.png)bin3326 -> 3254 bytes
-rw-r--r--res/drawable/button_esc.pngbin0 -> 3638 bytes
-rw-r--r--res/layout/act_console.xml32
-rw-r--r--res/values/strings.xml5
-rw-r--r--src/org/connectbot/ConsoleActivity.java29
-rw-r--r--src/org/connectbot/service/TerminalKeyListener.java9
6 files changed, 66 insertions, 9 deletions
diff --git a/res/drawable/keyboard_icon.png b/res/drawable/button_ctrl.png
index 9205d8b..dc4d786 100644
--- a/res/drawable/keyboard_icon.png
+++ b/res/drawable/button_ctrl.png
Binary files differ
diff --git a/res/drawable/button_esc.png b/res/drawable/button_esc.png
new file mode 100644
index 0000000..5f0cfc6
--- /dev/null
+++ b/res/drawable/button_esc.png
Binary files differ
diff --git a/res/layout/act_console.xml b/res/layout/act_console.xml
index d0d7ae6..22741b0 100644
--- a/res/layout/act_console.xml
+++ b/res/layout/act_console.xml
@@ -92,7 +92,7 @@
<Button
android:id="@+id/console_prompt_no"
- android:text="No"
+ android:text="@string/button_no"
android:paddingTop="5dip"
android:paddingBottom="10dip"
android:paddingLeft="40dip"
@@ -106,7 +106,7 @@
<Button
android:id="@+id/console_prompt_yes"
- android:text="Yes"
+ android:text="@string/button_yes"
android:paddingTop="5dip"
android:paddingBottom="10dip"
android:paddingLeft="40dip"
@@ -120,7 +120,7 @@
</RelativeLayout>
<ImageView
- android:id="@+id/keyboard_button"
+ android:id="@+id/button_keyboard"
android:paddingRight="15dip"
android:paddingBottom="15dip"
android:layout_width="wrap_content"
@@ -128,7 +128,31 @@
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:visibility="gone"
- android:src="@+drawable/keyboard_icon"
+ android:src="@+drawable/button_keyboard"
+ />
+
+ <ImageView
+ android:id="@+id/button_ctrl"
+ android:paddingRight="15dip"
+ android:paddingBottom="15dip"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignParentBottom="true"
+ android:layout_toLeftOf="@+id/button_keyboard"
+ android:visibility="gone"
+ android:src="@+drawable/button_ctrl"
+ />
+
+ <ImageView
+ android:id="@+id/button_esc"
+ android:paddingRight="15dip"
+ android:paddingBottom="15dip"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignParentBottom="true"
+ android:layout_toLeftOf="@+id/button_ctrl"
+ android:visibility="gone"
+ android:src="@+drawable/button_esc"
/>
</RelativeLayout>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 49e88ac..d489338 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -317,6 +317,11 @@
<!-- Button that brings up the list of URLs on the current screen -->
<string name="console_menu_urlscan">URL Scan</string>
+ <!-- Button label to answer "Yes" to a yes/no prompt -->
+ <string name="button_yes">Yes</string>
+ <!-- Button label to answer "No" to a yes/no prompt -->
+ <string name="button_no">No</string>
+
<!-- Selection for a "local" port forward. E.g., connections to a port listening locally is forwarded to the remote end's listening port. -->
<string name="portforward_local">Local</string>
<!-- Selection for a "remote" port forward. E.g., connections to a port listening remotely is forwarded to the local end's listening port. -->
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) {