Merge branch 'master' into improve-file-more

Conflicts:
	OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider/CachedPublicKeyRing.java
	OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptAsymmetricFragment.java
This commit is contained in:
mar-v-in
2014-08-01 05:29:40 +02:00
25 changed files with 297 additions and 204 deletions

View File

@@ -285,9 +285,9 @@ public class HkpKeyserver extends Keyserver {
// group 1 contains the full fingerprint (v4) or the long key id if available // group 1 contains the full fingerprint (v4) or the long key id if available
// see http://bit.ly/1d4bxbk and http://bit.ly/1gD1wwr // see http://bit.ly/1d4bxbk and http://bit.ly/1gD1wwr
String fingerprintOrKeyId = matcher.group(1); String fingerprintOrKeyId = matcher.group(1).toLowerCase(Locale.US);
if (fingerprintOrKeyId.length() > 16) { if (fingerprintOrKeyId.length() > 16) {
entry.setFingerprintHex(fingerprintOrKeyId.toLowerCase(Locale.US)); entry.setFingerprintHex(fingerprintOrKeyId);
entry.setKeyIdHex("0x" + fingerprintOrKeyId.substring(fingerprintOrKeyId.length() entry.setKeyIdHex("0x" + fingerprintOrKeyId.substring(fingerprintOrKeyId.length()
- 16, fingerprintOrKeyId.length())); - 16, fingerprintOrKeyId.length()));
} else { } else {

View File

@@ -354,7 +354,7 @@ public class PgpKeyOperation {
subProgressPush(15, 25); subProgressPush(15, 25);
for (int i = 0; i < saveParcel.mAddUserIds.size(); i++) { for (int i = 0; i < saveParcel.mAddUserIds.size(); i++) {
progress(R.string.progress_modify_adduid, (i-1) * (100 / saveParcel.mAddSubKeys.size())); progress(R.string.progress_modify_adduid, (i-1) * (100 / saveParcel.mAddUserIds.size()));
String userId = saveParcel.mAddUserIds.get(i); String userId = saveParcel.mAddUserIds.get(i);
log.add(LogLevel.INFO, LogType.MSG_MF_UID_ADD, indent); log.add(LogLevel.INFO, LogType.MSG_MF_UID_ADD, indent);
@@ -399,7 +399,7 @@ public class PgpKeyOperation {
subProgressPush(25, 40); subProgressPush(25, 40);
for (int i = 0; i < saveParcel.mRevokeUserIds.size(); i++) { for (int i = 0; i < saveParcel.mRevokeUserIds.size(); i++) {
progress(R.string.progress_modify_revokeuid, (i-1) * (100 / saveParcel.mAddSubKeys.size())); progress(R.string.progress_modify_revokeuid, (i-1) * (100 / saveParcel.mRevokeUserIds.size()));
String userId = saveParcel.mRevokeUserIds.get(i); String userId = saveParcel.mRevokeUserIds.get(i);
log.add(LogLevel.INFO, LogType.MSG_MF_UID_REVOKE, indent, userId); log.add(LogLevel.INFO, LogType.MSG_MF_UID_REVOKE, indent, userId);
@@ -522,7 +522,7 @@ public class PgpKeyOperation {
subProgressPush(50, 60); subProgressPush(50, 60);
for (int i = 0; i < saveParcel.mChangeSubKeys.size(); i++) { for (int i = 0; i < saveParcel.mChangeSubKeys.size(); i++) {
progress(R.string.progress_modify_subkeychange, (i-1) * (100 / saveParcel.mAddSubKeys.size())); progress(R.string.progress_modify_subkeychange, (i-1) * (100 / saveParcel.mChangeSubKeys.size()));
SaveKeyringParcel.SubkeyChange change = saveParcel.mChangeSubKeys.get(i); SaveKeyringParcel.SubkeyChange change = saveParcel.mChangeSubKeys.get(i);
log.add(LogLevel.INFO, LogType.MSG_MF_SUBKEY_CHANGE, log.add(LogLevel.INFO, LogType.MSG_MF_SUBKEY_CHANGE,
indent, PgpKeyHelper.convertKeyIdToHex(change.mKeyId)); indent, PgpKeyHelper.convertKeyIdToHex(change.mKeyId));
@@ -583,7 +583,7 @@ public class PgpKeyOperation {
subProgressPush(60, 70); subProgressPush(60, 70);
for (int i = 0; i < saveParcel.mRevokeSubKeys.size(); i++) { for (int i = 0; i < saveParcel.mRevokeSubKeys.size(); i++) {
progress(R.string.progress_modify_subkeyrevoke, (i-1) * (100 / saveParcel.mAddSubKeys.size())); progress(R.string.progress_modify_subkeyrevoke, (i-1) * (100 / saveParcel.mRevokeSubKeys.size()));
long revocation = saveParcel.mRevokeSubKeys.get(i); long revocation = saveParcel.mRevokeSubKeys.get(i);
log.add(LogLevel.INFO, LogType.MSG_MF_SUBKEY_REVOKE, log.add(LogLevel.INFO, LogType.MSG_MF_SUBKEY_REVOKE,
indent, PgpKeyHelper.convertKeyIdToHex(revocation)); indent, PgpKeyHelper.convertKeyIdToHex(revocation));

View File

@@ -300,14 +300,14 @@ public class UncachedKeyRing {
revocation = zert; revocation = zert;
// more revocations? at least one is superfluous, then. // more revocations? at least one is superfluous, then.
} else if (revocation.getCreationTime().before(zert.getCreationTime())) { } else if (revocation.getCreationTime().before(zert.getCreationTime())) {
log.add(LogLevel.INFO, LogType.MSG_KC_REVOKE_DUP, indent);
modified = PGPPublicKey.removeCertification(modified, revocation); modified = PGPPublicKey.removeCertification(modified, revocation);
redundantCerts += 1; redundantCerts += 1;
log.add(LogLevel.INFO, LogType.MSG_KC_REVOKE_DUP, indent);
revocation = zert; revocation = zert;
} else { } else {
log.add(LogLevel.INFO, LogType.MSG_KC_REVOKE_DUP, indent);
modified = PGPPublicKey.removeCertification(modified, zert); modified = PGPPublicKey.removeCertification(modified, zert);
redundantCerts += 1; redundantCerts += 1;
log.add(LogLevel.INFO, LogType.MSG_KC_REVOKE_DUP, indent);
} }
} }
@@ -331,12 +331,13 @@ public class UncachedKeyRing {
indent, "0x" + Integer.toString(zert.getSignatureType(), 16)); indent, "0x" + Integer.toString(zert.getSignatureType(), 16));
modified = PGPPublicKey.removeCertification(modified, userId, zert); modified = PGPPublicKey.removeCertification(modified, userId, zert);
badCerts += 1; badCerts += 1;
continue;
} }
if (cert.getCreationTime().after(now)) { if (cert.getCreationTime().after(now)) {
// Creation date in the future? No way! // Creation date in the future? No way!
log.add(LogLevel.WARN, LogType.MSG_KC_UID_BAD_TIME, indent); log.add(LogLevel.WARN, LogType.MSG_KC_UID_BAD_TIME, indent);
modified = PGPPublicKey.removeCertification(modified, zert); modified = PGPPublicKey.removeCertification(modified, userId, zert);
badCerts += 1; badCerts += 1;
continue; continue;
} }
@@ -344,7 +345,7 @@ public class UncachedKeyRing {
if (cert.isLocal()) { if (cert.isLocal()) {
// Creation date in the future? No way! // Creation date in the future? No way!
log.add(LogLevel.WARN, LogType.MSG_KC_UID_BAD_LOCAL, indent); log.add(LogLevel.WARN, LogType.MSG_KC_UID_BAD_LOCAL, indent);
modified = PGPPublicKey.removeCertification(modified, zert); modified = PGPPublicKey.removeCertification(modified, userId, zert);
badCerts += 1; badCerts += 1;
continue; continue;
} }
@@ -387,35 +388,35 @@ public class UncachedKeyRing {
if (selfCert == null) { if (selfCert == null) {
selfCert = zert; selfCert = zert;
} else if (selfCert.getCreationTime().before(cert.getCreationTime())) { } else if (selfCert.getCreationTime().before(cert.getCreationTime())) {
log.add(LogLevel.DEBUG, LogType.MSG_KC_UID_DUP,
indent, userId);
modified = PGPPublicKey.removeCertification(modified, userId, selfCert); modified = PGPPublicKey.removeCertification(modified, userId, selfCert);
redundantCerts += 1; redundantCerts += 1;
log.add(LogLevel.DEBUG, LogType.MSG_KC_UID_DUP,
indent, userId);
selfCert = zert; selfCert = zert;
} else { } else {
modified = PGPPublicKey.removeCertification(modified, userId, zert);
redundantCerts += 1;
log.add(LogLevel.DEBUG, LogType.MSG_KC_UID_DUP, log.add(LogLevel.DEBUG, LogType.MSG_KC_UID_DUP,
indent, userId); indent, userId);
modified = PGPPublicKey.removeCertification(modified, userId, zert);
redundantCerts += 1;
} }
// If there is a revocation certificate, and it's older than this, drop it // If there is a revocation certificate, and it's older than this, drop it
if (revocation != null if (revocation != null
&& revocation.getCreationTime().before(selfCert.getCreationTime())) { && revocation.getCreationTime().before(selfCert.getCreationTime())) {
log.add(LogLevel.DEBUG, LogType.MSG_KC_UID_REVOKE_OLD,
indent, userId);
modified = PGPPublicKey.removeCertification(modified, userId, revocation); modified = PGPPublicKey.removeCertification(modified, userId, revocation);
revocation = null; revocation = null;
redundantCerts += 1; redundantCerts += 1;
log.add(LogLevel.DEBUG, LogType.MSG_KC_UID_REVOKE_OLD,
indent, userId);
} }
break; break;
case PGPSignature.CERTIFICATION_REVOCATION: case PGPSignature.CERTIFICATION_REVOCATION:
// If this is older than the (latest) self cert, drop it // If this is older than the (latest) self cert, drop it
if (selfCert != null && selfCert.getCreationTime().after(zert.getCreationTime())) { if (selfCert != null && selfCert.getCreationTime().after(zert.getCreationTime())) {
modified = PGPPublicKey.removeCertification(modified, userId, zert);
redundantCerts += 1;
log.add(LogLevel.DEBUG, LogType.MSG_KC_UID_REVOKE_OLD, log.add(LogLevel.DEBUG, LogType.MSG_KC_UID_REVOKE_OLD,
indent, userId); indent, userId);
modified = PGPPublicKey.removeCertification(modified, userId, zert);
redundantCerts += 1;
continue; continue;
} }
// first revocation? remember it. // first revocation? remember it.
@@ -423,16 +424,16 @@ public class UncachedKeyRing {
revocation = zert; revocation = zert;
// more revocations? at least one is superfluous, then. // more revocations? at least one is superfluous, then.
} else if (revocation.getCreationTime().before(cert.getCreationTime())) { } else if (revocation.getCreationTime().before(cert.getCreationTime())) {
log.add(LogLevel.DEBUG, LogType.MSG_KC_UID_REVOKE_DUP,
indent, userId);
modified = PGPPublicKey.removeCertification(modified, userId, revocation); modified = PGPPublicKey.removeCertification(modified, userId, revocation);
redundantCerts += 1; redundantCerts += 1;
log.add(LogLevel.DEBUG, LogType.MSG_KC_UID_REVOKE_DUP,
indent, userId);
revocation = zert; revocation = zert;
} else { } else {
modified = PGPPublicKey.removeCertification(modified, userId, zert);
redundantCerts += 1;
log.add(LogLevel.DEBUG, LogType.MSG_KC_UID_REVOKE_DUP, log.add(LogLevel.DEBUG, LogType.MSG_KC_UID_REVOKE_DUP,
indent, userId); indent, userId);
modified = PGPPublicKey.removeCertification(modified, userId, zert);
redundantCerts += 1;
} }
break; break;
@@ -442,9 +443,9 @@ public class UncachedKeyRing {
// If no valid certificate (if only a revocation) remains, drop it // If no valid certificate (if only a revocation) remains, drop it
if (selfCert == null && revocation == null) { if (selfCert == null && revocation == null) {
modified = PGPPublicKey.removeCertification(modified, userId);
log.add(LogLevel.ERROR, LogType.MSG_KC_UID_REMOVE, log.add(LogLevel.ERROR, LogType.MSG_KC_UID_REMOVE,
indent, userId); indent, userId);
modified = PGPPublicKey.removeCertification(modified, userId);
} }
} }

View File

@@ -535,6 +535,11 @@ public class KeychainIntentService extends IntentService
Intent importIntent = new Intent(this, KeychainIntentService.class); Intent importIntent = new Intent(this, KeychainIntentService.class);
importIntent.setAction(ACTION_IMPORT_KEYRING); importIntent.setAction(ACTION_IMPORT_KEYRING);
// TODO: don't use FileImportCache
// externalize import key into function
FileImportCache cache = new FileImportCache(this);
cache.writeCache(keyRings);
Bundle importData = new Bundle(); Bundle importData = new Bundle();
importIntent.putExtra(EXTRA_DATA, importData); importIntent.putExtra(EXTRA_DATA, importData);
importIntent.putExtra(EXTRA_MESSENGER, mMessenger); importIntent.putExtra(EXTRA_MESSENGER, mMessenger);

View File

@@ -139,7 +139,7 @@ public class CertifyKeyActivity extends ActionBarActivity implements
Notify.showNotify(CertifyKeyActivity.this, getString(R.string.select_key_to_certify), Notify.showNotify(CertifyKeyActivity.this, getString(R.string.select_key_to_certify),
Notify.Style.ERROR); Notify.Style.ERROR);
} else { } else {
initiateSigning(); initiateCertifying();
} }
} }
} }
@@ -229,7 +229,7 @@ public class CertifyKeyActivity extends ActionBarActivity implements
/** /**
* handles the UI bits of the signing process on the UI thread * handles the UI bits of the signing process on the UI thread
*/ */
private void initiateSigning() { private void initiateCertifying() {
// get the user's passphrase for this key (if required) // get the user's passphrase for this key (if required)
String passphrase = PassphraseCacheService.getCachedPassphrase(this, mMasterKeyId); String passphrase = PassphraseCacheService.getCachedPassphrase(this, mMasterKeyId);
if (passphrase == null) { if (passphrase == null) {
@@ -238,7 +238,7 @@ public class CertifyKeyActivity extends ActionBarActivity implements
@Override @Override
public void handleMessage(Message message) { public void handleMessage(Message message) {
if (message.what == PassphraseDialogFragment.MESSAGE_OKAY) { if (message.what == PassphraseDialogFragment.MESSAGE_OKAY) {
startSigning(); startCertifying();
} }
} }
} }
@@ -246,15 +246,14 @@ public class CertifyKeyActivity extends ActionBarActivity implements
// bail out; need to wait until the user has entered the passphrase before trying again // bail out; need to wait until the user has entered the passphrase before trying again
return; return;
} else { } else {
startSigning(); startCertifying();
} }
} }
/** /**
* kicks off the actual signing process on a background thread * kicks off the actual signing process on a background thread
*/ */
private void startSigning() { private void startCertifying() {
// Bail out if there is not at least one user id selected // Bail out if there is not at least one user id selected
ArrayList<String> userIds = mUserIdsAdapter.getSelectedUserIds(); ArrayList<String> userIds = mUserIdsAdapter.getSelectedUserIds();
if (userIds.isEmpty()) { if (userIds.isEmpty()) {
@@ -279,7 +278,7 @@ public class CertifyKeyActivity extends ActionBarActivity implements
// Message is received after signing is done in KeychainIntentService // Message is received after signing is done in KeychainIntentService
KeychainIntentServiceHandler saveHandler = new KeychainIntentServiceHandler(this, KeychainIntentServiceHandler saveHandler = new KeychainIntentServiceHandler(this,
getString(R.string.progress_signing), ProgressDialog.STYLE_SPINNER) { getString(R.string.progress_certifying), ProgressDialog.STYLE_SPINNER) {
public void handleMessage(Message message) { public void handleMessage(Message message) {
// handle messages by standard KeychainIntentServiceHandler first // handle messages by standard KeychainIntentServiceHandler first
super.handleMessage(message); super.handleMessage(message);
@@ -333,7 +332,7 @@ public class CertifyKeyActivity extends ActionBarActivity implements
// Message is received after uploading is done in KeychainIntentService // Message is received after uploading is done in KeychainIntentService
KeychainIntentServiceHandler saveHandler = new KeychainIntentServiceHandler(this, KeychainIntentServiceHandler saveHandler = new KeychainIntentServiceHandler(this,
getString(R.string.progress_exporting), ProgressDialog.STYLE_HORIZONTAL) { getString(R.string.progress_uploading), ProgressDialog.STYLE_HORIZONTAL) {
public void handleMessage(Message message) { public void handleMessage(Message message) {
// handle messages by standard KeychainIntentServiceHandler first // handle messages by standard KeychainIntentServiceHandler first
super.handleMessage(message); super.handleMessage(message);

View File

@@ -145,20 +145,20 @@ public class CreateKeyFinalFragment extends Fragment {
return; return;
} }
if (mUploadCheckbox.isChecked()) { if (result.getResult() == OperationResultParcel.RESULT_OK) {
if (result.getResult() == OperationResultParcel.RESULT_OK) { if (mUploadCheckbox.isChecked()) {
// result will be displayed after upload // result will be displayed after upload
uploadKey(result); uploadKey(result);
} else { } else {
// display result on error without finishing activity // TODO: return result
result.createNotify(getActivity()); result.createNotify(getActivity());
getActivity().setResult(Activity.RESULT_OK);
getActivity().finish();
} }
} else { } else {
// TODO: return result // display result on error without finishing activity
result.createNotify(getActivity()); result.createNotify(getActivity());
getActivity().setResult(Activity.RESULT_OK);
getActivity().finish();
} }
} }
} }
@@ -196,9 +196,8 @@ public class CreateKeyFinalFragment extends Fragment {
intent.setAction(KeychainIntentService.ACTION_UPLOAD_KEYRING); intent.setAction(KeychainIntentService.ACTION_UPLOAD_KEYRING);
// set data uri as path to keyring // set data uri as path to keyring
Uri blobUri = KeychainContract.KeyRingData.buildPublicKeyRingUri( Uri blobUri = KeychainContract.KeyRings.buildUnifiedKeyRingUri(
Long.toString(editKeyResult.mRingMasterKeyId) editKeyResult.mRingMasterKeyId);
);
intent.setData(blobUri); intent.setData(blobUri);
// fill values for this action // fill values for this action
@@ -212,14 +211,15 @@ public class CreateKeyFinalFragment extends Fragment {
// Message is received after uploading is done in KeychainIntentService // Message is received after uploading is done in KeychainIntentService
KeychainIntentServiceHandler saveHandler = new KeychainIntentServiceHandler(getActivity(), KeychainIntentServiceHandler saveHandler = new KeychainIntentServiceHandler(getActivity(),
getString(R.string.progress_exporting), ProgressDialog.STYLE_HORIZONTAL) { getString(R.string.progress_uploading), ProgressDialog.STYLE_HORIZONTAL) {
public void handleMessage(Message message) { public void handleMessage(Message message) {
// handle messages by standard KeychainIntentServiceHandler first // handle messages by standard KeychainIntentServiceHandler first
super.handleMessage(message); super.handleMessage(message);
if (message.arg1 == KeychainIntentServiceHandler.MESSAGE_OKAY) { if (message.arg1 == KeychainIntentServiceHandler.MESSAGE_OKAY) {
// TODO: return results // TODO: not supported by upload?
// if (result.getResult() == OperationResultParcel.RESULT_OK) {
// TODO: return result
editKeyResult.createNotify(getActivity()); editKeyResult.createNotify(getActivity());
Notify.showNotify(getActivity(), R.string.key_send_success, Notify.showNotify(getActivity(), R.string.key_send_success,
@@ -227,6 +227,10 @@ public class CreateKeyFinalFragment extends Fragment {
getActivity().setResult(Activity.RESULT_OK); getActivity().setResult(Activity.RESULT_OK);
getActivity().finish(); getActivity().finish();
// } else {
// // display result on error without finishing activity
// editKeyResult.createNotify(getActivity());
// }
} }
} }
}; };

View File

@@ -30,8 +30,11 @@ import android.support.v4.widget.CursorAdapter;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.*; import android.widget.CheckBox;
import android.widget.TextView;
import android.widget.Button;
import com.tokenautocomplete.TokenCompleteTextView; import com.tokenautocomplete.TokenCompleteTextView;
import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.pgp.PgpKeyHelper; import org.sufficientlysecure.keychain.pgp.PgpKeyHelper;

View File

@@ -100,6 +100,7 @@ public class ImportKeysActivity extends ActionBarActivity {
public static final int VIEW_PAGER_HEIGHT = 64; // dp public static final int VIEW_PAGER_HEIGHT = 64; // dp
private static final int ALL_TABS = -1;
private static final int TAB_KEYSERVER = 0; private static final int TAB_KEYSERVER = 0;
private static final int TAB_QR_CODE = 1; private static final int TAB_QR_CODE = 1;
private static final int TAB_FILE = 2; private static final int TAB_FILE = 2;
@@ -152,7 +153,7 @@ public class ImportKeysActivity extends ActionBarActivity {
} }
Bundle serverBundle = null; Bundle serverBundle = null;
boolean serverOnly = false; int showTabOnly = ALL_TABS;
if (ACTION_IMPORT_KEY.equals(action)) { if (ACTION_IMPORT_KEY.equals(action)) {
/* Keychain's own Actions */ /* Keychain's own Actions */
@@ -216,7 +217,7 @@ public class ImportKeysActivity extends ActionBarActivity {
serverBundle.putString(ImportKeysServerFragment.ARG_QUERY, query); serverBundle.putString(ImportKeysServerFragment.ARG_QUERY, query);
serverBundle.putBoolean(ImportKeysServerFragment.ARG_DISABLE_QUERY_EDIT, true); serverBundle.putBoolean(ImportKeysServerFragment.ARG_DISABLE_QUERY_EDIT, true);
// display server tab only // display server tab only
serverOnly = true; showTabOnly = TAB_KEYSERVER;
mSwitchToTab = TAB_KEYSERVER; mSwitchToTab = TAB_KEYSERVER;
// action: search immediately // action: search immediately
@@ -229,11 +230,18 @@ public class ImportKeysActivity extends ActionBarActivity {
); );
return; return;
} }
} else if (ACTION_IMPORT_KEY_FROM_FILE.equals(action) } else if (ACTION_IMPORT_KEY_FROM_FILE.equals(action)) {
|| ACTION_IMPORT_KEY_FROM_FILE_AND_RETURN.equals(action)) {
// NOTE: this only displays the appropriate fragment, no actions are taken // NOTE: this only displays the appropriate fragment, no actions are taken
mSwitchToTab = TAB_FILE; mSwitchToTab = TAB_FILE;
// no immediate actions!
startListFragment(savedInstanceState, null, null, null);
} else if (ACTION_IMPORT_KEY_FROM_FILE_AND_RETURN.equals(action)) {
// NOTE: this only displays the appropriate fragment, no actions are taken
mSwitchToTab = TAB_FILE;
// display file tab only
showTabOnly = TAB_FILE;
// no immediate actions! // no immediate actions!
startListFragment(savedInstanceState, null, null, null); startListFragment(savedInstanceState, null, null, null);
} else if (ACTION_IMPORT_KEY_FROM_QR_CODE.equals(action)) { } else if (ACTION_IMPORT_KEY_FROM_QR_CODE.equals(action)) {
@@ -261,10 +269,10 @@ public class ImportKeysActivity extends ActionBarActivity {
startListFragment(savedInstanceState, null, null, null); startListFragment(savedInstanceState, null, null, null);
} }
initTabs(serverBundle, serverOnly); initTabs(serverBundle, showTabOnly);
} }
private void initTabs(Bundle serverBundle, boolean serverOnly) { private void initTabs(Bundle serverBundle, int showTabOnly) {
mTabsAdapter = new PagerTabStripAdapter(this); mTabsAdapter = new PagerTabStripAdapter(this);
mViewPager.setAdapter(mTabsAdapter); mViewPager.setAdapter(mTabsAdapter);
mSlidingTabLayout.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { mSlidingTabLayout.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@@ -287,15 +295,34 @@ public class ImportKeysActivity extends ActionBarActivity {
} }
}); });
mTabsAdapter.addTab(ImportKeysServerFragment.class, switch (showTabOnly) {
serverBundle, getString(R.string.import_tab_keyserver)); case ALL_TABS:
if (!serverOnly) { // show all tabs
mTabsAdapter.addTab(ImportKeysQrCodeFragment.class, mTabsAdapter.addTab(ImportKeysServerFragment.class,
null, getString(R.string.import_tab_qr_code)); serverBundle, getString(R.string.import_tab_keyserver));
mTabsAdapter.addTab(ImportKeysFileFragment.class, mTabsAdapter.addTab(ImportKeysQrCodeFragment.class,
null, getString(R.string.import_tab_direct)); null, getString(R.string.import_tab_qr_code));
mTabsAdapter.addTab(ImportKeysKeybaseFragment.class, mTabsAdapter.addTab(ImportKeysFileFragment.class,
null, getString(R.string.import_tab_keybase)); null, getString(R.string.import_tab_direct));
mTabsAdapter.addTab(ImportKeysKeybaseFragment.class,
null, getString(R.string.import_tab_keybase));
break;
case TAB_KEYSERVER:
mTabsAdapter.addTab(ImportKeysServerFragment.class,
serverBundle, getString(R.string.import_tab_keyserver));
break;
case TAB_QR_CODE:
mTabsAdapter.addTab(ImportKeysQrCodeFragment.class,
null, getString(R.string.import_tab_qr_code));
break;
case TAB_FILE:
mTabsAdapter.addTab(ImportKeysFileFragment.class,
null, getString(R.string.import_tab_direct));
break;
case TAB_KEYBASE:
mTabsAdapter.addTab(ImportKeysKeybaseFragment.class,
null, getString(R.string.import_tab_keybase));
break;
} }
// update layout after operations // update layout after operations

View File

@@ -74,7 +74,7 @@ public class KeyListActivity extends DrawerActivity {
@Override @Override
public boolean onOptionsItemSelected(MenuItem item) { public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) { switch (item.getItemId()) {
case R.id.menu_key_list_import: case R.id.menu_key_list_add:
importKeys(); importKeys();
return true; return true;
@@ -82,6 +82,12 @@ public class KeyListActivity extends DrawerActivity {
createKey(); createKey();
return true; return true;
case R.id.menu_key_list_import_existing_key:
Intent intentImportExisting = new Intent(this, ImportKeysActivity.class);
intentImportExisting.setAction(ImportKeysActivity.ACTION_IMPORT_KEY_FROM_FILE_AND_RETURN);
startActivityForResult(intentImportExisting, 0);
return true;
case R.id.menu_key_list_export: case R.id.menu_key_list_export:
mExportHelper.showExportKeysDialog(null, Constants.Path.APP_DIR_FILE, true); mExportHelper.showExportKeysDialog(null, Constants.Path.APP_DIR_FILE, true);
return true; return true;

View File

@@ -475,41 +475,40 @@ public class KeyListFragment extends LoaderFragment
} }
} }
{ // set edit button and revoked info, specific by key type { // set edit button and status, specific by key type
if (cursor.getInt(KeyListFragment.INDEX_HAS_ANY_SECRET) != 0) { boolean isRevoked = cursor.getInt(INDEX_IS_REVOKED) > 0;
// this is a secret key boolean isExpired = !cursor.isNull(INDEX_EXPIRY)
h.mStatus.setVisibility(View.GONE); && new Date(cursor.getLong(INDEX_EXPIRY)*1000).before(new Date());
} else { boolean isVerified = cursor.getInt(INDEX_VERIFIED) > 0;
// this is a public key - show if it's revoked, expired, or verified
boolean isRevoked = cursor.getInt(INDEX_IS_REVOKED) > 0; // Note: order is important!
boolean isExpired = !cursor.isNull(INDEX_EXPIRY) if (isRevoked) {
&& new Date(cursor.getLong(INDEX_EXPIRY)*1000).before(new Date()); h.mStatus.setImageDrawable(
boolean isVerified = cursor.getInt(INDEX_VERIFIED) > 0; getResources().getDrawable(R.drawable.status_signature_revoked_cutout));
h.mStatus.setColorFilter(getResources().getColor(R.color.android_red_dark),
// Note: order is important! PorterDuff.Mode.SRC_ATOP);
if (isRevoked) { h.mStatus.setVisibility(View.VISIBLE);
h.mStatus.setImageDrawable( } else if (isExpired) {
getResources().getDrawable(R.drawable.status_signature_revoked_cutout)); h.mStatus.setImageDrawable(
h.mStatus.setColorFilter(getResources().getColor(R.color.android_red_light), getResources().getDrawable(R.drawable.status_signature_expired_cutout));
PorterDuff.Mode.SRC_ATOP); h.mStatus.setColorFilter(getResources().getColor(R.color.android_orange_dark),
h.mStatus.setVisibility(View.VISIBLE); PorterDuff.Mode.SRC_ATOP);
} else if (isExpired) { h.mStatus.setVisibility(View.VISIBLE);
h.mStatus.setImageDrawable( } else if (isVerified) {
getResources().getDrawable(R.drawable.status_signature_expired_cutout)); if (cursor.getInt(KeyListFragment.INDEX_HAS_ANY_SECRET) != 0) {
h.mStatus.setColorFilter(getResources().getColor(R.color.android_orange_light), // this is a secret key
PorterDuff.Mode.SRC_ATOP); h.mStatus.setVisibility(View.GONE);
h.mStatus.setVisibility(View.VISIBLE); } else {
} else if (isVerified) { // this is a public key - show if it's verified
h.mStatus.setImageDrawable( h.mStatus.setImageDrawable(
getResources().getDrawable(R.drawable.status_signature_verified_cutout)); getResources().getDrawable(R.drawable.status_signature_verified_cutout));
h.mStatus.setColorFilter(getResources().getColor(R.color.android_green_light), h.mStatus.setColorFilter(getResources().getColor(R.color.android_green_dark),
PorterDuff.Mode.SRC_ATOP); PorterDuff.Mode.SRC_ATOP);
h.mStatus.setVisibility(View.VISIBLE); h.mStatus.setVisibility(View.VISIBLE);
} else {
h.mStatus.setVisibility(View.GONE);
} }
} else {
h.mStatus.setVisibility(View.GONE);
} }
} }

View File

@@ -36,6 +36,7 @@ import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.helper.Preferences; import org.sufficientlysecure.keychain.helper.Preferences;
import org.sufficientlysecure.keychain.provider.KeychainContract; import org.sufficientlysecure.keychain.provider.KeychainContract;
import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings;
import org.sufficientlysecure.keychain.service.KeychainIntentService; import org.sufficientlysecure.keychain.service.KeychainIntentService;
import org.sufficientlysecure.keychain.service.KeychainIntentServiceHandler; import org.sufficientlysecure.keychain.service.KeychainIntentServiceHandler;
import org.sufficientlysecure.keychain.util.Log; import org.sufficientlysecure.keychain.util.Log;
@@ -92,7 +93,7 @@ public class UploadKeyActivity extends ActionBarActivity {
intent.setAction(KeychainIntentService.ACTION_UPLOAD_KEYRING); intent.setAction(KeychainIntentService.ACTION_UPLOAD_KEYRING);
// set data uri as path to keyring // set data uri as path to keyring
Uri blobUri = KeychainContract.KeyRingData.buildPublicKeyRingUri(mDataUri); Uri blobUri = KeyRings.buildUnifiedKeyRingUri(mDataUri);
intent.setData(blobUri); intent.setData(blobUri);
// fill values for this action // fill values for this action
@@ -105,7 +106,7 @@ public class UploadKeyActivity extends ActionBarActivity {
// Message is received after uploading is done in KeychainIntentService // Message is received after uploading is done in KeychainIntentService
KeychainIntentServiceHandler saveHandler = new KeychainIntentServiceHandler(this, KeychainIntentServiceHandler saveHandler = new KeychainIntentServiceHandler(this,
getString(R.string.progress_exporting), ProgressDialog.STYLE_HORIZONTAL) { getString(R.string.progress_uploading), ProgressDialog.STYLE_HORIZONTAL) {
public void handleMessage(Message message) { public void handleMessage(Message message) {
// handle messages by standard KeychainIntentServiceHandler first // handle messages by standard KeychainIntentServiceHandler first
super.handleMessage(message); super.handleMessage(message);

View File

@@ -89,8 +89,6 @@ public class ViewKeyActivity extends ActionBarActivity implements
private ImageView mStatusImage; private ImageView mStatusImage;
private View mStatusDivider; private View mStatusDivider;
public static final int REQUEST_CODE_LOOKUP_KEY = 0x00007006;
// NFC // NFC
private NfcAdapter mNfcAdapter; private NfcAdapter mNfcAdapter;
private NfcAdapter.CreateNdefMessageCallback mNdefCallback; private NfcAdapter.CreateNdefMessageCallback mNdefCallback;
@@ -145,20 +143,27 @@ public class ViewKeyActivity extends ActionBarActivity implements
switchToTab = intent.getExtras().getInt(EXTRA_SELECTED_TAB); switchToTab = intent.getExtras().getInt(EXTRA_SELECTED_TAB);
} }
Uri dataUri = getDataUri(); mDataUri = getIntent().getData();
if (dataUri == null) { if (mDataUri == null) {
Log.e(Constants.TAG, "Data missing. Should be Uri of key!"); Log.e(Constants.TAG, "Data missing. Should be uri of key!");
finish(); finish();
return; return;
} }
if (mDataUri.getHost().equals(ContactsContract.AUTHORITY)) {
mDataUri = ContactHelper.dataUriFromContactUri(this, mDataUri);
}
loadData(dataUri); Log.i(Constants.TAG, "mDataUri: " + mDataUri.toString());
initNfc(dataUri); // Prepare the loaders. Either re-connect with an existing ones,
// or start new ones.
getSupportLoaderManager().initLoader(LOADER_ID_UNIFIED, null, this);
initNfc(mDataUri);
mShowAdvancedTabs = false; mShowAdvancedTabs = false;
initTabs(dataUri); initTabs(mDataUri);
// switch to tab selected by extra // switch to tab selected by extra
mViewPager.setCurrentItem(switchToTab); mViewPager.setCurrentItem(switchToTab);
@@ -235,24 +240,6 @@ public class ViewKeyActivity extends ActionBarActivity implements
mSlidingTabLayout.setViewPager(mViewPager); mSlidingTabLayout.setViewPager(mViewPager);
} }
private Uri getDataUri() {
Uri dataUri = getIntent().getData();
if (dataUri != null && dataUri.getHost().equals(ContactsContract.AUTHORITY)) {
dataUri = ContactHelper.dataUriFromContactUri(this, dataUri);
}
return dataUri;
}
private void loadData(Uri dataUri) {
mDataUri = dataUri;
Log.i(Constants.TAG, "mDataUri: " + mDataUri.toString());
// Prepare the loaders. Either re-connect with an existing ones,
// or start new ones.
getSupportLoaderManager().initLoader(LOADER_ID_UNIFIED, null, this);
}
@Override @Override
public boolean onCreateOptionsMenu(Menu menu) { public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu); super.onCreateOptionsMenu(menu);
@@ -273,14 +260,6 @@ public class ViewKeyActivity extends ActionBarActivity implements
startActivity(homeIntent); startActivity(homeIntent);
return true; 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: { case R.id.menu_key_view_export_file: {
exportToFile(mDataUri, mExportHelper, mProviderHelper); exportToFile(mDataUri, mExportHelper, mProviderHelper);
return true; return true;
@@ -321,26 +300,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) { private void deleteKey(Uri dataUri, ExportHelper exportHelper) {
// Message is received after key is deleted // Message is received after key is deleted
Handler returnHandler = new Handler() { Handler returnHandler = new Handler() {
@@ -515,19 +474,19 @@ public class ViewKeyActivity extends ActionBarActivity implements
// Note: order is important // Note: order is important
if (isRevoked) { if (isRevoked) {
mStatusText.setText(R.string.view_key_revoked); mStatusText.setText(R.string.view_key_revoked);
mStatusText.setTextColor(getResources().getColor(R.color.android_red_light)); mStatusText.setTextColor(getResources().getColor(R.color.android_red_dark));
mStatusImage.setImageDrawable( mStatusImage.setImageDrawable(
getResources().getDrawable(R.drawable.status_signature_revoked_cutout)); getResources().getDrawable(R.drawable.status_signature_revoked_cutout));
mStatusImage.setColorFilter(getResources().getColor(R.color.android_red_light), mStatusImage.setColorFilter(getResources().getColor(R.color.android_red_dark),
PorterDuff.Mode.SRC_ATOP); PorterDuff.Mode.SRC_ATOP);
mStatusDivider.setVisibility(View.VISIBLE); mStatusDivider.setVisibility(View.VISIBLE);
mStatusLayout.setVisibility(View.VISIBLE); mStatusLayout.setVisibility(View.VISIBLE);
} else if (isExpired) { } else if (isExpired) {
mStatusText.setText(R.string.view_key_expired); mStatusText.setText(R.string.view_key_expired);
mStatusText.setTextColor(getResources().getColor(R.color.android_orange_light)); mStatusText.setTextColor(getResources().getColor(R.color.android_orange_dark));
mStatusImage.setImageDrawable( mStatusImage.setImageDrawable(
getResources().getDrawable(R.drawable.status_signature_expired_cutout)); getResources().getDrawable(R.drawable.status_signature_expired_cutout));
mStatusImage.setColorFilter(getResources().getColor(R.color.android_orange_light), mStatusImage.setColorFilter(getResources().getColor(R.color.android_orange_dark),
PorterDuff.Mode.SRC_ATOP); PorterDuff.Mode.SRC_ATOP);
mStatusDivider.setVisibility(View.VISIBLE); mStatusDivider.setVisibility(View.VISIBLE);
mStatusLayout.setVisibility(View.VISIBLE); mStatusLayout.setVisibility(View.VISIBLE);

View File

@@ -33,11 +33,13 @@ import android.widget.ListView;
import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.pgp.PgpKeyHelper;
import org.sufficientlysecure.keychain.pgp.exception.PgpGeneralException; import org.sufficientlysecure.keychain.pgp.exception.PgpGeneralException;
import org.sufficientlysecure.keychain.provider.KeychainContract; import org.sufficientlysecure.keychain.provider.KeychainContract;
import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings; import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings;
import org.sufficientlysecure.keychain.provider.KeychainContract.UserIds; import org.sufficientlysecure.keychain.provider.KeychainContract.UserIds;
import org.sufficientlysecure.keychain.provider.ProviderHelper; import org.sufficientlysecure.keychain.provider.ProviderHelper;
import org.sufficientlysecure.keychain.provider.ProviderHelper.NotFoundException;
import org.sufficientlysecure.keychain.ui.adapter.UserIdsAdapter; import org.sufficientlysecure.keychain.ui.adapter.UserIdsAdapter;
import org.sufficientlysecure.keychain.util.Log; import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.Notify; import org.sufficientlysecure.keychain.util.Notify;
@@ -55,7 +57,7 @@ public class ViewKeyMainFragment extends LoaderFragment implements
private View mActionCertify; private View mActionCertify;
private View mActionCertifyText; private View mActionCertifyText;
private ImageView mActionCertifyImage; private ImageView mActionCertifyImage;
private View mActionCertifyDivider; private View mActionUpdate;
private ListView mUserIds; private ListView mUserIds;
@@ -84,7 +86,7 @@ public class ViewKeyMainFragment extends LoaderFragment implements
// make certify image gray, like action icons // make certify image gray, like action icons
mActionCertifyImage.setColorFilter(getResources().getColor(R.color.tertiary_text_light), mActionCertifyImage.setColorFilter(getResources().getColor(R.color.tertiary_text_light),
PorterDuff.Mode.SRC_IN); 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; return root;
} }
@@ -124,6 +126,15 @@ public class ViewKeyMainFragment extends LoaderFragment implements
editKey(mDataUri); 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); mUserIdsAdapter = new UserIdsAdapter(getActivity(), null, 0);
mUserIds.setAdapter(mUserIdsAdapter); 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) { private void certify(Uri dataUri) {
Intent signIntent = new Intent(getActivity(), CertifyKeyActivity.class); Intent signIntent = new Intent(getActivity(), CertifyKeyActivity.class);
signIntent.setData(dataUri); signIntent.setData(dataUri);

View File

@@ -49,6 +49,7 @@ import org.sufficientlysecure.keychain.provider.KeychainContract;
import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings; import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings;
import org.sufficientlysecure.keychain.provider.KeychainContract.Keys; import org.sufficientlysecure.keychain.provider.KeychainContract.Keys;
import org.sufficientlysecure.keychain.provider.ProviderHelper; import org.sufficientlysecure.keychain.provider.ProviderHelper;
import org.sufficientlysecure.keychain.provider.ProviderHelper.NotFoundException;
import org.sufficientlysecure.keychain.ui.dialog.ShareNfcDialogFragment; import org.sufficientlysecure.keychain.ui.dialog.ShareNfcDialogFragment;
import org.sufficientlysecure.keychain.util.Log; import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.Notify; import org.sufficientlysecure.keychain.util.Notify;
@@ -70,6 +71,7 @@ public class ViewKeyShareFragment extends LoaderFragment implements
private View mKeyClipboardButton; private View mKeyClipboardButton;
private View mNfcHelpButton; private View mNfcHelpButton;
private View mNfcPrefsButton; private View mNfcPrefsButton;
private View mKeyUploadButton;
ProviderHelper mProviderHelper; ProviderHelper mProviderHelper;
@@ -94,6 +96,7 @@ public class ViewKeyShareFragment extends LoaderFragment implements
mKeyClipboardButton = view.findViewById(R.id.view_key_action_key_clipboard); mKeyClipboardButton = view.findViewById(R.id.view_key_action_key_clipboard);
mNfcHelpButton = view.findViewById(R.id.view_key_action_nfc_help); mNfcHelpButton = view.findViewById(R.id.view_key_action_nfc_help);
mNfcPrefsButton = view.findViewById(R.id.view_key_action_nfc_prefs); 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) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
mNfcPrefsButton.setVisibility(View.VISIBLE); mNfcPrefsButton.setVisibility(View.VISIBLE);
@@ -144,6 +147,12 @@ public class ViewKeyShareFragment extends LoaderFragment implements
showNfcPrefs(); showNfcPrefs();
} }
}); });
mKeyUploadButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
uploadToKeyserver();
}
});
return root; return root;
} }
@@ -345,4 +354,11 @@ public class ViewKeyShareFragment extends LoaderFragment implements
loadTask.execute(); loadTask.execute();
} }
private void uploadToKeyserver() {
Intent uploadIntent = new Intent(getActivity(), UploadKeyActivity.class);
uploadIntent.setData(mDataUri);
startActivityForResult(uploadIntent, 0);
}
} }

