File extensions into Constants

This commit is contained in:
Dominik Schürmann 2015-03-17 13:22:13 +01:00
parent 025eaf0757
commit 444123d040
5 changed files with 19 additions and 13 deletions

View File

@ -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";

View File

@ -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;

View File

@ -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);
}

View File

@ -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++;
}

View File

@ -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);
}