aboutsummaryrefslogtreecommitdiffstats
path: root/app/src/main/java
diff options
context:
space:
mode:
authorKenny Root <kenny@the-b.org>2015-08-07 23:49:20 -0600
committerKenny Root <kenny@the-b.org>2015-08-07 23:49:20 -0600
commita4c53008744a2b04f6b38469bc75d713b713ed68 (patch)
tree0c6b44abc8416a8dba7429cc484ee2a1a9fdeb78 /app/src/main/java
parent9cd914c3563fbb8ed194c3d5b988e1e3930e30fc (diff)
parent74c3c374bee2ffa287d8efeb970ff062c1b59f6d (diff)
downloadconnectbot-a4c53008744a2b04f6b38469bc75d713b713ed68.tar.gz
connectbot-a4c53008744a2b04f6b38469bc75d713b713ed68.tar.bz2
connectbot-a4c53008744a2b04f6b38469bc75d713b713ed68.zip
Merge pull request #120 from alescdb/master
Diffstat (limited to 'app/src/main/java')
-rw-r--r--app/src/main/java/org/connectbot/ConsoleActivity.java56
-rw-r--r--app/src/main/java/org/connectbot/service/TerminalKeyListener.java7
2 files changed, 57 insertions, 6 deletions
diff --git a/app/src/main/java/org/connectbot/ConsoleActivity.java b/app/src/main/java/org/connectbot/ConsoleActivity.java
index e011c93..afe3840 100644
--- a/app/src/main/java/org/connectbot/ConsoleActivity.java
+++ b/app/src/main/java/org/connectbot/ConsoleActivity.java
@@ -79,6 +79,7 @@ import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
+import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.TextView;
@@ -116,7 +117,7 @@ public class ConsoleActivity extends Activity {
private TextView booleanPrompt;
private Button booleanYes, booleanNo;
- private RelativeLayout keyboardGroup;
+ private LinearLayout keyboardGroup;
private Runnable keyboardGroupHider;
private TextView empty;
@@ -371,7 +372,7 @@ public class ConsoleActivity extends Activity {
inputManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
- keyboardGroup = (RelativeLayout) findViewById(R.id.keyboard_group);
+ keyboardGroup = (LinearLayout) findViewById(R.id.keyboard_group);
mKeyboardButton = (ImageView) findViewById(R.id.button_keyboard);
mKeyboardButton.setOnClickListener(new OnClickListener() {
@@ -385,7 +386,7 @@ public class ConsoleActivity extends Activity {
}
});
- final ImageView ctrlButton = (ImageView) findViewById(R.id.button_ctrl);
+ final Button ctrlButton = (Button) findViewById(R.id.button_ctrl);
ctrlButton.setOnClickListener(new OnClickListener() {
public void onClick(View view) {
TerminalView terminal = adapter.getCurrentTerminalView();
@@ -397,7 +398,7 @@ public class ConsoleActivity extends Activity {
}
});
- final ImageView escButton = (ImageView) findViewById(R.id.button_esc);
+ final Button escButton = (Button) findViewById(R.id.button_esc);
escButton.setOnClickListener(new OnClickListener() {
public void onClick(View view) {
TerminalView terminal = adapter.getCurrentTerminalView();
@@ -409,7 +410,7 @@ public class ConsoleActivity extends Activity {
}
});
- final ImageView tabButton = (ImageView) findViewById(R.id.button_tab);
+ final Button tabButton = (Button) findViewById(R.id.button_tab);
tabButton.setOnClickListener(new OnClickListener() {
public void onClick(View view) {
TerminalView terminal = adapter.getCurrentTerminalView();
@@ -420,6 +421,51 @@ public class ConsoleActivity extends Activity {
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);
+ }
+ });
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 cf47427..c585f46 100644
--- a/app/src/main/java/org/connectbot/service/TerminalKeyListener.java
+++ b/app/src/main/java/org/connectbot/service/TerminalKeyListener.java
@@ -365,7 +365,7 @@ public class TerminalKeyListener implements OnKeyListener, OnSharedPreferenceCha
}
// look for special chars
- switch(keyCode) {
+ switch (keyCode) {
case KEYCODE_ESCAPE:
sendEscape();
return true;
@@ -520,6 +520,11 @@ public class TerminalKeyListener implements OnKeyListener, OnSharedPreferenceCha
}
}
+ public void sendPressedKey(int key) {
+ ((vt320) buffer).keyPressed(key, ' ', getStateForBuffer());
+ bridge.tryKeyVibrate();
+ }
+
/**
* @param key
* @return successful