View File

@@ -188,7 +188,7 @@ public class UserIdsAdapter extends CursorAdapter implements AdapterView.OnItemC
case Certs.VERIFIED_SECRET: case Certs.VERIFIED_SECRET:
vVerified.setImageResource(R.drawable.status_signature_verified_cutout); vVerified.setImageResource(R.drawable.status_signature_verified_cutout);
vVerified.setColorFilter( vVerified.setColorFilter(
mContext.getResources().getColor(R.color.android_green_light), mContext.getResources().getColor(R.color.android_green_dark),
PorterDuff.Mode.SRC_IN); PorterDuff.Mode.SRC_IN);
break; break;
case Certs.VERIFIED_SELF: case Certs.VERIFIED_SELF:
@@ -200,7 +200,7 @@ public class UserIdsAdapter extends CursorAdapter implements AdapterView.OnItemC
default: default:
vVerified.setImageResource(R.drawable.status_signature_invalid_cutout); vVerified.setImageResource(R.drawable.status_signature_invalid_cutout);
vVerified.setColorFilter( vVerified.setColorFilter(
mContext.getResources().getColor(R.color.android_red_light), mContext.getResources().getColor(R.color.android_red_dark),
PorterDuff.Mode.SRC_IN); PorterDuff.Mode.SRC_IN);
break; break;
} }

