aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenny Root <kenny@the-b.org>2008-03-16 08:04:33 +0000
committerKenny Root <kenny@the-b.org>2008-03-16 08:04:33 +0000
commit2d555d046e185b229a688817ac78e7e277e5b391 (patch)
treed96ae91d3afdaa43e65d92a1724ae3c10a70278a
parentc9c36c1e2aa66708c8cff728e2e4b02de1ec08a7 (diff)
downloadconnectbot-2d555d046e185b229a688817ac78e7e277e5b391.tar.gz
connectbot-2d555d046e185b229a688817ac78e7e277e5b391.tar.bz2
connectbot-2d555d046e185b229a688817ac78e7e277e5b391.zip
Initial update for Android SDK M5 support.
-rw-r--r--.classpath6
-rw-r--r--.project8
-rw-r--r--AndroidManifest.xml48
-rw-r--r--res/layout/about_dialog.xml4
-rw-r--r--res/layout/host_editor.xml16
-rw-r--r--res/layout/main.xml2
-rw-r--r--res/layout/message_dialog.xml4
-rw-r--r--res/layout/password_dialog.xml6
-rw-r--r--res/layout/pubkey.xml8
-rw-r--r--res/layout/secure_shell.xml4
-rw-r--r--res/values/strings.xml2
-rw-r--r--src/org/theb/provider/HostDb.java6
-rw-r--r--src/org/theb/ssh/HostDbProvider.java42
-rw-r--r--src/org/theb/ssh/HostEditor.java9
-rw-r--r--src/org/theb/ssh/HostsList.java31
-rw-r--r--src/org/theb/ssh/Pubkey.java1
-rw-r--r--src/org/theb/ssh/SecureShell.java10
-rw-r--r--src/org/theb/ssh/TouchEntropy.java2
18 files changed, 105 insertions, 104 deletions
diff --git a/.classpath b/.classpath
index 1933ede..9a5c3f1 100644
--- a/.classpath
+++ b/.classpath
@@ -1,10 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
- <classpathentry kind="lib" path="/Users/kenny/android/android.jar">
- <attributes>
- <attribute name="javadoc_location" value="file:/Users/kenny/android/docs/reference"/>
- </attributes>
- </classpathentry>
+ <classpathentry kind="con" path="com.android.ide.eclipse.adt.project.AndroidClasspathContainerInitializer"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/.project b/.project
index 2b4d401..260be6e 100644
--- a/.project
+++ b/.project
@@ -6,12 +6,12 @@
</projects>
<buildSpec>
<buildCommand>
- <name>com.google.android.adt.ResourceManagerBuilder</name>
+ <name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
- <name>com.google.android.adt.PreCompilerBuilder</name>
+ <name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
<arguments>
</arguments>
</buildCommand>
@@ -21,13 +21,13 @@
</arguments>
</buildCommand>
<buildCommand>
- <name>com.google.android.adt.ApkBuilder</name>
+ <name>com.android.ide.eclipse.adt.ApkBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
- <nature>com.google.android.adt.AndroidNature</nature>
+ <nature>com.android.ide.eclipse.adt.AndroidNature</nature>
</natures>
</projectDescription>
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 2537545..89fb231 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -3,40 +3,40 @@
package="org.theb.ssh">
<application android:icon="@drawable/icon"
android:label="@string/app_name">
- <provider class="HostDbProvider"
+ <provider android:name="HostDbProvider"
android:authorities="org.theb.provider.HostDb"/>
- <activity class="HostsList" android:label="@string/title_hosts_list">
+ <activity android:name="HostsList" android:label="@string/title_hosts_list">
<intent-filter>
- <action android:value="android.intent.action.MAIN" />
- <category android:value="android.intent.category.LAUNCHER" />
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
- <action android:value="android.intent.action.PICK" />
- <action android:value="android.intent.action.VIEW" />
- <action android:value="android.intent.action.EDIT" />
- <category android:value="android.intent.category.DEFAULT" />
- <type android:value="vnd.android.cursor.dir/vnd.theb.host" />
+ <action android:name="android.intent.action.PICK" />
+ <action android:name="android.intent.action.VIEW" />
+ <action android:name="android.intent.action.EDIT" />
+ <category android:name="android.intent.category.DEFAULT" />
+ <data android:mimeType="vnd.android.cursor.dir/vnd.theb.host" />
</intent-filter>
</activity>
- <activity class="HostEditor" android:label="@string/title_host"
+ <activity android:name="HostEditor" android:label="@string/title_host"
android:theme="@android:style/Theme.Dialog">
<!-- This filter says that we can view or edit the data of
a single host -->
<intent-filter android:label="@string/resolve_edit">
- <action android:value="org.theb.ssh.action.EDIT_HOST" />
- <action android:value="org.theb.ssh.action.EDIT" />
+ <action android:name="org.theb.ssh.action.EDIT_HOST" />
+ <action android:name="org.theb.ssh.action.EDIT" />
<!-- DEFAULT: execute if being directly invoked. -->
- <category android:value="android.intent.category.DEFAULT" />
+ <category android:name="android.intent.category.DEFAULT" />
<!-- ALTERNATIVE: show as an alternative action when the user is
working with this type of data. -->
- <category android:value="android.intent.category.ALTERNATIVE" />
+ <category android:name="android.intent.category.ALTERNATIVE" />
<!-- SELECTED_ALTERNATIVE: show as an alternative action the user
can perform when selecting this type of data. -->
- <category android:value="android.intent.category.SELECTED_ALTERNATIVE" />
+ <category android:name="android.intent.category.SELECTED_ALTERNATIVE" />
<type android:value="vnd.android.cursor.item/vnd.theb.host" />
</intent-filter>
@@ -44,32 +44,32 @@
<!-- This filter says that we can create a new note inside
of a directory of notes. -->
<intent-filter>
- <action android:value="android.intent.action.INSERT" />
- <category android:value="android.intent.category.DEFAULT" />
+ <action android:name="android.intent.action.INSERT" />
+ <category android:name="android.intent.category.DEFAULT" />
<type android:value="vnd.android.cursor.dir/vnd.theb.host" />
</intent-filter>
</activity>
- <activity class="SecureShell" android:label="@string/title_shell">
+ <activity android:name="SecureShell" android:label="@string/title_shell">
<!-- This filter says that we can connect to a host -->
<intent-filter android:label="@string/resolve_connect">
- <action android:value="org.theb.ssh.action.CONNECT_HOST" />
- <action android:value="android.intent.action.PICK" />
+ <action android:name="org.theb.ssh.action.CONNECT_HOST" />
+ <action android:name="android.intent.action.PICK" />
<!-- DEFAULT: execute if being directly invoked. -->
- <category android:value="android.intent.category.DEFAULT" />
+ <category android:name="android.intent.category.DEFAULT" />
<type android:value="vnd.android.cursor.item/vnd.theb.host" />
</intent-filter>
</activity>
- <activity class="PasswordDialog" android:label="@string/title_password"
+ <activity android:name="PasswordDialog" android:label="@string/title_password"
android:theme="@android:style/Theme.Dialog">
</activity>
- <activity class="TouchEntropy" android:label="@string/title_entropy"
+ <activity android:name="TouchEntropy" android:label="@string/title_entropy"
android:theme="@android:style/Theme.Dialog">
</activity>
- <activity class="Pubkey" android:label="@string/title_pubkey"
+ <activity android:name="Pubkey" android:label="@string/title_pubkey"
android:theme="@android:style/Theme.Dialog">
</activity>
</application>
diff --git a/res/layout/about_dialog.xml b/res/layout/about_dialog.xml
index 9a515fc..9ef62bc 100644
--- a/res/layout/about_dialog.xml
+++ b/res/layout/about_dialog.xml
@@ -5,7 +5,7 @@
android:layout_height="64px"
android:theme="@android:style/Theme.Dialog">
- <ImageView id="@+id/icon"
+ <ImageView android:id="@+id/icon"
android:layout_width="75px"
android:layout_height="wrap_content"
android:layout_weight="1"
@@ -13,7 +13,7 @@
android:minWidth="64px"
android:src="@drawable/icon"/>
- <TextView id="@+id/copyright"
+ <TextView android:id="@+id/copyright"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dip"
diff --git a/res/layout/host_editor.xml b/res/layout/host_editor.xml
index 98cd048..c25f98f 100644
--- a/res/layout/host_editor.xml
+++ b/res/layout/host_editor.xml
@@ -3,40 +3,40 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content">
- <TextView id="@+id/usernameLabel"
+ <TextView android:id="@+id/usernameLabel"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Username:"/>
- <EditText id="@+id/username"
+ <EditText android:id="@+id/username"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/usernameLabel"/>
- <TextView id="@+id/hostnameLabel"
+ <TextView android:id="@+id/hostnameLabel"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/username"
android:text="Hostname:"/>
- <EditText id="@+id/hostname"
+ <EditText android:id="@+id/hostname"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/hostnameLabel"/>
- <TextView id="@+id/portLabel"
+ <TextView android:id="@+id/portLabel"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/hostname"
android:text="Port:"/>
- <EditText id="@+id/port"
+ <EditText android:id="@+id/port"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="22"
android:layout_below="@id/portLabel"/>
- <Button id="@+id/add"
+ <Button android:id="@+id/add"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/port"
@@ -44,7 +44,7 @@
android:layout_marginLeft="10dip"
android:text="@string/button_add" />
- <Button id="@+id/cancel"
+ <Button android:id="@+id/cancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeft="@id/add"
diff --git a/res/layout/main.xml b/res/layout/main.xml
index 37bd27a..ec1ce98 100644
--- a/res/layout/main.xml
+++ b/res/layout/main.xml
@@ -4,7 +4,7 @@
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
-<TextView id="@+id/shell"
+<TextView android:id="@+id/shell"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Hello World, SSH"
diff --git a/res/layout/message_dialog.xml b/res/layout/message_dialog.xml
index 8720d92..4ed850a 100644
--- a/res/layout/message_dialog.xml
+++ b/res/layout/message_dialog.xml
@@ -3,11 +3,11 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content">
- <TextView id="@+id/message"
+ <TextView android:id="@+id/message"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
- <Button id="@+id/dismiss"
+ <Button android:id="@+id/dismiss"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/message"
diff --git a/res/layout/password_dialog.xml b/res/layout/password_dialog.xml
index df42486..ab67979 100644
--- a/res/layout/password_dialog.xml
+++ b/res/layout/password_dialog.xml
@@ -4,19 +4,19 @@
android:layout_height="wrap_content"
android:theme="@android:style/Theme.Dialog">
- <TextView id="@+id/passwordLabel"
+ <TextView android:id="@+id/passwordLabel"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Password:"/>
- <EditText id="@+id/password"
+ <EditText android:id="@+id/password"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/passwordLabel"
android:maxLines="1"
android:password="true"/>
- <Button id="@+id/ok"
+ <Button android:id="@+id/ok"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/password"
diff --git a/res/layout/pubkey.xml b/res/layout/pubkey.xml
index d22fc5c..f031e3c 100644
--- a/res/layout/pubkey.xml
+++ b/res/layout/pubkey.xml
@@ -3,20 +3,20 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content">
- <Button id="@+id/generate"
+ <Button android:id="@+id/generate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="10dip"
android:text="@string/button_generate" />
- <TextView id="@+id/keyName"
+ <TextView android:id="@+id/keyName"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/generate"
android:text="Username:"/>
- <Button id="@+id/ok"
+ <Button android:id="@+id/ok"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/keyName"
@@ -24,7 +24,7 @@
android:layout_marginLeft="10dip"
android:text="@string/button_ok" />
- <Button id="@+id/cancel"
+ <Button android:id="@+id/cancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeft="@id/ok"
diff --git a/res/layout/secure_shell.xml b/res/layout/secure_shell.xml
index 9af5081..471b4ed 100644
--- a/res/layout/secure_shell.xml
+++ b/res/layout/secure_shell.xml
@@ -3,13 +3,13 @@
android:layout_width="fill_parent"
android:layout_height="fill_parent">
- <org.theb.ssh.TerminalView id="@+id/terminal"
+ <org.theb.ssh.TerminalView android:id="@+id/terminal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:textSize="8sp"
android:typeface="monospace" />
<!--
- <TextView id="@+id/output"
+ <TextView android:id="@+id/output"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:textSize="8sp"
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 66a3b50..6c11b04 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -27,6 +27,8 @@
<string name="button_change">Change</string>
<string name="button_generate">Generate Key</string>
+ <string name="alert_disconnect_msg">Connection Lost</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/provider/HostDb.java b/src/org/theb/provider/HostDb.java
index e38396c..9939893 100644
--- a/src/org/theb/provider/HostDb.java
+++ b/src/org/theb/provider/HostDb.java
@@ -18,13 +18,13 @@
*/
package org.theb.provider;
-import android.net.ContentURI;
+import android.net.Uri;
import android.provider.BaseColumns;
public final class HostDb {
public static final class Hosts implements BaseColumns {
- public static final ContentURI CONTENT_URI
- = ContentURI.create("content://org.theb.provider.HostDb/hosts");
+ public static final Uri CONTENT_URI
+ = Uri.parse("content://org.theb.provider.HostDb/hosts");
public static final String DEFAULT_SORT_ORDER = "hostname DESC";
diff --git a/src/org/theb/ssh/HostDbProvider.java b/src/org/theb/ssh/HostDbProvider.java
index f0eac73..c51a356 100644
--- a/src/org/theb/ssh/HostDbProvider.java
+++ b/src/org/theb/ssh/HostDbProvider.java
@@ -23,14 +23,15 @@ import java.util.HashMap;
import org.theb.provider.HostDb;
import android.content.ContentProvider;
-import android.content.ContentProviderDatabaseHelper;
-import android.content.ContentURIParser;
+import android.content.ContentUris;
import android.content.ContentValues;
-import android.content.QueryBuilder;
+import android.content.UriMatcher;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
-import android.net.ContentURI;
+import android.database.sqlite.SQLiteOpenHelper;
+import android.database.sqlite.SQLiteQueryBuilder;
+import android.net.Uri;
import android.text.TextUtils;
import android.util.Log;
@@ -47,9 +48,9 @@ public class HostDbProvider extends ContentProvider {
private static final int HOSTS = 1;
private static final int HOST_ID = 2;
- private static final ContentURIParser URL_MATCHER;
+ private static final UriMatcher URL_MATCHER;
- private static class DatabaseHelper extends ContentProviderDatabaseHelper {
+ private static class DatabaseHelper extends SQLiteOpenHelper {
@Override
public void onCreate(SQLiteDatabase db) {
@@ -69,7 +70,7 @@ public class HostDbProvider extends ContentProvider {
}
@Override
- public int delete(ContentURI uri, String where, String[] whereArgs) {
+ public int delete(Uri uri, String where, String[] whereArgs) {
int count;
switch (URL_MATCHER.match(uri)) {
case HOSTS:
@@ -77,7 +78,7 @@ public class HostDbProvider extends ContentProvider {
break;
case HOST_ID:
- String segment = uri.getPathSegment(1);
+ String segment = uri.getPathSegments().get(1);
count = mDB.delete("hosts", "_id="
+ segment
+ (!TextUtils.isEmpty(where) ? " AND (" + where
@@ -93,7 +94,7 @@ public class HostDbProvider extends ContentProvider {
}
@Override
- public String getType(ContentURI uri) {
+ public String getType(Uri uri) {
switch (URL_MATCHER.match(uri)) {
case HOSTS:
return "vnd.android.cursor.dir/vnd.theb.host";
@@ -105,7 +106,7 @@ public class HostDbProvider extends ContentProvider {
}
@Override
- public ContentURI insert(ContentURI uri, ContentValues initialValues) {
+ public Uri insert(Uri uri, ContentValues initialValues) {
long rowID;
ContentValues values;
@@ -137,7 +138,7 @@ public class HostDbProvider extends ContentProvider {
rowID = mDB.insert("hosts", "host", values);
if (rowID > 0) {
- ContentURI newUri = HostDb.Hosts.CONTENT_URI.addId(rowID);
+ Uri newUri = ContentUris.withAppendedId(HostDb.Hosts.CONTENT_URI, rowID);
getContext().getContentResolver().notifyChange(newUri, null);
return newUri;
}
@@ -153,10 +154,9 @@ public class HostDbProvider extends ContentProvider {
}
@Override
- public Cursor query(ContentURI uri, String[] projection, String selection,
- String[] selectionArgs, String groupBy, String having,
- String sortOrder) {
- QueryBuilder qb = new QueryBuilder();
+ public Cursor query(Uri uri, String[] projection, String selection,
+ String[] selectionArgs, String sortOrder) {
+ SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
switch (URL_MATCHER.match(uri)) {
case HOSTS:
@@ -166,7 +166,7 @@ public class HostDbProvider extends ContentProvider {
case HOST_ID:
qb.setTables("hosts");
- qb.appendWhere("_id=" + uri.getPathSegment(1));
+ qb.appendWhere("_id=" + uri.getPathSegments().get(1));
break;
default:
@@ -180,14 +180,14 @@ public class HostDbProvider extends ContentProvider {
orderBy = sortOrder;
}
- Cursor c = qb.query(mDB, projection, selection, selectionArgs, groupBy,
- having, orderBy);
+ Cursor c = qb.query(mDB, projection, selection, selectionArgs, null,
+ null, orderBy);
c.setNotificationUri(getContext().getContentResolver(), uri);
return c;
}
@Override
- public int update(ContentURI uri, ContentValues values, String where,
+ public int update(Uri uri, ContentValues values, String where,
String[] whereArgs) {
int count;
@@ -197,7 +197,7 @@ public class HostDbProvider extends ContentProvider {
break;
case HOST_ID:
- String segment = uri.getPathSegment(1);
+ String segment = uri.getPathSegments().get(1);
count = mDB
.update("hosts", values, "_id="
+ segment
@@ -215,7 +215,7 @@ public class HostDbProvider extends ContentProvider {
}
static {
- URL_MATCHER = new ContentURIParser(ContentURIParser.NO_MATCH);
+ URL_MATCHER = new UriMatcher(UriMatcher.NO_MATCH);
URL_MATCHER.addURI("org.theb.provider.HostDb", "hosts", HOSTS);
URL_MATCHER.addURI("org.theb.provider.HostDb", "hosts/#", HOST_ID);
diff --git a/src/org/theb/ssh/HostEditor.java b/src/org/theb/ssh/HostEditor.java
index 967cf5b..a8a6de7 100644
--- a/src/org/theb/ssh/HostEditor.java
+++ b/src/org/theb/ssh/HostEditor.java
@@ -23,7 +23,7 @@ import org.theb.provider.HostDb;
import android.app.Activity;
import android.content.Intent;
import android.database.Cursor;
-import android.net.ContentURI;
+import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
@@ -59,15 +59,16 @@ public class HostEditor extends Activity {
private Cursor mCursor;
private int mState;
- private ContentURI mURI;
+ private Uri mURI;
@Override
public void onCreate(Bundle savedValues) {
super.onCreate(savedValues);
+ // TODO: update or remove
// Have the system blur any windows behind this one.
- getWindow().setFlags(WindowManager.LayoutParams.BLUR_BEHIND_FLAG,
- WindowManager.LayoutParams.BLUR_BEHIND_FLAG);
+ //getWindow().setFlags(WindowManager.LayoutParams.BLUR_BEHIND_FLAG,
+ // WindowManager.LayoutParams.BLUR_BEHIND_FLAG);
// Apply a tint to any windows behind this one. Doing a tint this
// way is more efficient than using a translucent background. Note
diff --git a/src/org/theb/ssh/HostsList.java b/src/org/theb/ssh/HostsList.java
index 2634eba..6f30f45 100644
--- a/src/org/theb/ssh/HostsList.java
+++ b/src/org/theb/ssh/HostsList.java
@@ -23,13 +23,13 @@ import org.theb.provider.HostDb;
import android.app.Dialog;
import android.app.ListActivity;
import android.content.ComponentName;
+import android.content.ContentUris;
import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
import android.graphics.drawable.Drawable;
-import android.net.ContentURI;
+import android.net.Uri;
import android.os.Bundle;
-import android.view.KeyEvent;
import android.view.Menu;
import android.view.SubMenu;
import android.view.View;
@@ -144,13 +144,13 @@ public class HostsList extends ListActivity {
// This is our one standard application action -- inserting a
// new host into the list.
- menu.add(0, INSERT_ID, R.string.menu_insert).setShortcut(
- KeyEvent.KEYCODE_3, 0, KeyEvent.KEYCODE_A);
+ menu.add(0, INSERT_ID, R.string.menu_insert)
+ .setShortcut('3', 'a');
// The preferences link allows users to e.g. set the pubkey
SubMenu prefs = menu.addSubMenu(0, 0, R.string.menu_preferences);
- prefs.add(0, PUBKEY_ID, R.string.menu_pubkey).setShortcut(
- KeyEvent.KEYCODE_4, 0, KeyEvent.KEYCODE_P);
+ prefs.add(0, PUBKEY_ID, R.string.menu_pubkey)
+ .setShortcut('4', 'p');
// This links to the about dialog for the program.
menu.add(0, ABOUT_ID, R.string.menu_about);
@@ -180,7 +180,7 @@ public class HostsList extends ListActivity {
// found.
if (haveItems) {
// This is the selected item.
- ContentURI uri = getIntent().getData().addId(getSelectionRowID());
+ Uri uri = ContentUris.withAppendedId(getIntent().getData(), getSelectedItemId());
// Build menu... always starts with the PICK action...
Intent[] specifics = new Intent[1];
@@ -191,17 +191,15 @@ public class HostsList extends ListActivity {
Intent intent = new Intent(null, uri);
intent.addCategory(Intent.SELECTED_ALTERNATIVE_CATEGORY);
menu.addIntentOptions(Menu.SELECTED_ALTERNATIVE, 0, null, specifics,
- intent, Menu.NO_SEPARATOR_AFTER, items);
+ intent, 0, items);
// ... and ends with the delete command.
menu.add(Menu.SELECTED_ALTERNATIVE, DELETE_ID, R.string.menu_delete)
-.
- setShortcut(KeyEvent.KEYCODE_2, 0, KeyEvent.KEYCODE_D);
- menu.addSeparator(Menu.SELECTED_ALTERNATIVE, 0);
+ .setShortcut('2', 'd');
// Give a shortcut to the connect action.
if (items[0] != null) {
- items[0].setShortcut(KeyEvent.KEYCODE_1, 0, KeyEvent.KEYCODE_C);
+ items[0].setShortcut('1', 'c');
}
} else {
menu.removeGroup(Menu.SELECTED_ALTERNATIVE);
@@ -243,9 +241,10 @@ public class HostsList extends ListActivity {
+ " "
+ getResources().getString(R.string.msg_version));
+ // TODO: update or remove
// Everything looks cooler when you blur the window behind it.
- about.getWindow().setFlags(WindowManager.LayoutParams.BLUR_BEHIND_FLAG,
- WindowManager.LayoutParams.BLUR_BEHIND_FLAG);
+ //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);
@@ -255,7 +254,7 @@ public class HostsList extends ListActivity {
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
- ContentURI url = getIntent().getData().addId(getSelectionRowID());
+ Uri url = ContentUris.withAppendedId(getIntent().getData(), getSelectedItemId());
String action = getIntent().getAction();
if (Intent.PICK_ACTION.equals(action)
@@ -270,7 +269,7 @@ public class HostsList extends ListActivity {
}
private final void deleteItem() {
- mCursor.moveTo(getSelection());
+ mCursor.moveTo(getSelectedItemPosition());
mCursor.deleteRow();
}
diff --git a/src/org/theb/ssh/Pubkey.java b/src/org/theb/ssh/Pubkey.java
index cf3bd0d..4cfaa9c 100644
--- a/src/org/theb/ssh/Pubkey.java
+++ b/src/org/theb/ssh/Pubkey.java
@@ -20,7 +20,6 @@ package org.theb.ssh;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
-import java.security.KeyStore;
import java.security.PrivateKey;
import java.security.PublicKey;
import java.security.SecureRandom;
diff --git a/src/org/theb/ssh/SecureShell.java b/src/org/theb/ssh/SecureShell.java
index 8d4dda6..9269bac 100644
--- a/src/org/theb/ssh/SecureShell.java
+++ b/src/org/theb/ssh/SecureShell.java
@@ -216,9 +216,13 @@ public class SecureShell extends Activity implements FeedbackUI, ConnectionMonit
if (SecureShell.this.isFinishing())
return;
- AlertDialog d = AlertDialog.show(SecureShell.this,
- "Connection Lost", mDisconnectReason, "Ok", false);
- d.show();
+// AlertDialog d = AlertDialog.show(SecureShell.this,
+// "Connection Lost", mDisconnectReason, "Ok", false);
+ new AlertDialog.Builder(SecureShell.this)
+ .setIcon(R.drawable.icon)
+ .setTitle(R.string.alert_disconnect_msg)
+ .setPositiveButton(R.string.button_ok, null)
+ .show();
// TODO: Return to previous activity if connection fails.
}
};
diff --git a/src/org/theb/ssh/TouchEntropy.java b/src/org/theb/ssh/TouchEntropy.java
index 33ad499..023e531 100644
--- a/src/org/theb/ssh/TouchEntropy.java
+++ b/src/org/theb/ssh/TouchEntropy.java
@@ -52,7 +52,7 @@ public class TouchEntropy extends Activity {
}
@Override
- public boolean onMotionEvent(MotionEvent event) {
+ public boolean onTouchEvent(MotionEvent event) {
// Only get entropy every 200 milliseconds to ensure the user has moved around.
long now = System.currentTimeMillis();
if ((now - mLastTime) < 200)