diff options
-rw-r--r-- | app/src/main/java/org/connectbot/ConsoleActivity.java | 229 | ||||
-rw-r--r-- | app/src/main/res/layout-large/act_console.xml | 298 | ||||
-rw-r--r-- | app/src/main/res/layout/act_console.xml | 300 | ||||
-rw-r--r-- | app/src/main/res/values/strings.xml | 33 | ||||
-rw-r--r-- | app/src/main/res/values/styles.xml | 41 |
5 files changed, 610 insertions, 291 deletions
diff --git a/app/src/main/java/org/connectbot/ConsoleActivity.java b/app/src/main/java/org/connectbot/ConsoleActivity.java index 6f72783..9ac0c95 100644 --- a/app/src/main/java/org/connectbot/ConsoleActivity.java +++ b/app/src/main/java/org/connectbot/ConsoleActivity.java @@ -84,6 +84,7 @@ import android.widget.AdapterView.OnItemClickListener; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.EditText; +import android.widget.HorizontalScrollView; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.ListView; @@ -99,7 +100,9 @@ public class ConsoleActivity extends AppCompatActivity implements BridgeDisconne private static final int CLICK_TIME = 400; private static final float MAX_CLICK_DISTANCE = 25f; - private static final int KEYBOARD_DISPLAY_TIME = 1500; + private static final int KEYBOARD_DISPLAY_TIME = 3000; + private static final int KEYBOARD_REPEAT_INITIAL = 500; + private static final int KEYBOARD_REPEAT = 100; protected ViewPager pager = null; protected TabLayout tabs = null; @@ -216,38 +219,143 @@ public class ConsoleActivity extends AppCompatActivity implements BridgeDisconne } }; + protected Handler keyRepeatHandler = new Handler(); + + + /** + * Handle repeatable virtual keys and touch events + */ + public class KeyRepeater implements Runnable, OnTouchListener { + private View mView; + private Handler mHandler; + private boolean mDown; + + public KeyRepeater(Handler handler, View view) { + mView = view; + mHandler = handler; + mView.setOnTouchListener(this); + mDown = false; + } + + @Override + public void run() { + mDown = true; + mHandler.removeCallbacks(this); + mHandler.postDelayed(this, KEYBOARD_REPEAT); + onEmulatedKeyClicked(mView); + } + + @Override + public boolean onTouch(View v, MotionEvent event) { + if (BuildConfig.DEBUG) { + Log.d(TAG, "KeyRepeater.onTouch(" + v.getId() + ", " + + event.getAction() + ", " + + event.getActionIndex() + ", " + + event.getActionMasked() + ");"); + } + switch (event.getAction()) { + case MotionEvent.ACTION_DOWN: + mDown = false; + mHandler.postDelayed(this, KEYBOARD_REPEAT_INITIAL); + return (true); + + case MotionEvent.ACTION_CANCEL: + keyRepeatHandler.removeCallbacks(this); + return (true); + + case MotionEvent.ACTION_UP: + keyRepeatHandler.removeCallbacks(this); + if (!mDown) { + onEmulatedKeyClicked(mView); + } + return (true); + } + return false; + } + } + private void onEmulatedKeyClicked(View v) { TerminalView terminal = adapter.getCurrentTerminalView(); if (terminal == null) return; TerminalKeyListener handler = terminal.bridge.getKeyHandler(); - boolean hideKeys = true; + boolean hideKeys = false; - switch (v.getId()) { + switch (v.getId()) { case R.id.button_ctrl: handler.metaPress(TerminalKeyListener.OUR_CTRL_ON, true); + hideKeys = true; break; case R.id.button_esc: handler.sendEscape(); + hideKeys = true; break; case R.id.button_tab: handler.sendTab(); + hideKeys = true; 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; + + case R.id.button_home: + handler.sendPressedKey(vt320.KEY_HOME); + break; + case R.id.button_end: + handler.sendPressedKey(vt320.KEY_END); + break; + case R.id.button_pgup: + handler.sendPressedKey(vt320.KEY_PAGE_UP); + break; + case R.id.button_pgdn: + handler.sendPressedKey(vt320.KEY_PAGE_DOWN); + break; + + case R.id.button_f1: + handler.sendPressedKey(vt320.KEY_F1); + break; + case R.id.button_f2: + handler.sendPressedKey(vt320.KEY_F2); + break; + case R.id.button_f3: + handler.sendPressedKey(vt320.KEY_F3); + break; + case R.id.button_f4: + handler.sendPressedKey(vt320.KEY_F4); + break; + case R.id.button_f5: + handler.sendPressedKey(vt320.KEY_F5); + break; + case R.id.button_f6: + handler.sendPressedKey(vt320.KEY_F6); + break; + case R.id.button_f7: + handler.sendPressedKey(vt320.KEY_F7); + break; + case R.id.button_f8: + handler.sendPressedKey(vt320.KEY_F8); + break; + case R.id.button_f9: + handler.sendPressedKey(vt320.KEY_F9); + break; + case R.id.button_f10: + handler.sendPressedKey(vt320.KEY_F10); + break; + case R.id.button_f11: + handler.sendPressedKey(vt320.KEY_F11); + break; + case R.id.button_f12: + handler.sendPressedKey(vt320.KEY_F12); break; } @@ -257,6 +365,9 @@ public class ConsoleActivity extends AppCompatActivity implements BridgeDisconne autoHideEmulatedKeys(); terminal.bridge.tryKeyVibrate(); + if (titleBarHide) { + actionBar.hide(); + } } /** @@ -447,10 +558,29 @@ public class ConsoleActivity extends AppCompatActivity implements BridgeDisconne 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); + + new KeyRepeater(keyRepeatHandler, findViewById(R.id.button_up)); + new KeyRepeater(keyRepeatHandler, findViewById(R.id.button_down)); + new KeyRepeater(keyRepeatHandler, findViewById(R.id.button_left)); + new KeyRepeater(keyRepeatHandler, findViewById(R.id.button_right)); + + findViewById(R.id.button_home).setOnClickListener(emulatedKeysListener); + findViewById(R.id.button_end).setOnClickListener(emulatedKeysListener); + findViewById(R.id.button_pgup).setOnClickListener(emulatedKeysListener); + findViewById(R.id.button_pgdn).setOnClickListener(emulatedKeysListener); + findViewById(R.id.button_f1).setOnClickListener(emulatedKeysListener); + findViewById(R.id.button_f2).setOnClickListener(emulatedKeysListener); + findViewById(R.id.button_f3).setOnClickListener(emulatedKeysListener); + findViewById(R.id.button_f4).setOnClickListener(emulatedKeysListener); + findViewById(R.id.button_f5).setOnClickListener(emulatedKeysListener); + findViewById(R.id.button_f6).setOnClickListener(emulatedKeysListener); + findViewById(R.id.button_f7).setOnClickListener(emulatedKeysListener); + findViewById(R.id.button_f8).setOnClickListener(emulatedKeysListener); + findViewById(R.id.button_f9).setOnClickListener(emulatedKeysListener); + findViewById(R.id.button_f10).setOnClickListener(emulatedKeysListener); + findViewById(R.id.button_f11).setOnClickListener(emulatedKeysListener); + findViewById(R.id.button_f12).setOnClickListener(emulatedKeysListener); + actionBar = getSupportActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); @@ -466,6 +596,31 @@ public class ConsoleActivity extends AppCompatActivity implements BridgeDisconne } }); + if (!hardKeyboard) { + // Show virtual keyboard and scroll back and forth + final HorizontalScrollView keyboardScroll = (HorizontalScrollView) findViewById(R.id.keyboard_hscroll); + showEmulatedKeys(); + keyboardScroll.postDelayed(new Runnable() { + @Override + public void run() { + final int xscroll = findViewById(R.id.button_f12).getRight(); + if (BuildConfig.DEBUG) { + Log.d(TAG, "smoothScrollBy(toEnd[" + xscroll + "])"); + } + keyboardScroll.smoothScrollBy(xscroll, 0); + keyboardScroll.postDelayed(new Runnable() { + @Override + public void run() { + if (BuildConfig.DEBUG) { + Log.d(TAG, "smoothScrollBy(toStart[" + (-xscroll) + "])"); + } + keyboardScroll.smoothScrollBy(-xscroll, 0); + } + }, 1000); + } + }, 1000); + } + tabs = (TabLayout) findViewById(R.id.tabs); if (tabs != null) tabs.setupWithViewPager(pager); @@ -787,26 +942,26 @@ public class ConsoleActivity extends AppCompatActivity implements BridgeDisconne final View resizeView = inflater.inflate(R.layout.dia_resize, null, false); new AlertDialog.Builder(ConsoleActivity.this) - .setView(resizeView) - .setPositiveButton(R.string.button_resize, new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int which) { - int width, height; - try { - width = Integer.parseInt(((EditText) resizeView - .findViewById(R.id.width)) - .getText().toString()); - height = Integer.parseInt(((EditText) resizeView - .findViewById(R.id.height)) - .getText().toString()); - } catch (NumberFormatException nfe) { - // TODO change this to a real dialog where we can - // make the input boxes turn red to indicate an error. - return; + .setView(resizeView) + .setPositiveButton(R.string.button_resize, new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + int width, height; + try { + width = Integer.parseInt(((EditText) resizeView + .findViewById(R.id.width)) + .getText().toString()); + height = Integer.parseInt(((EditText) resizeView + .findViewById(R.id.height)) + .getText().toString()); + } catch (NumberFormatException nfe) { + // TODO change this to a real dialog where we can + // make the input boxes turn red to indicate an error. + return; + } + + terminalView.forceSize(width, height); } - - terminalView.forceSize(width, height); - } - }).setNegativeButton(android.R.string.cancel, null).create().show(); + }).setNegativeButton(android.R.string.cancel, null).create().show(); return true; } @@ -851,13 +1006,13 @@ public class ConsoleActivity extends AppCompatActivity implements BridgeDisconne @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { - case android.R.id.home: - Intent intent = new Intent(this, HostListActivity.class); - intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); - startActivity(intent); - return true; - default: - return super.onOptionsItemSelected(item); + case android.R.id.home: + Intent intent = new Intent(this, HostListActivity.class); + intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); + startActivity(intent); + return true; + default: + return super.onOptionsItemSelected(item); } } diff --git a/app/src/main/res/layout-large/act_console.xml b/app/src/main/res/layout-large/act_console.xml index 44d15af..9b02b53 100644 --- a/app/src/main/res/layout-large/act_console.xml +++ b/app/src/main/res/layout-large/act_console.xml @@ -142,155 +142,199 @@ android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:background="#55000000" + android:orientation="horizontal" android:padding="0dip" android:visibility="gone"> - <Button - android:id="@+id/button_ctrl" - android:layout_width="0px" - android:layout_height="30dip" - android:layout_margin="0dp" + <HorizontalScrollView + android:id="@+id/keyboard_hscroll" + android:layout_width="0dp" + android:layout_height="match_parent" android:layout_weight="1" - android:background="#55f0f0f0" - android:contentDescription="@string/image_description_toggle_control_character" android:padding="0dp" - android:text="@string/button_key_ctrl" - android:textSize="10dip" - /> + android:scrollbars="none"> - <View - android:layout_width="1dp" - android:layout_height="match_parent" - android:background="#90000000" - /> + <LinearLayout + android:layout_width="0dp" + android:layout_height="match_parent" + android:orientation="horizontal" + android:padding="0dp"> - <Button - android:id="@+id/button_esc" - android:layout_width="0px" - android:layout_height="30dip" - android:layout_margin="0dp" - android:layout_weight="1" - android:background="#55f0f0f0" - android:contentDescription="@string/image_description_send_escape_character" - android:padding="0dp" - android:text="@string/button_key_esc" - android:textSize="10dip" - /> + <Button + android:id="@+id/button_ctrl" + style="@style/KeyboardButton" + android:contentDescription="@string/image_description_toggle_control_character" + android:text="@string/button_key_ctrl"/> + <View style="@style/KeyboardSeparator"/> - <View - android:layout_width="1dp" - android:layout_height="match_parent" - android:background="#90000000" - /> + <Button + android:id="@+id/button_esc" + style="@style/KeyboardButton" + android:contentDescription="@string/image_description_send_escape_character" + android:text="@string/button_key_esc"/> - <Button - android:id="@+id/button_tab" - android:layout_width="0px" - android:layout_height="30dip" - android:layout_margin="0dp" - android:layout_weight="1" - android:background="#55f0f0f0" - android:contentDescription="@string/image_description_send_tab_character" - android:padding="0dp" - android:text="@string/button_key_tab" - android:textSize="10dip" - /> + <View style="@style/KeyboardSeparator"/> - <View - android:layout_width="1dp" - android:layout_height="match_parent" - android:background="#90000000" - /> + <Button + android:id="@+id/button_tab" + style="@style/KeyboardButton" + android:contentDescription="@string/image_description_send_tab_character" + android:text="@string/button_key_tab"/> - <Button - android:id="@+id/button_up" - android:layout_width="0px" - android:layout_height="30dip" - android:layout_margin="0dp" - android:layout_weight="1" - android:background="#55f0f0f0" - android:contentDescription="@string/image_description_up" - android:padding="0dp" - android:text="@string/button_key_up" - android:textSize="10dip" - /> + <View style="@style/KeyboardSeparator"/> - <View - android:layout_width="1dp" - android:layout_height="match_parent" - android:background="#90000000" - /> + <Button + android:id="@+id/button_up" + style="@style/KeyboardButton" + android:contentDescription="@string/image_description_up" + android:text="@string/button_key_up"/> - <Button - android:id="@+id/button_down" - android:layout_width="0px" - android:layout_height="30dip" - android:layout_margin="0dp" - android:layout_weight="1" - android:background="#55f0f0f0" - android:contentDescription="@string/image_description_down" - android:padding="0dp" - android:text="@string/button_key_down" - android:textSize="10dip" - /> + <View style="@style/KeyboardSeparator"/> - <View - android:layout_width="1dp" - android:layout_height="match_parent" - android:background="#90000000" - /> + <Button + android:id="@+id/button_down" + style="@style/KeyboardButton" + android:contentDescription="@string/image_description_down" + android:text="@string/button_key_down"/> - <Button - android:id="@+id/button_left" - android:layout_width="0px" - android:layout_height="30dip" - android:layout_margin="0dp" - android:layout_weight="1" - android:background="#55f0f0f0" - android:contentDescription="@string/image_description_left" - android:padding="0dp" - android:text="@string/button_key_left" - android:textSize="10dip" - /> + <View style="@style/KeyboardSeparator"/> - <View - android:layout_width="1dp" - android:layout_height="match_parent" - android:background="#90000000" - /> + <Button + android:id="@+id/button_left" + style="@style/KeyboardButton" + android:contentDescription="@string/image_description_left" + android:text="@string/button_key_left"/> - <Button - android:id="@+id/button_right" - android:layout_width="0px" - android:layout_height="30dip" - android:layout_margin="0dp" - android:layout_weight="1" - android:background="#55f0f0f0" - android:contentDescription="@string/image_description_right" - android:padding="0dp" - android:text="@string/button_key_right" - android:textSize="10dip" - /> + <View style="@style/KeyboardSeparator"/> - <View - android:layout_width="1dp" - android:layout_height="match_parent" - android:background="#90000000" - /> + <Button + android:id="@+id/button_right" + style="@style/KeyboardButton" + android:contentDescription="@string/image_description_right" + android:text="@string/button_key_right"/> + + <View style="@style/KeyboardSeparator"/> + + <Button + android:id="@+id/button_home" + style="@style/KeyboardButton" + android:text="@string/button_key_home"/> + + <View style="@style/KeyboardSeparator"/> + + <Button + android:id="@+id/button_end" + style="@style/KeyboardButton" + android:text="@string/button_key_end"/> + + <View style="@style/KeyboardSeparator"/> + + <Button + android:id="@+id/button_pgup" + style="@style/KeyboardButton" + android:text="@string/button_key_pgup"/> + + <View style="@style/KeyboardSeparator"/> + + <Button + android:id="@+id/button_pgdn" + style="@style/KeyboardButton" + android:text="@string/button_key_pgdn"/> + + <View style="@style/KeyboardSeparator"/> + + <Button + android:id="@+id/button_f1" + style="@style/KeyboardButton" + android:text="@string/button_key_f1"/> + + <View style="@style/KeyboardSeparator"/> + + <Button + android:id="@+id/button_f2" + style="@style/KeyboardButton" + android:text="@string/button_key_f2"/> + + <View style="@style/KeyboardSeparator"/> + + <Button + android:id="@+id/button_f3" + style="@style/KeyboardButton" + android:text="@string/button_key_f3"/> + + <View style="@style/KeyboardSeparator"/> + + <Button + android:id="@+id/button_f4" + style="@style/KeyboardButton" + android:text="@string/button_key_f4"/> + + <View style="@style/KeyboardSeparator"/> + + <Button + android:id="@+id/button_f5" + style="@style/KeyboardButton" + android:text="@string/button_key_f5"/> + + <View style="@style/KeyboardSeparator"/> + + <Button + android:id="@+id/button_f6" + style="@style/KeyboardButton" + android:text="@string/button_key_f6"/> + + <View style="@style/KeyboardSeparator"/> + + <Button + android:id="@+id/button_f7" + style="@style/KeyboardButton" + android:text="@string/button_key_f7"/> + + <View style="@style/KeyboardSeparator"/> + + <Button + android:id="@+id/button_f8" + style="@style/KeyboardButton" + android:text="@string/button_key_f8"/> + + <View style="@style/KeyboardSeparator"/> + + <Button + android:id="@+id/button_f9" + style="@style/KeyboardButton" + android:text="@string/button_key_f9"/> + + <View style="@style/KeyboardSeparator"/> + + <Button + android:id="@+id/button_f10" + style="@style/KeyboardButton" + android:text="@string/button_key_f10"/> + + <View style="@style/KeyboardSeparator"/> + + <Button + android:id="@+id/button_f11" + style="@style/KeyboardButton" + android:text="@string/button_key_f11"/> + + <View style="@style/KeyboardSeparator"/> + + <Button + android:id="@+id/button_f12" + style="@style/KeyboardButton" + android:text="@string/button_key_f12"/> + </LinearLayout> + </HorizontalScrollView> + + <View style="@style/KeyboardSeparator"/> <ImageView android:id="@+id/button_keyboard" - android:layout_width="0px" - android:layout_height="30dip" - android:layout_margin="0dp" - android:layout_weight="1" - android:background="#55f0f0f0" + style="@style/KeyboardKey" + android:background="#55b0b0f0" android:contentDescription="@string/image_description_show_keyboard" - android:padding="0dp" - android:src="@drawable/button_keyboard" - android:textSize="10dip" - /> - + android:src="@drawable/button_keyboard"/> </LinearLayout> </RelativeLayout> diff --git a/app/src/main/res/layout/act_console.xml b/app/src/main/res/layout/act_console.xml index 8787265..4bc5ccb 100644 --- a/app/src/main/res/layout/act_console.xml +++ b/app/src/main/res/layout/act_console.xml @@ -126,155 +126,201 @@ android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:background="#55000000" + android:orientation="horizontal" android:padding="0dip" android:visibility="gone"> - <Button - android:id="@+id/button_ctrl" - android:layout_width="0px" - android:layout_height="30dip" - android:layout_margin="0dp" + <HorizontalScrollView + android:id="@+id/keyboard_hscroll" + android:layout_width="0dp" + android:layout_height="match_parent" android:layout_weight="1" - android:background="#55f0f0f0" - android:contentDescription="@string/image_description_toggle_control_character" android:padding="0dp" - android:text="@string/button_key_ctrl" - android:textSize="10dip" - /> + android:scrollbars="none"> - <View - android:layout_width="1dp" - android:layout_height="match_parent" - android:background="#90000000" - /> + <LinearLayout + android:layout_width="0dp" + android:layout_height="match_parent" + android:orientation="horizontal" + android:padding="0dp"> - <Button - android:id="@+id/button_esc" - android:layout_width="0px" - android:layout_height="30dip" - android:layout_margin="0dp" - android:layout_weight="1" - android:background="#55f0f0f0" - android:contentDescription="@string/image_description_send_escape_character" - android:padding="0dp" - android:text="@string/button_key_esc" - android:textSize="10dip" - /> + <Button + android:id="@+id/button_ctrl" + style="@style/KeyboardButton" + android:contentDescription="@string/image_description_toggle_control_character" + android:text="@string/button_key_ctrl"/> - <View - android:layout_width="1dp" - android:layout_height="match_parent" - android:background="#90000000" - /> + <View style="@style/KeyboardSeparator"/> - <Button - android:id="@+id/button_tab" - android:layout_width="0px" - android:layout_height="30dip" - android:layout_margin="0dp" - android:layout_weight="1" - android:background="#55f0f0f0" - android:contentDescription="@string/image_description_send_tab_character" - android:padding="0dp" - android:text="@string/button_key_tab" - android:textSize="10dip" - /> + <Button + android:id="@+id/button_esc" + style="@style/KeyboardButton" + android:contentDescription="@string/image_description_send_escape_character" + android:text="@string/button_key_esc"/> - <View - android:layout_width="1dp" - android:layout_height="match_parent" - android:background="#90000000" - /> + <View style="@style/KeyboardSeparator"/> - <Button - android:id="@+id/button_up" - android:layout_width="0px" - android:layout_height="30dip" - android:layout_margin="0dp" - android:layout_weight="1" - android:background="#55f0f0f0" - android:contentDescription="@string/image_description_up" - android:padding="0dp" - android:text="@string/button_key_up" - android:textSize="10dip" - /> + <Button + android:id="@+id/button_tab" + style="@style/KeyboardButton" + android:contentDescription="@string/image_description_send_tab_character" + android:text="@string/button_key_tab"/> - <View - android:layout_width="1dp" - android:layout_height="match_parent" - android:background="#90000000" - /> + <View style="@style/KeyboardSeparator"/> - <Button - android:id="@+id/button_down" - android:layout_width="0px" - android:layout_height="30dip" - android:layout_margin="0dp" - android:layout_weight="1" - android:background="#55f0f0f0" - android:contentDescription="@string/image_description_down" - android:padding="0dp" - android:text="@string/button_key_down" - android:textSize="10dip" - /> + <Button + android:id="@+id/button_up" + style="@style/KeyboardButton" + android:contentDescription="@string/image_description_up" + android:text="@string/button_key_up"/> - <View - android:layout_width="1dp" - android:layout_height="match_parent" - android:background="#90000000" - /> + <View style="@style/KeyboardSeparator"/> - <Button - android:id="@+id/button_left" - android:layout_width="0px" - android:layout_height="30dip" - android:layout_margin="0dp" - android:layout_weight="1" - android:background="#55f0f0f0" - android:contentDescription="@string/image_description_left" - android:padding="0dp" - android:text="@string/button_key_left" - android:textSize="10dip" - /> + <Button + android:id="@+id/button_down" + style="@style/KeyboardButton" + android:contentDescription="@string/image_description_down" + android:text="@string/button_key_down"/> - <View - android:layout_width="1dp" - android:layout_height="match_parent" - android:background="#90000000" - /> + <View style="@style/KeyboardSeparator"/> - <Button - android:id="@+id/button_right" - android:layout_width="0px" - android:layout_height="30dip" - android:layout_margin="0dp" - android:layout_weight="1" - android:background="#55f0f0f0" - android:contentDescription="@string/image_description_right" - android:padding="0dp" - android:text="@string/button_key_right" - android:textSize="10dip" - /> + <Button + android:id="@+id/button_left" + style="@style/KeyboardButton" + android:contentDescription="@string/image_description_left" + android:text="@string/button_key_left"/> - <View - android:layout_width="1dp" - android:layout_height="match_parent" - android:background="#90000000" - /> + <View style="@style/KeyboardSeparator"/> + + <Button + android:id="@+id/button_right" + style="@style/KeyboardButton" + android:contentDescription="@string/image_description_right" + android:text="@string/button_key_right"/> + + <View style="@style/KeyboardSeparator"/> + + <Button + android:id="@+id/button_home" + style="@style/KeyboardButton" + android:text="@string/button_key_home"/> + + <View style="@style/KeyboardSeparator"/> + + <Button + android:id="@+id/button_end" + style="@style/KeyboardButton" + android:text="@string/button_key_end"/> + + <View style="@style/KeyboardSeparator"/> + + <Button + android:id="@+id/button_pgup" + style="@style/KeyboardButton" + android:text="@string/button_key_pgup"/> + + <View style="@style/KeyboardSeparator"/> + + <Button + android:id="@+id/button_pgdn" + style="@style/KeyboardButton" + android:text="@string/button_key_pgdn"/> + + <View style="@style/KeyboardSeparator"/> + + <Button + android:id="@+id/button_f1" + style="@style/KeyboardButton" + android:text="@string/button_key_f1"/> + + <View style="@style/KeyboardSeparator"/> + + <Button + android:id="@+id/button_f2" + style="@style/KeyboardButton" + android:text="@string/button_key_f2"/> + + <View style="@style/KeyboardSeparator"/> + + <Button + android:id="@+id/button_f3" + style="@style/KeyboardButton" + android:text="@string/button_key_f3"/> + + <View style="@style/KeyboardSeparator"/> + + <Button + android:id="@+id/button_f4" + style="@style/KeyboardButton" + android:text="@string/button_key_f4"/> + + <View style="@style/KeyboardSeparator"/> + + <Button + android:id="@+id/button_f5" + style="@style/KeyboardButton" + android:text="@string/button_key_f5"/> + + <View style="@style/KeyboardSeparator"/> + + <Button + android:id="@+id/button_f6" + style="@style/KeyboardButton" + android:text="@string/button_key_f6"/> + + <View style="@style/KeyboardSeparator"/> + + <Button + android:id="@+id/button_f7" + style="@style/KeyboardButton" + android:text="@string/button_key_f7"/> + + <View style="@style/KeyboardSeparator"/> + + <Button + android:id="@+id/button_f8" + style="@style/KeyboardButton" + android:text="@string/button_key_f8"/> + + <View style="@style/KeyboardSeparator"/> + + <Button + android:id="@+id/button_f9" + style="@style/KeyboardButton" + android:text="@string/button_key_f9"/> + + <View style="@style/KeyboardSeparator"/> + + <Button + android:id="@+id/button_f10" + style="@style/KeyboardButton" + android:text="@string/button_key_f10"/> + + <View style="@style/KeyboardSeparator"/> + + <Button + android:id="@+id/button_f11" + style="@style/KeyboardButton" + android:text="@string/button_key_f11"/> + + <View style="@style/KeyboardSeparator"/> + + <Button + android:id="@+id/button_f12" + style="@style/KeyboardButton" + android:text="@string/button_key_f12"/> + </LinearLayout> + </HorizontalScrollView> + + <View style="@style/KeyboardSeparator"/> <ImageView android:id="@+id/button_keyboard" - android:layout_width="0px" - android:layout_height="30dip" - android:layout_margin="0dp" - android:layout_weight="1" - android:background="#55f0f0f0" + style="@style/KeyboardKey" + android:background="#55b0b0f0" android:contentDescription="@string/image_description_show_keyboard" - android:padding="0dp" - android:src="@drawable/button_keyboard" - android:textSize="10dip" - /> - + android:src="@drawable/button_keyboard"/> </LinearLayout> + </RelativeLayout> diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index ecbe757..c6086da 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -555,4 +555,37 @@ <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 "Home" button in virtual keyboard. --> + <string name="button_key_home">Home</string> + <!-- Text for the "End" button in virtual keyboard. --> + <string name="button_key_end">End</string> + <!-- Text for the "Page Up" button in virtual keyboard. --> + <string name="button_key_pgup">PgUp</string> + <!-- Text for the "Page Down" button in virtual keyboard. --> + <string name="button_key_pgdn">PgDn</string> + <!-- Text for the "F1" button in virtual keyboard. --> + <string name="button_key_f1">F1</string> + <!-- Text for the "F2" button in virtual keyboard. --> + <string name="button_key_f2">F2</string> + <!-- Text for the "F3" button in virtual keyboard. --> + <string name="button_key_f3">F3</string> + <!-- Text for the "F4" button in virtual keyboard. --> + <string name="button_key_f4">F4</string> + <!-- Text for the "F5" button in virtual keyboard. --> + <string name="button_key_f5">F5</string> + <!-- Text for the "F6" button in virtual keyboard. --> + <string name="button_key_f6">F6</string> + <!-- Text for the "F7" button in virtual keyboard. --> + <string name="button_key_f7">F7</string> + <!-- Text for the "F8" button in virtual keyboard. --> + <string name="button_key_f8">F8</string> + <!-- Text for the "F9" button in virtual keyboard. --> + <string name="button_key_f9">F9</string> + <!-- Text for the "F10" button in virtual keyboard. --> + <string name="button_key_f10">F10</string> + <!-- Text for the "F11" button in virtual keyboard. --> + <string name="button_key_f11">F11</string> + <!-- Text for the "F12" button in virtual keyboard. --> + <string name="button_key_f12">F12</string> </resources> diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml new file mode 100644 index 0000000..3ad5fc0 --- /dev/null +++ b/app/src/main/res/values/styles.xml @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* + * ConnectBot: simple, powerful, open-source SSH client for Android + * Copyright 2007 Kenny Root, Jeffrey Sharkey + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +--> +<resources> + + <style name="KeyboardKey"> + <item name="android:layout_width">45dip</item> + <item name="android:layout_height">30dip</item> + <item name="android:layout_margin">0dp</item> + <item name="android:padding">0dp</item> + <item name="android:textSize">10sp</item> + </style> + + + <style name="KeyboardButton" parent="KeyboardKey"> + <item name="android:background">#55f0f0f0</item> + </style> + + + <style name="KeyboardSeparator"> + <item name="android:layout_width">1dip</item> + <item name="android:layout_height">match_parent</item> + <item name="android:background">#90000000</item> + </style> +</resources> |