aboutsummaryrefslogtreecommitdiffstats
path: root/app/src/main/java
diff options
context:
space:
mode:
authoradb2001 <vacances2712>2015-08-07 15:45:49 +0200
committerKenny Root <kenny@the-b.org>2015-08-07 23:46:45 -0600
commit74c3c374bee2ffa287d8efeb970ff062c1b59f6d (patch)
tree18a25502b786f1101c11f2dfc36bbc91da0f37f5 /app/src/main/java
parent25315e3b4c26aa126f43cbc58fc7621926a4f6ac (diff)
downloadconnectbot-74c3c374bee2ffa287d8efeb970ff062c1b59f6d.tar.gz
connectbot-74c3c374bee2ffa287d8efeb970ff062c1b59f6d.tar.bz2
connectbot-74c3c374bee2ffa287d8efeb970ff062c1b59f6d.zip
Change virtual keyboard images by flat buttons with text and added 'Up', 'Down', 'Left' and 'Right' arrow keys.
Squashes together other commits: - Remove HorizontalScrollView tests - Add comments to give translators context. - Remove hardcoded button texts and change the keyboard icon to a more modern style. - Change virtual keyboard RelativeLayout to LinearLayout and it take all screen width. And add a small separators between buttons. - Mislabelled "Up" key
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 50c1a21..16dcef9 100644
--- a/app/src/main/java/org/connectbot/ConsoleActivity.java
+++ b/app/src/main/java/org/connectbot/ConsoleActivity.java
@@ -74,6 +74,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;
@@ -115,7 +116,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;
@@ -391,7 +392,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() {
@@ -405,7 +406,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) {
View flip = findCurrentView(R.id.console_flip);
@@ -418,7 +419,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) {
View flip = findCurrentView(R.id.console_flip);
@@ -431,7 +432,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) {
View flip = findCurrentView(R.id.console_flip);
@@ -443,6 +444,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