From 444123d040d2288628e38beaf06cc05ce5768617 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Tue, 17 Mar 2015 13:22:13 +0100 Subject: File extensions into Constants --- .../main/java/org/sufficientlysecure/keychain/Constants.java | 4 ++++ .../sufficientlysecure/keychain/ui/DecryptFilesFragment.java | 4 +++- .../sufficientlysecure/keychain/ui/EncryptFilesActivity.java | 10 +++++----- .../sufficientlysecure/keychain/ui/EncryptFilesFragment.java | 4 ++-- .../sufficientlysecure/keychain/ui/EncryptTextActivity.java | 10 +++++----- 5 files changed, 19 insertions(+), 13 deletions(-) (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain') diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/Constants.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/Constants.java index 2ae20bec3..fc1cb8acc 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/Constants.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/Constants.java @@ -47,6 +47,10 @@ public final class Constants { public static final String ENCRYPTED_FILES_MIME = "application/octet-stream"; public static final String ENCRYPTED_TEXT_MIME = "text/plain"; + public static final String FILE_EXTENSION_PGP_MAIN = ".gpg"; + public static final String FILE_EXTENSION_PGP_ALTERNATE = ".pgp"; + public static final String FILE_EXTENSION_ASC = ".asc"; + // used by QR Codes (Guardian Project, Monkeysphere compatiblity) public static final String FINGERPRINT_SCHEME = "openpgp4fpr"; 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 c808557a6..7e33843ea 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptFilesFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptFilesFragment.java @@ -147,7 +147,9 @@ public class DecryptFilesFragment extends DecryptFragment { } private String removeEncryptedAppend(String name) { - if (name.endsWith(".asc") || name.endsWith(".gpg") || name.endsWith(".pgp")) { + if (name.endsWith(Constants.FILE_EXTENSION_ASC) + || name.endsWith(Constants.FILE_EXTENSION_PGP_MAIN) + || name.endsWith(Constants.FILE_EXTENSION_PGP_ALTERNATE)) { return name.substring(0, name.length() - 4); } return name; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptFilesActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptFilesActivity.java index 4deaed736..f1784fab3 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptFilesActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptFilesActivity.java @@ -391,11 +391,11 @@ public class EncryptFilesActivity extends EncryptActivity implements EncryptActi notifyUpdate(); break; } - case R.id.check_hidden_recipients: { - mHiddenRecipients = item.isChecked(); - notifyUpdate(); - break; - } +// case R.id.check_hidden_recipients: { +// mHiddenRecipients = item.isChecked(); +// notifyUpdate(); +// break; +// } default: { return super.onOptionsItemSelected(item); } diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptFilesFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptFilesFragment.java index 6ea6ecec1..9c9b44511 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptFilesFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptFilesFragment.java @@ -139,7 +139,7 @@ public class EncryptFilesFragment extends Fragment implements EncryptActivityInt Uri inputUri = mEncryptInterface.getInputUris().get(0); String targetName = (mEncryptInterface.isEncryptFilenames() ? "1" : FileHelper.getFilename(getActivity(), inputUri)) - + (mEncryptInterface.isUseArmor() ? ".asc" : ".gpg"); + + (mEncryptInterface.isUseArmor() ? Constants.FILE_EXTENSION_ASC : Constants.FILE_EXTENSION_PGP_MAIN); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) { File file = new File(inputUri.getPath()); File parentDir = file.exists() ? file.getParentFile() : Constants.Path.APP_DIR; @@ -162,7 +162,7 @@ public class EncryptFilesFragment extends Fragment implements EncryptActivityInt for (Uri uri : mEncryptInterface.getInputUris()) { String targetName = (mEncryptInterface.isEncryptFilenames() ? String.valueOf(filenameCounter) : FileHelper.getFilename(getActivity(), uri)) - + (mEncryptInterface.isUseArmor() ? ".asc" : ".gpg"); + + (mEncryptInterface.isUseArmor() ? Constants.FILE_EXTENSION_ASC : Constants.FILE_EXTENSION_PGP_MAIN); mEncryptInterface.getOutputUris().add(TemporaryStorageProvider.createFile(getActivity(), targetName)); filenameCounter++; } 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 05132b50c..14f2c492d 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptTextActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptTextActivity.java @@ -366,11 +366,11 @@ public class EncryptTextActivity extends EncryptActivity implements EncryptActiv notifyUpdate(); break; } - case R.id.check_hidden_recipients: { - mHiddenRecipients = item.isChecked(); - notifyUpdate(); - break; - } +// case R.id.check_hidden_recipients: { +// mHiddenRecipients = item.isChecked(); +// notifyUpdate(); +// break; +// } default: { return super.onOptionsItemSelected(item); } -- cgit v1.2.3