View File

@@ -37,7 +37,6 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="8dp" android:layout_marginBottom="8dp"
android:layout_marginLeft="8dp" android:layout_marginLeft="8dp"
android:text="Max Mustermann"
android:textAppearance="?android:attr/textAppearanceMedium" /> android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView <TextView
@@ -52,7 +51,6 @@
android:id="@+id/email" android:id="@+id/email"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="max@musterman.com"
android:textAppearance="?android:attr/textAppearanceMedium" android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_marginBottom="8dp" android:layout_marginBottom="8dp"
android:layout_marginLeft="8dp" /> android:layout_marginLeft="8dp" />
@@ -131,7 +129,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:text="@string/title_create_key" android:text="@string/btn_create_key"
android:minHeight="?android:attr/listPreferredItemHeight" android:minHeight="?android:attr/listPreferredItemHeight"
android:drawableRight="@drawable/ic_action_new_account" android:drawableRight="@drawable/ic_action_new_account"
android:drawablePadding="8dp" android:drawablePadding="8dp"

View File

@@ -17,20 +17,28 @@
android:orientation="vertical"> android:orientation="vertical">
<TextView <TextView
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingTop="16dp" android:layout_marginTop="16dp"
android:paddingBottom="8dp" android:layout_marginLeft="8dp"
android:text="@string/create_key_text" android:textAppearance="?android:attr/textAppearanceMedium"
android:textAppearance="?android:attr/textAppearanceMedium" /> android:text="@string/create_key_text" />
<TextView
style="@style/SectionHeader"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="@string/label_user_id" />
<AutoCompleteTextView <AutoCompleteTextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp" android:layout_marginBottom="8dp"
android:imeOptions="actionNext" android:imeOptions="actionNext"
android:inputType="textPersonName" android:inputType="textPersonName"
android:hint="@string/label_name" android:hint="@string/create_key_hint_full_name"
android:ems="10" android:ems="10"
android:id="@+id/name" /> android:id="@+id/name" />
@@ -44,10 +52,17 @@
android:ems="10" android:ems="10"
android:inputType="textEmailAddress" /> android:inputType="textEmailAddress" />
<TextView
style="@style/SectionHeader"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/label_passphrase" />
<EditText <EditText
android:id="@+id/passphrase" android:id="@+id/passphrase"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp" android:layout_marginBottom="8dp"
android:inputType="textPassword" android:inputType="textPassword"
android:hint="@string/label_passphrase" android:hint="@string/label_passphrase"
@@ -117,7 +132,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:text="@string/title_create_key" android:text="@string/btn_next"
android:minHeight="?android:attr/listPreferredItemHeight" android:minHeight="?android:attr/listPreferredItemHeight"
android:drawableRight="@drawable/ic_action_new_account" android:drawableRight="@drawable/ic_action_new_account"
android:drawablePadding="8dp" android:drawablePadding="8dp"

