aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThialfihar <thialfihar@gmail.com>2010-08-17 23:05:41 +0000
committerThialfihar <thialfihar@gmail.com>2010-08-17 23:05:41 +0000
commitc57c36b3a53f92ece7df2c6c1f1e0316a2c92bb9 (patch)
treeeed9bd3722373e2a128b18fcdca02123d86b3fd2
parentfc0ae774cd8bff8d63003efb2930f0320175ae09 (diff)
downloadopen-keychain-c57c36b3a53f92ece7df2c6c1f1e0316a2c92bb9.tar.gz
open-keychain-c57c36b3a53f92ece7df2c6c1f1e0316a2c92bb9.tar.bz2
open-keychain-c57c36b3a53f92ece7df2c6c1f1e0316a2c92bb9.zip
use the key server preference to fill a Spinner in the key server query activity, allowing to query each server, also moved some previously static labels into strings.xml
Update issue 9 Key server preferences are now used in key server query activity.
-rw-r--r--res/layout/create_key.xml4
-rw-r--r--res/layout/edit_key_key_item.xml10
-rw-r--r--res/layout/edit_key_user_id_item.xml8
-rw-r--r--res/layout/key_server_query_layout.xml5
-rw-r--r--res/values/strings.xml10
-rw-r--r--src/org/thialfihar/android/apg/KeyServerQueryActivity.java27
-rw-r--r--src/org/thialfihar/android/apg/ui/widget/KeyServerEditor.java18
7 files changed, 52 insertions, 30 deletions
diff --git a/res/layout/create_key.xml b/res/layout/create_key.xml
index ab327ffeb..d8ccc73ec 100644
--- a/res/layout/create_key.xml
+++ b/res/layout/create_key.xml
@@ -29,7 +29,7 @@
<TableRow>
<TextView android:id="@+id/label_algorithm"
- android:text="Algorithm"
+ android:text="@string/label_algorithm"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_gravity="center_vertical"
@@ -45,7 +45,7 @@
<TableRow>
<TextView android:id="@+id/label_size"
- android:text="Key Size"
+ android:text="@string/label_keySize"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_gravity="center_vertical"
diff --git a/res/layout/edit_key_key_item.xml b/res/layout/edit_key_key_item.xml
index ba428938e..2db805d09 100644
--- a/res/layout/edit_key_key_item.xml
+++ b/res/layout/edit_key_key_item.xml
@@ -43,7 +43,7 @@
<TextView
android:id="@+id/label_keyId"
- android:text="Key ID"
+ android:text="@string/label_keyId"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_gravity="center_vertical"
@@ -63,7 +63,7 @@
<TextView
android:id="@+id/label_algorithm"
- android:text="Algorithm"
+ android:text="@string/label_algorithm"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_gravity="center_vertical"
@@ -82,7 +82,7 @@
<TextView
android:id="@+id/label_creation"
- android:text="Creation"
+ android:text="@string/label_creation"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_gravity="center_vertical"
@@ -99,7 +99,7 @@
<TextView
android:id="@+id/label_expiry"
- android:text="Expiry"
+ android:text="@string/label_expiry"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_gravity="center_vertical"
@@ -116,7 +116,7 @@
<TextView
android:id="@+id/label_usage"
- android:text="Usage"
+ android:text="@string/label_usage"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_gravity="center_vertical"
diff --git a/res/layout/edit_key_user_id_item.xml b/res/layout/edit_key_user_id_item.xml
index 2dc383a01..d5c7c0fa5 100644
--- a/res/layout/edit_key_user_id_item.xml
+++ b/res/layout/edit_key_user_id_item.xml
@@ -29,7 +29,7 @@
<RadioButton
android:id="@+id/isMainUserId"
- android:text="Main User ID"
+ android:text="@string/label_mainUserId"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_marginLeft="20dip"/>
@@ -49,7 +49,7 @@
<TextView
android:id="@+id/label_name"
- android:text="Name"
+ android:text="@string/label_name"
android:layout_gravity="center_vertical"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
@@ -68,7 +68,7 @@
<TextView
android:id="@+id/label_email"
- android:text="Email"
+ android:text="@string/label_email"
android:layout_gravity="center_vertical"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
@@ -87,7 +87,7 @@
<TextView
android:id="@+id/label_comment"
- android:text="Comment"
+ android:text="@string/label_comment"
android:layout_gravity="center_vertical"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
diff --git a/res/layout/key_server_query_layout.xml b/res/layout/key_server_query_layout.xml
index 167d02fef..6af4f3644 100644
--- a/res/layout/key_server_query_layout.xml
+++ b/res/layout/key_server_query_layout.xml
@@ -20,6 +20,11 @@
android:layout_height="fill_parent"
android:orientation="vertical">
+ <Spinner
+ android:id="@+id/keyServer"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"/>
+
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
diff --git a/res/values/strings.xml b/res/values/strings.xml
index dabade473..2ca8d949b 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -113,6 +113,15 @@
<string name="label_language">Language</string>
<string name="label_forceV3Signature">Force V3 Signatures</string>
<string name="label_keyServers">Key Servers</string>
+ <string name="label_keyId">Key ID</string>
+ <string name="label_creation">Creation</string>
+ <string name="label_expiry">Expiry</string>
+ <string name="label_usage">Usage</string>
+ <string name="label_keySize">Key Size</string>
+ <string name="label_mainUserId">Main User ID</string>
+ <string name="label_name">Name</string>
+ <string name="label_comment">Comment</string>
+ <string name="label_email">Email</string>
<string name="noKeysSelected">Select</string>
<string name="oneKeySelected">1 Selected</string>
@@ -263,6 +272,7 @@
<string name="progress_verifyingIntegrity">verifying integrity...</string>
<string name="progress_deletingSecurely">deleting \'%s\' securely...</string>
<string name="progress_querying">querying...</string>
+ <string name="progress_queryingServer">querying %s...</string>
<!-- permission strings -->
<string name="permission_read_key_details_label">Read key details from APG.</string>
diff --git a/src/org/thialfihar/android/apg/KeyServerQueryActivity.java b/src/org/thialfihar/android/apg/KeyServerQueryActivity.java
index 1d3a476e1..b1cab67ed 100644
--- a/src/org/thialfihar/android/apg/KeyServerQueryActivity.java
+++ b/src/org/thialfihar/android/apg/KeyServerQueryActivity.java
@@ -9,6 +9,8 @@ import org.thialfihar.android.apg.KeyServer.QueryException;
import org.thialfihar.android.apg.KeyServer.TooManyResponses;
import android.app.Activity;
+import android.app.Dialog;
+import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
@@ -19,12 +21,14 @@ import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
+import android.widget.ArrayAdapter;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
import android.widget.ListView;
+import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
@@ -33,6 +37,7 @@ public class KeyServerQueryActivity extends BaseActivity {
private EditText mQuery;
private Button mSearch;
private KeyInfoListAdapter mAdapter;
+ private Spinner mKeyServer;
private int mQueryType;
private String mQueryString;
@@ -52,6 +57,19 @@ public class KeyServerQueryActivity extends BaseActivity {
mAdapter = new KeyInfoListAdapter(this);
mList.setAdapter(mAdapter);
+ mKeyServer = (Spinner) findViewById(R.id.keyServer);
+ ArrayAdapter<String> adapter =
+ new ArrayAdapter<String>(this,
+ android.R.layout.simple_spinner_item,
+ mPreferences.getKeyServers());
+ adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
+ mKeyServer.setAdapter(adapter);
+ if (adapter.getCount() > 0) {
+ mKeyServer.setSelection(0);
+ } else {
+ mSearch.setEnabled(false);
+ }
+
mList.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapter, View view, int position, long keyId) {
@@ -83,6 +101,13 @@ public class KeyServerQueryActivity extends BaseActivity {
startThread();
}
+ protected Dialog onCreateDialog(int id) {
+ ProgressDialog progress = (ProgressDialog) super.onCreateDialog(id);
+ progress.setMessage(this.getString(R.string.progress_queryingServer,
+ (String)mKeyServer.getSelectedItem()));
+ return progress;
+ }
+
@Override
public void run() {
String error = null;
@@ -90,7 +115,7 @@ public class KeyServerQueryActivity extends BaseActivity {
Message msg = new Message();
try {
- HkpKeyServer server = new HkpKeyServer("pool.sks-keyservers.net");
+ HkpKeyServer server = new HkpKeyServer((String)mKeyServer.getSelectedItem());
if (mQueryType == Id.query.search) {
mSearchResult = server.search(mQueryString);
} else if (mQueryType == Id.query.get) {
diff --git a/src/org/thialfihar/android/apg/ui/widget/KeyServerEditor.java b/src/org/thialfihar/android/apg/ui/widget/KeyServerEditor.java
index b58fc6036..4e1fed398 100644
--- a/src/org/thialfihar/android/apg/ui/widget/KeyServerEditor.java
+++ b/src/org/thialfihar/android/apg/ui/widget/KeyServerEditor.java
@@ -16,33 +16,15 @@
package org.thialfihar.android.apg.ui.widget;
-import java.text.DateFormat;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.GregorianCalendar;
-import java.util.Vector;
-
-import org.bouncycastle2.openpgp.PGPPublicKey;
-import org.bouncycastle2.openpgp.PGPSecretKey;
-import org.thialfihar.android.apg.Apg;
-import org.thialfihar.android.apg.Id;
import org.thialfihar.android.apg.R;
-import org.thialfihar.android.apg.utils.Choice;
-import android.app.DatePickerDialog;
-import android.app.Dialog;
import android.content.Context;
-import android.content.DialogInterface;
import android.util.AttributeSet;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
-import android.widget.ArrayAdapter;
-import android.widget.Button;
-import android.widget.DatePicker;
import android.widget.ImageButton;
import android.widget.LinearLayout;
-import android.widget.Spinner;
import android.widget.TextView;
public class KeyServerEditor extends LinearLayout implements Editor, OnClickListener {