DecryptFilesActivity

This commit is contained in:
Dominik Schürmann 2014-09-24 00:02:00 +02:00
parent 0143b54e9e
commit 7c82e1c728
3 changed files with 21 additions and 14 deletions

View File

@ -348,12 +348,28 @@ public class DecryptFilesFragment extends DecryptFragment {
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
switch (requestCode) {
case REQUEST_CODE_PASSPHRASE: {
if (resultCode == Activity.RESULT_OK && data != null) {
String passphrase = data.getStringExtra(PassphraseDialogActivity.MESSAGE_DATA_PASSPHRASE);
decryptOriginalFilename(passphrase);
}
return;
}
case REQUEST_CODE_NFC: {
if (resultCode == Activity.RESULT_OK && data != null) {
// TODO
}
return;
}
case REQUEST_CODE_INPUT: {
if (resultCode == Activity.RESULT_OK && data != null) {
setInputUri(data.getData());
}
return;
}
case REQUEST_CODE_OUTPUT: {
// This happens after output file was selected, so start our operation
if (resultCode == Activity.RESULT_OK && data != null) {
@ -365,8 +381,6 @@ public class DecryptFilesFragment extends DecryptFragment {
default: {
super.onActivityResult(requestCode, resultCode, data);
break;
}
}
}

View File

@ -90,13 +90,13 @@ public class DecryptTextFragment extends DecryptFragment {
}
/**
* Create Intent Chooser but exclude OK's EncryptActivity.
* Create Intent Chooser but exclude decrypt activites
*/
private Intent sendWithChooserExcludingEncrypt(String text) {
Intent prototype = createSendIntent(text);
String title = getString(R.string.title_share_file);
// we don't want to encrypt the encrypted, no inception ;)
// we don't want to decrypt the decypted, no inception ;)
String[] blacklist = new String[]{
Constants.PACKAGE_NAME + ".ui.DecryptTextActivity",
"org.thialfihar.android.apg.ui.DecryptActivity"
@ -211,27 +211,23 @@ public class DecryptTextFragment extends DecryptFragment {
if (resultCode == Activity.RESULT_OK && data != null) {
String passphrase = data.getStringExtra(PassphraseDialogActivity.MESSAGE_DATA_PASSPHRASE);
decryptStart(passphrase);
return;
} else {
getActivity().finish();
}
break;
return;
}
case REQUEST_CODE_NFC: {
if (resultCode == Activity.RESULT_OK && data != null) {
// TODO
return;
} else {
getActivity().finish();
}
break;
return;
}
default: {
super.onActivityResult(requestCode, resultCode, data);
break;
}
}
}

View File

@ -191,8 +191,6 @@ public class EncryptFilesActivity extends EncryptActivity implements EncryptActi
super.handleMessage(message);
if (message.arg1 == KeychainIntentServiceHandler.MESSAGE_OKAY) {
Notify.showNotify(EncryptFilesActivity.this, R.string.encrypt_sign_successful, Notify.Style.INFO);
SignEncryptResult pgpResult =
message.getData().getParcelable(SignEncryptResult.EXTRA_RESULT);
@ -224,8 +222,7 @@ public class EncryptFilesActivity extends EncryptActivity implements EncryptActi
startActivity(sendWithChooserExcludingEncrypt(message));
} else {
// Save encrypted file
Notify.showNotify(EncryptFilesActivity.this,
R.string.encrypt_sign_clipboard_successful, Notify.Style.INFO);
pgpResult.createNotify(EncryptFilesActivity.this).show();
}
} else {
pgpResult.createNotify(EncryptFilesActivity.this).show();