aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui
diff options
context:
space:
mode:
authorVincent Breitmoser <valodim@mugenguild.com>2015-04-09 13:57:56 +0200
committerVincent Breitmoser <valodim@mugenguild.com>2015-04-09 13:57:56 +0200
commita4b7daf266b037c6a39cef0586aadedf32861ad5 (patch)
tree8446f6aae86530a8546caa99af6f9bac4f095370 /OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui
parentd27925ad19b6800658a69670ceaed261776ba6d3 (diff)
parentdcaac4f85f07efff2fdfd8a2eec9ba8ee758659c (diff)
downloadopen-keychain-a4b7daf266b037c6a39cef0586aadedf32861ad5.tar.gz
open-keychain-a4b7daf266b037c6a39cef0586aadedf32861ad5.tar.bz2
open-keychain-a4b7daf266b037c6a39cef0586aadedf32861ad5.zip
Merge branch 'development' into linked-identities
Conflicts: OpenKeychain/build.gradle OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui')
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CertifyKeyFragment.java11
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ConsolidateDialogActivity.java8
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyEmailFragment.java48
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyFinalFragment.java17
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptFilesFragment.java17
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptTextFragment.java10
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyFragment.java14
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptActivity.java10
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptTextActivity.java4
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/HelpAboutFragment.java13
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/HelpActivity.java19
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/HelpMarkdownFragment.java (renamed from OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/HelpHtmlFragment.java)26
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java32
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysProxyActivity.java8
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java186
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/SafeSlingerActivity.java8
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/UploadKeyActivity.java10
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java8
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyTrustFragment.java21
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/DeleteKeyDialogFragment.java11
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/ProgressDialogFragment.java44
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/linked/LinkedIdCreateFinalFragment.java8
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/linked/LinkedIdViewFragment.java4
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/CertListWidget.java2
24 files changed, 404 insertions, 135 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CertifyKeyFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CertifyKeyFragment.java
index b3738851c..9b6e8d8f9 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CertifyKeyFragment.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CertifyKeyFragment.java
@@ -55,9 +55,10 @@ import org.sufficientlysecure.keychain.provider.ProviderHelper;
import org.sufficientlysecure.keychain.service.CertifyActionsParcel;
import org.sufficientlysecure.keychain.service.CertifyActionsParcel.CertifyAction;
import org.sufficientlysecure.keychain.service.KeychainIntentService;
-import org.sufficientlysecure.keychain.service.KeychainIntentServiceHandler;
+import org.sufficientlysecure.keychain.service.ServiceProgressHandler;
import org.sufficientlysecure.keychain.service.PassphraseCacheService;
import org.sufficientlysecure.keychain.ui.adapter.MultiUserIdsAdapter;
+import org.sufficientlysecure.keychain.ui.dialog.ProgressDialogFragment;
import org.sufficientlysecure.keychain.ui.util.Notify;
import org.sufficientlysecure.keychain.ui.widget.CertifyKeySpinner;
import org.sufficientlysecure.keychain.ui.widget.KeySpinner;
@@ -388,8 +389,12 @@ public class CertifyKeyFragment extends LoaderFragment
} else {
// Message is received after signing is done in KeychainIntentService
- KeychainIntentServiceHandler saveHandler = new KeychainIntentServiceHandler(getActivity(),
- getString(R.string.progress_certifying), ProgressDialog.STYLE_SPINNER, true) {
+ ServiceProgressHandler saveHandler = new ServiceProgressHandler(
+ getActivity(),
+ getString(R.string.progress_certifying),
+ ProgressDialog.STYLE_SPINNER,
+ true,
+ ProgressDialogFragment.ServiceType.KEYCHAIN_INTENT) {
public void handleMessage(Message message) {
// handle messages by standard KeychainIntentServiceHandler first
super.handleMessage(message);
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ConsolidateDialogActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ConsolidateDialogActivity.java
index c55aad1f9..11ba3e287 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ConsolidateDialogActivity.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ConsolidateDialogActivity.java
@@ -26,7 +26,8 @@ import android.support.v4.app.FragmentActivity;
import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.service.KeychainIntentService;
-import org.sufficientlysecure.keychain.service.KeychainIntentServiceHandler;
+import org.sufficientlysecure.keychain.service.ServiceProgressHandler;
+import org.sufficientlysecure.keychain.ui.dialog.ProgressDialogFragment;
/**
* We can not directly create a dialog on the application context.
@@ -49,10 +50,11 @@ public class ConsolidateDialogActivity extends FragmentActivity {
private void consolidateRecovery(boolean recovery) {
// Message is received after importing is done in KeychainIntentService
- KeychainIntentServiceHandler saveHandler = new KeychainIntentServiceHandler(
+ ServiceProgressHandler saveHandler = new ServiceProgressHandler(
this,
getString(R.string.progress_importing),
- ProgressDialog.STYLE_HORIZONTAL) {
+ ProgressDialog.STYLE_HORIZONTAL,
+ ProgressDialogFragment.ServiceType.KEYCHAIN_INTENT) {
public void handleMessage(Message message) {
// handle messages by standard KeychainIntentServiceHandler first
super.handleMessage(message);
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyEmailFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyEmailFragment.java
index 2e8a1f370..7e2e1c31c 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyEmailFragment.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyEmailFragment.java
@@ -39,6 +39,7 @@ import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.ui.CreateKeyActivity.FragAction;
import org.sufficientlysecure.keychain.ui.dialog.AddEmailDialogFragment;
import org.sufficientlysecure.keychain.ui.dialog.SetPassphraseDialogFragment;
+import org.sufficientlysecure.keychain.ui.util.Notify;
import org.sufficientlysecure.keychain.ui.widget.EmailEditText;
import java.util.ArrayList;
@@ -122,16 +123,22 @@ public class CreateKeyEmailFragment extends Fragment {
mEmailsRecyclerView.setItemAnimator(new DefaultItemAnimator());
// initial values
- mAdditionalEmailModels = new ArrayList<>();
- if (mCreateKeyActivity.mAdditionalEmails != null) {
- setAdditionalEmails(mCreateKeyActivity.mAdditionalEmails);
- }
- mEmailAdapter = new EmailAdapter(mAdditionalEmailModels, new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- addEmail();
+ if (mAdditionalEmailModels == null) {
+ mAdditionalEmailModels = new ArrayList<>();
+ if (mCreateKeyActivity.mAdditionalEmails != null) {
+ setAdditionalEmails(mCreateKeyActivity.mAdditionalEmails);
}
- });
+ }
+
+ if (mEmailAdapter == null) {
+ mEmailAdapter = new EmailAdapter(mAdditionalEmailModels, new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ addEmail();
+ }
+ });
+ }
+
mEmailsRecyclerView.setAdapter(mEmailAdapter);
return view;
@@ -144,10 +151,27 @@ public class CreateKeyEmailFragment extends Fragment {
if (message.what == SetPassphraseDialogFragment.MESSAGE_OKAY) {
Bundle data = message.getData();
+ String email = data.getString(AddEmailDialogFragment.MESSAGE_DATA_EMAIL);
+
+ if (email.length() > 0 && mEmailEdit.getText().length() > 0 &&
+ email.equals(mEmailEdit.getText().toString())) {
+ Notify.create(getActivity(),
+ getString(R.string.create_key_email_already_exists_text),
+ Notify.LENGTH_LONG, Notify.Style.ERROR).show();
+ return;
+ }
+ //check for duplicated emails inside the adapter
+ for (EmailAdapter.ViewModel model : mAdditionalEmailModels) {
+ if (email.equals(model.email)) {
+ Notify.create(getActivity(),
+ getString(R.string.create_key_email_already_exists_text),
+ Notify.LENGTH_LONG, Notify.Style.ERROR).show();
+ return;
+ }
+ }
+
// add new user id
- mEmailAdapter.add(
- data.getString(AddEmailDialogFragment.MESSAGE_DATA_EMAIL)
- );
+ mEmailAdapter.add(email);
}
}
};
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyFinalFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyFinalFragment.java
index cbe3eecd4..b0a13c897 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyFinalFragment.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyFinalFragment.java
@@ -39,16 +39,15 @@ import org.sufficientlysecure.keychain.operations.results.OperationResult;
import org.sufficientlysecure.keychain.pgp.KeyRing;
import org.sufficientlysecure.keychain.provider.KeychainContract;
import org.sufficientlysecure.keychain.service.KeychainIntentService;
-import org.sufficientlysecure.keychain.service.KeychainIntentServiceHandler;
+import org.sufficientlysecure.keychain.service.ServiceProgressHandler;
import org.sufficientlysecure.keychain.service.SaveKeyringParcel;
import org.sufficientlysecure.keychain.service.SaveKeyringParcel.Algorithm;
import org.sufficientlysecure.keychain.service.SaveKeyringParcel.ChangeUnlockParcel;
import org.sufficientlysecure.keychain.ui.CreateKeyActivity.FragAction;
+import org.sufficientlysecure.keychain.ui.dialog.ProgressDialogFragment;
import org.sufficientlysecure.keychain.util.Log;
-import org.sufficientlysecure.keychain.util.Passphrase;
import org.sufficientlysecure.keychain.util.Preferences;
-import java.util.ArrayList;
import java.util.Iterator;
public class CreateKeyFinalFragment extends Fragment {
@@ -195,10 +194,11 @@ public class CreateKeyFinalFragment extends Fragment {
Intent intent = new Intent(getActivity(), KeychainIntentService.class);
intent.setAction(KeychainIntentService.ACTION_EDIT_KEYRING);
- KeychainIntentServiceHandler saveHandler = new KeychainIntentServiceHandler(
+ ServiceProgressHandler saveHandler = new ServiceProgressHandler(
getActivity(),
getString(R.string.progress_building_key),
- ProgressDialog.STYLE_HORIZONTAL) {
+ ProgressDialog.STYLE_HORIZONTAL,
+ ProgressDialogFragment.ServiceType.KEYCHAIN_INTENT) {
public void handleMessage(Message message) {
// handle messages by standard KeychainIntentServiceHandler first
super.handleMessage(message);
@@ -267,8 +267,11 @@ public class CreateKeyFinalFragment extends Fragment {
intent.putExtra(KeychainIntentService.EXTRA_DATA, data);
- KeychainIntentServiceHandler saveHandler = new KeychainIntentServiceHandler(getActivity(),
- getString(R.string.progress_uploading), ProgressDialog.STYLE_HORIZONTAL) {
+ ServiceProgressHandler saveHandler = new ServiceProgressHandler(
+ getActivity(),
+ getString(R.string.progress_uploading),
+ ProgressDialog.STYLE_HORIZONTAL,
+ ProgressDialogFragment.ServiceType.KEYCHAIN_INTENT) {
public void handleMessage(Message message) {
// handle messages by standard KeychainIntentServiceHandler first
super.handleMessage(message);
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptFilesFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptFilesFragment.java
index a92fb596c..c75e28145 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptFilesFragment.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptFilesFragment.java
@@ -38,8 +38,9 @@ import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.operations.results.DecryptVerifyResult;
import org.sufficientlysecure.keychain.service.KeychainIntentService;
import org.sufficientlysecure.keychain.service.KeychainIntentService.IOType;
-import org.sufficientlysecure.keychain.service.KeychainIntentServiceHandler;
+import org.sufficientlysecure.keychain.service.ServiceProgressHandler;
import org.sufficientlysecure.keychain.ui.dialog.DeleteFileDialogFragment;
+import org.sufficientlysecure.keychain.ui.dialog.ProgressDialogFragment;
import org.sufficientlysecure.keychain.ui.util.Notify;
import org.sufficientlysecure.keychain.util.FileHelper;
import org.sufficientlysecure.keychain.util.Log;
@@ -197,8 +198,11 @@ public class DecryptFilesFragment extends DecryptFragment {
intent.putExtra(KeychainIntentService.EXTRA_DATA, data);
// Message is received after decrypting is done in KeychainIntentService
- KeychainIntentServiceHandler saveHandler = new KeychainIntentServiceHandler(getActivity(),
- getString(R.string.progress_decrypting), ProgressDialog.STYLE_HORIZONTAL) {
+ ServiceProgressHandler saveHandler = new ServiceProgressHandler(
+ getActivity(),
+ getString(R.string.progress_decrypting),
+ ProgressDialog.STYLE_HORIZONTAL,
+ ProgressDialogFragment.ServiceType.KEYCHAIN_INTENT) {
public void handleMessage(Message message) {
// handle messages by standard KeychainIntentServiceHandler first
super.handleMessage(message);
@@ -271,8 +275,11 @@ public class DecryptFilesFragment extends DecryptFragment {
intent.putExtra(KeychainIntentService.EXTRA_DATA, data);
// Message is received after decrypting is done in KeychainIntentService
- KeychainIntentServiceHandler saveHandler = new KeychainIntentServiceHandler(getActivity(),
- getString(R.string.progress_decrypting), ProgressDialog.STYLE_HORIZONTAL) {
+ ServiceProgressHandler saveHandler = new ServiceProgressHandler(
+ getActivity(),
+ getString(R.string.progress_decrypting),
+ ProgressDialog.STYLE_HORIZONTAL,
+ ProgressDialogFragment.ServiceType.KEYCHAIN_INTENT) {
public void handleMessage(Message message) {
// handle messages by standard KeychainIntentServiceHandler first
super.handleMessage(message);
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptTextFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptTextFragment.java
index 80a07214b..f6e21937d 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptTextFragment.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptTextFragment.java
@@ -37,7 +37,8 @@ import org.sufficientlysecure.keychain.compatibility.ClipboardReflection;
import org.sufficientlysecure.keychain.operations.results.DecryptVerifyResult;
import org.sufficientlysecure.keychain.service.KeychainIntentService;
import org.sufficientlysecure.keychain.service.KeychainIntentService.IOType;
-import org.sufficientlysecure.keychain.service.KeychainIntentServiceHandler;
+import org.sufficientlysecure.keychain.service.ServiceProgressHandler;
+import org.sufficientlysecure.keychain.ui.dialog.ProgressDialogFragment;
import org.sufficientlysecure.keychain.ui.util.Notify;
import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.ShareHelper;
@@ -167,8 +168,11 @@ public class DecryptTextFragment extends DecryptFragment {
intent.putExtra(KeychainIntentService.EXTRA_DATA, data);
// Message is received after encrypting is done in KeychainIntentService
- KeychainIntentServiceHandler saveHandler = new KeychainIntentServiceHandler(getActivity(),
- getString(R.string.progress_decrypting), ProgressDialog.STYLE_HORIZONTAL) {
+ ServiceProgressHandler saveHandler = new ServiceProgressHandler(
+ getActivity(),
+ getString(R.string.progress_decrypting),
+ ProgressDialog.STYLE_HORIZONTAL,
+ ProgressDialogFragment.ServiceType.KEYCHAIN_INTENT) {
public void handleMessage(Message message) {
// handle messages by standard KeychainIntentServiceHandler first
super.handleMessage(message);
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyFragment.java
index 86fb8dc80..1e4b506d4 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyFragment.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyFragment.java
@@ -50,7 +50,7 @@ import org.sufficientlysecure.keychain.provider.KeychainContract.UserPackets;
import org.sufficientlysecure.keychain.provider.ProviderHelper;
import org.sufficientlysecure.keychain.provider.ProviderHelper.NotFoundException;
import org.sufficientlysecure.keychain.service.KeychainIntentService;
-import org.sufficientlysecure.keychain.service.KeychainIntentServiceHandler;
+import org.sufficientlysecure.keychain.service.ServiceProgressHandler;
import org.sufficientlysecure.keychain.service.PassphraseCacheService;
import org.sufficientlysecure.keychain.service.SaveKeyringParcel;
import org.sufficientlysecure.keychain.service.SaveKeyringParcel.ChangeUnlockParcel;
@@ -59,12 +59,7 @@ import org.sufficientlysecure.keychain.ui.adapter.SubkeysAdapter;
import org.sufficientlysecure.keychain.ui.adapter.SubkeysAddedAdapter;
import org.sufficientlysecure.keychain.ui.adapter.UserIdsAdapter;
import org.sufficientlysecure.keychain.ui.adapter.UserIdsAddedAdapter;
-import org.sufficientlysecure.keychain.ui.dialog.AddSubkeyDialogFragment;
-import org.sufficientlysecure.keychain.ui.dialog.AddUserIdDialogFragment;
-import org.sufficientlysecure.keychain.ui.dialog.EditSubkeyDialogFragment;
-import org.sufficientlysecure.keychain.ui.dialog.EditSubkeyExpiryDialogFragment;
-import org.sufficientlysecure.keychain.ui.dialog.EditUserIdDialogFragment;
-import org.sufficientlysecure.keychain.ui.dialog.SetPassphraseDialogFragment;
+import org.sufficientlysecure.keychain.ui.dialog.*;
import org.sufficientlysecure.keychain.ui.util.Notify;
import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.Passphrase;
@@ -597,11 +592,12 @@ public class EditKeyFragment extends LoaderFragment implements
private void saveInDatabase(Passphrase passphrase) {
Log.d(Constants.TAG, "mSaveKeyringParcel:\n" + mSaveKeyringParcel.toString());
- KeychainIntentServiceHandler saveHandler = new KeychainIntentServiceHandler(
+ ServiceProgressHandler saveHandler = new ServiceProgressHandler(
getActivity(),
getString(R.string.progress_saving),
ProgressDialog.STYLE_HORIZONTAL,
- true) {
+ true,
+ ProgressDialogFragment.ServiceType.KEYCHAIN_INTENT) {
public void handleMessage(Message message) {
// handle messages by standard KeychainIntentServiceHandler first
super.handleMessage(message);
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptActivity.java
index 5438f667c..cd1028de4 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptActivity.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptActivity.java
@@ -31,7 +31,8 @@ import org.sufficientlysecure.keychain.operations.results.PgpSignEncryptResult;
import org.sufficientlysecure.keychain.operations.results.SignEncryptResult;
import org.sufficientlysecure.keychain.pgp.SignEncryptParcel;
import org.sufficientlysecure.keychain.service.KeychainIntentService;
-import org.sufficientlysecure.keychain.service.KeychainIntentServiceHandler;
+import org.sufficientlysecure.keychain.service.ServiceProgressHandler;
+import org.sufficientlysecure.keychain.ui.dialog.ProgressDialogFragment;
import org.sufficientlysecure.keychain.util.Passphrase;
import java.util.Date;
@@ -123,8 +124,11 @@ public abstract class EncryptActivity extends BaseActivity {
intent.putExtra(KeychainIntentService.EXTRA_DATA, data);
// Message is received after encrypting is done in KeychainIntentService
- KeychainIntentServiceHandler serviceHandler = new KeychainIntentServiceHandler(this,
- getString(R.string.progress_encrypting), ProgressDialog.STYLE_HORIZONTAL) {
+ ServiceProgressHandler serviceHandler = new ServiceProgressHandler(
+ this,
+ getString(R.string.progress_encrypting),
+ ProgressDialog.STYLE_HORIZONTAL,
+ ProgressDialogFragment.ServiceType.KEYCHAIN_INTENT) {
public void handleMessage(Message message) {
// handle messages by standard KeychainIntentServiceHandler first
super.handleMessage(message);
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptTextActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptTextActivity.java
index c800153ae..dd09e62c3 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptTextActivity.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptTextActivity.java
@@ -136,7 +136,9 @@ public class EncryptTextActivity extends EncryptActivity implements EncryptActiv
@Override
public void setPassphrase(Passphrase passphrase) {
- mPassphrase.removeFromMemory();
+ if (mPassphrase != null) {
+ mPassphrase.removeFromMemory();
+ }
mPassphrase = passphrase;
}
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/HelpAboutFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/HelpAboutFragment.java
index 5909970af..ac4b94d64 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/HelpAboutFragment.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/HelpAboutFragment.java
@@ -27,11 +27,14 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
+import org.markdown4j.Markdown4jProcessor;
import org.sufficientlysecure.htmltextview.HtmlTextView;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.util.Log;
+import java.io.IOException;
+
public class HelpAboutFragment extends Fragment {
@@ -44,8 +47,14 @@ public class HelpAboutFragment extends Fragment {
HtmlTextView aboutTextView = (HtmlTextView) view.findViewById(R.id.help_about_text);
- // load html from raw resource (Parsing handled by HtmlTextView library)
- aboutTextView.setHtmlFromRawResource(getActivity(), R.raw.help_about, true);
+ // load markdown from raw resource
+ try {
+ String html = new Markdown4jProcessor().process(
+ getActivity().getResources().openRawResource(R.raw.help_about));
+ aboutTextView.setHtmlFromString(html, true);
+ } catch (IOException e) {
+ Log.e(Constants.TAG, "IOException", e);
+ }
// no flickering when clicking textview for Android < 4
aboutTextView.setTextColor(getResources().getColor(android.R.color.black));
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/HelpActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/HelpActivity.java
index cd6cdf4d6..6c3336547 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/HelpActivity.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/HelpActivity.java
@@ -64,18 +64,23 @@ public class HelpActivity extends BaseActivity {
}
Bundle startBundle = new Bundle();
- startBundle.putInt(HelpHtmlFragment.ARG_HTML_FILE, R.raw.help_start);
- mTabsAdapter.addTab(HelpHtmlFragment.class, startBundle,
+ startBundle.putInt(HelpMarkdownFragment.ARG_MARKDOWN_RES, R.raw.help_start);
+ mTabsAdapter.addTab(HelpMarkdownFragment.class, startBundle,
getString(R.string.help_tab_start));
- Bundle wotBundle = new Bundle();
- wotBundle.putInt(HelpHtmlFragment.ARG_HTML_FILE, R.raw.help_certification);
- mTabsAdapter.addTab(HelpHtmlFragment.class, wotBundle,
+ Bundle certificationBundle = new Bundle();
+ certificationBundle.putInt(HelpMarkdownFragment.ARG_MARKDOWN_RES, R.raw.help_certification);
+ mTabsAdapter.addTab(HelpMarkdownFragment.class, certificationBundle,
getString(R.string.help_tab_wot));
+ Bundle faqBundle = new Bundle();
+ faqBundle.putInt(HelpMarkdownFragment.ARG_MARKDOWN_RES, R.raw.help_faq);
+ mTabsAdapter.addTab(HelpMarkdownFragment.class, faqBundle,
+ getString(R.string.help_tab_faq));
+
Bundle changelogBundle = new Bundle();
- changelogBundle.putInt(HelpHtmlFragment.ARG_HTML_FILE, R.raw.help_changelog);
- mTabsAdapter.addTab(HelpHtmlFragment.class, changelogBundle,
+ changelogBundle.putInt(HelpMarkdownFragment.ARG_MARKDOWN_RES, R.raw.help_changelog);
+ mTabsAdapter.addTab(HelpMarkdownFragment.class, changelogBundle,
getString(R.string.help_tab_changelog));
mTabsAdapter.addTab(HelpAboutFragment.class, null,
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/HelpHtmlFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/HelpMarkdownFragment.java
index a3f0ef614..97d39feb1 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/HelpHtmlFragment.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/HelpMarkdownFragment.java
@@ -26,24 +26,29 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.ScrollView;
+import org.markdown4j.Markdown4jProcessor;
import org.sufficientlysecure.htmltextview.HtmlTextView;
+import org.sufficientlysecure.keychain.Constants;
+import org.sufficientlysecure.keychain.util.Log;
-public class HelpHtmlFragment extends Fragment {
+import java.io.IOException;
+
+public class HelpMarkdownFragment extends Fragment {
private Activity mActivity;
private int mHtmlFile;
- public static final String ARG_HTML_FILE = "htmlFile";
+ public static final String ARG_MARKDOWN_RES = "htmlFile";
/**
* Create a new instance of HelpHtmlFragment, providing "htmlFile" as an argument.
*/
- static HelpHtmlFragment newInstance(int htmlFile) {
- HelpHtmlFragment f = new HelpHtmlFragment();
+ static HelpMarkdownFragment newInstance(int markdownRes) {
+ HelpMarkdownFragment f = new HelpMarkdownFragment();
// Supply html raw file input as an argument.
Bundle args = new Bundle();
- args.putInt(ARG_HTML_FILE, htmlFile);
+ args.putInt(ARG_MARKDOWN_RES, markdownRes);
f.setArguments(args);
return f;
@@ -53,7 +58,7 @@ public class HelpHtmlFragment extends Fragment {
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
mActivity = getActivity();
- mHtmlFile = getArguments().getInt(ARG_HTML_FILE);
+ mHtmlFile = getArguments().getInt(ARG_MARKDOWN_RES);
ScrollView scroller = new ScrollView(mActivity);
HtmlTextView text = new HtmlTextView(mActivity);
@@ -65,8 +70,13 @@ public class HelpHtmlFragment extends Fragment {
scroller.addView(text);
- // load html from raw resource (Parsing handled by HtmlTextView library)
- text.setHtmlFromRawResource(getActivity(), mHtmlFile, true);
+ // load markdown from raw resource
+ try {
+ String html = new Markdown4jProcessor().process(getActivity().getResources().openRawResource(mHtmlFile));
+ text.setHtmlFromString(html, true);
+ } catch (IOException e) {
+ Log.e(Constants.TAG, "IOException", e);
+ }
// no flickering when clicking textview for Android < 4
text.setTextColor(getResources().getColor(android.R.color.black));
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java
index 9143609ad..dc4a2eb10 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java
@@ -35,8 +35,9 @@ import org.sufficientlysecure.keychain.keyimport.ImportKeysListEntry;
import org.sufficientlysecure.keychain.keyimport.ParcelableKeyRing;
import org.sufficientlysecure.keychain.operations.results.ImportKeyResult;
import org.sufficientlysecure.keychain.operations.results.OperationResult;
-import org.sufficientlysecure.keychain.service.KeychainIntentService;
-import org.sufficientlysecure.keychain.service.KeychainIntentServiceHandler;
+import org.sufficientlysecure.keychain.service.CloudImportService;
+import org.sufficientlysecure.keychain.service.ServiceProgressHandler;
+import org.sufficientlysecure.keychain.ui.dialog.ProgressDialogFragment;
import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils;
import org.sufficientlysecure.keychain.ui.util.Notify;
import org.sufficientlysecure.keychain.util.Log;
@@ -294,12 +295,13 @@ public class ImportKeysActivity extends BaseActivity {
* Import keys with mImportData
*/
public void importKeys() {
- // Message is received after importing is done in KeychainIntentService
- KeychainIntentServiceHandler saveHandler = new KeychainIntentServiceHandler(
+ // Message is received after importing is done in CloudImportService
+ ServiceProgressHandler saveHandler = new ServiceProgressHandler(
this,
getString(R.string.progress_importing),
ProgressDialog.STYLE_HORIZONTAL,
- true) {
+ true,
+ ProgressDialogFragment.ServiceType.CLOUD_IMPORT) {
public void handleMessage(Message message) {
// handle messages by standard KeychainIntentServiceHandler first
super.handleMessage(message);
@@ -342,9 +344,7 @@ public class ImportKeysActivity extends BaseActivity {
Log.d(Constants.TAG, "importKeys started");
// Send all information needed to service to import key in other thread
- Intent intent = new Intent(this, KeychainIntentService.class);
-
- intent.setAction(KeychainIntentService.ACTION_IMPORT_KEYRING);
+ Intent intent = new Intent(this, CloudImportService.class);
// fill values for this action
Bundle data = new Bundle();
@@ -362,11 +362,11 @@ public class ImportKeysActivity extends BaseActivity {
new ParcelableFileCache<>(this, "key_import.pcl");
cache.writeCache(selectedEntries);
- intent.putExtra(KeychainIntentService.EXTRA_DATA, data);
+ intent.putExtra(CloudImportService.EXTRA_DATA, data);
// Create a new Messenger for the communication back
Messenger messenger = new Messenger(saveHandler);
- intent.putExtra(KeychainIntentService.EXTRA_MESSENGER, messenger);
+ intent.putExtra(CloudImportService.EXTRA_MESSENGER, messenger);
// show progress dialog
saveHandler.showProgressDialog(this);
@@ -382,14 +382,12 @@ public class ImportKeysActivity extends BaseActivity {
ImportKeysListFragment.CloudLoaderState sls = (ImportKeysListFragment.CloudLoaderState) ls;
// Send all information needed to service to query keys in other thread
- Intent intent = new Intent(this, KeychainIntentService.class);
-
- intent.setAction(KeychainIntentService.ACTION_IMPORT_KEYRING);
+ Intent intent = new Intent(this, CloudImportService.class);
// fill values for this action
Bundle data = new Bundle();
- data.putString(KeychainIntentService.IMPORT_KEY_SERVER, sls.mCloudPrefs.keyserver);
+ data.putString(CloudImportService.IMPORT_KEY_SERVER, sls.mCloudPrefs.keyserver);
// get selected key entries
ArrayList<ParcelableKeyRing> keys = new ArrayList<>();
@@ -402,13 +400,13 @@ public class ImportKeysActivity extends BaseActivity {
);
}
}
- data.putParcelableArrayList(KeychainIntentService.IMPORT_KEY_LIST, keys);
+ data.putParcelableArrayList(CloudImportService.IMPORT_KEY_LIST, keys);
- intent.putExtra(KeychainIntentService.EXTRA_DATA, data);
+ intent.putExtra(CloudImportService.EXTRA_DATA, data);
// Create a new Messenger for the communication back
Messenger messenger = new Messenger(saveHandler);
- intent.putExtra(KeychainIntentService.EXTRA_MESSENGER, messenger);
+ intent.putExtra(CloudImportService.EXTRA_MESSENGER, messenger);
// show progress dialog
saveHandler.showProgressDialog(this);
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysProxyActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysProxyActivity.java
index 1c1e5fe99..21747f77b 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysProxyActivity.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysProxyActivity.java
@@ -42,7 +42,8 @@ import org.sufficientlysecure.keychain.operations.results.ImportKeyResult;
import org.sufficientlysecure.keychain.operations.results.OperationResult;
import org.sufficientlysecure.keychain.operations.results.SingletonResult;
import org.sufficientlysecure.keychain.service.KeychainIntentService;
-import org.sufficientlysecure.keychain.service.KeychainIntentServiceHandler;
+import org.sufficientlysecure.keychain.service.ServiceProgressHandler;
+import org.sufficientlysecure.keychain.ui.dialog.ProgressDialogFragment;
import org.sufficientlysecure.keychain.util.IntentIntegratorSupportV4;
import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.Preferences;
@@ -213,11 +214,12 @@ public class ImportKeysProxyActivity extends FragmentActivity {
private void startImportService (ArrayList<ParcelableKeyRing> keyRings) {
// Message is received after importing is done in KeychainIntentService
- KeychainIntentServiceHandler serviceHandler = new KeychainIntentServiceHandler(
+ ServiceProgressHandler serviceHandler = new ServiceProgressHandler(
this,
getString(R.string.progress_importing),
ProgressDialog.STYLE_HORIZONTAL,
- true) {
+ true,
+ ProgressDialogFragment.ServiceType.KEYCHAIN_INTENT) {
public void handleMessage(Message message) {
// handle messages by standard KeychainIntentServiceHandler first
super.handleMessage(message);
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java
index d9156e628..36ed99f69 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java
@@ -20,6 +20,7 @@ package org.sufficientlysecure.keychain.ui;
import android.animation.ObjectAnimator;
import android.annotation.TargetApi;
+import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
@@ -54,16 +55,24 @@ import com.getbase.floatingactionbutton.FloatingActionsMenu;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R;
+import org.sufficientlysecure.keychain.keyimport.ParcelableKeyRing;
import org.sufficientlysecure.keychain.operations.results.ConsolidateResult;
import org.sufficientlysecure.keychain.operations.results.DeleteResult;
+import org.sufficientlysecure.keychain.operations.results.ImportKeyResult;
import org.sufficientlysecure.keychain.operations.results.OperationResult;
import org.sufficientlysecure.keychain.provider.KeychainContract;
import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings;
import org.sufficientlysecure.keychain.provider.KeychainDatabase;
+import org.sufficientlysecure.keychain.provider.ProviderHelper;
+import org.sufficientlysecure.keychain.service.CloudImportService;
import org.sufficientlysecure.keychain.service.KeychainIntentService;
-import org.sufficientlysecure.keychain.service.KeychainIntentServiceHandler;
import org.sufficientlysecure.keychain.ui.adapter.KeyAdapter;
import org.sufficientlysecure.keychain.ui.dialog.DeleteKeyDialogFragment;
+import org.sufficientlysecure.keychain.service.ServiceProgressHandler;
+import org.sufficientlysecure.keychain.service.PassphraseCacheService;
+import org.sufficientlysecure.keychain.ui.dialog.DeleteKeyDialogFragment;
+import org.sufficientlysecure.keychain.ui.dialog.ProgressDialogFragment;
+import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils;
import org.sufficientlysecure.keychain.ui.util.Notify;
import org.sufficientlysecure.keychain.util.ExportHelper;
import org.sufficientlysecure.keychain.util.FabContainer;
@@ -71,6 +80,7 @@ import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.Preferences;
import java.io.IOException;
+import java.util.ArrayList;
import java.util.HashMap;
import se.emilsjolander.stickylistheaders.StickyListHeadersAdapter;
@@ -84,6 +94,9 @@ public class KeyListFragment extends LoaderFragment
implements SearchView.OnQueryTextListener, AdapterView.OnItemClickListener,
LoaderManager.LoaderCallbacks<Cursor>, FabContainer {
+ static final int REQUEST_REPEAT_PASSPHRASE = 1;
+ static final int REQUEST_ACTION = 2;
+
ExportHelper mExportHelper;
private KeyListAdapter mAdapter;
@@ -96,6 +109,11 @@ public class KeyListFragment extends LoaderFragment
private FloatingActionsMenu mFab;
+ // This ids for multiple key export.
+ private ArrayList<Long> mIdsForRepeatAskPassphrase;
+ // This index for remembering the number of master key.
+ private int mIndex;
+
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -218,9 +236,7 @@ public class KeyListFragment extends LoaderFragment
}
case R.id.menu_key_list_multi_export: {
ids = mAdapter.getCurrentSelectedMasterKeyIds();
- ExportHelper mExportHelper = new ExportHelper(getActivity());
- mExportHelper.showExportKeysDialog(ids, Constants.Path.APP_DIR_FILE,
- mAdapter.isAnySecretSelected());
+ showMultiExportDialog(ids);
break;
}
case R.id.menu_key_list_multi_select_all: {
@@ -351,7 +367,7 @@ public class KeyListFragment extends LoaderFragment
intent.setAction(EncryptFilesActivity.ACTION_ENCRYPT_DATA);
intent.putExtra(EncryptFilesActivity.EXTRA_ENCRYPTION_KEY_IDS, masterKeyIds);
// used instead of startActivity set actionbar based on callingPackage
- startActivityForResult(intent, 0);
+ startActivityForResult(intent, REQUEST_ACTION);
mode.finish();
}
@@ -451,6 +467,10 @@ public class KeyListFragment extends LoaderFragment
mExportHelper.showExportKeysDialog(null, Constants.Path.APP_DIR_FILE, true);
return true;
+ case R.id.menu_key_list_update_all_keys:
+ updateAllKeys();
+ return true;
+
case R.id.menu_key_list_debug_cons:
consolidate();
return true;
@@ -521,26 +541,104 @@ public class KeyListFragment extends LoaderFragment
private void scanQrCode() {
Intent scanQrCode = new Intent(getActivity(), ImportKeysProxyActivity.class);
scanQrCode.setAction(ImportKeysProxyActivity.ACTION_SCAN_IMPORT);
- startActivityForResult(scanQrCode, 0);
+ startActivityForResult(scanQrCode, REQUEST_ACTION);
}
private void importFile() {
Intent intentImportExisting = new Intent(getActivity(), ImportKeysActivity.class);
intentImportExisting.setAction(ImportKeysActivity.ACTION_IMPORT_KEY_FROM_FILE_AND_RETURN);
- startActivityForResult(intentImportExisting, 0);
+ startActivityForResult(intentImportExisting, REQUEST_ACTION);
}
private void createKey() {
Intent intent = new Intent(getActivity(), CreateKeyActivity.class);
- startActivityForResult(intent, 0);
+ startActivityForResult(intent, REQUEST_ACTION);
+ }
+
+ private void updateAllKeys() {
+ Context context = getActivity();
+
+ ProviderHelper providerHelper = new ProviderHelper(context);
+
+ Cursor cursor = providerHelper.getContentResolver().query(
+ KeyRings.buildUnifiedKeyRingsUri(), new String[]{
+ KeyRings.FINGERPRINT
+ }, null, null, null
+ );
+
+ ArrayList<ParcelableKeyRing> keyList = new ArrayList<>();
+
+ while (cursor.moveToNext()) {
+ byte[] blob = cursor.getBlob(0);//fingerprint column is 0
+ String fingerprint = KeyFormattingUtils.convertFingerprintToHex(blob);
+ ParcelableKeyRing keyEntry = new ParcelableKeyRing(fingerprint, null, null);
+ keyList.add(keyEntry);
+ }
+
+ ServiceProgressHandler serviceHandler = new ServiceProgressHandler(
+ getActivity(),
+ getString(R.string.progress_updating),
+ ProgressDialog.STYLE_HORIZONTAL,
+ true,
+ ProgressDialogFragment.ServiceType.CLOUD_IMPORT) {
+ public void handleMessage(Message message) {
+ // handle messages by standard KeychainIntentServiceHandler first
+ super.handleMessage(message);
+
+ if (message.arg1 == MessageStatus.OKAY.ordinal()) {
+ // get returned data bundle
+ Bundle returnData = message.getData();
+ if (returnData == null) {
+ return;
+ }
+ final ImportKeyResult result =
+ returnData.getParcelable(OperationResult.EXTRA_RESULT);
+ if (result == null) {
+ Log.e(Constants.TAG, "result == null");
+ return;
+ }
+
+ result.createNotify(getActivity()).show();
+ }
+ }
+ };
+
+ // Send all information needed to service to query keys in other thread
+ Intent intent = new Intent(getActivity(), CloudImportService.class);
+
+ // fill values for this action
+ Bundle data = new Bundle();
+
+ // search config
+ {
+ Preferences prefs = Preferences.getPreferences(getActivity());
+ Preferences.CloudSearchPrefs cloudPrefs =
+ new Preferences.CloudSearchPrefs(true, true, prefs.getPreferredKeyserver());
+ data.putString(CloudImportService.IMPORT_KEY_SERVER, cloudPrefs.keyserver);
+ }
+
+ data.putParcelableArrayList(CloudImportService.IMPORT_KEY_LIST, keyList);
+
+ intent.putExtra(CloudImportService.EXTRA_DATA, data);
+
+ // Create a new Messenger for the communication back
+ Messenger messenger = new Messenger(serviceHandler);
+ intent.putExtra(CloudImportService.EXTRA_MESSENGER, messenger);
+
+ // show progress dialog
+ serviceHandler.showProgressDialog(getActivity());
+
+ // start service with intent
+ getActivity().startService(intent);
}
private void consolidate() {
// Message is received after importing is done in KeychainIntentService
- KeychainIntentServiceHandler saveHandler = new KeychainIntentServiceHandler(
+ ServiceProgressHandler saveHandler = new ServiceProgressHandler(
getActivity(),
getString(R.string.progress_importing),
- ProgressDialog.STYLE_HORIZONTAL) {
+ ProgressDialog.STYLE_HORIZONTAL,
+ ProgressDialogFragment.ServiceType.KEYCHAIN_INTENT) {
public void handleMessage(Message message) {
// handle messages by standard KeychainIntentServiceHandler first
super.handleMessage(message);
@@ -583,14 +681,68 @@ public class KeyListFragment extends LoaderFragment
getActivity().startService(intent);
}
+ private void showMultiExportDialog(long[] masterKeyIds) {
+ mIdsForRepeatAskPassphrase = new ArrayList<Long>();
+ for(long id: masterKeyIds) {
+ try {
+ if (PassphraseCacheService.getCachedPassphrase(
+ getActivity(), id, id) == null) {
+ mIdsForRepeatAskPassphrase.add(Long.valueOf(id));
+ }
+ } catch (PassphraseCacheService.KeyNotFoundException e) {
+ // This happens when the master key is stripped
+ // and ignore this key.
+ continue;
+ }
+ }
+ mIndex = 0;
+ if (mIdsForRepeatAskPassphrase.size() != 0) {
+ startPassphraseActivity();
+ return;
+ }
+ long[] idsForMultiExport = new long[mIdsForRepeatAskPassphrase.size()];
+ for(int i=0; i<mIdsForRepeatAskPassphrase.size(); ++i) {
+ idsForMultiExport[i] = mIdsForRepeatAskPassphrase.get(i).longValue();
+ }
+ mExportHelper.showExportKeysDialog(idsForMultiExport,
+ Constants.Path.APP_DIR_FILE,
+ mAdapter.isAnySecretSelected());
+ }
+
+ private void startPassphraseActivity() {
+ Intent intent = new Intent(getActivity(), PassphraseDialogActivity.class);
+ long masterKeyId = mIdsForRepeatAskPassphrase.get(mIndex++).longValue();
+ intent.putExtra(PassphraseDialogActivity.EXTRA_SUBKEY_ID, masterKeyId);
+ startActivityForResult(intent, REQUEST_REPEAT_PASSPHRASE);
+ }
+
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
- // if a result has been returned, display a notify
- if (data != null && data.hasExtra(OperationResult.EXTRA_RESULT)) {
- OperationResult result = data.getParcelableExtra(OperationResult.EXTRA_RESULT);
- result.createNotify(getActivity()).show();
- } else {
- super.onActivityResult(requestCode, resultCode, data);
+ if (requestCode == REQUEST_REPEAT_PASSPHRASE) {
+ if(resultCode != Activity.RESULT_OK) {
+ return;
+ }
+ if (mIndex < mIdsForRepeatAskPassphrase.size()) {
+ startPassphraseActivity();
+ return;
+ }
+ long[] idsForMultiExport = new long[mIdsForRepeatAskPassphrase.size()];
+ for(int i=0; i<mIdsForRepeatAskPassphrase.size(); ++i) {
+ idsForMultiExport[i] = mIdsForRepeatAskPassphrase.get(i).longValue();
+ }
+ mExportHelper.showExportKeysDialog(idsForMultiExport,
+ Constants.Path.APP_DIR_FILE,
+ mAdapter.isAnySecretSelected());
+ }
+
+ if (requestCode == REQUEST_ACTION) {
+ // if a result has been returned, display a notify
+ if (data != null && data.hasExtra(OperationResult.EXTRA_RESULT)) {
+ OperationResult result = data.getParcelableExtra(OperationResult.EXTRA_RESULT);
+ result.createNotify(getActivity()).show();
+ } else {
+ super.onActivityResult(requestCode, resultCode, data);
+ }
}
}
@@ -632,7 +784,7 @@ public class KeyListFragment extends LoaderFragment
if (holder.mMasterKeyId != null) {
Intent safeSlingerIntent = new Intent(mContext, SafeSlingerActivity.class);
safeSlingerIntent.putExtra(SafeSlingerActivity.EXTRA_MASTER_KEY_ID, holder.mMasterKeyId);
- startActivityForResult(safeSlingerIntent, 0);
+ startActivityForResult(safeSlingerIntent, REQUEST_ACTION);
}
}
});
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/SafeSlingerActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/SafeSlingerActivity.java
index 863aef65f..c58a945d3 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/SafeSlingerActivity.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/SafeSlingerActivity.java
@@ -39,7 +39,8 @@ import org.sufficientlysecure.keychain.operations.results.OperationResult;
import org.sufficientlysecure.keychain.provider.KeychainContract;
import org.sufficientlysecure.keychain.provider.ProviderHelper;
import org.sufficientlysecure.keychain.service.KeychainIntentService;
-import org.sufficientlysecure.keychain.service.KeychainIntentServiceHandler;
+import org.sufficientlysecure.keychain.service.ServiceProgressHandler;
+import org.sufficientlysecure.keychain.ui.dialog.ProgressDialogFragment;
import org.sufficientlysecure.keychain.ui.util.Notify;
import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.ParcelableFileCache;
@@ -123,11 +124,12 @@ public class SafeSlingerActivity extends BaseActivity {
final FragmentActivity activity = SafeSlingerActivity.this;
// Message is received after importing is done in KeychainIntentService
- KeychainIntentServiceHandler saveHandler = new KeychainIntentServiceHandler(
+ ServiceProgressHandler saveHandler = new ServiceProgressHandler(
activity,
getString(R.string.progress_importing),
ProgressDialog.STYLE_HORIZONTAL,
- true) {
+ true,
+ ProgressDialogFragment.ServiceType.KEYCHAIN_INTENT) {
public void handleMessage(Message message) {
// handle messages by standard KeychainIntentServiceHandler first
super.handleMessage(message);
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/UploadKeyActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/UploadKeyActivity.java
index 4fb2074a5..c518cbcdb 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/UploadKeyActivity.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/UploadKeyActivity.java
@@ -36,7 +36,8 @@ import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.provider.KeychainContract;
import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings;
import org.sufficientlysecure.keychain.service.KeychainIntentService;
-import org.sufficientlysecure.keychain.service.KeychainIntentServiceHandler;
+import org.sufficientlysecure.keychain.service.ServiceProgressHandler;
+import org.sufficientlysecure.keychain.ui.dialog.ProgressDialogFragment;
import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.Preferences;
@@ -107,8 +108,11 @@ public class UploadKeyActivity extends BaseActivity {
intent.putExtra(KeychainIntentService.EXTRA_DATA, data);
// Message is received after uploading is done in KeychainIntentService
- KeychainIntentServiceHandler saveHandler = new KeychainIntentServiceHandler(this,
- getString(R.string.progress_uploading), ProgressDialog.STYLE_HORIZONTAL) {
+ ServiceProgressHandler saveHandler = new ServiceProgressHandler(
+ this,
+ getString(R.string.progress_uploading),
+ ProgressDialog.STYLE_HORIZONTAL,
+ ProgressDialogFragment.ServiceType.KEYCHAIN_INTENT) {
public void handleMessage(Message message) {
// handle messages by standard KeychainIntentServiceHandler first
super.handleMessage(message);
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 435a455dc..ad35d2833 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java
@@ -64,9 +64,9 @@ import org.sufficientlysecure.keychain.pgp.exception.PgpKeyNotFoundException;
import org.sufficientlysecure.keychain.provider.KeychainContract;
import org.sufficientlysecure.keychain.provider.ProviderHelper;
import org.sufficientlysecure.keychain.service.KeychainIntentService;
-import org.sufficientlysecure.keychain.service.KeychainIntentServiceHandler;
import org.sufficientlysecure.keychain.ui.linked.LinkedIdWizard;
-import org.sufficientlysecure.keychain.service.KeychainIntentServiceHandler.MessageStatus;
+import org.sufficientlysecure.keychain.service.ServiceProgressHandler;
+import org.sufficientlysecure.keychain.service.ServiceProgressHandler.MessageStatus;
import org.sufficientlysecure.keychain.service.PassphraseCacheService;
import org.sufficientlysecure.keychain.ui.dialog.DeleteKeyDialogFragment;
import org.sufficientlysecure.keychain.ui.util.FormattingUtils;
@@ -378,7 +378,7 @@ public class ViewKeyActivity extends BaseActivity implements
private void startCertifyIntent(Intent intent) {
// Message is received after signing is done in KeychainIntentService
- KeychainIntentServiceHandler saveHandler = new KeychainIntentServiceHandler(this) {
+ ServiceProgressHandler saveHandler = new ServiceProgressHandler(this) {
public void handleMessage(Message message) {
// handle messages by standard KeychainIntentServiceHandler first
super.handleMessage(message);
@@ -553,7 +553,7 @@ public class ViewKeyActivity extends BaseActivity implements
entries.add(keyEntry);
// Message is received after importing is done in KeychainIntentService
- KeychainIntentServiceHandler serviceHandler = new KeychainIntentServiceHandler(this) {
+ ServiceProgressHandler serviceHandler = new ServiceProgressHandler(this) {
public void handleMessage(Message message) {
// handle messages by standard KeychainIntentServiceHandler first
super.handleMessage(message);
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyTrustFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyTrustFragment.java
index e20796f8f..d5870d8c5 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyTrustFragment.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyTrustFragment.java
@@ -50,12 +50,12 @@ import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings;
import org.sufficientlysecure.keychain.service.KeychainIntentService;
-import org.sufficientlysecure.keychain.service.KeychainIntentServiceHandler;
+import org.sufficientlysecure.keychain.service.ServiceProgressHandler;
+import org.sufficientlysecure.keychain.ui.dialog.ProgressDialogFragment;
import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils;
import org.sufficientlysecure.keychain.util.Log;
import java.util.ArrayList;
-import java.util.Date;
import java.util.Hashtable;
import java.util.List;
@@ -362,23 +362,26 @@ public class ViewKeyTrustFragment extends LoaderFragment implements
// Create a new Messenger for the communication back after proof work is done
//
- KeychainIntentServiceHandler handler = new KeychainIntentServiceHandler(getActivity(),
- getString(R.string.progress_verifying_signature), ProgressDialog.STYLE_HORIZONTAL) {
+ ServiceProgressHandler handler = new ServiceProgressHandler(
+ getActivity(),
+ getString(R.string.progress_verifying_signature),
+ ProgressDialog.STYLE_HORIZONTAL,
+ ProgressDialogFragment.ServiceType.KEYCHAIN_INTENT) {
public void handleMessage(Message message) {
// handle messages by standard KeychainIntentServiceHandler first
super.handleMessage(message);
if (message.arg1 == MessageStatus.OKAY.ordinal()) {
Bundle returnData = message.getData();
- String msg = returnData.getString(KeychainIntentServiceHandler.DATA_MESSAGE);
+ String msg = returnData.getString(ServiceProgressHandler.DATA_MESSAGE);
SpannableStringBuilder ssb = new SpannableStringBuilder();
if ((msg != null) && msg.equals("OK")) {
//yay
- String proofUrl = returnData.getString(KeychainIntentServiceHandler.KEYBASE_PROOF_URL);
- String presenceUrl = returnData.getString(KeychainIntentServiceHandler.KEYBASE_PRESENCE_URL);
- String presenceLabel = returnData.getString(KeychainIntentServiceHandler.KEYBASE_PRESENCE_LABEL);
+ String proofUrl = returnData.getString(ServiceProgressHandler.KEYBASE_PROOF_URL);
+ String presenceUrl = returnData.getString(ServiceProgressHandler.KEYBASE_PRESENCE_URL);
+ String presenceLabel = returnData.getString(ServiceProgressHandler.KEYBASE_PRESENCE_LABEL);
String proofLabel;
switch (proof.getType()) {
@@ -429,7 +432,7 @@ public class ViewKeyTrustFragment extends LoaderFragment implements
ssb.append(" ").append(getString(R.string.keybase_contained_signature));
} else {
// verification failed!
- msg = returnData.getString(KeychainIntentServiceHandler.DATA_ERROR);
+ msg = returnData.getString(ServiceProgressHandler.DATA_ERROR);
ssb.append(getString(R.string.keybase_proof_failure));
if (msg == null) {
msg = getString(R.string.keybase_unknown_proof_failure);
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/DeleteKeyDialogFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/DeleteKeyDialogFragment.java
index f512ecca2..581a96e52 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/DeleteKeyDialogFragment.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/DeleteKeyDialogFragment.java
@@ -37,7 +37,7 @@ import org.sufficientlysecure.keychain.pgp.KeyRing;
import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings;
import org.sufficientlysecure.keychain.provider.ProviderHelper;
import org.sufficientlysecure.keychain.service.KeychainIntentService;
-import org.sufficientlysecure.keychain.service.KeychainIntentServiceHandler;
+import org.sufficientlysecure.keychain.service.ServiceProgressHandler;
import org.sufficientlysecure.keychain.util.Log;
import java.util.HashMap;
@@ -135,9 +135,12 @@ public class DeleteKeyDialogFragment extends DialogFragment {
intent.setAction(KeychainIntentService.ACTION_DELETE);
// Message is received after importing is done in KeychainIntentService
- KeychainIntentServiceHandler saveHandler = new KeychainIntentServiceHandler(
- getActivity(), getString(R.string.progress_deleting),
- ProgressDialog.STYLE_HORIZONTAL, true) {
+ ServiceProgressHandler saveHandler = new ServiceProgressHandler(
+ getActivity(),
+ getString(R.string.progress_deleting),
+ ProgressDialog.STYLE_HORIZONTAL,
+ true,
+ ProgressDialogFragment.ServiceType.KEYCHAIN_INTENT) {
@Override
public void handleMessage(Message message) {
super.handleMessage(message);
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/ProgressDialogFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/ProgressDialogFragment.java
index df7943f55..b58f584c8 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/ProgressDialogFragment.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/ProgressDialogFragment.java
@@ -32,23 +32,43 @@ import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
+import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R;
+import org.sufficientlysecure.keychain.service.CloudImportService;
import org.sufficientlysecure.keychain.service.KeychainIntentService;
+import org.sufficientlysecure.keychain.util.Log;
public class ProgressDialogFragment extends DialogFragment {
private static final String ARG_MESSAGE = "message";
private static final String ARG_STYLE = "style";
private static final String ARG_CANCELABLE = "cancelable";
+ private static final String ARG_SERVICE_TYPE = "service_class";
+
+ public static enum ServiceType {
+ KEYCHAIN_INTENT,
+ CLOUD_IMPORT
+ }
+
+ ServiceType mServiceType;
boolean mCanCancel = false, mPreventCancel = false, mIsCancelled = false;
- /** Creates new instance of this fragment */
- public static ProgressDialogFragment newInstance(String message, int style, boolean cancelable) {
+ /**
+ * creates a new instance of this fragment
+ * @param message the message to be displayed initially above the progress bar
+ * @param style the progress bar style, as defined in ProgressDialog (horizontal or spinner)
+ * @param cancelable should we let the user cancel this operation
+ * @param serviceType which Service this progress dialog is meant for
+ * @return
+ */
+ public static ProgressDialogFragment newInstance(String message, int style, boolean cancelable,
+ ServiceType serviceType) {
ProgressDialogFragment frag = new ProgressDialogFragment();
Bundle args = new Bundle();
args.putString(ARG_MESSAGE, message);
args.putInt(ARG_STYLE, style);
args.putBoolean(ARG_CANCELABLE, cancelable);
+ args.putSerializable(ARG_SERVICE_TYPE, serviceType);
frag.setArguments(args);
@@ -106,6 +126,7 @@ public class ProgressDialogFragment extends DialogFragment {
String message = getArguments().getString(ARG_MESSAGE);
int style = getArguments().getInt(ARG_STYLE);
mCanCancel = getArguments().getBoolean(ARG_CANCELABLE);
+ mServiceType = (ServiceType) getArguments().getSerializable(ARG_SERVICE_TYPE);
dialog.setMessage(message);
dialog.setProgressStyle(style);
@@ -175,9 +196,22 @@ public class ProgressDialogFragment extends DialogFragment {
// send a cancel message. note that this message will be handled by
// KeychainIntentService.onStartCommand, which runs in this thread,
// not the service one, and will not queue up a command.
- Intent intent = new Intent(getActivity(), KeychainIntentService.class);
- intent.setAction(KeychainIntentService.ACTION_CANCEL);
- getActivity().startService(intent);
+ Intent serviceIntent = null;
+
+ switch (mServiceType) {
+ case CLOUD_IMPORT:
+ serviceIntent = new Intent(getActivity(), CloudImportService.class);
+ break;
+ case KEYCHAIN_INTENT:
+ serviceIntent = new Intent(getActivity(), KeychainIntentService.class);
+ break;
+ default:
+ //should never happen, unless we forget to include a ServiceType enum case
+ Log.e(Constants.TAG, "Unrecognized ServiceType at ProgressDialogFragment");
+ }
+
+ serviceIntent.setAction(KeychainIntentService.ACTION_CANCEL);
+ getActivity().startService(serviceIntent);
}
});
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/linked/LinkedIdCreateFinalFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/linked/LinkedIdCreateFinalFragment.java
index 4f10102ae..ac7dff9bd 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/linked/LinkedIdCreateFinalFragment.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/linked/LinkedIdCreateFinalFragment.java
@@ -25,13 +25,13 @@ import org.sufficientlysecure.keychain.pgp.WrappedUserAttribute;
import org.sufficientlysecure.keychain.pgp.linked.LinkedCookieResource;
import org.sufficientlysecure.keychain.pgp.linked.LinkedIdentity;
import org.sufficientlysecure.keychain.service.KeychainIntentService;
-import org.sufficientlysecure.keychain.service.KeychainIntentServiceHandler;
import org.sufficientlysecure.keychain.service.SaveKeyringParcel;
+import org.sufficientlysecure.keychain.service.ServiceProgressHandler;
import org.sufficientlysecure.keychain.ui.PassphraseDialogActivity;
+import org.sufficientlysecure.keychain.ui.dialog.ProgressDialogFragment.ServiceType;
import org.sufficientlysecure.keychain.ui.util.Notify;
import org.sufficientlysecure.keychain.util.Passphrase;
-
public abstract class LinkedIdCreateFinalFragment extends Fragment {
protected static final int REQUEST_CODE_PASSPHRASE = 0x00007008;
@@ -187,11 +187,11 @@ public abstract class LinkedIdCreateFinalFragment extends Fragment {
}
private void certifyLinkedIdentity (Passphrase passphrase) {
- KeychainIntentServiceHandler saveHandler = new KeychainIntentServiceHandler(
+ ServiceProgressHandler saveHandler = new ServiceProgressHandler(
getActivity(),
getString(R.string.progress_saving),
ProgressDialog.STYLE_HORIZONTAL,
- true) {
+ true, ServiceType.KEYCHAIN_INTENT) {
public void handleMessage(Message message) {
// handle messages by standard KeychainIntentServiceHandler first
super.handleMessage(message);
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/linked/LinkedIdViewFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/linked/LinkedIdViewFragment.java
index 3a83939e7..0ef63f724 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/linked/LinkedIdViewFragment.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/linked/LinkedIdViewFragment.java
@@ -45,8 +45,8 @@ import org.sufficientlysecure.keychain.provider.KeychainDatabase.Tables;
import org.sufficientlysecure.keychain.service.CertifyActionsParcel;
import org.sufficientlysecure.keychain.service.CertifyActionsParcel.CertifyAction;
import org.sufficientlysecure.keychain.service.KeychainIntentService;
-import org.sufficientlysecure.keychain.service.KeychainIntentServiceHandler;
import org.sufficientlysecure.keychain.service.PassphraseCacheService;
+import org.sufficientlysecure.keychain.service.ServiceProgressHandler;
import org.sufficientlysecure.keychain.ui.PassphraseDialogActivity;
import org.sufficientlysecure.keychain.ui.adapter.LinkedIdsAdapter;
import org.sufficientlysecure.keychain.ui.adapter.UserIdsAdapter;
@@ -583,7 +583,7 @@ public class LinkedIdViewFragment extends Fragment implements
intent.putExtra(KeychainIntentService.EXTRA_DATA, data);
// Message is received after signing is done in KeychainIntentService
- KeychainIntentServiceHandler saveHandler = new KeychainIntentServiceHandler(getActivity()) {
+ ServiceProgressHandler saveHandler = new ServiceProgressHandler(getActivity()) {
public void handleMessage(Message message) {
// handle messages by standard KeychainIntentServiceHandler first
super.handleMessage(message);
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/CertListWidget.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/CertListWidget.java
index 0f33a3b8a..c413a00be 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/CertListWidget.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/CertListWidget.java
@@ -15,7 +15,7 @@ import android.widget.ListView;
import android.widget.TextView;
import android.widget.ViewAnimator;
-import com.ocpsoft.pretty.time.PrettyTime;
+import org.ocpsoft.prettytime.PrettyTime;
import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.provider.KeychainContract;
import org.sufficientlysecure.keychain.provider.KeychainContract.Certs;