aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--AndroidManifest.xml5
-rw-r--r--res/drawable/icon.pngbin5863 -> 5088 bytes
-rw-r--r--res/layout/about_dialog.xml23
-rw-r--r--res/values/strings.xml2
-rw-r--r--src/org/theb/ssh/HostsList.java46
-rw-r--r--src/org/theb/ssh/SecureShell.java10
6 files changed, 64 insertions, 22 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index fa54aea..31280af 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.theb.ssh">
- <application android:icon="@drawable/icon">
+ <application android:icon="@drawable/icon"
+ android:label="@string/app_name">
<provider class="HostDbProvider"
android:authorities="org.theb.provider.HostDb"/>
<activity class="HostsList" android:label="@string/title_hosts_list">
@@ -51,7 +52,7 @@
<activity class="SecureShell" android:label="@string/title_shell">
<!-- This filter says that we can connect to a host -->
- <intent-filter android:label="@string/resolve_edit">
+ <intent-filter android:label="@string/resolve_connect">
<action android:value="org.theb.ssh.action.CONNECT_HOST" />
<action android:value="android.intent.action.PICK" />
<!-- DEFAULT: execute if being directly invoked. -->
diff --git a/res/drawable/icon.png b/res/drawable/icon.png
index 5f2bd02..323b99f 100644
--- a/res/drawable/icon.png
+++ b/res/drawable/icon.png
Binary files differ
diff --git a/res/layout/about_dialog.xml b/res/layout/about_dialog.xml
index 56e265c..9a515fc 100644
--- a/res/layout/about_dialog.xml
+++ b/res/layout/about_dialog.xml
@@ -1,11 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="horizontal"
android:layout_width="fill_parent"
- android:layout_height="wrap_content"
+ android:layout_height="64px"
android:theme="@android:style/Theme.Dialog">
+ <ImageView id="@+id/icon"
+ android:layout_width="75px"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:minHeight="64px"
+ android:minWidth="64px"
+ android:src="@drawable/icon"/>
+
<TextView id="@+id/copyright"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:text="@string/msg_copyright"/>
-</RelativeLayout> \ No newline at end of file
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:paddingLeft="10dip"
+ android:layout_weight="2"
+ android:text="@string/msg_copyright"/>
+</LinearLayout> \ No newline at end of file
diff --git a/res/values/strings.xml b/res/values/strings.xml
index e76c311..b9531d8 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -19,6 +19,6 @@
<string name="button_cancel">Cancel</string>
<string name="button_change">Change</string>
- <string name="msg_copyright">Copyright (C) 2007, Kenny Root</string>
+ <string name="msg_copyright">Copyright &#169; 2007, Kenny Root http://the-b.org/</string>
<string name="msg_version">v1.0</string>
</resources>
diff --git a/src/org/theb/ssh/HostsList.java b/src/org/theb/ssh/HostsList.java
index 7a35fe2..da994d6 100644
--- a/src/org/theb/ssh/HostsList.java
+++ b/src/org/theb/ssh/HostsList.java
@@ -1,6 +1,8 @@
package org.theb.ssh;
import org.theb.provider.HostDb;
+
+import android.app.Dialog;
import android.app.ListActivity;
import android.content.ComponentName;
import android.content.Context;
@@ -12,6 +14,7 @@ import android.os.Bundle;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.View;
+import android.view.WindowManager;
import android.view.View.MeasureSpec;
import android.widget.ListAdapter;
import android.widget.ListView;
@@ -21,6 +24,7 @@ import android.widget.TextView;
public class HostsList extends ListActivity {
public static final int DELETE_ID = Menu.FIRST;
public static final int INSERT_ID = Menu.FIRST + 1;
+ public static final int ABOUT_ID = Menu.FIRST + 2;
private static final String[] PROJECTION = new String[] {
HostDb.Hosts._ID,
@@ -31,6 +35,13 @@ public class HostsList extends ListActivity {
private Cursor mCursor;
+ /**
+ * @author kenny
+ * Imparts a more informative view of the host list.
+ *
+ * Displays as "username@hostname:port" but only includes the port if it is
+ * not on the default port 22.
+ */
public class HostListCursorAdapter extends SimpleCursorAdapter {
public HostListCursorAdapter(Context context, int layout, Cursor c,
@@ -42,9 +53,7 @@ public class HostsList extends ListActivity {
public void bindView(View view, Context context, Cursor cursor) {
String label;
TextView textView = (TextView) view;
-
- // Create a list display of "username@hostname:port" but exclude the port if
- // it is already port 22 (default secure shell port).
+
label = cursor.getString(2)
+ "@"
+ cursor.getString(1);
@@ -64,7 +73,7 @@ public class HostsList extends ListActivity {
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
- this.setDefaultKeyMode(SHORTCUT_DEFAULT_KEYS);
+ setDefaultKeyMode(SHORTCUT_DEFAULT_KEYS);
Intent intent = getIntent();
if (intent.getData() == null) {
@@ -111,10 +120,13 @@ public class HostsList extends ListActivity {
super.onCreateOptionsMenu(menu);
// This is our one standard application action -- inserting a
- // new note into the list.
+ // new host into the list.
menu.add(0, INSERT_ID, R.string.menu_insert).setShortcut(
KeyEvent.KEYCODE_3, 0, KeyEvent.KEYCODE_A);
+ // This links to the about dialog for the program.
+ menu.add(0, ABOUT_ID, R.string.menu_about);
+
// Generate any additional actions that can be performed on the
// overall list. In a normal install, there are no additional
// actions found here, but this allows other applications to extend
@@ -142,7 +154,7 @@ public class HostsList extends ListActivity {
// This is the selected item.
ContentURI uri = getIntent().getData().addId(getSelectionRowID());
- // Build menu... always starts with the CONNECT action...
+ // Build menu... always starts with the PICK action...
Intent[] specifics = new Intent[1];
specifics[0] = new Intent(Intent.PICK_ACTION, uri);
Menu.Item[] items = new Menu.Item[1];
@@ -181,11 +193,31 @@ public class HostsList extends ListActivity {
case INSERT_ID:
insertItem();
return true;
+ case ABOUT_ID:
+ showAbout();
+ return true;
}
return super.onOptionsItemSelected(item);
}
- @Override
+ private void showAbout() {
+ Dialog about = new Dialog(this);
+ about.setContentView(R.layout.about_dialog);
+ about.setTitle(getResources().getString(R.string.app_name)
+ + " "
+ + getResources().getString(R.string.msg_version));
+
+ // Everything looks cooler when you blur the window behind it.
+ about.getWindow().setFlags(WindowManager.LayoutParams.BLUR_BEHIND_FLAG,
+ WindowManager.LayoutParams.BLUR_BEHIND_FLAG);
+ WindowManager.LayoutParams lp = about.getWindow().getAttributes();
+ lp.tintBehind = 0x60000820;
+ about.getWindow().setAttributes(lp);
+
+ about.show();
+ }
+
+ @Override
protected void onListItemClick(ListView l, View v, int position, long id) {
ContentURI url = getIntent().getData().addId(getSelectionRowID());
diff --git a/src/org/theb/ssh/SecureShell.java b/src/org/theb/ssh/SecureShell.java
index 0845559..2ec8029 100644
--- a/src/org/theb/ssh/SecureShell.java
+++ b/src/org/theb/ssh/SecureShell.java
@@ -7,16 +7,11 @@ import java.util.concurrent.Semaphore;
import org.theb.provider.HostDb;
-import com.trilead.ssh2.Connection;
-import com.trilead.ssh2.ConnectionMonitor;
-import com.trilead.ssh2.Session;
-
import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
-import android.net.ContentURI;
import android.os.Bundle;
import android.os.Handler;
import android.text.method.KeyCharacterMap;
@@ -26,9 +21,12 @@ import android.view.View;
import android.view.Window;
import android.view.View.OnClickListener;
import android.widget.Button;
-import android.widget.EditText;
import android.widget.TextView;
+import com.trilead.ssh2.Connection;
+import com.trilead.ssh2.ConnectionMonitor;
+import com.trilead.ssh2.Session;
+
public class SecureShell extends Activity {
private Context mContext;
private TextView mOutput;