From 505d8fdab97829cbd87dbcf476e029a44d886a90 Mon Sep 17 00:00:00 2001 From: Jeremy Klein Date: Mon, 5 Oct 2015 17:28:41 -0700 Subject: Get rid of the final html help view and switch it to native. --- app/src/main/AndroidManifest.xml | 17 +- app/src/main/assets/help/Hints.html | 26 -- app/src/main/java/org/connectbot/HelpActivity.java | 48 +--- .../java/org/connectbot/HelpTopicActivity.java | 48 ---- .../main/java/org/connectbot/HintsActivity.java | 30 +++ .../java/org/connectbot/util/HelpTopicView.java | 62 ----- app/src/main/res/drawable/gesture_hostnext.png | Bin 0 -> 8161 bytes app/src/main/res/drawable/gesture_hostprev.png | Bin 0 -> 8232 bytes app/src/main/res/drawable/gesture_pgdn.png | Bin 0 -> 8434 bytes app/src/main/res/drawable/gesture_pgup.png | Bin 0 -> 8560 bytes app/src/main/res/drawable/gesture_scrollback.png | Bin 0 -> 9061 bytes .../main/res/drawable/gesture_scrollforward.png | Bin 0 -> 8691 bytes app/src/main/res/layout-sw500dp/act_hints.xml | 262 +++++++++++++++++++++ app/src/main/res/layout/act_help.xml | 18 ++ app/src/main/res/layout/act_help_topic.xml | 33 --- app/src/main/res/layout/act_hints.xml | 196 +++++++++++++++ app/src/main/res/values/strings.xml | 39 +++ 17 files changed, 561 insertions(+), 218 deletions(-) delete mode 100644 app/src/main/assets/help/Hints.html delete mode 100644 app/src/main/java/org/connectbot/HelpTopicActivity.java create mode 100644 app/src/main/java/org/connectbot/HintsActivity.java delete mode 100644 app/src/main/java/org/connectbot/util/HelpTopicView.java create mode 100644 app/src/main/res/drawable/gesture_hostnext.png create mode 100644 app/src/main/res/drawable/gesture_hostprev.png create mode 100644 app/src/main/res/drawable/gesture_pgdn.png create mode 100644 app/src/main/res/drawable/gesture_pgup.png create mode 100644 app/src/main/res/drawable/gesture_scrollback.png create mode 100644 app/src/main/res/drawable/gesture_scrollforward.png create mode 100644 app/src/main/res/layout-sw500dp/act_hints.xml delete mode 100644 app/src/main/res/layout/act_help_topic.xml create mode 100644 app/src/main/res/layout/act_hints.xml (limited to 'app/src') diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index e863b21..95177fc 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -134,29 +134,28 @@ + android:label="@string/title_colors"> + android:value="org.connectbot.HostListActivity"/> + android:label="@string/terms_and_conditions"> + android:value="org.connectbot.HelpActivity"/> + android:name=".HintsActivity" + android:label="@string/hints"> - - -

Host Shortcuts

-

Long-press on your Android desktop to create direct shortcuts to frequently-used SSH hosts.

- -

Page Up / Page Down

-

Swiping your finger up and down on the left third of the screen - will send a page up and page down key to the remote host. Many programs - map this to scrolling back into history such as irssi or tinyfugue.

-

Page Up gesture

-

Page Down gesture

- -

Scroll back / Scroll forward

-

Swiping your finger up on the right side of the screen allows you to scroll backward and forward - in the local terminal buffer history.

-

Scroll back gesture

-

Scroll forward gesture

- -

Switching hosts

-

Swiping your finger from one side of the screen to the other will switch between currently connected hosts.

-

Previous host gesture

-

Next host gesture

