mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-12-24 07:58:50 -05:00
remove bundle for symmetric/asymmetric fragment as it was useless
This commit is contained in:
parent
e8b7bbd978
commit
f34597a3c0
@ -81,8 +81,6 @@ public class EncryptActivity extends DrawerActivity implements EncryptActivityIn
|
||||
PagerTabStripAdapter mTabsAdapterContent;
|
||||
|
||||
// tabs
|
||||
Bundle mAsymmetricFragmentBundle = new Bundle();
|
||||
Bundle mSymmetricFragmentBundle = new Bundle();
|
||||
int mSwitchToMode = PAGER_MODE_ASYMMETRIC;
|
||||
int mSwitchToContent = PAGER_CONTENT_MESSAGE;
|
||||
|
||||
@ -91,7 +89,7 @@ public class EncryptActivity extends DrawerActivity implements EncryptActivityIn
|
||||
private static final int PAGER_CONTENT_MESSAGE = 0;
|
||||
private static final int PAGER_CONTENT_FILE = 1;
|
||||
|
||||
// model used by message and file fragments
|
||||
// model used by fragments
|
||||
private long mEncryptionKeyIds[] = null;
|
||||
private String mEncryptionUserIds[] = null;
|
||||
private long mSigningKeyId = Constants.key.none;
|
||||
@ -501,10 +499,8 @@ public class EncryptActivity extends DrawerActivity implements EncryptActivityIn
|
||||
// Handle intent actions
|
||||
handleActions(getIntent());
|
||||
|
||||
mTabsAdapterMode.addTab(EncryptAsymmetricFragment.class,
|
||||
mAsymmetricFragmentBundle, getString(R.string.label_asymmetric));
|
||||
mTabsAdapterMode.addTab(EncryptSymmetricFragment.class,
|
||||
mSymmetricFragmentBundle, getString(R.string.label_symmetric));
|
||||
mTabsAdapterMode.addTab(EncryptAsymmetricFragment.class, null, getString(R.string.label_asymmetric));
|
||||
mTabsAdapterMode.addTab(EncryptSymmetricFragment.class, null, getString(R.string.label_symmetric));
|
||||
mViewPagerMode.setCurrentItem(mSwitchToMode);
|
||||
|
||||
mTabsAdapterContent.addTab(EncryptMessageFragment.class, null, getString(R.string.label_message));
|
||||
@ -600,14 +596,10 @@ public class EncryptActivity extends DrawerActivity implements EncryptActivityIn
|
||||
|
||||
String textData = extras.getString(EXTRA_TEXT);
|
||||
|
||||
long signatureKeyId = extras.getLong(EXTRA_SIGNATURE_KEY_ID);
|
||||
long[] encryptionKeyIds = extras.getLongArray(EXTRA_ENCRYPTION_KEY_IDS);
|
||||
mSigningKeyId = extras.getLong(EXTRA_SIGNATURE_KEY_ID);
|
||||
mEncryptionKeyIds = extras.getLongArray(EXTRA_ENCRYPTION_KEY_IDS);
|
||||
|
||||
// preselect keys given by intent
|
||||
mAsymmetricFragmentBundle.putLongArray(EncryptAsymmetricFragment.ARG_ENCRYPTION_KEY_IDS,
|
||||
encryptionKeyIds);
|
||||
mAsymmetricFragmentBundle.putLong(EncryptAsymmetricFragment.ARG_SIGNATURE_KEY_ID,
|
||||
signatureKeyId);
|
||||
mSwitchToMode = PAGER_MODE_ASYMMETRIC;
|
||||
|
||||
/**
|
||||
|
@ -123,14 +123,10 @@ public class EncryptAsymmetricFragment extends Fragment implements EncryptActivi
|
||||
@Override
|
||||
public void onActivityCreated(Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
|
||||
long signatureKeyId = getArguments().getLong(ARG_SIGNATURE_KEY_ID);
|
||||
long[] encryptionKeyIds = getArguments().getLongArray(ARG_ENCRYPTION_KEY_IDS);
|
||||
|
||||
mProviderHelper = new ProviderHelper(getActivity());
|
||||
|
||||
// preselect keys given by arguments (given by Intent to EncryptActivity)
|
||||
preselectKeys(signatureKeyId, encryptionKeyIds, mProviderHelper);
|
||||
// preselect keys given
|
||||
preselectKeys();
|
||||
|
||||
getLoaderManager().initLoader(1, null, new LoaderManager.LoaderCallbacks<Cursor>() {
|
||||
@Override
|
||||
@ -187,19 +183,15 @@ public class EncryptAsymmetricFragment extends Fragment implements EncryptActivi
|
||||
|
||||
/**
|
||||
* If an Intent gives a signatureMasterKeyId and/or encryptionMasterKeyIds, preselect those!
|
||||
*
|
||||
* @param preselectedSignatureKeyId
|
||||
* @param preselectedEncryptionKeyIds
|
||||
*/
|
||||
private void preselectKeys(long preselectedSignatureKeyId, long[] preselectedEncryptionKeyIds,
|
||||
ProviderHelper providerHelper) {
|
||||
private void preselectKeys() {
|
||||
// TODO all of this works under the assumption that the first suitable subkey is always used!
|
||||
// not sure if we need to distinguish between different subkeys here?
|
||||
if (preselectedSignatureKeyId != 0) {
|
||||
long signatureKey = mEncryptInterface.getSignatureKey();
|
||||
if (signatureKey != Constants.key.none) {
|
||||
try {
|
||||
CachedPublicKeyRing keyring =
|
||||
providerHelper.getCachedPublicKeyRing(
|
||||
KeyRings.buildUnifiedKeyRingUri(preselectedSignatureKeyId));
|
||||
CachedPublicKeyRing keyring = mProviderHelper.getCachedPublicKeyRing(
|
||||
KeyRings.buildUnifiedKeyRingUri(signatureKey));
|
||||
if(keyring.hasAnySecret()) {
|
||||
setSignatureKeyId(keyring.getMasterKeyId());
|
||||
}
|
||||
@ -208,10 +200,11 @@ public class EncryptAsymmetricFragment extends Fragment implements EncryptActivi
|
||||
}
|
||||
}
|
||||
|
||||
if (preselectedEncryptionKeyIds != null) {
|
||||
for (long preselectedId : preselectedEncryptionKeyIds) {
|
||||
long[] encryptionKeyIds = mEncryptInterface.getEncryptionKeys();
|
||||
if (encryptionKeyIds != null) {
|
||||
for (long preselectedId : encryptionKeyIds) {
|
||||
try {
|
||||
CachedPublicKeyRing ring = providerHelper.getCachedPublicKeyRing(
|
||||
CachedPublicKeyRing ring = mProviderHelper.getCachedPublicKeyRing(
|
||||
KeyRings.buildUnifiedKeyRingsFindBySubkeyUri(preselectedId));
|
||||
mEncryptKeyView.addObject(mEncryptKeyView.new EncryptionKey(ring));
|
||||
} catch (PgpGeneralException e) {
|
||||
|
Loading…
Reference in New Issue
Block a user