pass CryptoInputParcel independently for SignEncryptOperation

This commit is contained in:
Vincent Breitmoser
2015-03-30 16:40:41 +02:00
parent 2050be3995
commit d7b79e55fb
10 changed files with 35 additions and 90 deletions

View File

@@ -106,7 +106,7 @@ public abstract class EncryptActivity extends BaseActivity {
startEncrypt(null);
}
public void startEncrypt(CryptoInputParcel cryptoInput) {
public void startEncrypt(final CryptoInputParcel cryptoInput) {
if (!inputIsValid()) {
// Notify was created by inputIsValid.
return;
@@ -117,12 +117,10 @@ public abstract class EncryptActivity extends BaseActivity {
intent.setAction(KeychainIntentService.ACTION_SIGN_ENCRYPT);
final SignEncryptParcel input = createEncryptBundle();
if (cryptoInput != null) {
input.setCryptoInput(cryptoInput);
}
Bundle data = new Bundle();
data.putParcelable(KeychainIntentService.SIGN_ENCRYPT_PARCEL, input);
data.putParcelable(KeychainIntentService.EXTRA_CRYPTO_INPUT, cryptoInput);
intent.putExtra(KeychainIntentService.EXTRA_DATA, data);
// Message is received after encrypting is done in KeychainIntentService
@@ -151,7 +149,7 @@ public abstract class EncryptActivity extends BaseActivity {
RequiredInputParcel parcel = RequiredInputParcel.createNfcSignOperation(
pgpResult.getNfcHash(),
pgpResult.getNfcAlgo(),
input.getSignatureTime());
cryptoInput.getSignatureTime());
startNfcSign(pgpResult.getNfcKeyId(), parcel);
} else {

View File

@@ -93,8 +93,8 @@ public class EncryptFilesFragment extends CryptoOperationFragment {
private long mSigningKeyId = Constants.key.none;
private Passphrase mPassphrase = new Passphrase();
private ArrayList<Uri> mInputUris = new ArrayList<Uri>();
private ArrayList<Uri> mOutputUris = new ArrayList<Uri>();
private ArrayList<Uri> mInputUris = new ArrayList<>();
private ArrayList<Uri> mOutputUris = new ArrayList<>();
private ListView mSelectedFiles;
private SelectedFilesAdapter mAdapter = new SelectedFilesAdapter();
@@ -136,7 +136,7 @@ public class EncryptFilesFragment extends CryptoOperationFragment {
try {
mModeInterface = (IMode) activity;
} catch (ClassCastException e) {
throw new ClassCastException(activity.toString() + " must be IMode");
throw new ClassCastException(activity + " must be IMode");
}
}
@@ -487,12 +487,10 @@ public class EncryptFilesFragment extends CryptoOperationFragment {
intent.setAction(KeychainIntentService.ACTION_SIGN_ENCRYPT);
final SignEncryptParcel input = createEncryptBundle();
if (cryptoInput != null) {
input.setCryptoInput(cryptoInput);
}
Bundle data = new Bundle();
data.putParcelable(KeychainIntentService.SIGN_ENCRYPT_PARCEL, input);
data.putParcelable(KeychainIntentService.EXTRA_CRYPTO_INPUT, cryptoInput);
intent.putExtra(KeychainIntentService.EXTRA_DATA, data);
// Message is received after encrypting is done in KeychainIntentService

View File

@@ -344,12 +344,9 @@ public class EncryptTextFragment extends CryptoOperationFragment {
intent.setAction(KeychainIntentService.ACTION_SIGN_ENCRYPT);
final SignEncryptParcel input = createEncryptBundle();
if (cryptoInput != null) {
input.setCryptoInput(cryptoInput);
}
final Bundle data = new Bundle();
data.putParcelable(KeychainIntentService.SIGN_ENCRYPT_PARCEL, input);
data.putParcelable(KeychainIntentService.EXTRA_CRYPTO_INPUT, cryptoInput);
intent.putExtra(KeychainIntentService.EXTRA_DATA, data);
// Message is received after encrypting is done in KeychainIntentService