diff options
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain')
-rw-r--r-- | OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/BackupCodeFragment.java | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/BackupCodeFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/BackupCodeFragment.java index 50ad95540..438607b13 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/BackupCodeFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/BackupCodeFragment.java @@ -426,8 +426,12 @@ public class BackupCodeFragment extends CryptoOperationFragment<ExportKeyringPar return; } + String date = new SimpleDateFormat("yyyy-MM-dd", Locale.getDefault()).format(new Date()); + String filename = "backup_" + date + + (mExportSecret ? Constants.FILE_EXTENSION_PGP_MAIN : ".pub" + Constants.FILE_EXTENSION_PGP_MAIN); + if (mCachedBackupUri == null) { - mCachedBackupUri = TemporaryFileProvider.createFile(activity); + mCachedBackupUri = TemporaryFileProvider.createFile(activity, filename, Constants.ENCRYPTED_FILES_MIME); cryptoOperation(); return; } @@ -438,21 +442,17 @@ public class BackupCodeFragment extends CryptoOperationFragment<ExportKeyringPar intent.putExtra(Intent.EXTRA_STREAM, mCachedBackupUri); startActivity(intent); } else { - saveFile(false); + saveFile(filename, false); } } - private void saveFile(boolean overwrite) { + private void saveFile(final String filename, boolean overwrite) { FragmentActivity activity = getActivity(); if (activity == null) { return; } - String date = new SimpleDateFormat("yyyy-MM-dd", Locale.getDefault()).format(new Date()); - String filename = "backup_" + date - + (mExportSecret ? Constants.FILE_EXTENSION_PGP_MAIN : ".pub" + Constants.FILE_EXTENSION_PGP_MAIN); - // for kitkat and above, we have the document api if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { FileHelper.saveDocument(this, "application/octet-stream", filename, REQUEST_SAVE); @@ -465,7 +465,7 @@ public class BackupCodeFragment extends CryptoOperationFragment<ExportKeyringPar Notify.create(activity, R.string.snack_backup_exists, Style.WARN, new ActionListener() { @Override public void onAction() { - saveFile(true); + saveFile(filename, true); } }, R.string.snack_btn_overwrite).show(); return; |