View File

@@ -33,9 +33,10 @@
android:layout_weight="1" android:layout_weight="1"
android:text="@string/first_time_import_key" android:text="@string/first_time_import_key"
android:minHeight="?android:attr/listPreferredItemHeight" android:minHeight="?android:attr/listPreferredItemHeight"
android:drawableRight="@drawable/ic_action_download" android:drawableRight="@drawable/ic_action_collection"
android:drawablePadding="8dp" android:drawablePadding="8dp"
android:gravity="center_vertical" android:gravity="center_vertical"
android:layout_gravity="center_vertical"
android:clickable="true" android:clickable="true"
style="@style/SelectableItem" /> style="@style/SelectableItem" />
@@ -59,6 +60,7 @@
android:drawableRight="@drawable/ic_action_new_account" android:drawableRight="@drawable/ic_action_new_account"
android:drawablePadding="8dp" android:drawablePadding="8dp"
android:gravity="center_vertical" android:gravity="center_vertical"
android:layout_gravity="center_vertical"
android:clickable="true" android:clickable="true"
style="@style/SelectableItem" /> style="@style/SelectableItem" />

View File

@@ -56,6 +56,7 @@
android:textSize="14sp" android:textSize="14sp"
android:text="@string/key_list_empty_button_create" android:text="@string/key_list_empty_button_create"
android:drawableLeft="@drawable/ic_action_new_account" android:drawableLeft="@drawable/ic_action_new_account"
android:drawablePadding="8dp"
android:background="@drawable/button_edgy"/> android:background="@drawable/button_edgy"/>
<TextView <TextView
@@ -73,7 +74,8 @@
android:layout_margin="4dp" android:layout_margin="4dp"
android:textSize="14sp" android:textSize="14sp"
android:text="@string/key_list_empty_button_import" android:text="@string/key_list_empty_button_import"
android:drawableLeft="@drawable/ic_action_download" android:drawableLeft="@drawable/ic_action_collection"
android:drawablePadding="8dp"
android:background="@drawable/button_edgy" /> android:background="@drawable/button_edgy" />
</LinearLayout> </LinearLayout>

