use autovalue for InputDataParcel and SignEncryptParcel

This commit is contained in:
Vincent Breitmoser
2017-05-23 15:04:04 +02:00
parent 040a5a2006
commit 9d485dfe9f
8 changed files with 79 additions and 146 deletions

View File

@@ -639,7 +639,7 @@ public class DecryptListFragment
PgpDecryptVerifyInputParcel decryptInput = new PgpDecryptVerifyInputParcel()
.setAllowSymmetricDecryption(true);
return new InputDataParcel(mCurrentInputUri, decryptInput);
return InputDataParcel.createInputDataParcel(mCurrentInputUri, decryptInput);
}

View File

@@ -577,12 +577,10 @@ public class EncryptFilesFragment
}
public SignEncryptParcel createOperationInput() {
SignEncryptParcel actionsParcel = getCachedActionsParcel();
// we have three cases here: nothing cached, cached except output, fully cached
if (actionsParcel == null) {
// clear output uris for now, they will be created by prepareOutputStreams later
mOutputUris = null;
@@ -593,7 +591,6 @@ public class EncryptFilesFragment
}
cacheActionsParcel(actionsParcel);
}
// if it's incomplete, prepare output streams
@@ -606,9 +603,10 @@ public class EncryptFilesFragment
}
}
actionsParcel.addOutputUris(mOutputUris);
actionsParcel = SignEncryptParcel.builder(actionsParcel)
.addOutputUris(mOutputUris)
.build();
cacheActionsParcel(actionsParcel);
}
return actionsParcel;
@@ -675,10 +673,9 @@ public class EncryptFilesFragment
}
SignEncryptParcel parcel = new SignEncryptParcel(data.build());
parcel.addInputUris(mFilesAdapter.getAsArrayList());
return parcel;
SignEncryptParcel.Builder builder = SignEncryptParcel.builder(data.build());
builder.addInputUris(mFilesAdapter.getAsArrayList());
return builder.build();
}
private Intent createSendIntent() {

View File

@@ -17,6 +17,11 @@
package org.sufficientlysecure.keychain.ui;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import android.app.Activity;
import android.content.ClipData;
import android.content.ClipboardManager;
@@ -49,10 +54,6 @@ import org.sufficientlysecure.keychain.ui.util.Notify.Style;
import org.sufficientlysecure.keychain.util.Passphrase;
import org.sufficientlysecure.keychain.util.Preferences;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
public class EncryptTextFragment
extends CachingCryptoOperationFragment<SignEncryptParcel, SignEncryptResult> {
@@ -286,10 +287,7 @@ public class EncryptTextFragment
data.setSymmetricPassphrase(passphrase);
}
SignEncryptParcel parcel = new SignEncryptParcel(data.build());
parcel.setBytes(mMessage.getBytes());
return parcel;
return SignEncryptParcel.createSignEncryptParcel(data.build(), mMessage.getBytes());
}
private void copyToClipboard(SignEncryptResult result) {