aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain/src/main/java/org/sufficientlysecure
diff options
context:
space:
mode:
authorVincent Breitmoser <valodim@mugenguild.com>2015-06-30 15:15:03 +0200
committerVincent Breitmoser <valodim@mugenguild.com>2015-06-30 15:15:03 +0200
commitf1c0c3e00c7287cdc501cd9148461f4c1ef1d8ec (patch)
tree0b969d31f062079f04db72b96a4a8ade2959e4f8 /OpenKeychain/src/main/java/org/sufficientlysecure
parent27441c7d63175255d1a50e96ad6418592666a3db (diff)
downloadopen-keychain-f1c0c3e00c7287cdc501cd9148461f4c1ef1d8ec.tar.gz
open-keychain-f1c0c3e00c7287cdc501cd9148461f4c1ef1d8ec.tar.bz2
open-keychain-f1c0c3e00c7287cdc501cd9148461f4c1ef1d8ec.zip
earlier error on empty clipboard
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure')
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptDecryptOverviewFragment.java22
1 files changed, 19 insertions, 3 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptDecryptOverviewFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptDecryptOverviewFragment.java
index 590d02c6f..44ca50e6c 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptDecryptOverviewFragment.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptDecryptOverviewFragment.java
@@ -37,6 +37,7 @@ import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.compatibility.ClipboardReflection;
import org.sufficientlysecure.keychain.pgp.PgpHelper;
import org.sufficientlysecure.keychain.ui.util.Notify;
+import org.sufficientlysecure.keychain.ui.util.Notify.Style;
import org.sufficientlysecure.keychain.ui.util.SubtleAttentionSeeker;
import org.sufficientlysecure.keychain.util.FileHelper;
@@ -92,15 +93,30 @@ public class EncryptDecryptOverviewFragment extends Fragment {
mDecryptFromClipboard.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
- Intent clipboardDecrypt = new Intent(getActivity(), DecryptActivity.class);
- clipboardDecrypt.setAction(DecryptActivity.ACTION_DECRYPT_FROM_CLIPBOARD);
- startActivityForResult(clipboardDecrypt, 0);
+ decryptFromClipboard();
}
});
return view;
}
+ private void decryptFromClipboard() {
+
+ Activity activity = getActivity();
+ if (activity == null) {
+ return;
+ }
+
+ final CharSequence clipboardText = ClipboardReflection.getClipboardText(activity);
+ if (clipboardText == null) {
+ Notify.create(activity, R.string.error_clipboard_empty, Style.ERROR);
+ }
+
+ Intent clipboardDecrypt = new Intent(getActivity(), DecryptActivity.class);
+ clipboardDecrypt.setAction(DecryptActivity.ACTION_DECRYPT_FROM_CLIPBOARD);
+ startActivityForResult(clipboardDecrypt, 0);
+ }
+
@Override
public void onResume() {
super.onResume();