aboutsummaryrefslogtreecommitdiffstats
path: root/app
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
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')
-rw-r--r--app/src/main/java/org/connectbot/ConsoleActivity.java56
-rw-r--r--app/src/main/java/org/connectbot/service/TerminalKeyListener.java7
-rw-r--r--app/src/main/res/drawable/button_keyboard.pngbin3326 -> 1701 bytes
-rw-r--r--app/src/main/res/layout/act_console.xml182
-rw-r--r--app/src/main/res/values/strings.xml31
5 files changed, 230 insertions, 46 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
diff --git a/app/src/main/res/drawable/button_keyboard.png b/app/src/main/res/drawable/button_keyboard.png
index 9205d8b..f3094c1 100644
--- a/app/src/main/res/drawable/button_keyboard.png
+++ b/app/src/main/res/drawable/button_keyboard.png
Binary files differ
diff --git a/app/src/main/res/layout/act_console.xml b/app/src/main/res/layout/act_console.xml
index cd06e50..36dc69c 100644
--- a/app/src/main/res/layout/act_console.xml
+++ b/app/src/main/res/layout/act_console.xml
@@ -120,59 +120,161 @@
</RelativeLayout>
- <RelativeLayout
+ <LinearLayout
android:id="@+id/keyboard_group"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
- android:padding="15dip"
+ android:background="#55000000"
+ android:padding="0dip"
android:visibility="gone">
- <ImageView
- android:id="@+id/button_keyboard"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignParentBottom="true"
- android:layout_alignParentEnd="true"
- android:layout_alignParentRight="true"
- android:src="@+drawable/button_keyboard"
- android:contentDescription="@string/image_description_show_keyboard"
- />
-
- <ImageView
+ <Button
android:id="@+id/button_ctrl"
- android:paddingRight="15dip"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignParentStart="true"
- android:layout_alignParentLeft="true"
- android:layout_alignParentBottom="true"
- android:src="@+drawable/button_ctrl"
+ android:layout_width="0px"
+ android:layout_weight="1"
+ android:layout_height="30dip"
+ android:layout_margin="0dp"
+ android:background="#55f0f0f0"
android:contentDescription="@string/image_description_toggle_control_character"
+ android:padding="0dp"
+ android:text="@string/button_key_ctrl"
+ android:textSize="10dip"
/>
- <ImageView
+ <View
+ android:layout_width="1dp"
+ android:layout_height="match_parent"
+ android:background="#90000000"
+ />
+
+ <Button
android:id="@+id/button_esc"
- android:paddingRight="15dip"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_toRightOf="@+id/button_ctrl"
- android:layout_alignParentBottom="true"
- android:src="@+drawable/button_esc"
+ android:layout_width="0px"
+ android:layout_weight="1"
+ android:layout_height="30dip"
+ android:layout_margin="0dp"
+ android:background="#55f0f0f0"
android:contentDescription="@string/image_description_send_escape_character"
+ android:padding="0dp"
+ android:text="@string/button_key_esc"
+ android:textSize="10dip"
/>
-
- <ImageView
- android:id="@+id/button_tab"
- android:paddingRight="15dip"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_toRightOf="@+id/button_esc"
- android:layout_alignParentBottom="true"
- android:src="@+drawable/button_tab"
- android:contentDescription="@string/image_description_send_tab_character"
- />
- </RelativeLayout>
+ <View
+ android:layout_width="1dp"
+ android:layout_height="match_parent"
+ android:background="#90000000"
+ />
+
+ <Button
+ android:id="@+id/button_tab"
+ android:layout_width="0px"
+ android:layout_weight="1"
+ android:layout_height="30dip"
+ android:layout_margin="0dp"
+ android:background="#55f0f0f0"
+ android:contentDescription="@string/image_description_send_tab_character"
+ android:padding="0dp"
+ android:text="@string/button_key_tab"
+ android:textSize="10dip"
+ />
+
+ <View
+ android:layout_width="1dp"
+ android:layout_height="match_parent"
+ android:background="#90000000"
+ />
+
+ <Button
+ android:id="@+id/button_up"
+ android:layout_width="0px"
+ android:layout_weight="1"
+ android:layout_height="30dip"
+ android:layout_margin="0dp"
+ android:background="#55f0f0f0"
+ android:contentDescription="@string/image_description_up"
+ android:padding="0dp"
+ android:text="@string/button_key_up"
+ android:textSize="10dip"
+ />
+
+ <View
+ android:layout_width="1dp"
+ android:layout_height="match_parent"
+ android:background="#90000000"
+ />
+
+ <Button
+ android:id="@+id/button_down"
+ android:layout_width="0px"
+ android:layout_weight="1"
+ android:layout_height="30dip"
+ android:layout_margin="0dp"
+ android:background="#55f0f0f0"
+ android:contentDescription="@string/image_description_down"
+ android:padding="0dp"
+ android:text="@string/button_key_down"
+ android:textSize="10dip"
+ />
+
+ <View
+ android:layout_width="1dp"
+ android:layout_height="match_parent"
+ android:background="#90000000"
+ />
+
+ <Button
+ android:id="@+id/button_left"
+ android:layout_width="0px"
+ android:layout_weight="1"
+ android:layout_height="30dip"
+ android:layout_margin="0dp"
+ android:background="#55f0f0f0"
+ android:contentDescription="@string/image_description_left"
+ android:padding="0dp"
+ android:text="@string/button_key_left"
+ android:textSize="10dip"
+ />
+
+ <View
+ android:layout_width="1dp"
+ android:layout_height="match_parent"
+ android:background="#90000000"
+ />
+
+ <Button
+ android:id="@+id/button_right"
+ android:layout_width="0px"
+ android:layout_weight="1"
+ android:layout_height="30dip"
+ android:layout_margin="0dp"
+ android:background="#55f0f0f0"
+ android:contentDescription="@string/image_description_right"
+ android:padding="0dp"
+ android:text="@string/button_key_right"
+ android:textSize="10dip"
+ />
+
+ <View
+ android:layout_width="1dp"
+ android:layout_height="match_parent"
+ android:background="#90000000"
+ />
+
+ <ImageView
+ android:id="@+id/button_keyboard"
+ android:layout_width="0px"
+ android:layout_weight="1"
+ android:layout_height="30dip"
+ android:layout_margin="0dp"
+ android:contentDescription="@string/image_description_show_keyboard"
+ android:padding="0dp"
+ android:src="@drawable/button_keyboard"
+ android:background="#55f0f0f0"
+ android:textSize="10dip"
+ />
+
+ </LinearLayout>
</RelativeLayout>
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 67f478d..b7a1cd2 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -529,4 +529,35 @@
<!-- Describes the icon of the "show keyboard" button in the terminal view for accessibility
purposes. -->
<string name="image_description_show_keyboard">Show keyboard.</string>
+
+ <!-- Describes the icon of the "Arrow up" button in the terminal view for accessibility
+ purposes. -->
+ <string name="image_description_up">Arrow up</string>
+
+ <!-- Describes the icon of the "Arrow down" button in the terminal view for accessibility
+ purposes. -->
+ <string name="image_description_down">Arrow down</string>
+
+ <!-- Describes the icon of the "Arrow left" button in the terminal view for accessibility
+ purposes. -->
+ <string name="image_description_left">Arrow left</string>
+
+ <!-- Describes the icon of the "Arrow right" button in the terminal view for accessibility
+ purposes. -->
+ <string name="image_description_right">Arrow right</string>
+
+ <!-- Text for the "Esc" button in virtual keyboard. -->
+ <string name="button_key_esc">Esc</string>
+ <!-- Text for the "Ctrl" button in virtual keyboard. -->
+ <string name="button_key_ctrl">Ctrl</string>
+ <!-- Text for the "Tab" button in virtual keyboard. -->
+ <string name="button_key_tab">Tab</string>
+ <!-- Text for the "up" button in virtual keyboard. -->
+ <string name="button_key_up">Up</string>
+ <!-- Text for the "down" button in virtual keyboard. -->
+ <string name="button_key_down">Down</string>
+ <!-- Text for the "left" button in virtual keyboard. -->
+ <string name="button_key_left">Left</string>
+ <!-- Text for the "right" button in virtual keyboard. -->
+ <string name="button_key_right">Right</string>
</resources>