diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java
index b6b35a804..c5f4d482d 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java
@@ -89,8 +89,6 @@ public class ViewKeyActivity extends ActionBarActivity implements
private ImageView mStatusImage;
private View mStatusDivider;
- public static final int REQUEST_CODE_LOOKUP_KEY = 0x00007006;
-
// NFC
private NfcAdapter mNfcAdapter;
private NfcAdapter.CreateNdefMessageCallback mNdefCallback;
@@ -262,14 +260,6 @@ public class ViewKeyActivity extends ActionBarActivity implements
startActivity(homeIntent);
return true;
}
- case R.id.menu_key_view_update: {
- updateFromKeyserver(mDataUri, mProviderHelper);
- return true;
- }
- case R.id.menu_key_view_export_keyserver: {
- uploadToKeyserver(mDataUri);
- return true;
- }
case R.id.menu_key_view_export_file: {
exportToFile(mDataUri, mExportHelper, mProviderHelper);
return true;
@@ -311,26 +301,6 @@ public class ViewKeyActivity extends ActionBarActivity implements
);
}
- private void uploadToKeyserver(Uri dataUri) throws ProviderHelper.NotFoundException {
- Intent uploadIntent = new Intent(this, UploadKeyActivity.class);
- uploadIntent.setData(dataUri);
- startActivityForResult(uploadIntent, 0);
- }
-
- private void updateFromKeyserver(Uri dataUri, ProviderHelper providerHelper)
- throws ProviderHelper.NotFoundException {
- byte[] blob = (byte[]) providerHelper.getGenericData(
- KeychainContract.KeyRings.buildUnifiedKeyRingUri(dataUri),
- KeychainContract.Keys.FINGERPRINT, ProviderHelper.FIELD_TYPE_BLOB);
- String fingerprint = PgpKeyHelper.convertFingerprintToHex(blob);
-
- Intent queryIntent = new Intent(this, ImportKeysActivity.class);
- queryIntent.setAction(ImportKeysActivity.ACTION_IMPORT_KEY_FROM_KEYSERVER_AND_RETURN_RESULT);
- queryIntent.putExtra(ImportKeysActivity.EXTRA_FINGERPRINT, fingerprint);
-
- startActivityForResult(queryIntent, REQUEST_CODE_LOOKUP_KEY);
- }
-
private void deleteKey(Uri dataUri, ExportHelper exportHelper) {
// Message is received after key is deleted
Handler returnHandler = new Handler() {
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyMainFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyMainFragment.java
index a156ff5f1..370a7312f 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyMainFragment.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyMainFragment.java
@@ -33,11 +33,13 @@ import android.widget.ListView;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R;
+import org.sufficientlysecure.keychain.pgp.PgpKeyHelper;
import org.sufficientlysecure.keychain.pgp.exception.PgpGeneralException;
import org.sufficientlysecure.keychain.provider.KeychainContract;
import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings;
import org.sufficientlysecure.keychain.provider.KeychainContract.UserIds;
import org.sufficientlysecure.keychain.provider.ProviderHelper;
+import org.sufficientlysecure.keychain.provider.ProviderHelper.NotFoundException;
import org.sufficientlysecure.keychain.ui.adapter.UserIdsAdapter;
import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.Notify;
@@ -55,7 +57,7 @@ public class ViewKeyMainFragment extends LoaderFragment implements
private View mActionCertify;
private View mActionCertifyText;
private ImageView mActionCertifyImage;
- private View mActionCertifyDivider;
+ private View mActionUpdate;
private ListView mUserIds;
@@ -84,7 +86,7 @@ public class ViewKeyMainFragment extends LoaderFragment implements
// make certify image gray, like action icons
mActionCertifyImage.setColorFilter(getResources().getColor(R.color.tertiary_text_light),
PorterDuff.Mode.SRC_IN);
- mActionCertifyDivider = view.findViewById(R.id.view_key_action_certify_divider);
+ mActionUpdate = view.findViewById(R.id.view_key_action_update);
return root;
}
@@ -124,6 +126,15 @@ public class ViewKeyMainFragment extends LoaderFragment implements
editKey(mDataUri);
}
});
+ mActionUpdate.setOnClickListener(new View.OnClickListener() {
+ public void onClick(View view) {
+ try {
+ updateFromKeyserver(mDataUri, new ProviderHelper(getActivity()));
+ } catch (NotFoundException e) {
+ Notify.showNotify(getActivity(), R.string.error_key_not_found, Notify.Style.ERROR);
+ }
+ }
+ });
mUserIdsAdapter = new UserIdsAdapter(getActivity(), null, 0);
mUserIds.setAdapter(mUserIdsAdapter);
@@ -254,6 +265,20 @@ public class ViewKeyMainFragment extends LoaderFragment implements
}
}
+ private void updateFromKeyserver(Uri dataUri, ProviderHelper providerHelper)
+ throws ProviderHelper.NotFoundException {
+ byte[] blob = (byte[]) providerHelper.getGenericData(
+ KeychainContract.KeyRings.buildUnifiedKeyRingUri(dataUri),
+ KeychainContract.Keys.FINGERPRINT, ProviderHelper.FIELD_TYPE_BLOB);
+ String fingerprint = PgpKeyHelper.convertFingerprintToHex(blob);
+
+ Intent queryIntent = new Intent(getActivity(), ImportKeysActivity.class);
+ queryIntent.setAction(ImportKeysActivity.ACTION_IMPORT_KEY_FROM_KEYSERVER_AND_RETURN_RESULT);
+ queryIntent.putExtra(ImportKeysActivity.EXTRA_FINGERPRINT, fingerprint);
+
+ startActivityForResult(queryIntent, 0);
+ }
+
private void certify(Uri dataUri) {
Intent signIntent = new Intent(getActivity(), CertifyKeyActivity.class);
signIntent.setData(dataUri);
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyShareFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyShareFragment.java
index e81d5dbf7..54ab76464 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyShareFragment.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyShareFragment.java
@@ -49,6 +49,7 @@ import org.sufficientlysecure.keychain.provider.KeychainContract;
import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings;
import org.sufficientlysecure.keychain.provider.KeychainContract.Keys;
import org.sufficientlysecure.keychain.provider.ProviderHelper;
+import org.sufficientlysecure.keychain.provider.ProviderHelper.NotFoundException;
import org.sufficientlysecure.keychain.ui.dialog.ShareNfcDialogFragment;
import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.Notify;
@@ -70,6 +71,7 @@ public class ViewKeyShareFragment extends LoaderFragment implements
private View mKeyClipboardButton;
private View mNfcHelpButton;
private View mNfcPrefsButton;
+ private View mKeyUploadButton;
ProviderHelper mProviderHelper;
@@ -94,6 +96,7 @@ public class ViewKeyShareFragment extends LoaderFragment implements
mKeyClipboardButton = view.findViewById(R.id.view_key_action_key_clipboard);
mNfcHelpButton = view.findViewById(R.id.view_key_action_nfc_help);
mNfcPrefsButton = view.findViewById(R.id.view_key_action_nfc_prefs);
+ mKeyUploadButton = view.findViewById(R.id.view_key_action_upload);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
mNfcPrefsButton.setVisibility(View.VISIBLE);
@@ -144,6 +147,12 @@ public class ViewKeyShareFragment extends LoaderFragment implements
showNfcPrefs();
}
});
+ mKeyUploadButton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ uploadToKeyserver();
+ }
+ });
return root;
}
@@ -345,4 +354,11 @@ public class ViewKeyShareFragment extends LoaderFragment implements
loadTask.execute();
}
+
+ private void uploadToKeyserver() {
+ Intent uploadIntent = new Intent(getActivity(), UploadKeyActivity.class);
+ uploadIntent.setData(mDataUri);
+ startActivityForResult(uploadIntent, 0);
+ }
+
}
diff --git a/OpenKeychain/src/main/res/layout/view_key_main_fragment.xml b/OpenKeychain/src/main/res/layout/view_key_main_fragment.xml
index 27e0ab22e..38769324e 100644
--- a/OpenKeychain/src/main/res/layout/view_key_main_fragment.xml
+++ b/OpenKeychain/src/main/res/layout/view_key_main_fragment.xml
@@ -110,6 +110,28 @@
android:drawablePadding="8dp"
android:gravity="center_vertical" />
+
+
+
+
diff --git a/OpenKeychain/src/main/res/layout/view_key_share_fragment.xml b/OpenKeychain/src/main/res/layout/view_key_share_fragment.xml
index 1cd2b9f1b..a8786c461 100644
--- a/OpenKeychain/src/main/res/layout/view_key_share_fragment.xml
+++ b/OpenKeychain/src/main/res/layout/view_key_share_fragment.xml
@@ -124,6 +124,29 @@
+
+
+
+
- -
-
-
-
- Import existing key
Search
Keyserver…
- Update from keyserver
- Upload to key server
Share…
Share fingerprint…
Share whole key…
@@ -482,8 +480,10 @@
Edit key
Encrypt with this key
Certify identities
+ Update from keyserver
Share with…
Share over NFC by holding the devices back to back
+ Upload to key server
Main Info
Share
Subkeys