diff options
author | Jeremy Klein <jlklein@google.com> | 2015-08-14 15:32:54 -0700 |
---|---|---|
committer | Jeremy Klein <jlklein@google.com> | 2015-08-20 14:02:15 -0700 |
commit | 3b32e1b8e9ddbda0ff1cd4d389cf080ccd27e7f5 (patch) | |
tree | 9e47787ac19ca2f9e9a4c4ce6a62bb2e5bb87c4c /app/src | |
parent | c7218b987cf1cc2b803bc926b8a57750da1f2dd2 (diff) | |
download | connectbot-3b32e1b8e9ddbda0ff1cd4d389cf080ccd27e7f5.tar.gz connectbot-3b32e1b8e9ddbda0ff1cd4d389cf080ccd27e7f5.tar.bz2 connectbot-3b32e1b8e9ddbda0ff1cd4d389cf080ccd27e7f5.zip |
Add a keyboard shortucts dialog to help.
Diffstat (limited to 'app/src')
-rw-r--r-- | app/src/main/java/org/connectbot/HelpActivity.java | 29 | ||||
-rw-r--r-- | app/src/main/res/layout/dia_keyboard_shortcuts.xml | 81 | ||||
-rw-r--r-- | app/src/main/res/values/strings.xml | 7 |
3 files changed, 111 insertions, 6 deletions
diff --git a/app/src/main/java/org/connectbot/HelpActivity.java b/app/src/main/java/org/connectbot/HelpActivity.java index 0abcf17..5fae5ff 100644 --- a/app/src/main/java/org/connectbot/HelpActivity.java +++ b/app/src/main/java/org/connectbot/HelpActivity.java @@ -20,14 +20,17 @@ 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; import android.widget.LinearLayout; +import android.widget.TableRow; /** * @author Kenny Root @@ -39,6 +42,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 +80,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 c2ce2e7..9d20356 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> |