View File

@@ -21,7 +21,7 @@
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_marginRight="8dp" android:layout_marginRight="8dp"
android:visibility="visible" android:visibility="gone"
android:textColor="@android:color/darker_gray" /> android:textColor="@android:color/darker_gray" />
</RelativeLayout> </RelativeLayout>

View File

@@ -17,7 +17,6 @@
style="@style/SectionHeader" style="@style/SectionHeader"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_marginBottom="4dp"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:text="@string/section_user_ids" android:text="@string/section_user_ids"
android:layout_weight="1" /> android:layout_weight="1" />
@@ -98,7 +97,6 @@
android:id="@+id/view_key_action_encrypt" android:id="@+id/view_key_action_encrypt"
android:paddingLeft="8dp" android:paddingLeft="8dp"
android:paddingRight="8dp" android:paddingRight="8dp"
android:layout_marginBottom="8dp"
android:textAppearance="?android:attr/textAppearanceMedium" android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@@ -111,6 +109,28 @@
android:drawablePadding="8dp" android:drawablePadding="8dp"
android:gravity="center_vertical" /> android:gravity="center_vertical" />
<View
android:layout_width="match_parent"
android:layout_height="1dip"
android:background="?android:attr/listDivider" />
<TextView
android:id="@+id/view_key_action_update"
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/key_view_action_update"
android:layout_weight="1"
android:drawableRight="@drawable/ic_action_download"
android:drawablePadding="8dp"
android:gravity="center_vertical" />
</LinearLayout> </LinearLayout>
</ScrollView> </ScrollView>