- - - \ No newline at end of file diff --git a/app/src/main/java/org/connectbot/HelpActivity.java b/app/src/main/java/org/connectbot/HelpActivity.java index 3df8b2f..998dfe0 100644 --- a/app/src/main/java/org/connectbot/HelpActivity.java +++ b/app/src/main/java/org/connectbot/HelpActivity.java @@ -17,30 +17,20 @@ package org.connectbot; -import java.io.IOException; - import android.app.AlertDialog; import android.content.Intent; -import android.content.res.AssetManager; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; -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; /** * @author Kenny Root * */ public class HelpActivity extends AppCompatActivity { - public final static String TAG = "CB.HelpActivity"; - - public final static String HELPDIR = "help"; - public final static String SUFFIX = ".html"; - private LayoutInflater inflater = null; @@ -49,35 +39,16 @@ public class HelpActivity extends AppCompatActivity { super.onCreate(icicle); setContentView(R.layout.act_help); - AssetManager am = this.getAssets(); - LinearLayout content = (LinearLayout) findViewById(R.id.topics); - - try { - for (String name : am.list(HELPDIR)) { - if (name.endsWith(SUFFIX)) { - Button button = new Button(this); - final String topic = name.substring(0, name.length() - SUFFIX.length()); - button.setText(topic); - - button.setOnClickListener(new OnClickListener() { - public void onClick(View v) { - Intent intent = new Intent(HelpActivity.this, HelpTopicActivity.class); - intent.putExtra(Intent.EXTRA_TITLE, topic); - HelpActivity.this.startActivity(intent); - } - }); - - content.addView(button); - } + Button hintsButton = (Button) findViewById(R.id.hints_button); + hintsButton.setOnClickListener(new OnClickListener() { + public void onClick(View v) { + Intent intent = new Intent(HelpActivity.this, HintsActivity.class); + HelpActivity.this.startActivity(intent); } - } catch (IOException e) { - // TODO Auto-generated catch block - Log.e(TAG, "couldn't get list of help assets", e); - } + }); inflater = LayoutInflater.from(this); - Button shortcutsButton = new Button(this); - shortcutsButton.setText(getResources().getString(R.string.keyboard_shortcuts)); + Button shortcutsButton = (Button) findViewById(R.id.shortcuts_button); shortcutsButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { final View shortcuts = inflater.inflate(R.layout.dia_keyboard_shortcuts, null, false); @@ -87,16 +58,13 @@ public class HelpActivity extends AppCompatActivity { .show(); } }); - content.addView(shortcutsButton); - Button eulaButton = new Button(this); - eulaButton.setText(getResources().getString(R.string.terms_and_conditions)); + Button eulaButton = (Button) findViewById(R.id.eula_button); eulaButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { Intent intent = new Intent(HelpActivity.this, EulaActivity.class); HelpActivity.this.startActivity(intent); } }); - content.addView(eulaButton); } } diff --git a/app/src/main/java/org/connectbot/HelpTopicActivity.java b/app/src/main/java/org/connectbot/HelpTopicActivity.java deleted file mode 100644 index 9f5573a..0000000 --- a/app/src/main/java/org/connectbot/HelpTopicActivity.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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. - */ - -package org.connectbot; - -import org.connectbot.util.HelpTopicView; - -import android.content.Intent; -import android.os.Bundle; -import android.support.v7.app.AppCompatActivity; - -/** - * @author Kenny Root - * - */ -public class HelpTopicActivity extends AppCompatActivity { - public final static String TAG = "CB.HelpActivity"; - - @Override - public void onCreate(Bundle icicle) { - super.onCreate(icicle); - setContentView(R.layout.act_help_topic); - - String topic = getIntent().getStringExtra(Intent.EXTRA_TITLE); - - this.setTitle(String.format("%s: %s", - getResources().getText(R.string.title_help), - topic)); - - HelpTopicView helpTopic = (HelpTopicView) findViewById(R.id.topic_text); - - helpTopic.setTopic(topic); - } -} diff --git a/app/src/main/java/org/connectbot/HintsActivity.java b/app/src/main/java/org/connectbot/HintsActivity.java new file mode 100644 index 0000000..25bc691 --- /dev/null +++ b/app/src/main/java/org/connectbot/HintsActivity.java @@ -0,0 +1,30 @@ +/* + * 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. + */ + +package org.connectbot; + +import android.os.Bundle; +import android.support.v7.app.AppCompatActivity; + +public class HintsActivity extends AppCompatActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.act_hints); + } +} diff --git a/app/src/main/java/org/connectbot/util/HelpTopicView.java b/app/src/main/java/org/connectbot/util/HelpTopicView.java deleted file mode 100644 index 0cbc267..0000000 --- a/app/src/main/java/org/connectbot/util/HelpTopicView.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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. - */ - -package org.connectbot.util; - -import org.connectbot.HelpActivity; - -import android.content.Context; -import android.util.AttributeSet; -import android.webkit.WebSettings; -import android.webkit.WebView; - -/** - * @author Kenny Root - * - */ -public class HelpTopicView extends WebView { - public HelpTopicView(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); - initialize(); - } - - public HelpTopicView(Context context, AttributeSet attrs) { - super(context, attrs); - initialize(); - } - - public HelpTopicView(Context context) { - super(context); - initialize(); - } - - private void initialize() { - WebSettings wSet = getSettings(); - wSet.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NARROW_COLUMNS); - wSet.setUseWideViewPort(false); - } - - public HelpTopicView setTopic(String topic) { - String path = String.format("file:///android_asset/%s/%s%s", - HelpActivity.HELPDIR, topic, HelpActivity.SUFFIX); - loadUrl(path); - - computeScroll(); - - return this; - } -} diff --git a/app/src/main/res/drawable/gesture_hostnext.png b/app/src/main/res/drawable/gesture_hostnext.png new file mode 100644 index 0000000..624223d Binary files /dev/null and b/app/src/main/res/drawable/gesture_hostnext.png differ diff --git a/app/src/main/res/drawable/gesture_hostprev.png b/app/src/main/res/drawable/gesture_hostprev.png new file mode 100644 index 0000000..f99f70c Binary files /dev/null and b/app/src/main/res/drawable/gesture_hostprev.png differ diff --git a/app/src/main/res/drawable/gesture_pgdn.png b/app/src/main/res/drawable/gesture_pgdn.png new file mode 100644 index 0000000..61b769b Binary files /dev/null and b/app/src/main/res/drawable/gesture_pgdn.png differ diff --git a/app/src/main/res/drawable/gesture_pgup.png b/app/src/main/res/drawable/gesture_pgup.png new file mode 100644 index 0000000..0e7f1ca Binary files /dev/null and b/app/src/main/res/drawable/gesture_pgup.png differ diff --git a/app/src/main/res/drawable/gesture_scrollback.png b/app/src/main/res/drawable/gesture_scrollback.png new file mode 100644 index 0000000..714e626 Binary files /dev/null and b/app/src/main/res/drawable/gesture_scrollback.png differ diff --git a/app/src/main/res/drawable/gesture_scrollforward.png b/app/src/main/res/drawable/gesture_scrollforward.png new file mode 100644 index 0000000..0172e45 Binary files /dev/null and b/app/src/main/res/drawable/gesture_scrollforward.png differ diff --git a/app/src/main/res/layout-sw500dp/act_hints.xml b/app/src/main/res/layout-sw500dp/act_hints.xml new file mode 100644 index 0000000..d0b82e2 --- /dev/null +++ b/app/src/main/res/layout-sw500dp/act_hints.xml @@ -0,0 +1,262 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/act_help.xml b/app/src/main/res/layout/act_help.xml index b4bb808..146eaa1 100644 --- a/app/src/main/res/layout/act_help.xml +++ b/app/src/main/res/layout/act_help.xml @@ -52,5 +52,23 @@ android:textAppearance="?android:attr/textAppearanceMedium" /> +