diff options
author | Kenny Root <kenny@the-b.org> | 2015-08-07 23:49:20 -0600 |
---|---|---|
committer | Kenny Root <kenny@the-b.org> | 2015-08-07 23:49:20 -0600 |
commit | a4c53008744a2b04f6b38469bc75d713b713ed68 (patch) | |
tree | 0c6b44abc8416a8dba7429cc484ee2a1a9fdeb78 /app | |
parent | 9cd914c3563fbb8ed194c3d5b988e1e3930e30fc (diff) | |
parent | 74c3c374bee2ffa287d8efeb970ff062c1b59f6d (diff) | |
download | connectbot-a4c53008744a2b04f6b38469bc75d713b713ed68.tar.gz connectbot-a4c53008744a2b04f6b38469bc75d713b713ed68.tar.bz2 connectbot-a4c53008744a2b04f6b38469bc75d713b713ed68.zip |
Merge pull request #120 from alescdb/master
Diffstat (limited to 'app')
-rw-r--r-- | app/src/main/java/org/connectbot/ConsoleActivity.java | 56 | ||||
-rw-r--r-- | app/src/main/java/org/connectbot/service/TerminalKeyListener.java | 7 | ||||
-rw-r--r-- | app/src/main/res/drawable/button_keyboard.png | bin | 3326 -> 1701 bytes | |||
-rw-r--r-- | app/src/main/res/layout/act_console.xml | 182 | ||||
-rw-r--r-- | app/src/main/res/values/strings.xml | 31 |
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 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 diff --git a/app/src/main/res/drawable/button_keyboard.png b/app/src/main/res/drawable/button_keyboard.png Binary files differindex 9205d8b..f3094c1 100644 --- a/app/src/main/res/drawable/button_keyboard.png +++ b/app/src/main/res/drawable/button_keyboard.png diff --git a/app/src/main/res/layout/act_console.xml b/app/src/main/res/layout/act_console.xml index b3f5157..b2c0d08 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> |