diff options
author | Kenny Root <kenny@the-b.org> | 2015-08-20 14:09:25 -0700 |
---|---|---|
committer | Kenny Root <kenny@the-b.org> | 2015-08-20 14:09:25 -0700 |
commit | 8870c63f99f101404aca50dbfef950cf40db5753 (patch) | |
tree | cee9c5b8afb7e7655ced34de67a7b9e7387bcf9c /app | |
parent | 6a6b04db69978bd0d0b6202f4dc2a1be465330b3 (diff) | |
parent | b1a9b3c724ac42fe667ca5523eb70490b4deaa54 (diff) | |
download | connectbot-8870c63f99f101404aca50dbfef950cf40db5753.tar.gz connectbot-8870c63f99f101404aca50dbfef950cf40db5753.tar.bz2 connectbot-8870c63f99f101404aca50dbfef950cf40db5753.zip |
Merge pull request #139 from jklein24/keyboardshortcuts
Add a keyboard shortcuts dialog to the help page.
Diffstat (limited to 'app')
-rw-r--r-- | app/src/main/assets/help/PhysicalKeyboard.html | 62 | ||||
-rw-r--r-- | app/src/main/java/org/connectbot/HelpActivity.java | 28 | ||||
-rw-r--r-- | app/src/main/res/layout/dia_keyboard_shortcuts.xml | 81 | ||||
-rw-r--r-- | app/src/main/res/values/strings.xml | 7 |
4 files changed, 110 insertions, 68 deletions
diff --git a/app/src/main/assets/help/PhysicalKeyboard.html b/app/src/main/assets/help/PhysicalKeyboard.html deleted file mode 100644 index 4ff3753..0000000 --- a/app/src/main/assets/help/PhysicalKeyboard.html +++ /dev/null @@ -1,62 +0,0 @@ -<html> -<body style="background-color: #000; color: #fff"> - -<p><img - src="http://connectbot.googlecode.com/svn/trunk/www/keyboard.jpg" /></p> -<p>Here are some keyboard shortcuts available when a <strong>hardware -keyboard</strong> is present. If you're using a phone where the main input -type is a <strong>virtual keyboard</strong>, please see the VirtualKeyboard help topic. -</p> -<p><strong>Note:</strong> the side that <strong>shift</strong>, <strong>alt</strong>, -<strong>slash</strong>, and <strong>tab</strong> uses can be changed in -preferences between left, right, and disabled.</p> -<ul> - <li>Control key (CTRL)</li> - <blockquote>Pressing once on the trackball will toggle on - <strong>control</strong> for the next character typed. The cursor will - indicate this state with a < symbol. Note that pressing the - trackball again will send an <strong>escape</strong> key.</blockquote> -</ul> -<ul> - <li>Escape (ESC)</li> - <blockquote>Pressing twice on the trackball will send <strong>escape</strong> - key. Note that some other terminal emulators map pressing <strong>ALT-<i>key</i></strong> - to <strong>escape + <i>key</i></strong>.</blockquote> -</ul> -<ul> - <li>Shift</li> - <blockquote>Pressing the <strong>shift</strong> (up arrow) - key once will make the next key typed its uppercase variant according - to the keyboard layout. This state is indicated with an outline of a - triangle on the top of the cursor. Pressing it twice will turn on <strong>shift - lock</strong> which is indicated by a solid triangle on the top of the cursor.</blockquote> -</ul> -<ul> - <li>Alt</li> - <blockquote>Pressing the <strong>Alt</strong> key once - will make the next key typed its symbol as indicated on the keyboard. - This state is indicated with the outline of a triangle on the bottom of - the cursor. Pressing it twice will turn on <strong>alt lock</strong> - which is indicated by a solid triangle on the bottom of the cursor.</blockquote> -</ul> -<ul> - <li>Slash (opposite side Alt)</li> - <blockquote>The opposite side <strong>alt</strong> key can - be used as a shortcut for the forward slash / character. This aids in - quickly typing directories on the G1.</blockquote> -</ul> -<ul> - <li>Tab (opposite side Shift)</li> - <blockquote>The opposite side <strong>shift</strong> key - can be used as a shortcut for the <strong>tab</strong> key (CTRL-i) for - quick completion in many shells.</blockquote> -</ul> -<ul> - <li>Function keys (F1 through F10)</li> - <blockquote>Hold down the shift key and press numbers 1 - through 10 to send F1 through F10 respectively.</blockquote> -</ul> - - -</body> -</html> diff --git a/app/src/main/java/org/connectbot/HelpActivity.java b/app/src/main/java/org/connectbot/HelpActivity.java index 0abcf17..1e78d72 100644 --- a/app/src/main/java/org/connectbot/HelpActivity.java +++ b/app/src/main/java/org/connectbot/HelpActivity.java @@ -20,10 +20,12 @@ package org.connectbot; import java.io.IOException; import android.app.Activity; +import android.app.AlertDialog; import android.content.Intent; import android.content.res.AssetManager; import android.os.Bundle; import android.util.Log; +import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; @@ -39,6 +41,9 @@ public class HelpActivity extends Activity { public final static String HELPDIR = "help"; public final static String SUFFIX = ".html"; + private LayoutInflater inflater = null; + + @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); @@ -74,17 +79,28 @@ public class HelpActivity extends Activity { Log.e(TAG, "couldn't get list of help assets", e); } - Button button = new Button(this); - final String topic = getResources().getString(R.string.terms_and_conditions); - button.setText(topic); + inflater = LayoutInflater.from(this); + Button shortcutsButton = new Button(this); + shortcutsButton.setText(getResources().getString(R.string.keyboard_shortcuts)); + shortcutsButton.setOnClickListener(new OnClickListener() { + public void onClick(View v) { + final View shortcuts = inflater.inflate(R.layout.dia_keyboard_shortcuts, null, false); + new AlertDialog.Builder(HelpActivity.this) + .setView(shortcuts) + .setTitle(R.string.keyboard_shortcuts) + .show(); + } + }); + content.addView(shortcutsButton); - button.setOnClickListener(new OnClickListener() { + Button eulaButton = new Button(this); + eulaButton.setText(getResources().getString(R.string.terms_and_conditions)); + eulaButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { Intent intent = new Intent(HelpActivity.this, EulaActivity.class); HelpActivity.this.startActivity(intent); } }); - - content.addView(button); + content.addView(eulaButton); } } diff --git a/app/src/main/res/layout/dia_keyboard_shortcuts.xml b/app/src/main/res/layout/dia_keyboard_shortcuts.xml new file mode 100644 index 0000000..095fa2a --- /dev/null +++ b/app/src/main/res/layout/dia_keyboard_shortcuts.xml @@ -0,0 +1,81 @@ +<?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. + --> + +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent"> + <ScrollView + xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_weight="1"> + + <TableLayout + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:padding="24dip" + android:stretchColumns="1"> + <TableRow> + <TextView + android:text="Ctrl-Shift-V" + android:padding="3dip" + android:textAppearance="?android:attr/textAppearanceMedium" + /> + <TextView + android:text="@string/console_menu_paste" + android:padding="3dip" + android:gravity="right" + android:layout_weight="1" + android:textAppearance="?android:attr/textAppearanceMedium" + /> + </TableRow> + + <TableRow> + <TextView + android:text="Ctrl and +" + android:padding="3dip" + android:textAppearance="?android:attr/textAppearanceMedium" + /> + <TextView + android:text="@string/increase_font_size" + android:padding="3dip" + android:layout_weight="1" + android:gravity="right" + android:textAppearance="?android:attr/textAppearanceMedium" + /> + </TableRow> + + <TableRow> + <TextView + android:text="Ctrl and -" + android:padding="3dip" + android:textAppearance="?android:attr/textAppearanceMedium" + /> + <TextView + android:text="@string/decrease_font_size" + android:padding="3dip" + android:gravity="right" + android:layout_weight="1" + android:textAppearance="?android:attr/textAppearanceMedium" + /> + </TableRow> + + </TableLayout> + + </ScrollView> +</RelativeLayout>
\ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 7c4c591..ecbe757 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -56,6 +56,13 @@ <!-- Title for the help page with the terms & conditions of the app. --> <string name="terms_and_conditions">"Terms & Conditions"</string> + <!-- Title for the help dialog showing keyboard shortcuts. --> + <string name="keyboard_shortcuts">"Keyboard Shortcuts"</string> + <!-- Text in a keyboard shortcuts list lined up to keys which increase the terminal font-size. --> + <string name="increase_font_size">"Increase Font Size"</string> + <!-- Text in a keyboard shortcuts list lined up to keys which decrease the terminal font-size. --> + <string name="decrease_font_size">"Decrease Font Size"</string> + <string name="pubkey_generate">"Generate"</string> <string name="pubkey_import">"Import"</string> <string name="pubkey_delete">"Delete key"</string> |