diff options
Diffstat (limited to 'app/src')
-rw-r--r-- | app/src/main/java/org/connectbot/ConsoleActivity.java | 19 | ||||
-rw-r--r-- | app/src/main/res/drawable/selector_keyboard.xml | 26 | ||||
-rw-r--r-- | app/src/main/res/layout-large/act_console.xml | 201 | ||||
-rw-r--r-- | app/src/main/res/layout/act_console.xml | 203 | ||||
-rw-r--r-- | app/src/main/res/layout/inc_keyboard.xml | 219 | ||||
-rw-r--r-- | app/src/main/res/values/colors.xml | 24 | ||||
-rw-r--r-- | app/src/main/res/values/styles.xml | 2 |
7 files changed, 288 insertions, 406 deletions
diff --git a/app/src/main/java/org/connectbot/ConsoleActivity.java b/app/src/main/java/org/connectbot/ConsoleActivity.java index 4051a45..5dc741f 100644 --- a/app/src/main/java/org/connectbot/ConsoleActivity.java +++ b/app/src/main/java/org/connectbot/ConsoleActivity.java @@ -227,7 +227,7 @@ public class ConsoleActivity extends AppCompatActivity implements BridgeDisconne /** * Handle repeatable virtual keys and touch events */ - public class KeyRepeater implements Runnable, OnTouchListener { + public class KeyRepeater implements Runnable, OnTouchListener, OnClickListener { private View mView; private Handler mHandler; private boolean mDown; @@ -236,6 +236,7 @@ public class ConsoleActivity extends AppCompatActivity implements BridgeDisconne mView = view; mHandler = handler; mView.setOnTouchListener(this); + mView.setOnClickListener(this); mDown = false; } @@ -244,7 +245,7 @@ public class ConsoleActivity extends AppCompatActivity implements BridgeDisconne mDown = true; mHandler.removeCallbacks(this); mHandler.postDelayed(this, KEYBOARD_REPEAT); - onEmulatedKeyClicked(mView); + mView.performClick(); } @Override @@ -259,27 +260,39 @@ public class ConsoleActivity extends AppCompatActivity implements BridgeDisconne case MotionEvent.ACTION_DOWN: mDown = false; mHandler.postDelayed(this, KEYBOARD_REPEAT_INITIAL); + mView.setPressed(true); return (true); case MotionEvent.ACTION_CANCEL: mHandler.removeCallbacks(this); + mView.setPressed(false); return (true); case MotionEvent.ACTION_UP: mHandler.removeCallbacks(this); + mView.setPressed(false); + if (!mDown) { - onEmulatedKeyClicked(mView); + mView.performClick(); } return (true); } return false; } + + @Override + public void onClick(View view) { + onEmulatedKeyClicked(view); + } } private void onEmulatedKeyClicked(View v) { TerminalView terminal = adapter.getCurrentTerminalView(); if (terminal == null) return; + if (BuildConfig.DEBUG) { + Log.d(TAG, "onEmulatedKeyClicked(" + v.getId() + ")"); + } TerminalKeyListener handler = terminal.bridge.getKeyHandler(); boolean hideKeys = false; diff --git a/app/src/main/res/drawable/selector_keyboard.xml b/app/src/main/res/drawable/selector_keyboard.xml new file mode 100644 index 0000000..a7c822d --- /dev/null +++ b/app/src/main/res/drawable/selector_keyboard.xml @@ -0,0 +1,26 @@ +<?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. + */ +--> +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:drawable="@color/key_background_selected" + android:state_selected="true"/> + <item android:drawable="@color/key_background_pressed" + android:state_pressed="true"/> + <item android:drawable="@color/key_background_normal"/> +</selector> diff --git a/app/src/main/res/layout-large/act_console.xml b/app/src/main/res/layout-large/act_console.xml index 66f3d83..d0ad41b 100644 --- a/app/src/main/res/layout-large/act_console.xml +++ b/app/src/main/res/layout-large/act_console.xml @@ -138,205 +138,6 @@ </RelativeLayout> - <LinearLayout - android:id="@+id/keyboard_group" - android:layout_width="fill_parent" - android:layout_height="wrap_content" - android:layout_alignParentBottom="true" - android:background="#55000000" - android:orientation="horizontal" - android:padding="0dip" - android:visibility="gone"> - - <HorizontalScrollView - android:id="@+id/keyboard_hscroll" - android:layout_width="0dp" - android:layout_height="match_parent" - android:layout_weight="1" - android:padding="0dp" - android:scrollbars="none"> - - <LinearLayout - android:layout_width="0dp" - android:layout_height="match_parent" - android:orientation="horizontal" - android:padding="0dp"> - - <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"/> - - <Button - android:id="@+id/button_esc" - style="@style/KeyboardButton" - android:contentDescription="@string/image_description_send_escape_character" - android:text="@string/button_key_esc"/> - - <View style="@style/KeyboardSeparator"/> - - <Button - android:id="@+id/button_tab" - style="@style/KeyboardButton" - android:contentDescription="@string/image_description_send_tab_character" - android:text="@string/button_key_tab"/> - - <View style="@style/KeyboardSeparator"/> - - <Button - android:id="@+id/button_up" - style="@style/KeyboardButton" - android:contentDescription="@string/image_description_up" - android:text="@string/button_key_up"/> - - <View style="@style/KeyboardSeparator"/> - - <Button - android:id="@+id/button_down" - style="@style/KeyboardButton" - android:contentDescription="@string/image_description_down" - android:text="@string/button_key_down"/> - - <View style="@style/KeyboardSeparator"/> - - <Button - android:id="@+id/button_left" - style="@style/KeyboardButton" - android:contentDescription="@string/image_description_left" - android:text="@string/button_key_left"/> - - <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" - style="@style/KeyboardKey" - android:background="#55b0b0f0" - android:contentDescription="@string/image_description_show_keyboard" - android:src="@drawable/button_keyboard"/> - </LinearLayout> + <include layout="@layout/inc_keyboard" /> </RelativeLayout> diff --git a/app/src/main/res/layout/act_console.xml b/app/src/main/res/layout/act_console.xml index 4bc5ccb..34f1d42 100644 --- a/app/src/main/res/layout/act_console.xml +++ b/app/src/main/res/layout/act_console.xml @@ -120,207 +120,6 @@ </RelativeLayout> - <LinearLayout - android:id="@+id/keyboard_group" - android:layout_width="fill_parent" - android:layout_height="wrap_content" - android:layout_alignParentBottom="true" - android:background="#55000000" - android:orientation="horizontal" - android:padding="0dip" - android:visibility="gone"> - - <HorizontalScrollView - android:id="@+id/keyboard_hscroll" - android:layout_width="0dp" - android:layout_height="match_parent" - android:layout_weight="1" - android:padding="0dp" - android:scrollbars="none"> - - <LinearLayout - android:layout_width="0dp" - android:layout_height="match_parent" - android:orientation="horizontal" - android:padding="0dp"> - - <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"/> - - <Button - android:id="@+id/button_esc" - style="@style/KeyboardButton" - android:contentDescription="@string/image_description_send_escape_character" - android:text="@string/button_key_esc"/> - - <View style="@style/KeyboardSeparator"/> - - <Button - android:id="@+id/button_tab" - style="@style/KeyboardButton" - android:contentDescription="@string/image_description_send_tab_character" - android:text="@string/button_key_tab"/> - - <View style="@style/KeyboardSeparator"/> - - <Button - android:id="@+id/button_up" - style="@style/KeyboardButton" - android:contentDescription="@string/image_description_up" - android:text="@string/button_key_up"/> - - <View style="@style/KeyboardSeparator"/> - - <Button - android:id="@+id/button_down" - style="@style/KeyboardButton" - android:contentDescription="@string/image_description_down" - android:text="@string/button_key_down"/> - - <View style="@style/KeyboardSeparator"/> - - <Button - android:id="@+id/button_left" - style="@style/KeyboardButton" - android:contentDescription="@string/image_description_left" - android:text="@string/button_key_left"/> - - <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" - style="@style/KeyboardKey" - android:background="#55b0b0f0" - android:contentDescription="@string/image_description_show_keyboard" - android:src="@drawable/button_keyboard"/> - </LinearLayout> - + <include layout="@layout/inc_keyboard" /> </RelativeLayout> diff --git a/app/src/main/res/layout/inc_keyboard.xml b/app/src/main/res/layout/inc_keyboard.xml new file mode 100644 index 0000000..c3d3904 --- /dev/null +++ b/app/src/main/res/layout/inc_keyboard.xml @@ -0,0 +1,219 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ ConnectBot: simple, powerful, open-source SSH client for Android + ~ Copyright 2015 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. + --> +<LinearLayout android:id="@+id/keyboard_group" + xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_alignParentBottom="true" + android:background="@color/key_background_layout" + android:orientation="horizontal" + android:padding="0dip" + android:visibility="gone"> + + + <HorizontalScrollView + android:id="@+id/keyboard_hscroll" + android:layout_width="0dp" + android:layout_height="match_parent" + android:layout_weight="1" + android:padding="0dp" + android:scrollbars="none"> + + <LinearLayout + android:layout_width="0dp" + android:layout_height="match_parent" + android:orientation="horizontal" + android:padding="0dp"> + + <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"/> + + <Button + android:id="@+id/button_esc" + style="@style/KeyboardButton" + android:contentDescription="@string/image_description_send_escape_character" + android:text="@string/button_key_esc"/> + + <View style="@style/KeyboardSeparator"/> + + <Button + android:id="@+id/button_tab" + style="@style/KeyboardButton" + android:contentDescription="@string/image_description_send_tab_character" + android:text="@string/button_key_tab"/> + + <View style="@style/KeyboardSeparator"/> + + <Button + android:id="@+id/button_up" + style="@style/KeyboardButton" + android:contentDescription="@string/image_description_up" + android:text="@string/button_key_up"/> + + <View style="@style/KeyboardSeparator"/> + + <Button + android:id="@+id/button_down" + style="@style/KeyboardButton" + android:contentDescription="@string/image_description_down" + android:text="@string/button_key_down"/> + + <View style="@style/KeyboardSeparator"/> + + <Button + android:id="@+id/button_left" + style="@style/KeyboardButton" + android:contentDescription="@string/image_description_left" + android:text="@string/button_key_left"/> + + <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" + style="@style/KeyboardKey" + android:background="#55b0b0f0" + android:contentDescription="@string/image_description_show_keyboard" + android:src="@drawable/button_keyboard"/> +</LinearLayout> diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml new file mode 100644 index 0000000..021f16b --- /dev/null +++ b/app/src/main/res/values/colors.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ ConnectBot: simple, powerful, open-source SSH client for Android + ~ Copyright 2015 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> + <color name="key_background_selected">#55f0f0f0</color> + <color name="key_background_pressed">#aaa0a0ff</color> + <color name="key_background_normal">#55f0f0f0</color> + <color name="key_background_layout">#55000000</color> +</resources>
\ No newline at end of file diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 3ad5fc0..976d4bf 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -29,7 +29,7 @@ <style name="KeyboardButton" parent="KeyboardKey"> - <item name="android:background">#55f0f0f0</item> + <item name="android:background">@drawable/selector_keyboard</item> </style> |