aboutsummaryrefslogtreecommitdiffstats
path: root/app/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main')
-rw-r--r--app/src/main/java/org/connectbot/ConsoleActivity.java142
-rw-r--r--app/src/main/java/org/connectbot/service/TerminalKeyListener.java1
-rw-r--r--app/src/main/res/drawable/button_ctrl.pngbin3254 -> 0 bytes
-rw-r--r--app/src/main/res/drawable/button_esc.pngbin3638 -> 0 bytes
-rw-r--r--app/src/main/res/drawable/button_tab.pngbin3535 -> 0 bytes
5 files changed, 62 insertions, 81 deletions
diff --git a/app/src/main/java/org/connectbot/ConsoleActivity.java b/app/src/main/java/org/connectbot/ConsoleActivity.java
index 351ec27..727749d 100644
--- a/app/src/main/java/org/connectbot/ConsoleActivity.java
+++ b/app/src/main/java/org/connectbot/ConsoleActivity.java
@@ -206,6 +206,58 @@ public class ConsoleActivity extends Activity {
}
};
+ protected OnClickListener emulatedKeysListener = new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ onEmulatedKeyClicked(v);
+ }
+ };
+
+ private void onEmulatedKeyClicked(View v) {
+ View flip = findCurrentView(R.id.console_flip);
+ if (flip == null)
+ return;
+
+ TerminalView terminal = (TerminalView) flip;
+ TerminalKeyListener handler = terminal.bridge.getKeyHandler();
+ boolean hideKeys = true;
+
+ switch (v.getId()) {
+ case R.id.button_ctrl:
+ handler.metaPress(TerminalKeyListener.OUR_CTRL_ON, true);
+ break;
+ case R.id.button_esc:
+ handler.sendEscape();
+ break;
+ case R.id.button_tab:
+ handler.sendTab();
+ break;
+ case R.id.button_up:
+ handler.sendPressedKey(vt320.KEY_UP);
+ hideKeys = false;
+ break;
+ case R.id.button_down:
+ handler.sendPressedKey(vt320.KEY_DOWN);
+ hideKeys = false;
+ break;
+ case R.id.button_left:
+ handler.sendPressedKey(vt320.KEY_LEFT);
+ hideKeys = false;
+ break;
+ case R.id.button_right:
+ handler.sendPressedKey(vt320.KEY_RIGHT);
+ hideKeys = false;
+ break;
+ }
+
+ if (hideKeys)
+ hideEmulatedKeys();
+ else
+ autoHideEmulatedKeys();
+
+ terminal.bridge.tryKeyVibrate();
+ }
+
/**
* @param bridge
*/
@@ -244,7 +296,10 @@ public class ConsoleActivity extends Activity {
keyboardGroup.startAnimation(keyboard_fade_in);
keyboardGroup.setVisibility(View.VISIBLE);
actionBar.show();
+ autoHideEmulatedKeys();
+ }
+ private void autoHideEmulatedKeys() {
if (keyboardGroupHider != null)
handler.removeCallbacks(keyboardGroupHider);
keyboardGroupHider = new Runnable() {
@@ -387,86 +442,13 @@ public class ConsoleActivity extends Activity {
}
});
- final Button ctrlButton = (Button) findViewById(R.id.button_ctrl);
- ctrlButton.setOnClickListener(new OnClickListener() {
- public void onClick(View view) {
- TerminalView terminal = adapter.getCurrentTerminalView();
- if (terminal == null) return;
-
- TerminalKeyListener handler = terminal.bridge.getKeyHandler();
- handler.metaPress(TerminalKeyListener.OUR_CTRL_ON, true);
- hideEmulatedKeys();
- }
- });
-
- final Button escButton = (Button) findViewById(R.id.button_esc);
- escButton.setOnClickListener(new OnClickListener() {
- public void onClick(View view) {
- TerminalView terminal = adapter.getCurrentTerminalView();
- if (terminal == null) return;
-
- TerminalKeyListener handler = terminal.bridge.getKeyHandler();
- handler.sendEscape();
- hideEmulatedKeys();
- }
- });
-
- final Button tabButton = (Button) findViewById(R.id.button_tab);
- tabButton.setOnClickListener(new OnClickListener() {
- public void onClick(View view) {
- TerminalView terminal = adapter.getCurrentTerminalView();
- if (terminal == null) return;
-
- TerminalKeyListener handler = terminal.bridge.getKeyHandler();
- handler.sendTab();
- hideEmulatedKeys();
- }
- });
- final Button upButton = (Button) findViewById(R.id.button_up);
- upButton.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.sendPressedKey(vt320.KEY_UP);
- }
- });
- final Button dnButton = (Button) findViewById(R.id.button_down);
- dnButton.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.sendPressedKey(vt320.KEY_DOWN);
- }
- });
- final Button leftButton = (Button) findViewById(R.id.button_left);
- leftButton.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.sendPressedKey(vt320.KEY_LEFT);
- }
- });
- final Button rightButton = (Button) findViewById(R.id.button_right);
- rightButton.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.sendPressedKey(vt320.KEY_RIGHT);
- }
- });
+ findViewById(R.id.button_ctrl).setOnClickListener(emulatedKeysListener);
+ findViewById(R.id.button_esc).setOnClickListener(emulatedKeysListener);
+ findViewById(R.id.button_tab).setOnClickListener(emulatedKeysListener);
+ findViewById(R.id.button_up).setOnClickListener(emulatedKeysListener);
+ findViewById(R.id.button_down).setOnClickListener(emulatedKeysListener);
+ findViewById(R.id.button_left).setOnClickListener(emulatedKeysListener);
+ findViewById(R.id.button_right).setOnClickListener(emulatedKeysListener);
actionBar = ActionBarWrapper.getActionBar(this);
actionBar.setDisplayHomeAsUpEnabled(true);
diff --git a/app/src/main/java/org/connectbot/service/TerminalKeyListener.java b/app/src/main/java/org/connectbot/service/TerminalKeyListener.java
index c585f46..1b2ffe4 100644
--- a/app/src/main/java/org/connectbot/service/TerminalKeyListener.java
+++ b/app/src/main/java/org/connectbot/service/TerminalKeyListener.java
@@ -522,7 +522,6 @@ public class TerminalKeyListener implements OnKeyListener, OnSharedPreferenceCha
public void sendPressedKey(int key) {
((vt320) buffer).keyPressed(key, ' ', getStateForBuffer());
- bridge.tryKeyVibrate();
}
/**
diff --git a/app/src/main/res/drawable/button_ctrl.png b/app/src/main/res/drawable/button_ctrl.png
deleted file mode 100644
index dc4d786..0000000
--- a/app/src/main/res/drawable/button_ctrl.png
+++ /dev/null
Binary files differ
diff --git a/app/src/main/res/drawable/button_esc.png b/app/src/main/res/drawable/button_esc.png
deleted file mode 100644
index 5f0cfc6..0000000
--- a/app/src/main/res/drawable/button_esc.png
+++ /dev/null
Binary files differ
diff --git a/app/src/main/res/drawable/button_tab.png b/app/src/main/res/drawable/button_tab.png
deleted file mode 100644
index 4443118..0000000
--- a/app/src/main/res/drawable/button_tab.png
+++ /dev/null
Binary files differ