aboutsummaryrefslogtreecommitdiffstats
path: root/src/org/theb
diff options
context:
space:
mode:
authorKenny Root <kenny@the-b.org>2007-11-18 05:52:08 +0000
committerKenny Root <kenny@the-b.org>2007-11-18 05:52:08 +0000
commit1c008e4dffdf42797f623a6a5ced59d705d4e6b5 (patch)
treef71e75bbb962b1dbb61506b9f29aca8eb376b10e /src/org/theb
parent0a4ee03304d605e7e1383aa37ff2c355a383caff (diff)
downloadconnectbot-1c008e4dffdf42797f623a6a5ced59d705d4e6b5.tar.gz
connectbot-1c008e4dffdf42797f623a6a5ced59d705d4e6b5.tar.bz2
connectbot-1c008e4dffdf42797f623a6a5ced59d705d4e6b5.zip
Updated icon for about screen.
Diffstat (limited to 'src/org/theb')
-rw-r--r--src/org/theb/ssh/HostsList.java46
-rw-r--r--src/org/theb/ssh/SecureShell.java10
2 files changed, 43 insertions, 13 deletions
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;