aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenny Root <kenny@the-b.org>2008-10-30 20:15:42 +0000
committerKenny Root <kenny@the-b.org>2008-10-30 20:15:42 +0000
commitd13d568d1effb0e9913b1bc8ec4b6d7e4cc0e02d (patch)
tree77525c175c64bebe114582f7656bcbb4552f71e6
parentf3cdd0eb4229905378b5b5a1a2dd78b27d387862 (diff)
downloadconnectbot-d13d568d1effb0e9913b1bc8ec4b6d7e4cc0e02d.tar.gz
connectbot-d13d568d1effb0e9913b1bc8ec4b6d7e4cc0e02d.tar.bz2
connectbot-d13d568d1effb0e9913b1bc8ec4b6d7e4cc0e02d.zip
* Add icons for PubkeyListActivity and an empty-list hint TextView
* Make sure setMargins in terminal emulation can't be fooled * Don't force ConsoleActivity to run in landscape orientation
-rw-r--r--AndroidManifest.xml2
-rw-r--r--res/drawable/pubkey_locked.pngbin0 -> 1487 bytes
-rw-r--r--res/drawable/pubkey_unlocked.pngbin0 -> 1743 bytes
-rw-r--r--res/layout/act_pubkeylist.xml9
-rw-r--r--res/layout/item_pubkey.xml37
-rw-r--r--res/values/strings.xml2
-rw-r--r--src/de/mud/terminal/VDUBuffer.java10
-rw-r--r--src/org/connectbot/GeneratePubkeyActivity.java12
-rw-r--r--src/org/connectbot/PubkeyListActivity.java23
9 files changed, 61 insertions, 34 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index a4d0a97..acf6e87 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -28,7 +28,7 @@
<service android:name="org.connectbot.service.TerminalManager" android:configChanges="keyboardHidden|orientation" />
- <activity android:name=".ConsoleActivity" android:screenOrientation="landscape" android:configChanges="keyboardHidden|orientation">
+ <activity android:name=".ConsoleActivity" android:configChanges="keyboardHidden|orientation">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
diff --git a/res/drawable/pubkey_locked.png b/res/drawable/pubkey_locked.png
new file mode 100644
index 0000000..7df56b5
--- /dev/null
+++ b/res/drawable/pubkey_locked.png
Binary files differ
diff --git a/res/drawable/pubkey_unlocked.png b/res/drawable/pubkey_unlocked.png
new file mode 100644
index 0000000..eec4558
--- /dev/null
+++ b/res/drawable/pubkey_unlocked.png
Binary files differ
diff --git a/res/layout/act_pubkeylist.xml b/res/layout/act_pubkeylist.xml
index d219047..1467086 100644
--- a/res/layout/act_pubkeylist.xml
+++ b/res/layout/act_pubkeylist.xml
@@ -28,5 +28,12 @@
android:layout_height="0dip"
android:layout_weight="1"
/>
-
+
+ <TextView android:id="@android:id/empty"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:text="@string/pubkey_list_empty"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:gravity="center"
+ />
</LinearLayout>
diff --git a/res/layout/item_pubkey.xml b/res/layout/item_pubkey.xml
index 9ef468a..7678982 100644
--- a/res/layout/item_pubkey.xml
+++ b/res/layout/item_pubkey.xml
@@ -20,22 +20,39 @@
android:id="@android:id/content"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
- android:orientation="vertical"
android:padding="10dip"
- >
-
- <TextView
- android:id="@android:id/text1"
+ android:orientation="horizontal">
+
+ <LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:textAppearance="?android:attr/textAppearanceLarge"
- />
+ android:orientation="vertical"
+ android:layout_weight="1"
+ android:gravity="left|center_vertical">
- <TextView
- android:id="@android:id/text2"
+ <TextView
+ android:id="@android:id/text1"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textAppearance="?android:attr/textAppearanceLarge"
+ android:text="Key Example"
+ />
+
+ <TextView
+ android:id="@android:id/text2"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ android:text="DSA 1024-bit"
+ />
+ </LinearLayout>
+
+ <ImageView
+ android:id="@android:id/icon1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:textAppearance="?android:attr/textAppearanceSmall"
+ android:src="@drawable/pubkey_locked"
+ android:layout_gravity="right"
/>
</LinearLayout> \ No newline at end of file
diff --git a/res/values/strings.xml b/res/values/strings.xml
index cce57c0..5ae2a35 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -27,6 +27,8 @@
<string name="pubkey_touch_prompt">Touch this box to gather randomness: </string>
<string name="pubkey_generating">Generating key...</string>
<string name="pubkey_copy_clipboard">Copy to clipboard for OpenSSH</string>
+ <string name="pubkey_list_empty">Press "Menu" to create public keys.</string>
+ <string name="pubkey_unknown_format">Unknown format</string>
<string name="button_ok">Ok</string>
<string name="button_add">Add</string>
diff --git a/src/de/mud/terminal/VDUBuffer.java b/src/de/mud/terminal/VDUBuffer.java
index cb77ad6..35dbb49 100644
--- a/src/de/mud/terminal/VDUBuffer.java
+++ b/src/de/mud/terminal/VDUBuffer.java
@@ -615,17 +615,13 @@ public class VDUBuffer {
}
/**
- * Set the scroll margins simultaneously. If they're backwards, swap them.
- * If they're out of bounds, trim them.
+ * Set the scroll margins simultaneously. If they're out of bounds, trim them.
* @param l1 line that is the top
* @param l2 line that is the bottom
*/
public void setMargins(int l1, int l2) {
- if (l1 > l2) {
- int temp = l2;
- l2 = l1;
- l1 = temp;
- }
+ if (l1 > l2)
+ return;
if (l1 < 0)
l1 = 0;
diff --git a/src/org/connectbot/GeneratePubkeyActivity.java b/src/org/connectbot/GeneratePubkeyActivity.java
index d33ffb3..690c6ec 100644
--- a/src/org/connectbot/GeneratePubkeyActivity.java
+++ b/src/org/connectbot/GeneratePubkeyActivity.java
@@ -18,20 +18,16 @@
package org.connectbot;
-import java.security.Key;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.PrivateKey;
import java.security.PublicKey;
import java.security.SecureRandom;
-import javax.crypto.Cipher;
-import javax.crypto.spec.SecretKeySpec;
-
import org.connectbot.util.EntropyDialog;
import org.connectbot.util.EntropyView;
-import org.connectbot.util.PubkeyDatabase;
import org.connectbot.util.OnEntropyGatheredListener;
+import org.connectbot.util.PubkeyDatabase;
import org.connectbot.util.PubkeyUtils;
import android.app.Activity;
@@ -166,10 +162,16 @@ public class GeneratePubkeyActivity extends Activity implements OnEntropyGathere
if (!hasFocus) {
try {
bits = Integer.parseInt(bitsText.getText().toString());
+ if (bits < minBits) {
+ bits = minBits;
+ bitsText.setText(String.valueOf(bits));
+ }
} catch (NumberFormatException nfe) {
bits = DEFAULT_BITS;
bitsText.setText(String.valueOf(bits));
}
+
+ bitsSlider.setProgress(bits - minBits);
}
}
});
diff --git a/src/org/connectbot/PubkeyListActivity.java b/src/org/connectbot/PubkeyListActivity.java
index a8b2bed..c05d024 100644
--- a/src/org/connectbot/PubkeyListActivity.java
+++ b/src/org/connectbot/PubkeyListActivity.java
@@ -18,16 +18,9 @@
package org.connectbot;
-import java.security.KeyFactory;
-import java.security.NoSuchAlgorithmException;
import java.security.PublicKey;
-import java.security.interfaces.RSAPublicKey;
-import java.security.spec.EncodedKeySpec;
-import java.security.spec.InvalidKeySpecException;
-import java.security.spec.X509EncodedKeySpec;
import java.util.EventListener;
-import org.connectbot.util.EntropyView;
import org.connectbot.util.PubkeyDatabase;
import org.connectbot.util.PubkeyUtils;
@@ -51,6 +44,7 @@ import android.view.ViewGroup;
import android.view.MenuItem.OnMenuItemClickListener;
import android.widget.AdapterView;
import android.widget.CursorAdapter;
+import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;
@@ -71,8 +65,6 @@ public class PubkeyListActivity extends ListActivity implements EventListener {
if(this.pubkeydb == null)
this.pubkeydb = new PubkeyDatabase(this);
-
- this.updateCursor();
ListView list = this.getListView();
this.registerForContextMenu(list);
@@ -99,6 +91,7 @@ public class PubkeyListActivity extends ListActivity implements EventListener {
this.clipboard = (ClipboardManager)this.getSystemService(CLIPBOARD_SERVICE);
}
+
@Override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
@@ -173,9 +166,14 @@ public class PubkeyListActivity extends ListActivity implements EventListener {
};
protected void updateCursor() {
- this.pubkeys = this.pubkeydb.allPubkeys();
+ if (this.pubkeys != null) {
+ pubkeys.requery();
+ return;
+ }
+ this.pubkeys = this.pubkeydb.allPubkeys();
this.setListAdapter(new PubkeyCursorAdapter(this, this.pubkeys));
+ this.startManagingCursor(pubkeys);
}
class PubkeyCursorAdapter extends CursorAdapter {
@@ -199,6 +197,7 @@ public class PubkeyListActivity extends ListActivity implements EventListener {
public void bindView(View view, Context context, Cursor cursor) {
TextView text1 = (TextView) view.findViewById(android.R.id.text1);
TextView text2 = (TextView) view.findViewById(android.R.id.text2);
+ ImageView icon1 = (ImageView) view.findViewById(android.R.id.icon1);
text1.setText(cursor.getString(mNickname));
@@ -211,8 +210,12 @@ public class PubkeyListActivity extends ListActivity implements EventListener {
} catch (Exception e) {
e.printStackTrace();
+ text2.setText(R.string.pubkey_unknown_format);
Log.e(TAG, "Error decoding public key at " + cursor.toString());
}
+
+ if (encrypted == 0)
+ icon1.setImageResource(R.drawable.pubkey_unlocked);
}
@Override