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