View File

@@ -124,6 +124,29 @@
</LinearLayout> </LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dip"
android:background="?android:attr/listDivider" />
<TextView
android:id="@+id/view_key_action_upload"
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/key_view_action_upload"
android:layout_weight="1"
android:drawableRight="@drawable/ic_action_upload"
android:drawablePadding="8dp"
android:gravity="center_vertical"
android:editable="false" />
<View <View
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="1dip" android:layout_height="1dip"

View File

@@ -10,7 +10,7 @@
app:showAsAction="collapseActionView|ifRoom" /> app:showAsAction="collapseActionView|ifRoom" />
<item <item
android:id="@+id/menu_key_list_import" android:id="@+id/menu_key_list_add"
app:showAsAction="ifRoom|withText" app:showAsAction="ifRoom|withText"
android:icon="@drawable/ic_action_add_person" android:icon="@drawable/ic_action_add_person"
android:title="@string/menu_add_keys" /> android:title="@string/menu_add_keys" />
@@ -26,6 +26,11 @@
app:showAsAction="never" app:showAsAction="never"
android:title="@string/menu_create_key" /> android:title="@string/menu_create_key" />
<item
android:id="@+id/menu_key_list_import_existing_key"
app:showAsAction="never"
android:title="@string/menu_import_existing_key" />
<item <item
android:id="@+id/menu_key_list_debug_read" android:id="@+id/menu_key_list_debug_read"
app:showAsAction="never" app:showAsAction="never"

