aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain
diff options
context:
space:
mode:
authorDominik Schürmann <dominik@dominikschuermann.de>2014-05-07 14:17:18 +0200
committerDominik Schürmann <dominik@dominikschuermann.de>2014-05-07 14:17:18 +0200
commitf4cbd8cabbe9dcd01e430a4f9953f061092cdfe6 (patch)
treea044e4020d03f8efb7ab368e029d794f3fa0d473 /OpenKeychain
parent7c2dc276c1bf01437db977026334ed17d2c1e65d (diff)
downloadopen-keychain-f4cbd8cabbe9dcd01e430a4f9953f061092cdfe6.tar.gz
open-keychain-f4cbd8cabbe9dcd01e430a4f9953f061092cdfe6.tar.bz2
open-keychain-f4cbd8cabbe9dcd01e430a4f9953f061092cdfe6.zip
Design fixes for certification activity
Diffstat (limited to 'OpenKeychain')
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewCertActivity.java87
-rw-r--r--OpenKeychain/src/main/res/layout/view_cert_activity.xml29
-rw-r--r--OpenKeychain/src/main/res/menu/view_cert.xml9
-rw-r--r--OpenKeychain/src/main/res/values/strings.xml1
4 files changed, 71 insertions, 55 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewCertActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewCertActivity.java
index 645766287..f78c30820 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewCertActivity.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewCertActivity.java
@@ -28,7 +28,6 @@ import android.support.v4.content.Loader;
import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBarActivity;
import android.text.format.DateFormat;
-import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.TextView;
@@ -76,11 +75,12 @@ public class ViewCertActivity extends ActionBarActivity
private Uri mDataUri;
- private long mSignerKeyId;
+ private long mCertifierKeyId;
- private TextView mSigneeKey, mSigneeUid, mAlgorithm, mType, mRReason, mCreation;
- private TextView mSignerKey, mSignerUid, mStatus;
+ private TextView mSigneeKey, mSigneeUid, mAlgorithm, mType, mReason, mCreation;
+ private TextView mCertifierKey, mCertifierUid, mStatus;
private View mRowReason;
+ private View mViewCertifierButton;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -96,14 +96,16 @@ public class ViewCertActivity extends ActionBarActivity
mSigneeUid = (TextView) findViewById(R.id.signee_uid);
mAlgorithm = (TextView) findViewById(R.id.algorithm);
mType = (TextView) findViewById(R.id.signature_type);
- mRReason = (TextView) findViewById(R.id.reason);
+ mReason = (TextView) findViewById(R.id.reason);
mCreation = (TextView) findViewById(R.id.creation);
- mSignerKey = (TextView) findViewById(R.id.signer_key_id);
- mSignerUid = (TextView) findViewById(R.id.signer_uid);
+ mCertifierKey = (TextView) findViewById(R.id.signer_key_id);
+ mCertifierUid = (TextView) findViewById(R.id.signer_uid);
mRowReason = findViewById(R.id.row_reason);
+ mViewCertifierButton = findViewById(R.id.view_cert_view_cert_key);
+
mDataUri = getIntent().getData();
if (mDataUri == null) {
Log.e(Constants.TAG, "Intent data missing. Should be Uri of key!");
@@ -133,15 +135,15 @@ public class ViewCertActivity extends ActionBarActivity
Date creationDate = new Date(data.getLong(INDEX_CREATION) * 1000);
mCreation.setText(DateFormat.getDateFormat(getApplicationContext()).format(creationDate));
- mSignerKeyId = data.getLong(INDEX_KEY_ID_CERTIFIER);
- String signerKey = PgpKeyHelper.convertKeyIdToHex(mSignerKeyId);
- mSignerKey.setText(signerKey);
+ mCertifierKeyId = data.getLong(INDEX_KEY_ID_CERTIFIER);
+ String certifierKey = PgpKeyHelper.convertKeyIdToHex(mCertifierKeyId);
+ mCertifierKey.setText(certifierKey);
- String signerUid = data.getString(INDEX_SIGNER_UID);
- if (signerUid != null) {
- mSignerUid.setText(signerUid);
+ String certifierUid = data.getString(INDEX_SIGNER_UID);
+ if (certifierUid != null) {
+ mCertifierUid.setText(certifierUid);
} else {
- mSignerUid.setText(R.string.unknown_uid);
+ mCertifierUid.setText(R.string.unknown_uid);
}
PGPSignature sig = PgpConversionHelper.BytesToPGPSignature(data.getBlob(INDEX_DATA));
@@ -149,10 +151,12 @@ public class ViewCertActivity extends ActionBarActivity
ProviderHelper providerHelper = new ProviderHelper(this);
PGPKeyRing signeeRing = providerHelper.getPGPKeyRing(
KeychainContract.KeyRingData.buildPublicKeyRingUri(
- Long.toString(data.getLong(INDEX_MASTER_KEY_ID))));
+ Long.toString(data.getLong(INDEX_MASTER_KEY_ID)))
+ );
PGPKeyRing signerRing = providerHelper.getPGPKeyRing(
KeychainContract.KeyRingData.buildPublicKeyRingUri(
- Long.toString(sig.getKeyID())));
+ Long.toString(sig.getKeyID()))
+ );
try {
sig.init(new JcaPGPContentVerifierBuilderProvider().setProvider(
@@ -203,25 +207,39 @@ public class ViewCertActivity extends ActionBarActivity
p = new RevocationReason(false, p.getData());
}
String reason = ((RevocationReason) p).getRevocationDescription();
- mRReason.setText(reason);
+ mReason.setText(reason);
mRowReason.setVisibility(View.VISIBLE);
}
break;
}
}
}
- }
- @Override
- public void onLoaderReset(Loader<Cursor> loader) {
- }
+ // can't do this before the data is initialized
+ mViewCertifierButton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ Intent viewIntent = new Intent(ViewCertActivity.this, ViewKeyActivity.class);
+ try {
+ ProviderHelper providerHelper = new ProviderHelper(ViewCertActivity.this);
+ long signerMasterKeyId = providerHelper.getMasterKeyId(
+ KeyRings.buildUnifiedKeyRingsFindBySubkeyUri(Long.toString(mCertifierKeyId))
+ );
+ viewIntent.setData(KeyRings.buildGenericKeyRingUri(
+ Long.toString(signerMasterKeyId))
+ );
+ startActivity(viewIntent);
+ } catch (ProviderHelper.NotFoundException e) {
+ // TODO notify user of this, maybe offer download?
+ Log.e(Constants.TAG, "key not found!", e);
+ }
+ }
+ });
+ }
@Override
- public boolean onCreateOptionsMenu(Menu menu) {
- super.onCreateOptionsMenu(menu);
- getMenuInflater().inflate(R.menu.view_cert, menu);
- return true;
+ public void onLoaderReset(Loader<Cursor> loader) {
}
@Override
@@ -233,25 +251,6 @@ public class ViewCertActivity extends ActionBarActivity
NavUtils.navigateUpTo(this, viewIntent);
return true;
}
- case R.id.menu_view_cert_view_signer:
- // can't do this before the data is initialized
- Intent viewIntent = new Intent(this, ViewKeyActivity.class);
-
- try {
- ProviderHelper providerHelper = new ProviderHelper(this);
- long signerMasterKeyId = providerHelper.getMasterKeyId(
- KeyRings.buildUnifiedKeyRingsFindBySubkeyUri(Long.toString(mSignerKeyId))
- );
- viewIntent.setData(KeyRings.buildGenericKeyRingUri(
- Long.toString(signerMasterKeyId))
- );
- startActivity(viewIntent);
- } catch (ProviderHelper.NotFoundException e) {
- // TODO notify user of this, maybe offer download?
- Log.e(Constants.TAG, "key not found!", e);
- }
-
- return true;
}
return super.onOptionsItemSelected(item);
}
diff --git a/OpenKeychain/src/main/res/layout/view_cert_activity.xml b/OpenKeychain/src/main/res/layout/view_cert_activity.xml
index 264b84239..12357fa0c 100644
--- a/OpenKeychain/src/main/res/layout/view_cert_activity.xml
+++ b/OpenKeychain/src/main/res/layout/view_cert_activity.xml
@@ -44,6 +44,7 @@
<TableLayout
android:layout_width="wrap_content"
android:layout_height="0dp"
+ android:layout_marginLeft="8dp"
android:layout_weight="1"
android:stretchColumns="1">
@@ -164,6 +165,8 @@
<TableLayout
android:layout_width="wrap_content"
android:layout_height="0dp"
+ android:layout_marginLeft="8dp"
+ android:layout_marginBottom="4dp"
android:layout_weight="1"
android:stretchColumns="1">
@@ -192,17 +195,39 @@
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:paddingRight="10dip"
- android:text="@string/label_email" />
+ android:text="@string/label_user_id" />
<TextView
android:id="@+id/signer_uid"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:paddingRight="5dip"/>
+ android:paddingRight="5dip" />
</TableRow>
</TableLayout>
+ <View
+ android:layout_width="match_parent"
+ android:layout_height="1dip"
+ android:background="?android:attr/listDivider" />
+
+ <TextView
+ android:id="@+id/view_cert_view_cert_key"
+ android:paddingLeft="8dp"
+ android:paddingRight="8dp"
+ android:layout_marginBottom="8dp"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:minHeight="?android:attr/listPreferredItemHeight"
+ android:clickable="true"
+ style="@style/SelectableItem"
+ android:text="@string/btn_view_cert_key"
+ android:layout_weight="1"
+ android:drawableRight="@drawable/ic_action_person"
+ android:drawablePadding="8dp"
+ android:gravity="center_vertical" />
+
</LinearLayout>
</ScrollView>
diff --git a/OpenKeychain/src/main/res/menu/view_cert.xml b/OpenKeychain/src/main/res/menu/view_cert.xml
deleted file mode 100644
index 8c8e455c7..000000000
--- a/OpenKeychain/src/main/res/menu/view_cert.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<menu xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:app="http://schemas.android.com/apk/res-auto">
-
- <item
- android:id="@+id/menu_view_cert_view_signer"
- app:showAsAction="never"
- android:title="View signing key" />
-</menu> \ No newline at end of file
diff --git a/OpenKeychain/src/main/res/values/strings.xml b/OpenKeychain/src/main/res/values/strings.xml
index 11ca869ff..02889eac2 100644
--- a/OpenKeychain/src/main/res/values/strings.xml
+++ b/OpenKeychain/src/main/res/values/strings.xml
@@ -69,6 +69,7 @@
<string name="btn_encryption_advanced_settings_show">Show advanced settings</string>
<string name="btn_encryption_advanced_settings_hide">Hide advanced settings</string>
<string name="btn_share_encrypted_signed">Share encrypted/signed message…</string>
+ <string name="btn_view_cert_key">View certification key</string>
<!-- menu -->
<string name="menu_preferences">Settings</string>