From 8b78652c17d9d5f5d71d5a1d5b740fc70714dfb5 Mon Sep 17 00:00:00 2001 From: Kyle Horimoto Date: Fri, 2 Oct 2015 16:23:26 -0700 Subject: Add connection options. --- .../java/org/connectbot/HostEditorFragment.java | 157 ++++++- app/src/main/res/layout/fragment_host_editor.xml | 518 +++++++++++++++------ app/src/main/res/values/strings.xml | 1 + 3 files changed, 523 insertions(+), 153 deletions(-) (limited to 'app/src') diff --git a/app/src/main/java/org/connectbot/HostEditorFragment.java b/app/src/main/java/org/connectbot/HostEditorFragment.java index f0a8c4f..0312f5d 100644 --- a/app/src/main/java/org/connectbot/HostEditorFragment.java +++ b/app/src/main/java/org/connectbot/HostEditorFragment.java @@ -25,6 +25,8 @@ import android.os.Bundle; import android.os.Parcelable; import android.support.design.widget.TextInputLayout; import android.support.v4.app.Fragment; +import android.support.v7.widget.AppCompatCheckBox; +import android.support.v7.widget.SwitchCompat; import android.text.Editable; import android.text.TextWatcher; import android.view.LayoutInflater; @@ -32,10 +34,12 @@ import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.ArrayAdapter; +import android.widget.CompoundButton; import android.widget.EditText; import android.widget.ImageButton; import android.widget.SeekBar; import android.widget.Spinner; +import android.widget.Switch; import android.widget.TextView; import org.connectbot.bean.HostBean; @@ -76,6 +80,12 @@ public class HostEditorFragment extends Fragment { // the text in the Spinner because the text is localized while these values are not. private TypedArray mColorValues; + // Likewise, but for SSH auth agent values. + private TypedArray mSshAuthValues; + + // Likewise, but for DEL key values. + private TypedArray mDelKeyValues; + private Spinner mTransportSpinner; private TextInputLayout mQuickConnectContainer; private EditText mQuickConnectField; @@ -91,6 +101,17 @@ public class HostEditorFragment extends Fragment { private Spinner mColorSelector; private TextView mFontSizeText; private SeekBar mFontSizeSeekBar; + private Spinner mPubkeySpinner; + private View mUseSshConfirmationContainer; + private SwitchCompat mUseSshAuthSwitch; + private AppCompatCheckBox mSshAuthConfirmationCheckbox; + private SwitchCompat mCompressionSwitch; + private SwitchCompat mStartShellSwitch; + private SwitchCompat mStayConnectedSwitch; + private SwitchCompat mCloseOnDisconnectSwitch; + private EditText mPostLoginAutomationField; + private Spinner mDelKeySpinner; + private Spinner mEncodingSpinner; public static HostEditorFragment newInstance(HostBean existingHost) { HostEditorFragment fragment = new HostEditorFragment(); @@ -128,12 +149,16 @@ public class HostEditorFragment extends Fragment { View view = inflater.inflate(R.layout.fragment_host_editor, container, false); mTransportSpinner = (Spinner) view.findViewById(R.id.transport_selector); + String[] transportNames = TransportFactory.getTransportNames(); ArrayAdapter transportSelection = new ArrayAdapter<>( - getActivity(), - android.R.layout.simple_spinner_item, - TransportFactory.getTransportNames()); + getActivity(), android.R.layout.simple_spinner_item, transportNames); transportSelection.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); mTransportSpinner.setAdapter(transportSelection); + for (int i = 0; i < transportNames.length; i++) { + if (transportNames.equals(mHost.getProtocol())) { + mTransportSpinner.setSelection(i); + } + } mTransportSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView parent, View view, int position, long id) { @@ -240,14 +265,10 @@ public class HostEditorFragment extends Fragment { new HostTextFieldWatcher(HostDatabase.FIELD_HOST_NICKNAME)); mColorSelector = (Spinner) view.findViewById(R.id.color_selector); - if (mHost.getColor() != null) { - // Unfortunately, TypedArray doesn't have an indexOf(String) function, so search through - // the array for the saved color. - for (int i = 0; i < mColorValues.getIndexCount(); i++) { - if (mHost.getColor().equals(mColorValues.getString(i))) { - mColorSelector.setSelection(i); - break; - } + for (int i = 0; i < mColorValues.getIndexCount(); i++) { + if (mHost.getColor().equals(mColorValues.getString(i))) { + mColorSelector.setSelection(i); + break; } } mColorSelector.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @@ -281,6 +302,88 @@ public class HostEditorFragment extends Fragment { }); mFontSizeSeekBar.setProgress(mHost.getFontSize() - MINIMUM_FONT_SIZE); + mPubkeySpinner = (Spinner) view.findViewById(R.id.pubkey_spinner); + // TODO: Set up spinner. This requires passing pubkey data into the fragment from the + // activity and will be part of an upcoming PR. + + mUseSshConfirmationContainer = view.findViewById(R.id.ssh_confirmation_container); + mUseSshAuthSwitch = (SwitchCompat) view.findViewById(R.id.use_ssh_auth_switch); + mSshAuthConfirmationCheckbox = + (AppCompatCheckBox) view.findViewById(R.id.ssh_auth_confirmation_checkbox); + CompoundButton.OnCheckedChangeListener authSwitchListener = new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { + mUseSshConfirmationContainer.setVisibility( + mUseSshAuthSwitch.isChecked() ? View.VISIBLE : View.GONE); + if (mUseSshAuthSwitch.isChecked()) { + mHost.setUseAuthAgent( + mSshAuthConfirmationCheckbox.isChecked() ? + /* require confirmation */ mSshAuthValues.getString(1) : + /* don't require confirmation */ mSshAuthValues.getString(2)); + } else { + mHost.setUseAuthAgent(/* don't use */ mSshAuthValues.getString(0)); + } + } + }; + mUseSshAuthSwitch.setOnCheckedChangeListener(authSwitchListener); + mSshAuthConfirmationCheckbox.setOnCheckedChangeListener(authSwitchListener); + if (mHost.getUseAuthAgent() == null || + mHost.getUseAuthAgent().equals(mSshAuthValues.getString(0))) { + mUseSshAuthSwitch.setChecked(false); + mSshAuthConfirmationCheckbox.setChecked(false); + } else { + mUseSshAuthSwitch.setChecked(true); + mSshAuthConfirmationCheckbox.setChecked( + mHost.getUseAuthAgent().equals(mSshAuthValues.getString(1))); + } + + mCompressionSwitch = (SwitchCompat) view.findViewById(R.id.compression_switch); + mCompressionSwitch.setChecked(mHost.getCompression()); + mCompressionSwitch.setOnCheckedChangeListener( + new HostSwitchWatcher(HostDatabase.FIELD_HOST_COMPRESSION)); + + mStartShellSwitch = (SwitchCompat) view.findViewById(R.id.start_shell_switch); + mStartShellSwitch.setChecked(mHost.getWantSession()); + mStartShellSwitch.setOnCheckedChangeListener( + new HostSwitchWatcher(HostDatabase.FIELD_HOST_WANTSESSION)); + + mStayConnectedSwitch = (SwitchCompat) view.findViewById(R.id.stay_connected_switch); + mStayConnectedSwitch.setChecked(mHost.getStayConnected()); + mStayConnectedSwitch.setOnCheckedChangeListener( + new HostSwitchWatcher(HostDatabase.FIELD_HOST_STAYCONNECTED)); + + mCloseOnDisconnectSwitch = (SwitchCompat) view.findViewById(R.id.close_on_disconnect_switch); + mCloseOnDisconnectSwitch.setChecked(mHost.getQuickDisconnect()); + mCloseOnDisconnectSwitch.setOnCheckedChangeListener( + new HostSwitchWatcher(HostDatabase.FIELD_HOST_QUICKDISCONNECT)); + + mPostLoginAutomationField = (EditText) view.findViewById(R.id.post_login_automation_field); + mPostLoginAutomationField.setText(mHost.getPostLogin()); + mPostLoginAutomationField.addTextChangedListener( + new HostTextFieldWatcher(HostDatabase.FIELD_HOST_POSTLOGIN)); + + mDelKeySpinner = (Spinner) view.findViewById(R.id.del_key_spinner); + for (int i = 0; i < mDelKeyValues.getIndexCount(); i++) { + if (mHost.getDelKey().equals(mDelKeyValues.getString(i))) { + mDelKeySpinner.setSelection(i); + break; + } + } + mDelKeySpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { + @Override + public void onItemSelected(AdapterView parent, View view, int position, long id) { + mHost.setDelKey(mDelKeyValues.getString(position)); + } + + @Override + public void onNothingSelected(AdapterView parent) { + } + }); + + mEncodingSpinner = (Spinner) view.findViewById(R.id.encoding_spinner); + // TODO: Set up spinner. This requires passing pubkey data into the fragment from the + // activity and will be part of an upcoming PR. + setUriPartsContainerExpanded(mIsUriEditorExpanded); return view; @@ -295,9 +398,11 @@ public class HostEditorFragment extends Fragment { throw new ClassCastException(context.toString() + " must implement Listener"); } - // Now that the fragment is attached to an Activity, fetch the array from the attached + // Now that the fragment is attached to an Activity, fetch the arrays from the attached // Activity's resources. mColorValues = getResources().obtainTypedArray(R.array.list_color_values); + mSshAuthValues = getResources().obtainTypedArray(R.array.list_authagent_values); + mDelKeyValues = getResources().obtainTypedArray(R.array.list_delkey_values); } @Override @@ -305,6 +410,8 @@ public class HostEditorFragment extends Fragment { super.onDetach(); mListener = null; mColorValues.recycle(); + mSshAuthValues.recycle(); + mDelKeyValues.recycle(); } @Override @@ -392,6 +499,8 @@ public class HostEditorFragment extends Fragment { } } else if (HostDatabase.FIELD_HOST_NICKNAME.equals(mFieldType)) { mHost.setNickname(text); + } else if (HostDatabase.FIELD_HOST_POSTLOGIN.equals(mFieldType)) { + mHost.setPostLogin(text); } else { throw new RuntimeException("Invalid field type."); } @@ -414,4 +523,28 @@ public class HostEditorFragment extends Fragment { HostDatabase.FIELD_HOST_PORT.equals(fieldType); } } + + private class HostSwitchWatcher implements CompoundButton.OnCheckedChangeListener { + + private final String mFieldType; + + public HostSwitchWatcher(String fieldType) { + mFieldType = fieldType; + } + + @Override + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { + if (HostDatabase.FIELD_HOST_COMPRESSION.equals(mFieldType)) { + mHost.setCompression(isChecked); + } else if (HostDatabase.FIELD_HOST_WANTSESSION.equals(mFieldType)) { + mHost.setWantSession(isChecked); + } else if (HostDatabase.FIELD_HOST_STAYCONNECTED.equals(mFieldType)) { + mHost.setStayConnected(isChecked); + } else if (HostDatabase.FIELD_HOST_QUICKDISCONNECT.equals(mFieldType)) { + mHost.setQuickDisconnect(isChecked); + } else { + throw new RuntimeException("Invalid field type."); + } + } + } } diff --git a/app/src/main/res/layout/fragment_host_editor.xml b/app/src/main/res/layout/fragment_host_editor.xml index 6f429ac..cd27788 100644 --- a/app/src/main/res/layout/fragment_host_editor.xml +++ b/app/src/main/res/layout/fragment_host_editor.xml @@ -15,226 +15,462 @@ ~ limitations under the License. --> - + > - + android:orientation="vertical" + android:layout_marginStart="4dp" + android:layout_marginLeft="4dp" + android:layout_marginBottom="4dp" + > - + - + - + - + + + + + + + + + + + - + android:orientation="vertical" + android:layout_marginLeft="56dp" + android:layout_marginStart="56dp" + android:visibility="gone" + android:animateLayoutChanges="true" + tools:ignore="UnusedAttribute" + > - + + + + + + + + + + + + + - + - + - + + + - + - - + + + + + + + + + + + + + + + + + + + + - + - + + + + + + - + + + + + + + + + + + + + + + + + + + > - + - + - + - + + + + + - + + + > - + - + - + + + > - + + + + + + + > - + - + + + - - + android:orientation="vertical" + android:layout_marginStart="4dp" + android:layout_marginLeft="4dp" + android:layout_marginBottom="4dp" + > - + - + + + + + - + \ 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 9833a31..75213ba 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -596,5 +596,6 @@ Protocol Expand + require confirmation -- cgit v1.2.3 From 50262fac4e67c27bfb9cea7778ef8de1458871e3 Mon Sep 17 00:00:00 2001 From: Kyle Horimoto Date: Mon, 5 Oct 2015 15:58:42 -0700 Subject: Lint errors. --- app/src/main/java/org/connectbot/HostEditorFragment.java | 1 - app/src/main/res/layout/fragment_host_editor.xml | 10 ++++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'app/src') diff --git a/app/src/main/java/org/connectbot/HostEditorFragment.java b/app/src/main/java/org/connectbot/HostEditorFragment.java index 0312f5d..b5555a6 100644 --- a/app/src/main/java/org/connectbot/HostEditorFragment.java +++ b/app/src/main/java/org/connectbot/HostEditorFragment.java @@ -39,7 +39,6 @@ import android.widget.EditText; import android.widget.ImageButton; import android.widget.SeekBar; import android.widget.Spinner; -import android.widget.Switch; import android.widget.TextView; import org.connectbot.bean.HostBean; diff --git a/app/src/main/res/layout/fragment_host_editor.xml b/app/src/main/res/layout/fragment_host_editor.xml index cd27788..5e809d8 100644 --- a/app/src/main/res/layout/fragment_host_editor.xml +++ b/app/src/main/res/layout/fragment_host_editor.xml @@ -19,13 +19,13 @@ xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" - android:layout_height="match_parent" + android:layout_height="wrap_content" tools:context="org.connectbot.HostEditorFragment" > @@ -291,6 +291,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" + android:layout_alignParentEnd="true" /> @@ -313,6 +314,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" + android:layout_alignParentEnd="true" /> @@ -335,6 +337,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" + android:layout_alignParentEnd="true" /> @@ -355,6 +358,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" + android:layout_alignParentEnd="true" /> @@ -375,6 +379,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" + android:layout_alignParentEnd="true" /> @@ -395,6 +400,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" + android:layout_alignParentEnd="true" /> -- cgit v1.2.3 From c096c13e99ff32ba8052d1cd0cb34f27d3b1951d Mon Sep 17 00:00:00 2001 From: Kyle Horimoto Date: Tue, 6 Oct 2015 11:03:53 -0700 Subject: Jeremy comment. --- app/src/main/java/org/connectbot/HostEditorFragment.java | 1 + 1 file changed, 1 insertion(+) (limited to 'app/src') diff --git a/app/src/main/java/org/connectbot/HostEditorFragment.java b/app/src/main/java/org/connectbot/HostEditorFragment.java index b5555a6..6646b4a 100644 --- a/app/src/main/java/org/connectbot/HostEditorFragment.java +++ b/app/src/main/java/org/connectbot/HostEditorFragment.java @@ -156,6 +156,7 @@ public class HostEditorFragment extends Fragment { for (int i = 0; i < transportNames.length; i++) { if (transportNames.equals(mHost.getProtocol())) { mTransportSpinner.setSelection(i); + break; } } mTransportSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { -- cgit v1.2.3 From 0a41d6587a4bcea300a9a0f9893f1eeaf6c15af5 Mon Sep 17 00:00:00 2001 From: Kyle Horimoto Date: Tue, 6 Oct 2015 11:43:43 -0700 Subject: Jeremy comment. --- app/src/main/res/values/strings.xml | 1 + 1 file changed, 1 insertion(+) (limited to 'app/src') diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 75213ba..a0dc643 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -596,6 +596,7 @@ Protocol Expand + require confirmation -- cgit v1.2.3 From 835dac4485c52362a13f4895f8c687e301000d96 Mon Sep 17 00:00:00 2001 From: Ryan Hansberry Date: Wed, 23 Sep 2015 10:47:05 -0700 Subject: Fixed error when not filling in all fields of port forward creation dialog. --- .../java/org/connectbot/PortForwardListActivity.java | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'app/src') diff --git a/app/src/main/java/org/connectbot/PortForwardListActivity.java b/app/src/main/java/org/connectbot/PortForwardListActivity.java index c7f0e7c..e5d3210 100644 --- a/app/src/main/java/org/connectbot/PortForwardListActivity.java +++ b/app/src/main/java/org/connectbot/PortForwardListActivity.java @@ -188,11 +188,23 @@ public class PortForwardListActivity extends AppCompatListActivity { break; } + // Why length(), not isEmpty(), is used: http://stackoverflow.com/q/10606725 + String sourcePort = sourcePortEdit.getText().toString(); + if (sourcePort.length() == 0) { + sourcePort = sourcePortEdit.getHint().toString(); + } + + String destination = destEdit.getText().toString(); + if (destination.length() == 0) { + destination = destEdit.getHint().toString(); + } + PortForwardBean portForward = new PortForwardBean( host != null ? host.getId() : -1, - nicknameEdit.getText().toString(), type, - sourcePortEdit.getText().toString(), - destEdit.getText().toString()); + nicknameEdit.getText().toString(), + type, + sourcePort, + destination); if (hostBridge != null) { hostBridge.addPortForward(portForward); -- cgit v1.2.3 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" /> +