View File

@@ -2,23 +2,6 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android" <menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"> xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/menu_key_keyserver"
android:icon="@drawable/ic_action_cloud"
app:showAsAction="always"
android:title="@string/menu_key_server">
<menu>
<item
android:id="@+id/menu_key_view_update"
app:showAsAction="never"
android:title="@string/menu_update_key" />
<item
android:id="@+id/menu_key_view_export_keyserver"
app:showAsAction="never"
android:title="@string/menu_export_key_to_server" />
</menu>
</item>
<item <item
android:id="@+id/menu_key_view_export_file" android:id="@+id/menu_key_view_export_file"
android:icon="@drawable/ic_action_import_export" android:icon="@drawable/ic_action_import_export"

View File

@@ -2,12 +2,12 @@
<resources> <resources>
<!-- title --> <!-- title -->
<string name="title_select_recipients">Select Public Key</string> <string name="title_select_recipients">Select Keys</string>
<string name="title_select_secret_key">Select Secret Key</string> <string name="title_select_secret_key">Select Your Key</string>
<string name="title_encrypt">Encrypt</string> <string name="title_encrypt">Encrypt</string>
<string name="title_decrypt">Decrypt</string> <string name="title_decrypt">Decrypt</string>
<string name="title_authentication">Passphrase</string> <string name="title_authentication">Passphrase</string>
<string name="title_create_key">Create Key</string> <string name="title_create_key">Create My Key</string>
<string name="title_edit_key">Edit Key</string> <string name="title_edit_key">Edit Key</string>
<string name="title_preferences">Preferences</string> <string name="title_preferences">Preferences</string>
<string name="title_api_registered_apps">Apps</string> <string name="title_api_registered_apps">Apps</string>
@@ -73,18 +73,17 @@
<string name="btn_encryption_advanced_settings_hide">Hide 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_share_encrypted_signed">Share encrypted/signed message…</string>
<string name="btn_view_cert_key">View certification key</string> <string name="btn_view_cert_key">View certification key</string>
<string name="btn_create_key">Create key</string>
<!-- menu --> <!-- menu -->
<string name="menu_preferences">Settings</string> <string name="menu_preferences">Settings</string>
<string name="menu_help">Help</string> <string name="menu_help">Help</string>
<string name="menu_export_key">Export to file</string> <string name="menu_export_key">Export to file</string>
<string name="menu_delete_key">Delete key</string> <string name="menu_delete_key">Delete key</string>
<string name="menu_create_key">Create key</string> <string name="menu_create_key">Create my key</string>
<string name="menu_create_key_expert">Create key (expert)</string> <string name="menu_import_existing_key">Import existing key</string>
<string name="menu_search">Search</string> <string name="menu_search">Search</string>
<string name="menu_key_server">Keyserver…</string> <string name="menu_key_server">Keyserver…</string>
<string name="menu_update_key">Update from keyserver</string>
<string name="menu_export_key_to_server">Upload to key server</string>
<string name="menu_share">Share…</string> <string name="menu_share">Share…</string>
<string name="menu_share_title_fingerprint">Share fingerprint…</string> <string name="menu_share_title_fingerprint">Share fingerprint…</string>
<string name="menu_share_title">Share whole key…</string> <string name="menu_share_title">Share whole key…</string>
@@ -224,7 +223,7 @@
<string name="ask_save_changed_key">You have made changes to the keyring, would you like to save it?</string> <string name="ask_save_changed_key">You have made changes to the keyring, would you like to save it?</string>
<string name="ask_empty_id_ok">You have added an empty identity, are you sure you want to continue?</string> <string name="ask_empty_id_ok">You have added an empty identity, are you sure you want to continue?</string>
<string name="public_key_deletetion_confirmation">Do you really want to delete the public key \'%s\'?\nYou can\'t undo this!</string> <string name="public_key_deletetion_confirmation">Do you really want to delete the public key \'%s\'?\nYou can\'t undo this!</string>
<string name="also_export_secret_keys">Also export secret keys?</string> <string name="also_export_secret_keys">Also export secret keys</string>
<string name="key_exported">Successfully exported 1 key.</string> <string name="key_exported">Successfully exported 1 key.</string>
<string name="keys_exported">Successfully exported %d keys.</string> <string name="keys_exported">Successfully exported %d keys.</string>
@@ -306,6 +305,7 @@
<string name="progress_saving">saving…</string> <string name="progress_saving">saving…</string>
<string name="progress_importing">importing…</string> <string name="progress_importing">importing…</string>
<string name="progress_exporting">exporting…</string> <string name="progress_exporting">exporting…</string>
<string name="progress_uploading">uploading…</string>
<string name="progress_building_key">building key…</string> <string name="progress_building_key">building key…</string>
<string name="progress_certifying_master_key">certifying master key…</string> <string name="progress_certifying_master_key">certifying master key…</string>
<string name="progress_building_master_key">building master ring…</string> <string name="progress_building_master_key">building master ring…</string>
@@ -346,6 +346,7 @@
<string name="progress_processing_signature">processing signature…</string> <string name="progress_processing_signature">processing signature…</string>
<string name="progress_verifying_signature">verifying signature…</string> <string name="progress_verifying_signature">verifying signature…</string>
<string name="progress_signing">signing…</string> <string name="progress_signing">signing…</string>
<string name="progress_certifying">certifying…</string>
<string name="progress_reading_data">reading data…</string> <string name="progress_reading_data">reading data…</string>
<string name="progress_finding_key">finding key…</string> <string name="progress_finding_key">finding key…</string>
<string name="progress_decompressing_data">decompressing data…</string> <string name="progress_decompressing_data">decompressing data…</string>
@@ -354,7 +355,6 @@
<!-- action strings --> <!-- action strings -->
<string name="hint_public_keys">Name/Email/Key ID…</string> <string name="hint_public_keys">Name/Email/Key ID…</string>
<string name="hint_secret_keys">Search Secret Keys</string>
<string name="action_share_key_with">Share Key with…</string> <string name="action_share_key_with">Share Key with…</string>
<string name="hint_keybase_search">Name/Keybase.io username…</string> <string name="hint_keybase_search">Name/Keybase.io username…</string>
@@ -455,7 +455,7 @@
<string name="api_settings_package_signature">SHA-256 of Package Signature</string> <string name="api_settings_package_signature">SHA-256 of Package Signature</string>
<string name="api_settings_accounts">Accounts</string> <string name="api_settings_accounts">Accounts</string>
<string name="api_settings_accounts_empty">No accounts attached to this app.</string> <string name="api_settings_accounts_empty">No accounts attached to this app.</string>
<string name="api_create_account_text">The app requests the creation of a new account. Please select an existing private key or create a new one.\nApps are restricted to the usage of keys you select here!</string> <string name="api_create_account_text">The app requests the creation of a new account. Please select one of your existing keys or create a new one.\nApps are restricted to the usage of keys you select here!</string>
<string name="api_register_text">The displayed app wants to encrypt/decrypt messages and sign them in your name.\nAllow access?\n\nWARNING: If you do not know why this screen appeared, disallow access! You can revoke access later using the \'Apps\' screen.</string> <string name="api_register_text">The displayed app wants to encrypt/decrypt messages and sign them in your name.\nAllow access?\n\nWARNING: If you do not know why this screen appeared, disallow access! You can revoke access later using the \'Apps\' screen.</string>
<string name="api_register_allow">Allow access</string> <string name="api_register_allow">Allow access</string>
<string name="api_register_disallow">Disallow access</string> <string name="api_register_disallow">Disallow access</string>
@@ -482,14 +482,16 @@
<string name="key_list_empty_text2">You can start by</string> <string name="key_list_empty_text2">You can start by</string>
<string name="key_list_empty_text3">or</string> <string name="key_list_empty_text3">or</string>
<string name="key_list_empty_button_create">creating your own key</string> <string name="key_list_empty_button_create">creating your own key</string>
<string name="key_list_empty_button_import">importing keys.</string> <string name="key_list_empty_button_import">importing an existing key.</string>
<!-- Key view --> <!-- Key view -->
<string name="key_view_action_edit">Edit key</string> <string name="key_view_action_edit">Edit key</string>
<string name="key_view_action_encrypt">Encrypt with this key</string> <string name="key_view_action_encrypt">Encrypt with this key</string>
<string name="key_view_action_certify">Certify identities</string> <string name="key_view_action_certify">Certify identities</string>
<string name="key_view_action_update">Update from keyserver</string>
<string name="key_view_action_share_with">Share with…</string> <string name="key_view_action_share_with">Share with…</string>
<string name="key_view_action_share_nfc">Share over NFC by holding the devices back to back</string> <string name="key_view_action_share_nfc">Share over NFC by holding the devices back to back</string>
<string name="key_view_action_upload">Upload to key server</string>
<string name="key_view_tab_main">Main Info</string> <string name="key_view_tab_main">Main Info</string>
<string name="key_view_tab_share">Share</string> <string name="key_view_tab_share">Share</string>
<string name="key_view_tab_keys">Subkeys</string> <string name="key_view_tab_keys">Subkeys</string>
@@ -511,12 +513,13 @@
</string-array> </string-array>
<!-- Create key --> <!-- Create key -->
<string name="create_key_text">Enter Full Name, Email and a Passphrase.</string>
<string name="create_key_upload">Upload key to keyserver</string> <string name="create_key_upload">Upload key to keyserver</string>
<string name="create_key_empty">This field is required</string> <string name="create_key_empty">This field is required</string>
<string name="create_key_passphrases_not_equal">Passphrases do not match</string> <string name="create_key_passphrases_not_equal">Passphrases do not match</string>
<string name="create_key_final_text">You entered the following credentials:</string> <string name="create_key_final_text">You entered the following credentials:</string>
<string name="create_key_final_robot_text">Creating a key may take a while, have a cup of coffee in the meantime…\n(3 subkeys, RSA, 4096 bit)</string> <string name="create_key_final_robot_text">Creating a key may take a while, have a cup of coffee in the meantime…\n(3 subkeys, RSA, 4096 bit)</string>
<string name="create_key_text">Enter your full name, email address, and choose a passhrase.</string>
<string name="create_key_hint_full_name">Full Name, e.g. Max Mustermann</string>
<!-- View key --> <!-- View key -->
<string name="view_key_revoked">This key has been revoked!</string> <string name="view_key_revoked">This key has been revoked!</string>
@@ -532,9 +535,6 @@
<string name="drawer_close">Close navigation drawer</string> <string name="drawer_close">Close navigation drawer</string>
<string name="edit">Edit</string> <string name="edit">Edit</string>
<string name="my_keys">My Keys</string> <string name="my_keys">My Keys</string>
<string name="label_secret_key">Secret Key</string>
<string name="secret_key_yes">available</string>
<string name="secret_key_no">unavailable</string>
<!-- hints --> <!-- hints -->
<string name="encrypt_content_edit_text_hint">Write message here to encrypt and/or sign…</string> <string name="encrypt_content_edit_text_hint">Write message here to encrypt and/or sign…</string>
@@ -736,7 +736,7 @@
<string name="error_key_processing">Error processing key!</string> <string name="error_key_processing">Error processing key!</string>
<string name="no_subkey">subkey unavailable</string> <string name="no_subkey">subkey unavailable</string>
<string name="key_stripped">stripped</string> <string name="key_stripped">stripped</string>
<string name="secret_cannot_multiple">Secret keys can only be deleted individually!</string> <string name="secret_cannot_multiple">Your own keys can only be deleted individually!</string>
<string name="title_view_cert">View Certificate Details</string> <string name="title_view_cert">View Certificate Details</string>
<string name="unknown_algorithm">unknown</string> <string name="unknown_algorithm">unknown</string>
<string name="can_sign_not">cannot sign</string> <string name="can_sign_not">cannot sign</string>
@@ -747,8 +747,8 @@
<!-- First Time --> <!-- First Time -->
<string name="first_time_text1">Take back your privacy with OpenKeychain!</string> <string name="first_time_text1">Take back your privacy with OpenKeychain!</string>
<string name="first_time_create_key">Create Key</string> <string name="first_time_create_key">Create my key</string>
<string name="first_time_import_key">Import Key</string> <string name="first_time_import_key">Import existing key</string>
<string name="first_time_skip">Skip Setup</string> <string name="first_time_skip">Skip Setup</string>
</resources> </resources>